	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PIA_StateRead                  ## -- Begin function PIA_StateRead
	.p2align	4, 0x90
_PIA_StateRead:                         ## @PIA_StateRead
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%edi, %r14d
	movq	_PIA_PACTL@GOTPCREL(%rip), %rbx
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_StateSav_ReadUBYTE
	xorl	%edi, %edi
	testb	$8, (%rbx)
	sete	%dil
	callq	_SIO_TapeMotor
	leaq	-20(%rbp), %rdi
	movl	$1, %esi
	callq	_StateSav_ReadUBYTE
	movq	_PIA_PBCTL@GOTPCREL(%rip), %rbx
	movl	-20(%rbp), %eax
	movl	(%rbx), %ecx
	xorl	%eax, %ecx
	testb	$8, %cl
	je	LBB0_2
## %bb.1:
	xorl	%edi, %edi
	testb	$8, %al
	sete	%dil
	callq	_SIO_SwitchCommandFrame
	movl	-20(%rbp), %eax
LBB0_2:
	movl	%eax, (%rbx)
	movq	_PIA_PORTA@GOTPCREL(%rip), %rdi
	movl	$1, %esi
	callq	_StateSav_ReadUBYTE
	movq	_PIA_PORTB@GOTPCREL(%rip), %rdi
	movl	$1, %esi
	callq	_StateSav_ReadUBYTE
	cmpl	$6, %r14d
	jg	LBB0_8
## %bb.3:
	movq	_MEMORY_xe_bank@GOTPCREL(%rip), %rdi
	movl	$1, %esi
	callq	_StateSav_ReadINT
	movq	_MEMORY_selftest_enabled@GOTPCREL(%rip), %rdi
	movl	$1, %esi
	callq	_StateSav_ReadINT
	leaq	-24(%rbp), %rdi
	movl	$1, %esi
	callq	_StateSav_ReadINT
	movq	_Atari800_machine_type@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_Atari800_MACHINE_XLXE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.4:
	cmpl	$1, -24(%rbp)
	jne	LBB0_7
## %bb.5:
	movq	_MEMORY_ram_size@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	_MEMORY_RAM_320_COMPY_SHOP@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_7
## %bb.6:
	movq	_MEMORY_RAM_320_RAMBO@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rcx, (%rax)
LBB0_7:
	movq	_MEMORY_cartA0BF_enabled@GOTPCREL(%rip), %rdi
	movl	$1, %esi
	callq	_StateSav_ReadINT
LBB0_8:
	movq	_PIA_PORTA_mask@GOTPCREL(%rip), %rdi
	movl	$1, %esi
	callq	_StateSav_ReadUBYTE
	movq	_PIA_PORTB_mask@GOTPCREL(%rip), %rdi
	movl	$1, %esi
	callq	_StateSav_ReadUBYTE
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PIA_PACTL,4,2                  ## @PIA_PACTL
	.comm	_PIA_PBCTL,4,2                  ## @PIA_PBCTL
	.comm	_PIA_PORTA,4,2                  ## @PIA_PORTA
	.comm	_PIA_PORTB,4,2                  ## @PIA_PORTB
	.comm	_MEMORY_xe_bank,4,2             ## @MEMORY_xe_bank
	.comm	_MEMORY_selftest_enabled,4,2    ## @MEMORY_selftest_enabled
	.comm	_Atari800_machine_type,8,3      ## @Atari800_machine_type
	.comm	_Atari800_MACHINE_XLXE,8,3      ## @Atari800_MACHINE_XLXE
	.comm	_MEMORY_ram_size,8,3            ## @MEMORY_ram_size
	.comm	_MEMORY_RAM_320_COMPY_SHOP,8,3  ## @MEMORY_RAM_320_COMPY_SHOP
	.comm	_MEMORY_RAM_320_RAMBO,8,3       ## @MEMORY_RAM_320_RAMBO
	.comm	_MEMORY_cartA0BF_enabled,4,2    ## @MEMORY_cartA0BF_enabled
	.comm	_PIA_PORTA_mask,4,2             ## @PIA_PORTA_mask
	.comm	_PIA_PORTB_mask,4,2             ## @PIA_PORTB_mask
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PIA_StateRead                  ; -- Begin function PIA_StateRead
	.p2align	2
_PIA_StateRead:                         ; @PIA_StateRead
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
Lloh0:
	adrp	x20, _PIA_PACTL@GOTPAGE
Lloh1:
	ldr	x20, [x20, _PIA_PACTL@GOTPAGEOFF]
	mov	w21, #1
	mov	x0, x20
	mov	w1, #1
	bl	_StateSav_ReadUBYTE
	ldr	w8, [x20]
	bic	w0, w21, w8, lsr #3
	bl	_SIO_TapeMotor
	add	x0, sp, #12
	mov	w1, #1
	bl	_StateSav_ReadUBYTE
Lloh2:
	adrp	x20, _PIA_PBCTL@GOTPAGE
