	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vdp_z80_data_w_m5
_vdp_z80_data_w_m5:                     ## @vdp_z80_data_w_m5
	.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, %ebx
	movq	_pending@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	_code@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	$15, %eax
	cmpl	$5, %eax
	je	LBB0_15
## %bb.1:
	cmpl	$3, %eax
	je	LBB0_7
## %bb.2:
	cmpl	$1, %eax
	jne	LBB0_16
## %bb.3:
	movq	_addr@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	xorl	$1, %r14d
	movq	_sat_base_mask@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%r14d, %eax
	movq	_satb@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_5
## %bb.4:
	movq	_sat@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_sat_addr_mask@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	andl	%r14d, %esi
	movl	%ebx, %edx
	callq	_WRITE_BYTE
LBB0_5:
	movq	_vram@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	movl	%r14d, %esi
	callq	_READ_BYTE
	cmpl	%ebx, %eax
	je	LBB0_16
## %bb.6:
	movl	(%r15), %edi
	movl	%r14d, %esi
	movl	%ebx, %edx
	callq	_WRITE_BYTE
	movl	%r14d, %edi
	callq	_MARK_BG_DIRTY
	jmp	LBB0_16
LBB0_15:
	movq	_vsram@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_addr@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	andl	$127, %esi
	xorl	$1, %esi
	movl	%ebx, %edx
	callq	_WRITE_BYTE
	jmp	LBB0_16
LBB0_7:
	movq	_cram@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	movq	_addr@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%edx, %esi
	andl	$126, %esi
	movl	(%r8,%rsi,4), %eax
	movl	%eax, %edi
	testb	$1, %dl
	jne	LBB0_8
## %bb.9:
	andl	$448, %edi                      ## imm = 0x1C0
	movl	%ebx, %ecx
	shrl	%ecx
	andl	$7, %ecx
	shrl	$2, %ebx
	andl	$56, %ebx
	orl	%ecx, %ebx
	jmp	LBB0_10
LBB0_8:
	andl	$63, %edi
	andl	$14, %ebx
	shll	$5, %ebx
LBB0_10:
	orl	%edi, %ebx
	cmpl	%eax, %ebx
	je	LBB0_17
## %bb.11:
	movl	%edx, %r14d
	shrl	%r14d
	andl	$63, %r14d
	movl	%ebx, (%r8,%rsi,4)
	testb	$30, %dl
	je	LBB0_13
## %bb.12:
	movl	%r14d, %edi
	movl	%ebx, %esi
	callq	_color_update_m5
LBB0_13:
	movq	_bordrr@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r14d
	jne	LBB0_16
## %bb.14:
	xorl	%edi, %edi
	movl	%ebx, %esi
	callq	_color_update_m5
LBB0_16:
	movl	%ebx, %eax
LBB0_17:
	movq	_reg@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	60(%rcx), %edx
	movq	_addr@GOTPCREL(%rip), %rsi
	addl	%edx, (%rsi)
	movq	_dmafill@GOTPCREL(%rip), %rdx
	testb	$1, 1(%rdx)
	jne	LBB0_19
## %bb.18:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_19:
	movl	%eax, (%rdx)
	movl	80(%rcx), %eax
	shll	$8, %eax
	orl	76(%rcx), %eax
	movl	$65536, %ecx                    ## imm = 0x10000
	cmovnel	%eax, %ecx
	movq	_dma_length@GOTPCREL(%rip), %rax
	movl	%ecx, (%rax)
	movq	_dma_type@GOTPCREL(%rip), %rax
	movl	$2, (%rax)
	movq	_Z80@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_vdp_dma_update                 ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_pending,8,3                    ## @pending
	.comm	_code,4,2                       ## @code
	.comm	_addr,4,2                       ## @addr
	.comm	_sat_base_mask,4,2              ## @sat_base_mask
	.comm	_satb,4,2                       ## @satb
	.comm	_sat,4,2                        ## @sat
	.comm	_sat_addr_mask,4,2              ## @sat_addr_mask
	.comm	_vram,4,2                       ## @vram
	.comm	_cram,8,3                       ## @cram
	.comm	_bordrr,4,2                     ## @bordrr
	.comm	_vsram,4,2                      ## @vsram
	.comm	_reg,8,3                        ## @reg
	.comm	_dmafill,4,2                    ## @dmafill
	.comm	_dma_length,4,2                 ## @dma_length
	.comm	_dma_type,4,2                   ## @dma_type
	.comm	_Z80,4,2                        ## @Z80
	.no_dead_strip	_vdp_z80_data_w_m5
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vdp_z80_data_w_m5
_vdp_z80_data_w_m5:                     ; @vdp_z80_data_w_m5
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, _pending@GOTPAGE
Lloh1:
	ldr	x8, [x8, _pending@GOTPAGEOFF]
Lloh2:
	adrp	x9, _code@GOTPAGE
Lloh3:
	ldr	x9, [x9, _code@GOTPAGEOFF]
Lloh4:
	str	xzr, [x8]
Lloh5:
	ldr	w8, [x9]
	and	w8, w8, #0xf
Lloh6:
	adrp	x21, _addr@GOTPAGE
Lloh7:
	ldr	x21, [x21, _addr@GOTPAGEOFF]
	cmp	w8, #5
	b.eq	LBB0_7
; %bb.1:
	cmp	w8, #3
	b.eq	LBB0_8
; %bb.2:
	cmp	w8, #1
	b.ne	LBB0_14
; %bb.3:
	ldr	w8, [x21]
	eor	w20, w8, #0x1
Lloh8:
	adrp	x8, _sat_base_mask@GOTPAGE
