	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ngene_command_load_firmware
_ngene_command_load_firmware:           ## @ngene_command_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
	subq	$48, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ebx
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	_CMD_FWLOAD_PREPARE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -36(%rbp)
	movl	$0, -40(%rbp)
	movl	$0, -72(%rbp)
	movq	$0, -64(%rbp)
	leaq	-72(%rbp), %rsi
	callq	_ngene_command
	addl	$3, %ebx
	andl	$-4, %ebx
	cmpl	$1025, %ebx                     ## imm = 0x401
	jl	LBB0_2
## %bb.1:
	movq	_PROGRAM_SRAM@GOTPCREL(%rip), %rax
	movl	$1024, %edi                     ## imm = 0x400
	addq	(%rax), %rdi
	leaq	4096(%r15), %rsi
	addl	$-1024, %ebx                    ## imm = 0xFC00
	movl	%ebx, %edx
	callq	_ngcpyto
	movl	$1024, %ebx                     ## imm = 0x400
LBB0_2:
	movq	_DATA_FIFO_AREA@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	movq	%r15, %rsi
	movl	%ebx, %edx
	callq	_ngcpyto
	leaq	-72(%rbp), %r15
	movq	%r15, %rdi
	xorl	%esi, %esi
	movl	$40, %edx
	callq	_memset
	movq	_CMD_FWLOAD_FINISH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -36(%rbp)
	movl	$4, -40(%rbp)
	movq	(%r12), %rax
	movq	%rax, -48(%rbp)
	movw	%bx, -56(%rbp)
	movl	$4, -72(%rbp)
	movq	$0, -64(%rbp)
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_ngene_command
	addq	$48, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CMD_FWLOAD_PREPARE,4,2         ## @CMD_FWLOAD_PREPARE
	.comm	_PROGRAM_SRAM,8,3               ## @PROGRAM_SRAM
	.comm	_DATA_FIFO_AREA,8,3             ## @DATA_FIFO_AREA
	.comm	_CMD_FWLOAD_FINISH,4,2          ## @CMD_FWLOAD_FINISH
	.comm	_FIRSTCHUNK,4,2                 ## @FIRSTCHUNK
	.no_dead_strip	_ngene_command_load_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ngene_command_load_firmware
_ngene_command_load_firmware:           ; @ngene_command_load_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _CMD_FWLOAD_PREPARE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CMD_FWLOAD_PREPARE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	stp	wzr, w8, [sp, #40]
	str	wzr, [sp, #8]
	str	xzr, [sp, #16]
	add	x1, sp, #8
	bl	_ngene_command
	add	w8, w21, #3
	and	w21, w8, #0xfffffffc
	cmp	w21, #1025
	b.lt	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _PROGRAM_SRAM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PROGRAM_SRAM@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	add	x0, x8, #1024
	add	x1, x20, #1, lsl #12            ; =4096
	sub	w2, w21, #1024
	bl	_ngcpyto
	mov	w21, #1024
LBB0_2:
Lloh6:
	adrp	x22, _DATA_FIFO_AREA@GOTPAGE
Lloh7:
	ldr	x22, [x22, _DATA_FIFO_AREA@GOTPAGEOFF]
	ldr	x0, [x22]
	mov	x1, x20
	mov	x2, x21
	bl	_ngcpyto
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #40
	bl	_memset
Lloh8:
	adrp	x8, _CMD_FWLOAD_FINISH@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CMD_FWLOAD_FINISH@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	mov	w9, #4
	stp	w9, w8, [sp, #40]
	ldr	x8, [x22]
	str	x8, [sp, #32]
	strh	w21, [sp, #24]
	str	w9, [sp, #8]
	str	xzr, [sp, #16]
	add	x1, sp, #8
	mov	x0, x19
	bl	_ngene_command
	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
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_CMD_FWLOAD_PREPARE,4,2         ; @CMD_FWLOAD_PREPARE
	.comm	_PROGRAM_SRAM,8,3               ; @PROGRAM_SRAM
	.comm	_DATA_FIFO_AREA,8,3             ; @DATA_FIFO_AREA
	.comm	_CMD_FWLOAD_FINISH,4,2          ; @CMD_FWLOAD_FINISH
	.comm	_FIRSTCHUNK,4,2                 ; @FIRSTCHUNK
	.no_dead_strip	_ngene_command_load_firmware
.subsections_via_symbols
