	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bq27xxx_battery_read_dcap
_bq27xxx_battery_read_dcap:             ## @bq27xxx_battery_read_dcap
	.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
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	_BQ27XXX_O_ZERO@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	xorl	%edx, %edx
	andl	(%rdi), %eax
	setne	%dl
	movq	_BQ27XXX_REG_DCAP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_bq27xxx_read
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movl	(%r15), %eax
	testl	%eax, (%rbx)
	je	LBB0_4
## %bb.3:
	movq	_BQ27XXX_CURRENT_CONSTANT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	imull	%r14d, %eax
	shll	$8, %eax
	movq	_BQ27XXX_RS@GOTPCREL(%rip), %rcx
	cltd
	idivl	(%rcx)
	movl	%eax, %r14d
	jmp	LBB0_5
LBB0_1:
	movl	4(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	jmp	LBB0_5
LBB0_4:
	imull	$1000, %r14d, %r14d             ## imm = 0x3E8
LBB0_5:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BQ27XXX_O_ZERO,4,2             ## @BQ27XXX_O_ZERO
	.comm	_BQ27XXX_REG_DCAP,4,2           ## @BQ27XXX_REG_DCAP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"error reading initial last measured discharge\n"

	.comm	_BQ27XXX_CURRENT_CONSTANT,4,2   ## @BQ27XXX_CURRENT_CONSTANT
	.comm	_BQ27XXX_RS,4,2                 ## @BQ27XXX_RS
	.no_dead_strip	_bq27xxx_battery_read_dcap
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bq27xxx_battery_read_dcap
_bq27xxx_battery_read_dcap:             ; @bq27xxx_battery_read_dcap
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x20, x0
	ldr	w8, [x0]
Lloh0:
	adrp	x21, _BQ27XXX_O_ZERO@GOTPAGE
Lloh1:
	ldr	x21, [x21, _BQ27XXX_O_ZERO@GOTPAGEOFF]
	ldr	w9, [x21]
	tst	w9, w8
	cset	w2, ne
Lloh2:
	adrp	x8, _BQ27XXX_REG_DCAP@GOTPAGE
Lloh3:
	ldr	x8, [x8, _BQ27XXX_REG_DCAP@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	bl	_bq27xxx_read
	mov	x19, x0
	tbnz	w0, #31, LBB0_3
; %bb.1:
	ldr	w8, [x20]
	ldr	w9, [x21]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.2:
Lloh5:
	adrp	x8, _BQ27XXX_CURRENT_CONSTANT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _BQ27XXX_CURRENT_CONSTANT@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	mul	w8, w19, w8
	lsl	w8, w8, #8
Lloh8:
	adrp	x9, _BQ27XXX_RS@GOTPAGE
Lloh9:
	ldr	x9, [x9, _BQ27XXX_RS@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	sdiv	w19, w8, w9
	b	LBB0_5
LBB0_3:
	ldr	w0, [x20, #4]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	b	LBB0_5
LBB0_4:
	mov	w8, #1000
	mul	w19, w19, w8
LBB0_5:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_BQ27XXX_O_ZERO,4,2             ; @BQ27XXX_O_ZERO
	.comm	_BQ27XXX_REG_DCAP,4,2           ; @BQ27XXX_REG_DCAP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"error reading initial last measured discharge\n"

	.comm	_BQ27XXX_CURRENT_CONSTANT,4,2   ; @BQ27XXX_CURRENT_CONSTANT
	.comm	_BQ27XXX_RS,4,2                 ; @BQ27XXX_RS
	.no_dead_strip	_bq27xxx_battery_read_dcap
.subsections_via_symbols
