	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_iwlagn_set_rxon_chain          ## -- Begin function iwlagn_set_rxon_chain
	.p2align	4, 0x90
_iwlagn_set_rxon_chain:                 ## @iwlagn_set_rxon_chain
	.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, %r15
	movq	%rdi, %r13
	callq	_is_single_rx_stream
	movl	%eax, %ebx
	movq	_STATUS_POWER_PMI@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	36(%r13), %rsi
	callq	_test_bit
	movl	32(%r13), %r14d
	testl	%r14d, %r14d
	jne	LBB0_2
## %bb.1:
	movq	24(%r13), %rcx
	movl	(%rcx), %r14d
LBB0_2:
	movq	16(%r13), %rcx
	movq	(%rcx), %rcx
	testq	%rcx, %rcx
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	je	LBB0_7
## %bb.3:
	cmpq	$0, (%rcx)
	je	LBB0_7
## %bb.4:
	cmpq	$0, 8(%r13)
	jne	LBB0_6
## %bb.5:
	movq	(%r13), %rax
	movq	_IWL_BT_COEX_TRAFFIC_LOAD_HIGH@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_7
LBB0_6:
	movl	%r14d, %edi
	callq	_first_antenna
	movl	%eax, %r14d
LBB0_7:
	movq	_RXON_RX_CHAIN_VALID_POS@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%r14d, %r15d
	shll	%cl, %r15d
	movq	%r13, %rdi
	callq	_iwl_get_active_rx_chain_count
	movl	%eax, %ebx
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_iwl_get_idle_rx_chain_count
	movl	%eax, %r12d
	movl	%r14d, %edi
	callq	_iwl_count_chain_bitmap
	cmpl	%ebx, %eax
	cmovll	%eax, %ebx
	cmpl	%r12d, %eax
	cmovll	%eax, %r12d
	movq	_RXON_RX_CHAIN_MIMO_CNT_POS@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%ebx, %eax
	shll	%cl, %eax
	orl	%r15d, %eax
	movq	_RXON_RX_CHAIN_CNT_POS@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	%r12d, %edi
	shll	%cl, %edi
	orl	%eax, %edi
	callq	_cpu_to_le16
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movl	%eax, (%rdx)
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_8
LBB0_11:
	movq	_RXON_RX_CHAIN_MIMO_FORCE_MSK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%ecx, %eax
LBB0_12:
	movl	%eax, (%rdx)
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rdi
	movl	%eax, %edx
	movl	%ebx, %ecx
	movl	%r12d, %r8d
	callq	_IWL_DEBUG_ASSOC
	testl	%ebx, %ebx
	sete	%al
	testl	%r12d, %r12d
	sete	%cl
	orb	%al, %cl
	cmpl	%r12d, %ebx
	setl	%al
	orb	%cl, %al
	movzbl	%al, %edi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_WARN_ON                        ## TAILCALL
LBB0_8:
	movq	_IWL_NUM_RX_CHAINS_SINGLE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %ebx
	jl	LBB0_11
## %bb.9:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_11
## %bb.10:
	movq	_RXON_RX_CHAIN_MIMO_FORCE_MSK@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_STATUS_POWER_PMI,4,2           ## @STATUS_POWER_PMI
	.comm	_IWL_BT_COEX_TRAFFIC_LOAD_HIGH,8,3 ## @IWL_BT_COEX_TRAFFIC_LOAD_HIGH
	.comm	_RXON_RX_CHAIN_VALID_POS,4,2    ## @RXON_RX_CHAIN_VALID_POS
	.comm	_RXON_RX_CHAIN_MIMO_CNT_POS,4,2 ## @RXON_RX_CHAIN_MIMO_CNT_POS
	.comm	_RXON_RX_CHAIN_CNT_POS,4,2      ## @RXON_RX_CHAIN_CNT_POS
	.comm	_IWL_NUM_RX_CHAINS_SINGLE,4,2   ## @IWL_NUM_RX_CHAINS_SINGLE
	.comm	_RXON_RX_CHAIN_MIMO_FORCE_MSK,4,2 ## @RXON_RX_CHAIN_MIMO_FORCE_MSK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"rx_chain=0x%X active=%d idle=%d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_iwlagn_set_rxon_chain          ; -- Begin function iwlagn_set_rxon_chain
	.p2align	2
_iwlagn_set_rxon_chain:                 ; @iwlagn_set_rxon_chain
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x20, x1
	mov	x19, x0
	bl	_is_single_rx_stream
	mov	x21, x0
