	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function berlin2_adc_read_raw
_berlin2_adc_read_raw:                  ## @berlin2_adc_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdx, %rbx
	cmpq	$129, %r8
	je	LBB0_5
## %bb.1:
	cmpq	$128, %r8
	jne	LBB0_8
## %bb.2:
	movl	(%rsi), %eax
	movq	_IIO_VOLTAGE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_8
## %bb.3:
	movl	4(%rsi), %esi
	callq	_berlin2_adc_read
                                        ## kill: def $eax killed $eax def $rax
	movl	%eax, (%rbx)
	testl	%eax, %eax
	jns	LBB0_4
	jmp	LBB0_9
LBB0_5:
	movl	(%rsi), %eax
	movq	_IIO_TEMP@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_8
## %bb.6:
	callq	_berlin2_adc_tsen_read
                                        ## kill: def $eax killed $eax def $rax
	testl	%eax, %eax
	js	LBB0_9
## %bb.7:
	leal	-4096(%rax), %ecx
	cmpl	$2048, %eax                     ## imm = 0x800
	cmovbl	%eax, %ecx
	imull	$100000, %ecx, %eax             ## imm = 0x186A0
	cltq
	imulq	$1041204193, %rax, %rax         ## imm = 0x3E0F83E1
	movq	%rax, %rcx
	sarq	$38, %rcx
	shrq	$63, %rax
	addl	%ecx, %eax
	addl	$-270000, %eax                  ## imm = 0xFFFBE150
	movl	%eax, (%rbx)
LBB0_4:
	movq	_IIO_VAL_INT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_9
LBB0_8:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_9:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IIO_VOLTAGE,4,2                ## @IIO_VOLTAGE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_IIO_VAL_INT,4,2                ## @IIO_VAL_INT
	.comm	_IIO_TEMP,4,2                   ## @IIO_TEMP
	.no_dead_strip	_berlin2_adc_read_raw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function berlin2_adc_read_raw
_berlin2_adc_read_raw:                  ; @berlin2_adc_read_raw
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x2
	cmp	x4, #129
	b.eq	LBB0_4
; %bb.1:
	cmp	x4, #128
	b.ne	LBB0_7
; %bb.2:
	ldr	w8, [x1]
Lloh0:
	adrp	x9, _IIO_VOLTAGE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _IIO_VOLTAGE@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_7
; %bb.3:
	ldr	w1, [x1, #4]
	bl	_berlin2_adc_read
	str	w0, [x19]
Lloh3:
	adrp	x8, _IIO_VAL_INT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _IIO_VAL_INT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w0, #0
	csel	w0, w0, w8, lt
	b	LBB0_8
LBB0_4:
	ldr	w8, [x1]
Lloh6:
	adrp	x9, _IIO_TEMP@GOTPAGE
Lloh7:
	ldr	x9, [x9, _IIO_TEMP@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_7
; %bb.5:
	bl	_berlin2_adc_tsen_read
	tbnz	w0, #31, LBB0_8
; %bb.6:
	sub	w8, w0, #1, lsl #12             ; =4096
	cmp	w0, #2047
	csel	w8, w8, w0, hi
	mov	w9, #34464
	movk	w9, #1, lsl #16
	mul	w8, w8, w9
	mov	w9, #33761
	movk	w9, #15887, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w8, w8, w9
	sub	w8, w8, #65, lsl #12            ; =266240
	sub	w8, w8, #3760
	str	w8, [x19]
Lloh9:
	adrp	x8, _IIO_VAL_INT@GOTPAGE
Lloh10:
	ldr	x8, [x8, _IIO_VAL_INT@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	b	LBB0_8
LBB0_7:
Lloh12:
	adrp	x8, _EINVAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_IIO_VOLTAGE,4,2                ; @IIO_VOLTAGE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_IIO_VAL_INT,4,2                ; @IIO_VAL_INT
	.comm	_IIO_TEMP,4,2                   ; @IIO_TEMP
	.no_dead_strip	_berlin2_adc_read_raw
.subsections_via_symbols