Lloh3:
	ldr	x20, [x20, _PIA_PBCTL@GOTPAGEOFF]
	ldr	w9, [x20]
	ldr	w8, [sp, #12]
	eor	w9, w8, w9
	tbz	w9, #3, LBB0_2
; %bb.1:
	bic	w0, w21, w8, lsr #3
	bl	_SIO_SwitchCommandFrame
	ldr	w8, [sp, #12]
LBB0_2:
	str	w8, [x20]
Lloh4:
	adrp	x0, _PIA_PORTA@GOTPAGE
Lloh5:
	ldr	x0, [x0, _PIA_PORTA@GOTPAGEOFF]
	mov	w1, #1
	bl	_StateSav_ReadUBYTE
Lloh6:
	adrp	x0, _PIA_PORTB@GOTPAGE
Lloh7:
	ldr	x0, [x0, _PIA_PORTB@GOTPAGEOFF]
	mov	w1, #1
	bl	_StateSav_ReadUBYTE
	cmp	w19, #6
	b.gt	LBB0_7
; %bb.3:
Lloh8:
	adrp	x0, _MEMORY_xe_bank@GOTPAGE
Lloh9:
	ldr	x0, [x0, _MEMORY_xe_bank@GOTPAGEOFF]
	mov	w1, #1
	bl	_StateSav_ReadINT
Lloh10:
	adrp	x0, _MEMORY_selftest_enabled@GOTPAGE
Lloh11:
	ldr	x0, [x0, _MEMORY_selftest_enabled@GOTPAGEOFF]
	mov	w1, #1
	bl	_StateSav_ReadINT
	add	x0, sp, #8
	mov	w1, #1
	bl	_StateSav_ReadINT
Lloh12:
	adrp	x8, _Atari800_machine_type@GOTPAGE
Lloh13:
	ldr	x8, [x8, _Atari800_machine_type@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
Lloh15:
	adrp	x9, _Atari800_MACHINE_XLXE@GOTPAGE
Lloh16:
	ldr	x9, [x9, _Atari800_MACHINE_XLXE@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	ldr	w10, [sp, #8]
	cmp	x8, x9
	ccmp	w10, #1, #0, eq
	b.ne	LBB0_6
; %bb.4:
Lloh18:
	adrp	x8, _MEMORY_ram_size@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MEMORY_ram_size@GOTPAGEOFF]
	ldr	x9, [x8]
Lloh20:
	adrp	x10, _MEMORY_RAM_320_COMPY_SHOP@GOTPAGE
Lloh21:
	ldr	x10, [x10, _MEMORY_RAM_320_COMPY_SHOP@GOTPAGEOFF]
Lloh22:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_6
; %bb.5:
Lloh23:
	adrp	x9, _MEMORY_RAM_320_RAMBO@GOTPAGE
Lloh24:
	ldr	x9, [x9, _MEMORY_RAM_320_RAMBO@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	str	x9, [x8]
LBB0_6:
Lloh26:
	adrp	x0, _MEMORY_cartA0BF_enabled@GOTPAGE
Lloh27:
	ldr	x0, [x0, _MEMORY_cartA0BF_enabled@GOTPAGEOFF]
	mov	w1, #1
	bl	_StateSav_ReadINT
LBB0_7:
Lloh28:
	adrp	x0, _PIA_PORTA_mask@GOTPAGE
Lloh29:
	ldr	x0, [x0, _PIA_PORTA_mask@GOTPAGEOFF]
	mov	w1, #1
	bl	_StateSav_ReadUBYTE
Lloh30:
	adrp	x0, _PIA_PORTB_mask@GOTPAGE
Lloh31:
	ldr	x0, [x0, _PIA_PORTB_mask@GOTPAGEOFF]
	mov	w1, #1
	bl	_StateSav_ReadUBYTE
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_PIA_PACTL,4,2                  ; @PIA_PACTL
	.comm	_PIA_PBCTL,4,2                  ; @PIA_PBCTL
	.comm	_PIA_PORTA,4,2                  ; @PIA_PORTA
	.comm	_PIA_PORTB,4,2                  ; @PIA_PORTB
	.comm	_MEMORY_xe_bank,4,2             ; @MEMORY_xe_bank
	.comm	_MEMORY_selftest_enabled,4,2    ; @MEMORY_selftest_enabled
	.comm	_Atari800_machine_type,8,3      ; @Atari800_machine_type
	.comm	_Atari800_MACHINE_XLXE,8,3      ; @Atari800_MACHINE_XLXE
	.comm	_MEMORY_ram_size,8,3            ; @MEMORY_ram_size
	.comm	_MEMORY_RAM_320_COMPY_SHOP,8,3  ; @MEMORY_RAM_320_COMPY_SHOP
	.comm	_MEMORY_RAM_320_RAMBO,8,3       ; @MEMORY_RAM_320_RAMBO
	.comm	_MEMORY_cartA0BF_enabled,4,2    ; @MEMORY_cartA0BF_enabled
	.comm	_PIA_PORTA_mask,4,2             ; @PIA_PORTA_mask
	.comm	_PIA_PORTB_mask,4,2             ; @PIA_PORTB_mask
.subsections_via_symbols
