	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_EEPROM_read                    ## -- Begin function EEPROM_read
	.p2align	4, 0x90
_EEPROM_read:                           ## @EEPROM_read
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_Pico@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	sarl	$6, %edi
	callq	_EEPROM_write_do
	movl	(%rbx), %r15d
	movl	4(%rbx), %r12d
	movl	8(%rbx), %r14d
	movl	12(%rbx), %r13d
	xorl	%eax, %eax
	callq	_SekCyclesDone
	movl	%r15d, %ebx
	shrl	$6, %ebx
	testb	$-128, %r15b
	jne	LBB0_3
## %bb.1:
	movq	_last_write@GOTPCREL(%rip), %rcx
	subl	(%rcx), %eax
	cmpl	$24, %eax
	jb	LBB0_3
## %bb.2:
	movq	_EL_EEPROM@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_elprintf
	incl	%r14d
LBB0_3:
	andl	$1, %ebx
	testb	$8, %r15b
	je	LBB0_19
## %bb.4:
	cmpl	$27, %r14d
	ja	LBB0_7
## %bb.5:
	movl	$134480384, %eax                ## imm = 0x8040200
	btl	%r14d, %eax
	jae	LBB0_7
## %bb.6:
	movq	_EL_EEPROM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_elprintf
LBB0_19:
	movq	_SRam@GOTPCREL(%rip), %rax
	movb	8(%rax), %cl
	shll	%cl, %ebx
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	leal	-10(%r14), %eax
	cmpl	$7, %eax
	ja	LBB0_19
## %bb.8:
	movl	%r12d, %edx
	andl	$8191, %edx                     ## imm = 0x1FFF
	movl	$17, %eax
	subl	%r14d, %eax
	movq	_SRam@GOTPCREL(%rip), %rcx
	cmpq	$0, 16(%rcx)
	je	LBB0_13
## %bb.9:
	testb	$1, %r13b
	je	LBB0_19
## %bb.10:
	movl	%eax, %r12d
	movq	_EL_EEPROM@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	leaq	L_.str.2(%rip), %rsi
	movq	%rdx, %r13
	movl	%r14d, %ecx
	movl	%r15d, %r8d
	xorl	%eax, %eax
	callq	_elprintf
	cmpl	$17, %r14d
	jne	LBB0_12
## %bb.11:
	movl	(%rbx), %edi
	movq	_SRam@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%r13d, %r13d
	movl	(%rax,%r13,4), %edx
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_elprintf
LBB0_12:
	movq	_SRam@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax,%r13,4), %eax
	jmp	LBB0_18
LBB0_13:
	testb	$1, %r12b
	je	LBB0_19
## %bb.14:
	movl	%eax, %r12d
	movq	_EL_EEPROM@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	shrl	%edx
	leaq	L_.str.2(%rip), %rsi
	movq	%rdx, %r13
	movl	%r14d, %ecx
	movl	%r15d, %r8d
	xorl	%eax, %eax
	callq	_elprintf
	movq	_SRam@GOTPCREL(%rip), %rax
	cmpl	$17, %r14d
	jne	LBB0_15
## %bb.16:
	movl	(%rbx), %edi
	movq	(%rax), %rax
	movl	%r13d, %ebx
	movl	(%rax,%rbx,4), %edx
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_elprintf
	movq	_SRam@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_15:
	movl	%r13d, %ebx
LBB0_17:
	movq	(%rax), %rax
	movl	(%rax,%rbx,4), %eax
LBB0_18:
	xorl	%ebx, %ebx
	btl	%r12d, %eax
	setb	%bl
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.comm	_Pico,16,2                      ## @Pico
	.comm	_last_write,4,2                 ## @last_write
	.comm	_EL_EEPROM,4,2                  ## @EL_EEPROM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"eeprom: early read, cycles=%i"

L_.str.1:                               ## @.str.1
	.asciz	"eeprom: r ack"

	.comm	_SRam,24,3                      ## @SRam
L_.str.2:                               ## @.str.2
	.asciz	"eeprom: read: addr %02x, cycle %i, reg %02x"

L_.str.3:                               ## @.str.3
	.asciz	"eeprom: read done, byte %02x"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_EEPROM_read                    ; -- Begin function EEPROM_read
	.p2align	2
_EEPROM_read:                           ; @EEPROM_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
Lloh0:
	adrp	x19, _Pico@GOTPAGE
