
;  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	"clipcvid.$(%d)\000"
	.code
	.align	1
	.global	cvid_init
cvid_init:
;	.frame	%sp,144,$31		# vars= 116, regs= 5/0, args= 8, extra= 0
;	.mask	0x800f0000,-4
;	.fmask	0x00000000,0
	pushn	%r3
	sub	%sp,0x1f	; 	xsub	%sp,%sp,124
	ld.w	%r0,%r12
	ld.w	[%sp+0x1b],%r13	; 	xld.w	[%sp+108],%r13
	ext	cvid_free@rm	; 	xcall	cvid_free
	call	cvid_free@rl
	ld.w	%r12,%r0
	ld.w	%r13,0x0
	ld.w	%r14,%r13
	ext	mmioOpen@rm	; 	xcall	mmioOpen
	call	mmioOpen@rl
	ld.w	%r12,%r10
	ext	cvid_driver+0x18@h	; 	xld.w	%r0,cvid_driver+24
	ext	cvid_driver+0x18@m
	ld.w	%r0,cvid_driver+0x18@l
	ld.w	[%r0],%r12	; 	xld.w	[%r0],%r12
	cmp	%r12,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	0x3		; 	xld.w	%r10,0x000000f8		; 248
	ld.w	%r10,0x38
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX71:				; __L71:
	ext	0x409		; 	xld.w	%r10,0x20495641		; 541677121
	ext	0x559
	ld.w	%r10,0x1
	ext	0xc		; 	xld.w	[%r0+12],%r10
	ld.w	[%r0],%r10
	ext	0x4		; 	xadd	%r1,%r0,4
	add	%r1,%r0
	ld.w	%r13,%r1
	ld.w	%r14,0x0
	ext	0x0		; 	xld.w	%r15,0x00000020		; 32
	ld.w	%r15,0x20
	ext	mmioDescend@rm	; 	xcall	mmioDescend
	call	mmioDescend@rl
	cmp	%r10,0x0
	jreq	__LX72		; 	xjreq	__L72
	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,0x000000fb		; 251
	ld.w	%r10,0x3b
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX72:				; __L72:
	ext	0xd8e		; 	xld.w	%r10,0x6c726468		; 1819436136
	ext	0x991
	ld.w	%r10,0x28
	ld.w	[%sp+0x4],%r10	; 	xld.w	[%sp+16],%r10
	ext	0x1		; 	xld.w	%r3,0x00000040		; 64
	ld.w	%r3,0x0
	ld.w	%r12,[%r0]	; 	xld.w	%r12,[%r0]
	ld.w	%r13,%sp	; 	xadd	%r13,%sp,8
	add	%r13,0x8
	ld.w	%r14,%r1
	ld.w	%r15,%r3
	ext	mmioDescend@rm	; 	xcall	mmioDescend
	call	mmioDescend@rl
	cmp	%r10,0x0
	jreq	__LX73		; 	xjreq	__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	0x3		; 	xld.w	%r10,0x000000ff		; 255
	ld.w	%r10,0x3f
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX73:				; __L73:
	ext	0xd0d		; 	xld.w	%r10,0x68697661		; 1751742049
	ext	0x5d9
	ld.w	%r10,0x21
	ld.w	[%sp+0x7],%r10	; 	xld.w	[%sp+28],%r10
	ld.w	%r2,%sp		; 	xadd	%r2,%sp,28
	add	%r2,0x1c
	ld.w	%r12,[%r0]	; 	xld.w	%r12,[%r0]
	ld.w	%r13,%r2
	ld.w	%r14,%sp	; 	xadd	%r14,%sp,8
	add	%r14,0x8
	ld.w	%r15,0x10	; 	xld.w	%r15,0x00000010		; 16
	ext	mmioDescend@rm	; 	xcall	mmioDescend
	call	mmioDescend@rl
	ld.w	%r1,%r10
	cmp	%r1,0x0
	jreq	__LX74		; 	xjreq	__L74
	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,0x00000103		; 259
	ld.w	%r10,0x3
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX74:				; __L74:
	ld.w	%r12,[%r0]	; 	xld.w	%r12,[%r0]
	ld.w	%r13,%r2
	ld.w	%r14,%r1
	ext	mmioAscend@rm	; 	xcall	mmioAscend
	call	mmioAscend@rl
	ld.w	%r1,%r10
	cmp	%r1,0x0
	jreq	__LX75		; 	xjreq	__L75
	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,0x00000108		; 264
	ld.w	%r10,0x8
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX75:				; __L75:
	ext	0x40		; 	xadd	%r10,%r0,64
	add	%r10,%r0
	ld.w	[%r10],%r1	; 	xld.w	[%r10],%r1
	ld.w	%r2,%r0
	ld.w	%r4,%sp		; 	xadd	%r4,%sp,8
	add	%r4,0x8
	ld.w	[%sp+0x1e],%r4	; 	xld.w	[%sp+120],%r4
	add	%r4,0x28	; 	xadd	%r4,%r4,40
	ld.w	[%sp+0x1c],%r4	; 	xld.w	[%sp+112],%r4
	ld.w	%r4,%sp		; 	xadd	%r4,%sp,88
	ext	0x1
	add	%r4,0x18
	ld.w	[%sp+0x1d],%r4	; 	xld.w	[%sp+116],%r4
