	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ath5k_hw_gainf_calibrate       ## -- Begin function ath5k_hw_gainf_calibrate
	.p2align	4, 0x90
_ath5k_hw_gainf_calibrate:              ## @ath5k_hw_gainf_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	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	cmpq	$0, 32(%rdi)
	je	LBB0_1
## %bb.2:
	movq	%rdi, %rbx
	movq	8(%rdi), %rax
	movq	_AR5K_RFGAIN_INACTIVE@GOTPCREL(%rip), %r14
	cmpq	(%r14), %rax
	je	LBB0_18
## %bb.3:
	leaq	8(%rbx), %r14
	movq	_AR5K_RFGAIN_READ_REQUESTED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_18
## %bb.4:
	movq	_AR5K_PHY_PAPD_PROBE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_ath5k_hw_reg_read
	movq	_AR5K_PHY_PAPD_PROBE_TX_NEXT@GOTPCREL(%rip), %rcx
	testq	%rax, (%rcx)
	jne	LBB0_18
## %bb.5:
	movq	_AR5K_PHY_PAPD_PROBE_GAINF_S@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movq	%rax, %rdx
	sarq	%cl, %rdx
	movq	%rdx, 24(%rbx)
	movq	_AR5K_PHY_PAPD_PROBE_TYPE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	%rax, %rdi
	callq	_AR5K_REG_MS
	movq	_AR5K_PHY_PAPD_PROBE_TYPE_CCK@GOTPCREL(%rip), %rsi
	movq	(%rbx), %rcx
	movq	_AR5K_SREV_RAD_5112A@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	cmpq	(%rsi), %rax
	jne	LBB0_10
## %bb.6:
	cmpq	%rdx, %rcx
	jge	LBB0_7
## %bb.8:
	movq	_AR5K_GAIN_CCK_PROBE_CORR@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_1:
	movq	_AR5K_RFGAIN_INACTIVE@GOTPCREL(%rip), %r14
LBB0_18:
	movl	(%r14), %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_7:
	leaq	40(%rbx), %rax
LBB0_9:
	movq	(%rax), %rax
	addq	%rax, 24(%rbx)
LBB0_10:
	cmpq	%rdx, %rcx
	jl	LBB0_12
## %bb.11:
	movq	%rbx, %rdi
	callq	_ath5k_hw_rf_gainf_corr
	movq	24(%rbx), %rax
	xorl	%ecx, %ecx
	subq	16(%rbx), %rax
	cmovgeq	%rax, %rcx
	movq	%rcx, 24(%rbx)
LBB0_12:
	movq	%rbx, %rdi
	callq	_ath5k_hw_rf_check_gainf_readback
	testq	%rax, %rax
	je	LBB0_16
## %bb.13:
	movq	%r14, %rdi
	callq	_AR5K_GAIN_CHECK_ADJUST
	testq	%rax, %rax
	je	LBB0_16
## %bb.14:
	movq	%rbx, %rdi
	callq	_ath5k_hw_rf_gainf_adjust
	testq	%rax, %rax
	je	LBB0_16
## %bb.15:
	movq	_AR5K_RFGAIN_NEED_CHANGE@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_16:
	movq	_AR5K_RFGAIN_ACTIVE@GOTPCREL(%rip), %rax
LBB0_17:
	movq	(%rax), %rax
	movq	%rax, (%r14)
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_AR5K_RFGAIN_INACTIVE,8,3       ## @AR5K_RFGAIN_INACTIVE
	.comm	_AR5K_RFGAIN_READ_REQUESTED,8,3 ## @AR5K_RFGAIN_READ_REQUESTED
	.comm	_AR5K_PHY_PAPD_PROBE,4,2        ## @AR5K_PHY_PAPD_PROBE
	.comm	_AR5K_PHY_PAPD_PROBE_TX_NEXT,8,3 ## @AR5K_PHY_PAPD_PROBE_TX_NEXT
	.comm	_AR5K_PHY_PAPD_PROBE_GAINF_S,8,3 ## @AR5K_PHY_PAPD_PROBE_GAINF_S
	.comm	_AR5K_PHY_PAPD_PROBE_TYPE,4,2   ## @AR5K_PHY_PAPD_PROBE_TYPE
	.comm	_AR5K_PHY_PAPD_PROBE_TYPE_CCK,8,3 ## @AR5K_PHY_PAPD_PROBE_TYPE_CCK
	.comm	_AR5K_SREV_RAD_5112A,8,3        ## @AR5K_SREV_RAD_5112A
	.comm	_AR5K_GAIN_CCK_PROBE_CORR,8,3   ## @AR5K_GAIN_CCK_PROBE_CORR
	.comm	_AR5K_RFGAIN_NEED_CHANGE,8,3    ## @AR5K_RFGAIN_NEED_CHANGE
	.comm	_AR5K_RFGAIN_ACTIVE,8,3         ## @AR5K_RFGAIN_ACTIVE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ath5k_hw_gainf_calibrate       ; -- Begin function ath5k_hw_gainf_calibrate
	.p2align	2
_ath5k_hw_gainf_calibrate:              ; @ath5k_hw_gainf_calibrate
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	x9, [x0, #32]
Lloh0:
	adrp	x8, _AR5K_RFGAIN_INACTIVE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AR5K_RFGAIN_INACTIVE@GOTPAGEOFF]
	cbz	x9, LBB0_14
