
;  GNU C 2.7.2 [AL 1.1, MM 40] RISC NEWS-OS compiled by CC

;  Cc1 defaults:
;  -mmemcpy

;  Cc1 arguments (-G value = 0, Cpu = 3000, ISA = 1):
;  -quiet -dumpbase -O2 -Wall -o

gcc2_compiled.:
__gnu_compiled_c:
	.code
	.align	1
	.global	gsm_play
gsm_play:
;	.frame	%sp,24,$31		# vars= 4, regs= 5/0, args= 0, extra= 0
;	.mask	0x800f0000,-4
;	.fmask	0x00000000,0
	pushn	%r3
	sub	%sp,0x1		; 	xsub	%sp,%sp,4
	ld.w	%r3,%r12
	ld.w	%r0,%r13
	ld.w	[%sp+0x0],%r14	; 	xld.w	[%sp],%r14
	ext	gsm_info+0x0@h	; 	xld.w	%r1,gsm_info
	ext	gsm_info+0x0@m
	ld.w	%r1,gsm_info+0x0@l
	ext	gsm_stop@rm	; 	xcall	gsm_stop
	call	gsm_stop@rl
	ld.w	%r12,%r1
	ld.w	%r13,0x0
	ext	0x1a		; 	xld.w	%r14,0x000006b4		; 1716
	ld.w	%r14,0x34
	ext	memset@rm	; 	xcall	memset
	call	memset@rl
	ext	0x8		; 	xadd	%r2,%r1,8
	add	%r2,%r1
	ld.w	%r12,%r2
	ld.w	%r13,%r0
	ld.w	%r14,0x1	; 	xld.w	%r14,0x00000001		; 1
	ext	pceFileOpen@rm	; 	xcall	pceFileOpen
	call	pceFileOpen@rl
	ld.w	%r0,%r10
	cmp	%r0,0x0
	jreq	__LX71		; 	xjreq	__L71
	ld.w	%r10,0x3f	; 	xld.w	%r10,-1			; 0xffffffff
	jp	__LX79		; 	xjp	__L79
__LX71:				; __L71:
	ext	gsm_create@rm	; 	xcall	gsm_create
	call	gsm_create@rl
	ext	gsm_info+0x1c@ah	; 	xld.w	[gsm_info+28],%r10
	ext	gsm_info+0x1c@al
	ld.w	[%r8],%r10
	cmp	%r10,0x0
	jreq	__LX80		; 	xjreq	__L80
	cmp	%r3,0x3		; 	xcmp	%r3,3
	jrule	__LX73		; 	xjrule	__L73
	ld.w	%r12,%r10
	ext	gsm_destroy@rm	; 	xcall	gsm_destroy
	call	gsm_destroy@rl
__LX80:				; __L80:
	ld.w	%r12,%r2
	ext	pceFileClose@rm	; 	xcall	pceFileClose
	call	pceFileClose@rl
	ld.w	%r10,0x3f	; 	xld.w	%r10,-1			; 0xffffffff
	jp	__LX79		; 	xjp	__L79
__LX73:				; __L73:
	ext	gsm_info+0x188@ah	; 	xld.w	[gsm_info+392],%r3
	ext	gsm_info+0x188@al
	ld.w	[%r8],%r3
	ld.ub	%r7,[%sp+0x0]	; 	xld.ub	%r7,[%sp]
	;.set	volatile
	ext	gsm_info+0x7@ah	; 	xld.b	[gsm_info+7],%r7
	ext	gsm_info+0x7@al
	ld.b	[%r8],%r7
	;.set	novolatile
	ld.w	%r12,%r0
	ext	0x18c		; 	xadd	%r15,%r1,396
	add	%r15,%r1
	ld.w	%r6,0x1		; 	xld.w	%r6,0x00000001		; 1
	ext	0xa		; 	xld.w	%r5,0x00000280		; 640
	ld.w	%r5,0x0
	ext	0x6		; 	xld.w	%r4,0x000001b4		; 436
	ld.w	%r4,0x34
	ext	0xc		; 	xadd	%r14,%r15,12
	add	%r14,%r15
	ext	0x4		; 	xadd	%r13,%r15,4
	add	%r13,%r15
