	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function palmas_gpadc_read_raw
_palmas_gpadc_read_raw:                 ## @palmas_gpadc_read_raw
	.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
	movq	%r8, %r12
	movq	%rdx, %r14
	movq	%rsi, %rbx
	movq	%rdi, %r15
	callq	_iio_priv
	movl	(%rbx), %r13d
	movq	_PALMAS_ADC_CH_MAX@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %r13d
	jle	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_12
LBB0_2:
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%r12, %rax
	andq	$-2, %rax
	cmpq	$128, %rax
	jne	LBB0_13
## %bb.3:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movl	%r13d, %esi
	callq	_palmas_gpadc_read_prepare
	testl	%eax, %eax
	js	LBB0_4
## %bb.5:
	movq	%r14, %rdi
	movl	%r13d, %esi
	callq	_palmas_gpadc_start_conversion
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:
	cmpq	$129, %r12
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	jne	LBB0_8
## %bb.9:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %esi
	movl	%ebx, %edx
	callq	_palmas_gpadc_get_calibrated_code
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %ebx
	jmp	LBB0_10
LBB0_13:
	movq	%r15, %rdi
	callq	_mutex_unlock
	xorl	%ebx, %ebx
	jmp	LBB0_12
LBB0_4:
	movl	%eax, %ebx
	movq	%r14, %rdi
	jmp	LBB0_11
LBB0_6:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	%r14, %rdi
	jmp	LBB0_11
LBB0_8:
	movq	%r14, %rdi
LBB0_10:
	movl	%ebx, (%r12)
	movq	_IIO_VAL_INT@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_11:
	movl	%r13d, %esi
	callq	_palmas_gpadc_read_done
	movq	%r15, %rdi
	callq	_mutex_unlock
LBB0_12:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PALMAS_ADC_CH_MAX,4,2          ## @PALMAS_ADC_CH_MAX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ADC start conversion failed\n"

	.comm	_IIO_VAL_INT,4,2                ## @IIO_VAL_INT
	.no_dead_strip	_palmas_gpadc_read_raw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function palmas_gpadc_read_raw
_palmas_gpadc_read_raw:                 ; @palmas_gpadc_read_raw
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x24, x4
	mov	x22, x2
	mov	x21, x1
	mov	x19, x0
	bl	_iio_priv
	ldr	w21, [x21]
Lloh0:
	adrp	x8, _PALMAS_ADC_CH_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PALMAS_ADC_CH_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w21, w8
	b.le	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_12
LBB0_2:
	mov	x20, x0
	mov	x0, x19
	bl	_mutex_lock
	and	x8, x24, #0xfffffffffffffffe
	cmp	x8, #128
	b.ne	LBB0_8
; %bb.3:
	mov	x0, x20
	mov	x1, x21
	bl	_palmas_gpadc_read_prepare
	tbnz	w0, #31, LBB0_9
; %bb.4:
	mov	x0, x20
	mov	x1, x21
	bl	_palmas_gpadc_start_conversion
	mov	x23, x0
	tbnz	w0, #31, LBB0_10
; %bb.5:
	cmp	x24, #129
	b.ne	LBB0_7
; %bb.6:
	mov	x0, x20
	mov	x1, x21
	mov	x2, x23
	bl	_palmas_gpadc_get_calibrated_code
	mov	x23, x0
LBB0_7:
	str	w23, [x22]
Lloh6:
	adrp	x8, _IIO_VAL_INT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _IIO_VAL_INT@GOTPAGEOFF]
Lloh8:
	ldr	w23, [x8]
	b	LBB0_11
LBB0_8:
	mov	x0, x19
	bl	_mutex_unlock
	mov	w23, #0
	b	LBB0_12
LBB0_9:
	mov	x23, x0
	b	LBB0_11
LBB0_10:
	ldr	w0, [x20]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_11:
	mov	x0, x20
	mov	x1, x21
	bl	_palmas_gpadc_read_done
	mov	x0, x19
	bl	_mutex_unlock
LBB0_12:
	mov	x0, x23
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_PALMAS_ADC_CH_MAX,4,2          ; @PALMAS_ADC_CH_MAX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ADC start conversion failed\n"

	.comm	_IIO_VAL_INT,4,2                ; @IIO_VAL_INT
	.no_dead_strip	_palmas_gpadc_read_raw
.subsections_via_symbols
