	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar9002_hw_calibrate
_ar9002_hw_calibrate:                   ## @ar9002_hw_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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r15d
	movl	%edx, %ebx
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r14
	movq	8(%rdi), %r12
	movq	_AR_PHY_AGC_CONTROL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_REG_READ
	movl	%eax, %r13d
	movq	_AR_PHY_AGC_CONTROL_NF@GOTPCREL(%rip), %rax
	andl	(%rax), %r13d
	movq	16(%r14), %rsi
	testq	%rsi, %rsi
	je	LBB0_1
## %bb.2:
	movq	_NFCAL_PENDING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_test_bit
	testq	%r12, %r12
	je	LBB0_4
LBB0_9:
	movl	%ebx, %edx
	movq	(%r12), %rcx
	movq	_CAL_RUNNING@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rcx
	setne	%bl
	movq	_CAL_WAITING@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rcx
	setne	%cl
	andb	%bl, %cl
	movl	%ecx, %ebx
	jne	LBB0_5
## %bb.10:
	testl	%r13d, %r13d
	jne	LBB0_5
## %bb.11:
	movq	%rsi, %rbx
	movq	%r14, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	%r12, %rcx
	callq	_ar9002_hw_per_calibration
	xorl	%r15d, %r15d
	testl	%eax, %eax
	je	LBB0_17
## %bb.12:
	movq	8(%r12), %rsi
	movq	%rsi, 8(%r14)
	movq	(%rsi), %rax
	cmpq	(%rbx), %rax
	jne	LBB0_17
## %bb.13:
	movq	%r14, %rdi
	callq	_ath9k_hw_reset_calibration
	jmp	LBB0_17
LBB0_1:
	xorl	%eax, %eax
	testq	%r12, %r12
	jne	LBB0_9
LBB0_4:
	movb	$1, %bl
LBB0_5:
	orl	%r15d, %eax
	je	LBB0_16
## %bb.6:
	movl	%r15d, %r12d
	movq	%r14, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_ath9k_hw_getnf
	testq	%rax, %rax
	je	LBB0_14
## %bb.7:
	movl	(%r14), %esi
	movq	%r14, %rdi
	callq	_ath9k_hw_loadnf
	testl	%eax, %eax
	js	LBB0_8
LBB0_14:
	testl	%r12d, %r12d
	je	LBB0_16
## %bb.15:
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_ath9k_hw_start_nfcal
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_ar9002_hw_pa_cal
	movq	%r14, %rdi
	callq	_ar9002_hw_olc_temp_compensation
LBB0_16:
	movzbl	%bl, %r15d
LBB0_17:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	%eax, %r15d
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_AR_PHY_AGC_CONTROL,4,2         ## @AR_PHY_AGC_CONTROL
	.comm	_AR_PHY_AGC_CONTROL_NF,4,2      ## @AR_PHY_AGC_CONTROL_NF
	.comm	_NFCAL_PENDING,4,2              ## @NFCAL_PENDING
	.comm	_CAL_RUNNING,8,3                ## @CAL_RUNNING
	.comm	_CAL_WAITING,8,3                ## @CAL_WAITING
	.no_dead_strip	_ar9002_hw_calibrate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ar9002_hw_calibrate
_ar9002_hw_calibrate:                   ; @ar9002_hw_calibrate
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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, x3
	mov	x24, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x23, [x0, #8]
Lloh0:
	adrp	x8, _AR_PHY_AGC_CONTROL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AR_PHY_AGC_CONTROL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_REG_READ
	mov	x25, x0
Lloh3:
	adrp	x8, _AR_PHY_AGC_CONTROL_NF@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AR_PHY_AGC_CONTROL_NF@GOTPAGEOFF]
Lloh5:
	ldr	w26, [x8]
	ldr	x1, [x19, #16]
	cbz	x1, LBB0_7
; %bb.1:
Lloh6:
	adrp	x8, _NFCAL_PENDING@GOTPAGE
Lloh7:
	ldr	x8, [x8, _NFCAL_PENDING@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_test_bit
	cbz	x23, LBB0_8
LBB0_2:
	ldr	x8, [x23]
Lloh9:
	adrp	x9, _CAL_RUNNING@GOTPAGE
Lloh10:
	ldr	x9, [x9, _CAL_RUNNING@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x8, x9
Lloh12:
	adrp	x27, _CAL_WAITING@GOTPAGE
Lloh13:
	ldr	x27, [x27, _CAL_WAITING@GOTPAGEOFF]
	ldr	x9, [x27]
	ccmp	x8, x9, #4, ne
	cset	w22, ne
	b.ne	LBB0_9
; %bb.3:
	and	w8, w26, w25
	cbnz	w8, LBB0_9
; %bb.4:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x24
	mov	x3, x23
	bl	_ar9002_hw_per_calibration
	cbz	w0, LBB0_14
; %bb.5:
	ldr	x1, [x23, #8]
	str	x1, [x19, #8]
	ldr	x8, [x1]
	ldr	x9, [x27]
	cmp	x8, x9
	b.ne	LBB0_14
; %bb.6:
	mov	x0, x19
	bl	_ath9k_hw_reset_calibration
	mov	w22, #0
	b	LBB0_16
LBB0_7:
	mov	w0, #0
	cbnz	x23, LBB0_2
LBB0_8:
	mov	w22, #1
LBB0_9:
	orr	w8, w20, w0
	cbz	w8, LBB0_16
; %bb.10:
	mov	x0, x19
	mov	x1, x21
	bl	_ath9k_hw_getnf
	cbz	x0, LBB0_12
; %bb.11:
	ldr	w1, [x19]
	mov	x0, x19
	bl	_ath9k_hw_loadnf
	tbnz	w0, #31, LBB0_15
LBB0_12:
	cbz	w20, LBB0_16
; %bb.13:
	mov	x0, x19
	mov	w1, #0
	bl	_ath9k_hw_start_nfcal
	mov	x0, x19
	mov	w1, #0
	bl	_ar9002_hw_pa_cal
	mov	x0, x19
	bl	_ar9002_hw_olc_temp_compensation
	b	LBB0_16
LBB0_14:
	mov	w22, #0
	b	LBB0_16
LBB0_15:
	mov	x22, x0
LBB0_16:
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_AR_PHY_AGC_CONTROL,4,2         ; @AR_PHY_AGC_CONTROL
	.comm	_AR_PHY_AGC_CONTROL_NF,4,2      ; @AR_PHY_AGC_CONTROL_NF
	.comm	_NFCAL_PENDING,4,2              ; @NFCAL_PENDING
	.comm	_CAL_RUNNING,8,3                ; @CAL_RUNNING
	.comm	_CAL_WAITING,8,3                ; @CAL_WAITING
	.no_dead_strip	_ar9002_hw_calibrate
.subsections_via_symbols
