	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_POKEY_Scanline                 ## -- Begin function POKEY_Scanline
	.p2align	4, 0x90
_POKEY_Scanline:                        ## @POKEY_Scanline
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	xorl	%eax, %eax
	callq	_INPUT_Scanline
	movq	_ESC_enable_sio_patch@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jne	LBB0_3
## %bb.1:
	xorl	%eax, %eax
	callq	_CASSETTE_AddScanLine
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	_POKEY_DELAYED_SERIN_IRQ@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
LBB0_3:
	movq	_POKEY_SKCTL@GOTPCREL(%rip), %rax
	testb	$3, (%rax)
	je	LBB0_28
## %bb.4:
	movq	_pot_scanline@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	cmpl	$227, %ecx
	jg	LBB0_6
## %bb.5:
	incl	%ecx
	movl	%ecx, (%rax)
LBB0_6:
	movq	_ANTIC_LINE_C@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	movq	_random_scanline_counter@GOTPCREL(%rip), %rcx
	addl	%eax, (%rcx)
	movq	_POKEY_DELAYED_SERIN_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	testl	%ecx, %ecx
	jle	LBB0_12
## %bb.7:
	decl	%ecx
	movl	%ecx, (%rax)
	jne	LBB0_12
## %bb.8:
	xorl	%eax, %eax
	callq	_SIO_GetByte
	movq	_POKEY_SERIN@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	_POKEY_IRQEN@GOTPCREL(%rip), %rax
	testb	$32, (%rax)
	je	LBB0_12
## %bb.9:
	movq	_POKEY_IRQST@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	testb	$32, %cl
	jne	LBB0_11
## %bb.10:
	movq	_POKEY_SKSTAT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
LBB0_11:
	andl	$223, %ecx
	movl	%ecx, (%rax)
	xorl	%eax, %eax
	callq	_CPU_GenerateIRQ
LBB0_12:
	movq	_POKEY_DELAYED_SEROUT_IRQ@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	testq	%rcx, %rcx
	jle	LBB0_16
## %bb.13:
	decq	%rcx
	movq	%rcx, (%rax)
	jne	LBB0_16
## %bb.14:
	movq	_POKEY_IRQEN@GOTPCREL(%rip), %rax
	testb	$16, (%rax)
	je	LBB0_16
## %bb.15:
	movq	_POKEY_IRQST@GOTPCREL(%rip), %rax
	andl	$239, (%rax)
	xorl	%eax, %eax
	callq	_CPU_GenerateIRQ
LBB0_16:
	movq	_POKEY_DELAYED_XMTDONE_IRQ@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	testq	%rcx, %rcx
	jle	LBB0_20
## %bb.17:
	decq	%rcx
	movq	%rcx, (%rax)
	jne	LBB0_20
## %bb.18:
	movq	_POKEY_IRQST@GOTPCREL(%rip), %rax
	andl	$247, (%rax)
	movq	_POKEY_IRQEN@GOTPCREL(%rip), %rax
	testb	$8, (%rax)
	je	LBB0_20
## %bb.19:
	xorl	%eax, %eax
	callq	_CPU_GenerateIRQ
LBB0_20:
	movl	(%r14), %ecx
	movq	_POKEY_DivNIRQ@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movq	_POKEY_CHAN1@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movl	(%rax,%rdx,4), %esi
	subl	%ecx, %esi
	movl	%esi, (%rax,%rdx,4)
	jns	LBB0_23
## %bb.21:
	movq	_POKEY_DivNMax@GOTPCREL(%rip), %rdi
	movq	(%rdi), %rdi
	addl	(%rdi,%rdx,8), %esi
	movl	%esi, (%rax,%rdx,4)
	movq	_POKEY_IRQEN@GOTPCREL(%rip), %rdx
	testb	$1, (%rdx)
	je	LBB0_23
## %bb.22:
	movq	_POKEY_IRQST@GOTPCREL(%rip), %rax
	andl	$254, (%rax)
	xorl	%eax, %eax
	callq	_CPU_GenerateIRQ
	movl	(%r14), %ecx
	movq	(%rbx), %rax
