	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt7615_mcu_send_ram_firmware
_mt7615_mcu_send_ram_firmware:          ## @mt7615_mcu_send_ram_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	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r14
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	testl	%ecx, %ecx
	jne	LBB0_1
## %bb.2:
	movq	_N9_REGION_NUM@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_CR4_REGION_NUM@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_11
## %bb.4:
	movl	%eax, %eax
	shlq	$2, %rax
	leaq	(%rax,%rax,2), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movl	8(%r15,%r12), %edi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_mt7615_mcu_gen_dl_mode
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movl	4(%r15,%r12), %edi
	callq	_le32_to_cpu
	movq	%rax, %r13
	movq	_IMG_CRC_LEN@GOTPCREL(%rip), %rax
	addq	(%rax), %r13
	movl	(%r15,%r12), %edi
	callq	_le32_to_cpu
	movq	%r14, %rdi
	movq	%rax, %rsi
	movq	%r13, %rdx
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	callq	_mt7615_mcu_init_download
	movq	%r14, %rdi
	testl	%eax, %eax
	jne	LBB0_6
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movslq	%ebx, %rbx
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%rbx,4), %rsi
	movq	%rdi, %r14
	movq	%r13, %rdx
	callq	_mt7615_mcu_send_firmware
	testl	%eax, %eax
	jne	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_5 Depth=1
	addq	%rbx, %r13
	addq	$12, %r12
	movq	%r13, %rbx
	cmpq	%r12, -56(%rbp)                 ## 8-byte Folded Reload
	jne	LBB0_5
LBB0_11:
	xorl	%r15d, %r15d
	jmp	LBB0_12
LBB0_6:
	movl	%eax, %r15d
	movq	%rdi, %r14
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_7
LBB0_9:
	movl	%eax, %r15d
	leaq	L_.str.1(%rip), %rsi
LBB0_7:
	movl	(%r14), %edi
	callq	_dev_err
LBB0_12:
	movl	%r15d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CR4_REGION_NUM,4,2             ## @CR4_REGION_NUM
	.comm	_N9_REGION_NUM,4,2              ## @N9_REGION_NUM
	.comm	_IMG_CRC_LEN,8,3                ## @IMG_CRC_LEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Download request failed\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to send firmware to device\n"

	.no_dead_strip	_mt7615_mcu_send_ram_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt7615_mcu_send_ram_firmware
_mt7615_mcu_send_ram_firmware:          ; @mt7615_mcu_send_ram_firmware
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x8, _CR4_REGION_NUM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CR4_REGION_NUM@GOTPAGEOFF]
Lloh2:
	adrp	x9, _N9_REGION_NUM@GOTPAGE
Lloh3:
	ldr	x9, [x9, _N9_REGION_NUM@GOTPAGEOFF]
	cmp	w3, #0
	csel	x8, x9, x8, eq
	ldr	w25, [x8]
	cmp	w25, #1
	b.lt	LBB0_5
; %bb.1:
	mov	x20, x3
	mov	x21, x2
	mov	x19, x0
	mov	x26, #0
	add	x27, x1, #8
Lloh4:
	adrp	x28, _IMG_CRC_LEN@GOTPAGE
Lloh5:
	ldr	x28, [x28, _IMG_CRC_LEN@GOTPAGEOFF]
Lloh6:
	adrp	x22, l_.str@PAGE
Lloh7:
	add	x22, x22, l_.str@PAGEOFF
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x27]
	mov	x1, x20
	bl	_mt7615_mcu_gen_dl_mode
	mov	x23, x0
	ldur	w0, [x27, #-4]
	bl	_le32_to_cpu
	ldr	x8, [x28]
	add	x24, x8, x0
	ldur	w0, [x27, #-8]
	bl	_le32_to_cpu
	mov	x1, x0
	mov	x0, x19
	mov	x2, x24
	mov	x3, x23
	bl	_mt7615_mcu_init_download
	cbnz	w0, LBB0_6
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	lsl	x8, x26, #32
	add	x1, x21, x8, asr #30
	mov	x0, x19
	mov	x2, x24
	bl	_mt7615_mcu_send_firmware
	cbnz	w0, LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	sxtw	x8, w26
	add	x26, x24, x8
	add	x27, x27, #12
	subs	x25, x25, #1
	b.ne	LBB0_2
LBB0_5:
	mov	w23, #0
	b	LBB0_9
LBB0_6:
	mov	x23, x0
	b	LBB0_8
LBB0_7:
	mov	x23, x0
Lloh8:
	adrp	x22, l_.str.1@PAGE
Lloh9:
	add	x22, x22, l_.str.1@PAGEOFF
LBB0_8:
	ldr	w0, [x19]
	mov	x1, x22
	bl	_dev_err
LBB0_9:
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_CR4_REGION_NUM,4,2             ; @CR4_REGION_NUM
	.comm	_N9_REGION_NUM,4,2              ; @N9_REGION_NUM
	.comm	_IMG_CRC_LEN,8,3                ; @IMG_CRC_LEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Download request failed\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to send firmware to device\n"

	.no_dead_strip	_mt7615_mcu_send_ram_firmware
.subsections_via_symbols
