	.file	"extr_vdp_ctrl.c_vdp_68k_ctrl_w.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	vdp_68k_ctrl_w
	.type	vdp_68k_ctrl_w, @function
vdp_68k_ctrl_w:
.LFB0:
	.cfi_startproc
	endbr64
	mov	esi, DWORD PTR pending[rip]
	push	rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	mov	ebx, edi
	test	esi, esi
	jne	.L2
	mov	ecx, DWORD PTR dma_length[rip]
	test	ecx, ecx
	jne	.L29
.L3:
	mov	eax, ebx
	and	eax, 49152
	cmp	eax, 32768
	je	.L30
	mov	rcx, QWORD PTR reg[rip]
	mov	eax, DWORD PTR 4[rcx]
	and	eax, 4
	mov	DWORD PTR pending[rip], eax
.L6:
	mov	edi, DWORD PTR code[rip]
	mov	eax, ebx
	shr	ebx, 14
	and	ebx, 3
	and	eax, 16383
	or	eax, DWORD PTR addr_latch[rip]
	and	edi, 60
	mov	DWORD PTR addr[rip], eax
	or	ebx, edi
	mov	DWORD PTR code[rip], ebx
.L7:
	mov	eax, DWORD PTR 48[rcx]
	and	eax, 1
	cmp	eax, 1
	sbb	eax, eax
	and	ebx, 15
	and	eax, 24
	add	eax, 190
	cmp	ebx, 2
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	setle	cl
	sal	eax, cl
	mov	DWORD PTR fifo_latency[rip], eax
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	edx, DWORD PTR addr[rip]
	mov	eax, edi
	shr	ebx, 2
	mov	edi, DWORD PTR code[rip]
	sal	eax, 14
	and	ebx, 60
	mov	DWORD PTR pending[rip], 0
	mov	rcx, QWORD PTR reg[rip]
	movzx	eax, ax
	and	edx, 16383
	and	edi, 3
	mov	DWORD PTR addr_latch[rip], eax
	or	ebx, edi
	or	eax, edx
	mov	DWORD PTR addr[rip], eax
	mov	DWORD PTR code[rip], ebx
	test	bl, 32
	je	.L7
	test	BYTE PTR 4[rcx], 16
	je	.L7
	mov	esi, DWORD PTR 92[rcx]
	mov	edx, esi
	sar	edx, 6
	cmp	edx, 2
	je	.L8
	cmp	edx, 3
	je	.L9
	mov	edx, DWORD PTR 80[rcx]
	mov	edi, 65536
	sal	edx, 8
	or	edx, DWORD PTR 76[rcx]
	cmove	edx, edi
	mov	DWORD PTR dma_length[rip], edx
	mov	edx, DWORD PTR 88[rcx]
	sal	edx, 8
	or	edx, DWORD PTR 84[rcx]
	mov	DWORD PTR dma_src[rip], edx
	mov	edx, DWORD PTR SYSTEM_MCD[rip]
	cmp	DWORD PTR system_hw[rip], edx
	je	.L31
.L15:
	mov	edx, DWORD PTR svp[rip]
	test	edx, edx
	je	.L17
	and	esi, 96
	jne	.L17
.L16:
	add	eax, DWORD PTR 60[rcx]
	sub	DWORD PTR dma_length[rip], 1
	mov	DWORD PTR addr[rip], eax
