	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mid_initialize_adc
_mid_initialize_adc:                    ## @mid_initialize_adc
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_INTEL_MSIC_ADC1CNTL3@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	leaq	-36(%rbp), %rsi
	callq	_intel_msic_reg_read
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_11
## %bb.1:
	movq	_MSIC_ADCTHERM_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	notl	%esi
	andl	-36(%rbp), %esi
	movl	%esi, -36(%rbp)
	movl	(%r15), %edi
	callq	_intel_msic_reg_write
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_2
LBB0_11:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	xorl	%eax, %eax
	callq	_find_free_channel
	movq	_channel_index@GOTPCREL(%rip), %r12
	movq	%rax, (%r12)
	testq	%rax, %rax
	js	LBB0_3
## %bb.4:
	movq	_ADC_CHNL_START_ADDR@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r15
	addq	%rax, %r15
	testq	%rax, %rax
	je	LBB0_8
## %bb.5:
	movq	_ADC_LOOP_MAX@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_8
## %bb.6:
	movq	%r15, %rdi
	callq	_reset_stopbit
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_11
## %bb.7:
	incq	%r15
	incq	(%r12)
LBB0_8:
	movq	%r15, %rdi
	callq	_set_up_therm_channel
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_err
	jmp	LBB0_11
LBB0_3:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_err
	movl	(%r12), %ebx
	jmp	LBB0_11
LBB0_10:
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_dbg
	xorl	%ebx, %ebx
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_INTEL_MSIC_ADC1CNTL3,4,2       ## @INTEL_MSIC_ADC1CNTL3
	.comm	_MSIC_ADCTHERM_MASK,4,2         ## @MSIC_ADCTHERM_MASK
	.comm	_channel_index,8,3              ## @channel_index
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No free ADC channels"

	.comm	_ADC_CHNL_START_ADDR,8,3        ## @ADC_CHNL_START_ADDR
	.comm	_ADC_LOOP_MAX,8,3               ## @ADC_LOOP_MAX
L_.str.1:                               ## @.str.1
	.asciz	"unable to enable ADC"

L_.str.2:                               ## @.str.2
	.asciz	"ADC initialization successful"

	.no_dead_strip	_mid_initialize_adc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mid_initialize_adc
_mid_initialize_adc:                    ; @mid_initialize_adc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
Lloh0:
	adrp	x21, _INTEL_MSIC_ADC1CNTL3@GOTPAGE
Lloh1:
	ldr	x21, [x21, _INTEL_MSIC_ADC1CNTL3@GOTPAGEOFF]
	ldr	w0, [x21]
	add	x1, sp, #12
	bl	_intel_msic_reg_read
	mov	x20, x0
	cbnz	w0, LBB0_2
; %bb.1:
Lloh2:
	adrp	x8, _MSIC_ADCTHERM_MASK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MSIC_ADCTHERM_MASK@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	ldr	w9, [sp, #12]
	bic	w1, w9, w8
	str	w1, [sp, #12]
	ldr	w0, [x21]
	bl	_intel_msic_reg_write
	mov	x20, x0
	cbz	w0, LBB0_3
LBB0_2:
	mov	x0, x20
	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
	add	sp, sp, #64
	ret
LBB0_3:
	bl	_find_free_channel
Lloh5:
	adrp	x22, _channel_index@GOTPAGE
Lloh6:
	ldr	x22, [x22, _channel_index@GOTPAGEOFF]
	str	x0, [x22]
	tbnz	x0, #63, LBB0_10
; %bb.4:
Lloh7:
	adrp	x8, _ADC_CHNL_START_ADDR@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ADC_CHNL_START_ADDR@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	add	x21, x8, x0
	cbz	x0, LBB0_8
; %bb.5:
Lloh10:
	adrp	x8, _ADC_LOOP_MAX@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ADC_LOOP_MAX@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	cmp	x0, x8
	b.eq	LBB0_8
; %bb.6:
	mov	x0, x21
	bl	_reset_stopbit
	mov	x20, x0
	cbnz	w0, LBB0_2
; %bb.7:
	add	x21, x21, #1
	ldr	x8, [x22]
	add	x8, x8, #1
	str	x8, [x22]
LBB0_8:
	mov	x0, x21
	bl	_set_up_therm_channel
	mov	x20, x0
	cbz	w0, LBB0_11
; %bb.9:
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	b	LBB0_2
LBB0_10:
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	ldr	w20, [x22]
	b	LBB0_2
LBB0_11:
Lloh17:
	adrp	x1, l_.str.2@PAGE
Lloh18:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dev_dbg
	b	LBB0_2
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_INTEL_MSIC_ADC1CNTL3,4,2       ; @INTEL_MSIC_ADC1CNTL3
	.comm	_MSIC_ADCTHERM_MASK,4,2         ; @MSIC_ADCTHERM_MASK
	.comm	_channel_index,8,3              ; @channel_index
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No free ADC channels"

	.comm	_ADC_CHNL_START_ADDR,8,3        ; @ADC_CHNL_START_ADDR
	.comm	_ADC_LOOP_MAX,8,3               ; @ADC_LOOP_MAX
l_.str.1:                               ; @.str.1
	.asciz	"unable to enable ADC"

l_.str.2:                               ; @.str.2
	.asciz	"ADC initialization successful"

	.no_dead_strip	_mid_initialize_adc
.subsections_via_symbols
