	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function il4965_gain_computation
_il4965_gain_computation:               ## @il4965_gain_computation
	.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
	movl	%ecx, %r14d
	movq	%rdi, %r13
	movq	(%rdi), %rcx
	movq	$0, (%rcx,%rdx,8)
	movq	_NUM_RX_CHAINS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%r8d, %eax
	jle	LBB0_7
## %bb.1:
	movq	%rsi, %r15
	movslq	%r8d, %rbx
	movq	_CHAIN_NOISE_DELTA_GAIN_INIT_VAL@GOTPCREL(%rip), %r12
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	$0, (%rcx,%rbx,8)
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%rbx
	movslq	%eax, %rdx
	cmpq	%rdx, %rbx
	jge	LBB0_7
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	16(%r13), %rdx
	cmpl	$0, (%rdx,%rbx,4)
	jne	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rcx,%rbx,8), %rdx
	cmpq	(%r12), %rdx
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r15,%rbx,4), %eax
	subl	%r14d, %eax
	addl	%eax, %eax
	leal	(%rax,%rax,4), %eax
	cltq
	imulq	$-2004318071, %rax, %rdx        ## imm = 0x88888889
	shrq	$32, %rdx
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	sarl	$3, %eax
	addl	%edx, %eax
	movslq	%eax, %rdi
	movq	%rdi, (%rcx,%rbx,8)
	movq	_CHAIN_NOISE_MAX_DELTA_GAIN_CODE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	callq	_min
	movq	(%r13), %rcx
	orq	$4, %rax
	movq	%rax, (%rcx,%rbx,8)
	movq	_NUM_RX_CHAINS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_6
LBB0_7:
	movq	(%rcx), %rsi
	movq	8(%rcx), %rdx
	movq	16(%rcx), %rcx
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_D_CALIB
	cmpl	$0, 8(%r13)
	jne	LBB0_11
## %bb.8:
	movl	$1, 8(%r13)
	leaq	-56(%rbp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	$16, %edx
	callq	_memset
	movq	_IL_PHY_CALIBRATE_DIFF_GAIN_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)
	movq	(%r13), %rax
	movdqu	(%rax), %xmm0
	pshufd	$232, %xmm0, %xmm0              ## xmm0 = xmm0[0,2,2,3]
	movq	%xmm0, -56(%rbp)
	movl	16(%rax), %eax
	movl	%eax, -48(%rbp)
	movq	_C_PHY_CALIBRATION@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	$16, %edx
	movq	%r14, %rcx
	callq	_il_send_cmd_pdu
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_D_CALIB
LBB0_10:
	movq	_IL_CHAIN_NOISE_CALIBRATED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%r13)
LBB0_11:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NUM_RX_CHAINS,4,2              ## @NUM_RX_CHAINS
	.comm	_CHAIN_NOISE_DELTA_GAIN_INIT_VAL,8,3 ## @CHAIN_NOISE_DELTA_GAIN_INIT_VAL
	.comm	_CHAIN_NOISE_MAX_DELTA_GAIN_CODE,8,3 ## @CHAIN_NOISE_MAX_DELTA_GAIN_CODE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"delta_gain_codes: a %d b %d c %d\n"

	.comm	_IL_PHY_CALIBRATE_DIFF_GAIN_CMD,4,2 ## @IL_PHY_CALIBRATE_DIFF_GAIN_CMD
	.comm	_C_PHY_CALIBRATION,4,2          ## @C_PHY_CALIBRATION