__LX77:				; __L77:
	ext	0x1		; 	xld.b	[%r15+1],%r6
	ld.b	[%r15],%r6
	mlt.w	%r12,%r5
	ld.w	%r10,%alr
	add	%r10,%r4
	ld.w	%r7,%r1
	add	%r7,%r10
	ld.w	%r10,%r7
	ld.w	[%r13],%r10	; 	xld.w	[%r13],%r10
	ext	0x5		; 	xld.w	%r10,0x00000140		; 320
	ld.w	%r10,0x0
	ext	0x4		; 	xld.w	[%r13+4],%r10
	ld.w	[%r13],%r10
	add	%r12,0x1	; 	xadd	%r12,%r12,1
	ld.w	%r10,%r12
	srl	%r10,0x8	; 	xsrl	%r10,31
	srl	%r10,0x8
	srl	%r10,0x8
	srl	%r10,0x7
	ld.w	%r7,%r12
	add	%r7,%r10
	ld.w	%r10,%r7
	and	%r10,0x3e	; 	xand	%r10,%r10,0xfffffffe
	ld.w	%r7,%r12
	sub	%r7,%r10
	ld.w	%r10,%r7
	ld.w	%r11,0x14	; 	xld.w	%r11,0x00000014		; 20
	mlt.w	%r10,%r11
	ext	0x6		; 	xld.w	%r0,0x0000018c		; 396
	ld.w	%r0,0xc
	ld.w	%r10,%alr
	add	%r10,%r0
	ld.w	%r7,%r1
	add	%r7,%r10
	ld.w	%r10,%r7
	ld.w	[%r14],%r10	; 	xld.w	[%r14],%r10
	ext	gsm_endproc+0x0@h	; 	xld.w	%r10,gsm_endproc
	ext	gsm_endproc+0x0@m
	ld.w	%r10,gsm_endproc+0x0@l
	ext	0x4		; 	xld.w	[%r14+4],%r10
	ld.w	[%r14],%r10
	add	%r14,0x14	; 	xadd	%r14,%r14,20
	add	%r13,0x14	; 	xadd	%r13,%r13,20
	add	%r15,0x14	; 	xadd	%r15,%r15,20
	cmp	%r12,0x1	; 	xcmp	%r12,1
	jrle	__LX77		; 	xjrle	__L77
	ld.w	%r10,0x2	; 	xld.w	%r10,0x00000002		; 2
	;.set	volatile
	ext	0x5		; 	xld.b	[%r1+5],%r10
	ld.b	[%r1],%r10
	;.set	novolatile
	call	gsm_fill	; 	xcall	gsm_fill
	ext	gsm_fill_busy@rm	; 	xcall	gsm_fill_busy
	call	gsm_fill_busy@rl
; APP
	ld.w %r9,%psr
	and %r9,0xffffffef
	ld.w %psr,%r9
; NO_APP
	ld.w	%r12,0x17	; 	xld.w	%r12,0x00000017		; 23
	ext	gsm_isr+0x0@h	; 	xld.w	%r13,gsm_isr
	ext	gsm_isr+0x0@m
	ld.w	%r13,gsm_isr+0x0@l
	ext	pceVectorSetTrap@rm	; 	xcall	pceVectorSetTrap
	call	pceVectorSetTrap@rl
	ld.w	[%r1],%r10	; 	xld.w	[%r1],%r10
	ext	0x188		; 	xld.w	%r12,[%r1+392]
	ld.w	%r12,[%r1]
	ld.w	%r13,%r1
	add	%r13,%r0
	ext	pceWaveDataOut@rm	; 	xcall	pceWaveDataOut
	call	pceWaveDataOut@rl
