	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ee1004_read
_ee1004_read:                           ## @ee1004_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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %r12
	movl	%r8d, %r14d
	movq	%rcx, %r13
	movq	%rsi, %rdi
	callq	_kobj_to_dev
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_to_i2c_client
	movq	%rax, %r15
	xorl	%edi, %edi
	testq	%r12, %r12
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_15
## %bb.1:
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	_EE1004_PAGE_SHIFT@GOTPCREL(%rip), %rbx
	movb	(%rbx), %cl
	movl	%r14d, %r15d
	sarl	%cl, %r15d
	xorl	%edi, %edi
	cmpl	$2, %r15d
	setge	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	xorl	%r12d, %r12d
	jmp	LBB0_15
LBB0_3:
	movl	(%rbx), %ebx
	movq	_ee1004_bus_lock@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	testq	%r12, %r12
	je	LBB0_14
## %bb.4:
	movl	$-1, %r12d
	movl	%ebx, %ecx
	shll	%cl, %r12d
	notl	%r12d
	andl	%r14d, %r12d
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	_ee1004_current_page@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	je	LBB0_11
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	_ee1004_set_page@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%r15d, %rcx
	movl	(%rax,%rcx,4), %edi
	xorl	%esi, %esi
	callq	_i2c_smbus_write_byte
	movl	%eax, %ebx
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%ebx, %eax
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	xorl	%eax, %eax
	callq	_ee1004_get_current_page
	cmpl	%r15d, %eax
	je	LBB0_10
LBB0_8:                                 ##   in Loop: Header=BB0_5 Depth=1
	testl	%ebx, %ebx
	js	LBB0_9
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	leaq	L_.str.1(%rip), %rsi
	movl	%r15d, %edx
	callq	_dev_dbg
	movq	_ee1004_current_page@GOTPCREL(%rip), %rax
	movl	%r15d, (%rax)
LBB0_11:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movl	%r12d, %edx
	movq	%r14, %rcx
	callq	_ee1004_eeprom_read
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	%ebx, %eax
	addq	%rax, %r13
	addl	%ebx, %r12d
	xorl	%ecx, %ecx
	movq	_EE1004_PAGE_SIZE@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %r12d
	sete	%cl
	movl	$0, %edx
	cmovel	%edx, %r12d
	addl	%ecx, %r15d
	subq	%rax, %r14
	jne	LBB0_5
LBB0_14:
	movq	_ee1004_bus_lock@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	jmp	LBB0_15
LBB0_9:
	leaq	L_.str(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r15d, %edx
	movl	%ebx, %ecx
	callq	_dev_err
LBB0_12:
	movq	_ee1004_bus_lock@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movslq	%ebx, %r12
LBB0_15:
	movq	%r12, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EE1004_PAGE_SHIFT,4,2          ## @EE1004_PAGE_SHIFT
	.comm	_ee1004_bus_lock,4,2            ## @ee1004_bus_lock
	.comm	_ee1004_current_page,4,2        ## @ee1004_current_page
	.comm	_ee1004_set_page,8,3            ## @ee1004_set_page
	.comm	_ENXIO,4,2                      ## @ENXIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to select page %d (%d)\n"

L_.str.1:                               ## @.str.1
	.asciz	"Selected page %d\n"

	.comm	_EE1004_PAGE_SIZE,4,2           ## @EE1004_PAGE_SIZE
	.no_dead_strip	_ee1004_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ee1004_read
_ee1004_read:                           ; @ee1004_read
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x5
	mov	x24, x4
	mov	x20, x3
	mov	x0, x1
	bl	_kobj_to_dev
	mov	x21, x0
	bl	_to_i2c_client
	mov	x22, x0
	cmp	x19, #0
	cset	w0, eq
	bl	_unlikely
	cbnz	x0, LBB0_15
; %bb.1:
Lloh0:
	adrp	x25, _EE1004_PAGE_SHIFT@GOTPAGE
Lloh1:
	ldr	x25, [x25, _EE1004_PAGE_SHIFT@GOTPAGEOFF]
	ldr	w8, [x25]
	asr	w23, w24, w8
	cmp	w23, #1
	cset	w0, gt
	bl	_unlikely
	cbz	x0, LBB0_3
; %bb.2:
	mov	x19, #0
	b	LBB0_15
LBB0_3:
	ldr	w25, [x25]
Lloh2:
	adrp	x0, _ee1004_bus_lock@GOTPAGE
Lloh3:
	ldr	x0, [x0, _ee1004_bus_lock@GOTPAGEOFF]
	bl	_mutex_lock
	cbz	x19, LBB0_12
; %bb.4:
	mov	w8, #-1
	lsl	w8, w8, w25
Lloh4:
	adrp	x28, _ee1004_current_page@GOTPAGE
Lloh5:
	ldr	x28, [x28, _ee1004_current_page@GOTPAGEOFF]
	bic	w25, w24, w8
Lloh6:
	adrp	x24, _ENXIO@GOTPAGE
Lloh7:
	ldr	x24, [x24, _ENXIO@GOTPAGEOFF]
	mov	x26, x19
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x28]
	cmp	w23, w8
	b.eq	LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
