	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt7615_add_interface
_mt7615_add_interface:                  ## @mt7615_add_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	16(%rsi), %r12
	movq	(%rdi), %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	movl	20(%r15), %eax
	movl	%eax, %ecx
	notl	%ecx
	bsfl	%ecx, %ecx
	cmpl	$-1, %eax
	cmovel	%eax, %ecx
	movl	%ecx, (%r12)
	movq	_MT7615_MAX_INTERFACES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ecx
	jge	LBB0_1
## %bb.2:
	movl	8(%r14), %edi
	movl	16(%r15), %esi
	callq	_get_omac_idx
	testl	%eax, %eax
	js	LBB0_1
## %bb.3:
	movl	%eax, 4(%r12)
	movq	$0, 24(%r12)
	movl	(%r12), %eax
	movq	_MT7615_MAX_WMM_SETS@GOTPCREL(%rip), %rcx
	cltd
	idivl	(%rcx)
	movl	%edx, 8(%r12)
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	_mt7615_mcu_set_dev_info
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_5
## %bb.4:
	movl	(%r12), %edi
	callq	_BIT
	orl	%eax, 20(%r15)
	movl	4(%r12), %edi
	callq	_BIT
	orl	%eax, 16(%r15)
	movq	_MT7615_WTBL_RESERVED@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movslq	(%r12), %rcx
	subq	%rcx, %rax
	leaq	12(%r12), %rbx
	movl	%eax, 12(%r12)
	movl	$-1, 16(%r12)
	movq	8(%r15), %rcx
	movl	(%rcx,%rax,4), %edi
	movq	%rbx, %rsi
	callq	_rcu_assign_pointer
	movq	(%r14), %rsi
	movq	(%rsi), %rax
	movq	%rbx, (%rax)
	movq	%r15, %rdi
	callq	_mt76_txq_init
	xorl	%ebx, %ebx
	jmp	LBB0_5
LBB0_1:
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_5:
	movq	%r15, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MT7615_MAX_INTERFACES,4,2      ## @MT7615_MAX_INTERFACES
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_MT7615_MAX_WMM_SETS,4,2        ## @MT7615_MAX_WMM_SETS
	.comm	_MT7615_WTBL_RESERVED,4,2       ## @MT7615_WTBL_RESERVED
	.no_dead_strip	_mt7615_add_interface
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt7615_add_interface
_mt7615_add_interface:                  ; @mt7615_add_interface
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x1
	ldr	x21, [x1, #16]
	ldr	x19, [x0]
	mov	x0, x19
	bl	_mutex_lock
	ldr	w8, [x19, #20]
	mvn	w9, w8
	rbit	w9, w9
	clz	w9, w9
	cmn	w8, #1
	csinv	w8, w9, wzr, ne
	str	w8, [x21]
Lloh0:
	adrp	x9, _MT7615_MAX_INTERFACES@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MT7615_MAX_INTERFACES@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ge	LBB0_4
; %bb.1:
	ldr	w0, [x20, #8]
	ldr	w1, [x19, #16]
	bl	_get_omac_idx
	tbnz	w0, #31, LBB0_4
; %bb.2:
	str	xzr, [x21, #24]
Lloh3:
	adrp	x8, _MT7615_MAX_WMM_SETS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MT7615_MAX_WMM_SETS@GOTPAGEOFF]
	ldr	w9, [x21]
Lloh5:
	ldr	w8, [x8]
	sdiv	w10, w9, w8
	msub	w8, w10, w8, w9
	stp	w0, w8, [x21, #4]
	mov	x0, x19
	mov	x1, x20
	mov	w2, #1
	bl	_mt7615_mcu_set_dev_info
	mov	x22, x0
	cbnz	w0, LBB0_5
; %bb.3:
	ldr	w0, [x21]
	bl	_BIT
	ldr	w8, [x19, #20]
	orr	w8, w8, w0
	str	w8, [x19, #20]
	ldr	w0, [x21, #4]
	bl	_BIT
	ldr	w8, [x19, #16]
Lloh6:
	adrp	x9, _MT7615_WTBL_RESERVED@GOTPAGE
Lloh7:
	ldr	x9, [x9, _MT7615_WTBL_RESERVED@GOTPAGEOFF]
	orr	w8, w8, w0
Lloh8:
	ldr	w9, [x9]
	ldr	w10, [x21]
	sub	w9, w9, w10
	str	w9, [x21, #12]!
	str	w8, [x19, #16]
	mov	w8, #-1
	str	w8, [x21, #4]
	ldr	x8, [x19, #8]
	ldr	w0, [x8, w9, sxtw #2]
	mov	x1, x21
	bl	_rcu_assign_pointer
	ldr	x1, [x20]
	ldr	x8, [x1]
	str	x21, [x8]
	mov	x0, x19
	bl	_mt76_txq_init
	b	LBB0_5
LBB0_4:
Lloh9:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_5:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x22
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_MT7615_MAX_INTERFACES,4,2      ; @MT7615_MAX_INTERFACES
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_MT7615_MAX_WMM_SETS,4,2        ; @MT7615_MAX_WMM_SETS
	.comm	_MT7615_WTBL_RESERVED,4,2       ; @MT7615_WTBL_RESERVED
	.no_dead_strip	_mt7615_add_interface
.subsections_via_symbols