; APP
	ld.w %r9,%psr
	or %r9,0x10
	ld.w %psr,%r9
; NO_APP
	ld.w	%r10,0x0
__LX79:				; __L79:
	add	%sp,0x1		; 	xadd	%sp,%sp,4
	popn	%r3
	ret
	.align	1
	.global	gsm_stop
gsm_stop:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ext	gsm_info+0x0@h	; 	xld.w	%r0,gsm_info
	ext	gsm_info+0x0@m
	ld.w	%r0,gsm_info+0x0@l
	ld.w	%r10,[%r0]	; 	xld.w	%r10,[%r0]
	cmp	%r10,0x0
	jreq	__LX81		; 	xjreq	__L81
; APP
	ld.w %r9,%psr
	and %r9,0xffffffef
	ld.w %psr,%r9
; NO_APP
	ext	gsm_info+0x188@ah	; 	xld.w	%r12,[gsm_info+392]
	ext	gsm_info+0x188@al
	ld.w	%r12,[%r8]
	ext	pceWaveAbort@rm	; 	xcall	pceWaveAbort
	call	pceWaveAbort@rl
	ld.w	%r12,0x17	; 	xld.w	%r12,0x00000017		; 23
	ld.w	%r13,[%r0]	; 	xld.w	%r13,[%r0]
	ext	pceVectorSetTrap@rm	; 	xcall	pceVectorSetTrap
	call	pceVectorSetTrap@rl
	ld.w	%r11,0x0
	ld.w	[%r0],%r11	; 	xld.w	[%r0],%r11
; APP
	ld.w %r9,%psr
	or %r9,0x10
	ld.w %psr,%r9
; NO_APP
	ext	gsm_info+0x1c@ah	; 	xld.w	%r12,[gsm_info+28]
	ext	gsm_info+0x1c@al
	ld.w	%r12,[%r8]
	ext	gsm_destroy@rm	; 	xcall	gsm_destroy
	call	gsm_destroy@rl
	ext	0x8		; 	xadd	%r12,%r0,8
	add	%r12,%r0
	ext	pceFileClose@rm	; 	xcall	pceFileClose
	call	pceFileClose@rl
__LX81:				; __L81:
	popn	%r0
	ret
	.align	1
gsm_isr:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
; APP
	
	pushn %r15
	ld.w %r0, %alr
	ld.w %r1, %ahr
	pushn %r1
	
	
	 ld.w %r0, [%sp+18]		; psr
	ext	gsm_info+0x0@h	; 	xld.w %r3, gsm_info
	ext	gsm_info+0x0@m
	ld.w	%r3,gsm_info+0x0@l
	 ld.w %r4, [%r3]+		; old_isr
	ext	gsm_fill_busy+0x0@h	; 	xld.w %r1, gsm_fill_busy
	ext	gsm_fill_busy+0x0@m
	ld.w	%r1,gsm_fill_busy+0x0@l
	ext	gsm_isr_ret_busy+0x0@h	; 	xld.w %r2, gsm_isr_ret_busy
	ext	gsm_isr_ret_busy+0x0@m
	ld.w	%r2,gsm_isr_ret_busy+0x0@l
	btst [%r3], 0			; busy?
	jrne gsm_isr_busy
	ext	gsm_fill+0x0@h	; 	xld.w %r1, gsm_fill
	ext	gsm_fill+0x0@m
	ld.w	%r1,gsm_fill+0x0@l
	ext	gsm_isr_ret+0x0@h	; 	xld.w %r2, gsm_isr_ret
	ext	gsm_isr_ret+0x0@m
	ld.w	%r2,gsm_isr_ret+0x0@l
	bset [%r3], 0			; busy <- 1
