	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bq2415x_detect_revision
_bq2415x_detect_revision:               ## @bq2415x_detect_revision
	.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
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movq	_BQ2415X_REVISION@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_bq2415x_exec_command
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_bq2415x_detect_chip
	movl	%eax, %ecx
	movl	$-1, %eax
	testl	%r14d, %r14d
	js	LBB0_8
## %bb.1:
	testl	%ecx, %ecx
	js	LBB0_8
## %bb.2:
	addl	$-129, %ecx
	cmpl	$11, %ecx
	ja	LBB0_8
## %bb.3:
	movl	$111, %eax
	btl	%ecx, %eax
	jae	LBB0_4
## %bb.6:
	xorl	%eax, %eax
	cmpl	$1, %r14d
	sete	%al
	leal	(%rax,%rax), %ecx
	decl	%ecx
	xorl	%eax, %eax
	cmpl	$3, %r14d
	cmovnel	%ecx, %eax
	jmp	LBB0_8
LBB0_4:
	movl	$3968, %eax                     ## imm = 0xF80
	btl	%ecx, %eax
	jae	LBB0_7
## %bb.5:
	cmpl	$4, %r14d
	movl	$-1, %eax
	cmovbl	%r14d, %eax
LBB0_8:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_7:
	xorl	%eax, %eax
	cmpl	$3, %r14d
	sete	%al
	leal	-1(,%rax,4), %eax
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_BQ2415X_REVISION,4,2           ## @BQ2415X_REVISION
	.no_dead_strip	_bq2415x_detect_revision
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bq2415x_detect_revision
_bq2415x_detect_revision:               ; @bq2415x_detect_revision
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x20, x0
Lloh0:
	adrp	x8, _BQ2415X_REVISION@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BQ2415X_REVISION@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_bq2415x_exec_command
	mov	x19, x0
	mov	x0, x20
	bl	_bq2415x_detect_chip
	mov	x8, x0
	mov	w0, #-1
	tbnz	w19, #31, LBB0_7
; %bb.1:
	tbnz	w8, #31, LBB0_7
; %bb.2:
	sub	w8, w8, #129
	cmp	w8, #11
	b.hi	LBB0_8
; %bb.3:
	mov	w9, #1
	lsl	w8, w9, w8
	mov	w9, #111
	tst	w8, w9
	b.eq	LBB0_5
; %bb.4:
	cmp	w19, #1
	csinv	w8, w19, wzr, eq
	cmp	w19, #3
	csel	w0, wzr, w8, eq
	b	LBB0_7
LBB0_5:
	tst	w8, #0xf80
	b.eq	LBB0_9
; %bb.6:
	cmp	w19, #4
	csinv	w0, w19, wzr, lo
LBB0_7:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_8:
	mov	w0, #-1
	b	LBB0_7
LBB0_9:
	cmp	w19, #3
	csinv	w0, w19, wzr, eq
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_BQ2415X_REVISION,4,2           ; @BQ2415X_REVISION
	.no_dead_strip	_bq2415x_detect_revision
.subsections_via_symbols