__LX76:				; __L76:
	ext	0xd8e		; 	xld.w	%r10,0x6c727473		; 1819440243
	ext	0x9d1
	ld.w	%r10,0x33
	ld.w	[%sp+0xe],%r10	; 	xld.w	[%sp+56],%r10
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ld.w	%r13,[%sp+0x1c]	; 	xld.w	%r13,[%sp+112]
	ld.w	%r14,[%sp+0x1e]	; 	xld.w	%r14,[%sp+120]
	ext	0x1		; 	xld.w	%r15,0x00000040		; 64
	ld.w	%r15,0x0
	ext	mmioDescend@rm	; 	xcall	mmioDescend
	call	mmioDescend@rl
	cmp	%r10,0x0
	jreq	__LX79		; 	xjreq	__L79
	ext	__LC0+0x0@h	; 	xld.w	%r4,__LC0
	ext	__LC0+0x0@m
	ld.w	%r4,__LC0+0x0@l
	ld.w	[%sp+0x0],%r4	; 	xld.w	[%sp],%r4
	ext	0x4		; 	xld.w	%r10,0x0000010c		; 268
	ld.w	%r10,0xc
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX79:				; __L79:
	ext	0xd0e		; 	xld.w	%r10,0x68727473		; 1752331379
	ext	0x9d1
	ld.w	%r10,0x33
	ld.w	[%sp+0x11],%r10	; 	xld.w	[%sp+68],%r10
	ld.w	%r0,%sp		; 	xadd	%r0,%sp,68
	ext	0x1
	add	%r0,0x4
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ld.w	%r13,%r0
	ld.w	%r14,[%sp+0x1c]	; 	xld.w	%r14,[%sp+112]
	ld.w	%r15,0x10	; 	xld.w	%r15,0x00000010		; 16
	ext	mmioDescend@rm	; 	xcall	mmioDescend
	call	mmioDescend@rl
	ld.w	%r1,%r10
	cmp	%r1,0x0
	jreq	__LX80		; 	xjreq	__L80
	ext	__LC0+0x0@h	; 	xld.w	%r4,__LC0
	ext	__LC0+0x0@m
	ld.w	%r4,__LC0+0x0@l
	ld.w	[%sp+0x0],%r4	; 	xld.w	[%sp],%r4
	ext	0x4		; 	xld.w	%r10,0x00000110		; 272
	ld.w	%r10,0x10
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX80:				; __L80:
	ext	0x44		; 	xadd	%r3,%r2,68
	add	%r3,%r2
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ld.w	%r13,%r3
	ext	0x1		; 	xld.w	%r14,0x00000040		; 64
	ld.w	%r14,0x0
	ext	mmioRead@rm	; 	xcall	mmioRead
	call	mmioRead@rl
	ext	0x1		; 	xcmp	%r10,64
	cmp	%r10,0x0
	jreq	__LX81		; 	xjreq	__L81
	ext	__LC0+0x0@h	; 	xld.w	%r4,__LC0
	ext	__LC0+0x0@m
	ld.w	%r4,__LC0+0x0@l
	ld.w	[%sp+0x0],%r4	; 	xld.w	[%sp],%r4
	ext	0x4		; 	xld.w	%r10,0x00000113		; 275
	ld.w	%r10,0x13
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX81:				; __L81:
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ld.w	%r13,%r0
	ld.w	%r14,%r1
	ext	mmioAscend@rm	; 	xcall	mmioAscend
	call	mmioAscend@rl
	cmp	%r10,0x0
	jreq	__LX82		; 	xjreq	__L82
	ext	__LC0+0x0@h	; 	xld.w	%r4,__LC0
	ext	__LC0+0x0@m
	ld.w	%r4,__LC0+0x0@l
	ld.w	[%sp+0x0],%r4	; 	xld.w	[%sp],%r4
	ext	0x4		; 	xld.w	%r10,0x00000116		; 278
	ld.w	%r10,0x16
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX82:				; __L82:
	ld.w	%r10,[%r3]	; 	xld.w	%r10,[%r3]
	ext	0xe6c		; 	xcmp	%r10,1935960438
	ext	0x11a5
	cmp	%r10,0x36
	jrne	__LX83		; 	xjrne	__L83
	ext	0xcce		; 	xld.w	%r10,0x66727473		; 1718776947
	ext	0x9d1
	ld.w	%r10,0x33
	ld.w	[%sp+0x16],%r10	; 	xld.w	[%sp+88],%r10
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ld.w	%r13,[%sp+0x1d]	; 	xld.w	%r13,[%sp+116]
	ld.w	%r14,[%sp+0x1c]	; 	xld.w	%r14,[%sp+112]
	ld.w	%r15,0x10	; 	xld.w	%r15,0x00000010		; 16
	ext	mmioDescend@rm	; 	xcall	mmioDescend
	call	mmioDescend@rl
	ld.w	%r1,%r10
	cmp	%r1,0x0
	jreq	__LX84		; 	xjreq	__L84
	ext	__LC0+0x0@h	; 	xld.w	%r4,__LC0
	ext	__LC0+0x0@m
	ld.w	%r4,__LC0+0x0@l
	ld.w	[%sp+0x0],%r4	; 	xld.w	[%sp],%r4
	ext	0x4		; 	xld.w	%r10,0x0000011a		; 282
	ld.w	%r10,0x1a
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX84:				; __L84:
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ext	0x84		; 	xadd	%r13,%r2,132
	add	%r13,%r2
	ext	0x0		; 	xld.w	%r14,0x00000028		; 40
	ld.w	%r14,0x28
	ext	mmioRead@rm	; 	xcall	mmioRead
	call	mmioRead@rl
	ext	0x0		; 	xcmp	%r10,40
	cmp	%r10,0x28
	jreq	__LX85		; 	xjreq	__L85
	ext	__LC0+0x0@h	; 	xld.w	%r4,__LC0
	ext	__LC0+0x0@m
	ld.w	%r4,__LC0+0x0@l
	ld.w	[%sp+0x0],%r4	; 	xld.w	[%sp],%r4
	ext	0x4		; 	xld.w	%r10,0x0000011d		; 285
	ld.w	%r10,0x1d
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX85:				; __L85:
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ld.w	%r13,[%sp+0x1d]	; 	xld.w	%r13,[%sp+116]
	ld.w	%r14,%r1
	ext	mmioAscend@rm	; 	xcall	mmioAscend
	call	mmioAscend@rl
	cmp	%r10,0x0
	jreq	__LX83		; 	xjreq	__L83
	ext	__LC0+0x0@h	; 	xld.w	%r4,__LC0
	ext	__LC0+0x0@m
	ld.w	%r4,__LC0+0x0@l
	ld.w	[%sp+0x0],%r4	; 	xld.w	[%sp],%r4
	ext	0x4		; 	xld.w	%r10,0x00000120		; 288
	ld.w	%r10,0x20
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX83:				; __L83:
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ld.w	%r13,[%sp+0x1e]	; 	xld.w	%r13,[%sp+120]
	add	%r13,0x28	; 	xadd	%r13,%r13,40
	ld.w	%r14,0x0
	ext	mmioAscend@rm	; 	xcall	mmioAscend
	call	mmioAscend@rl
	cmp	%r10,0x0
	jreq	__LX87		; 	xjreq	__L87
	ext	__LC0+0x0@h	; 	xld.w	%r4,__LC0
	ext	__LC0+0x0@m
	ld.w	%r4,__LC0+0x0@l
	ld.w	[%sp+0x0],%r4	; 	xld.w	[%sp],%r4
	ext	0x4		; 	xld.w	%r10,0x00000124		; 292
	ld.w	%r10,0x24
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX87:				; __L87:
	ext	0x44		; 	xld.w	%r10,[%r2+68]
	ld.w	%r10,[%r2]
	ext	0xe6c		; 	xcmp	%r10,1935960438
	ext	0x11a5
	cmp	%r10,0x36
	jrne	__LX78		; 	xjrne	__L78
	ext	0x94		; 	xld.w	%r10,[%r2+148]
	ld.w	%r10,[%r2]
	ext	0xc8d		; 	xcmp	%r10,1684633187
	ext	0x5d9
	cmp	%r10,0x23
	jreq	__LX77		; 	xjreq	__L77
