	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function twl4030_madc_conversion
_twl4030_madc_conversion:               ## @twl4030_madc_conversion
	.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
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	movq	%rdi, %r14
	movq	_twl4030_madc@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.3:
	callq	_mutex_lock
	movq	(%r14), %r12
	movq	_TWL4030_MADC_RT@GOTPCREL(%rip), %r13
	cmpq	(%r13), %r12
	jb	LBB0_5
## %bb.4:
	movq	_TWL4030_MADC_SW2@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r12
	ja	LBB0_5
## %bb.7:
	movq	(%r15), %rax
	movq	8(%rax), %rax
	cmpl	$0, (%rax,%r12,4)
	je	LBB0_9
## %bb.8:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_23
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_6:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_22:
	movq	(%r15), %rdi
	callq	_mutex_unlock
LBB0_23:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	_twl4030_conversion_methods@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	movq	_TWL4030_MODULE_MADC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	16(%r14), %esi
	shlq	$4, %r12
	movl	12(%r15,%r12), %edx
	callq	_twl_i2c_write_u16
	testl	%eax, %eax
	je	LBB0_11
## %bb.10:
	movl	%eax, %ebx
	leaq	(%r15,%r12), %rax
	addq	$12, %rax
	movq	_twl4030_madc@GOTPCREL(%rip), %r15
	movq	(%r15), %rcx
	movl	16(%rcx), %edi
	movl	(%rax), %edx
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_22
LBB0_11:
	movq	_TWL4030_MODULE_MADC@GOTPCREL(%rip), %rax
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	cmpq	$0, 24(%r14)
	je	LBB0_14
## %bb.12:
	movl	(%rax), %edi
	movl	16(%r14), %esi
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax,%r12), %edx
	callq	_twl_i2c_write_u16
	testl	%eax, %eax
	je	LBB0_14
## %bb.13:
	movl	%eax, %ebx
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	addq	%r12, %rax
	addq	$8, %rax
	movq	_twl4030_madc@GOTPCREL(%rip), %r15
	movq	(%r15), %rcx
	movl	16(%rcx), %edi
	movl	(%rax), %edx
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_22
LBB0_14:
	movq	(%r14), %rsi
	cmpq	(%r13), %rsi
	jne	LBB0_16
## %bb.15:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	_twl4030_madc@GOTPCREL(%rip), %r15
	jmp	LBB0_22
LBB0_16:
	movq	_twl4030_madc@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	callq	_twl4030_madc_start_conversion
	testl	%eax, %eax
	js	LBB0_17
## %bb.18:
	movq	(%r15), %rdi
	movq	8(%rdi), %rax
	movq	(%r14), %rcx
	movl	$1, (%rax,%rcx,4)
	movq	%r15, %r13
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	movl	4(%r15,%r12), %edx
	movl	$5, %esi
	callq	_twl4030_madc_wait_conversion_ready
	movq	(%r13), %rdi
	testl	%eax, %eax
	je	LBB0_20
## %bb.19:
	movl	%eax, %ebx
	movq	8(%rdi), %rax
	jmp	LBB0_21
LBB0_17:
	movl	%eax, %ebx
	jmp	LBB0_22
LBB0_20:
	movl	(%r15,%r12), %esi
	movl	16(%r14), %edx
	movl	8(%r14), %r8d
	movl	12(%r14), %ecx
	callq	_twl4030_madc_read_channels
	movl	%eax, %ebx
	movq	(%r13), %rax
	movq	8(%rax), %rax
LBB0_21:
	movq	(%r14), %rcx
	movl	$0, (%rax,%rcx,4)
	movq	%r13, %r15
	jmp	LBB0_22
	.cfi_endproc
                                        ## -- End function
	.comm	_twl4030_madc,8,3               ## @twl4030_madc
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_TWL4030_MADC_RT,8,3            ## @TWL4030_MADC_RT
	.comm	_TWL4030_MADC_SW2,8,3           ## @TWL4030_MADC_SW2
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_twl4030_conversion_methods,8,3 ## @twl4030_conversion_methods
	.comm	_TWL4030_MODULE_MADC,4,2        ## @TWL4030_MODULE_MADC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to write sel register 0x%X\n"

L_.str.1:                               ## @.str.1
	.asciz	"unable to write avg register 0x%X\n"

	.no_dead_strip	_twl4030_madc_conversion
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function twl4030_madc_conversion
_twl4030_madc_conversion:               ; @twl4030_madc_conversion
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	cbz	x0, LBB0_4
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x21, _twl4030_madc@GOTPAGE
Lloh1:
	ldr	x21, [x21, _twl4030_madc@GOTPAGEOFF]
	ldr	x0, [x21]
	cbz	x0, LBB0_4
