	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar9002_hw_set_channel
_ar9002_hw_set_channel:                 ## @ar9002_hw_set_channel
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r12
	leaq	-48(%rbp), %rdx
	callq	_ath9k_hw_get_channel_centers
	movl	-48(%rbp), %r14d
	movq	_AR_PHY_SYNTH_CONTROL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_REG_READ
	movl	%eax, %r15d
	cmpl	$4799, %r14d                    ## imm = 0x12BF
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	jg	LBB0_4
## %bb.1:
	movl	%r14d, %edi
	callq	_CHANSEL_2G
	movl	%eax, %r13d
	movq	%r12, %rdi
	callq	_AR_SREV_9287_11_OR_LATER
	testq	%rax, %rax
	je	LBB0_8
## %bb.2:
	cmpl	$2484, %r14d                    ## imm = 0x9B4
	jne	LBB0_10
## %bb.3:
	leaq	20(%r12), %rdi
	jmp	LBB0_11
LBB0_4:
	movq	8(%r12), %rax
	movq	_EEP_FRAC_N_5G@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	%r12, %rdi
	callq	*(%rax)
	testl	%eax, %eax
	jne	LBB0_7
## %bb.5:
	movq	%rbx, %rdi
	callq	_IS_CHAN_HALF_RATE
	testl	%eax, %eax
	jne	LBB0_7
## %bb.6:
	movq	%rbx, %rdi
	callq	_IS_CHAN_QUARTER_RATE
	testl	%eax, %eax
	je	LBB0_16
LBB0_7:
	movl	%r14d, %edi
	callq	_CHANSEL_5G
	movl	%eax, %r13d
	movq	_AR_AN_SYNTH9@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_AR_AN_SYNTH9_REFDIVA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_AR_AN_SYNTH9_REFDIVA_S@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r12, %rdi
	movl	$1, %r8d
	callq	_ath9k_hw_analog_shift_rmw
	movl	$268435456, %eax                ## imm = 0x10000000
	xorl	%ebx, %ebx
	xorl	%ecx, %ecx
	jmp	LBB0_14
LBB0_8:
	movq	_AR_PHY_CCK_TX_CTRL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r12, %rdi
	callq	_REG_READ
	movl	(%rbx), %esi
	movq	_AR_PHY_CCK_TX_CTRL_JAPAN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	cmpl	$2484, %r14d                    ## imm = 0x9B4
	jne	LBB0_12
## %bb.9:
	orl	%eax, %edx
	movq	%r12, %rdi
	jmp	LBB0_13
LBB0_10:
	leaq	16(%r12), %rdi
LBB0_11:
	xorl	%ebx, %ebx
	movl	$1, %esi
	xorl	%edx, %edx
	callq	_REG_WRITE_ARRAY
	movl	$536870912, %ecx                ## imm = 0x20000000
	movl	$268435456, %eax                ## imm = 0x10000000
	jmp	LBB0_14
LBB0_12:
	notl	%edx
	andl	%edx, %eax
	movq	%r12, %rdi
	movl	%eax, %edx
LBB0_13:
	callq	_REG_WRITE
	movl	$536870912, %ecx                ## imm = 0x20000000
	movl	$268435456, %eax                ## imm = 0x10000000
	xorl	%ebx, %ebx
LBB0_14:
	movq	_AR_PHY_SYNTH_CONTROL@GOTPCREL(%rip), %rdx
LBB0_15:
	orl	%eax, %r13d
	orl	%ecx, %r13d
	andl	$-1073741824, %r15d             ## imm = 0xC0000000
	shll	$26, %ebx
	orl	%r15d, %ebx
	orl	%r13d, %ebx
	movl	(%rdx), %esi
	movq	%r12, %rdi
	movl	%ebx, %edx
	callq	_REG_WRITE
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, (%r12)
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	imull	$-858993459, %r14d, %eax        ## imm = 0xCCCCCCCD
	movl	%eax, %ecx
	rorl	$2, %ecx
	cmpl	$214748365, %ecx                ## imm = 0xCCCCCCD
	jb	LBB0_19
## %bb.17:
	rorl	%eax
	cmpl	$429496730, %eax                ## imm = 0x1999999A
	jae	LBB0_7