__LX78:				; __L78:
	ext	cvid_driver+0x58@ah	; 	xld.w	%r10,[cvid_driver+88]
	ext	cvid_driver+0x58@al
	ld.w	%r10,[%r8]
	add	%r10,0x1	; 	xadd	%r10,%r10,1
	ext	cvid_driver+0x58@ah	; 	xld.w	[cvid_driver+88],%r10
	ext	cvid_driver+0x58@al
	ld.w	[%r8],%r10
	ext	__LX76@rm	; 	xjp	__L76
	jp	__LX76@rl
__LX77:				; __L77:
	ext	cvid_driver+0x18@h	; 	xld.w	%r2,cvid_driver+24
	ext	cvid_driver+0x18@m
	ld.w	%r2,cvid_driver+0x18@l
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ld.w	%r13,%sp	; 	xadd	%r13,%sp,8
	add	%r13,0x8
	ld.w	%r14,0x0
	ext	mmioAscend@rm	; 	xcall	mmioAscend
	call	mmioAscend@rl
	cmp	%r10,0x0
	jreq	__LX89		; 	xjreq	__L89
	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,0x0000012a		; 298
	ld.w	%r10,0x2a
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX89:				; __L89:
	ext	0xd2e		; 	xld.w	%r10,0x69766f6d		; 1769369453
	ext	0x19bd
	ld.w	%r10,0x2d
	ext	0x20		; 	xld.w	[%r2+32],%r10
	ld.w	[%r2],%r10
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ext	0x18		; 	xadd	%r13,%r2,24
	add	%r13,%r2
	ext	0x4		; 	xadd	%r14,%r2,4
	add	%r14,%r2
	ext	0x1		; 	xld.w	%r15,0x00000040		; 64
	ld.w	%r15,0x0
	ext	mmioDescend@rm	; 	xcall	mmioDescend
	call	mmioDescend@rl
	ld.w	%r1,%r10
	cmp	%r1,0x0
	jreq	__LX90		; 	xjreq	__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,0x0000012d		; 301
	ld.w	%r10,0x2d
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX90:				; __L90:
	ext	0xac		; 	xadd	%r0,%r2,172
	add	%r0,%r2
	ld.w	%r4,[%sp+0x1b]	; 	xld.w	%r4,[%sp+108]
	ld.w	[%r0],%r4	; 	xld.w	[%r0],%r4
	ld.w	%r12,[%r2]	; 	xld.w	%r12,[%r2]
	ld.w	%r13,%r1
	ld.w	%r14,0x1	; 	xld.w	%r14,0x00000001		; 1
	ext	mmioSeek@rm	; 	xcall	mmioSeek
	call	mmioSeek@rl
	ext	0x4		; 	xld.w	[%r0+4],%r10
	ld.w	[%r0],%r10
	cmp	%r10,0x0
	jrge	__LX91		; 	xjrge	__L91
	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,0x00000134		; 308
	ld.w	%r10,0x34
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX91:				; __L91:
	ext	0x18		; 	xsub	%r11,%r2,24
	sub	%r11,%r2
	ext	0x88		; 	xld.w	%r10,[%r2+136]
	ld.w	%r10,[%r2]
	add	%r10,0x3	; 	xadd	%r10,%r10,3
	and	%r10,0x3c	; 	xand	%r10,%r10,0xfffffffc
	ld.h	[%r11],%r10	; 	xld.h	[%r11],%r10
	ext	0x16		; 	xsub	%r11,%r2,22
	sub	%r11,%r2
	ext	0x8c		; 	xld.w	%r12,[%r2+140]
	ld.w	%r12,[%r2]
	add	%r12,0x3	; 	xadd	%r12,%r12,3
	and	%r12,0x3c	; 	xand	%r12,%r12,0xfffffffc
	ld.h	[%r11],%r12	; 	xld.h	[%r11],%r12
	ld.h	%r10,%r10
	ld.h	%r12,%r12
	mlt.w	%r10,%r12
	ld.w	%r12,%alr
	ext	malloc@rm	; 	xcall	malloc
	call	malloc@rl
	ext	0x14		; 	xsub	%r11,%r2,20
	sub	%r11,%r2
	ld.w	[%r11],%r10	; 	xld.w	[%r11],%r10
	cmp	%r10,0x0
	jrne	__LX92		; 	xjrne	__L92
	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,0x00000152		; 338
	ld.w	%r10,0x12
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX92:				; __L92:
	ext	0x68		; 	xld.w	%r12,[%r2+104]
	ld.w	%r12,[%r2]
	ext	malloc@rm	; 	xcall	malloc
	call	malloc@rl
	ext	0xc		; 	xsub	%r11,%r2,12
	sub	%r11,%r2
	ld.w	[%r11],%r10	; 	xld.w	[%r11],%r10
	cmp	%r10,0x0
	jrne	__LX93		; 	xjrne	__L93
	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,0x00000156		; 342
	ld.w	%r10,0x16
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX93:				; __L93:
	add	%sp,0x1f	; 	xadd	%sp,%sp,124
	popn	%r3
	ret
	.align	1
	.global	cvid_free
