	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt76x0u_load_firmware
_mt76x0u_load_firmware:                 ## @mt76x0u_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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	_MT_USB_DMA_CFG@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_MT_USB_DMA_CFG_RX_BULK_EN@GOTPCREL(%rip), %r13
	movq	_MT_USB_DMA_CFG_TX_BULK_EN@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	orl	(%r13), %edx
	callq	_mt76_wr
	movq	%r15, %rdi
	callq	_mt76x0_firmware_running
	xorl	%ebx, %ebx
	testq	%rax, %rax
	jne	LBB0_9
## %bb.1:
	leaq	-56(%rbp), %rsi
	movq	%r15, %rdi
	callq	_mt76x0_get_firmware
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_9
## %bb.2:
	movq	-56(%rbp), %rax
	testq	%rax, %rax
	je	LBB0_8
## %bb.3:
	movq	8(%rax), %rbx
	testq	%rbx, %rbx
	je	LBB0_8
## %bb.4:
	cmpl	$20, (%rax)
	jb	LBB0_8
## %bb.5:
	movl	(%rbx), %edi
	callq	_le32_to_cpu
	movq	_MT_MCU_IVB_SIZE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_8
## %bb.6:
	movl	(%rbx), %edi
	callq	_le32_to_cpu
                                        ## kill: def $eax killed $eax def $rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	16(%rbx), %edi
	callq	_le32_to_cpu
                                        ## kill: def $eax killed $eax def $rax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	addl	%ecx, %eax
	addl	$20, %eax
	movq	-56(%rbp), %rcx
	cmpl	%eax, (%rcx)
	jne	LBB0_8
## %bb.7:
	movl	12(%rbx), %edi
	callq	_le16_to_cpu
	movl	(%r15), %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movl	%eax, %ecx
	shrl	$12, %ecx
	andl	$15, %ecx
	movl	%ecx, -68(%rbp)                 ## 4-byte Spill
	movl	%eax, %ecx
	shrl	$8, %ecx
	andl	$15, %ecx
	movl	%ecx, -64(%rbp)                 ## 4-byte Spill
	andl	$15, %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movl	8(%rbx), %edi
	callq	_le16_to_cpu
	movl	4(%rbx), %ecx
	movl	%ecx, (%rsp)
	leaq	L_.str(%rip), %rsi
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	-68(%rbp), %edx                 ## 4-byte Reload
	movl	-64(%rbp), %ecx                 ## 4-byte Reload
	movl	-60(%rbp), %r8d                 ## 4-byte Reload
	movl	%eax, %r9d
	callq	_dev_dbg
	movl	(%rbx), %edi
	callq	_le32_to_cpu
	movq	%r15, %rdi
	movl	$4100, %esi                     ## imm = 0x1004
	movl	$44, %edx
	callq	_mt76_wr
	movl	(%r12), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	(%r14), %r14d
	orl	(%r13), %r14d
	movq	_MT_USB_DMA_CFG_RX_BULK_AGG_TOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$32, %esi
	callq	_FIELD_PREP
	orl	%eax, %r14d
	movq	%r15, %rdi
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movl	%r14d, %edx
	callq	_mt76_set
	movq	%r15, %rdi
	callq	_mt76x02u_mcu_fw_reset
	movl	$5000, %edi                     ## imm = 0x1388
	movl	$6000, %esi                     ## imm = 0x1770
	callq	_usleep_range
	movq	_MT_FCE_PSE_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	$1, %edx
	callq	_mt76_wr
	movq	_MT_TX_CPU_FROM_FCE_BASE_PTR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	$4194864, %edx                  ## imm = 0x400230
	callq	_mt76_wr
	movq	_MT_TX_CPU_FROM_FCE_MAX_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	$1, %edx
	callq	_mt76_wr
	movq	_MT_FCE_PDMA_GLOBAL_CONF@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	$68, %edx
	callq	_mt76_wr
	movq	_MT_FCE_SKIP_FS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	$3, %edx
	callq	_mt76_wr
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_mt76_rr
	movl	%eax, %r14d
	movq	_MT_USB_DMA_CFG_UDMA_TX_WL_DROP@GOTPCREL(%rip), %r13
	orl	(%r13), %r14d
	movl	(%r12), %esi
	movq	%r15, %rdi
	movl	%r14d, %edx
	callq	_mt76_wr
	movl	(%r13), %edx
	notl	%edx
	andl	%r14d, %edx
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_mt76_wr
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_mt76x0u_upload_firmware
	movl	%eax, %ebx
	movq	-56(%rbp), %rdi
	callq	_release_firmware
	movq	_MT_FCE_PSE_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	$1, %edx
	callq	_mt76_wr
	jmp	LBB0_9
