
;  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	2
__LC0:
	.ascii	"cliptask.$(%d)\000"
	.code
	.align	1
	.global	task_init
task_init:
;	.frame	%sp,20,$31		# vars= 0, regs= 3/0, args= 8, extra= 0
;	.mask	0x80030000,-4
;	.fmask	0x00000000,0
	pushn	%r1
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ext	ready_task_list+0x0@h	; 	xld.w	%r1,ready_task_list
	ext	ready_task_list+0x0@m
	ld.w	%r1,ready_task_list+0x0@l
	ld.w	%r12,%r1
	ext	InitializeListHead@rm	; 	xcall	InitializeListHead
	call	InitializeListHead@rl
	ext	0x0		; 	xld.w	%r12,0x00000020		; 32
	ld.w	%r12,0x20
	ld.w	%r13,0x1	; 	xld.w	%r13,0x00000001		; 1
	ext	calloc@rm	; 	xcall	calloc
	call	calloc@rl
	ld.w	%r0,%r10
	cmp	%r0,0x0
	jrne	__LX71		; 	xjrne	__L71
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x1		; 	xld.w	%r10,0x00000074		; 116
	ld.w	%r10,0x34
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX71:				; __L71:
	ext	0x1000		; 	xld.w	%r10,-2147483648			; 0x80000000
	ext	0x0
	ld.w	%r10,0x0
	ext	0x8		; 	xld.w	[%r0+8],%r10
	ld.w	[%r0],%r10
	ld.w	%r12,%r1
	ext	0x18		; 	xadd	%r13,%r0,24
	add	%r13,%r0
	ext	InsertTailList@rm	; 	xcall	InsertTailList
	call	InsertTailList@rl
	ext	running_task+0x0@ah	; 	xld.w	[running_task],%r0
	ext	running_task+0x0@al
	ld.w	[%r8],%r0
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	popn	%r1
	ret
	.align	1
	.global	task_get_current
task_get_current:
;	.frame	%sp,12,$31		# vars= 0, regs= 1/0, args= 8, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ext	running_task+0x0@ah	; 	xld.w	%r10,[running_task]
	ext	running_task+0x0@al
	ld.w	%r10,[%r8]
	cmp	%r10,0x0
	jrne	__LX73		; 	xjrne	__L73
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x2		; 	xld.w	%r10,0x00000085		; 133
	ld.w	%r10,0x5
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX73:				; __L73:
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	ret
	.align	1
	.global	task_create
task_create:
;	.frame	%sp,32,$31		# vars= 4, regs= 5/0, args= 8, extra= 0
;	.mask	0x800f0000,-4
;	.fmask	0x00000000,0
	pushn	%r3
	sub	%sp,0x3		; 	xsub	%sp,%sp,12
	ld.w	[%sp+0x2],%r12	; 	xld.w	[%sp+8],%r12
	ld.w	%r3,%r13
	ld.w	%r2,%r14
	cmp	%r15,0x0
	jrne	__LX75		; 	xjrne	__L75
	ext	0x40		; 	xld.w	%r15,0x00001000		; 4096
	ld.w	%r15,0x0