LBB0_23:
	movq	_POKEY_CHAN2@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movl	(%rax,%rdx,4), %esi
	subl	%ecx, %esi
	movl	%esi, (%rax,%rdx,4)
	jns	LBB0_26
## %bb.24:
	movq	_POKEY_DivNMax@GOTPCREL(%rip), %rdi
	movq	(%rdi), %rdi
	addl	(%rdi,%rdx,8), %esi
	movl	%esi, (%rax,%rdx,4)
	movq	_POKEY_IRQEN@GOTPCREL(%rip), %rdx
	testb	$2, (%rdx)
	je	LBB0_26
## %bb.25:
	movq	_POKEY_IRQST@GOTPCREL(%rip), %rax
	andl	$253, (%rax)
	xorl	%eax, %eax
	callq	_CPU_GenerateIRQ
	movl	(%r14), %ecx
	movq	(%rbx), %rax
LBB0_26:
	movq	_POKEY_CHAN4@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movl	(%rax,%rdx,4), %esi
	subl	%ecx, %esi
	movl	%esi, (%rax,%rdx,4)
	jns	LBB0_28
## %bb.27:
	movq	_POKEY_DivNMax@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	addl	(%rcx,%rdx,8), %esi
	movl	%esi, (%rax,%rdx,4)
	movq	_POKEY_IRQEN@GOTPCREL(%rip), %rax
	testb	$4, (%rax)
	jne	LBB0_29
LBB0_28:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_29:
	movq	_POKEY_IRQST@GOTPCREL(%rip), %rax
	andl	$251, (%rax)
	xorl	%eax, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_CPU_GenerateIRQ                ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_ESC_enable_sio_patch,4,2       ## @ESC_enable_sio_patch
	.comm	_POKEY_DELAYED_SERIN_IRQ,4,2    ## @POKEY_DELAYED_SERIN_IRQ
	.comm	_POKEY_SKCTL,4,2                ## @POKEY_SKCTL
	.comm	_pot_scanline,4,2               ## @pot_scanline
	.comm	_ANTIC_LINE_C,8,3               ## @ANTIC_LINE_C
	.comm	_random_scanline_counter,4,2    ## @random_scanline_counter
	.comm	_POKEY_SERIN,4,2                ## @POKEY_SERIN
	.comm	_POKEY_IRQEN,4,2                ## @POKEY_IRQEN
	.comm	_POKEY_IRQST,4,2                ## @POKEY_IRQST
	.comm	_POKEY_SKSTAT,4,2               ## @POKEY_SKSTAT
	.comm	_POKEY_DELAYED_SEROUT_IRQ,8,3   ## @POKEY_DELAYED_SEROUT_IRQ
	.comm	_POKEY_DELAYED_XMTDONE_IRQ,8,3  ## @POKEY_DELAYED_XMTDONE_IRQ
	.comm	_POKEY_DivNIRQ,8,3              ## @POKEY_DivNIRQ
	.comm	_POKEY_CHAN1,8,3                ## @POKEY_CHAN1
	.comm	_POKEY_DivNMax,8,3              ## @POKEY_DivNMax
	.comm	_POKEY_CHAN2,8,3                ## @POKEY_CHAN2
	.comm	_POKEY_CHAN4,8,3                ## @POKEY_CHAN4
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_POKEY_Scanline                 ; -- Begin function POKEY_Scanline
	.p2align	2
_POKEY_Scanline:                        ; @POKEY_Scanline
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	bl	_INPUT_Scanline
Lloh0:
	adrp	x8, _ESC_enable_sio_patch@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ESC_enable_sio_patch@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cbnz	w8, LBB0_3
; %bb.1:
	bl	_CASSETTE_AddScanLine
	cbz	x0, LBB0_3
; %bb.2:
Lloh3:
	adrp	x8, _POKEY_DELAYED_SERIN_IRQ@GOTPAGE
Lloh4:
	ldr	x8, [x8, _POKEY_DELAYED_SERIN_IRQ@GOTPAGEOFF]
	mov	w9, #1
Lloh5:
	str	w9, [x8]
