	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar9003_hw_calibrate
_ar9003_hw_calibrate:                   ## @ar9003_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, %r12d
	movq	%rsi, %r15
	movq	%rdi, %r13
	movq	8(%rdi), %rbx
	movl	$1, %r14d
	testq	%rbx, %rbx
	je	LBB0_6
## %bb.1:
	movq	(%rbx), %rax
	movq	_CAL_RUNNING@GOTPCREL(%rip), %rcx
	movq	_CAL_WAITING@GOTPCREL(%rip), %rsi
	cmpq	(%rcx), %rax
	je	LBB0_3
## %bb.2:
	cmpq	(%rsi), %rax
	jne	LBB0_6
LBB0_3:
	movq	%r13, %rdi
	movq	%r15, %rsi
	movq	%rbx, %rcx
	callq	_ar9003_hw_per_calibration
	xorl	%r14d, %r14d
	testl	%eax, %eax
	je	LBB0_6
## %bb.4:
	movq	8(%rbx), %rsi
	movq	%rsi, 8(%r13)
	movq	(%rsi), %rcx
	movl	%eax, %r14d
	movq	_CAL_WAITING@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rcx
	jne	LBB0_6
## %bb.5:
	movq	%r13, %rdi
	callq	_ath9k_hw_reset_calibration
	xorl	%r14d, %r14d
LBB0_6:
	testl	%r12d, %r12d
	je	LBB0_11
## %bb.7:
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_ath9k_hw_getnf
	testq	%rax, %rax
	je	LBB0_11
## %bb.8:
	movl	(%r13), %esi
	movq	%r13, %rdi
	callq	_ath9k_hw_loadnf
	testl	%eax, %eax
	js	LBB0_9
## %bb.10:
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_ath9k_hw_start_nfcal
	jmp	LBB0_11
LBB0_9:
	movl	%eax, %r14d
LBB0_11:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CAL_RUNNING,8,3                ## @CAL_RUNNING
	.comm	_CAL_WAITING,8,3                ## @CAL_WAITING
	.no_dead_strip	_ar9003_hw_calibrate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ar9003_hw_calibrate
_ar9003_hw_calibrate:                   ; @ar9003_hw_calibrate
	.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	x21, x3
	mov	x20, x1
	mov	x19, x0
	ldr	x23, [x0, #8]
	cbz	x23, LBB0_5
; %bb.1:
	ldr	x8, [x23]
Lloh0:
	adrp	x9, _CAL_RUNNING@GOTPAGE
Lloh1:
	ldr	x9, [x9, _CAL_RUNNING@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
Lloh3:
	adrp	x24, _CAL_WAITING@GOTPAGE
Lloh4:
	ldr	x24, [x24, _CAL_WAITING@GOTPAGEOFF]
	ldr	x10, [x24]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_7
; %bb.2:
	mov	x0, x19
	mov	x1, x20
	mov	x3, x23
	bl	_ar9003_hw_per_calibration
	mov	x22, x0
	cbz	w0, LBB0_6
; %bb.3:
	ldr	x1, [x23, #8]
	str	x1, [x19, #8]
	ldr	x8, [x1]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_6
; %bb.4:
	mov	x0, x19
	bl	_ath9k_hw_reset_calibration
	mov	w22, #0
	cbnz	w21, LBB0_8
	b	LBB0_12
LBB0_5:
	mov	w22, #1
LBB0_6:
	cbnz	w21, LBB0_8
	b	LBB0_12
LBB0_7:
	mov	w22, #1
	cbz	w21, LBB0_12
LBB0_8:
	mov	x0, x19
	mov	x1, x20
	bl	_ath9k_hw_getnf
	cbz	x0, LBB0_12
; %bb.9:
	ldr	w1, [x19]
	mov	x0, x19
	bl	_ath9k_hw_loadnf
	tbnz	w0, #31, LBB0_11
; %bb.10:
	mov	x0, x19
	mov	w1, #0
	bl	_ath9k_hw_start_nfcal
	b	LBB0_12
LBB0_11:
	mov	x22, x0
LBB0_12:
	mov	x0, x22
	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 AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_CAL_RUNNING,8,3                ; @CAL_RUNNING
	.comm	_CAL_WAITING,8,3                ; @CAL_WAITING
	.no_dead_strip	_ar9003_hw_calibrate
.subsections_via_symbols