Lloh0:
	adrp	x8, _STATUS_POWER_PMI@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STATUS_POWER_PMI@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	add	x1, x19, #36
	bl	_test_bit
	mov	x22, x0
	ldr	w23, [x19, #32]
	cbnz	w23, LBB0_2
; %bb.1:
	ldr	x8, [x19, #24]
	ldr	w23, [x8]
LBB0_2:
	ldr	x8, [x19, #16]
	ldr	x8, [x8]
	cbz	x8, LBB0_7
; %bb.3:
	ldr	x8, [x8]
	cbz	x8, LBB0_7
; %bb.4:
	ldr	x8, [x19, #8]
	cbnz	x8, LBB0_6
; %bb.5:
	ldr	x8, [x19]
Lloh3:
	adrp	x9, _IWL_BT_COEX_TRAFFIC_LOAD_HIGH@GOTPAGE
Lloh4:
	ldr	x9, [x9, _IWL_BT_COEX_TRAFFIC_LOAD_HIGH@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.lt	LBB0_7
LBB0_6:
	mov	x0, x23
	bl	_first_antenna
	mov	x23, x0
LBB0_7:
Lloh6:
	adrp	x8, _RXON_RX_CHAIN_VALID_POS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _RXON_RX_CHAIN_VALID_POS@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	lsl	w26, w23, w8
	mov	x0, x19
	bl	_iwl_get_active_rx_chain_count
	mov	x24, x0
	mov	x0, x19
	mov	x1, x24
	bl	_iwl_get_idle_rx_chain_count
	mov	x25, x0
	mov	x0, x23
	bl	_iwl_count_chain_bitmap
	cmp	w0, w24
	csel	w23, w0, w24, lt
	cmp	w0, w25
	csel	w24, w0, w25, lt
Lloh9:
	adrp	x8, _RXON_RX_CHAIN_MIMO_CNT_POS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _RXON_RX_CHAIN_MIMO_CNT_POS@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	lsl	w8, w23, w8
	orr	w8, w8, w26
Lloh12:
	adrp	x9, _RXON_RX_CHAIN_CNT_POS@GOTPAGE
Lloh13:
	ldr	x9, [x9, _RXON_RX_CHAIN_CNT_POS@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	lsl	w9, w24, w9
	orr	w0, w8, w9
	bl	_cpu_to_le16
	str	w0, [x20]
	cbnz	w21, LBB0_9
; %bb.8:
Lloh15:
	adrp	x8, _IWL_NUM_RX_CHAINS_SINGLE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _IWL_NUM_RX_CHAINS_SINGLE@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	cmp	w23, w8
	ccmp	w22, #0, #0, ge
	b.eq	LBB0_11
LBB0_9:
Lloh18:
	adrp	x8, _RXON_RX_CHAIN_MIMO_FORCE_MSK@GOTPAGE
Lloh19:
	ldr	x8, [x8, _RXON_RX_CHAIN_MIMO_FORCE_MSK@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	bic	w2, w0, w8
LBB0_10:
	str	w2, [x20]
Lloh21:
	adrp	x1, l_.str@PAGE
Lloh22:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x3, x23
	mov	x4, x24
	bl	_IWL_DEBUG_ASSOC
	cmp	w23, #0
	ccmp	w24, #0, #4, ne
	ccmp	w23, w24, #8, ne
	cset	w0, lt
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_WARN_ON
LBB0_11:
Lloh23:
	adrp	x8, _RXON_RX_CHAIN_MIMO_FORCE_MSK@GOTPAGE
Lloh24:
	ldr	x8, [x8, _RXON_RX_CHAIN_MIMO_FORCE_MSK@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	orr	w2, w8, w0
	b	LBB0_10
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_STATUS_POWER_PMI,4,2           ; @STATUS_POWER_PMI
	.comm	_IWL_BT_COEX_TRAFFIC_LOAD_HIGH,8,3 ; @IWL_BT_COEX_TRAFFIC_LOAD_HIGH
	.comm	_RXON_RX_CHAIN_VALID_POS,4,2    ; @RXON_RX_CHAIN_VALID_POS
	.comm	_RXON_RX_CHAIN_MIMO_CNT_POS,4,2 ; @RXON_RX_CHAIN_MIMO_CNT_POS
	.comm	_RXON_RX_CHAIN_CNT_POS,4,2      ; @RXON_RX_CHAIN_CNT_POS
	.comm	_IWL_NUM_RX_CHAINS_SINGLE,4,2   ; @IWL_NUM_RX_CHAINS_SINGLE
	.comm	_RXON_RX_CHAIN_MIMO_FORCE_MSK,4,2 ; @RXON_RX_CHAIN_MIMO_FORCE_MSK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"rx_chain=0x%X active=%d idle=%d\n"

.subsections_via_symbols
