	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ath5k_hw_rf511x_iq_calibrate
_ath5k_hw_rf511x_iq_calibrate:          ## @ath5k_hw_rf511x_iq_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	$0, 8(%rdi)
	je	LBB0_3
## %bb.1:
	movq	%rdi, %r14
	movq	_AR5K_PHY_IQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_ath5k_hw_reg_read
	movq	_AR5K_PHY_IQ_RUN@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.2:
	movq	_ATH5K_DEBUG_CALIBRATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_ATH5K_DBG_UNLIMIT
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_4:
	movl	$10, %r12d
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	_AR5K_PHY_IQRES_CAL_CORR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_ath5k_hw_reg_read
	movl	%eax, %r13d
	movq	_AR5K_PHY_IQRES_CAL_PWR_I@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_ath5k_hw_reg_read
	movl	%eax, %ebx
	movq	_AR5K_PHY_IQRES_CAL_PWR_Q@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_ath5k_hw_reg_read
	movl	%eax, %r15d
	movq	_ATH5K_DEBUG_CALIBRATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	leaq	L_.str.1(%rip), %rdx
	movl	%r13d, %ecx
	movl	%ebx, %r8d
	movl	%r15d, %r9d
	xorl	%eax, %eax
	callq	_ATH5K_DBG_UNLIMIT
	testl	%ebx, %ebx
	setne	%cl
	testl	%r15d, %r15d
	setne	%dl
	subl	$1, %r12d
	setb	%al
	testb	%dl, %cl
	jne	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	testb	%al, %al
	je	LBB0_5
LBB0_7:
	movl	%ebx, %eax
	sarl	%eax
	movl	%r15d, %r12d
	sarl	%r12d
	addl	%eax, %r12d
	movq	(%r14), %rax
	movq	_AR5K_AR5211@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	sete	%cl
	xorb	$7, %cl
	sarl	%cl, %r15d
	cmpl	$128, %r12d
	jb	LBB0_10
## %bb.8:
	cmpl	$1, %r15d
	jle	LBB0_10
## %bb.9:
	sarl	$7, %r12d
	movl	%r13d, %eax
	movq	%rdx, %r13
	cltd
	idivl	%r12d
	negl	%eax
	movl	%eax, %edi
	movl	$-32, %esi
	movl	$31, %edx
	callq	_clamp
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	(%r14), %rax
	xorl	%ecx, %ecx
	cmpq	(%r13), %rax
	sete	%cl
	movl	%ebx, %eax
	cltd
	idivl	%r15d
                                        ## kill: def $eax killed $eax def $rax
	shll	$6, %ecx
	leal	(%rcx,%rax), %edi
	addl	$-128, %edi
	movl	$-16, %esi
	movl	$15, %edx
	callq	_clamp
	movl	%eax, %r8d
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_ATH5K_DEBUG_CALIBRATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, (%rsp)
	leaq	L_.str.2(%rip), %rdx
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	movl	-48(%rbp), %r13d                ## 4-byte Reload
	movl	%r13d, %ecx
	movl	%r12d, %r9d
	xorl	%eax, %eax
	callq	_ATH5K_DBG_UNLIMIT
	movq	_AR5K_PHY_IQ@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_AR5K_PHY_IQ_CORR_Q_I_COFF@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	%r13d, %ecx
	callq	_AR5K_REG_WRITE_BITS
	movl	(%r15), %esi
	movq	_AR5K_PHY_IQ_CORR_Q_Q_COFF@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	callq	_AR5K_REG_WRITE_BITS
	movl	(%r15), %esi
	movq	_AR5K_PHY_IQ_CORR_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_AR5K_REG_ENABLE_BITS
	movl	(%r15), %esi
	movq	_AR5K_PHY_IQ_CAL_NUM_LOG_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	$15, %ecx
	callq	_AR5K_REG_WRITE_BITS
	movl	(%r15), %esi
	movq	_AR5K_PHY_IQ_RUN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_AR5K_REG_ENABLE_BITS
	jmp	LBB0_13
LBB0_10:
	movq	_ECANCELED@GOTPCREL(%rip), %rax
LBB0_11:
	xorl	%ebx, %ebx
LBB0_12:
	subl	(%rax), %ebx
LBB0_13:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AR5K_PHY_IQ,4,2                ## @AR5K_PHY_IQ
	.comm	_AR5K_PHY_IQ_RUN,4,2            ## @AR5K_PHY_IQ_RUN
	.comm	_ATH5K_DEBUG_CALIBRATE,4,2      ## @ATH5K_DEBUG_CALIBRATE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"I/Q calibration still running"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_AR5K_PHY_IQRES_CAL_CORR,4,2    ## @AR5K_PHY_IQRES_CAL_CORR
	.comm	_AR5K_PHY_IQRES_CAL_PWR_I,4,2   ## @AR5K_PHY_IQRES_CAL_PWR_I
	.comm	_AR5K_PHY_IQRES_CAL_PWR_Q,4,2   ## @AR5K_PHY_IQRES_CAL_PWR_Q
