	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wf_ad7417_adc_get
_wf_ad7417_adc_get:                     ## @wf_ad7417_adc_get
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	8(%rdi), %rbx
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r14
	subq	16(%rbx), %r14
	shrq	$4, %r14
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movl	$0, (%rsi)
	leaq	4(%rbx), %rdi
	movq	%rdi, -88(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movq	%r14, -80(%rbp)                 ## 8-byte Spill
	movl	%r14d, %r12d
	shll	$5, %r12d
	xorl	%r13d, %r13d
	leaq	-56(%rbp), %r14
	leaq	L_.str.1(%rip), %r15
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_1 Depth=1
	incl	%r13d
	cmpl	$10, %r13d
	je	LBB0_8
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	$1, -56(%rbp)
	movl	(%rbx), %eax
	andl	$31, %eax
	orl	%r12d, %eax
	movl	%eax, -52(%rbp)
	movq	8(%rbx), %rdi
	movq	%r14, %rsi
	movl	$2, %edx
	callq	_i2c_master_send
	testl	%eax, %eax
	js	LBB0_5
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$1, %edi
	callq	_msleep
	movl	$4, -56(%rbp)
	movq	8(%rbx), %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	_i2c_master_send
	testl	%eax, %eax
	js	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	8(%rbx), %rdi
	movq	%r14, %rsi
	movl	$2, %edx
	callq	_i2c_master_recv
	testl	%eax, %eax
	jns	LBB0_4
LBB0_5:                                 ##   in Loop: Header=BB0_1 Depth=1
	movq	8(%rbx), %rdi
	movq	%r15, %rsi
	movl	%r13d, %edx
	callq	_dev_dbg
	cmpl	$8, %r13d
	ja	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$10, %edi
	callq	_msleep
	jmp	LBB0_7
LBB0_8:
	movl	$-1, %ebx
	jmp	LBB0_9
LBB0_4:
	leaq	-56(%rbp), %rdi
	callq	_be16_to_cpup
	movl	%eax, %r14d
	sarl	$6, %r14d
	movq	%rbx, %rdi
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	movl	%r15d, %esi
	movl	%r14d, %edx
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rcx
	callq	_wf_ad7417_adc_convert
	movq	8(%rbx), %rdi
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %ecx
	movl	(%r12), %r9d
	leaq	L_.str(%rip), %rsi
	movl	%r15d, %edx
	movl	%r14d, %r8d
	callq	_dev_vdbg
	xorl	%ebx, %ebx
LBB0_9:
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_11
## %bb.10:
	movl	%ebx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ADC chan %d [%s] raw value: 0x%x, conv to: 0x%08x\n"

L_.str.1:                               ## @.str.1
	.asciz	"Error reading ADC, try %d...\n"

	.no_dead_strip	_wf_ad7417_adc_get
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wf_ad7417_adc_get
_wf_ad7417_adc_get:                     ; @wf_ad7417_adc_get
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #8]
	ldr	x23, [x0, #8]
	ldr	x8, [x23, #16]
	sub	x8, x0, x8
	lsr	x22, x8, #4
	str	wzr, [x1]
	add	x19, x23, #4
	mov	x0, x19
	bl	_mutex_lock
	mov	w24, #0
	lsl	w26, w22, #5
	mov	w27, #1
	mov	w28, #4
Lloh3:
	adrp	x25, l_.str.1@PAGE
Lloh4:
	add	x25, x25, l_.str.1@PAGEOFF
	b	LBB0_2
LBB0_1:                                 ;   in Loop: Header=BB0_2 Depth=1
	add	w24, w24, #1
	cmp	w24, #10
	b.eq	LBB0_7
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	str	w27, [sp]
	ldr	w8, [x23]
	and	w8, w8, #0x1f
	orr	w8, w8, w26
	str	w8, [sp, #4]
	ldr	x0, [x23, #8]
	mov	x1, sp
	mov	w2, #2
	bl	_i2c_master_send
	tbnz	w0, #31, LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w0, #1
	bl	_msleep
	str	w28, [sp]
	ldr	x0, [x23, #8]
	mov	x1, sp
	mov	w2, #1
	bl	_i2c_master_send
	tbnz	w0, #31, LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x23, #8]
	mov	x1, sp
	mov	w2, #2
	bl	_i2c_master_recv
	tbz	w0, #31, LBB0_8
LBB0_5:                                 ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x23, #8]
	mov	x1, x25
	mov	x2, x24
	bl	_dev_dbg
	cmp	w24, #8
	b.hi	LBB0_1
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w0, #10
	bl	_msleep
	b	LBB0_1
LBB0_7:
	mov	w20, #-1
	b	LBB0_9
LBB0_8:
	mov	x0, sp
	bl	_be16_to_cpup
	asr	w24, w0, #6
	mov	x0, x23
	mov	x1, x22
	mov	x2, x24
	mov	x3, x20
	bl	_wf_ad7417_adc_convert
	ldr	x0, [x23, #8]
	ldr	w3, [x21]
	ldr	w5, [x20]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
	mov	x4, x24
	bl	_dev_vdbg
	mov	w20, #0
LBB0_9:
	mov	x0, x19
	bl	_mutex_unlock
	ldr	x8, [sp, #8]
Lloh7:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh8:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_11
; %bb.10:
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_11:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ADC chan %d [%s] raw value: 0x%x, conv to: 0x%08x\n"

l_.str.1:                               ; @.str.1
	.asciz	"Error reading ADC, try %d...\n"

	.no_dead_strip	_wf_ad7417_adc_get
.subsections_via_symbols