__LX75:				; __L75:
	ext	0x3		; 	xadd	%r10,%r15,3
	add	%r10,%r15
	ld.w	%r15,%r10
	and	%r15,0x3c	; 	xand	%r15,%r15,0xfffffffc
	ext	0x20		; 	xadd	%r1,%r15,32
	add	%r1,%r15
	ld.w	%r12,%r1
	ld.w	%r13,0x1	; 	xld.w	%r13,0x00000001		; 1
	ext	calloc@rm	; 	xcall	calloc
	call	calloc@rl
	ld.w	%r0,%r10
	cmp	%r0,0x0
	jrne	__LX76		; 	xjrne	__L76
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x2		; 	xld.w	%r10,0x000000a3		; 163
	ld.w	%r10,0x23
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX76:				; __L76:
	ld.w	%r10,%r0
	add	%r10,%r1
	sub	%r10,0x4	; 	xsub	%r10,%r10,4
	ld.w	[%r0],%r10	; 	xld.w	[%r0],%r10
	ld.w	[%r10],%r2	; 	xld.w	[%r10],%r2
	ld.w	%r10,[%r0]	; 	xld.w	%r10,[%r0]
	sub	%r10,0x4	; 	xsub	%r10,%r10,4
	ld.w	[%r0],%r10	; 	xld.w	[%r0],%r10
	ld.w	[%r10],%r3	; 	xld.w	[%r10],%r3
	ld.w	%r10,[%r0]	; 	xld.w	%r10,[%r0]
	sub	%r10,0x4	; 	xsub	%r10,%r10,4
	ld.w	[%r0],%r10	; 	xld.w	[%r0],%r10
	ext	task_stub+0x0@h	; 	xld.w	%r11,task_stub
	ext	task_stub+0x0@m
	ld.w	%r11,task_stub+0x0@l
	ld.w	[%r10],%r11	; 	xld.w	[%r10],%r11
	ld.w	%r10,[%r0]	; 	xld.w	%r10,[%r0]
	sub	%r10,0x4	; 	xsub	%r10,%r10,4
	ld.w	[%r0],%r10	; 	xld.w	[%r0],%r10
	ld.w	%r4,0x0
	ld.w	[%r10],%r4	; 	xld.w	[%r10],%r4
	ld.w	%r10,[%r0]	; 	xld.w	%r10,[%r0]
	sub	%r10,0x4	; 	xsub	%r10,%r10,4
	ld.w	[%r0],%r10	; 	xld.w	[%r0],%r10
	ld.w	[%r10],%r4	; 	xld.w	[%r10],%r4
	ld.w	%r10,[%r0]	; 	xld.w	%r10,[%r0]
	sub	%r10,0x4	; 	xsub	%r10,%r10,4
	ld.w	[%r0],%r10	; 	xld.w	[%r0],%r10
	ld.w	[%r10],%r4	; 	xld.w	[%r10],%r4
	ld.w	%r10,[%r0]	; 	xld.w	%r10,[%r0]
	sub	%r10,0x4	; 	xsub	%r10,%r10,4
	ld.w	[%r0],%r10	; 	xld.w	[%r0],%r10
	ld.w	[%r10],%r4	; 	xld.w	[%r10],%r4
	ld.w	%r4,[%sp+0x2]	; 	xld.w	%r4,[%sp+8]
	ext	0x8		; 	xld.w	[%r0+8],%r4
	ld.w	[%r0],%r4
	ext	0x10		; 	xadd	%r12,%r0,16
	add	%r12,%r0
	ext	InitializeListHead@rm	; 	xcall	InitializeListHead
	call	InitializeListHead@rl
	ext	ready_task_list+0x0@h	; 	xld.w	%r12,ready_task_list
	ext	ready_task_list+0x0@m
	ld.w	%r12,ready_task_list+0x0@l
	ext	0x18		; 	xadd	%r13,%r0,24
	add	%r13,%r0
	ext	InsertTailList@rm	; 	xcall	InsertTailList
	call	InsertTailList@rl
	ext	task_schedule@rm	; 	xcall	task_schedule
	call	task_schedule@rl
	ld.w	%r10,%r0
	add	%sp,0x3		; 	xadd	%sp,%sp,12
	popn	%r3
	ret
	.align	1
	.global	task_exit