cvid_free:
;	.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	cvid_driver+0x18@h	; 	xld.w	%r1,cvid_driver+24
	ext	cvid_driver+0x18@m
	ld.w	%r1,cvid_driver+0x18@l
	ld.w	%r12,[%r1]	; 	xld.w	%r12,[%r1]
	cmp	%r12,0x0
	jreq	__LX94		; 	xjreq	__L94
	ext	0x18		; 	xadd	%r13,%r1,24
	add	%r13,%r1
	ld.w	%r14,0x0
	ext	mmioAscend@rm	; 	xcall	mmioAscend
	call	mmioAscend@rl
	ld.w	%r0,%r10
	cmp	%r0,0x0
	jreq	__LX96		; 	xjreq	__L96
	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,0x00000168		; 360
	ld.w	%r10,0x28
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX96:				; __L96:
	ld.w	%r12,[%r1]	; 	xld.w	%r12,[%r1]
	ext	0x4		; 	xadd	%r13,%r1,4
	add	%r13,%r1
	ld.w	%r14,%r0
	ext	mmioAscend@rm	; 	xcall	mmioAscend
	call	mmioAscend@rl
	ld.w	%r0,%r10
	cmp	%r0,0x0
	jreq	__LX97		; 	xjreq	__L97
	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,0x0000016b		; 363
	ld.w	%r10,0x2b
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX97:				; __L97:
	ld.w	%r12,[%r1]	; 	xld.w	%r12,[%r1]
	ld.w	%r13,%r0
	ext	mmioClose@rm	; 	xcall	mmioClose
	call	mmioClose@rl
	ld.w	%r0,%r10
	cmp	%r0,0x0
	jreq	__LX98		; 	xjreq	__L98
	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,0x0000016d		; 365
	ld.w	%r10,0x2d
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX98:				; __L98:
	ext	0x14		; 	xsub	%r10,%r1,20
	sub	%r10,%r1
	ld.w	%r12,[%r10]	; 	xld.w	%r12,[%r10]
	ext	free@rm		; 	xcall	free
	call	free@rl
	ext	0xc		; 	xsub	%r10,%r1,12
	sub	%r10,%r1
	ld.w	%r12,[%r10]	; 	xld.w	%r12,[%r10]
	ext	free@rm		; 	xcall	free
	call	free@rl
	ext	0x4		; 	xsub	%r10,%r1,4
	sub	%r10,%r1
	ld.w	%r12,[%r10]	; 	xld.w	%r12,[%r10]
	ext	free@rm		; 	xcall	free
	call	free@rl
	ext	0x18		; 	xsub	%r12,%r1,24
	sub	%r12,%r1
	ld.w	%r13,%r0
	ext	0x3		; 	xld.w	%r14,0x000000cc		; 204
	ld.w	%r14,0xc
	ext	memset@rm	; 	xcall	memset
	call	memset@rl
__LX94:				; __L94:
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	popn	%r1
	ret
	.align	1
	.global	cvid_update
cvid_update:
;	.frame	%sp,40,$31		# vars= 20, regs= 3/0, args= 8, extra= 0
;	.mask	0x80030000,-4
;	.fmask	0x00000000,0
	pushn	%r1
	sub	%sp,0x7		; 	xsub	%sp,%sp,28
	ext	cvid_driver+0xc4@ah	; 	xld.w	%r10,[cvid_driver+196]
	ext	cvid_driver+0xc4@al
	ld.w	%r10,[%r8]
	cmp	%r10,0x0
	jreq	__LX119		; 	xjreq	__L119
__LX101:				; __L101:
	ext	cvid_driver+0x44@h	; 	xld.w	%r0,cvid_driver+68
	ext	cvid_driver+0x44@m
	ld.w	%r0,cvid_driver+0x44@l
	ld.w	%r15,[%r0]	; 	xld.w	%r15,[%r0]
	cmp	%r15,0x0
	jrne	__LX104		; 	xjrne	__L104
	ext	0x2c		; 	xsub	%r10,%r0,44
	sub	%r10,%r0
	ld.w	%r12,[%r10]	; 	xld.w	%r12,[%r10]
	ld.w	%r13,%sp	; 	xadd	%r13,%sp,8
	add	%r13,0x8
	ext	0x14		; 	xsub	%r14,%r0,20
	sub	%r14,%r0
	ext	mmioDescend@rm	; 	xcall	mmioDescend
	call	mmioDescend@rl
	cmp	%r10,0x0
	jreq	__LX105		; 	xjreq	__L105
	ext	0x80		; 	xadd	%r12,%r0,128
	add	%r12,%r0
	ld.w	%r10,[%r12]	; 	xld.w	%r10,[%r12]
	cmp	%r10,0x0
	jrle	__LX106		; 	xjrle	__L106
	sub	%r10,0x1	; 	xsub	%r10,%r10,1
	ld.w	[%r12],%r10	; 	xld.w	[%r12],%r10
	jrne	__LX106		; 	xjrne	__L106
__LX119:				; __L119:
	ld.w	%r10,0x3f	; 	xld.w	%r10,-1			; 0xffffffff
	ext	__LX118@rm	; 	xjp	__L118
	jp	__LX118@rl
__LX106:				; __L106:
	ext	cvid_driver+0x18@h	; 	xld.w	%r10,cvid_driver+24
	ext	cvid_driver+0x18@m
	ld.w	%r10,cvid_driver+0x18@l
	ext	0xb0		; 	xadd	%r0,%r10,176
	add	%r0,%r10
	ld.w	%r12,[%r10]	; 	xld.w	%r12,[%r10]
	ld.w	%r13,[%r0]	; 	xld.w	%r13,[%r0]
	ld.w	%r14,0x0
	ext	mmioSeek@rm	; 	xcall	mmioSeek
	call	mmioSeek@rl
	ld.w	%r11,[%r0]	; 	xld.w	%r11,[%r0]
	cmp	%r10,%r11
	jreq	__LX101		; 	xjreq	__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,0x00000190		; 400
	ld.w	%r10,0x10
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX105:				; __L105:
	ld.w	%r10,[%sp+0x2]	; 	xld.w	%r10,[%sp+8]
	ext	0xa8a		; 	xcmp	%r10,1414744396
	ext	0xd25
	cmp	%r10,0xc
	jrne	__LX110		; 	xjrne	__L110
	ld.w	%r10,[%sp+0x4]	; 	xld.w	%r10,[%sp+16]
	ext	0x40c		; 	xcmp	%r10,543384946
	ext	0xd95
	cmp	%r10,0x32
	jrne	__LX110		; 	xjrne	__L110
	ld.w	%r12,%r0
	ld.w	%r13,%sp	; 	xadd	%r13,%sp,8
	add	%r13,0x8
	ld.w	%r14,0x14	; 	xld.w	%r14,0x00000014		; 20
	ext	memcpy@rm	; 	xcall	memcpy
	call	memcpy@rl
	jp	__LX101		; 	xjp	__L101
__LX104:				; __L104:
	ext	0x2c		; 	xsub	%r1,%r0,44
	sub	%r1,%r0
	ld.w	%r12,[%r1]	; 	xld.w	%r12,[%r1]
	ld.w	%r13,%sp	; 	xadd	%r13,%sp,8
	add	%r13,0x8
	ld.w	%r14,%r0
	ld.w	%r15,0x0
	ext	mmioDescend@rm	; 	xcall	mmioDescend
	call	mmioDescend@rl
	cmp	%r10,0x0
	jreq	__LX110		; 	xjreq	__L110
	ld.w	%r12,[%r1]	; 	xld.w	%r12,[%r1]
	ld.w	%r13,%r0
	ld.w	%r14,0x0
	ext	mmioAscend@rm	; 	xcall	mmioAscend
	call	mmioAscend@rl
	cmp	%r10,0x0
	jreq	__LX112		; 	xjreq	__L112
	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,0x0000019e		; 414
	ld.w	%r10,0x1e
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX112:				; __L112:
	ld.w	[%r0],%r10	; 	xld.w	[%r0],%r10
	jp	__LX101		; 	xjp	__L101
