	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ar9003_hw_rtt_restore          ## -- Begin function ar9003_hw_rtt_restore
	.p2align	4, 0x90
_ar9003_hw_rtt_restore:                 ## @ar9003_hw_rtt_restore
	.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
	movq	%rsi, %r15
	movq	(%rdi), %rsi
	xorl	%r14d, %r14d
	testq	%rsi, %rsi
	je	LBB0_11
## %bb.1:
	movq	%rdi, %rbx
	movq	_SW_PKDET_DONE@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	addq	$8, %rsi
	callq	_test_bit
	testq	%rax, %rax
	je	LBB0_6
## %bb.2:
	movq	%r15, %rdi
	callq	_IS_CHAN_2GHZ
	movq	%rax, %r15
	xorl	%edi, %edi
	callq	_AR_PHY_65NM_RXRF_AGC
	testq	%r15, %r15
	jne	LBB0_3
## %bb.4:
	movq	_AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR@GOTPCREL(%rip), %r15
	jmp	LBB0_5
LBB0_3:
	movq	_AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR@GOTPCREL(%rip), %r15
LBB0_5:
	movl	(%r15), %edx
	movq	(%rbx), %rcx
	movq	(%rcx), %rcx
	movl	(%rcx), %ecx
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_REG_RMW_FIELD
	movl	$1, %edi
	callq	_AR_PHY_65NM_RXRF_AGC
	movl	(%r15), %edx
	movq	(%rbx), %rcx
	movq	(%rcx), %rcx
	movl	4(%rcx), %ecx
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_REG_RMW_FIELD
	movl	$1, %edi
	callq	_AR_PHY_65NM_RXRF_AGC
	movq	_AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	$1, %ecx
	callq	_REG_RMW_FIELD
	xorl	%edi, %edi
	callq	_AR_PHY_65NM_RXRF_AGC
	movl	(%r15), %edx
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	$1, %ecx
	callq	_REG_RMW_FIELD
LBB0_6:
	movq	_RTT_DONE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%rbx), %rsi
	addq	$8, %rsi
	callq	_test_bit
	testq	%rax, %rax
	je	LBB0_11
## %bb.7:
	movq	%rbx, %rdi
	callq	_ar9003_hw_rtt_enable
	movl	(%r12), %edi
	movq	(%rbx), %rsi
	addq	$8, %rsi
	callq	_test_bit
	xorl	%esi, %esi
	testq	%rax, %rax
	setne	%sil
	shll	$5, %esi
	orl	$16, %esi
	movq	%rbx, %rdi
	callq	_ar9003_hw_rtt_set_mask
	movq	%rbx, %rdi
	callq	_ath9k_hw_rfbus_req
	movq	%rbx, %rdi
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:
	callq	_ar9003_hw_rtt_load_hist
	movq	%rbx, %rdi
	callq	_ar9003_hw_rtt_force_restore
	movl	%eax, %r14d
	jmp	LBB0_10
LBB0_8:
	callq	_ath9k_hw_common
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	callq	_ath_err
	xorl	%r14d, %r14d
LBB0_10:
	movq	%rbx, %rdi
	callq	_ath9k_hw_rfbus_done
	movq	%rbx, %rdi
	callq	_ar9003_hw_rtt_disable
LBB0_11:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SW_PKDET_DONE,4,2              ## @SW_PKDET_DONE
	.comm	_AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR,4,2 ## @AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR
	.comm	_AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR,4,2 ## @AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR
	.comm	_AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE,4,2 ## @AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE
	.comm	_RTT_DONE,4,2                   ## @RTT_DONE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not stop baseband\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ar9003_hw_rtt_restore          ; -- Begin function ar9003_hw_rtt_restore
	.p2align	2
_ar9003_hw_rtt_restore:                 ; @ar9003_hw_rtt_restore
	.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
	ldr	x8, [x0]
	cbz	x8, LBB0_6
; %bb.1:
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x21, _SW_PKDET_DONE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SW_PKDET_DONE@GOTPAGEOFF]
	ldr	w0, [x21]
	add	x1, x8, #8
	bl	_test_bit
	cbz	x0, LBB0_3
; %bb.2:
	mov	x0, x20
	bl	_IS_CHAN_2GHZ
	mov	x20, x0
	mov	w0, #0
	bl	_AR_PHY_65NM_RXRF_AGC
	mov	x1, x0
Lloh2:
	adrp	x8, _AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR@GOTPAGEOFF]
Lloh4:
	adrp	x9, _AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR@GOTPAGE
Lloh5:
	ldr	x9, [x9, _AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR@GOTPAGEOFF]
	cmp	x20, #0
	csel	x20, x9, x8, eq
	ldr	w2, [x20]
	ldr	x8, [x19]
	ldr	x8, [x8]
	ldr	w3, [x8]
	mov	x0, x19
	bl	_REG_RMW_FIELD
	mov	w0, #1
	bl	_AR_PHY_65NM_RXRF_AGC
	mov	x1, x0
	ldr	w2, [x20]
	ldr	x8, [x19]
	ldr	x8, [x8]
	ldr	w3, [x8, #4]
	mov	x0, x19
	bl	_REG_RMW_FIELD
	mov	w0, #1
	bl	_AR_PHY_65NM_RXRF_AGC
	mov	x1, x0
Lloh6:
	adrp	x20, _AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE@GOTPAGE
Lloh7:
	ldr	x20, [x20, _AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE@GOTPAGEOFF]
	ldr	w2, [x20]
	mov	x0, x19
	mov	w3, #1
	bl	_REG_RMW_FIELD
	mov	w0, #0
	bl	_AR_PHY_65NM_RXRF_AGC
	mov	x1, x0
	ldr	w2, [x20]
	mov	x0, x19
	mov	w3, #1
	bl	_REG_RMW_FIELD
LBB0_3:
Lloh8:
	adrp	x8, _RTT_DONE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _RTT_DONE@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	ldr	x8, [x19]
	add	x1, x8, #8
	bl	_test_bit
	cbz	x0, LBB0_6
; %bb.4:
	mov	x0, x19
	bl	_ar9003_hw_rtt_enable
	ldr	w0, [x21]
	ldr	x8, [x19]
	add	x1, x8, #8
	bl	_test_bit
	cmp	x0, #0
	mov	w8, #48
	mov	w9, #16
	csel	w1, w9, w8, eq
	mov	x0, x19
	bl	_ar9003_hw_rtt_set_mask
	mov	x0, x19
	bl	_ath9k_hw_rfbus_req
	cbz	w0, LBB0_7
; %bb.5:
	mov	x0, x19
	bl	_ar9003_hw_rtt_load_hist
	mov	x0, x19
	bl	_ar9003_hw_rtt_force_restore
	mov	x20, x0
	b	LBB0_8
LBB0_6:
	mov	w20, #0
	b	LBB0_9
LBB0_7:
	mov	x0, x19
	bl	_ath9k_hw_common
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	bl	_ath_err
	mov	w20, #0
LBB0_8:
	mov	x0, x19
	bl	_ath9k_hw_rfbus_done
	mov	x0, x19
	bl	_ar9003_hw_rtt_disable
LBB0_9:
	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 AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_SW_PKDET_DONE,4,2              ; @SW_PKDET_DONE
	.comm	_AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR,4,2 ; @AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR
	.comm	_AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR,4,2 ; @AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR
	.comm	_AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE,4,2 ; @AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE
	.comm	_RTT_DONE,4,2                   ; @RTT_DONE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not stop baseband\n"

.subsections_via_symbols
