	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cpcap_battery_cc_get_avg_current
_cpcap_battery_cc_get_avg_current:      ## @cpcap_battery_cc_get_avg_current
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	movq	_CPCAP_VENDOR_ST@GOTPCREL(%rip), %rcx
	xorl	%r15d, %r15d
	cmpq	(%rcx), %rax
	sete	%r12b
	movl	8(%rdi), %edi
	movq	_CPCAP_REG_CCI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-36(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	jne	LBB0_6
## %bb.1:
	movq	(%rbx), %rax
	movq	_CPCAP_VENDOR_TI@GOTPCREL(%rip), %rcx
	movl	-36(%rbp), %r14d
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.2:
	cmpl	$8193, %r14d                    ## imm = 0x2001
	jl	LBB0_4
## %bb.3:
	orl	$49152, %r14d                   ## imm = 0xC000
	movl	%r14d, -36(%rbp)
LBB0_4:
	movl	8(%rbx), %edi
	movq	_CPCAP_REG_CCM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-36(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	jne	LBB0_6
## %bb.5:
	movb	%r12b, %r15b
	leal	(%r15,%r15,2), %esi
	incl	%esi
	movl	-36(%rbp), %eax
	movl	%eax, %ecx
	orl	$64512, %ecx                    ## imm = 0xFC00
	cmpl	$512, %eax                      ## imm = 0x200
	cmovll	%eax, %ecx
	movq	%rbx, %rdi
	movl	%r14d, %edx
	callq	_cpcap_battery_cc_to_ua
LBB0_6:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CPCAP_VENDOR_ST,8,3            ## @CPCAP_VENDOR_ST
	.comm	_CPCAP_REG_CCI,4,2              ## @CPCAP_REG_CCI
	.comm	_CPCAP_VENDOR_TI,8,3            ## @CPCAP_VENDOR_TI
	.comm	_CPCAP_REG_CCM,4,2              ## @CPCAP_REG_CCM
	.no_dead_strip	_cpcap_battery_cc_get_avg_current
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cpcap_battery_cc_get_avg_current
_cpcap_battery_cc_get_avg_current:      ; @cpcap_battery_cc_get_avg_current
	.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
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _CPCAP_VENDOR_ST@GOTPAGE
Lloh1:
	ldr	x9, [x9, _CPCAP_VENDOR_ST@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	mov	w8, #4
	csinc	w20, w8, wzr, eq
	ldr	w0, [x0, #8]
Lloh3:
	adrp	x8, _CPCAP_REG_CCI@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CPCAP_REG_CCI@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x2, sp, #12
	bl	_regmap_read
	cbnz	w0, LBB0_6
; %bb.1:
	ldr	x8, [x19]
Lloh6:
	adrp	x9, _CPCAP_VENDOR_TI@GOTPAGE
Lloh7:
	ldr	x9, [x9, _CPCAP_VENDOR_TI@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	ldr	w21, [sp, #12]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.2:
	cmp	w21, #2, lsl #12                ; =8192
	b.le	LBB0_4
; %bb.3:
	orr	w21, w21, #0xc000
	str	w21, [sp, #12]
LBB0_4:
	ldr	w0, [x19, #8]
Lloh9:
	adrp	x8, _CPCAP_REG_CCM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _CPCAP_REG_CCM@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	add	x2, sp, #12
	bl	_regmap_read
	cbnz	w0, LBB0_6
; %bb.5:
	ldr	w8, [sp, #12]
	orr	w9, w8, #0xfc00
	cmp	w8, #512
	csel	w3, w8, w9, lt
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_cpcap_battery_cc_to_ua
LBB0_6:
	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 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_VENDOR_ST,8,3            ; @CPCAP_VENDOR_ST
	.comm	_CPCAP_REG_CCI,4,2              ; @CPCAP_REG_CCI
	.comm	_CPCAP_VENDOR_TI,8,3            ; @CPCAP_VENDOR_TI
	.comm	_CPCAP_REG_CCM,4,2              ; @CPCAP_REG_CCM
	.no_dead_strip	_cpcap_battery_cc_get_avg_current
.subsections_via_symbols