LBB0_3:
Lloh6:
	adrp	x8, _POKEY_SKCTL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _POKEY_SKCTL@GOTPAGEOFF]
	ldrb	w8, [x8]
	tst	w8, #0x3
	b.eq	LBB0_26
; %bb.4:
Lloh8:
	adrp	x8, _pot_scanline@GOTPAGE
Lloh9:
	ldr	x8, [x8, _pot_scanline@GOTPAGEOFF]
	ldr	w9, [x8]
	cmp	w9, #227
	b.gt	LBB0_6
; %bb.5:
	add	w9, w9, #1
	str	w9, [x8]
LBB0_6:
Lloh10:
	adrp	x19, _ANTIC_LINE_C@GOTPAGE
Lloh11:
	ldr	x19, [x19, _ANTIC_LINE_C@GOTPAGEOFF]
	ldr	w8, [x19]
Lloh12:
	adrp	x9, _random_scanline_counter@GOTPAGE
Lloh13:
	ldr	x9, [x9, _random_scanline_counter@GOTPAGEOFF]
	ldr	w10, [x9]
	add	w8, w10, w8
	str	w8, [x9]
Lloh14:
	adrp	x8, _POKEY_DELAYED_SERIN_IRQ@GOTPAGE
Lloh15:
	ldr	x8, [x8, _POKEY_DELAYED_SERIN_IRQ@GOTPAGEOFF]
	ldr	w9, [x8]
	subs	w9, w9, #1
	b.lt	LBB0_10
; %bb.7:
	str	w9, [x8]
	b.ne	LBB0_10
; %bb.8:
	bl	_SIO_GetByte
Lloh16:
	adrp	x8, _POKEY_SERIN@GOTPAGE
Lloh17:
	ldr	x8, [x8, _POKEY_SERIN@GOTPAGEOFF]
Lloh18:
	str	w0, [x8]
Lloh19:
	adrp	x8, _POKEY_IRQEN@GOTPAGE
Lloh20:
	ldr	x8, [x8, _POKEY_IRQEN@GOTPAGEOFF]
	ldrb	w8, [x8]
	tbz	w8, #5, LBB0_10
; %bb.9:
Lloh21:
	adrp	x8, _POKEY_IRQST@GOTPAGE
Lloh22:
	ldr	x8, [x8, _POKEY_IRQST@GOTPAGEOFF]
	ldr	w9, [x8]
Lloh23:
	adrp	x10, _POKEY_SKSTAT@GOTPAGE
Lloh24:
	ldr	x10, [x10, _POKEY_SKSTAT@GOTPAGEOFF]
	ldr	w11, [x10]
	tst	w9, #0x20
	csel	w9, w11, w9, eq
	csel	x8, x10, x8, eq
	mov	w10, #223
	and	w9, w9, w10
	str	w9, [x8]
	bl	_CPU_GenerateIRQ
LBB0_10:
Lloh25:
	adrp	x8, _POKEY_DELAYED_SEROUT_IRQ@GOTPAGE
Lloh26:
	ldr	x8, [x8, _POKEY_DELAYED_SEROUT_IRQ@GOTPAGEOFF]
	ldr	x9, [x8]
	subs	x9, x9, #1
	b.lt	LBB0_14
; %bb.11:
	str	x9, [x8]
	b.ne	LBB0_14
; %bb.12:
Lloh27:
	adrp	x8, _POKEY_IRQEN@GOTPAGE
Lloh28:
	ldr	x8, [x8, _POKEY_IRQEN@GOTPAGEOFF]
	ldrb	w8, [x8]
	tbz	w8, #4, LBB0_14
; %bb.13:
Lloh29:
	adrp	x8, _POKEY_IRQST@GOTPAGE
Lloh30:
	ldr	x8, [x8, _POKEY_IRQST@GOTPAGEOFF]
	ldr	w9, [x8]
	mov	w10, #239
	and	w9, w9, w10
	str	w9, [x8]
	bl	_CPU_GenerateIRQ
LBB0_14:
Lloh31:
	adrp	x8, _POKEY_DELAYED_XMTDONE_IRQ@GOTPAGE