Lloh9:
	ldr	x8, [x8, _sat_base_mask@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	and	w8, w20, w8
Lloh11:
	adrp	x9, _satb@GOTPAGE
Lloh12:
	ldr	x9, [x9, _satb@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_5
; %bb.4:
Lloh14:
	adrp	x8, _sat@GOTPAGE
Lloh15:
	ldr	x8, [x8, _sat@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
Lloh17:
	adrp	x8, _sat_addr_mask@GOTPAGE
Lloh18:
	ldr	x8, [x8, _sat_addr_mask@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	and	w1, w8, w20
	mov	x2, x19
	bl	_WRITE_BYTE
LBB0_5:
Lloh20:
	adrp	x22, _vram@GOTPAGE
Lloh21:
	ldr	x22, [x22, _vram@GOTPAGEOFF]
	ldr	w0, [x22]
	mov	x1, x20
	bl	_READ_BYTE
	cmp	w0, w19
	b.eq	LBB0_14
; %bb.6:
	ldr	w0, [x22]
	mov	x1, x20
	mov	x2, x19
	bl	_WRITE_BYTE
	mov	x0, x20
	bl	_MARK_BG_DIRTY
	b	LBB0_14
LBB0_7:
Lloh22:
	adrp	x8, _vsram@GOTPAGE
Lloh23:
	ldr	x8, [x8, _vsram@GOTPAGEOFF]
Lloh24:
	ldr	w0, [x8]
	ldr	w8, [x21]
	and	w8, w8, #0x7f
	eor	w1, w8, #0x1
	mov	x2, x19
	bl	_WRITE_BYTE
	b	LBB0_14
LBB0_8:
Lloh25:
	adrp	x8, _cram@GOTPAGE
Lloh26:
	ldr	x8, [x8, _cram@GOTPAGEOFF]
Lloh27:
	ldr	x8, [x8]
	ldr	w9, [x21]
	and	x10, x9, #0x7e
	lsr	w11, w19, #2
	and	w11, w11, #0x38
	bfxil	w11, w19, #1, #3
	lsl	w12, w19, #5
	ldr	w13, [x8, x10, lsl #2]
	and	w14, w13, #0x1c0
	orr	w11, w11, w14
	and	w12, w12, #0x1c0
	bfxil	w12, w13, #0, #6
	tst	w9, #0x1
	csel	w20, w11, w12, eq
	mov	x19, x13
	cmp	w20, w13
	b.eq	LBB0_14
; %bb.9:
	ubfx	w19, w9, #1, #6
	str	w20, [x8, x10, lsl #2]
	tst	w9, #0x1e
	b.eq	LBB0_11
; %bb.10:
	mov	x0, x19
	mov	x1, x20
	bl	_color_update_m5
LBB0_11:
Lloh28:
	adrp	x8, _bordrr@GOTPAGE
Lloh29:
	ldr	x8, [x8, _bordrr@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	cmp	w19, w8
	b.ne	LBB0_13
; %bb.12:
	mov	w0, #0
	mov	x1, x20
	bl	_color_update_m5
LBB0_13:
	mov	x19, x20
LBB0_14:
Lloh31:
	adrp	x8, _reg@GOTPAGE
Lloh32:
	ldr	x8, [x8, _reg@GOTPAGEOFF]
Lloh33:
	ldr	x8, [x8]
	ldr	w9, [x8, #60]
	ldr	w10, [x21]
	add	w9, w10, w9
	str	w9, [x21]
Lloh34:
	adrp	x9, _dmafill@GOTPAGE
Lloh35:
	ldr	x9, [x9, _dmafill@GOTPAGEOFF]
	ldrb	w10, [x9, #1]
	tbnz	w10, #0, LBB0_16
; %bb.15:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_16:
	str	w19, [x9]
	ldp	w8, w9, [x8, #76]
	orr	w8, w8, w9, lsl #8
	mov	w9, #65536
	cmp	w8, #0
	csel	w8, w9, w8, eq
Lloh36:
	adrp	x9, _dma_length@GOTPAGE
Lloh37:
	ldr	x9, [x9, _dma_length@GOTPAGEOFF]
Lloh38:
	str	w8, [x9]
Lloh39:
	adrp	x8, _dma_type@GOTPAGE
Lloh40:
	ldr	x8, [x8, _dma_type@GOTPAGEOFF]
	mov	w9, #2
Lloh41:
	str	w9, [x8]
Lloh42:
	adrp	x8, _Z80@GOTPAGE
Lloh43:
	ldr	x8, [x8, _Z80@GOTPAGEOFF]
Lloh44:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_vdp_dma_update
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh5
	.loh AdrpLdrGotStr	Lloh0, Lloh1, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotStr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotStr	Lloh36, Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_pending,8,3                    ; @pending
	.comm	_code,4,2                       ; @code
	.comm	_addr,4,2                       ; @addr
	.comm	_sat_base_mask,4,2              ; @sat_base_mask
	.comm	_satb,4,2                       ; @satb
	.comm	_sat,4,2                        ; @sat
	.comm	_sat_addr_mask,4,2              ; @sat_addr_mask
	.comm	_vram,4,2                       ; @vram
	.comm	_cram,8,3                       ; @cram
	.comm	_bordrr,4,2                     ; @bordrr
	.comm	_vsram,4,2                      ; @vsram
	.comm	_reg,8,3                        ; @reg
	.comm	_dmafill,4,2                    ; @dmafill
	.comm	_dma_length,4,2                 ; @dma_length
	.comm	_dma_type,4,2                   ; @dma_type
	.comm	_Z80,4,2                        ; @Z80
	.no_dead_strip	_vdp_z80_data_w_m5
.subsections_via_symbols