.L17:
	xor	eax, eax
	mov	edi, DWORD PTR m68k[rip]
	and	ebx, 6
	sete	al
	mov	DWORD PTR dma_type[rip], eax
	call	vdp_dma_update@PLT
	mov	rcx, QWORD PTR reg[rip]
	mov	ebx, DWORD PTR code[rip]
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L29:
	cmp	DWORD PTR dma_type[rip], 1
	jg	.L3
	mov	DWORD PTR cached_write[rip], edi
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L30:
	.cfi_restore_state
	mov	edi, ebx
	mov	edx, DWORD PTR m68k[rip]
	movzx	esi, bl
	shr	edi, 8
	and	edi, 31
	call	vdp_reg_w@PLT
	mov	rcx, QWORD PTR reg[rip]
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L31:
	mov	edx, DWORD PTR scd[rip]
	mov	edi, esi
	and	edi, 112
	sar	edx
	add	edx, 16
	cmp	edi, edx
	jne	.L15
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L8:
	mov	DWORD PTR dmafill[rip], 256
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L9:
	mov	eax, DWORD PTR 80[rcx]
	mov	edx, 65536
	mov	edi, DWORD PTR m68k[rip]
	mov	DWORD PTR dma_type[rip], 3
	sal	eax, 8
	or	eax, DWORD PTR 76[rcx]
	cmove	eax, edx
	mov	DWORD PTR dma_length[rip], eax
	mov	eax, DWORD PTR 88[rcx]
	sal	eax, 8
	or	eax, DWORD PTR 84[rcx]
	mov	DWORD PTR dma_src[rip], eax
	call	vdp_dma_update@PLT
	mov	rcx, QWORD PTR reg[rip]
	mov	ebx, DWORD PTR code[rip]
	jmp	.L7
	.cfi_endproc
.LFE0:
	.size	vdp_68k_ctrl_w, .-vdp_68k_ctrl_w
	.comm	system_hw,4,4
	.comm	svp,4,4
	.comm	scd,4,4
	.comm	reg,8,8
	.comm	pending,4,4
	.comm	m68k,4,4
	.comm	fifo_latency,4,4
	.comm	dmafill,4,4
	.comm	dma_type,4,4
	.comm	dma_src,4,4
	.comm	dma_length,4,4
	.comm	code,4,4
	.comm	cached_write,4,4
	.comm	addr_latch,4,4
	.comm	addr,4,4
	.comm	SYSTEM_MCD,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_vdp_ctrl.c_vdp_68k_ctrl_w.c"
	.text
	.align	2
	.global	vdp_68k_ctrl_w
	.syntax unified
	.arm
	.fpu softvfp
	.type	vdp_68k_ctrl_w, %function