LBB0_8:
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	movq	-56(%rbp), %rdi
	callq	_release_firmware
	movq	_ENOENT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_9:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MT_USB_DMA_CFG,4,2             ## @MT_USB_DMA_CFG
	.comm	_MT_USB_DMA_CFG_RX_BULK_EN,4,2  ## @MT_USB_DMA_CFG_RX_BULK_EN
	.comm	_MT_USB_DMA_CFG_TX_BULK_EN,4,2  ## @MT_USB_DMA_CFG_TX_BULK_EN
	.comm	_MT_MCU_IVB_SIZE,4,2            ## @MT_MCU_IVB_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Firmware Version: %d.%d.%02d Build: %x Build time: %.16s\n"

	.comm	_MT_USB_DMA_CFG_RX_BULK_AGG_TOUT,4,2 ## @MT_USB_DMA_CFG_RX_BULK_AGG_TOUT
	.comm	_MT_FCE_PSE_CTRL,4,2            ## @MT_FCE_PSE_CTRL
	.comm	_MT_TX_CPU_FROM_FCE_BASE_PTR,4,2 ## @MT_TX_CPU_FROM_FCE_BASE_PTR
	.comm	_MT_TX_CPU_FROM_FCE_MAX_COUNT,4,2 ## @MT_TX_CPU_FROM_FCE_MAX_COUNT
	.comm	_MT_FCE_PDMA_GLOBAL_CONF,4,2    ## @MT_FCE_PDMA_GLOBAL_CONF
	.comm	_MT_FCE_SKIP_FS,4,2             ## @MT_FCE_SKIP_FS
	.comm	_MT_USB_DMA_CFG_UDMA_TX_WL_DROP,4,2 ## @MT_USB_DMA_CFG_UDMA_TX_WL_DROP
L_.str.1:                               ## @.str.1
	.asciz	"Invalid firmware image\n"

	.comm	_ENOENT,4,2                     ## @ENOENT
	.no_dead_strip	_mt76x0u_load_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt76x0u_load_firmware
_mt76x0u_load_firmware:                 ; @mt76x0u_load_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
Lloh0:
	adrp	x25, _MT_USB_DMA_CFG@GOTPAGE
Lloh1:
	ldr	x25, [x25, _MT_USB_DMA_CFG@GOTPAGEOFF]
Lloh2:
	adrp	x26, _MT_USB_DMA_CFG_RX_BULK_EN@GOTPAGE
Lloh3:
	ldr	x26, [x26, _MT_USB_DMA_CFG_RX_BULK_EN@GOTPAGEOFF]
	ldr	w1, [x25]
	ldr	w8, [x26]
Lloh4:
	adrp	x27, _MT_USB_DMA_CFG_TX_BULK_EN@GOTPAGE
Lloh5:
	ldr	x27, [x27, _MT_USB_DMA_CFG_TX_BULK_EN@GOTPAGEOFF]
	ldr	w9, [x27]
	orr	w2, w9, w8
	bl	_mt76_wr
	mov	x0, x19
	bl	_mt76x0_firmware_running
	cbz	x0, LBB0_2
; %bb.1:
	mov	w20, #0
	b	LBB0_10
LBB0_2:
	add	x1, sp, #8
	mov	x0, x19
	bl	_mt76x0_get_firmware
	mov	x20, x0
	cbnz	w0, LBB0_10
