	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function done_battery_state_smart
_done_battery_state_smart:              ## @done_battery_state_smart
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	_PMU_BATT_TYPE_SMART@GOTPCREL(%rip), %rsi
	movq	(%rdi), %rdx
	movl	4(%rdx), %ecx
	movl	%ecx, %ebx
	movq	_PMU_PWR_AC_PRESENT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	andl	$1, %ebx
	jne	LBB0_1
## %bb.2:
	notl	%edi
	movq	_pmu_power_flags@GOTPCREL(%rip), %rax
	andl	(%rax), %edi
	jmp	LBB0_3
LBB0_1:
	movq	_pmu_power_flags@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
LBB0_3:
	movl	(%rsi), %r15d
	movq	_pmu_power_flags@GOTPCREL(%rip), %rax
	movl	%edi, (%rax)
	xorl	%r14d, %r14d
	testb	$4, %cl
	je	LBB0_8
## %bb.4:
	movq	_PMU_BATT_PRESENT@GOTPCREL(%rip), %rax
	orl	(%rax), %r15d
	movl	(%rdx), %eax
	leal	-3(%rax), %ecx
	cmpl	$2, %ecx
	jae	LBB0_5
## %bb.21:
	movl	8(%rdx), %r9d
	movl	12(%rdx), %r11d
	movsbl	16(%rdx), %esi
	movl	20(%rdx), %r10d
	jmp	LBB0_9
LBB0_5:
	cmpl	$5, %eax
	jne	LBB0_7
## %bb.6:
	movl	8(%rdx), %r9d
	movl	16(%rdx), %r11d
	shll	$8, %r9d
	orl	12(%rdx), %r9d
	shll	$8, %r11d
	orl	20(%rdx), %r11d
	movswl	24(%rdx), %esi
	movl	32(%rdx), %r10d
	shll	$8, %r10d
	orl	36(%rdx), %r10d
	jmp	LBB0_9
LBB0_7:
	movl	8(%r12), %esi
	leaq	L_.str(%rip), %rdi
	callq	_pr_warn
	movq	(%r12), %rdx
	movl	4(%rdx), %ebx
	andl	$1, %ebx
LBB0_8:
	xorl	%esi, %esi
	xorl	%r9d, %r9d
	xorl	%r11d, %r11d
	xorl	%r10d, %r10d
LBB0_9:
	movl	$0, %eax
	testl	%esi, %esi
	jle	LBB0_11
## %bb.10:
	movq	_PMU_BATT_CHARGING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_11:
	testl	%ebx, %ebx
	cmovel	%ebx, %eax
	orl	%r15d, %eax
	movq	_pmu_batteries@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdi
	movq	_pmu_cur_battery@GOTPCREL(%rip), %r8
	movq	(%r8), %rcx
	leaq	(%rcx,%rcx,2), %rbx
	movl	%eax, (%rdi,%rbx,8)
	movl	%r9d, 4(%rdi,%rbx,8)
	movl	%r11d, 8(%rdi,%rbx,8)
	movl	%esi, 12(%rdi,%rbx,8)
	movl	%r10d, 16(%rdi,%rbx,8)
	testl	%esi, %esi
	je	LBB0_17
## %bb.12:
	testb	$1, 4(%rdx)
	je	LBB0_15
## %bb.13:
	testl	%esi, %esi
	jle	LBB0_15
## %bb.14:
	subl	%r9d, %r11d
	imull	$3600, %r11d, %eax              ## imm = 0xE10
	jmp	LBB0_16
LBB0_15:
	imull	$3600, %r9d, %eax               ## imm = 0xE10
	negl	%esi
LBB0_16:
	xorl	%edx, %edx
	divl	%esi
	movl	%eax, %r14d
LBB0_17:
	movl	%r14d, 20(%rdi,%rbx,8)
	incq	%rcx
	movq	_pmu_battery_count@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%rcx, %rax
	orq	%rsi, %rax
	shrq	$32, %rax
	je	LBB0_18
## %bb.19:
	movq	%rcx, %rax
	xorl	%edx, %edx
	divq	%rsi
	jmp	LBB0_20
LBB0_18:
	movl	%ecx, %eax
	xorl	%edx, %edx
	divl	%esi
                                        ## kill: def $edx killed $edx def $rdx
