	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bq27xxx_battery_current
_bq27xxx_battery_current:               ## @bq27xxx_battery_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r15
	movq	_BQ27XXX_REG_AI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_bq27xxx_read
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movq	_BQ27XXX_O_ZERO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r15)
	je	LBB0_6
## %bb.3:
	movq	_BQ27XXX_REG_FLAGS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	$1, %edx
	callq	_bq27xxx_read
	movq	_BQ27000_FLAG_CHGS@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_5
## %bb.4:
	movl	4(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_dbg
	negl	%ebx
LBB0_5:
	movq	_BQ27XXX_CURRENT_CONSTANT@GOTPCREL(%rip), %rax
	imull	(%rax), %ebx
	movq	_BQ27XXX_RS@GOTPCREL(%rip), %rcx
	movl	%ebx, %eax
	cltd
	idivl	(%rcx)
	jmp	LBB0_7
LBB0_1:
	movl	4(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_8
LBB0_6:
	imull	$1000, %ebx, %eax               ## imm = 0x3E8
LBB0_7:
	movl	%eax, (%r14)
	xorl	%ebx, %ebx
LBB0_8:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BQ27XXX_REG_AI,4,2             ## @BQ27XXX_REG_AI
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"error reading current\n"

	.comm	_BQ27XXX_O_ZERO,4,2             ## @BQ27XXX_O_ZERO
	.comm	_BQ27XXX_REG_FLAGS,4,2          ## @BQ27XXX_REG_FLAGS
	.comm	_BQ27000_FLAG_CHGS,4,2          ## @BQ27000_FLAG_CHGS
L_.str.1:                               ## @.str.1
	.asciz	"negative current!\n"

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

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bq27xxx_battery_current
_bq27xxx_battery_current:               ; @bq27xxx_battery_current
	.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, x1
	mov	x21, x0
Lloh0:
	adrp	x8, _BQ27XXX_REG_AI@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BQ27XXX_REG_AI@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_bq27xxx_read
	mov	x19, x0
	tbnz	w0, #31, LBB0_5
; %bb.1:
	ldr	w8, [x21]
Lloh3:
	adrp	x9, _BQ27XXX_O_ZERO@GOTPAGE
Lloh4:
	ldr	x9, [x9, _BQ27XXX_O_ZERO@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.2:
Lloh6:
	adrp	x8, _BQ27XXX_REG_FLAGS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _BQ27XXX_REG_FLAGS@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x21
	mov	w2, #1
	bl	_bq27xxx_read
Lloh9:
	adrp	x8, _BQ27000_FLAG_CHGS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _BQ27000_FLAG_CHGS@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_4
; %bb.3:
	ldr	w0, [x21, #4]
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	neg	w19, w19
LBB0_4:
Lloh14:
	adrp	x8, _BQ27XXX_CURRENT_CONSTANT@GOTPAGE
Lloh15:
	ldr	x8, [x8, _BQ27XXX_CURRENT_CONSTANT@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	mul	w8, w8, w19
Lloh17:
	adrp	x9, _BQ27XXX_RS@GOTPAGE
Lloh18:
	ldr	x9, [x9, _BQ27XXX_RS@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	sdiv	w8, w8, w9
	str	w8, [x20]
	mov	w19, #0
	b	LBB0_7
LBB0_5:
	ldr	w0, [x21, #4]
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_7
LBB0_6:
	mov	w8, #1000
	mul	w8, w19, w8
	mov	w19, #0
	str	w8, [x20]
LBB0_7:
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_BQ27XXX_REG_AI,4,2             ; @BQ27XXX_REG_AI
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"error reading current\n"

	.comm	_BQ27XXX_O_ZERO,4,2             ; @BQ27XXX_O_ZERO
	.comm	_BQ27XXX_REG_FLAGS,4,2          ; @BQ27XXX_REG_FLAGS
	.comm	_BQ27000_FLAG_CHGS,4,2          ; @BQ27000_FLAG_CHGS
l_.str.1:                               ; @.str.1
	.asciz	"negative current!\n"

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