; %bb.1:
	mov	x20, x0
	mov	x19, x0
	ldr	x9, [x19, #8]!
	ldr	x10, [x8]
	cmp	x9, x10
	b.eq	LBB0_14
; %bb.2:
Lloh2:
	adrp	x8, _AR5K_RFGAIN_READ_REQUESTED@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AR5K_RFGAIN_READ_REQUESTED@GOTPAGEOFF]
Lloh4:
	ldr	x10, [x8]
	mov	x8, x19
	cmp	x9, x10
	b.ne	LBB0_14
; %bb.3:
Lloh5:
	adrp	x8, _AR5K_PHY_PAPD_PROBE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AR5K_PHY_PAPD_PROBE@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_ath5k_hw_reg_read
Lloh8:
	adrp	x8, _AR5K_PHY_PAPD_PROBE_TX_NEXT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AR5K_PHY_PAPD_PROBE_TX_NEXT@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x8]
	mov	x8, x19
	tst	x9, x0
	b.ne	LBB0_14
; %bb.4:
Lloh11:
	adrp	x8, _AR5K_PHY_PAPD_PROBE_GAINF_S@GOTPAGE
Lloh12:
	ldr	x8, [x8, _AR5K_PHY_PAPD_PROBE_GAINF_S@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
	asr	x8, x0, x8
	str	x8, [x20, #24]
Lloh14:
	adrp	x8, _AR5K_PHY_PAPD_PROBE_TYPE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _AR5K_PHY_PAPD_PROBE_TYPE@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	bl	_AR5K_REG_MS
Lloh17:
	adrp	x8, _AR5K_PHY_PAPD_PROBE_TYPE_CCK@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AR5K_PHY_PAPD_PROBE_TYPE_CCK@GOTPAGEOFF]
Lloh19:
	ldr	x10, [x8]
	ldr	x8, [x20]
Lloh20:
	adrp	x9, _AR5K_SREV_RAD_5112A@GOTPAGE
Lloh21:
	ldr	x9, [x9, _AR5K_SREV_RAD_5112A@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	cmp	x0, x10
	b.ne	LBB0_6
; %bb.5:
	add	x10, x20, #40
Lloh23:
	adrp	x11, _AR5K_GAIN_CCK_PROBE_CORR@GOTPAGE
Lloh24:
	ldr	x11, [x11, _AR5K_GAIN_CCK_PROBE_CORR@GOTPAGEOFF]
	cmp	x8, x9
	csel	x10, x11, x10, lt
	ldr	x10, [x10]
	ldr	x11, [x20, #24]
	add	x10, x11, x10
	str	x10, [x20, #24]
LBB0_6:
	cmp	x8, x9
	b.lt	LBB0_8
; %bb.7:
	mov	x0, x20
	bl	_ath5k_hw_rf_gainf_corr
	ldp	x9, x8, [x20, #16]
	subs	x8, x8, x9
	csel	x8, xzr, x8, lt
	str	x8, [x20, #24]
LBB0_8:
	mov	x0, x20
	bl	_ath5k_hw_rf_check_gainf_readback
	cbz	x0, LBB0_12
; %bb.9:
	mov	x0, x19
	bl	_AR5K_GAIN_CHECK_ADJUST
	cbz	x0, LBB0_12
; %bb.10:
	mov	x0, x20
	bl	_ath5k_hw_rf_gainf_adjust
	cbz	x0, LBB0_12
; %bb.11:
Lloh25:
	adrp	x8, _AR5K_RFGAIN_NEED_CHANGE@GOTPAGE
Lloh26:
	ldr	x8, [x8, _AR5K_RFGAIN_NEED_CHANGE@GOTPAGEOFF]
	b	LBB0_13
LBB0_12:
Lloh27:
	adrp	x8, _AR5K_RFGAIN_ACTIVE@GOTPAGE
Lloh28:
	ldr	x8, [x8, _AR5K_RFGAIN_ACTIVE@GOTPAGEOFF]
LBB0_13:
	ldr	x8, [x8]
	str	x8, [x19]
	mov	x8, x19
LBB0_14:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_AR5K_RFGAIN_INACTIVE,8,3       ; @AR5K_RFGAIN_INACTIVE
	.comm	_AR5K_RFGAIN_READ_REQUESTED,8,3 ; @AR5K_RFGAIN_READ_REQUESTED
	.comm	_AR5K_PHY_PAPD_PROBE,4,2        ; @AR5K_PHY_PAPD_PROBE
	.comm	_AR5K_PHY_PAPD_PROBE_TX_NEXT,8,3 ; @AR5K_PHY_PAPD_PROBE_TX_NEXT
	.comm	_AR5K_PHY_PAPD_PROBE_GAINF_S,8,3 ; @AR5K_PHY_PAPD_PROBE_GAINF_S
	.comm	_AR5K_PHY_PAPD_PROBE_TYPE,4,2   ; @AR5K_PHY_PAPD_PROBE_TYPE
	.comm	_AR5K_PHY_PAPD_PROBE_TYPE_CCK,8,3 ; @AR5K_PHY_PAPD_PROBE_TYPE_CCK
	.comm	_AR5K_SREV_RAD_5112A,8,3        ; @AR5K_SREV_RAD_5112A
	.comm	_AR5K_GAIN_CCK_PROBE_CORR,8,3   ; @AR5K_GAIN_CCK_PROBE_CORR
	.comm	_AR5K_RFGAIN_NEED_CHANGE,8,3    ; @AR5K_RFGAIN_NEED_CHANGE
	.comm	_AR5K_RFGAIN_ACTIVE,8,3         ; @AR5K_RFGAIN_ACTIVE
.subsections_via_symbols
