	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vdp_68k_data_w_m4
_vdp_68k_data_w_m4:                     ## @vdp_68k_data_w_m4
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	movq	_pending@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	_status@GOTPCREL(%rip), %rbx
	testb	$8, (%rbx)
	jne	LBB0_5
## %bb.1:
	movq	_reg@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testb	$64, 4(%rax)
	je	LBB0_5
## %bb.2:
	movq	_m68k@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_vdp_fifo_update
	movl	$65023, %eax                    ## imm = 0xFDFF
	andl	(%rbx), %eax
	movl	%eax, (%rbx)
	movq	_fifo_write_cnt@GOTPCREL(%rip), %rdx
	movl	(%rdx), %ecx
	cmpl	$3, %ecx
	jg	LBB0_4
## %bb.3:
	incl	%ecx
	movl	%ecx, (%rdx)
	andl	$4, %ecx
	shll	$6, %ecx
	orl	%eax, %ecx
	movl	%ecx, (%rbx)
	jmp	LBB0_5
LBB0_4:
	movq	_fifo_latency@GOTPCREL(%rip), %rax
	movq	_fifo_lastwrite@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	addl	(%rax), %edx
	movl	%edx, (%rcx)
	movl	%edx, (%r15)
LBB0_5:
	movq	_code@GOTPCREL(%rip), %rax
	testb	$2, (%rax)
	movq	_addr@GOTPCREL(%rip), %r15
	movl	(%r15), %ebx
	jne	LBB0_6
## %bb.9:
	movl	%ebx, %eax
	andl	$510, %eax                      ## imm = 0x1FE
	movq	%rbx, %rcx
	shrq	$8, %rcx
	andl	$2, %ecx
	movl	%ebx, %edx
	andl	$15360, %edx                    ## imm = 0x3C00
	orq	%rcx, %rdx
	leaq	(%rdx,%rax,2), %rdi
	movq	_vram@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%r14d, %ecx
	bswapl	%ecx
	shrl	$16, %ecx
	testb	$1, %bl
	cmovel	%r14d, %ecx
	cmpl	(%rax,%rdi,4), %ecx
	je	LBB0_11
## %bb.10:
	movl	%ecx, (%rax,%rdi,4)
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_MARK_BG_DIRTY
	jmp	LBB0_11
LBB0_6:
	andl	$31, %ebx
	movq	_cram@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%r14d, %ecx
	shrl	$3, %ecx
	andl	$448, %ecx                      ## imm = 0x1C0
	andl	$63, %r14d
	orl	%ecx, %r14d
	cmpl	(%rax,%rbx,8), %r14d
	je	LBB0_11
## %bb.7:
	movq	%rbx, %rcx
	addq	%rbx, %rcx
	movl	%r14d, (%rax,%rcx,4)
	movl	%ebx, %edi
	movl	%r14d, %esi
	callq	_color_update_m4
	movq	_bordrr@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	$15, %eax
	orl	$16, %eax
	cmpl	%eax, %ebx
	jne	LBB0_11
## %bb.8:
	movl	$64, %edi
	movl	%r14d, %esi
	callq	_color_update_m4
LBB0_11:
	movq	_reg@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	60(%rax), %eax
	movl	(%r15), %ecx
	addl	%ecx, %eax
	incl	%eax
	movl	%eax, (%r15)
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_pending,8,3                    ## @pending
	.comm	_status,4,2                     ## @status
	.comm	_reg,8,3                        ## @reg
	.comm	_m68k,4,2                       ## @m68k
	.comm	_fifo_write_cnt,4,2             ## @fifo_write_cnt
	.comm	_fifo_latency,8,3               ## @fifo_latency
	.comm	_fifo_lastwrite,4,2             ## @fifo_lastwrite
	.comm	_code,4,2                       ## @code
	.comm	_addr,4,2                       ## @addr
	.comm	_cram,8,3                       ## @cram
	.comm	_bordrr,4,2                     ## @bordrr
	.comm	_vram,8,3                       ## @vram
	.no_dead_strip	_vdp_68k_data_w_m4
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vdp_68k_data_w_m4
_vdp_68k_data_w_m4:                     ; @vdp_68k_data_w_m4
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
Lloh0:
	adrp	x8, _pending@GOTPAGE
Lloh1:
	ldr	x8, [x8, _pending@GOTPAGEOFF]
Lloh2:
	str	xzr, [x8]
Lloh3:
	adrp	x20, _status@GOTPAGE
Lloh4:
	ldr	x20, [x20, _status@GOTPAGEOFF]
	ldrb	w8, [x20]
Lloh5:
	adrp	x22, _reg@GOTPAGE
Lloh6:
	ldr	x22, [x22, _reg@GOTPAGEOFF]
	tbnz	w8, #3, LBB0_5