Lloh1:
	ldr	x19, [x19, _Pico@GOTPAGEOFF]
	ldr	w8, [x19]
	asr	w0, w8, #6
	bl	_EEPROM_write_do
	ldp	w22, w24, [x19]
	ldp	w20, w25, [x19, #8]
	bl	_SekCyclesDone
	ubfx	w23, w22, #6, #1
	tbnz	w22, #7, LBB0_3
; %bb.1:
Lloh2:
	adrp	x8, _last_write@GOTPAGE
Lloh3:
	ldr	x8, [x8, _last_write@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	sub	w8, w0, w8
	cmp	w8, #24
	b.lo	LBB0_3
; %bb.2:
Lloh5:
	adrp	x9, _EL_EEPROM@GOTPAGE
Lloh6:
	ldr	x9, [x9, _EL_EEPROM@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x9]
	str	x8, [sp]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_elprintf
	add	w20, w20, #1
LBB0_3:
Lloh10:
	adrp	x19, _SRam@GOTPAGE
Lloh11:
	ldr	x19, [x19, _SRam@GOTPAGEOFF]
	tbz	w22, #3, LBB0_6
; %bb.4:
	cmp	w20, #27
	mov	w8, #1
	lsl	w8, w8, w20
	mov	w9, #512
	movk	w9, #2052, lsl #16
	and	w8, w8, w9
	ccmp	w8, #0, #4, ls
	b.eq	LBB0_7
; %bb.5:
Lloh12:
	adrp	x8, _EL_EEPROM@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EL_EEPROM@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_elprintf
	mov	w23, #0
LBB0_6:
	ldr	w8, [x19, #8]
	lsl	w0, w23, w8
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_7:
	sub	w8, w20, #10
	cmp	w8, #7
	b.hi	LBB0_6
; %bb.8:
	and	x26, x24, #0x1fff
	mov	w8, #17
	sub	w21, w8, w20
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_13
; %bb.9:
	tbz	w25, #0, LBB0_6
; %bb.10:
Lloh17:
	adrp	x23, _EL_EEPROM@GOTPAGE
Lloh18:
	ldr	x23, [x23, _EL_EEPROM@GOTPAGEOFF]
	ldr	w0, [x23]
	stp	x20, x22, [sp, #8]
	mov	x8, x26
	str	x8, [sp]
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_elprintf
	cmp	w20, #17
	b.ne	LBB0_12
; %bb.11:
	ldr	w0, [x23]
	ldr	x8, [x19]
	mov	w20, w26
	ldr	w8, [x8, w26, uxtw #2]
	str	x8, [sp]
Lloh21:
	adrp	x1, l_.str.3@PAGE
Lloh22:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_elprintf
	mov	x26, x20
LBB0_12:
	ldr	x8, [x19]
	ldr	w8, [x8, x26, lsl #2]
	b	LBB0_17
LBB0_13:
	tbz	w24, #0, LBB0_6
; %bb.14:
Lloh23:
	adrp	x24, _EL_EEPROM@GOTPAGE
Lloh24:
	ldr	x24, [x24, _EL_EEPROM@GOTPAGEOFF]
	ldr	w0, [x24]
	lsr	w23, w26, #1
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	mov	x8, x20
	mov	x9, x23
	stp	x8, x22, [sp, #8]
	str	x9, [sp]
Lloh25:
	adrp	x1, l_.str.2@PAGE
Lloh26:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_elprintf
	cmp	w20, #17
	b.ne	LBB0_16
; %bb.15:
	ldr	w0, [x24]
	ldr	x8, [x19]
	ldr	w8, [x8, w23, uxtw #2]
	str	x8, [sp]
Lloh27:
	adrp	x1, l_.str.3@PAGE
Lloh28:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_elprintf
LBB0_16:
	ldr	x8, [x19]
	ldr	w8, [x8, x23, lsl #2]
LBB0_17:
	lsr	w8, w8, w21
	and	w23, w8, #0x1
	b	LBB0_6
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_Pico,16,2                      ; @Pico
	.comm	_last_write,4,2                 ; @last_write
	.comm	_EL_EEPROM,4,2                  ; @EL_EEPROM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"eeprom: early read, cycles=%i"

l_.str.1:                               ; @.str.1
	.asciz	"eeprom: r ack"

	.comm	_SRam,24,3                      ; @SRam
l_.str.2:                               ; @.str.2
	.asciz	"eeprom: read: addr %02x, cycle %i, reg %02x"

l_.str.3:                               ; @.str.3
	.asciz	"eeprom: read done, byte %02x"

.subsections_via_symbols
