	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cpcap_battery_update_status
_cpcap_battery_update_status:           ## @cpcap_battery_update_status
	.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	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	leaq	-48(%rbp), %rdi
	xorl	%esi, %esi
	movl	$24, %edx
	callq	_memset
	xorl	%eax, %eax
	callq	_ktime_get
	movl	%eax, %r15d
	movq	%rbx, %rdi
	callq	_cpcap_battery_latest
	movq	%rax, %r14
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movl	20(%r14), %esi
	movl	%r15d, %edi
	callq	_ktime_sub
	movl	%eax, %edi
	callq	_ktime_to_ms
	movq	_CPCAP_BATTERY_CC_SAMPLE_PERIOD_MS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_4
LBB0_2:
	movl	%r15d, -28(%rbp)
	movq	%rbx, %rdi
	callq	_cpcap_battery_get_voltage
	movl	%eax, -32(%rbp)
	movq	%rbx, %rdi
	callq	_cpcap_battery_get_current
	movl	%eax, -36(%rbp)
	leaq	-44(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_cpcap_battery_read_accumulated
	movl	%eax, -40(%rbp)
	leaq	-48(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_cpcap_charger_battery_temperature
                                        ## kill: def $eax killed $eax def $rax
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:
	movq	%rbx, %rdi
	callq	_cpcap_battery_previous
	movq	%rax, %rdi
	movq	%r14, %rsi
	movl	$24, %edx
	callq	_memcpy
	leaq	-48(%rbp), %rsi
	movq	%r14, %rdi
	movl	$24, %edx
	callq	_memcpy
	xorl	%eax, %eax
LBB0_4:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CPCAP_BATTERY_CC_SAMPLE_PERIOD_MS,8,3 ## @CPCAP_BATTERY_CC_SAMPLE_PERIOD_MS
	.no_dead_strip	_cpcap_battery_update_status
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cpcap_battery_update_status
_cpcap_battery_update_status:           ; @cpcap_battery_update_status
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x0
	add	x22, sp, #8
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #24
	bl	_memset
	bl	_ktime_get
	mov	x21, x0
	mov	x0, x19
	bl	_cpcap_battery_latest
	mov	x20, x0
	cbz	x0, LBB0_2
; %bb.1:
	ldr	w1, [x20, #20]
	mov	x0, x21
	bl	_ktime_sub
	bl	_ktime_to_ms
Lloh0:
	adrp	x8, _CPCAP_BATTERY_CC_SAMPLE_PERIOD_MS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CPCAP_BATTERY_CC_SAMPLE_PERIOD_MS@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x0, x8
	b.lt	LBB0_4
LBB0_2:
	str	w21, [sp, #28]
	mov	x0, x19
	bl	_cpcap_battery_get_voltage
	str	w0, [sp, #24]
	mov	x0, x19
	bl	_cpcap_battery_get_current
	str	w0, [sp, #20]
	orr	x1, x22, #0x4
	mov	x0, x19
	bl	_cpcap_battery_read_accumulated
	str	w0, [sp, #16]
	add	x1, sp, #8
	mov	x0, x19
	bl	_cpcap_charger_battery_temperature
                                        ; kill: def $w0 killed $w0 def $x0
	cbnz	w0, LBB0_4
; %bb.3:
	mov	x0, x19
	bl	_cpcap_battery_previous
	mov	x1, x20
	mov	w2, #24
	bl	_memcpy
	add	x1, sp, #8
	mov	x0, x20
	mov	w2, #24
	bl	_memcpy
	mov	w0, #0
LBB0_4:
                                        ; kill: def $w0 killed $w0 killed $x0
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_CPCAP_BATTERY_CC_SAMPLE_PERIOD_MS,8,3 ; @CPCAP_BATTERY_CC_SAMPLE_PERIOD_MS
	.no_dead_strip	_cpcap_battery_update_status
.subsections_via_symbols
