	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ath9k_htc_remove_interface
_ath9k_htc_remove_interface:            ## @ath9k_htc_remove_interface
	.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, %r12
	movq	(%rdi), %rbx
	movl	44(%rbx), %edi
	callq	_ath9k_hw_common
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	8(%r12), %r15
	leaq	20(%rbx), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	%rbx, %rdi
	callq	_ath9k_htc_ps_wakeup
	leaq	-48(%rbp), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	leaq	-44(%rbp), %rdi
	movl	4(%r12), %esi
	movq	_ETH_ALEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_memcpy
	movl	(%r15), %eax
	movl	%eax, -48(%rbp)
	movq	_WMI_VAP_REMOVE_CMDID@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r13, %rsi
	callq	_WMI_CMD_BUF
	decl	40(%rbx)
	movb	(%r15), %cl
	movl	$-2, %eax
	roll	%cl, %eax
	andl	%eax, (%rbx)
	cmpq	%r12, 32(%rbx)
	jne	LBB0_2
## %bb.1:
	movq	$0, 32(%rbx)
LBB0_2:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ath9k_htc_remove_station
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_DEC_VIF
	movl	(%r12), %eax
	movq	_NL80211_IFTYPE_AP@GOTPCREL(%rip), %r13
	cmpl	(%r13), %eax
	je	LBB0_5
## %bb.3:
	movq	_NL80211_IFTYPE_MESH_POINT@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_5
## %bb.4:
	movq	_NL80211_IFTYPE_ADHOC@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_6
LBB0_5:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_ath9k_htc_remove_bslot
LBB0_6:
	movq	%rbx, %rdi
	callq	_ath9k_htc_set_opmode
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_ath9k_htc_set_mac_bssid_mask
	movl	(%r12), %eax
	cmpl	(%r13), %eax
	jne	LBB0_10
## %bb.7:
	cmpq	$0, 8(%rbx)
	jne	LBB0_10
## %bb.8:
	movl	$0, 16(%rbx)
	movl	24(%rbx), %edi
	movq	_IEEE80211_IFACE_ITER_RESUME_ALL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ath9k_htc_vif_iter@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rcx
	callq	_ieee80211_iterate_active_interfaces_atomic
	cmpl	$0, 16(%rbx)
	jne	LBB0_10
## %bb.9:
	movq	%rbx, %rdi
	callq	_ath9k_htc_stop_ani
LBB0_10:
	movq	_CONFIG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r15), %ecx
	leaq	L_.str.1(%rip), %rdx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_ath_dbg
	movq	%rbx, %rdi
	callq	_ath9k_htc_ps_restore
	movq	%r14, %rdi
	callq	_mutex_unlock
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ETH_ALEN,4,2                   ## @ETH_ALEN
	.comm	_WMI_VAP_REMOVE_CMDID,4,2       ## @WMI_VAP_REMOVE_CMDID
	.comm	_NL80211_IFTYPE_AP,4,2          ## @NL80211_IFTYPE_AP
	.comm	_NL80211_IFTYPE_MESH_POINT,4,2  ## @NL80211_IFTYPE_MESH_POINT
	.comm	_NL80211_IFTYPE_ADHOC,4,2       ## @NL80211_IFTYPE_ADHOC
	.comm	_IEEE80211_IFACE_ITER_RESUME_ALL,4,2 ## @IEEE80211_IFACE_ITER_RESUME_ALL
	.comm	_ath9k_htc_vif_iter,4,2         ## @ath9k_htc_vif_iter
	.comm	_CONFIG,4,2                     ## @CONFIG
	.section	__TEXT,__cstring,cstring_literals