LBB0_20:
	movq	%rdx, (%r8)
	movq	_async_req_locks@GOTPCREL(%rip), %rsi
	xorl	%edi, %edi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_clear_bit                      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_PMU_BATT_TYPE_SMART,4,2        ## @PMU_BATT_TYPE_SMART
	.comm	_PMU_PWR_AC_PRESENT,4,2         ## @PMU_PWR_AC_PRESENT
	.comm	_pmu_power_flags,4,2            ## @pmu_power_flags
	.comm	_PMU_BATT_PRESENT,4,2           ## @PMU_BATT_PRESENT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pmu.c: unrecognized battery info, len: %d, %4ph\n"

	.comm	_PMU_BATT_CHARGING,4,2          ## @PMU_BATT_CHARGING
	.comm	_pmu_batteries,8,3              ## @pmu_batteries
	.comm	_pmu_cur_battery,8,3            ## @pmu_cur_battery
	.comm	_pmu_battery_count,8,3          ## @pmu_battery_count
	.comm	_async_req_locks,4,2            ## @async_req_locks
	.no_dead_strip	_done_battery_state_smart
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function done_battery_state_smart
_done_battery_state_smart:              ; @done_battery_state_smart
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x10, _PMU_BATT_TYPE_SMART@GOTPAGE
Lloh1:
	ldr	x10, [x10, _PMU_BATT_TYPE_SMART@GOTPAGEOFF]
	ldr	x2, [x0]
	ldr	w9, [x2, #4]
	and	w8, w9, #0x1
Lloh2:
	adrp	x11, _PMU_PWR_AC_PRESENT@GOTPAGE
Lloh3:
	ldr	x11, [x11, _PMU_PWR_AC_PRESENT@GOTPAGEOFF]
Lloh4:
	ldr	w12, [x11]
Lloh5:
	adrp	x11, _pmu_power_flags@GOTPAGE
Lloh6:
	ldr	x11, [x11, _pmu_power_flags@GOTPAGEOFF]
	tbnz	w9, #0, LBB0_2
; %bb.1:
	ldr	w13, [x11]
	bic	w12, w13, w12
	b	LBB0_3
LBB0_2:
	ldr	w13, [x11]
	orr	w12, w13, w12
LBB0_3:
	ldr	w20, [x10]
	str	w12, [x11]
	tbnz	w9, #2, LBB0_5
; %bb.4:
	mov	w10, #0
	mov	w9, #0
	mov	w11, #0
	mov	w12, #0
	b	LBB0_10
LBB0_5:
Lloh7:
	adrp	x9, _PMU_BATT_PRESENT@GOTPAGE
Lloh8:
	ldr	x9, [x9, _PMU_BATT_PRESENT@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	orr	w20, w9, w20
	ldr	w9, [x2]
	sub	w10, w9, #3
	cmp	w10, #2
	b.hs	LBB0_7
; %bb.6:
	ldp	w9, w11, [x2, #8]
	ldrsb	w10, [x2, #16]
	ldr	w12, [x2, #20]
	b	LBB0_10
LBB0_7:
	cmp	w9, #5
	b.ne	LBB0_9
; %bb.8:
	ldp	w9, w10, [x2, #8]
	orr	w9, w10, w9, lsl #8
	ldp	w10, w11, [x2, #16]
	orr	w11, w11, w10, lsl #8
	ldrsh	w10, [x2, #24]
	ldp	w12, w13, [x2, #32]
	orr	w12, w13, w12, lsl #8
	b	LBB0_10
LBB0_9:
	ldr	w1, [x19, #8]
Lloh10:
	adrp	x0, l_.str@PAGE
Lloh11:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_warn
	mov	w10, #0
	mov	w9, #0
	mov	w11, #0
	mov	w12, #0
	ldr	x2, [x19]
	ldr	w8, [x2, #4]
	and	w8, w8, #0x1
LBB0_10:
	cmp	w10, #0
	ccmp	w8, #0, #4, gt
Lloh12:
	adrp	x8, _PMU_BATT_CHARGING@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PMU_BATT_CHARGING@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	csel	w8, w8, wzr, ne
Lloh15:
	adrp	x13, _pmu_batteries@GOTPAGE
Lloh16:
	ldr	x13, [x13, _pmu_batteries@GOTPAGEOFF]
	orr	w15, w8, w20
Lloh17:
	ldr	x13, [x13]
Lloh18:
	adrp	x8, _pmu_cur_battery@GOTPAGE
Lloh19:
	ldr	x8, [x8, _pmu_cur_battery@GOTPAGEOFF]
	ldr	x14, [x8]
	mov	w16, #24
	madd	x16, x14, x16, x13
	stp	w15, w9, [x16]
	stp	w11, w10, [x16, #8]
	str	w12, [x16, #16]
	cbz	w10, LBB0_14
; %bb.11:
	ldrb	w12, [x2, #4]
	tbz	w12, #0, LBB0_15
; %bb.12:
	cmp	w10, #1
	b.lt	LBB0_15
; %bb.13:
	sub	w9, w11, w9
	mov	w11, #3600
	mul	w9, w9, w11
	b	LBB0_16
LBB0_14:
	mov	w9, #0
	b	LBB0_17
LBB0_15:
	mov	w11, #3600
	mul	w9, w9, w11
	neg	w10, w10
LBB0_16:
	udiv	w9, w9, w10
LBB0_17:
	mov	w10, #24
	madd	x10, x14, x10, x13
	str	w9, [x10, #20]
	add	x9, x14, #1
Lloh20:
	adrp	x10, _pmu_battery_count@GOTPAGE
Lloh21:
	ldr	x10, [x10, _pmu_battery_count@GOTPAGEOFF]
Lloh22:
	ldr	x10, [x10]
	udiv	x11, x9, x10
	msub	x9, x11, x10, x9
	str	x9, [x8]
Lloh23:
	adrp	x1, _async_req_locks@GOTPAGE
Lloh24:
	ldr	x1, [x1, _async_req_locks@GOTPAGEOFF]
	mov	w0, #0
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_clear_bit
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_PMU_BATT_TYPE_SMART,4,2        ; @PMU_BATT_TYPE_SMART
	.comm	_PMU_PWR_AC_PRESENT,4,2         ; @PMU_PWR_AC_PRESENT
	.comm	_pmu_power_flags,4,2            ; @pmu_power_flags
	.comm	_PMU_BATT_PRESENT,4,2           ; @PMU_BATT_PRESENT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pmu.c: unrecognized battery info, len: %d, %4ph\n"

	.comm	_PMU_BATT_CHARGING,4,2          ; @PMU_BATT_CHARGING
	.comm	_pmu_batteries,8,3              ; @pmu_batteries
	.comm	_pmu_cur_battery,8,3            ; @pmu_cur_battery
	.comm	_pmu_battery_count,8,3          ; @pmu_battery_count
	.comm	_async_req_locks,4,2            ; @async_req_locks
	.no_dead_strip	_done_battery_state_smart
.subsections_via_symbols
