	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar9002_hw_adc_gaincal_calibrate
_ar9002_hw_adc_gaincal_calibrate:       ## @ar9002_hw_adc_gaincal_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
	subq	$56, %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, -48(%rbp)                 ## 8-byte Spill
	callq	_ath9k_hw_common
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	testq	%rbx, %rbx
	je	LBB0_12
## %bb.1:
	xorl	%r13d, %r13d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	xorl	%edx, %edx
	divq	%rbx
	movq	%rax, %r14
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	andl	$63, %r14d
	movq	_CALIBRATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rax, %rbx
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rdi
	leaq	L_.str.5(%rip), %rdx
	movq	%r13, %rcx
	movq	%r15, %r8
	xorl	%eax, %eax
	callq	_ath_dbg
	movl	(%rbx), %esi
	movq	%r12, %rdi
	leaq	L_.str.6(%rip), %rdx
	movq	%r13, %rcx
	movq	%r14, %r8
	xorl	%eax, %eax
	callq	_ath_dbg
	movq	%r13, %rdi
	callq	_AR_PHY_NEW_ADC_DC_GAIN_CORR
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_REG_READ
	andl	$-4096, %eax                    ## imm = 0xF000
	shlq	$6, %r15
	orq	%r14, %r15
	orq	%rax, %r15
	movq	%r13, %rdi
	callq	_AR_PHY_NEW_ADC_DC_GAIN_CORR
	movq	%rbx, %rdi
	movl	%eax, %esi
	movq	%r15, %rdx
	callq	_REG_WRITE
	movq	_CALIBRATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	leaq	L_.str.7(%rip), %rdx
	movq	%r13, %rcx
	xorl	%eax, %eax
	callq	_ath_dbg
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%r13
	cmpq	%r13, -72(%rbp)                 ## 8-byte Folded Reload
	je	LBB0_12
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movq	(%rdx), %rax
	movq	8(%rdx), %rcx
	movq	(%rax,%r13,8), %rbx
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	movq	(%rcx,%r13,8), %r15
	movq	16(%rdx), %rax
	movq	(%rax,%r13,8), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	24(%rdx), %rax
	movq	(%rax,%r13,8), %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movq	_CALIBRATE@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rdi
	leaq	L_.str(%rip), %rdx
	movq	%r13, %rcx
	xorl	%eax, %eax
	callq	_ath_dbg
	movl	(%r14), %esi
	movq	%r12, %rdi
	leaq	L_.str.1(%rip), %rdx
	movq	%r13, %rcx
	movq	%rbx, %r8
	xorl	%eax, %eax
	callq	_ath_dbg
	movl	(%r14), %esi
	movq	%r12, %rdi
	leaq	L_.str.2(%rip), %rdx
	movq	%r13, %rcx
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	movq	%r15, %r8
	xorl	%eax, %eax
	callq	_ath_dbg
	movl	(%r14), %esi
	movq	%r12, %rdi
	leaq	L_.str.3(%rip), %rdx
	movq	%r13, %rcx
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	xorl	%eax, %eax
	callq	_ath_dbg
	movl	(%r14), %esi
	movq	-96(%rbp), %rbx                 ## 8-byte Reload
	movq	%r12, %rdi
	leaq	L_.str.4(%rip), %rdx
	movq	%r13, %rcx
	movq	%rbx, %r8
	xorl	%eax, %eax
	callq	_ath_dbg
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	testq	%rcx, %rcx
	je	LBB0_11
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	testq	%rbx, %rbx
	je	LBB0_11
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	shlq	$5, %rax
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	je	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	xorl	%edx, %edx
	divq	%rcx
	movq	%rax, %r15
	jmp	LBB0_7
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %r15d
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	andl	$63, %r15d
	shlq	$5, %rax
	movq	%rax, %rcx
	orq	%rbx, %rcx
	shrq	$32, %rcx
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ebx
	movl	%eax, %r14d
	jmp	LBB0_10
LBB0_12:
	xorl	%edi, %edi
	callq	_AR_PHY_NEW_ADC_DC_GAIN_CORR
	movl	%eax, %r14d
	xorl	%edi, %edi
	callq	_AR_PHY_NEW_ADC_DC_GAIN_CORR
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_REG_READ
	movq	_AR_PHY_NEW_ADC_GAIN_CORR_ENABLE@GOTPCREL(%rip), %rcx
	orq	(%rcx), %rax
	movq	%rbx, %rdi
	movl	%r14d, %esi
	movq	%rax, %rdx
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_REG_WRITE                      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_CALIBRATE,4,2                  ## @CALIBRATE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Starting ADC Gain Cal for Chain %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Chn %d pwr_meas_odd_i = 0x%08x\n"

L_.str.2:                               ## @.str.2
	.asciz	"Chn %d pwr_meas_even_i = 0x%08x\n"

L_.str.3:                               ## @.str.3
	.asciz	"Chn %d pwr_meas_odd_q = 0x%08x\n"

L_.str.4:                               ## @.str.4
	.asciz	"Chn %d pwr_meas_even_q = 0x%08x\n"

L_.str.5:                               ## @.str.5
	.asciz	"Chn %d gain_mismatch_i = 0x%08x\n"

L_.str.6:                               ## @.str.6
	.asciz	"Chn %d gain_mismatch_q = 0x%08x\n"

L_.str.7:                               ## @.str.7
	.asciz	"ADC Gain Cal done for Chain %d\n"

	.comm	_AR_PHY_NEW_ADC_GAIN_CORR_ENABLE,8,3 ## @AR_PHY_NEW_ADC_GAIN_CORR_ENABLE
	.no_dead_strip	_ar9002_hw_adc_gaincal_calibrate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ar9002_hw_adc_gaincal_calibrate
