	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function download_firmware_to_mem
_download_firmware_to_mem:              ## @download_firmware_to_mem
	.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	%r8, %rbx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r12
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	movq	(%rdi), %rax
	movq	(%rax), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_REG_DDMA_CH0CTRL@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	callq	_rtw_read32
	movq	_BIT_DDMACH0_RESET_CHKSUM_STS@GOTPCREL(%rip), %rcx
	orq	(%rcx), %rax
	movl	(%r14), %esi
	movq	%r15, %rdi
	movq	%rax, %rdx
	callq	_rtw_write32
	testq	%rbx, %rbx
	je	LBB0_5
## %bb.1:
	addq	%r12, -56(%rbp)                 ## 8-byte Folded Spill
	shrq	$7, %r12
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movl	$1, %r14d
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	$4096, %rbx                     ## imm = 0x1000
	movl	$4096, %r13d                    ## imm = 0x1000
	cmovlq	%rbx, %r13
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%r12,4), %rdx
	movq	%r15, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	movq	%r13, %rcx
	callq	_send_firmware_pkt
	testl	%eax, %eax
	jne	LBB0_7
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_OCPBASE_TXBUF_88XX@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	-56(%rbp), %rsi                 ## 8-byte Folded Reload
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	leaq	(%r12,%rax), %rdx
	movq	%r15, %rdi
	movq	%r13, %rcx
	movl	%r14d, %r8d
	callq	_iddma_download_firmware
	testl	%eax, %eax
	jne	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	addq	%r13, %r12
	xorl	%r14d, %r14d
	subq	%r13, %rbx
	jne	LBB0_2
LBB0_5:
	movq	%r15, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_check_fw_checksum
	movl	%eax, %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	jne	LBB0_7
## %bb.6:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_7:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_REG_DDMA_CH0CTRL,4,2           ## @REG_DDMA_CH0CTRL
	.comm	_BIT_DDMACH0_RESET_CHKSUM_STS,8,3 ## @BIT_DDMACH0_RESET_CHKSUM_STS
	.comm	_OCPBASE_TXBUF_88XX,8,3         ## @OCPBASE_TXBUF_88XX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_download_firmware_to_mem
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function download_firmware_to_mem
_download_firmware_to_mem:              ; @download_firmware_to_mem
	.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
	mov	x20, x4
	mov	x19, x3
	mov	x24, x2
	mov	x22, x1
	mov	x21, x0
	ldr	x8, [x0]
	ldr	x25, [x8]
Lloh0:
	adrp	x23, _REG_DDMA_CH0CTRL@GOTPAGE
Lloh1:
	ldr	x23, [x23, _REG_DDMA_CH0CTRL@GOTPAGEOFF]
	ldr	w1, [x23]
	bl	_rtw_read32
Lloh2:
	adrp	x8, _BIT_DDMACH0_RESET_CHKSUM_STS@GOTPAGE
Lloh3:
	ldr	x8, [x8, _BIT_DDMACH0_RESET_CHKSUM_STS@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	orr	x2, x8, x0
	ldr	w1, [x23]
	mov	x0, x21
	bl	_rtw_write32
	cbz	x20, LBB0_5
; %bb.1:
	mov	x26, #0
	lsr	x23, x24, #7
	add	x27, x25, x24
	mov	w24, #1
	mov	w28, #4096
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	cmp	x20, #1, lsl #12                ; =4096
	csel	x25, x20, x28, lt
	add	x2, x22, x26, lsl #2
	mov	x0, x21
	mov	x1, x23
	mov	x3, x25
	bl	_send_firmware_pkt
	cbnz	w0, LBB0_8
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
Lloh5:
	adrp	x8, _OCPBASE_TXBUF_88XX@GOTPAGE
Lloh6:
	ldr	x8, [x8, _OCPBASE_TXBUF_88XX@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	add	x1, x27, x8
	add	x2, x26, x19
	mov	x0, x21
	mov	x3, x25
	mov	x4, x24
	bl	_iddma_download_firmware
	cbnz	w0, LBB0_8
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w24, #0
	add	x26, x25, x26
	subs	x20, x20, x25
	b.ne	LBB0_2
LBB0_5:
	mov	x0, x21
	mov	x1, x19
	bl	_check_fw_checksum
	cbz	w0, LBB0_7
; %bb.6:
	mov	w0, #0
	b	LBB0_8
LBB0_7:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	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 AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_REG_DDMA_CH0CTRL,4,2           ; @REG_DDMA_CH0CTRL
	.comm	_BIT_DDMACH0_RESET_CHKSUM_STS,8,3 ; @BIT_DDMACH0_RESET_CHKSUM_STS
	.comm	_OCPBASE_TXBUF_88XX,8,3         ; @OCPBASE_TXBUF_88XX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_download_firmware_to_mem
.subsections_via_symbols