gsm_isr_busy:
	pushn %r2
	
	
	jp %r4				; * old_isr->(iret)->gsm_fill/busy->(ret)->gsm_isr_ret/busy
					;   長時間の割り込み禁止を防ぐため、old_isrがretiするときに
					;   割り込み発生時のpsr(たいていIE=1)を復元しています。
					; * 割り込みルーチン内ではフラグを保存する必要があるので、
					;   gsm_isrから帰るときもretではなくretiを使わなければいけません。
					;   つまり、割り込み発生時のpsrを、二回復元しています。
gsm_isr_ret:
	bclr [%r3], 0			; S1C33の関数規約により、r3は保持されているはず。
gsm_isr_ret_busy:
	
	
	popn %r1
	ld.w %ahr, %r1
	ld.w %alr, %r0
	popn %r15
	
	
	reti
	
; NO_APP
	ret
	.align	1
gsm_fill:
;	.frame	%sp,20,$31		# vars= 0, regs= 5/0, args= 0, extra= 0
;	.mask	0x800f0000,-4
;	.fmask	0x00000000,0
	pushn	%r3
	ext	gsm_info+0x0@h	; 	xld.w	%r1,gsm_info
	ext	gsm_info+0x0@m
	ld.w	%r1,gsm_info+0x0@l
	;.set	volatile
	ext	gsm_info+0x5@ah	; 	xld.ub	%r10,[gsm_info+5]
	ext	gsm_info+0x5@al
	ld.ub	%r10,[%r8]
	;.set	novolatile
	ext	__LX115@rm	; 	xjp	__L115
	jp	__LX115@rl
__LX87:				; __L87:
	ext	0x2		; 	xld.w	%r2,0x000000a0		; 160
	ld.w	%r2,0x20
	ext	0x6		; 	xld.b	%r11,[%r1+6]
	ld.b	%r11,[%r1]
	ext	0xa		; 	xld.w	%r10,0x00000280		; 640
	ld.w	%r10,0x0
	mlt.w	%r11,%r10
	ld.w	%r10,%alr
	ext	0x6		; 	xadd	%r10,%r10,436
	add	%r10,0x34
	ld.w	%r0,%r1
	add	%r0,%r10
	;.set	volatile
	ext	0x7		; 	xld.ub	%r10,[%r1+7]
	ld.ub	%r10,[%r1]
	;.set	novolatile
	ld.b	%r10,%r10
	cmp	%r10,0x0
	jreq	__LX109		; 	xjreq	__L109
__LX89:				; __L89:
	ext	0x184		; 	xld.w	%r3,[%r1+388]
	ld.w	%r3,[%r1]
	cmp	%r3,0x0
	jrne	__LX92		; 	xjrne	__L92
	ext	0x8		; 	xadd	%r12,%r1,8
	add	%r12,%r1
	ext	gsm_info+0x20@h	; 	xld.w	%r13,gsm_info+32
	ext	gsm_info+0x20@m
	ld.w	%r13,gsm_info+0x20@l
	ext	0x18		; 	xld.w	%r14,[%r1+24]
	ld.w	%r14,[%r1]
	ext	0x0		; 	xld.w	%r15,0x00000021		; 33
	ld.w	%r15,0x21
	ext	file_read@rm	; 	xcall	file_read
	call	file_read@rl
	ld.w	%r11,%r10
	ext	0x18		; 	xld.w	%r10,[%r1+24]
	ld.w	%r10,[%r1]
	add	%r10,%r11
	ext	0x18		; 	xld.w	[%r1+24],%r10
	ld.w	[%r1],%r10
	ext	0x0		; 	xcmp	%r11,33
	cmp	%r11,0x21
	jrne	__LX93		; 	xjrne	__L93
	ext	0x1c		; 	xld.w	%r12,[%r1+28]
	ld.w	%r12,[%r1]
	ext	gsm_info+0x20@h	; 	xld.w	%r13,gsm_info+32
	ext	gsm_info+0x20@m
	ld.w	%r13,gsm_info+0x20@l
	ext	gsm_info+0x42@h	; 	xld.w	%r14,gsm_info+66
	ext	gsm_info+0x42@m
	ld.w	%r14,gsm_info+0x42@l
	ext	gsm_decode@rm	; 	xcall	gsm_decode
	call	gsm_decode@rl
	cmp	%r10,0x0
	jreq	__LX95		; 	xjreq	__L95
	ext	gsm_info+0x42@h	; 	xld.w	%r12,gsm_info+66
	ext	gsm_info+0x42@m
	ld.w	%r12,gsm_info+0x42@l
	jp	__LX116		; 	xjp	__L116
