	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calc_soc
_calc_soc:                              ## @calc_soc
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	testq	%rdx, %rdx
	je	LBB0_15
## %bb.1:
	movq	%rdx, %r14
	cmpl	$128, %esi
	je	LBB0_5
## %bb.2:
	cmpl	$129, %esi
	jne	LBB0_4
## %bb.3:
	leaq	-20(%rbp), %rsi
	callq	_calc_ocv
LBB0_4:
	testl	%eax, %eax
	jne	LBB0_15
	jmp	LBB0_6
LBB0_5:
	leaq	-20(%rbp), %rdx
	movl	$128, %esi
	callq	_measure_vbatt
	testl	%eax, %eax
	jne	LBB0_15
LBB0_6:
	movq	_array_soc@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	callq	_ARRAY_SIZE
	movl	%eax, %ecx
	movl	-20(%rbp), %edx
	movq	(%rbx), %rsi
	cltq
	movq	-8(%rsi,%rax,8), %rbx
	xorl	%eax, %eax
	movl	$0, %edi
	cmpl	(%rbx), %edx
	jl	LBB0_14
## %bb.7:
	testl	%ecx, %ecx
	jle	LBB0_12
## %bb.8:
	movl	%ecx, %ecx
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rsi,%rdi,8), %rbx
	cmpl	(%rbx), %edx
	jge	LBB0_13
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	incq	%rdi
	cmpq	%rdi, %rcx
	jne	LBB0_9
LBB0_12:
	xorl	%eax, %eax
	jmp	LBB0_15
LBB0_13:
	movl	4(%rbx), %edi
LBB0_14:
	movl	%edi, (%r14)
LBB0_15:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_array_soc,8,3                  ## @array_soc
	.no_dead_strip	_calc_soc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calc_soc
_calc_soc:                              ; @calc_soc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x8, x0
Lloh0:
	adrp	x9, _EINVAL@GOTPAGE
Lloh1:
	ldr	x9, [x9, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	neg	w0, w9
	cbz	x2, LBB0_15
; %bb.1:
	mov	x19, x2
	cmp	w1, #128
	b.eq	LBB0_5
; %bb.2:
	cmp	w1, #129
	b.ne	LBB0_4
; %bb.3:
	add	x1, sp, #12
	mov	x0, x8
	bl	_calc_ocv
LBB0_4:
	cbnz	w0, LBB0_15
	b	LBB0_6
LBB0_5:
	add	x2, sp, #12
	mov	x0, x8
	bl	_measure_vbatt
	cbnz	w0, LBB0_15
LBB0_6:
Lloh3:
	adrp	x20, _array_soc@GOTPAGE
Lloh4:
	ldr	x20, [x20, _array_soc@GOTPAGEOFF]
	ldr	x0, [x20]
	bl	_ARRAY_SIZE
	ldr	w8, [sp, #12]
	ldr	x9, [x20]
	sub	w10, w0, #1
	ldr	x10, [x9, w10, sxtw #3]
	ldr	w10, [x10]
	cmp	w8, w10
	b.ge	LBB0_8
; %bb.7:
	mov	w8, #0
	b	LBB0_14
LBB0_8:
	cmp	w0, #1
	b.lt	LBB0_12
; %bb.9:
	mov	w10, w0
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x9]
	ldr	w12, [x11]
	cmp	w8, w12
	b.ge	LBB0_13
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	add	x9, x9, #8
	subs	x10, x10, #1
	b.ne	LBB0_10
LBB0_12:
	mov	w0, #0
	b	LBB0_15
LBB0_13:
	ldr	w8, [x11, #4]
LBB0_14:
	mov	w0, #0
	str	w8, [x19]
LBB0_15:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_array_soc,8,3                  ; @array_soc
	.no_dead_strip	_calc_soc
.subsections_via_symbols
