	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vadc_do_conversion
_vadc_do_conversion:                    ## @vadc_do_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
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r13
	callq	_mutex_lock
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_vadc_configure
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_13
## %bb.1:
	cmpq	$0, 16(%r13)
	jne	LBB0_3
## %bb.2:
	leaq	8(%r13), %rdi
	callq	_reinit_completion
LBB0_3:
	movq	%r13, %rdi
	movl	$1, %esi
	callq	_vadc_set_state
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_13
## %bb.4:
	movq	_VADC_CONV_REQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_VADC_CONV_REQ_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_vadc_write
	movl	%eax, %r12d
	testl	%eax, %eax
	je	LBB0_5
LBB0_14:
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_vadc_set_state
	jmp	LBB0_12
LBB0_5:
	movl	(%r15), %edi
	callq	_BIT
	movq	_VADC_CONV_TIME_MIN_US@GOTPCREL(%rip), %rbx
	imull	(%rbx), %eax
	addl	%eax, %eax
	cmpq	$0, 16(%r13)
	je	LBB0_7
## %bb.6:
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_vadc_poll_wait_eoc
LBB0_10:
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_vadc_read_result
	movl	%eax, %r12d
LBB0_11:
	xorl	%ebx, %ebx
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_vadc_set_state
	testl	%r12d, %r12d
	je	LBB0_13
LBB0_12:
	movl	4(%r13), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movl	%r12d, %ebx
LBB0_13:
	movq	%r13, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	leaq	8(%r13), %rdi
	movl	%eax, %esi
	callq	_wait_for_completion_timeout
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:
	movl	(%rbx), %esi
	movq	%r13, %rdi
	callq	_vadc_poll_wait_eoc
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_14
	jmp	LBB0_10
LBB0_8:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_VADC_CONV_REQ,4,2              ## @VADC_CONV_REQ
	.comm	_VADC_CONV_REQ_SET,4,2          ## @VADC_CONV_REQ_SET
	.comm	_VADC_CONV_TIME_MIN_US,4,2      ## @VADC_CONV_TIME_MIN_US
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"conversion failed\n"

	.no_dead_strip	_vadc_do_conversion
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vadc_do_conversion
_vadc_do_conversion:                    ; @vadc_do_conversion
	.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, x2
	mov	x22, x1
	mov	x19, x0
	bl	_mutex_lock
	mov	x0, x19
	mov	x1, x22
	bl	_vadc_configure
	mov	x21, x0
	cbnz	w0, LBB0_11
; %bb.1:
	ldr	x8, [x19, #16]
	cbnz	x8, LBB0_3
; %bb.2:
	add	x0, x19, #8
	bl	_reinit_completion
LBB0_3:
	mov	x0, x19
	mov	w1, #1
	bl	_vadc_set_state
	mov	x21, x0
	cbnz	w0, LBB0_11
; %bb.4:
Lloh0:
	adrp	x8, _VADC_CONV_REQ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VADC_CONV_REQ@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _VADC_CONV_REQ_SET@GOTPAGE
Lloh4:
	ldr	x8, [x8, _VADC_CONV_REQ_SET@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_vadc_write
	mov	x21, x0
	cbz	w0, LBB0_6
LBB0_5:
	mov	x0, x19
	mov	w1, #0
	bl	_vadc_set_state
	b	LBB0_10
LBB0_6:
	ldr	w0, [x22]
	bl	_BIT
Lloh6:
	adrp	x21, _VADC_CONV_TIME_MIN_US@GOTPAGE
Lloh7:
	ldr	x21, [x21, _VADC_CONV_TIME_MIN_US@GOTPAGEOFF]
	ldr	w8, [x21]
	mul	w8, w0, w8
	lsl	w1, w8, #1
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_12
; %bb.7:
	mov	x0, x19
	bl	_vadc_poll_wait_eoc
LBB0_8:
	mov	x0, x19
	mov	x1, x20
	bl	_vadc_read_result
	mov	x21, x0
LBB0_9:
	mov	x0, x19
	mov	w1, #0
	bl	_vadc_set_state
	cbz	w21, LBB0_11
LBB0_10:
	ldr	w0, [x19, #4]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_11:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x21
	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
LBB0_12:
	add	x0, x19, #8
	bl	_wait_for_completion_timeout
	cbz	w0, LBB0_14
; %bb.13:
	ldr	w1, [x21]
	mov	x0, x19
	bl	_vadc_poll_wait_eoc
	mov	x21, x0
	cbnz	w0, LBB0_5
	b	LBB0_8
LBB0_14:
Lloh10:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_VADC_CONV_REQ,4,2              ; @VADC_CONV_REQ
	.comm	_VADC_CONV_REQ_SET,4,2          ; @VADC_CONV_REQ_SET
	.comm	_VADC_CONV_TIME_MIN_US,4,2      ; @VADC_CONV_TIME_MIN_US
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"conversion failed\n"

	.no_dead_strip	_vadc_do_conversion
.subsections_via_symbols