__LX110:				; __L110:
	ld.b	%r12,[%sp+0x8]	; 	xld.b	%r12,[%sp+8]
	ext	0x0		; 	xcmp	%r12,48
	cmp	%r12,0x30
	jrne	__LX116		; 	xjrne	__L116
	ld.b	%r11,[%sp+0x9]	; 	xld.b	%r11,[%sp+9]
	ext	cvid_driver+0x58@h	; 	xld.w	%r13,cvid_driver+88
	ext	cvid_driver+0x58@m
	ld.w	%r13,cvid_driver+0x58@l
	ld.w	%r10,[%r13]	; 	xld.w	%r10,[%r13]
	add	%r10,%r12
	cmp	%r11,%r10
	jrne	__LX116		; 	xjrne	__L116
	ld.w	%r14,[%sp+0x3]	; 	xld.w	%r14,[%sp+12]
	ext	0x28		; 	xld.w	%r10,[%r13+40]
	ld.w	%r10,[%r13]
	cmp	%r14,%r10
	jrule	__LX114		; 	xjrule	__L114
	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,0x000001a5		; 421
	ld.w	%r10,0x25
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX114:				; __L114:
	ext	0x40		; 	xsub	%r10,%r13,64
	sub	%r10,%r13
	ext	0x4c		; 	xsub	%r11,%r13,76
	sub	%r11,%r13
	ld.w	%r12,[%r10]	; 	xld.w	%r12,[%r10]
	ld.w	%r13,[%r11]	; 	xld.w	%r13,[%r11]
	ext	mmioRead@rm	; 	xcall	mmioRead
	call	mmioRead@rl
	ld.w	%r11,[%sp+0x3]	; 	xld.w	%r11,[%sp+12]
	cmp	%r10,%r11
	jreq	__LX115		; 	xjreq	__L115
	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,0x000001a7		; 423
	ld.w	%r10,0x27
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX115:				; __L115:
	call	cvid_decode	; 	xcall	cvid_decode
	ld.w	%r10,0x0
	jp	__LX118		; 	xjp	__L118
__LX116:				; __L116:
	ext	cvid_driver+0x18@ah	; 	xld.w	%r12,[cvid_driver+24]
	ext	cvid_driver+0x18@al
	ld.w	%r12,[%r8]
	ld.w	%r13,%sp	; 	xadd	%r13,%sp,8
	add	%r13,0x8
	ld.w	%r14,0x0
	ext	mmioAscend@rm	; 	xcall	mmioAscend
	call	mmioAscend@rl
	cmp	%r10,0x0
	ext	__LX101@rm	; 	xjreq	__L101
	jreq	__LX101@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	0x6		; 	xld.w	%r10,0x000001b1		; 433
	ld.w	%r10,0x31
	ld.w	[%sp+0x1],%r10	; 	xld.w	[%sp+4],%r10
	ext	die@rm		; 	xcall	die
	call	die@rl
__LX118:				; __L118:
	add	%sp,0x7		; 	xadd	%sp,%sp,28
	popn	%r1
	ret
	.align	1
cvid_decode_DIE:
;	.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	__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	0xb		; 	xld.w	%r10,0x000002c3		; 707
	ld.w	%r10,0x3
	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
	ret
; APP
	
	.code
	.align	1
cvid_decode:
	pushn	%r3
	ext	cvid_driver+0x0@h	; 	xld.w	%r0, cvid_driver			; %r0  := &cvid_driver
	ext	cvid_driver+0x0@m
	ld.w	%r0,cvid_driver+0x0@l
	ext	0xc		; 	xld.w	%r1, [%r0+12]				; %r1  := data = buffer
	ld.w	%r1,[%r0]
	ext	0x10		; 	xld.w	%r2, [%r0+16]				; %r2  := num_strips							*anti-interlock*
	ld.w	%r2,[%r0]
	;/* Frame Header */
	add	%r1, 8					; %r1  := data += 8	// Flags, Length of CVID data, Width of coded frame, Height of coded frame
	ld.uh	%r3, [%r1]+				; %r3  := frame_strips	// Number of coded strips
	sla	%r3,0x8		; 	xsla	%r3, 16
	sla	%r3,0x8
	swap	%r3, %r3
	;// %r0  := &cvid_driver
	;// %r1  := data
	;// %r2  := num_strips
	;// %r3  := frame_strips
	cmp	%r3, %r2				; if(frame_strips > num_strips) {
	jrle	cvid_decode_REALLOC	; 	xjrle	cvid_decode_REALLOC
	ext	0x10		; 	xld.w	[%r0+16], %r3				;   cvid_driver.num_strips = frame_strips
	ld.w	[%r0],%r3
	ext	0x14		; 	xld.w	%r12, [%r0+20]				;   %r12 := strips
	ld.w	%r12,[%r0]
	ld.w	%r13, %r3				;   %r13 := frame_strips
;//	xsla	%r13, 10				;   %r13 := frame_strips * 1024 --------------------------+
	sla	%r13, 8					;   <-----------------------------------------------------+
	ext	realloc@rm	; 	xcall.d	realloc					;   %r10 := strips = realloc(strips, frame_strips * 1024) |
	call.d	realloc@rl
	sla	%r13, 2					;   <-----------------------------------------------------+		*delay*
	cmp	%r10, 0					;   if(!strips) DIE()
	jreq	cvid_decode_DIE	; 	xjreq	cvid_decode_DIE
	ext	0x14		; 	xld.w	[%r0+20], %r10				;   cvid_driver.strips = strips
	ld.w	[%r0],%r10
cvid_decode_REALLOC:					; }
	ext	0x4		; 	xld.w	%r2, [%r0+4]				; %r2  := p = surface.vbuff
	ld.w	%r2,[%r0]
	ext	0x14		; 	xld.w	%r0, [%r0+20]				; %r0  := strip = strips
	ld.w	%r0,[%r0]
	;// %r0  := strip
	;// %r1  := data
	;// %r2  := p
	;// %r3  := frame_strips
	ext	0x38		; 	xld.w	%r12, 0x0e00				; %r12 := FRAM4
	ld.w	%r12,0x0
	ext	cvid_decode_START+0x0@h	; 	xld.w	%r13, cvid_decode_START			; %r13 := START
	ext	cvid_decode_START+0x0@m
	ld.w	%r13,cvid_decode_START+0x0@l
	ext	cvid_decode_END+0x0@h	; 	xld.w	%r14, cvid_decode_END			; %r14 := END
	ext	cvid_decode_END+0x0@m
	ld.w	%r14,cvid_decode_END+0x0@l
	sub	%sp,0x1		; 	xsub	%sp, %sp, 4
	ld.w	[%sp+0x0],%r12	; 	xld.w	[%sp+0], %r12				; retp := FRAM4
	ext	memcpy@rm	; 	xjp.d	memcpy					; memcpy(FRAM4, START, END - START)
	jp.d	memcpy@rl
	sub	%r14, %r13				; %r14 := END - START							*delay*