__LX93:				; __L93:
	cmp	%r11,0x0
	jrne	__LX96		; 	xjrne	__L96
	;.set	volatile
	ext	0x7		; 	xld.ub	%r10,[%r1+7]
	ld.ub	%r10,[%r1]
	;.set	novolatile
	ld.b	%r10,%r10
	cmp	%r10,0x0
	jrlt	__LX98		; 	xjrlt	__L98
	;.set	volatile
	ext	0x7		; 	xld.ub	%r10,[%r1+7]
	ld.ub	%r10,[%r1]
	;.set	novolatile
	ld.b	%r10,%r10
	cmp	%r10,0x0
	jreq	__LX97		; 	xjreq	__L97
	;.set	volatile
	ext	0x7		; 	xld.ub	%r10,[%r1+7]
	ld.ub	%r10,[%r1]
	;.set	novolatile
	sub	%r10,0x1	; 	xsub	%r10,%r10,1
	;.set	volatile
	ext	0x7		; 	xld.b	[%r1+7],%r10
	ld.b	[%r1],%r10
	;.set	novolatile
	;.set	volatile
	ext	0x7		; 	xld.ub	%r10,[%r1+7]
	ld.ub	%r10,[%r1]
	;.set	novolatile
	ld.b	%r10,%r10
	cmp	%r10,0x0
	jreq	__LX97		; 	xjreq	__L97
__LX98:				; __L98:
	ext	0x18		; 	xld.w	[%r1+24],%r3
	ld.w	[%r1],%r3
	jp	__LX91		; 	xjp	__L91
__LX97:				; __L97:
__LX96:				; __L96:
	ext	0x42		; 	xadd	%r12,%r1,66
	add	%r12,%r1
__LX116:				; __L116:
	ld.w	%r13,0x0
	ext	0x5		; 	xld.w	%r14,0x00000140		; 320
	ld.w	%r14,0x0
	ext	memset@rm	; 	xcall	memset
	call	memset@rl
__LX95:				; __L95:
	ext	0x2		; 	xld.w	%r10,0x000000a0		; 160
	ld.w	%r10,0x20
	ext	0x184		; 	xld.w	[%r1+388],%r10
	ld.w	[%r1],%r10
__LX92:				; __L92:
	ext	0x184		; 	xld.w	%r12,[%r1+388]
	ld.w	%r12,[%r1]
	ext	0x2		; 	xld.w	%r10,0x000000a0		; 160
	ld.w	%r10,0x20
	sub	%r10,%r12
	sll	%r10,0x1	; 	xsll	%r10,1
	ext	0x1		; 	xadd	%r10,%r10,66
	add	%r10,0x2
	ld.w	%r13,%r1
	add	%r13,%r10
	cmp	%r2,%r12
	jrgt	__LX101		; 	xjrgt	__L101
	ld.w	%r11,%r2
	ld.w	%r2,0x0
	ld.w	%r10,%r12
	sub	%r10,%r11
	ext	0x184		; 	xld.w	[%r1+388],%r10
	ld.w	[%r1],%r10
	jp	__LX103		; 	xjp	__L103
__LX101:				; __L101:
	ld.w	%r11,%r12
	sub	%r2,%r11
	ld.w	%r4,0x0
	ext	0x184		; 	xld.w	[%r1+388],%r4
	ld.w	[%r1],%r4