_ar9002_hw_adc_gaincal_calibrate:       ; @ar9002_hw_adc_gaincal_calibrate
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x1
	mov	x19, x0
	bl	_ath9k_hw_common
	cbz	x20, LBB0_6
; %bb.1:
	mov	x21, x0
	mov	x22, #0
Lloh0:
	adrp	x23, _CALIBRATE@GOTPAGE
Lloh1:
	ldr	x23, [x23, _CALIBRATE@GOTPAGEOFF]
Lloh2:
	adrp	x27, l_.str.4@PAGE
Lloh3:
	add	x27, x27, l_.str.4@PAGEOFF
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x22, x22, #1
	cmp	x20, x22
	b.eq	LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	lsl	x8, x22, #3
	ldp	x9, x10, [x19]
	ldr	x28, [x9, x8]
	ldr	x25, [x10, x8]
	ldp	x9, x10, [x19, #16]
	ldr	x26, [x9, x8]
	ldr	x24, [x10, x8]
	ldr	w1, [x23]
	mov	x0, x21
Lloh4:
	adrp	x2, l_.str@PAGE
Lloh5:
	add	x2, x2, l_.str@PAGEOFF
	mov	x3, x22
	bl	_ath_dbg
	ldr	w1, [x23]
	str	x28, [sp]
	mov	x0, x21
Lloh6:
	adrp	x2, l_.str.1@PAGE
Lloh7:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x3, x22
	bl	_ath_dbg
	ldr	w1, [x23]
	str	x25, [sp]
	mov	x0, x21
Lloh8:
	adrp	x2, l_.str.2@PAGE
Lloh9:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x3, x22
	bl	_ath_dbg
	ldr	w1, [x23]
	str	x26, [sp]
	mov	x0, x21
Lloh10:
	adrp	x2, l_.str.3@PAGE
Lloh11:
	add	x2, x2, l_.str.3@PAGEOFF
	mov	x3, x22
	bl	_ath_dbg
	ldr	w1, [x23]
	str	x24, [sp]
	mov	x0, x21
	mov	x2, x27
	mov	x3, x22
	bl	_ath_dbg
	cbz	x28, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cbz	x24, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	lsl	x8, x25, #5
	udiv	x8, x8, x28
	and	x25, x8, #0x3f
	lsl	x8, x26, #5
	udiv	x8, x8, x24
	and	x24, x8, #0x3f
	ldr	w1, [x23]
	str	x25, [sp]
	mov	x0, x21
Lloh12:
	adrp	x2, l_.str.5@PAGE
Lloh13:
	add	x2, x2, l_.str.5@PAGEOFF
	mov	x3, x22
	bl	_ath_dbg
	ldr	w1, [x23]
	str	x24, [sp]
	mov	x0, x21
Lloh14:
	adrp	x2, l_.str.6@PAGE
Lloh15:
	add	x2, x2, l_.str.6@PAGEOFF
	mov	x3, x22
	bl	_ath_dbg
	mov	x0, x22
	bl	_AR_PHY_NEW_ADC_DC_GAIN_CORR
	mov	x1, x0
	mov	x0, x19
	bl	_REG_READ
	and	x8, x0, #0xfffff000
	bfi	x24, x25, #6, #6
	orr	x28, x8, x24
	mov	x0, x22
	bl	_AR_PHY_NEW_ADC_DC_GAIN_CORR
	mov	x1, x0
	mov	x0, x19
	mov	x2, x28
	bl	_REG_WRITE
	ldr	w1, [x23]
	mov	x0, x21
Lloh16:
	adrp	x2, l_.str.7@PAGE
Lloh17:
	add	x2, x2, l_.str.7@PAGEOFF
	mov	x3, x22
	bl	_ath_dbg
	b	LBB0_2
LBB0_6:
	mov	x0, #0
	bl	_AR_PHY_NEW_ADC_DC_GAIN_CORR
	mov	x20, x0
	mov	x0, #0
	bl	_AR_PHY_NEW_ADC_DC_GAIN_CORR
	mov	x1, x0
	mov	x0, x19
	bl	_REG_READ
Lloh18:
	adrp	x8, _AR_PHY_NEW_ADC_GAIN_CORR_ENABLE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _AR_PHY_NEW_ADC_GAIN_CORR_ENABLE@GOTPAGEOFF]
Lloh20:
	ldr	x8, [x8]
	orr	x2, x8, x0
	mov	x0, x19
	mov	x1, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_REG_WRITE
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_CALIBRATE,4,2                  ; @CALIBRATE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Starting ADC Gain Cal for Chain %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Chn %d pwr_meas_odd_i = 0x%08x\n"

l_.str.2:                               ; @.str.2
	.asciz	"Chn %d pwr_meas_even_i = 0x%08x\n"

l_.str.3:                               ; @.str.3
	.asciz	"Chn %d pwr_meas_odd_q = 0x%08x\n"

l_.str.4:                               ; @.str.4
	.asciz	"Chn %d pwr_meas_even_q = 0x%08x\n"

l_.str.5:                               ; @.str.5
	.asciz	"Chn %d gain_mismatch_i = 0x%08x\n"

l_.str.6:                               ; @.str.6
	.asciz	"Chn %d gain_mismatch_q = 0x%08x\n"

l_.str.7:                               ; @.str.7
	.asciz	"ADC Gain Cal done for Chain %d\n"

	.comm	_AR_PHY_NEW_ADC_GAIN_CORR_ENABLE,8,3 ; @AR_PHY_NEW_ADC_GAIN_CORR_ENABLE
	.no_dead_strip	_ar9002_hw_adc_gaincal_calibrate
.subsections_via_symbols
