	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar9003_hw_per_calibration
_ar9003_hw_per_calibration:             ## @ar9003_hw_per_calibration
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r14
	movl	%edx, %ebx
	movq	%rdi, %r15
	movq	8(%rdi), %rdx
	movq	(%rcx), %rax
	movq	8(%rcx), %r13
	movq	_CAL_RUNNING@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_13
## %bb.1:
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movq	_AR_PHY_TIMING4@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_REG_READ
	movq	_AR_PHY_TIMING4_DO_CAL@GOTPCREL(%rip), %rcx
	xorl	%r12d, %r12d
	testl	%eax, (%rcx)
	jne	LBB0_15
## %bb.2:
	movq	%r15, %rdi
	callq	*24(%r13)
	movq	(%r15), %rax
	incq	%rax
	movq	%rax, (%r15)
	cmpq	(%r13), %rax
	jge	LBB0_3
## %bb.12:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_ar9003_hw_setup_calibration
	jmp	LBB0_15
LBB0_13:
	movl	8(%r13), %eax
	xorl	%r12d, %r12d
	testl	%eax, (%rdx)
	jne	LBB0_15
## %bb.14:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_ath9k_hw_reset_calibration
	jmp	LBB0_15
LBB0_3:
	movq	_AR9300_MAX_CHAINS@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	testl	%r8d, %r8d
	je	LBB0_4
## %bb.5:
	leal	-1(%r8), %ecx
	movl	%r8d, %eax
	andl	$3, %eax
	cmpl	$3, %ecx
	jae	LBB0_7
## %bb.6:
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	jmp	LBB0_9
LBB0_4:
	xorl	%esi, %esi
	jmp	LBB0_11
LBB0_7:
	andl	$-4, %r8d
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%edi, %edi
	btl	%ecx, %ebx
	setb	%dil
	leal	1(%rcx), %edx
	btl	%edx, %ebx
	adcl	%esi, %edi
	incl	%edx
	movzbl	%dl, %edx
	xorl	%esi, %esi
	btl	%edx, %ebx
	setb	%sil
	leal	3(%rcx), %edx
	btl	%edx, %ebx
	adcl	%edi, %esi
	addl	$4, %ecx
	cmpl	%r8d, %ecx
	jne	LBB0_8
LBB0_9:
	testl	%eax, %eax
	je	LBB0_11
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	btl	%ecx, %ebx
	adcl	$0, %esi
	incl	%ecx
	decl	%eax
	jne	LBB0_10
LBB0_11:
	movq	%r15, %rdi
	callq	*16(%r13)
	movl	8(%r13), %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	orl	%eax, (%rcx)
	movq	_CAL_DONE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r14)
	movl	$1, %r12d