; %bb.2:
	bl	_mutex_lock
	ldr	x22, [x19]
Lloh2:
	adrp	x24, _TWL4030_MADC_RT@GOTPAGE
Lloh3:
	ldr	x24, [x24, _TWL4030_MADC_RT@GOTPAGEOFF]
	ldr	x8, [x24]
Lloh4:
	adrp	x9, _TWL4030_MADC_SW2@GOTPAGE
Lloh5:
	ldr	x9, [x9, _TWL4030_MADC_SW2@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
	cmp	x22, x8
	ccmp	x22, x9, #2, hs
	b.ls	LBB0_5
LBB0_3:
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_7
LBB0_4:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_9
LBB0_5:
	ldr	x8, [x21]
	ldr	x8, [x8, #8]
	ldr	w8, [x8, x22, lsl #2]
	cbz	w8, LBB0_10
; %bb.6:
Lloh12:
	adrp	x8, _EBUSY@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_8:
	ldr	x0, [x21]
	bl	_mutex_unlock
LBB0_9:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_10:
Lloh14:
	adrp	x8, _twl4030_conversion_methods@GOTPAGE
Lloh15:
	ldr	x8, [x8, _twl4030_conversion_methods@GOTPAGEOFF]
Lloh16:
	adrp	x25, _TWL4030_MODULE_MADC@GOTPAGE
Lloh17:
	ldr	x25, [x25, _TWL4030_MODULE_MADC@GOTPAGEOFF]
Lloh18:
	ldr	x23, [x8]
	ldr	w0, [x25]
	ldr	w1, [x19, #16]
	add	x26, x23, x22, lsl #4
	ldr	w2, [x26, #12]!
	bl	_twl_i2c_write_u16
	cbz	w0, LBB0_12
; %bb.11:
	mov	x20, x0
	ldr	x8, [x21]
	ldr	w0, [x8, #16]
	ldr	w2, [x26]
Lloh19:
	adrp	x1, l_.str@PAGE
Lloh20:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_8
LBB0_12:
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_15
; %bb.13:
	ldr	w0, [x25]
	ldr	w1, [x19, #16]
	add	x25, x23, x22, lsl #4
	ldr	w2, [x25, #8]!
	bl	_twl_i2c_write_u16
	cbz	w0, LBB0_15
; %bb.14:
	mov	x20, x0
	ldr	x8, [x21]
	ldr	w0, [x8, #16]
	ldr	w2, [x25]
Lloh21:
	adrp	x1, l_.str.1@PAGE
Lloh22:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	b	LBB0_8
LBB0_15:
	ldr	x1, [x19]
	ldr	x8, [x24]
	cmp	x1, x8
	b.eq	LBB0_3
; %bb.16:
	ldr	x0, [x21]
	bl	_twl4030_madc_start_conversion
	tbnz	w0, #31, LBB0_19
; %bb.17:
	ldr	x0, [x21]
	ldr	x8, [x0, #8]
	ldr	x9, [x19]
	mov	w10, #1
	str	w10, [x8, x9, lsl #2]
	add	x8, x23, x22, lsl #4
	ldr	w2, [x8, #4]
	mov	w1, #5
	bl	_twl4030_madc_wait_conversion_ready
	mov	x20, x0
	ldr	x0, [x21]
	cbz	w20, LBB0_20
; %bb.18:
	ldr	x8, [x0, #8]
	b	LBB0_21
LBB0_19:
	mov	x20, x0
	b	LBB0_8
LBB0_20:
	lsl	x8, x22, #4
	ldr	w1, [x23, x8]
	ldp	w3, w2, [x19, #12]
	ldr	w4, [x19, #8]
	bl	_twl4030_madc_read_channels
	mov	x20, x0
	ldr	x8, [x21]
	ldr	x8, [x8, #8]
LBB0_21:
	ldr	x9, [x19]
	str	wzr, [x8, x9, lsl #2]
	b	LBB0_8
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_twl4030_madc,8,3               ; @twl4030_madc
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_TWL4030_MADC_RT,8,3            ; @TWL4030_MADC_RT
	.comm	_TWL4030_MADC_SW2,8,3           ; @TWL4030_MADC_SW2
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_twl4030_conversion_methods,8,3 ; @twl4030_conversion_methods
	.comm	_TWL4030_MODULE_MADC,4,2        ; @TWL4030_MODULE_MADC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to write sel register 0x%X\n"

l_.str.1:                               ; @.str.1
	.asciz	"unable to write avg register 0x%X\n"

	.no_dead_strip	_twl4030_madc_conversion
.subsections_via_symbols