vdp_68k_ctrl_w:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	ldr	lr, .L39
	mov	r4, r0
	ldr	r3, [lr]
	cmp	r3, #0
	bne	.L2
	ldr	r3, .L39+4
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L36
.L3:
	and	r3, r4, #49152
	cmp	r3, #32768
	beq	.L37
	ldr	r3, .L39+8
	ldr	r1, [r3]
	ldr	r3, [r1, #4]
	and	r3, r3, #4
	str	r3, [lr]
.L6:
	ldr	r2, .L39+12
	ldr	r0, .L39+16
	ldr	r3, [r2]
	ldr	lr, [r0]
	lsl	ip, r4, #16
	and	r3, r3, #60
	lsl	r0, r4, #18
	orr	r3, r3, ip, lsr #30
	lsr	r0, r0, #18
	ldr	ip, .L39+20
	orr	r0, r0, lr
	str	r3, [r2]
	str	r0, [ip]
.L7:
	ldr	r2, [r1, #48]
	and	r3, r3, #15
	tst	r2, #1
	movne	r2, #190
	moveq	r2, #214
	cmp	r3, #2
	movgt	r3, #0
	movle	r3, #1
	ldr	r1, .L39+24
	lsl	r3, r2, r3
	str	r3, [r1]
	pop	{r4, r5, r6, r7, r8, pc}
.L2:
	mov	r7, #0
	ldr	r5, .L39+12
	ldr	r6, .L39+20
	ldr	r3, [r5]
	ldr	r2, [r6]
	ldr	r1, .L39+28
	and	ip, r3, #3
	lsr	r3, r0, #2
	lsl	r2, r2, #18
	and	r3, r3, #60
	and	r0, r1, r0, lsl #14
	orr	r3, ip, r3
	ldr	r1, .L39+16
	ldr	r4, .L39+8
	lsr	r2, r2, #18
	orr	r2, r2, r0
	tst	r3, #32
	str	r0, [r1]
	str	r2, [r6]
	ldr	r1, [r4]
	str	r3, [r5]
	str	r7, [lr]
	beq	.L7
	ldr	r0, [r1, #4]
	tst	r0, #16
	beq	.L7
	ldr	ip, [r1, #92]
	asr	r0, ip, #6
	cmp	r0, #2
	beq	.L8
	cmp	r0, #3
	beq	.L9
	ldr	lr, [r1, #80]
	ldr	r0, [r1, #76]
	ldr	r7, .L39+32
	orrs	r0, r0, lr, lsl #8
	moveq	r0, #65536
	ldr	lr, .L39+4
	ldr	r7, [r7]
	str	r0, [lr]
	ldr	r0, .L39+36
	ldr	r8, [r1, #88]
	ldr	r0, [r0]
	cmp	r7, r0
	ldr	r0, [r1, #84]
	ldr	r7, .L39+40
	orr	r0, r0, r8, lsl #8
	str	r0, [r7]
	beq	.L38
.L15:
	ldr	r0, .L39+44
	ldr	r0, [r0]
	cmp	r0, #0
	beq	.L17
	tst	ip, #96
	bne	.L17
.L16:
	ldr	r0, [r1, #60]
	ldr	r1, [lr]
	add	r0, r0, r2
	sub	r2, r1, #1
	str	r0, [r6]
	str	r2, [lr]
.L17:
	tst	r3, #6
	moveq	r2, #1
	movne	r2, #0
	ldr	r1, .L39+48
	ldr	r3, .L39+52
	ldr	r0, [r1]
	str	r2, [r3]
	bl	vdp_dma_update
	ldr	r1, [r4]
	ldr	r3, [r5]
	b	.L7
.L36:
	ldr	r3, .L39+52
	ldr	r3, [r3]
	cmp	r3, #1
	bgt	.L3
	ldr	r3, .L39+56
	str	r0, [r3]
	pop	{r4, r5, r6, r7, r8, pc}
.L37:
	ldr	r3, .L39+48
	lsr	r0, r4, #8
	ldr	r2, [r3]
	and	r1, r4, #255
	and	r0, r0, #31
	bl	vdp_reg_w
	ldr	r3, .L39+8
	ldr	r1, [r3]
	b	.L6
.L38:
	ldr	r0, .L39+60
	and	r7, ip, #112
	ldr	r0, [r0]
	asr	r0, r0, #1
	add	r0, r0, #16
	cmp	r7, r0
	bne	.L15
	b	.L16
.L8:
	mov	r0, #256
	ldr	r2, .L39+64
	str	r0, [r2]
	b	.L7
.L9:
	ldr	r2, [r1, #80]
	ldr	r3, [r1, #76]
	ldr	ip, [r1, #88]
	orrs	r3, r3, r2, lsl #8
	moveq	r2, #65536
	ldrne	r2, .L39+4
	ldreq	r3, .L39+4
	strne	r3, [r2]
	streq	r2, [r3]
	mov	r2, #3
	ldr	r3, [r1, #84]
	ldr	r1, .L39+40
	orr	r3, r3, ip, lsl #8
	ldr	r0, .L39+48
	str	r3, [r1]
	ldr	r3, .L39+52
	ldr	r0, [r0]
	str	r2, [r3]
	bl	vdp_dma_update
	ldr	r1, [r4]
	ldr	r3, [r5]
	b	.L7
.L40:
	.align	2
.L39:
	.word	pending
	.word	dma_length
	.word	reg
	.word	code
	.word	addr_latch
	.word	addr
	.word	fifo_latency
	.word	65535
	.word	system_hw
	.word	SYSTEM_MCD
	.word	dma_src
	.word	svp
	.word	m68k
	.word	dma_type
	.word	cached_write
	.word	scd
	.word	dmafill
	.size	vdp_68k_ctrl_w, .-vdp_68k_ctrl_w
	.comm	system_hw,4,4
	.comm	svp,4,4
	.comm	scd,4,4
	.comm	reg,4,4
	.comm	pending,4,4
	.comm	m68k,4,4
	.comm	fifo_latency,4,4
	.comm	dmafill,4,4
	.comm	dma_type,4,4
	.comm	dma_src,4,4
	.comm	dma_length,4,4
	.comm	code,4,4
	.comm	cached_write,4,4
	.comm	addr_latch,4,4
	.comm	addr,4,4
	.comm	SYSTEM_MCD,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
