	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bq27xxx_battery_cfgupdate_priv
_bq27xxx_battery_cfgupdate_priv:        ## @bq27xxx_battery_cfgupdate_priv
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r15
	testl	%esi, %esi
	jne	LBB0_1
## %bb.2:
	movq	_BQ27XXX_SOFT_RESET@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_BQ27XXX_SET_CFGUPDATE@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %edx
	movq	_BQ27XXX_REG_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%ecx, %ecx
	callq	_bq27xxx_write
	testl	%eax, %eax
	js	LBB0_13
## %bb.4:
	movl	$100, %ebx
	movq	_BQ27XXX_REG_FLAGS@GOTPCREL(%rip), %r12
	movq	_BQ27XXX_FLAG_CFGUP@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	$25, %edi
	callq	_BQ27XXX_MSLEEP
	movl	(%r12), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_bq27xxx_read
	testl	%eax, %eax
	js	LBB0_13
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	xorl	%ecx, %ecx
	testl	%eax, (%r13)
	setne	%cl
	cmpl	%r14d, %ecx
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	decl	%ebx
	jne	LBB0_5
	jmp	LBB0_9
LBB0_8:
	testl	%ebx, %ebx
	je	LBB0_9
## %bb.11:
	xorl	%eax, %eax
	cmpl	$96, %ebx
	jle	LBB0_12
	jmp	LBB0_13
LBB0_9:
	movq	(%r15), %rax
	movq	_BQ27425@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	cmpq	(%rcx), %rax
	jne	LBB0_10
LBB0_12:
	movl	$100, %ecx
	subl	%ebx, %ecx
	movl	8(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edx
	callq	_dev_warn
	xorl	%eax, %eax
	jmp	LBB0_13
LBB0_10:
	movl	8(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BQ27XXX_SET_CFGUPDATE,4,2      ## @BQ27XXX_SET_CFGUPDATE
	.comm	_BQ27XXX_SOFT_RESET,4,2         ## @BQ27XXX_SOFT_RESET
	.comm	_BQ27XXX_REG_CTRL,4,2           ## @BQ27XXX_REG_CTRL
	.comm	_BQ27XXX_REG_FLAGS,4,2          ## @BQ27XXX_REG_FLAGS
	.comm	_BQ27XXX_FLAG_CFGUP,4,2         ## @BQ27XXX_FLAG_CFGUP
	.comm	_BQ27425,8,3                    ## @BQ27425
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"timed out waiting for cfgupdate flag %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"cfgupdate %d, retries %d\n"

	.no_dead_strip	_bq27xxx_battery_cfgupdate_priv
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bq27xxx_battery_cfgupdate_priv
_bq27xxx_battery_cfgupdate_priv:        ; @bq27xxx_battery_cfgupdate_priv
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _BQ27XXX_SET_CFGUPDATE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BQ27XXX_SET_CFGUPDATE@GOTPAGEOFF]
Lloh2:
	adrp	x9, _BQ27XXX_SOFT_RESET@GOTPAGE
Lloh3:
	ldr	x9, [x9, _BQ27XXX_SOFT_RESET@GOTPAGEOFF]
	cmp	w1, #0
	csel	x8, x9, x8, eq
	ldr	w2, [x8]
Lloh4:
	adrp	x8, _BQ27XXX_REG_CTRL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _BQ27XXX_REG_CTRL@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	w3, #0
	bl	_bq27xxx_write
	tbnz	w0, #31, LBB0_12
; %bb.1:
	mov	w21, #100
Lloh7:
	adrp	x22, _BQ27XXX_REG_FLAGS@GOTPAGE
Lloh8:
	ldr	x22, [x22, _BQ27XXX_REG_FLAGS@GOTPAGEOFF]
Lloh9:
	adrp	x23, _BQ27XXX_FLAG_CFGUP@GOTPAGE
Lloh10:
	ldr	x23, [x23, _BQ27XXX_FLAG_CFGUP@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #25
	bl	_BQ27XXX_MSLEEP
	ldr	w1, [x22]
	mov	x0, x20
	mov	w2, #0
	bl	_bq27xxx_read
	tbnz	w0, #31, LBB0_12
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [x23]
	tst	w8, w0
	cset	w8, ne
	cmp	w8, w19
	b.eq	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	subs	w21, w21, #1
	b.ne	LBB0_2
	b	LBB0_7
LBB0_5:
	cbz	w21, LBB0_7
; %bb.6:
	cmp	w21, #96
	b.le	LBB0_9
	b	LBB0_10
LBB0_7:
	ldr	x8, [x20]
Lloh11:
	adrp	x9, _BQ27425@GOTPAGE
Lloh12:
	ldr	x9, [x9, _BQ27425@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_11
; %bb.8:
	mov	w21, #0
LBB0_9:
	mov	w8, #100
	sub	w3, w8, w21
	ldr	w0, [x20, #8]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x19
	bl	_dev_warn
LBB0_10:
	mov	w0, #0
	b	LBB0_12
LBB0_11:
	ldr	w0, [x20, #8]
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_dev_err
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_12:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_BQ27XXX_SET_CFGUPDATE,4,2      ; @BQ27XXX_SET_CFGUPDATE
	.comm	_BQ27XXX_SOFT_RESET,4,2         ; @BQ27XXX_SOFT_RESET
	.comm	_BQ27XXX_REG_CTRL,4,2           ; @BQ27XXX_REG_CTRL
	.comm	_BQ27XXX_REG_FLAGS,4,2          ; @BQ27XXX_REG_FLAGS
	.comm	_BQ27XXX_FLAG_CFGUP,4,2         ; @BQ27XXX_FLAG_CFGUP
	.comm	_BQ27425,8,3                    ; @BQ27425
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"timed out waiting for cfgupdate flag %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"cfgupdate %d, retries %d\n"

	.no_dead_strip	_bq27xxx_battery_cfgupdate_priv
.subsections_via_symbols