LBB0_15:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CAL_RUNNING,8,3                ## @CAL_RUNNING
	.comm	_AR_PHY_TIMING4,4,2             ## @AR_PHY_TIMING4
	.comm	_AR_PHY_TIMING4_DO_CAL,4,2      ## @AR_PHY_TIMING4_DO_CAL
	.comm	_AR9300_MAX_CHAINS,4,2          ## @AR9300_MAX_CHAINS
	.comm	_CAL_DONE,8,3                   ## @CAL_DONE
	.no_dead_strip	_ar9003_hw_per_calibration
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ; -- Begin function ar9003_hw_per_calibration
lCPI0_0:
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.long	2                               ; 0x2
	.long	3                               ; 0x3
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_ar9003_hw_per_calibration:             ; @ar9003_hw_per_calibration
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x3
	mov	x20, x0
	ldr	x22, [x0, #8]
	ldp	x8, x23, [x3]
Lloh0:
	adrp	x9, _CAL_RUNNING@GOTPAGE
Lloh1:
	ldr	x9, [x9, _CAL_RUNNING@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.1:
	mov	x21, x2
Lloh3:
	adrp	x8, _AR_PHY_TIMING4@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AR_PHY_TIMING4@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_REG_READ
Lloh6:
	adrp	x8, _AR_PHY_TIMING4_DO_CAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _AR_PHY_TIMING4_DO_CAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	tst	w8, w0
	b.ne	LBB0_6
; %bb.2:
	ldr	x8, [x23, #24]
	mov	x0, x20
	blr	x8
	ldr	x8, [x20]
	add	x8, x8, #1
	str	x8, [x20]
	ldr	x9, [x23]
	cmp	x8, x9
	b.ge	LBB0_8
; %bb.3:
	mov	x0, x20
	mov	x1, x19
	bl	_ar9003_hw_setup_calibration
	b	LBB0_6
LBB0_4:
	ldr	w8, [x22]
	ldr	w9, [x23, #8]
	tst	w9, w8
	b.ne	LBB0_6
; %bb.5:
	mov	x0, x20
	mov	x1, x19
	bl	_ath9k_hw_reset_calibration
LBB0_6:
	mov	w0, #0
LBB0_7:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_8:
Lloh9:
	adrp	x8, _AR9300_MAX_CHAINS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _AR9300_MAX_CHAINS@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cbz	w8, LBB0_11
; %bb.9:
	cmp	w8, #16
	b.hs	LBB0_12
; %bb.10:
	mov	w1, #0
	mov	w9, #0
	b	LBB0_15
LBB0_11:
	mov	w1, #0
	b	LBB0_17
LBB0_12:
	and	w9, w8, #0xfffffff0
	dup.4s	v0, w21
	movi.2d	v1, #0000000000000000
	mvni.4s	v2, #3
	mvni.4s	v3, #7
Lloh12:
	adrp	x10, lCPI0_0@PAGE
Lloh13:
	ldr	q4, [x10, lCPI0_0@PAGEOFF]
	mvni.4s	v5, #11
	movi.4s	v6, #1
	movi.4s	v7, #16
	mov	x10, x9
	movi.2d	v16, #0000000000000000
	movi.2d	v17, #0000000000000000
	movi.2d	v18, #0000000000000000
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	neg.4s	v19, v4
	ushl.4s	v19, v0, v19
	sub.4s	v20, v2, v4
	ushl.4s	v20, v0, v20
	sub.4s	v21, v3, v4
	ushl.4s	v21, v0, v21
	sub.4s	v22, v5, v4
	ushl.4s	v22, v0, v22
	and.16b	v19, v19, v6
	and.16b	v20, v20, v6
	and.16b	v21, v21, v6
	and.16b	v22, v22, v6
	add.4s	v1, v19, v1
	add.4s	v16, v20, v16
	add.4s	v17, v21, v17
	add.4s	v18, v22, v18
	add.4s	v4, v4, v7
	subs	w10, w10, #16
	b.ne	LBB0_13
; %bb.14:
	add.4s	v0, v16, v1
	add.4s	v0, v17, v0
	add.4s	v0, v18, v0
	addv.4s	s0, v0
	fmov	w1, s0
	b	LBB0_16
LBB0_15:
	lsr	w10, w21, w9
	and	w10, w10, #0x1
	add	w1, w10, w1
	add	w9, w9, #1
LBB0_16:
	cmp	w8, w9
	b.ne	LBB0_15
LBB0_17:
	ldr	x8, [x23, #16]
	mov	x0, x20
	blr	x8
	ldr	w8, [x23, #8]
	ldr	w9, [x22]
	orr	w8, w9, w8
	str	w8, [x22]
Lloh14:
	adrp	x8, _CAL_DONE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _CAL_DONE@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	str	x8, [x19]
	mov	w0, #1
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdr	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_CAL_RUNNING,8,3                ; @CAL_RUNNING
	.comm	_AR_PHY_TIMING4,4,2             ; @AR_PHY_TIMING4
	.comm	_AR_PHY_TIMING4_DO_CAL,4,2      ; @AR_PHY_TIMING4_DO_CAL
	.comm	_AR9300_MAX_CHAINS,4,2          ; @AR9300_MAX_CHAINS
	.comm	_CAL_DONE,8,3                   ; @CAL_DONE
	.no_dead_strip	_ar9003_hw_per_calibration
.subsections_via_symbols