task_exit:
;	.frame	%sp,20,$31		# vars= 0, regs= 3/0, args= 8, extra= 0
;	.mask	0x80030000,-4
;	.fmask	0x00000000,0
	pushn	%r1
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ld.w	%r0,%r12
	call	task_get_current	; 	xcall	task_get_current
	ld.w	%r1,%r10
	ext	0xc		; 	xld.w	[%r1+12],%r0
	ld.w	[%r1],%r0
	ext	0x18		; 	xadd	%r0,%r1,24
	add	%r0,%r1
	ld.w	%r12,%r0
	ext	RemoveEntryList@rm	; 	xcall	RemoveEntryList
	call	RemoveEntryList@rl
	ld.w	%r11,0x0
	ld.w	[%r0],%r11	; 	xld.w	[%r0],%r11
	ext	0x1c		; 	xld.w	[%r1+28],%r11
	ld.w	[%r1],%r11
	add	%r1,0x10	; 	xadd	%r1,%r1,16
	ld.w	%r12,%r1
	ext	IsListEmpty@rm	; 	xcall	IsListEmpty
	call	IsListEmpty@rl
	cmp	%r10,0x0
	jrne	__LX78		; 	xjrne	__L78
	ld.w	%r12,%r1
	ext	RemoveHeadList@rm	; 	xcall	RemoveHeadList
	call	RemoveHeadList@rl
	ext	ready_task_list+0x0@h	; 	xld.w	%r12,ready_task_list
	ext	ready_task_list+0x0@m
	ld.w	%r12,ready_task_list+0x0@l
	ld.w	%r13,%r10
	ext	InsertTailList@rm	; 	xcall	InsertTailList
	call	InsertTailList@rl
__LX78:				; __L78:
	ext	task_schedule@rm	; 	xcall	task_schedule
	call	task_schedule@rl
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x3		; 	xld.w	%r10,0x000000dc		; 220
	ld.w	%r10,0x1c
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	popn	%r1
	ret
	.align	1
	.global	task_wait
task_wait:
;	.frame	%sp,24,$31		# vars= 0, regs= 4/0, args= 8, extra= 0
;	.mask	0x80070000,-4
;	.fmask	0x00000000,0
	pushn	%r2
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ld.w	%r1,%r12
	ext	task_get_current@rm	; 	xcall	task_get_current
	call	task_get_current@rl
	ld.w	%r0,%r10
	cmp	%r1,%r0
	jrne	__LX80		; 	xjrne	__L80
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x3		; 	xld.w	%r10,0x000000e8		; 232
	ld.w	%r10,0x28
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX80:				; __L80:
	ext	0x10		; 	xadd	%r2,%r1,16
	add	%r2,%r1
	ld.w	%r12,%r2
	ext	IsListEmpty@rm	; 	xcall	IsListEmpty
	call	IsListEmpty@rl
	cmp	%r10,0x0
	jrne	__LX81		; 	xjrne	__L81
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x3		; 	xld.w	%r10,0x000000ed		; 237
	ld.w	%r10,0x2d
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX81:				; __L81:
	ext	0x18		; 	xld.w	%r10,[%r1+24]
	ld.w	%r10,[%r1]
	cmp	%r10,0x0
	jreq	__LX82		; 	xjreq	__L82
	add	%r0,0x18	; 	xadd	%r0,%r0,24
	ld.w	%r12,%r0
	ext	RemoveEntryList@rm	; 	xcall	RemoveEntryList
	call	RemoveEntryList@rl
	ld.w	%r12,%r2
	ld.w	%r13,%r0
	ext	InsertTailList@rm	; 	xcall	InsertTailList
	call	InsertTailList@rl
	ext	task_schedule@rm	; 	xcall	task_schedule
	call	task_schedule@rl
__LX82:				; __L82:
	ext	0xc		; 	xld.w	%r0,[%r1+12]
	ld.w	%r0,[%r1]
	ld.w	%r12,%r1
	ext	free@rm		; 	xcall	free
	call	free@rl
	ld.w	%r10,%r0
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	popn	%r2
	ret
	.align	1
	.global	task_kill