Lloh32:
	ldr	x8, [x8, _POKEY_DELAYED_XMTDONE_IRQ@GOTPAGEOFF]
	ldr	x9, [x8]
	subs	x9, x9, #1
	b.lt	LBB0_18
; %bb.15:
	str	x9, [x8]
	b.ne	LBB0_18
; %bb.16:
Lloh33:
	adrp	x8, _POKEY_IRQST@GOTPAGE
Lloh34:
	ldr	x8, [x8, _POKEY_IRQST@GOTPAGEOFF]
	ldr	w9, [x8]
	mov	w10, #247
	and	w9, w9, w10
	str	w9, [x8]
Lloh35:
	adrp	x8, _POKEY_IRQEN@GOTPAGE
Lloh36:
	ldr	x8, [x8, _POKEY_IRQEN@GOTPAGEOFF]
	ldrb	w8, [x8]
	tbz	w8, #3, LBB0_18
; %bb.17:
	bl	_CPU_GenerateIRQ
LBB0_18:
	ldr	w9, [x19]
Lloh37:
	adrp	x20, _POKEY_DivNIRQ@GOTPAGE
Lloh38:
	ldr	x20, [x20, _POKEY_DivNIRQ@GOTPAGEOFF]
	ldr	x8, [x20]
Lloh39:
	adrp	x10, _POKEY_CHAN1@GOTPAGE
Lloh40:
	ldr	x10, [x10, _POKEY_CHAN1@GOTPAGEOFF]
Lloh41:
	ldr	x10, [x10]
	lsl	x12, x10, #2
	ldr	w11, [x8, x12]
	subs	w11, w11, w9
	str	w11, [x8, x12]
	b.pl	LBB0_21
; %bb.19:
Lloh42:
	adrp	x12, _POKEY_DivNMax@GOTPAGE
Lloh43:
	ldr	x12, [x12, _POKEY_DivNMax@GOTPAGEOFF]