L_.str.1:                               ## @.str.1
	.asciz	"Detach Interface at idx: %d\n"

	.no_dead_strip	_ath9k_htc_remove_interface
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ath9k_htc_remove_interface
_ath9k_htc_remove_interface:            ; @ath9k_htc_remove_interface
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x22, x1
	ldr	x19, [x0]
	ldr	w0, [x19, #44]
	bl	_ath9k_hw_common
	mov	x21, x0
	ldr	x23, [x22, #8]
	add	x20, x19, #20
	mov	x0, x20
	bl	_mutex_lock
	mov	x0, x19
	bl	_ath9k_htc_ps_wakeup
	add	x24, sp, #8
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #8
	bl	_memset
	orr	x0, x24, #0x4
	ldr	w1, [x22, #4]
Lloh0:
	adrp	x8, _ETH_ALEN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ETH_ALEN@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	bl	_memcpy
	ldr	w8, [x23]
	str	w8, [sp, #8]
Lloh3:
	adrp	x8, _WMI_VAP_REMOVE_CMDID@GOTPAGE
Lloh4:
	ldr	x8, [x8, _WMI_VAP_REMOVE_CMDID@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	add	x1, sp, #8
	bl	_WMI_CMD_BUF
	ldr	w8, [x19, #40]
	sub	w8, w8, #1
	str	w8, [x19, #40]
	ldr	w8, [x23]
	mov	w9, #1
	lsl	w8, w9, w8
	ldr	w9, [x19]
	bic	w8, w9, w8
	str	w8, [x19]
	ldr	x8, [x19, #32]
	cmp	x8, x22
	b.ne	LBB0_2
; %bb.1:
	str	xzr, [x19, #32]
LBB0_2:
	mov	x0, x19
	mov	x1, x22
	mov	x2, #0
	bl	_ath9k_htc_remove_station
	ldr	w1, [x22]
	mov	x0, x19
	bl	_DEC_VIF
	ldr	w8, [x22]
Lloh6:
	adrp	x24, _NL80211_IFTYPE_AP@GOTPAGE
Lloh7:
	ldr	x24, [x24, _NL80211_IFTYPE_AP@GOTPAGEOFF]
	ldr	w9, [x24]
	cmp	w8, w9
	b.eq	LBB0_5
; %bb.3:
Lloh8:
	adrp	x9, _NL80211_IFTYPE_MESH_POINT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _NL80211_IFTYPE_MESH_POINT@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	w8, w9
	b.eq	LBB0_5
; %bb.4:
Lloh11:
	adrp	x9, _NL80211_IFTYPE_ADHOC@GOTPAGE
Lloh12:
	ldr	x9, [x9, _NL80211_IFTYPE_ADHOC@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_6
LBB0_5:
	mov	x0, x19
	mov	x1, x22
	bl	_ath9k_htc_remove_bslot
LBB0_6:
	mov	x0, x19
	bl	_ath9k_htc_set_opmode
	mov	x0, x19
	mov	x1, x22
	bl	_ath9k_htc_set_mac_bssid_mask
	ldr	w8, [x22]
	ldr	w9, [x24]
	cmp	w8, w9
	b.ne	LBB0_10
; %bb.7:
	ldr	x8, [x19, #8]
	cbnz	x8, LBB0_10
; %bb.8:
	str	wzr, [x19, #16]
	ldr	w0, [x19, #24]
Lloh14:
	adrp	x8, _IEEE80211_IFACE_ITER_RESUME_ALL@GOTPAGE
Lloh15:
	ldr	x8, [x8, _IEEE80211_IFACE_ITER_RESUME_ALL@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
Lloh17:
	adrp	x8, _ath9k_htc_vif_iter@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ath9k_htc_vif_iter@GOTPAGEOFF]
Lloh19:
	ldr	w2, [x8]
	mov	x3, x19
	bl	_ieee80211_iterate_active_interfaces_atomic
	ldr	w8, [x19, #16]
	cbnz	w8, LBB0_10
; %bb.9:
	mov	x0, x19
	bl	_ath9k_htc_stop_ani
LBB0_10:
Lloh20:
	adrp	x8, _CONFIG@GOTPAGE
Lloh21:
	ldr	x8, [x8, _CONFIG@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	ldr	w3, [x23]
Lloh23:
	adrp	x2, l_.str.1@PAGE
Lloh24:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_ath_dbg
	mov	x0, x19
	bl	_ath9k_htc_ps_restore
	mov	x0, x20
	bl	_mutex_unlock
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_ETH_ALEN,4,2                   ; @ETH_ALEN
	.comm	_WMI_VAP_REMOVE_CMDID,4,2       ; @WMI_VAP_REMOVE_CMDID
	.comm	_NL80211_IFTYPE_AP,4,2          ; @NL80211_IFTYPE_AP
	.comm	_NL80211_IFTYPE_MESH_POINT,4,2  ; @NL80211_IFTYPE_MESH_POINT
	.comm	_NL80211_IFTYPE_ADHOC,4,2       ; @NL80211_IFTYPE_ADHOC
	.comm	_IEEE80211_IFACE_ITER_RESUME_ALL,4,2 ; @IEEE80211_IFACE_ITER_RESUME_ALL
	.comm	_ath9k_htc_vif_iter,4,2         ; @ath9k_htc_vif_iter
	.comm	_CONFIG,4,2                     ; @CONFIG
	.section	__TEXT,__cstring,cstring_literals
l_.str.1:                               ; @.str.1
	.asciz	"Detach Interface at idx: %d\n"

	.no_dead_strip	_ath9k_htc_remove_interface
.subsections_via_symbols