;//{{ここからFRAM4領域へ転送
cvid_decode_START:
	ext	0x1e1e		; 	xld.w	%r4, 0xF0F0F0F0
	ext	0x3c3
	ld.w	%r4,0x30
	;// %r0  := strip
	;// %r1  := data
	;// %r2  := p
	;// %r3  := frame_strips
	;// %r4  := 0xF0F0F0F0
cvid_decode_STRIP_FOR:					; for(;;) {
	;/* Strip Header */
	add	%r1, 2					;			// Strip CVID ID
	ld.uh	%r5, [%r1]+				;   %r5  := strip_size	// Size of strip data
	sla	%r5,0x8		; 	xsla	%r5, 16
	sla	%r5,0x8
	swap	%r5, %r5
	add	%r1, 4					;			// Strips top Y position, Strips top X position
	ld.uh	%r6, [%r1]+				;   %r6  := strip_h	// Strips bottom Y position
	sla	%r6,0x8		; 	xsla	%r6, 16
	sla	%r6,0x8
	swap	%r6, %r6
	ld.uh	%r7, [%r1]+				;   %r7  := strip_w	// Strips bottom X position
	sla	%r7,0x8		; 	xsla	%r7, 16
	sla	%r7,0x8
	swap	%r7, %r7
	sub	%r5, 12					;   %r5  := strip_size - 12/*Strip Header*/
	add	%r5, %r1				;   %r5  := strip_end = data + (strip_size - 12/*Strip Header*/)
	;// %r0  := strip
	;// %r1  := data
	;// %r2  := p
	;// %r3  := frame_strips
	;// %r4  := 0xF0F0F0F0
	;// %r5  := strip_end
	;// %r6  := strip_h
	;// %r7  := strip_w
cvid_decode_CHUNK_WHILE:
	cmp	%r1, %r5				;   while(data < strip_end) {
	ext	cvid_decode_CHUNK_BREAK@rm	; 	xjruge	cvid_decode_CHUNK_BREAK
	jruge	cvid_decode_CHUNK_BREAK@rl
	;/* CVID Chunk */
	ld.w	%r10, %r1				;     %r10 := &chunk_id = data	// CVID Chunk ID
	add	%r1, 2
	;// %r0  := strip
	;// %r1  := data
	;// %r2  := p
	;// %r3  := frame_strips
	;// %r4  := 0xF0F0F0F0
	;// %r5  := strip_end
	;// %r6  := strip_h
	;// %r7  := strip_w
	;// %r10 := &chunk_id
	ld.uh	%r11, [%r1]+				;     %r11 := SWAP(chunk_size)	// Size of chunk data
	btst	[%r10], 4				;     switch(chunk_id) {
	jrne	cvid_decode_FRAME	; 	xjrne	cvid_decode_FRAME
	;// CODEBOOK -----------------------------------;
;//cvid_decode_CODEBOOK:				;     case 0x2000,0x2100,0x2200,0x2300,0x2400,0x2500,0x2600,0x2700:
	sla	%r11,0x8	; 	xsla	%r11, 16				;       %r11 := chunk_size
	sla	%r11,0x8
	swap	%r11, %r11
	sub	%r11, 4					;       %r11 := chunk_size - 4/*CVID Chunk*/
	add	%r11, %r1				;       %r11 := chunk_end = data + (chunk_size - 4/*CVID Chunk*/)
	btst	[%r10], 1				;       %r12 := codebook = (chunk_id & 0x0200) ? strip->v1 : strip->v4
	jreq.d	4
	 ld.w	%r12, %r0				;									*delay*
	 ext	8	;// xadd %r4,%r4,512
	 add	%r12, 0
	;// %r0  := strip
	;// %r1  := data
	;// %r2  := p
	;// %r3  := frame_strips
	;// %r4  := 0xF0F0F0F0
	;// %r5  := strip_end
	;// %r6  := strip_h
	;// %r7  := strip_w
	;// %r10 := &chunk_id
	;// %r11 := chunk_end
	;// %r12 := codebook
cvid_decode_CODEBOOK_WHILE:
	cmp	%r1, %r11				;       while(data < chunk_end) {
	jruge	cvid_decode_CHUNK_WHILE	; 	xjruge	cvid_decode_CHUNK_WHILE
	btst	[%r10], 0				;         %r13 := flag = (chunk_id & 0x0100) ? get_word() : -1
	jreq.d	7
	 ld.w	%r13, -1				;									*delay*
	 ld.uh	%r13, [%r1]+
	 ld.uh	%r9, [%r1]+
	sla	%r9,0x8		; 	 xsla	%r9, 16
	sla	%r9,0x8
	 or	%r13, %r9
	 swap	%r13, %r13
	ld.w	%r14, 31				;         %r14 := mask = 31
	;// %r0  := strip
	;// %r1  := data
	;// %r2  := p
	;// %r3  := frame_strips
	;// %r4  := 0xF0F0F0F0
	;// %r5  := strip_end
	;// %r6  := strip_h
	;// %r7  := strip_w
	;// %r10 := &chunk_id
	;// %r11 := chunk_end
	;// %r12 := codebook
	;// %r13 := flag
	;// %r14 := mask
cvid_decode_CODEBOOK_DO:				;         do {
	cmp	%r1, %r11				;           if(data >= chunk_end) break
	jruge	cvid_decode_CHUNK_WHILE	; 	xjruge	cvid_decode_CHUNK_WHILE
	add	%r13, %r13				;           %psr(C), %r13 := flag <<= 1
	jruge	12					;           if(%psr(C)) {
	 ld.uh	%r15, [%r1]+				;             %r15 := y1y1y1y1 y0y0y0y0			// Luminance value 0, Luminance value 1
	 ld.uh	%r9, [%r1]+				;             %r9  := y3y3y3y3 y2y2y2y2			// Luminance value 2, Luminance value 3
	 btst	[%r10], 2				;             if(!(chunk_id & 0x0400)) data += 2	// U Chrominance value, V Chrominance value
	 jrne.d	3
	  and	%r15, %r4				;             %r15 := y1y10000 y0y00000					*delay*
	  add	%r1, 2
	 and	%r9, %r4				;             %r9  := y3y30000 y2y20000
	 rr	%r15, 4					;             %r15 := 0000y1y1 0000y0y0
	 or	%r15, %r9				;             %r15 := y3y3y1y1 y2y2y0y0
	 not	%r15, %r15				;             輝度反転
	 ld.h	[%r12], %r15				;             *codebook = y3y3y1y1 y2y2y0y0 }
;//	add	%r12, 2					;           codebook++ --------+
	sub	%r14, 1					;         } while(--mask >= 0) |
	jrge.d	cvid_decode_CODEBOOK_DO	; 	xjrge.d	cvid_decode_CODEBOOK_DO			;                              |
	add	%r12, 2					;           <------------------+					*delay*
	jp	cvid_decode_CODEBOOK_WHILE	; 	xjp	cvid_decode_CODEBOOK_WHILE		;       }
	;// FRAME --------------------------------------;
cvid_decode_FRAME:					;     case 0x3000,0x3100,0x3200:
	ext	cvid_driver+0x0@ah	; 	xld.h	%r12, [cvid_driver+0]			;       %r12 := surface.w
	ext	cvid_driver+0x0@al
	ld.h	%r12,[%r8]
	;// %r0  := strip
	;// %r1  := data
	;// %r2  := p
	;// %r3  := frame_strips
	;// %r4  := 0xF0F0F0F0
	;// %r5  := strip_end
	;// %r6  := strip_h
	;// %r7  := strip_w
	;// %r10 := &chunk_id
	;// %r12 := surface.w
cvid_decode_FRAME_FOR:					;       for(;;) {
	btst	[%r10], 1				;         %r13 := flag = (chunk_id & 0x0200) ? 0 : get_word()
	jrne.d	12
	 ld.w	%r13, 0					;									*delay*
	 ld.ub	%r13, [%r1]+
	 sla	%r13, 8
	 ld.ub	%r9, [%r1]+
	 or	%r13, %r9
	 sla	%r13, 8
	 ld.ub	%r9, [%r1]+
	 or	%r13, %r9
	 sla	%r13, 8
	 ld.ub	%r9, [%r1]+
	 or	%r13, %r9
	ld.w	%r14, 31				;         %r14 := mask = 31
	;// %r0  := strip
	;// %r1  := data
	;// %r2  := p
	;// %r3  := frame_strips
	;// %r4  := 0xF0F0F0F0
	;// %r5  := strip_end
	;// %r6  := strip_h
	;// %r7  := strip_w
	;// %r10 := &chunk_id
	;// %r12 := surface.w
	;// %r13 := flag
	;// %r14 := mask
cvid_decode_FRAME_DO:					;         do {
	btst	[%r10], 0				;           if(chunk_id & 0x0100) {
	jreq	18
	 add	%r13, %r13				;             %psr(C), %r13 := flag <<= 1
	 jrult	3					;             if(!%psr(C)) {
	  jp.d	cvid_decode_FRAME_SKIP			;               goto L_SKIP
	  add	%r2, 4					;               %r2  := p += 4 }					*delay*
	 sub	%r14, 1					;             if(--mask < 0) {
	 jrge	12
	  ld.ub	%r13, [%r1]+				;               %r13 := flag = get_word()
	  sla	%r13, 8
	  ld.ub	%r9, [%r1]+
	  or	%r13, %r9
	  sla	%r13, 8
	  ld.ub	%r9, [%r1]+
	  or	%r13, %r9
	  sla	%r13, 8
	  ld.ub	%r9, [%r1]+
	  or	%r13, %r9
	  ld.w	%r14, 31				;               %r14 := mask = 31 } }
;//{{共通化
	ld.ub	%r15, [%r1]+				;           %r15 := i
	sla	%r15, 1					;           %r15 := codebook
;//	add	%r15, %r0				;           ----------------------------+
;//}}共通化						;                                       |
	add	%r13, %r13				;           %psr(C), %r13 := flag <<= 1 |
	jrult.d	cvid_decode_FRAME_V4	; 	xjrult.d cvid_decode_FRAME_V4			;           if(!%psr(C)) {              |
	add	%r15, %r0				;           <---------------------------+				*delay*
;//cvid_decode_FRAME_V1:
;//{{共通化
;//	ld.ub	%r15, [%r1]+				;             %r15 := i
;//	sla	%r15, 1					;             %r15 := codebook
;//	add	%r15, %r0
;//}}共通化
	ext	0x200		; 	xld.uh	%r15, [%r15+512]			;             %r15 := 00000000 00000000 y3y3y1y1 y2y2y0y0
	ld.uh	%r15,[%r15]
	swap	%r9, %r15				;             %r9  := y2y2y0y0 y3y3y1y1 00000000 00000000
	or	%r15, %r9				;             %r15 := y2y2y0y0 y3y3y1y1 y3y3y1y1 y2y2y0y0
	rl	%r15, 8					;             %r15 := y3y3y1y1 y3y3y1y1 y2y2y0y0 y2y2y0y0
	ld.w	%r9, %r15				;             %r9  := y3y3y1y1 y3y3y1y1 y2y2y0y0 y2y2y0y0
	and	%r9, %r4				;             %r9  := y3y30000 y3y30000 y2y20000 y2y20000
	sub	%r15, %r9				;             %r15 := 0000y1y1 0000y1y1 0000y0y0 0000y0y0
	rr	%r9, 4					;             %r9  := 0000y3y3 0000y3y3 0000y2y2 0000y2y2
	ld.w	[%r2], %r15				;             *p = [y0,y0,y1,y1]
	add	%r2, %r12				;             %r2  := p += surface.w
	ld.w	[%r2], %r15				;             *p = [y0,y0,y1,y1]
	add	%r2, %r12				;             %r2  := p += surface.w
	ld.w	[%r2], %r9				;             *p = [y2,y2,y3,y3]
	add	%r2, %r12				;             %r2  := p += surface.w
	ld.w	[%r2]+, %r9				;             *p++ = [y2,y2,y3,y3]
	jp	cvid_decode_FRAME_NEXT	; 	xjp	cvid_decode_FRAME_NEXT
cvid_decode_FRAME_V4:					;           } else {
;//{{共通化
;//	ld.ub	%r15, [%r1]+				;             %r15 := i
;//	sla	%r15, 1					;             %r15 := codebook
;//	add	%r15, %r0
;//}}共通化
;//	ld.uh	%r15, [%r15]				;             %r15 := 00000000 00000000 r0y3r0y1 r0y2r0y0 -+
	ld.ub	%r9, [%r1]+				;             %r9  := i                                    |
	sla	%r9, 1					;             %r9  := codebook                             |
	add	%r9, %r0				;                                                          |
	ld.uh	%r9, [%r9]				;             %r9  := 00000000 00000000 r1y3r1y1 r1y2r1y0  |
	ld.uh	%r15, [%r15]				;             <--------------------------------------------+		*anti-interlock*
	sla	%r9,0x8		; 	xsla	%r9, 16					;             %r9  := r1y3r1y1 r1y2r1y0 00000000 00000000
	sla	%r9,0x8
	or	%r15, %r9				;             %r15 := r1y3r1y1 r1y2r1y0 r0y3r0y1 r0y2r0y0
	ld.w	%r9, %r15				;             %r9  := r1y3r1y1 r1y2r1y0 r0y3r0y1 r0y2r0y0
	and	%r9, %r4				;             %r9  := r1y30000 r1y20000 r0y30000 r0y20000
	sub	%r15, %r9				;             %r15 := 0000r1y1 0000r1y0 0000r0y1 0000r0y0
	rr	%r9, 4					;             %r9  := 0000r1y3 0000r1y2 0000r0y3 0000r0y2
	ld.w	[%r2], %r15				;             *p = [r0y0,r0y1,r1y0,r1y1]
	add	%r2, %r12				;             %r2  := p += surface.w
	ld.w	[%r2], %r9				;             *p = [r0y2,r0y3,r1y2,r1y3]
	add	%r2, %r12				;             %r2  := p += surface.w
	;
	ld.ub	%r15, [%r1]+				;             %r15 := i
	sla	%r15, 1					;             %r15 := codebook
	add	%r15, %r0
;//	ld.uh	%r15, [%r15]				;             %r15 := 00000000 00000000 r2y3r2y1 r2y2r2y0 -+
	ld.ub	%r9, [%r1]+				;             %r9  := i                                    |
	sla	%r9, 1					;             %r9  := codebook                             |
	add	%r9, %r0				;                                                          |
	ld.uh	%r9, [%r9]				;             %r9  := 00000000 00000000 r3y3r3y1 r3y2r3y0  |
	ld.uh	%r15, [%r15]				;             <--------------------------------------------+		*anti-interlock*
	sla	%r9,0x8		; 	xsla	%r9, 16					;             %r9  := r3y3r3y1 r3y2r3y0 00000000 00000000
	sla	%r9,0x8
	or	%r15, %r9				;             %r15 := r3y3r3y1 r3y2r3y0 r2y3r2y1 r2y2r2y0
	ld.w	%r9, %r15				;             %r9  := r3y3r3y1 r3y2r3y0 r2y3r2y1 r2y2r2y0
	and	%r9, %r4				;             %r9  := r3y30000 r3y20000 r2y30000 r2y20000
	sub	%r15, %r9				;             %r15 := 0000r3y1 0000r3y0 0000r2y1 0000r2y0
	rr	%r9, 4					;             %r9  := 0000r3y3 0000r3y2 0000r2y3 0000r2y2
	ld.w	[%r2], %r15				;             *p = [r2y0,r2y1,r3y0,r3y1]
	add	%r2, %r12				;             %r2  := p += surface.w
	ld.w	[%r2]+, %r9				;             *p++ = [r0y2,r0y3,r3y2,r3y3]
cvid_decode_FRAME_NEXT:					;           }
	sub	%r2, %r12				;           %r2  := p -= surface.w * 3
	sub	%r2, %r12
	sub	%r2, %r12
cvid_decode_FRAME_SKIP:					; L_SKIP:
	sub	%r7, 4					;           if(!(strip_w -= 4)) {
	jrne	11
	 add	%r2, %r12				;             %r2  := p += cvid_driver.surface.w * 3
	 add	%r2, %r12
	 add	%r2, %r12
	 sub	%r6, 4					;             if(!(strip_h -= 4)) {
	 jrne	5
	  add	%r1, 1					;               %r1  := data = (data + 1) & ~1
;//	  and	%r1, -2					;               ---------+
	  ext	cvid_decode_CHUNK_WHILE@rm		;                        |	ext無しのjp一命令では届きませんでした
	  jp.d	cvid_decode_CHUNK_WHILE@rl		;               exit for |
	  and	%r1, -2					;               <--------+ }						*delay*
	 ld.w	%r7, %r12				;             %r7  := strip_w = surface.w }
	sub	%r14, 1					;         } while(--mask >= 0)
	jrge	cvid_decode_FRAME_DO	; 	xjrge	cvid_decode_FRAME_DO
	jp	cvid_decode_FRAME_FOR	; 	xjp	cvid_decode_FRAME_FOR			;       }
cvid_decode_CHUNK_BREAK:				;     } }
	;// %r0  := strip
	;// %r1  := data
	;// %r2  := p
	;// %r3  := frame_strips
	;// %r4  := 0xF0F0F0F0
	sub	%r3, 1					;   if(!--frame_strips) break
	jreq	cvid_decode_STRIP_BREAK	; 	xjreq	cvid_decode_STRIP_BREAK
	ext	cvid_driver+0xc@ah	; 	xld.w	%r9, [cvid_driver+12]			;   %r9  := &frame_flags = buffer
	ext	cvid_driver+0xc@al
	ld.w	%r9,[%r8]
	ext	0x10		; 	xld.w	%r5, 1024				;   %r5  := cnt = 1024							*anti-interlock*
	ld.w	%r5,0x0
	btst	[%r9], 0				;   if(frame_flags & 1) continue
	ext	cvid_decode_STRIP_FOR@rm	; 	xjrne.d	cvid_decode_STRIP_FOR
	jrne.d	cvid_decode_STRIP_FOR@rl
	add	%r0, %r5				;   %r0  := strip += 1024						*delay*
	ld.w	%r6, %r0				;   %r6  := dst = strip + 1024
	sub	%r0, %r5				;   %r0  := src = strip
	;// %r0  := src
	;// %r1  := data
	;// %r2  := p
	;// %r3  := frame_strips
	;// %r4  := 0xF0F0F0F0
	;// %r5  := cnt
	;// %r6  := dst
	;//{{高速版memcpy()と同じアルゴリズムです。clippce.cを参照してください。
	sub	%r5, 4					;   %r5  := (cnt-4) ------+
	 ld.w	%r9, [%r0]+				;     word = *src++       |
	 ld.w	[%r6]+, %r9				;     *dst++ = word       |
	jrne.d	-2					;   while(cnt-4) <--------+ フラグ影響
	sub	%r5, 4					;   %r5  := (cnt-4) -= 4 -+						*delay*
	;//}}高速版memcpy()と同じアルゴリズムです。clippce.cを参照してください。
	ext	cvid_decode_STRIP_FOR@rm	; 	xjp	cvid_decode_STRIP_FOR			; }
	jp	cvid_decode_STRIP_FOR@rl
cvid_decode_STRIP_BREAK:
	popn	%r3
	ret
cvid_decode_END:
;//}}ここまでFRAM4領域へ転送

; NO_APP

	.comm	cvid_driver 204