task_kill:
;	.frame	%sp,16,$31		# vars= 0, regs= 2/0, args= 8, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ld.w	%r0,%r12
	ext	task_get_current@rm	; 	xcall	task_get_current
	call	task_get_current@rl
	cmp	%r0,%r10
	jrne	__LX84		; 	xjrne	__L84
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x4		; 	xld.w	%r10,0x0000010f		; 271
	ld.w	%r10,0xf
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX84:				; __L84:
	ext	0x10		; 	xadd	%r12,%r0,16
	add	%r12,%r0
	ext	IsListEmpty@rm	; 	xcall	IsListEmpty
	call	IsListEmpty@rl
	cmp	%r10,0x0
	jrne	__LX85		; 	xjrne	__L85
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x4		; 	xld.w	%r10,0x00000114		; 276
	ld.w	%r10,0x14
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX85:				; __L85:
	ext	0x18		; 	xld.w	%r10,[%r0+24]
	ld.w	%r10,[%r0]
	cmp	%r10,0x0
	jreq	__LX86		; 	xjreq	__L86
	ext	0x18		; 	xadd	%r12,%r0,24
	add	%r12,%r0
	ext	RemoveEntryList@rm	; 	xcall	RemoveEntryList
	call	RemoveEntryList@rl
__LX86:				; __L86:
	ld.w	%r12,%r0
	ext	free@rm		; 	xcall	free
	call	free@rl
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	popn	%r0
	ret
	.align	1
	.global	task_suspend
task_suspend:
;	.frame	%sp,12,$31		# vars= 0, regs= 1/0, args= 8, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ext	0x4		; 	xld.w	%r10,[%r12+4]
	ld.w	%r10,[%r12]
	ext	0xfff		; 	xcmp	%r10,2147483646
	ext	0x1fff
	cmp	%r10,0x3e
	jrule	__LX88		; 	xjrule	__L88
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x4		; 	xld.w	%r10,0x0000012f		; 303
	ld.w	%r10,0x2f
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX88:				; __L88:
	add	%r10,0x1	; 	xadd	%r10,%r10,1
	ext	0x4		; 	xld.w	[%r12+4],%r10
	ld.w	[%r12],%r10
	call	task_schedule	; 	xcall	task_schedule
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	ret
	.align	1
	.global	task_resume
task_resume:
;	.frame	%sp,12,$31		# vars= 0, regs= 1/0, args= 8, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ext	0x4		; 	xld.w	%r10,[%r12+4]
	ld.w	%r10,[%r12]
	sub	%r10,0x1	; 	xsub	%r10,%r10,1
	ext	0xfff		; 	xcmp	%r10,2147483646
	ext	0x1fff
	cmp	%r10,0x3e
	jrule	__LX90		; 	xjrule	__L90
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x4		; 	xld.w	%r10,0x0000013e		; 318
	ld.w	%r10,0x3e
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX90:				; __L90:
	ext	0x4		; 	xld.w	[%r12+4],%r10
	ld.w	[%r12],%r10
	call	task_schedule	; 	xcall	task_schedule
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	ret
	.align	1
task_select:
;	.frame	%sp,12,$31		# vars= 0, regs= 1/0, args= 8, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ext	ready_task_list+0x0@h	; 	xld.w	%r15,ready_task_list
	ext	ready_task_list+0x0@m
	ld.w	%r15,ready_task_list+0x0@l
	ld.w	%r13,[%r15]	; 	xld.w	%r13,[%r15]
	ld.w	%r14,0x0
	cmp	%r13,%r15
	jreq	__LX93		; 	xjreq	__L93
__LX94:				; __L94:
	ext	0x18		; 	xsub	%r12,%r13,24
	sub	%r12,%r13
	ext	0x4		; 	xld.w	%r10,[%r12+4]
	ld.w	%r10,[%r12]
	cmp	%r10,0x0
	jrne	__LX95		; 	xjrne	__L95
	cmp	%r14,0x0
	jreq	__LX97		; 	xjreq	__L97
	ext	0x8		; 	xld.w	%r11,[%r12+8]
	ld.w	%r11,[%r12]
	ext	0x8		; 	xld.w	%r10,[%r14+8]
	ld.w	%r10,[%r14]
	cmp	%r11,%r10
	jrle	__LX95		; 	xjrle	__L95
__LX97:				; __L97:
	ld.w	%r14,%r12
__LX95:				; __L95:
	ld.w	%r13,[%r13]	; 	xld.w	%r13,[%r13]
	cmp	%r13,%r15
	jrne	__LX94		; 	xjrne	__L94
