	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vdp_68k_ctrl_w                 ## -- Begin function vdp_68k_ctrl_w
	.p2align	4, 0x90
_vdp_68k_ctrl_w:                        ## @vdp_68k_ctrl_w
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movl	%edi, %ebx
	movq	_pending@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_1
## %bb.8:
	movl	$0, (%rax)
	movl	%ebx, %eax
	shll	$14, %eax
	movzwl	%ax, %edx
	movq	_addr_latch@GOTPCREL(%rip), %rax
	movl	%edx, (%rax)
	movq	_addr@GOTPCREL(%rip), %rax
	movl	$16383, %ecx                    ## imm = 0x3FFF
	andl	(%rax), %ecx
	orl	%edx, %ecx
	movl	%ecx, (%rax)
	movq	_code@GOTPCREL(%rip), %rsi
	movl	(%rsi), %edi
	andl	$3, %edi
	movl	%ebx, %edx
	shrl	$2, %edx
	andl	$60, %edx
	orl	%edi, %edx
	movl	%edx, (%rsi)
	testb	$-128, %bl
	je	LBB0_21
## %bb.9:
	movq	_reg@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rsi
	testb	$16, 4(%rsi)
	je	LBB0_21
## %bb.10:
	movl	92(%rsi), %r10d
	movl	%r10d, %edi
	sarl	$6, %edi
	cmpl	$3, %edi
	je	LBB0_13
## %bb.11:
	cmpl	$2, %edi
	jne	LBB0_14
## %bb.12:
	movq	_dmafill@GOTPCREL(%rip), %rax
	movl	$256, (%rax)                    ## imm = 0x100
	jmp	LBB0_21
LBB0_1:
	movq	_dma_length@GOTPCREL(%rip), %rcx
	cmpl	$0, (%rcx)
	je	LBB0_4
## %bb.2:
	movq	_dma_type@GOTPCREL(%rip), %rcx
	cmpl	$1, (%rcx)
	jg	LBB0_4
## %bb.3:
	movq	_cached_write@GOTPCREL(%rip), %rax
	movl	%ebx, (%rax)
	jmp	LBB0_22
LBB0_4:
	movl	%ebx, %ecx
	andl	$49152, %ecx                    ## imm = 0xC000
	cmpl	$32768, %ecx                    ## imm = 0x8000
	jne	LBB0_6
## %bb.5:
	movl	%ebx, %edi
	shrl	$8, %edi
	andl	$31, %edi
	movzbl	%bl, %esi
	movq	_m68k@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_vdp_reg_w
	jmp	LBB0_7
LBB0_6:
	movq	_reg@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	4(%rcx), %ecx
	andl	$4, %ecx
	movl	%ecx, (%rax)
LBB0_7:
	movq	_addr_latch@GOTPCREL(%rip), %rax
	movl	%ebx, %ecx
	andl	$16383, %ecx                    ## imm = 0x3FFF
	orl	(%rax), %ecx
	movq	_addr@GOTPCREL(%rip), %rax
	movl	%ecx, (%rax)
	movq	_code@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	andl	$60, %ecx
	shrl	$14, %ebx
	andl	$3, %ebx
	orl	%ecx, %ebx
	movl	%ebx, (%rax)
	jmp	LBB0_21
LBB0_13:
	movl	80(%rsi), %eax
	shll	$8, %eax
	orl	76(%rsi), %eax
	movl	$65536, %ecx                    ## imm = 0x10000
	cmovnel	%eax, %ecx
	movq	_dma_length@GOTPCREL(%rip), %rax
	movl	%ecx, (%rax)
	movl	88(%rsi), %eax
	shll	$8, %eax
	orl	84(%rsi), %eax
	movq	_dma_src@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	_dma_type@GOTPCREL(%rip), %rax
	movl	$3, (%rax)
	jmp	LBB0_20
LBB0_14:
	movl	80(%rsi), %edi
	shll	$8, %edi
	orl	76(%rsi), %edi
	movl	$65536, %r9d                    ## imm = 0x10000
	cmovnel	%edi, %r9d
	movq	_dma_length@GOTPCREL(%rip), %r8
	movl	%r9d, (%r8)
	movl	88(%rsi), %edi
	shll	$8, %edi
	orl	84(%rsi), %edi
	movq	_dma_src@GOTPCREL(%rip), %rbx
	movl	%edi, (%rbx)
	movq	_system_hw@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edi
	movq	_SYSTEM_MCD@GOTPCREL(%rip), %rbx
	cmpl	(%rbx), %edi
	jne	LBB0_16