L_.str.1:                               ## @.str.1
	.asciz	"iq_corr:%x i_pwr:%x q_pwr:%x"

	.comm	_AR5K_AR5211,8,3                ## @AR5K_AR5211
	.comm	_ECANCELED,4,2                  ## @ECANCELED
L_.str.2:                               ## @.str.2
	.asciz	"new I:%d Q:%d (i_coffd:%x q_coffd:%x)"

	.comm	_AR5K_PHY_IQ_CORR_Q_I_COFF,4,2  ## @AR5K_PHY_IQ_CORR_Q_I_COFF
	.comm	_AR5K_PHY_IQ_CORR_Q_Q_COFF,4,2  ## @AR5K_PHY_IQ_CORR_Q_Q_COFF
	.comm	_AR5K_PHY_IQ_CORR_ENABLE,4,2    ## @AR5K_PHY_IQ_CORR_ENABLE
	.comm	_AR5K_PHY_IQ_CAL_NUM_LOG_MAX,4,2 ## @AR5K_PHY_IQ_CAL_NUM_LOG_MAX
	.no_dead_strip	_ath5k_hw_rf511x_iq_calibrate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ath5k_hw_rf511x_iq_calibrate
_ath5k_hw_rf511x_iq_calibrate:          ; @ath5k_hw_rf511x_iq_calibrate
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	ldr	w8, [x0, #8]
	cbz	w8, LBB0_3
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x8, _AR5K_PHY_IQ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AR5K_PHY_IQ@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_ath5k_hw_reg_read
Lloh3:
	adrp	x8, _AR5K_PHY_IQ_RUN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AR5K_PHY_IQ_RUN@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_4
; %bb.2:
Lloh6:
	adrp	x8, _ATH5K_DEBUG_CALIBRATE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ATH5K_DEBUG_CALIBRATE@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
Lloh9:
	adrp	x2, l_.str@PAGE
Lloh10:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	bl	_ATH5K_DBG_UNLIMIT
Lloh11:
	adrp	x8, _EBUSY@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_8
LBB0_3:
Lloh13:
	adrp	x8, _EINVAL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_8
LBB0_4:
	mov	w27, #10
Lloh15:
	adrp	x28, _AR5K_PHY_IQRES_CAL_CORR@GOTPAGE
Lloh16:
	ldr	x28, [x28, _AR5K_PHY_IQRES_CAL_CORR@GOTPAGEOFF]
Lloh17:
	adrp	x25, _AR5K_PHY_IQRES_CAL_PWR_I@GOTPAGE
Lloh18:
	ldr	x25, [x25, _AR5K_PHY_IQRES_CAL_PWR_I@GOTPAGEOFF]
Lloh19:
	adrp	x24, _AR5K_PHY_IQRES_CAL_PWR_Q@GOTPAGE
Lloh20:
	ldr	x24, [x24, _AR5K_PHY_IQRES_CAL_PWR_Q@GOTPAGEOFF]
Lloh21:
	adrp	x22, l_.str.1@PAGE
Lloh22:
	add	x22, x22, l_.str.1@PAGEOFF
Lloh23:
	adrp	x26, _ATH5K_DEBUG_CALIBRATE@GOTPAGE
Lloh24:
	ldr	x26, [x26, _ATH5K_DEBUG_CALIBRATE@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x28]
	mov	x0, x19
	bl	_ath5k_hw_reg_read
	mov	x21, x0
	ldr	w1, [x25]
	mov	x0, x19
	bl	_ath5k_hw_reg_read
	mov	x20, x0
	ldr	w1, [x24]
	mov	x0, x19
	bl	_ath5k_hw_reg_read
	mov	x23, x0
	ldr	w1, [x26]
	stp	x20, x23, [sp, #8]
	str	x21, [sp]
	mov	x0, x19
	mov	x2, x22
	bl	_ATH5K_DBG_UNLIMIT
	cmp	w23, #0
	ccmp	w20, #0, #4, ne
	ccmp	w27, #0, #4, eq
	sub	w27, w27, #1
	b.ne	LBB0_5
; %bb.6:
	asr	w8, w23, #1
	add	w8, w8, w20, asr #1
	ldr	x9, [x19]
Lloh25:
	adrp	x24, _AR5K_AR5211@GOTPAGE
Lloh26:
	ldr	x24, [x24, _AR5K_AR5211@GOTPAGEOFF]
	ldr	x10, [x24]
	cmp	x9, x10
	mov	w9, #6
	cinc	w9, w9, ne
	asr	w22, w23, w9
	cmp	w8, #128
	ccmp	w22, #1, #4, hs
	b.gt	LBB0_10
; %bb.7:
Lloh27:
	adrp	x8, _ECANCELED@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ECANCELED@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_10:
	asr	w23, w8, #7
	sdiv	w8, w21, w23
	neg	w0, w8
	mov	w1, #-32
	mov	w2, #31
	bl	_clamp
	mov	x21, x0
	ldr	x8, [x19]
	ldr	x9, [x24]
	sdiv	w10, w20, w22
	cmp	x8, x9
	mov	w8, #-128
	mov	w9, #-64
	csel	w8, w9, w8, eq
	add	w0, w10, w8
	mov	w1, #-16
	mov	w2, #15
	bl	_clamp
	mov	x20, x0
	ldr	w1, [x26]
	stp	x23, x22, [sp, #16]
	stp	x21, x20, [sp]
Lloh29:
	adrp	x2, l_.str.2@PAGE
Lloh30:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_ATH5K_DBG_UNLIMIT
Lloh31:
	adrp	x22, _AR5K_PHY_IQ@GOTPAGE
Lloh32:
	ldr	x22, [x22, _AR5K_PHY_IQ@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh33:
	adrp	x8, _AR5K_PHY_IQ_CORR_Q_I_COFF@GOTPAGE
Lloh34:
	ldr	x8, [x8, _AR5K_PHY_IQ_CORR_Q_I_COFF@GOTPAGEOFF]
Lloh35:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x3, x21
	bl	_AR5K_REG_WRITE_BITS
	ldr	w1, [x22]
Lloh36:
	adrp	x8, _AR5K_PHY_IQ_CORR_Q_Q_COFF@GOTPAGE
Lloh37:
	ldr	x8, [x8, _AR5K_PHY_IQ_CORR_Q_Q_COFF@GOTPAGEOFF]
Lloh38:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x3, x20
	bl	_AR5K_REG_WRITE_BITS
	ldr	w1, [x22]
Lloh39:
	adrp	x8, _AR5K_PHY_IQ_CORR_ENABLE@GOTPAGE
Lloh40:
	ldr	x8, [x8, _AR5K_PHY_IQ_CORR_ENABLE@GOTPAGEOFF]
Lloh41:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_AR5K_REG_ENABLE_BITS
	ldr	w1, [x22]
Lloh42:
	adrp	x8, _AR5K_PHY_IQ_CAL_NUM_LOG_MAX@GOTPAGE
Lloh43:
	ldr	x8, [x8, _AR5K_PHY_IQ_CAL_NUM_LOG_MAX@GOTPAGEOFF]
Lloh44:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w3, #15
	bl	_AR5K_REG_WRITE_BITS
	ldr	w1, [x22]
Lloh45:
	adrp	x8, _AR5K_PHY_IQ_RUN@GOTPAGE
Lloh46:
	ldr	x8, [x8, _AR5K_PHY_IQ_RUN@GOTPAGEOFF]
Lloh47:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_AR5K_REG_ENABLE_BITS
	mov	w0, #0
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpAdd	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AR5K_PHY_IQ,4,2                ; @AR5K_PHY_IQ
	.comm	_AR5K_PHY_IQ_RUN,4,2            ; @AR5K_PHY_IQ_RUN
	.comm	_ATH5K_DEBUG_CALIBRATE,4,2      ; @ATH5K_DEBUG_CALIBRATE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"I/Q calibration still running"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_AR5K_PHY_IQRES_CAL_CORR,4,2    ; @AR5K_PHY_IQRES_CAL_CORR
	.comm	_AR5K_PHY_IQRES_CAL_PWR_I,4,2   ; @AR5K_PHY_IQRES_CAL_PWR_I
	.comm	_AR5K_PHY_IQRES_CAL_PWR_Q,4,2   ; @AR5K_PHY_IQRES_CAL_PWR_Q
l_.str.1:                               ; @.str.1
	.asciz	"iq_corr:%x i_pwr:%x q_pwr:%x"

	.comm	_AR5K_AR5211,8,3                ; @AR5K_AR5211
	.comm	_ECANCELED,4,2                  ; @ECANCELED
l_.str.2:                               ; @.str.2
	.asciz	"new I:%d Q:%d (i_coffd:%x q_coffd:%x)"

	.comm	_AR5K_PHY_IQ_CORR_Q_I_COFF,4,2  ; @AR5K_PHY_IQ_CORR_Q_I_COFF
	.comm	_AR5K_PHY_IQ_CORR_Q_Q_COFF,4,2  ; @AR5K_PHY_IQ_CORR_Q_Q_COFF
	.comm	_AR5K_PHY_IQ_CORR_ENABLE,4,2    ; @AR5K_PHY_IQ_CORR_ENABLE
	.comm	_AR5K_PHY_IQ_CAL_NUM_LOG_MAX,4,2 ; @AR5K_PHY_IQ_CAL_NUM_LOG_MAX
	.no_dead_strip	_ath5k_hw_rf511x_iq_calibrate
.subsections_via_symbols