__LX93:				; __L93:
	cmp	%r14,0x0
	jrne	__LX99		; 	xjrne	__L99
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x5		; 	xld.w	%r10,0x00000169		; 361
	ld.w	%r10,0x29
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX99:				; __L99:
	ext	running_task+0x0@ah	; 	xld.w	[running_task],%r14
	ext	running_task+0x0@al
	ld.w	[%r8],%r14
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	ret
; APP
	
	.code
	.align	1
task_stub:
	; この関数は処理を返さないので、%r0と%r1を破壊しても大丈夫です。
	popn	%r1		; %r0 = task_proc, %r1 = param
	call.d	%r0		; exit_code = task_proc(param)
	ld.w	%r12, %r1	; *delay*
	ext	task_exit@rm	; 	xjp.d	task_exit	; task_exit(exit_code)
	jp.d	task_exit@rl
	ld.w	%r12, %r10	; *delay*

	
	.code
	.align	1
task_schedule:
	pushn	%r3
	ext	running_task+0x0@ah	; 	xld.w	%r4, [running_task]	; running_task->sp = %sp
	ext	running_task+0x0@al
	ld.w	%r4,[%r8]
	ld.w	%r5, %sp
	ld.w	[%r4],%r5	; 	xld.w	[%r4+0], %r5
	;
	call	task_select	; 	xcall	task_select
	;
	ext	running_task+0x0@ah	; 	xld.w	%r4, [running_task]	; %sp = running_task->sp
	ext	running_task+0x0@al
	ld.w	%r4,[%r8]
	ld.w	%r5,[%r4]	; 	xld.w	%r5, [%r4+0]
	ld.w	%sp, %r5
	popn	%r3
	ret

; NO_APP
	.align	1
	.global	event_create
event_create:
;	.frame	%sp,20,$31		# vars= 0, regs= 3/0, args= 8, extra= 0
;	.mask	0x80030000,-4
;	.fmask	0x00000000,0
	pushn	%r1
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ld.w	%r1,%r12
	ld.w	%r12,0x10	; 	xld.w	%r12,0x00000010		; 16
	ld.w	%r13,0x1	; 	xld.w	%r13,0x00000001		; 1
	ext	calloc@rm	; 	xcall	calloc
	call	calloc@rl
	ld.w	%r0,%r10
	cmp	%r0,0x0
	jrne	__LX101		; 	xjrne	__L101
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x6		; 	xld.w	%r10,0x000001a3		; 419
	ld.w	%r10,0x23
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX101:				; __L101:
	ext	0x4		; 	xld.w	[%r0+4],%r1
	ld.w	[%r0],%r1
	ext	0x8		; 	xadd	%r12,%r0,8
	add	%r12,%r0
	ext	InitializeListHead@rm	; 	xcall	InitializeListHead
	call	InitializeListHead@rl
	ld.w	%r10,%r0
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	popn	%r1
	ret
	.align	1
	.global	event_delete
event_delete:
;	.frame	%sp,16,$31		# vars= 0, regs= 2/0, args= 8, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ld.w	%r0,%r12
	ext	0x8		; 	xadd	%r12,%r0,8
	add	%r12,%r0
	ext	IsListEmpty@rm	; 	xcall	IsListEmpty
	call	IsListEmpty@rl
	cmp	%r10,0x0
	jrne	__LX103		; 	xjrne	__L103
	ext	__LC0+0x0@h	; 	xld.w	%r10,__LC0
	ext	__LC0+0x0@m
	ld.w	%r10,__LC0+0x0@l
	ld.w	[%sp+0x0],%r10	; 	xld.w	[%sp],%r10
	ext	0x6		; 	xld.w	%r10,0x000001b4		; 436
	ld.w	%r10,0x34
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX103:				; __L103:
	ld.w	%r12,%r0
	ext	free@rm		; 	xcall	free
	call	free@rl
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	popn	%r0
	ret
	.align	1
	.global	event_wait