; %bb.3:
	ldr	x8, [sp, #8]
	cbz	x8, LBB0_9
; %bb.4:
	ldr	x20, [x8, #8]
	cbz	x20, LBB0_9
; %bb.5:
	ldr	w8, [x8]
	cmp	w8, #20
	b.lo	LBB0_9
; %bb.6:
	ldr	w0, [x20]
	bl	_le32_to_cpu
Lloh6:
	adrp	x8, _MT_MCU_IVB_SIZE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MT_MCU_IVB_SIZE@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w0, w8
	b.le	LBB0_9
; %bb.7:
	ldr	w0, [x20]
	bl	_le32_to_cpu
	mov	x21, x0
	ldr	w0, [x20, #16]
	bl	_le32_to_cpu
	add	w8, w21, w0
	add	w8, w8, #20
	ldr	x9, [sp, #8]
	ldr	w9, [x9]
	cmp	w9, w8
	b.ne	LBB0_9
; %bb.8:
	ldr	w0, [x20, #12]
	bl	_le16_to_cpu
	ldr	w21, [x19]
	ubfx	w22, w0, #12, #4
	ubfx	w23, w0, #8, #4
	and	w24, w0, #0xf
	ldr	w0, [x20, #8]
	bl	_le16_to_cpu
	mov	x5, x0
	ldr	w6, [x20, #4]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	x2, x22
	mov	x3, x23
	mov	x4, x24
	bl	_dev_dbg
	ldr	w0, [x20]
	bl	_le32_to_cpu
	mov	x0, x19
	mov	w1, #4100
	mov	w2, #44
	bl	_mt76_wr
	ldr	w21, [x25]
	ldr	w8, [x26]
	ldr	w9, [x27]
	orr	w22, w9, w8
Lloh11:
	adrp	x8, _MT_USB_DMA_CFG_RX_BULK_AGG_TOUT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _MT_USB_DMA_CFG_RX_BULK_AGG_TOUT@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	mov	w1, #32
	bl	_FIELD_PREP
	orr	w2, w22, w0
	mov	x0, x19
	mov	x1, x21
	bl	_mt76_set
	mov	x0, x19
	bl	_mt76x02u_mcu_fw_reset
	mov	w0, #5000
	mov	w1, #6000
	bl	_usleep_range
Lloh14:
	adrp	x22, _MT_FCE_PSE_CTRL@GOTPAGE
Lloh15:
	ldr	x22, [x22, _MT_FCE_PSE_CTRL@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x19
	mov	w2, #1
	bl	_mt76_wr
Lloh16:
	adrp	x8, _MT_TX_CPU_FROM_FCE_BASE_PTR@GOTPAGE
Lloh17:
	ldr	x8, [x8, _MT_TX_CPU_FROM_FCE_BASE_PTR@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #560
	movk	w2, #64, lsl #16
	bl	_mt76_wr
Lloh19:
	adrp	x8, _MT_TX_CPU_FROM_FCE_MAX_COUNT@GOTPAGE
Lloh20:
	ldr	x8, [x8, _MT_TX_CPU_FROM_FCE_MAX_COUNT@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #1
	bl	_mt76_wr
Lloh22:
	adrp	x8, _MT_FCE_PDMA_GLOBAL_CONF@GOTPAGE
Lloh23:
	ldr	x8, [x8, _MT_FCE_PDMA_GLOBAL_CONF@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #68
	bl	_mt76_wr
Lloh25:
	adrp	x8, _MT_FCE_SKIP_FS@GOTPAGE
Lloh26:
	ldr	x8, [x8, _MT_FCE_SKIP_FS@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #3
	bl	_mt76_wr
	ldr	w1, [x25]
	mov	x0, x19
	bl	_mt76_rr
Lloh28:
	adrp	x23, _MT_USB_DMA_CFG_UDMA_TX_WL_DROP@GOTPAGE
Lloh29:
	ldr	x23, [x23, _MT_USB_DMA_CFG_UDMA_TX_WL_DROP@GOTPAGEOFF]
	ldr	w8, [x23]
	orr	w21, w8, w0
	ldr	w1, [x25]
	mov	x0, x19
	mov	x2, x21
	bl	_mt76_wr
	ldr	w8, [x23]
	bic	w2, w21, w8
	ldr	w1, [x25]
	mov	x0, x19
	bl	_mt76_wr
	mov	x0, x19
	mov	x1, x20
	bl	_mt76x0u_upload_firmware
	mov	x20, x0
	ldr	x0, [sp, #8]
	bl	_release_firmware
	ldr	w1, [x22]
	mov	x0, x19
	mov	w2, #1
	bl	_mt76_wr
	b	LBB0_10
LBB0_9:
	ldr	w0, [x19]
Lloh30:
	adrp	x1, l_.str.1@PAGE
Lloh31:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	ldr	x0, [sp, #8]
	bl	_release_firmware
Lloh32:
	adrp	x8, _ENOENT@GOTPAGE
Lloh33:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_10:
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_MT_USB_DMA_CFG,4,2             ; @MT_USB_DMA_CFG
	.comm	_MT_USB_DMA_CFG_RX_BULK_EN,4,2  ; @MT_USB_DMA_CFG_RX_BULK_EN
	.comm	_MT_USB_DMA_CFG_TX_BULK_EN,4,2  ; @MT_USB_DMA_CFG_TX_BULK_EN
	.comm	_MT_MCU_IVB_SIZE,4,2            ; @MT_MCU_IVB_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Firmware Version: %d.%d.%02d Build: %x Build time: %.16s\n"

	.comm	_MT_USB_DMA_CFG_RX_BULK_AGG_TOUT,4,2 ; @MT_USB_DMA_CFG_RX_BULK_AGG_TOUT
	.comm	_MT_FCE_PSE_CTRL,4,2            ; @MT_FCE_PSE_CTRL
	.comm	_MT_TX_CPU_FROM_FCE_BASE_PTR,4,2 ; @MT_TX_CPU_FROM_FCE_BASE_PTR
	.comm	_MT_TX_CPU_FROM_FCE_MAX_COUNT,4,2 ; @MT_TX_CPU_FROM_FCE_MAX_COUNT
	.comm	_MT_FCE_PDMA_GLOBAL_CONF,4,2    ; @MT_FCE_PDMA_GLOBAL_CONF
	.comm	_MT_FCE_SKIP_FS,4,2             ; @MT_FCE_SKIP_FS
	.comm	_MT_USB_DMA_CFG_UDMA_TX_WL_DROP,4,2 ; @MT_USB_DMA_CFG_UDMA_TX_WL_DROP
l_.str.1:                               ; @.str.1
	.asciz	"Invalid firmware image\n"

	.comm	_ENOENT,4,2                     ; @ENOENT
	.no_dead_strip	_mt76x0u_load_firmware
.subsections_via_symbols
