	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function olpc_bat_eeprom_read
_olpc_bat_eeprom_read:                  ## @olpc_bat_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
	testq	%r9, %r9
	je	LBB0_1
## %bb.3:
	movq	%r9, %r13
	movq	%r8, %r14
	movq	%rcx, %r15
	xorl	%ebx, %ebx
	leaq	-48(%rbp), %r12
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	leaq	(%r14,%rbx), %rax
	movq	_EEPROM_START@GOTPCREL(%rip), %rcx
	addq	(%rcx), %rax
	movq	%rax, -48(%rbp)
	movq	_EC_BAT_EEPROM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	(%r15,%rbx), %rcx
	movq	%r12, %rsi
	movl	$1, %edx
	movl	$1, %r8d
	callq	_olpc_ec_cmd
	testl	%eax, %eax
	jne	LBB0_5
## %bb.2:                               ##   in Loop: Header=BB0_4 Depth=1
	incq	%rbx
	cmpq	%rbx, %r13
	jne	LBB0_4
	jmp	LBB0_6
LBB0_1:
	xorl	%r13d, %r13d
	jmp	LBB0_6
LBB0_5:
	movq	-48(%rbp), %rsi
	leaq	L_.str(%rip), %rdi
	movl	%eax, %edx
	callq	_pr_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subq	(%rax), %r13
LBB0_6:
	movq	%r13, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EEPROM_START,8,3               ## @EEPROM_START
	.comm	_EC_BAT_EEPROM,4,2              ## @EC_BAT_EEPROM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"olpc-battery: EC_BAT_EEPROM cmd @ 0x%x failed - %d!\n"

	.comm	_EIO,8,3                        ## @EIO
	.no_dead_strip	_olpc_bat_eeprom_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function olpc_bat_eeprom_read
_olpc_bat_eeprom_read:                  ; @olpc_bat_eeprom_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x5
	cbz	x5, LBB0_5
; %bb.1:
	mov	x20, x4
	mov	x21, x3
	mov	x22, #0
Lloh0:
	adrp	x23, _EEPROM_START@GOTPAGE
Lloh1:
	ldr	x23, [x23, _EEPROM_START@GOTPAGEOFF]
Lloh2:
	adrp	x24, _EC_BAT_EEPROM@GOTPAGE
Lloh3:
	ldr	x24, [x24, _EC_BAT_EEPROM@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23]
	add	x9, x20, x22
	add	x8, x9, x8
	str	x8, [sp, #8]
	ldr	w0, [x24]
	add	x3, x21, x22
	add	x1, sp, #8
	mov	w2, #1
	mov	w4, #1
	bl	_olpc_ec_cmd
	cbnz	w0, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x22, x22, #1
	cmp	x19, x22
	b.ne	LBB0_2
	b	LBB0_5
LBB0_4:
	mov	x2, x0
	ldr	x1, [sp, #8]
Lloh4:
	adrp	x0, l_.str@PAGE
Lloh5:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
Lloh6:
	adrp	x8, _EIO@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	neg	x19, x8
LBB0_5:
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EEPROM_START,8,3               ; @EEPROM_START
	.comm	_EC_BAT_EEPROM,4,2              ; @EC_BAT_EEPROM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"olpc-battery: EC_BAT_EEPROM cmd @ 0x%x failed - %d!\n"

	.comm	_EIO,8,3                        ; @EIO
	.no_dead_strip	_olpc_bat_eeprom_read
.subsections_via_symbols