## %bb.15:
	movl	%r10d, %edi
	andl	$112, %edi
	movq	_scd@GOTPCREL(%rip), %rbx
	movl	(%rbx), %ebx
	sarl	%ebx
	addl	$16, %ebx
	cmpl	%ebx, %edi
	je	LBB0_18
LBB0_16:
	movq	_svp@GOTPCREL(%rip), %rdi
	cmpl	$0, (%rdi)
	je	LBB0_19
## %bb.17:
	andl	$96, %r10d
	jne	LBB0_19
LBB0_18:
	addl	60(%rsi), %ecx
	movl	%ecx, (%rax)
	decl	%r9d
	movl	%r9d, (%r8)
LBB0_19:
	xorl	%eax, %eax
	testb	$6, %dl
	sete	%al
	movq	_dma_type@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
LBB0_20:
	movq	_m68k@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_vdp_dma_update
LBB0_21:
	movq	_reg@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testb	$1, 48(%rax)
	movl	$214, %eax
	movl	$190, %edx
	cmovel	%eax, %edx
	movq	_code@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	$15, %eax
	cmpl	$3, %eax
	setb	%cl
	shll	%cl, %edx
	movq	_fifo_latency@GOTPCREL(%rip), %rax
	movl	%edx, (%rax)
LBB0_22:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_pending,4,2                    ## @pending
	.comm	_dma_length,4,2                 ## @dma_length
	.comm	_dma_type,4,2                   ## @dma_type
	.comm	_cached_write,4,2               ## @cached_write
	.comm	_m68k,4,2                       ## @m68k
	.comm	_reg,8,3                        ## @reg
	.comm	_addr_latch,4,2                 ## @addr_latch
	.comm	_addr,4,2                       ## @addr
	.comm	_code,4,2                       ## @code
	.comm	_dmafill,4,2                    ## @dmafill
	.comm	_dma_src,4,2                    ## @dma_src
	.comm	_system_hw,4,2                  ## @system_hw
	.comm	_SYSTEM_MCD,4,2                 ## @SYSTEM_MCD
	.comm	_scd,4,2                        ## @scd
	.comm	_svp,4,2                        ## @svp
	.comm	_fifo_latency,4,2               ## @fifo_latency
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vdp_68k_ctrl_w                 ; -- Begin function vdp_68k_ctrl_w
	.p2align	2
_vdp_68k_ctrl_w:                        ; @vdp_68k_ctrl_w
	.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]
	ldr	w9, [x8]
Lloh2:
	adrp	x21, _reg@GOTPAGE
Lloh3:
	ldr	x21, [x21, _reg@GOTPAGEOFF]
Lloh4:
	adrp	x20, _code@GOTPAGE
Lloh5:
	ldr	x20, [x20, _code@GOTPAGEOFF]
	cbz	w9, LBB0_6
; %bb.1:
	str	wzr, [x8]
	ubfiz	w8, w19, #14, #2
Lloh6:
	adrp	x9, _addr_latch@GOTPAGE
Lloh7:
	ldr	x9, [x9, _addr_latch@GOTPAGEOFF]
Lloh8:
	str	w8, [x9]
Lloh9:
	adrp	x8, _addr@GOTPAGE
Lloh10:
	ldr	x8, [x8, _addr@GOTPAGEOFF]
	ldr	w9, [x8]
	and	w9, w9, #0x3fff
	bfi	w9, w19, #14, #2
	str	w9, [x8]
	ldr	w11, [x20]
	lsr	w10, w19, #2
	and	w10, w10, #0x3c
	bfxil	w10, w11, #0, #2
	str	w10, [x20]
	tbz	w19, #7, LBB0_20
