	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ad_sd_calibrate
_ad_sd_calibrate:                       ## @ad_sd_calibrate
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %r14
	movl	%edx, %esi
	callq	_ad_sigma_delta_set_channel
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_6
## %bb.1:
	movq	16(%r14), %rax
	movl	(%rax), %edi
	callq	_spi_bus_lock
	movabsq	$4294967297, %rax               ## imm = 0x100000001
	movq	%rax, (%r14)
	leaq	24(%r14), %r12
	movq	%r12, %rdi
	callq	_reinit_completion
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_ad_sigma_delta_set_mode
	testl	%eax, %eax
	js	LBB0_2
## %bb.3:
	movl	$0, 8(%r14)
	movq	16(%r14), %rax
	movl	4(%rax), %edi
	callq	_enable_irq
	movq	_HZ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	addl	%esi, %esi
	movq	%r12, %rdi
	callq	_wait_for_completion_timeout
	xorl	%ebx, %ebx
	testq	%rax, %rax
	jne	LBB0_5
## %bb.4:
	movl	$1, 8(%r14)
	movq	16(%r14), %rax
	movl	4(%rax), %edi
	callq	_disable_irq_nosync
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_5
LBB0_2:
	movl	%eax, %ebx
LBB0_5:
	movl	$0, 4(%r14)
	movq	_AD_SD_MODE_IDLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_ad_sigma_delta_set_mode
	movl	$0, (%r14)
	movq	16(%r14), %rax
	movl	(%rax), %edi
	callq	_spi_bus_unlock
LBB0_6:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HZ,4,2                         ## @HZ
	.comm	_EIO,4,2                        ## @EIO
	.comm	_AD_SD_MODE_IDLE,4,2            ## @AD_SD_MODE_IDLE
	.no_dead_strip	_ad_sd_calibrate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ad_sd_calibrate
_ad_sd_calibrate:                       ; @ad_sd_calibrate
	.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	x21, x1
	mov	x19, x0
	mov	x1, x2
	bl	_ad_sigma_delta_set_channel
	mov	x20, x0
	cbnz	w0, LBB0_6
; %bb.1:
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
	bl	_spi_bus_lock
	movi.2s	v0, #1
	str	d0, [x19]
	add	x22, x19, #24
	mov	x0, x22
	bl	_reinit_completion
	mov	x0, x19
	mov	x1, x21
	bl	_ad_sigma_delta_set_mode
	tbnz	w0, #31, LBB0_4
; %bb.2:
	str	wzr, [x19, #8]
	ldr	x8, [x19, #16]
	ldr	w0, [x8, #4]
	bl	_enable_irq
Lloh0:
	adrp	x8, _HZ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HZ@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	lsl	w1, w8, #1
	mov	x0, x22
	bl	_wait_for_completion_timeout
	mov	w20, #0
	cbnz	x0, LBB0_5
; %bb.3:
	mov	w8, #1
	str	w8, [x19, #8]
	ldr	x8, [x19, #16]
	ldr	w0, [x8, #4]
	bl	_disable_irq_nosync
Lloh3:
	adrp	x8, _EIO@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_5
LBB0_4:
	mov	x20, x0
LBB0_5:
	str	wzr, [x19, #4]
Lloh6:
	adrp	x8, _AD_SD_MODE_IDLE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _AD_SD_MODE_IDLE@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ad_sigma_delta_set_mode
	str	wzr, [x19]
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
	bl	_spi_bus_unlock
LBB0_6:
	mov	x0, x20
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_HZ,4,2                         ; @HZ
	.comm	_EIO,4,2                        ; @EIO
	.comm	_AD_SD_MODE_IDLE,4,2            ; @AD_SD_MODE_IDLE
	.no_dead_strip	_ad_sd_calibrate
.subsections_via_symbols
