	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt7601u_upload_firmware
_mt7601u_upload_firmware:               ## @mt7601u_upload_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	%rdi, %r15
	movl	16(%rsi), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$4, %esi
	callq	_kmemdup
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	movq	_MCU_FW_URB_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r15, %rdi
	callq	_mt7601u_usb_alloc_buf
	testq	%rax, %rax
	je	LBB0_5
## %bb.3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_4:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_14
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_15
LBB0_5:
	movl	12(%r13), %edi
	callq	_le32_to_cpu
	movq	%rax, %r12
	addq	$-4, %r12
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	$4, %ecx
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	(%r13), %rdx
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdi
	movq	%r12, %rcx
	movl	$4, %r8d
	callq	_mt7601u_dma_fw
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_14
## %bb.6:
	movl	8(%r13), %edi
	callq	_le32_to_cpu
	movq	%rax, %rbx
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_dev_dbg
	addq	(%r13), %r12
	movq	_MT_MCU_DLM_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdi
	movq	%r12, %rdx
	movq	%rbx, %rcx
	callq	_mt7601u_dma_fw
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_7
LBB0_14:
	movq	%r14, %rdi
	callq	_kfree
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdi
	callq	_mt7601u_usb_free_buf
LBB0_15:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_MT_VEND_DEV_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_USB_DIR_OUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$4, (%rsp)
	movq	%r15, %rdi
	movl	$18, %ecx
	xorl	%r8d, %r8d
	movq	%r14, %r9
	callq	_mt7601u_vendor_request
	testl	%eax, %eax
	js	LBB0_8
## %bb.9:
	movl	$-100, %ebx
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_firmware_running
	testl	%eax, %eax
	jne	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	$10, %edi
	callq	_msleep
	incl	%ebx
	jne	LBB0_10
## %bb.12:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_8:
	movl	%eax, %ebx
	jmp	LBB0_14
LBB0_13:
	movl	(%r15), %edi
	leaq	L_.str.2(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MCU_FW_URB_SIZE,4,2            ## @MCU_FW_URB_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"loading FW - ILM %u + IVB %zu\n"

L_.str.1:                               ## @.str.1
	.asciz	"loading FW - DLM %u\n"

	.comm	_MT_MCU_DLM_OFFSET,4,2          ## @MT_MCU_DLM_OFFSET
	.comm	_MT_VEND_DEV_MODE,4,2           ## @MT_VEND_DEV_MODE
	.comm	_USB_DIR_OUT,4,2                ## @USB_DIR_OUT
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
L_.str.2:                               ## @.str.2
	.asciz	"Firmware running!\n"

	.no_dead_strip	_mt7601u_upload_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt7601u_upload_firmware
_mt7601u_upload_firmware:               ; @mt7601u_upload_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x21, x1
	mov	x19, x0
	ldr	w0, [x1, #16]
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	mov	w1, #4
	bl	_kmemdup
	cbz	x0, LBB0_4
; %bb.1:
	mov	x20, x0
Lloh3:
	adrp	x8, _MCU_FW_URB_SIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MCU_FW_URB_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x2, sp, #24
	mov	x0, x19
	bl	_mt7601u_usb_alloc_buf
	cbz	x0, LBB0_5
; %bb.2:
Lloh6:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_3:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_7
LBB0_4:
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_8
LBB0_5:
	ldr	w0, [x21, #12]
	bl	_le32_to_cpu
	sub	x22, x0, #4
	ldr	w0, [x19]
	mov	w8, #4
	stp	x22, x8, [sp]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	x2, [x21]
	add	x1, sp, #24
	mov	x0, x19
	mov	x3, x22
	mov	w4, #4
	bl	_mt7601u_dma_fw
	mov	x23, x0
	cbnz	w0, LBB0_7
; %bb.6:
	ldr	w0, [x21, #8]
	bl	_le32_to_cpu
	mov	x23, x0
	ldr	w0, [x19]
	str	x23, [sp]
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	ldr	x8, [x21]
	add	x2, x8, x22
Lloh15:
	adrp	x8, _MT_MCU_DLM_OFFSET@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MT_MCU_DLM_OFFSET@GOTPAGEOFF]
Lloh17:
	ldr	w4, [x8]
	add	x1, sp, #24
	mov	x0, x19
	mov	x3, x23
	bl	_mt7601u_dma_fw
	mov	x23, x0
	cbz	w0, LBB0_9
LBB0_7:
	mov	x0, x20
	bl	_kfree
	add	x1, sp, #24
	mov	x0, x19
	bl	_mt7601u_usb_free_buf
LBB0_8:
	mov	x0, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_9:
Lloh18:
	adrp	x8, _MT_VEND_DEV_MODE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MT_VEND_DEV_MODE@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
Lloh21:
	adrp	x8, _USB_DIR_OUT@GOTPAGE
Lloh22:
	ldr	x8, [x8, _USB_DIR_OUT@GOTPAGEOFF]
Lloh23:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w3, #18
	mov	w4, #0
	mov	x5, x20
	mov	w6, #4
	bl	_mt7601u_vendor_request
	tbnz	w0, #31, LBB0_14
; %bb.10:
	mov	w21, #-100
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	bl	_firmware_running
	cbnz	w0, LBB0_15
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	w0, #10
	bl	_msleep
	adds	w21, w21, #1
	b.lo	LBB0_11
; %bb.13:
Lloh24:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_3
LBB0_14:
	mov	x23, x0
	b	LBB0_7
LBB0_15:
	ldr	w0, [x19]
Lloh26:
	adrp	x1, l_.str.2@PAGE
Lloh27:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_dbg
	mov	w23, #0
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MCU_FW_URB_SIZE,4,2            ; @MCU_FW_URB_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"loading FW - ILM %u + IVB %zu\n"

l_.str.1:                               ; @.str.1
	.asciz	"loading FW - DLM %u\n"

	.comm	_MT_MCU_DLM_OFFSET,4,2          ; @MT_MCU_DLM_OFFSET
	.comm	_MT_VEND_DEV_MODE,4,2           ; @MT_VEND_DEV_MODE
	.comm	_USB_DIR_OUT,4,2                ; @USB_DIR_OUT
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
l_.str.2:                               ; @.str.2
	.asciz	"Firmware running!\n"

	.no_dead_strip	_mt7601u_upload_firmware
.subsections_via_symbols