event_wait:
;	.frame	%sp,12,$31		# vars= 0, regs= 3/0, args= 0, extra= 0
;	.mask	0x80030000,-4
;	.fmask	0x00000000,0
	pushn	%r1
	ld.w	%r1,%r12
	ext	task_get_current@rm	; 	xcall	task_get_current
	call	task_get_current@rl
	ld.w	%r0,%r10
	ld.w	%r10,[%r1]	; 	xld.w	%r10,[%r1]
	cmp	%r10,0x0
	jreq	__LX105		; 	xjreq	__L105
	ext	0x4		; 	xld.w	%r10,[%r1+4]
	ld.w	%r10,[%r1]
	cmp	%r10,0x0
	jrne	__LX107		; 	xjrne	__L107
	ld.w	[%r1],%r10	; 	xld.w	[%r1],%r10
	jp	__LX107		; 	xjp	__L107
__LX105:				; __L105:
	add	%r0,0x18	; 	xadd	%r0,%r0,24
	ld.w	%r12,%r0
	ext	RemoveEntryList@rm	; 	xcall	RemoveEntryList
	call	RemoveEntryList@rl
	ext	0x8		; 	xadd	%r12,%r1,8
	add	%r12,%r1
	ld.w	%r13,%r0
	ext	InsertTailList@rm	; 	xcall	InsertTailList
	call	InsertTailList@rl
__LX107:				; __L107:
	call	task_schedule	; 	xcall	task_schedule
	popn	%r1
	ret
	.align	1
	.global	event_set
event_set:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ld.w	%r13,0x0
	call	event_set_pulse	; 	xcall	event_set_pulse
	ret
	.align	1
	.global	event_pulse
event_pulse:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ld.w	%r13,0x1	; 	xld.w	%r13,0x00000001		; 1
	call	event_set_pulse	; 	xcall	event_set_pulse
	ret
	.align	1
	.global	event_reset
event_reset:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ld.w	%r10,0x0
	ld.w	[%r12],%r10	; 	xld.w	[%r12],%r10
	ret
	.align	1
event_set_pulse:
;	.frame	%sp,16,$31		# vars= 0, regs= 4/0, args= 0, extra= 0
;	.mask	0x80070000,-4
;	.fmask	0x00000000,0
	pushn	%r2
	ld.w	%r0,%r12
	ld.w	%r2,%r13
	ld.w	%r10,0x1	; 	xld.w	%r10,0x00000001		; 1
	ld.w	[%r0],%r10	; 	xld.w	[%r0],%r10
	ext	0x8		; 	xadd	%r1,%r0,8
	add	%r1,%r0
__LX112:				; __L112:
	ld.w	%r12,%r1
	ext	IsListEmpty@rm	; 	xcall	IsListEmpty
	call	IsListEmpty@rl
	cmp	%r10,0x0
	jrne	__LX113		; 	xjrne	__L113
	ld.w	%r12,%r1
	ext	RemoveHeadList@rm	; 	xcall	RemoveHeadList
	call	RemoveHeadList@rl
	ext	ready_task_list+0x0@h	; 	xld.w	%r12,ready_task_list
	ext	ready_task_list+0x0@m
	ld.w	%r12,ready_task_list+0x0@l
	ld.w	%r13,%r10
	ext	InsertTailList@rm	; 	xcall	InsertTailList
	call	InsertTailList@rl
	ext	0x4		; 	xld.w	%r10,[%r0+4]
	ld.w	%r10,[%r0]
	cmp	%r10,0x0
	jrne	__LX112		; 	xjrne	__L112
	ld.w	[%r0],%r10	; 	xld.w	[%r0],%r10
__LX113:				; __L113:
	cmp	%r2,0x0
	jreq	__LX116		; 	xjreq	__L116
	ld.w	%r11,0x0
	ld.w	[%r0],%r11	; 	xld.w	[%r0],%r11
__LX116:				; __L116:
	ext	task_schedule@rm	; 	xcall	task_schedule
	call	task_schedule@rl
	popn	%r2
	ret

	.lcomm	ready_task_list 8

	.lcomm	running_task 4