__LX103:				; __L103:
	ld.uh	%r10,[%r13]	; 	xld.uh	%r10,[%r13]
	add	%r13,0x2	; 	xadd	%r13,%r13,2
	ld.h	[%r0],%r10	; 	xld.h	[%r0],%r10
	add	%r0,0x2		; 	xadd	%r0,%r0,2
	ld.h	[%r0],%r10	; 	xld.h	[%r0],%r10
	add	%r0,0x2		; 	xadd	%r0,%r0,2
	sub	%r11,0x1	; 	xsub	%r11,%r11,1
	jrne	__LX103		; 	xjrne	__L103
__LX91:				; __L91:
	cmp	%r2,0x0
	jrne	__LX89		; 	xjrne	__L89
	jp	__LX108		; 	xjp	__L108
__LX109:				; __L109:
	ld.w	%r4,0x0
	ld.h	[%r0],%r4	; 	xld.h	[%r0],%r4
	add	%r0,0x2		; 	xadd	%r0,%r0,2
	ld.h	[%r0],%r4	; 	xld.h	[%r0],%r4
	add	%r0,0x2		; 	xadd	%r0,%r0,2
	sub	%r2,0x1		; 	xsub	%r2,%r2,1
	jrne	__LX109		; 	xjrne	__L109
__LX108:				; __L108:
	ext	0x6		; 	xld.ub	%r10,[%r1+6]
	ld.ub	%r10,[%r1]
	add	%r10,0x1	; 	xadd	%r10,%r10,1
	ext	0x6		; 	xld.b	[%r1+6],%r10
	ld.b	[%r1],%r10
	ld.b	%r10,%r10
	cmp	%r10,0x2	; 	xcmp	%r10,2
	jrne	__LX113		; 	xjrne	__L113
	ld.w	%r4,0x0
	ext	0x6		; 	xld.b	[%r1+6],%r4
	ld.b	[%r1],%r4
__LX113:				; __L113:
; APP
	
		pushn %r2
		ld.w %r0, %psr			; %psr保存
	ld.w	%r1,%r0		; 		xand %r1, %r0, 0xffffffef	; 割り込み禁止
	and	%r1,0x2f
		ld.w %psr, %r1
	ext	gsm_info+0x5@h	; 		xld.w %r1, gsm_info + 5		; gsm_info.bc--
	ext	gsm_info+0x5@m
	ld.w	%r1,gsm_info+0x5@l
		ld.b %r2, [%r1]
		sub %r2, 1
		ld.b [%r1], %r2
		ld.w %psr, %r0			; %psr復元
		popn %r2
		
; NO_APP
	;.set	volatile
	ext	0x5		; 	xld.ub	%r10,[%r1+5]
	ld.ub	%r10,[%r1]
	;.set	novolatile
__LX115:				; __L115:
	ld.b	%r10,%r10
	cmp	%r10,0x0
	ext	__LX87@rm	; 	xjrne	__L87
	jrne	__LX87@rl
	popn	%r3
	ret
	.align	1
gsm_fill_busy:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ret
	.align	1
gsm_endproc:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	;.set	volatile
	ext	gsm_info+0x5@ah	; 	xld.ub	%r10,[gsm_info+5]
	ext	gsm_info+0x5@al
	ld.ub	%r10,[%r8]
	;.set	novolatile
	add	%r10,0x1	; 	xadd	%r10,%r10,1
	;.set	volatile
	ext	gsm_info+0x5@ah	; 	xld.b	[gsm_info+5],%r10
	ext	gsm_info+0x5@al
	ld.b	[%r8],%r10
	;.set	novolatile
	;.set	volatile
	ext	gsm_info+0x5@ah	; 	xld.ub	%r10,[gsm_info+5]
	ext	gsm_info+0x5@al
	ld.ub	%r10,[%r8]
	;.set	novolatile
	ret

	.lcomm	gsm_info 1716