; %bb.1:
	ldr	x8, [x22]
	ldrb	w8, [x8, #4]
	tbz	w8, #6, LBB0_5
; %bb.2:
Lloh7:
	adrp	x21, _m68k@GOTPAGE
Lloh8:
	ldr	x21, [x21, _m68k@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_vdp_fifo_update
	ldr	w8, [x20]
	mov	w9, #65023
	and	w8, w8, w9
	str	w8, [x20]
Lloh9:
	adrp	x9, _fifo_write_cnt@GOTPAGE
Lloh10:
	ldr	x9, [x9, _fifo_write_cnt@GOTPAGEOFF]
	ldr	w10, [x9]
	cmp	w10, #3
	b.gt	LBB0_4
; %bb.3:
	add	w10, w10, #1
	str	w10, [x9]
	lsl	w9, w10, #6
	and	w9, w9, #0x100
	orr	w8, w9, w8
	str	w8, [x20]
	b	LBB0_5
LBB0_4:
Lloh11:
	adrp	x8, _fifo_latency@GOTPAGE
Lloh12:
	ldr	x8, [x8, _fifo_latency@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
Lloh14:
	adrp	x9, _fifo_lastwrite@GOTPAGE
Lloh15:
	ldr	x9, [x9, _fifo_lastwrite@GOTPAGEOFF]
	ldr	w10, [x9]
	add	w8, w10, w8
	str	w8, [x9]
	str	w8, [x21]
LBB0_5:
Lloh16:
	adrp	x9, _code@GOTPAGE
Lloh17:
	ldr	x9, [x9, _code@GOTPAGEOFF]
Lloh18:
	adrp	x23, _addr@GOTPAGE
Lloh19:
	ldr	x23, [x23, _addr@GOTPAGEOFF]
	ldr	w8, [x23]
	ldrb	w9, [x9]
	tbnz	w9, #1, LBB0_8
; %bb.6:
	lsl	w9, w8, #1
	and	x9, x9, #0x3fc
	lsr	x10, x8, #8
	and	x10, x10, #0x2
	and	x11, x8, #0x3c00
	orr	x10, x10, x11
	orr	x0, x10, x9
Lloh20:
	adrp	x9, _vram@GOTPAGE
Lloh21:
	ldr	x9, [x9, _vram@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	rev	w10, w19
	lsr	w10, w10, #16
	tst	w8, #0x1
	csel	w8, w19, w10, eq
	ldr	w10, [x9, x0, lsl #2]
	cmp	w8, w10
	b.eq	LBB0_11
; %bb.7:
	str	w8, [x9, x0, lsl #2]
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_MARK_BG_DIRTY
	b	LBB0_11
LBB0_8:
	and	x21, x8, #0x1f
Lloh23:
	adrp	x8, _cram@GOTPAGE
Lloh24:
	ldr	x8, [x8, _cram@GOTPAGEOFF]
Lloh25:
	ldr	x8, [x8]
	lsl	x9, x21, #3
	lsr	w10, w19, #3
	and	w20, w10, #0x1c0
	bfxil	w20, w19, #0, #6
	ldr	w9, [x8, x9]
	cmp	w20, w9
	b.eq	LBB0_11
; %bb.9:
	lsl	x9, x21, #1
	str	w20, [x8, x9, lsl #2]
	mov	x0, x21
	mov	x1, x20
	bl	_color_update_m4
Lloh26:
	adrp	x8, _bordrr@GOTPAGE
Lloh27:
	ldr	x8, [x8, _bordrr@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	mov	w9, #16
	bfxil	w9, w8, #0, #4
	cmp	w21, w9
	b.ne	LBB0_11
; %bb.10:
	mov	w0, #64
	mov	x1, x20
	bl	_color_update_m4
LBB0_11:
	ldr	x8, [x22]
	ldr	w8, [x8, #60]
	ldr	w9, [x23]
	add	w8, w8, w9
	add	w8, w8, #1
	str	w8, [x23]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotStr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_pending,8,3                    ; @pending
	.comm	_status,4,2                     ; @status
	.comm	_reg,8,3                        ; @reg
	.comm	_m68k,4,2                       ; @m68k
	.comm	_fifo_write_cnt,4,2             ; @fifo_write_cnt
	.comm	_fifo_latency,8,3               ; @fifo_latency
	.comm	_fifo_lastwrite,4,2             ; @fifo_lastwrite
	.comm	_code,4,2                       ; @code
	.comm	_addr,4,2                       ; @addr
	.comm	_cram,8,3                       ; @cram
	.comm	_bordrr,4,2                     ; @bordrr
	.comm	_vram,8,3                       ; @vram
	.no_dead_strip	_vdp_68k_data_w_m4
.subsections_via_symbols
