	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function twl4030_madc_set_current_generator
_twl4030_madc_set_current_generator:    ## @twl4030_madc_set_current_generator
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movl	%esi, %r12d
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movq	_TWL_MODULE_MAIN_CHARGE@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	movq	_TWL4030_BCI_BCICTL1@GOTPCREL(%rip), %rax
	movq	%rax, %r13
	movl	(%rax), %edx
	leaq	-44(%rbp), %rsi
	callq	_twl_i2c_read_u8
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_10
LBB0_2:
	testl	%r12d, %r12d
	jne	LBB0_3
## %bb.4:
	movq	_TWL4030_BCI_TYPEN@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_3:
	movq	_TWL4030_BCI_ITHEN@GOTPCREL(%rip), %rax
LBB0_5:
	movl	(%rax), %esi
	testl	%r15d, %r15d
	je	LBB0_7
## %bb.6:
	orl	-44(%rbp), %esi
	jmp	LBB0_8
LBB0_7:
	notl	%esi
	andl	-44(%rbp), %esi
LBB0_8:
	movl	%esi, -44(%rbp)
	movl	(%r14), %edi
	movl	(%r13), %edx
	callq	_twl_i2c_write_u8
	testl	%eax, %eax
	je	LBB0_12
## %bb.9:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rsi
LBB0_10:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movl	(%r13), %edx
	callq	_dev_err
LBB0_11:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	xorl	%ebx, %ebx
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_TWL_MODULE_MAIN_CHARGE,4,2     ## @TWL_MODULE_MAIN_CHARGE
	.comm	_TWL4030_BCI_BCICTL1,4,2        ## @TWL4030_BCI_BCICTL1
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to read BCICTL1 reg 0x%X"

	.comm	_TWL4030_BCI_ITHEN,4,2          ## @TWL4030_BCI_ITHEN
	.comm	_TWL4030_BCI_TYPEN,4,2          ## @TWL4030_BCI_TYPEN
L_.str.1:                               ## @.str.1
	.asciz	"unable to write BCICTL1 reg 0x%X\n"

	.no_dead_strip	_twl4030_madc_set_current_generator
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function twl4030_madc_set_current_generator
_twl4030_madc_set_current_generator:    ; @twl4030_madc_set_current_generator
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x21, x2
	mov	x22, x1
	mov	x19, x0
Lloh0:
	adrp	x24, _TWL_MODULE_MAIN_CHARGE@GOTPAGE
Lloh1:
	ldr	x24, [x24, _TWL_MODULE_MAIN_CHARGE@GOTPAGEOFF]
	ldr	w0, [x24]
Lloh2:
	adrp	x23, _TWL4030_BCI_BCICTL1@GOTPAGE
Lloh3:
	ldr	x23, [x23, _TWL4030_BCI_BCICTL1@GOTPAGEOFF]
	ldr	w2, [x23]
	add	x1, sp, #12
	bl	_twl_i2c_read_u8
	cbz	w0, LBB0_2
; %bb.1:
	mov	x20, x0
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_7
LBB0_2:
Lloh6:
	adrp	x8, _TWL4030_BCI_ITHEN@GOTPAGE
Lloh7:
	ldr	x8, [x8, _TWL4030_BCI_ITHEN@GOTPAGEOFF]
Lloh8:
	adrp	x9, _TWL4030_BCI_TYPEN@GOTPAGE
Lloh9:
	ldr	x9, [x9, _TWL4030_BCI_TYPEN@GOTPAGEOFF]
	cmp	w22, #0
	csel	x8, x9, x8, eq
	ldr	w8, [x8]
	cbz	w21, LBB0_4
; %bb.3:
	ldr	w9, [sp, #12]
	orr	w1, w9, w8
	b	LBB0_5
LBB0_4:
	ldr	w9, [sp, #12]
	bic	w1, w9, w8
LBB0_5:
	str	w1, [sp, #12]
	ldr	w0, [x24]
	ldr	w2, [x23]
	bl	_twl_i2c_write_u8
	mov	x20, x0
	cbz	w0, LBB0_8
; %bb.6:
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_7:
	ldr	w0, [x19]
	ldr	w2, [x23]
	bl	_dev_err
LBB0_8:
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_TWL_MODULE_MAIN_CHARGE,4,2     ; @TWL_MODULE_MAIN_CHARGE
	.comm	_TWL4030_BCI_BCICTL1,4,2        ; @TWL4030_BCI_BCICTL1
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to read BCICTL1 reg 0x%X"

	.comm	_TWL4030_BCI_ITHEN,4,2          ; @TWL4030_BCI_ITHEN
	.comm	_TWL4030_BCI_TYPEN,4,2          ; @TWL4030_BCI_TYPEN
l_.str.1:                               ; @.str.1
	.asciz	"unable to write BCICTL1 reg 0x%X\n"

	.no_dead_strip	_twl4030_madc_set_current_generator
.subsections_via_symbols