; %bb.2:
	ldr	x11, [x21]
	ldrb	w12, [x11, #4]
	tbz	w12, #4, LBB0_20
; %bb.3:
	ldr	w12, [x11, #92]
	asr	w13, w12, #6
	cmp	w13, #3
	b.eq	LBB0_12
; %bb.4:
	cmp	w13, #2
	b.ne	LBB0_13
; %bb.5:
Lloh11:
	adrp	x8, _dmafill@GOTPAGE
Lloh12:
	ldr	x8, [x8, _dmafill@GOTPAGEOFF]
	mov	w9, #256
Lloh13:
	str	w9, [x8]
	b	LBB0_20
LBB0_6:
Lloh14:
	adrp	x9, _dma_length@GOTPAGE
Lloh15:
	ldr	x9, [x9, _dma_length@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
Lloh17:
	adrp	x10, _dma_type@GOTPAGE
Lloh18:
	ldr	x10, [x10, _dma_type@GOTPAGEOFF]
Lloh19:
	ldr	w10, [x10]
	cmp	w9, #0
	ccmp	w10, #1, #0, ne
	b.le	LBB0_9
; %bb.7:
	and	w9, w19, #0xc000
	cmp	w9, #8, lsl #12                 ; =32768
	b.ne	LBB0_10
; %bb.8:
	ubfx	w0, w19, #8, #5
	and	w1, w19, #0xff
Lloh20:
	adrp	x8, _m68k@GOTPAGE
Lloh21:
	ldr	x8, [x8, _m68k@GOTPAGEOFF]
Lloh22:
	ldr	w2, [x8]
	bl	_vdp_reg_w
	b	LBB0_11
LBB0_9:
Lloh23:
	adrp	x8, _cached_write@GOTPAGE
Lloh24:
	ldr	x8, [x8, _cached_write@GOTPAGEOFF]
Lloh25:
	str	w19, [x8]
	b	LBB0_21
LBB0_10:
	ldr	x9, [x21]
	ldr	w9, [x9, #4]
	and	w9, w9, #0x4
	str	w9, [x8]
LBB0_11:
Lloh26:
	adrp	x8, _addr_latch@GOTPAGE
Lloh27:
	ldr	x8, [x8, _addr_latch@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	and	w9, w19, #0x3fff
Lloh29:
	adrp	x10, _addr@GOTPAGE
Lloh30:
	ldr	x10, [x10, _addr@GOTPAGEOFF]
	orr	w8, w8, w9
Lloh31:
	str	w8, [x10]
	ldr	w8, [x20]
	and	w8, w8, #0x3c
	bfxil	w8, w19, #14, #2
	str	w8, [x20]
	b	LBB0_20
LBB0_12:
	ldp	w9, w8, [x11, #76]
	orr	w8, w9, w8, lsl #8
	mov	w9, #65536
	cmp	w8, #0
	csel	w8, w9, w8, eq
Lloh32:
	adrp	x9, _dma_length@GOTPAGE
Lloh33:
	ldr	x9, [x9, _dma_length@GOTPAGEOFF]
Lloh34:
	str	w8, [x9]
	ldp	w9, w8, [x11, #84]
	orr	w8, w9, w8, lsl #8
Lloh35:
	adrp	x9, _dma_src@GOTPAGE
Lloh36:
	ldr	x9, [x9, _dma_src@GOTPAGEOFF]
Lloh37:
	adrp	x10, _dma_type@GOTPAGE
Lloh38:
	ldr	x10, [x10, _dma_type@GOTPAGEOFF]
Lloh39:
	str	w8, [x9]
	mov	w8, #3
Lloh40:
	str	w8, [x10]
	b	LBB0_19
LBB0_13:
	ldp	w14, w13, [x11, #76]
	orr	w13, w14, w13, lsl #8
	mov	w14, #65536
	cmp	w13, #0
	csel	w13, w14, w13, eq
Lloh41:
	adrp	x14, _dma_length@GOTPAGE
Lloh42:
	ldr	x14, [x14, _dma_length@GOTPAGEOFF]
	ldp	w16, w15, [x11, #84]
	orr	w15, w16, w15, lsl #8
Lloh43:
	adrp	x16, _dma_src@GOTPAGE
Lloh44:
	ldr	x16, [x16, _dma_src@GOTPAGEOFF]
Lloh45:
	str	w15, [x16]
Lloh46:
	adrp	x15, _system_hw@GOTPAGE
Lloh47:
	ldr	x15, [x15, _system_hw@GOTPAGEOFF]
	str	w13, [x14]
Lloh48:
	ldr	w15, [x15]
Lloh49:
	adrp	x16, _SYSTEM_MCD@GOTPAGE
Lloh50:
	ldr	x16, [x16, _SYSTEM_MCD@GOTPAGEOFF]
Lloh51:
	ldr	w16, [x16]
	cmp	w15, w16
	b.ne	LBB0_15
; %bb.14:
	and	w15, w12, #0x70
Lloh52:
	adrp	x16, _scd@GOTPAGE
Lloh53:
	ldr	x16, [x16, _scd@GOTPAGEOFF]
Lloh54:
	ldr	w16, [x16]
	asr	w16, w16, #1
	add	w16, w16, #16
	cmp	w15, w16
	b.eq	LBB0_17
LBB0_15:
Lloh55:
	adrp	x15, _svp@GOTPAGE
Lloh56:
	ldr	x15, [x15, _svp@GOTPAGEOFF]
Lloh57:
	ldr	w15, [x15]
	cbz	w15, LBB0_18
; %bb.16:
	and	w12, w12, #0x60
	cbnz	w12, LBB0_18
LBB0_17:
	ldr	w11, [x11, #60]
	add	w9, w11, w9
	str	w9, [x8]
	sub	w8, w13, #1
	str	w8, [x14]
LBB0_18:
	tst	w10, #0x6
	cset	w8, eq
Lloh58:
	adrp	x9, _dma_type@GOTPAGE
Lloh59:
	ldr	x9, [x9, _dma_type@GOTPAGEOFF]
Lloh60:
	str	w8, [x9]
LBB0_19:
Lloh61:
	adrp	x8, _m68k@GOTPAGE
Lloh62:
	ldr	x8, [x8, _m68k@GOTPAGEOFF]
Lloh63:
	ldr	w0, [x8]
	bl	_vdp_dma_update
LBB0_20:
	ldr	x8, [x21]
	ldr	w8, [x8, #48]
	tst	w8, #0x1
	mov	w8, #190
	mov	w9, #214
	csel	w8, w9, w8, eq
	ldr	w9, [x20]
	and	w9, w9, #0xf
	cmp	w9, #3
	cset	w9, lo
	lsl	w8, w8, w9
Lloh64:
	adrp	x9, _fifo_latency@GOTPAGE
Lloh65:
	ldr	x9, [x9, _fifo_latency@GOTPAGEOFF]
Lloh66:
	str	w8, [x9]
LBB0_21:
	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
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotStr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotStr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotStr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotStr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotStr	Lloh37, Lloh38, Lloh40
	.loh AdrpLdrGotStr	Lloh35, Lloh36, Lloh39
	.loh AdrpLdrGotStr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpLdrGotStr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGot	Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh52, Lloh53, Lloh54
	.loh AdrpLdrGotLdr	Lloh55, Lloh56, Lloh57
	.loh AdrpLdrGotStr	Lloh58, Lloh59, Lloh60
	.loh AdrpLdrGotLdr	Lloh61, Lloh62, Lloh63
	.loh AdrpLdrGotStr	Lloh64, Lloh65, Lloh66
	.cfi_endproc
                                        ; -- End function
	.comm	_pending,4,2                    ; @pending
	.comm	_dma_length,4,2                 ; @dma_length
	.comm	_dma_type,4,2                   ; @dma_type
	.comm	_cached_write,4,2               ; @cached_write
	.comm	_m68k,4,2                       ; @m68k
	.comm	_reg,8,3                        ; @reg
	.comm	_addr_latch,4,2                 ; @addr_latch
	.comm	_addr,4,2                       ; @addr
	.comm	_code,4,2                       ; @code
	.comm	_dmafill,4,2                    ; @dmafill
	.comm	_dma_src,4,2                    ; @dma_src
	.comm	_system_hw,4,2                  ; @system_hw
	.comm	_SYSTEM_MCD,4,2                 ; @SYSTEM_MCD
	.comm	_scd,4,2                        ; @scd
	.comm	_svp,4,2                        ; @svp
	.comm	_fifo_latency,4,2               ; @fifo_latency
.subsections_via_symbols
