	.file	"extr_ar9003_calib.c_ar9003_hw_calibrate.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	ar9003_hw_calibrate, @function
ar9003_hw_calibrate:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	mov	r14, rsi
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	mov	r12d, 1
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	r13, QWORD PTR 8[rdi]
	mov	ebx, ecx
	test	r13, r13
	je	.L2
	mov	rax, QWORD PTR 0[r13]
	cmp	rax, QWORD PTR CAL_RUNNING[rip]
	je	.L3
	cmp	rax, QWORD PTR CAL_WAITING[rip]
	je	.L3
.L2:
	test	ebx, ebx
	jne	.L20
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	mov	rcx, r13
	mov	rsi, r14
	mov	rdi, rbp
	call	ar9003_hw_per_calibration@PLT
	mov	r12d, eax
	test	eax, eax
	je	.L2
	mov	rsi, QWORD PTR 8[r13]
	mov	rax, QWORD PTR CAL_WAITING[rip]
	mov	QWORD PTR 8[rbp], rsi
	cmp	QWORD PTR [rsi], rax
	jne	.L2
	mov	rdi, rbp
	xor	r12d, r12d
	call	ath9k_hw_reset_calibration@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L20:
	mov	rsi, r14
	mov	rdi, rbp
	call	ath9k_hw_getnf@PLT
	test	rax, rax
	je	.L1
	mov	esi, DWORD PTR 0[rbp]
	mov	rdi, rbp
	call	ath9k_hw_loadnf@PLT
	test	eax, eax
	js	.L7
	xor	esi, esi
	mov	rdi, rbp
	call	ath9k_hw_start_nfcal@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L7:
	mov	r12d, eax
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	ar9003_hw_calibrate, .-ar9003_hw_calibrate
	.comm	CAL_WAITING,8,8
	.comm	CAL_RUNNING,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_ar9003_calib.c_ar9003_hw_calibrate.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ar9003_hw_calibrate, %function
ar9003_hw_calibrate:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	ldr	r8, [r0, #4]
	mov	r4, r0
	cmp	r8, #0
	mov	r7, r1
	mov	r5, r3
	beq	.L6
	ldr	r1, .L20
	ldr	r3, [r8]
	ldr	r1, [r1]
	cmp	r3, r1
	beq	.L3
	ldr	r1, .L20+4
	ldr	r1, [r1]
	cmp	r3, r1
	beq	.L3
.L6:
	mov	r6, #1
.L2:
	cmp	r5, #0
	bne	.L19
.L1:
	mov	r0, r6
	pop	{r4, r5, r6, r7, r8, pc}
.L3:
	mov	r3, r8
	mov	r1, r7
	mov	r0, r4
	bl	ar9003_hw_per_calibration
	subs	r6, r0, #0
	beq	.L2
	ldr	r1, [r8, #4]
	ldr	r3, .L20+4
	ldr	r2, [r1]
	ldr	r3, [r3]
	str	r1, [r4, #4]
	cmp	r2, r3
	bne	.L2
	mov	r0, r4
	bl	ath9k_hw_reset_calibration
	mov	r6, #0
	b	.L2
.L19:
	mov	r1, r7
	mov	r0, r4
	bl	ath9k_hw_getnf
	cmp	r0, #0
	beq	.L1
	mov	r0, r4
	ldr	r1, [r4]
	bl	ath9k_hw_loadnf
	cmp	r0, #0
	movlt	r6, r0
	blt	.L1
	mov	r0, r4
	mov	r1, #0
	bl	ath9k_hw_start_nfcal
	b	.L1
.L21:
	.align	2
.L20:
	.word	CAL_RUNNING
	.word	CAL_WAITING
	.size	ar9003_hw_calibrate, .-ar9003_hw_calibrate
	.comm	CAL_WAITING,4,4
	.comm	CAL_RUNNING,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