L_.str.1:                               ## @.str.1
	.asciz	"fail sending cmd C_PHY_CALIBRATION\n"

	.comm	_IL_CHAIN_NOISE_CALIBRATED,4,2  ## @IL_CHAIN_NOISE_CALIBRATED
	.no_dead_strip	_il4965_gain_computation
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function il4965_gain_computation
_il4965_gain_computation:               ; @il4965_gain_computation
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x19, x0
	ldr	x8, [x0]
	str	xzr, [x8, x2, lsl #3]
Lloh0:
	adrp	x22, _NUM_RX_CHAINS@GOTPAGE
Lloh1:
	ldr	x22, [x22, _NUM_RX_CHAINS@GOTPAGEOFF]
	ldr	w9, [x22]
	cmp	w9, w4
	b.le	LBB0_7
; %bb.1:
	mov	x20, x3
	mov	x21, x1
	sxtw	x23, w4
Lloh2:
	adrp	x24, _CHAIN_NOISE_DELTA_GAIN_INIT_VAL@GOTPAGE
Lloh3:
	ldr	x24, [x24, _CHAIN_NOISE_DELTA_GAIN_INIT_VAL@GOTPAGEOFF]
	mov	w25, #34953
	movk	w25, #34952, lsl #16
Lloh4:
	adrp	x26, _CHAIN_NOISE_MAX_DELTA_GAIN_CODE@GOTPAGE
Lloh5:
	ldr	x26, [x26, _CHAIN_NOISE_MAX_DELTA_GAIN_CODE@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	str	xzr, [x8, x23, lsl #3]
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x23, x23, #1
	cmp	x23, w9, sxtw
	b.ge	LBB0_7
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x10, [x19, #16]
	ldr	w10, [x10, x23, lsl #2]
	cbnz	w10, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x10, [x8, x23, lsl #3]
	ldr	x11, [x24]
	cmp	x10, x11
	b.ne	LBB0_2
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w9, [x21, x23, lsl #2]
	sub	w9, w9, w20
	add	w9, w9, w9, lsl #2
	lsl	w9, w9, #1
	smull	x10, w9, w25
	lsr	x10, x10, #32
	add	w9, w10, w9
	asr	w10, w9, #3
	add	w9, w10, w9, lsr #31
	sxtw	x0, w9
	lsl	x27, x23, #3
	str	x0, [x8, x27]
	ldr	x1, [x26]
	bl	_min
	ldr	x8, [x19]
	orr	x9, x0, #0x4
	str	x9, [x8, x27]
	ldr	w9, [x22]
	b	LBB0_3
LBB0_7:
	ldr	q0, [x8]
	ldr	x8, [x8, #16]
	str	x8, [sp, #16]
	str	q0, [sp]
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	bl	_D_CALIB
	ldr	w8, [x19, #8]
	cbnz	w8, LBB0_11
; %bb.8:
	mov	w8, #1
	str	w8, [x19, #8]
	add	x0, sp, #32
	mov	w1, #0
	mov	w2, #16
	bl	_memset
Lloh8:
	adrp	x8, _IL_PHY_CALIBRATE_DIFF_GAIN_CMD@GOTPAGE
Lloh9:
	ldr	x8, [x8, _IL_PHY_CALIBRATE_DIFF_GAIN_CMD@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	str	w8, [sp, #44]
	ldr	x8, [x19]
	ldr	q0, [x8]
	xtn.2s	v0, v0
	str	d0, [sp, #32]
	ldr	x8, [x8, #16]
	str	w8, [sp, #40]
Lloh11:
	adrp	x8, _C_PHY_CALIBRATION@GOTPAGE
Lloh12:
	ldr	x8, [x8, _C_PHY_CALIBRATION@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	add	x3, sp, #32
	mov	x0, x19
	mov	w2, #16
	bl	_il_send_cmd_pdu
	cbz	w0, LBB0_10
; %bb.9:
Lloh14:
	adrp	x0, l_.str.1@PAGE
Lloh15:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_D_CALIB
LBB0_10:
Lloh16:
	adrp	x8, _IL_CHAIN_NOISE_CALIBRATED@GOTPAGE
Lloh17:
	ldr	x8, [x8, _IL_CHAIN_NOISE_CALIBRATED@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	str	w8, [x19, #12]
LBB0_11:
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_NUM_RX_CHAINS,4,2              ; @NUM_RX_CHAINS
	.comm	_CHAIN_NOISE_DELTA_GAIN_INIT_VAL,8,3 ; @CHAIN_NOISE_DELTA_GAIN_INIT_VAL
	.comm	_CHAIN_NOISE_MAX_DELTA_GAIN_CODE,8,3 ; @CHAIN_NOISE_MAX_DELTA_GAIN_CODE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"delta_gain_codes: a %d b %d c %d\n"

	.comm	_IL_PHY_CALIBRATE_DIFF_GAIN_CMD,4,2 ; @IL_PHY_CALIBRATE_DIFF_GAIN_CMD
	.comm	_C_PHY_CALIBRATION,4,2          ; @C_PHY_CALIBRATION
l_.str.1:                               ; @.str.1
	.asciz	"fail sending cmd C_PHY_CALIBRATION\n"

	.comm	_IL_CHAIN_NOISE_CALIBRATED,4,2  ; @IL_CHAIN_NOISE_CALIBRATED
	.no_dead_strip	_il4965_gain_computation
.subsections_via_symbols