Lloh44:
	ldr	x12, [x12]
	ldr	x12, [x12, x10, lsl #3]
	add	w11, w11, w12
	str	w11, [x8, x10, lsl #2]
Lloh45:
	adrp	x10, _POKEY_IRQEN@GOTPAGE
Lloh46:
	ldr	x10, [x10, _POKEY_IRQEN@GOTPAGEOFF]
	ldrb	w10, [x10]
	tbz	w10, #0, LBB0_21
; %bb.20:
Lloh47:
	adrp	x8, _POKEY_IRQST@GOTPAGE
Lloh48:
	ldr	x8, [x8, _POKEY_IRQST@GOTPAGEOFF]
	ldr	w9, [x8]
	and	w9, w9, #0xfe
	str	w9, [x8]
	bl	_CPU_GenerateIRQ
	ldr	w9, [x19]
	ldr	x8, [x20]
LBB0_21:
Lloh49:
	adrp	x10, _POKEY_CHAN2@GOTPAGE
Lloh50:
	ldr	x10, [x10, _POKEY_CHAN2@GOTPAGEOFF]
Lloh51:
	ldr	x10, [x10]
	lsl	x12, x10, #2
	ldr	w11, [x8, x12]
	subs	w11, w11, w9
	str	w11, [x8, x12]
	b.pl	LBB0_24
; %bb.22:
Lloh52:
	adrp	x12, _POKEY_DivNMax@GOTPAGE
Lloh53:
	ldr	x12, [x12, _POKEY_DivNMax@GOTPAGEOFF]
Lloh54:
	ldr	x12, [x12]
	ldr	x12, [x12, x10, lsl #3]
	add	w11, w11, w12
	str	w11, [x8, x10, lsl #2]
Lloh55:
	adrp	x10, _POKEY_IRQEN@GOTPAGE
Lloh56:
	ldr	x10, [x10, _POKEY_IRQEN@GOTPAGEOFF]
	ldrb	w10, [x10]
	tbz	w10, #1, LBB0_24
; %bb.23:
Lloh57:
	adrp	x8, _POKEY_IRQST@GOTPAGE
Lloh58:
	ldr	x8, [x8, _POKEY_IRQST@GOTPAGEOFF]
	ldr	w9, [x8]
	mov	w10, #253
	and	w9, w9, w10
	str	w9, [x8]
	bl	_CPU_GenerateIRQ
	ldr	w9, [x19]
	ldr	x8, [x20]
LBB0_24:
Lloh59:
	adrp	x10, _POKEY_CHAN4@GOTPAGE
Lloh60:
	ldr	x10, [x10, _POKEY_CHAN4@GOTPAGEOFF]
Lloh61:
	ldr	x10, [x10]
	lsl	x11, x10, #2
	ldr	w12, [x8, x11]
	subs	w9, w12, w9
	str	w9, [x8, x11]
	b.pl	LBB0_26
; %bb.25:
Lloh62:
	adrp	x11, _POKEY_DivNMax@GOTPAGE
Lloh63:
	ldr	x11, [x11, _POKEY_DivNMax@GOTPAGEOFF]
Lloh64:
	ldr	x11, [x11]
	ldr	x11, [x11, x10, lsl #3]
	add	w9, w9, w11
	str	w9, [x8, x10, lsl #2]
Lloh65:
	adrp	x8, _POKEY_IRQEN@GOTPAGE
Lloh66:
	ldr	x8, [x8, _POKEY_IRQEN@GOTPAGEOFF]
	ldrb	w8, [x8]
	tbnz	w8, #2, LBB0_27
LBB0_26:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_27:
Lloh67:
	adrp	x8, _POKEY_IRQST@GOTPAGE
Lloh68:
	ldr	x8, [x8, _POKEY_IRQST@GOTPAGEOFF]
	ldr	w9, [x8]
	mov	w10, #251
	and	w9, w9, w10
	str	w9, [x8]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_CPU_GenerateIRQ
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotStr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotStr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGot	Lloh37, Lloh38
	.loh AdrpLdrGot	Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGot	Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGot	Lloh55, Lloh56
	.loh AdrpLdrGotLdr	Lloh52, Lloh53, Lloh54
	.loh AdrpLdrGot	Lloh57, Lloh58
	.loh AdrpLdrGotLdr	Lloh59, Lloh60, Lloh61
	.loh AdrpLdrGot	Lloh65, Lloh66
	.loh AdrpLdrGotLdr	Lloh62, Lloh63, Lloh64
	.loh AdrpLdrGot	Lloh67, Lloh68
	.cfi_endproc
                                        ; -- End function
	.comm	_ESC_enable_sio_patch,4,2       ; @ESC_enable_sio_patch
	.comm	_POKEY_DELAYED_SERIN_IRQ,4,2    ; @POKEY_DELAYED_SERIN_IRQ
	.comm	_POKEY_SKCTL,4,2                ; @POKEY_SKCTL
	.comm	_pot_scanline,4,2               ; @pot_scanline
	.comm	_ANTIC_LINE_C,8,3               ; @ANTIC_LINE_C
	.comm	_random_scanline_counter,4,2    ; @random_scanline_counter
	.comm	_POKEY_SERIN,4,2                ; @POKEY_SERIN
	.comm	_POKEY_IRQEN,4,2                ; @POKEY_IRQEN
	.comm	_POKEY_IRQST,4,2                ; @POKEY_IRQST
	.comm	_POKEY_SKSTAT,4,2               ; @POKEY_SKSTAT
	.comm	_POKEY_DELAYED_SEROUT_IRQ,8,3   ; @POKEY_DELAYED_SEROUT_IRQ
	.comm	_POKEY_DELAYED_XMTDONE_IRQ,8,3  ; @POKEY_DELAYED_XMTDONE_IRQ
	.comm	_POKEY_DivNIRQ,8,3              ; @POKEY_DivNIRQ
	.comm	_POKEY_CHAN1,8,3                ; @POKEY_CHAN1
	.comm	_POKEY_DivNMax,8,3              ; @POKEY_DivNMax
	.comm	_POKEY_CHAN2,8,3                ; @POKEY_CHAN2
	.comm	_POKEY_CHAN4,8,3                ; @POKEY_CHAN4
.subsections_via_symbols