## %bb.18:
	movl	$2, %ebx
	jmp	LBB0_20
LBB0_19:
	movl	$3, %ebx
LBB0_20:
	movq	_AR_PHY_SYNTH_CONTROL@GOTPCREL(%rip), %rdx
	movl	$24, %eax
	movl	%ebx, %ecx
	shrl	%cl, %eax
	imull	%r14d, %eax
	movslq	%eax, %r13
	imulq	$-2004318071, %r13, %rax        ## imm = 0x88888889
	shrq	$32, %rax
	addl	%eax, %r13d
	movl	%r13d, %eax
	shrl	$31, %eax
	sarl	$5, %r13d
	addl	%eax, %r13d
	leal	(%r13,%r13), %eax
	andl	$-1024, %eax                    ## imm = 0xFC00
	shll	$17, %r13d
	andl	$66977792, %r13d                ## imm = 0x3FE0000
	orl	%eax, %r13d
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_AR_PHY_SYNTH_CONTROL,4,2       ## @AR_PHY_SYNTH_CONTROL
	.comm	_AR_PHY_CCK_TX_CTRL,4,2         ## @AR_PHY_CCK_TX_CTRL
	.comm	_AR_PHY_CCK_TX_CTRL_JAPAN,4,2   ## @AR_PHY_CCK_TX_CTRL_JAPAN
	.comm	_EEP_FRAC_N_5G,4,2              ## @EEP_FRAC_N_5G
	.comm	_AR_AN_SYNTH9,4,2               ## @AR_AN_SYNTH9
	.comm	_AR_AN_SYNTH9_REFDIVA,4,2       ## @AR_AN_SYNTH9_REFDIVA
	.comm	_AR_AN_SYNTH9_REFDIVA_S,4,2     ## @AR_AN_SYNTH9_REFDIVA_S
	.no_dead_strip	_ar9002_hw_set_channel
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ar9002_hw_set_channel
_ar9002_hw_set_channel:                 ; @ar9002_hw_set_channel
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x19, x1
	mov	x20, x0
	add	x2, sp, #8
	bl	_ath9k_hw_get_channel_centers
	ldr	w23, [sp, #8]
Lloh0:
	adrp	x24, _AR_PHY_SYNTH_CONTROL@GOTPAGE
Lloh1:
	ldr	x24, [x24, _AR_PHY_SYNTH_CONTROL@GOTPAGEOFF]
	ldr	w1, [x24]
	mov	x0, x20
	bl	_REG_READ
	mov	x21, x0
	mov	w8, #4799
	cmp	w23, w8
	b.gt	LBB0_4
; %bb.1:
	mov	x0, x23
	bl	_CHANSEL_2G
	mov	x22, x0
	mov	x0, x20
	bl	_AR_SREV_9287_11_OR_LATER
	cbz	x0, LBB0_8
; %bb.2:
	cmp	w23, #2484
	b.ne	LBB0_10
; %bb.3:
	add	x0, x20, #20
	b	LBB0_11
LBB0_4:
	ldr	x8, [x20, #8]
	ldr	x8, [x8]
Lloh2:
	adrp	x9, _EEP_FRAC_N_5G@GOTPAGE
Lloh3:
	ldr	x9, [x9, _EEP_FRAC_N_5G@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x9]
	mov	x0, x20
	blr	x8
	cbnz	w0, LBB0_7
; %bb.5:
	mov	x0, x19
	bl	_IS_CHAN_HALF_RATE
	cbnz	w0, LBB0_7
; %bb.6:
	mov	x0, x19
	bl	_IS_CHAN_QUARTER_RATE
	cbz	w0, LBB0_17
LBB0_7:
	mov	x0, x23
	bl	_CHANSEL_5G
	mov	x22, x0
Lloh5:
	adrp	x8, _AR_AN_SYNTH9@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AR_AN_SYNTH9@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
Lloh8:
	adrp	x8, _AR_AN_SYNTH9_REFDIVA@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AR_AN_SYNTH9_REFDIVA@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
Lloh11:
	adrp	x8, _AR_AN_SYNTH9_REFDIVA_S@GOTPAGE
Lloh12:
	ldr	x8, [x8, _AR_AN_SYNTH9_REFDIVA_S@GOTPAGEOFF]
Lloh13:
	ldr	w3, [x8]
	mov	x0, x20
	mov	w4, #1
	bl	_ath9k_hw_analog_shift_rmw
	mov	w8, #0
	mov	w9, #0
	b	LBB0_15
LBB0_8:
Lloh14:
	adrp	x25, _AR_PHY_CCK_TX_CTRL@GOTPAGE
Lloh15:
	ldr	x25, [x25, _AR_PHY_CCK_TX_CTRL@GOTPAGEOFF]
	ldr	w1, [x25]
	mov	x0, x20
	bl	_REG_READ
	ldr	w1, [x25]
Lloh16:
	adrp	x8, _AR_PHY_CCK_TX_CTRL_JAPAN@GOTPAGE
Lloh17:
	ldr	x8, [x8, _AR_PHY_CCK_TX_CTRL_JAPAN@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	cmp	w23, #2484
	b.ne	LBB0_12
; %bb.9:
	orr	w2, w8, w0
	b	LBB0_13
LBB0_10:
	add	x0, x20, #16
LBB0_11:
	mov	w1, #1
	mov	w2, #0
	bl	_REG_WRITE_ARRAY
	b	LBB0_14
LBB0_12:
	bic	w2, w0, w8
LBB0_13:
	mov	x0, x20
	bl	_REG_WRITE
LBB0_14:
	mov	w8, #0
	mov	w9, #536870912
LBB0_15:
	mov	w10, #268435456
LBB0_16:
	and	w11, w21, #0xc0000000
	bfi	w11, w8, #26, #2
	orr	w8, w11, w22
	orr	w8, w8, w10
	orr	w2, w8, w9
	ldr	w1, [x24]
	mov	x0, x20
	bl	_REG_WRITE
	str	x19, [x20]
	mov	w0, #0
	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
	add	sp, sp, #96
	ret
LBB0_17:
	mov	w8, #52429
	movk	w8, #52428, lsl #16
	mul	w8, w23, w8
	ror	w9, w8, #2
	mov	w10, #52429
	movk	w10, #3276, lsl #16
	cmp	w9, w10
	b.lo	LBB0_20
; %bb.18:
	ror	w8, w8, #1
	mov	w9, #39322
	movk	w9, #6553, lsl #16
	cmp	w8, w9
	b.hs	LBB0_7
; %bb.19:
	mov	w8, #2
	b	LBB0_21
LBB0_20:
	mov	w8, #3
LBB0_21:
	mov	w10, #0
	mov	w9, #0
	mov	w11, #24
	lsr	w11, w11, w8
	mul	w11, w11, w23
	mov	w12, #34953
	movk	w12, #34952, lsl #16
	smull	x12, w11, w12
	lsr	x12, x12, #32
	add	w11, w12, w11
	asr	w12, w11, #5
	add	w11, w12, w11, lsr #31
	lsl	w12, w11, #1
	and	w12, w12, #0xfffffc00
	ubfiz	w11, w11, #17, #9
	orr	w22, w11, w12
	b	LBB0_16
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_AR_PHY_SYNTH_CONTROL,4,2       ; @AR_PHY_SYNTH_CONTROL
	.comm	_AR_PHY_CCK_TX_CTRL,4,2         ; @AR_PHY_CCK_TX_CTRL
	.comm	_AR_PHY_CCK_TX_CTRL_JAPAN,4,2   ; @AR_PHY_CCK_TX_CTRL_JAPAN
	.comm	_EEP_FRAC_N_5G,4,2              ; @EEP_FRAC_N_5G
	.comm	_AR_AN_SYNTH9,4,2               ; @AR_AN_SYNTH9
	.comm	_AR_AN_SYNTH9_REFDIVA,4,2       ; @AR_AN_SYNTH9_REFDIVA
	.comm	_AR_AN_SYNTH9_REFDIVA_S,4,2     ; @AR_AN_SYNTH9_REFDIVA_S
	.no_dead_strip	_ar9002_hw_set_channel
.subsections_via_symbols