Lloh8:
	adrp	x8, _ee1004_set_page@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ee1004_set_page@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	ldr	w0, [x8, w23, sxtw #2]
	mov	w1, #0
	bl	_i2c_smbus_write_byte
	mov	x27, x0
	ldr	w8, [x24]
	cmn	w0, w8
	b.ne	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	bl	_ee1004_get_current_page
	cmp	w0, w23
	b.eq	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_5 Depth=1
	tbnz	w27, #31, LBB0_13
LBB0_9:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x21
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x23
	bl	_dev_dbg
	str	w23, [x28]
LBB0_10:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x22
	mov	x1, x20
	mov	x2, x25
	mov	x3, x26
	bl	_ee1004_eeprom_read
	mov	x27, x0
	tbnz	w0, #31, LBB0_14
; %bb.11:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	w8, w27
	add	x20, x20, x8
Lloh13:
	adrp	x9, _EE1004_PAGE_SIZE@GOTPAGE
Lloh14:
	ldr	x9, [x9, _EE1004_PAGE_SIZE@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	add	w10, w27, w25
	cmp	w10, w9
	csel	w25, wzr, w10, eq
	cinc	w23, w23, eq
	sub	x26, x26, x8
	cbnz	x26, LBB0_5
LBB0_12:
Lloh16:
	adrp	x0, _ee1004_bus_lock@GOTPAGE
Lloh17:
	ldr	x0, [x0, _ee1004_bus_lock@GOTPAGEOFF]
	bl	_mutex_unlock
	b	LBB0_15
LBB0_13:
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	x2, x23
	mov	x3, x27
	bl	_dev_err
LBB0_14:
Lloh20:
	adrp	x0, _ee1004_bus_lock@GOTPAGE
Lloh21:
	ldr	x0, [x0, _ee1004_bus_lock@GOTPAGEOFF]
	bl	_mutex_unlock
	sxtw	x19, w27
LBB0_15:
	mov	x0, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_EE1004_PAGE_SHIFT,4,2          ; @EE1004_PAGE_SHIFT
	.comm	_ee1004_bus_lock,4,2            ; @ee1004_bus_lock
	.comm	_ee1004_current_page,4,2        ; @ee1004_current_page
	.comm	_ee1004_set_page,8,3            ; @ee1004_set_page
	.comm	_ENXIO,4,2                      ; @ENXIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to select page %d (%d)\n"

l_.str.1:                               ; @.str.1
	.asciz	"Selected page %d\n"

	.comm	_EE1004_PAGE_SIZE,4,2           ; @EE1004_PAGE_SIZE
	.no_dead_strip	_ee1004_read
.subsections_via_symbols
