	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt7615_load_firmware
_mt7615_load_firmware:                  ## @mt7615_load_firmware
	.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	%rdi, %r14
	movq	_MT_TOP_MISC2@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_MT_TOP_MISC2_FW_STATE@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	callq	_mt76_get_field
	movq	_FW_STATE_FW_DOWNLOAD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_1
## %bb.3:
	movq	%r14, %rdi
	callq	_mt7615_load_patch
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_8
## %bb.4:
	movq	%r14, %rdi
	callq	_mt7615_load_ram
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_8
## %bb.5:
	movl	(%r15), %r15d
	movl	(%r12), %ebx
	movq	_FW_STATE_CR4_RDY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_FIELD_PREP
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	%ebx, %edx
	movl	%eax, %ecx
	movl	$500, %r8d                      ## imm = 0x1F4
	callq	_mt76_poll_msec
	testl	%eax, %eax
	je	LBB0_6
## %bb.7:
	movq	_MT_TXQ_FWDL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_mt76_queue_tx_cleanup
	movl	(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_dbg
	jmp	LBB0_8
LBB0_1:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
LBB0_2:
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_8:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_2
	.cfi_endproc
                                        ## -- End function
	.comm	_MT_TOP_MISC2,4,2               ## @MT_TOP_MISC2
	.comm	_MT_TOP_MISC2_FW_STATE,4,2      ## @MT_TOP_MISC2_FW_STATE
	.comm	_FW_STATE_FW_DOWNLOAD,8,3       ## @FW_STATE_FW_DOWNLOAD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Firmware is not ready for download\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_FW_STATE_CR4_RDY,4,2           ## @FW_STATE_CR4_RDY
L_.str.1:                               ## @.str.1
	.asciz	"Timeout for initializing firmware\n"

	.comm	_MT_TXQ_FWDL,4,2                ## @MT_TXQ_FWDL
L_.str.2:                               ## @.str.2
	.asciz	"Firmware init done\n"

	.no_dead_strip	_mt7615_load_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt7615_load_firmware
_mt7615_load_firmware:                  ; @mt7615_load_firmware
	.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	x19, x0
Lloh0:
	adrp	x20, _MT_TOP_MISC2@GOTPAGE
Lloh1:
	ldr	x20, [x20, _MT_TOP_MISC2@GOTPAGEOFF]
	ldr	w1, [x20]
Lloh2:
	adrp	x21, _MT_TOP_MISC2_FW_STATE@GOTPAGE
Lloh3:
	ldr	x21, [x21, _MT_TOP_MISC2_FW_STATE@GOTPAGEOFF]
	ldr	w2, [x21]
	bl	_mt76_get_field
Lloh4:
	adrp	x8, _FW_STATE_FW_DOWNLOAD@GOTPAGE
Lloh5:
	ldr	x8, [x8, _FW_STATE_FW_DOWNLOAD@GOTPAGEOFF]
Lloh6:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_5
; %bb.1:
	mov	x0, x19
	bl	_mt7615_load_patch
	cbnz	w0, LBB0_7
; %bb.2:
	mov	x0, x19
	bl	_mt7615_load_ram
	cbnz	w0, LBB0_7
; %bb.3:
	ldr	w20, [x20]
	ldr	w21, [x21]
Lloh7:
	adrp	x8, _FW_STATE_CR4_RDY@GOTPAGE
Lloh8:
	ldr	x8, [x8, _FW_STATE_CR4_RDY@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_FIELD_PREP
	mov	x3, x0
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	mov	w4, #500
	bl	_mt76_poll_msec
	cbz	w0, LBB0_8
; %bb.4:
Lloh10:
	adrp	x8, _MT_TXQ_FWDL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _MT_TXQ_FWDL@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_mt76_queue_tx_cleanup
	ldr	w0, [x19]
Lloh13:
	adrp	x1, l_.str.2@PAGE
Lloh14:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_dbg
	mov	w0, #0
	b	LBB0_7
LBB0_5:
	ldr	w0, [x19]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
LBB0_6:
	bl	_dev_err
Lloh17:
	adrp	x8, _EIO@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_7:
	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
LBB0_8:
	ldr	w0, [x19]
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_MT_TOP_MISC2,4,2               ; @MT_TOP_MISC2
	.comm	_MT_TOP_MISC2_FW_STATE,4,2      ; @MT_TOP_MISC2_FW_STATE
	.comm	_FW_STATE_FW_DOWNLOAD,8,3       ; @FW_STATE_FW_DOWNLOAD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Firmware is not ready for download\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_FW_STATE_CR4_RDY,4,2           ; @FW_STATE_CR4_RDY
l_.str.1:                               ; @.str.1
	.asciz	"Timeout for initializing firmware\n"

	.comm	_MT_TXQ_FWDL,4,2                ; @MT_TXQ_FWDL
l_.str.2:                               ; @.str.2
	.asciz	"Firmware init done\n"

	.no_dead_strip	_mt7615_load_firmware
.subsections_via_symbols
