	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cpcap_battery_read_accumulated
_cpcap_battery_read_accumulated:        ## @cpcap_battery_read_accumulated
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	$0, (%rsi)
	movl	$0, 8(%rsi)
	movl	8(%rdi), %r12d
	movq	_CPCAP_REG_CCS1@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	-80(%rbp), %r13
	movq	%r13, %rdi
	callq	_ARRAY_SIZE
	movl	%r12d, %edi
	movl	%ebx, %esi
	movq	%r13, %rdx
	movl	%eax, %ecx
	callq	_regmap_bulk_read
	movl	%eax, %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	jne	LBB0_4
## %bb.1:
	movl	-76(%rbp), %esi
	shll	$16, %esi
	andl	$268369920, %esi                ## imm = 0xFFF0000
	orl	-80(%rbp), %esi
	movl	%esi, (%r15)
	movq	(%r14), %rax
	movq	_CPCAP_VENDOR_TI@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_3
## %bb.2:
	movl	$24, %edi
	callq	_sign_extend32
	movl	%eax, (%r15)
LBB0_3:
	movl	-68(%rbp), %eax
	shll	$16, %eax
	orl	-72(%rbp), %eax
	movl	%eax, 4(%r15)
	movl	-64(%rbp), %edi
	movl	%edi, 8(%r15)
	movl	$9, %esi
	callq	_sign_extend32
	movl	%eax, 8(%r15)
	movl	(%r15), %esi
	movl	4(%r15), %edx
	movq	%r14, %rdi
	movl	%eax, %ecx
	callq	_cpcap_battery_cc_to_uah
LBB0_4:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_6
## %bb.5:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_CPCAP_REG_CCS1,4,2             ## @CPCAP_REG_CCS1
	.comm	_CPCAP_VENDOR_TI,8,3            ## @CPCAP_VENDOR_TI
	.no_dead_strip	_cpcap_battery_read_accumulated
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cpcap_battery_read_accumulated
_cpcap_battery_read_accumulated:        ; @cpcap_battery_read_accumulated
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #40]
	str	xzr, [x1]
	str	wzr, [x1, #8]
	ldr	w21, [x0, #8]
Lloh3:
	adrp	x8, _CPCAP_REG_CCS1@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CPCAP_REG_CCS1@GOTPAGEOFF]
Lloh5:
	ldr	w22, [x8]
	add	x0, sp, #12
	bl	_ARRAY_SIZE
	mov	x3, x0
	add	x2, sp, #12
	mov	x0, x21
	mov	x1, x22
	bl	_regmap_bulk_read
	mov	x8, x0
	mov	w0, #0
	cbnz	w8, LBB0_4
; %bb.1:
	ldp	w9, w8, [sp, #12]
	ubfiz	w8, w8, #16, #12
	orr	w1, w8, w9
	str	w1, [x20]
	ldr	x8, [x19]
Lloh6:
	adrp	x9, _CPCAP_VENDOR_TI@GOTPAGE
Lloh7:
	ldr	x9, [x9, _CPCAP_VENDOR_TI@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
	mov	w0, #24
	bl	_sign_extend32
	str	w0, [x20]
LBB0_3:
	ldp	w9, w8, [sp, #20]
	orr	w8, w9, w8, lsl #16
	ldr	w0, [sp, #28]
	stp	w8, w0, [x20, #4]
	mov	w1, #9
	bl	_sign_extend32
	mov	x3, x0
	str	w3, [x20, #8]
	ldp	w1, w2, [x20]
	mov	x0, x19
                                        ; kill: def $w3 killed $w3 killed $x3
	bl	_cpcap_battery_cc_to_uah
LBB0_4:
	ldr	x8, [sp, #40]
Lloh9:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh10:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_6
; %bb.5:
	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
	add	sp, sp, #96
	ret
LBB0_6:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_CPCAP_REG_CCS1,4,2             ; @CPCAP_REG_CCS1
	.comm	_CPCAP_VENDOR_TI,8,3            ; @CPCAP_VENDOR_TI
	.no_dead_strip	_cpcap_battery_read_accumulated
.subsections_via_symbols
