	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function if_spi_prog_helper_firmware
_if_spi_prog_helper_firmware:           ## @if_spi_prog_helper_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, %r12
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_HELPER_FW_LOAD_CHUNK_SZ@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	(,%rbx,4), %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r15
	movq	%r12, %rdi
	movl	$1, %esi
	xorl	%edx, %edx
	callq	_spu_set_interrupt_mode
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_1
## %bb.4:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	(%r13), %ebx
	testl	%ebx, %ebx
	jle	LBB0_12
## %bb.5:
	movq	8(%r13), %r13
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	shll	$2, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_HELPER_FW_LOAD_CHUNK_SZ@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	_IF_SPI_SCRATCH_1_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_spu_write_u16
	testl	%eax, %eax
	jne	LBB0_15
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	_IF_SPI_HOST_INT_STATUS_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_IF_SPI_HIST_CMD_DOWNLOAD_RDY@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r12, %rdi
	movl	%ecx, %edx
	callq	_spu_wait_for_u16
	testl	%eax, %eax
	jne	LBB0_15
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%r15, %rdi
	xorl	%esi, %esi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memset
	movq	_HELPER_FW_LOAD_CHUNK_SZ@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movl	%ebx, %edi
	callq	_min
	movq	%r15, %rdi
	movq	%r13, %rsi
	movl	%eax, %edx
	callq	_memcpy
	movl	$10, %edi
	callq	_mdelay
	movq	_IF_SPI_CMD_RDWRPORT_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r14), %ecx
	movq	%r12, %rdi
	movq	%r15, %rdx
	callq	_spu_write
	testl	%eax, %eax
	jne	LBB0_15
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	_IF_SPI_HOST_INT_STATUS_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_spu_write_u16
	testl	%eax, %eax
	jne	LBB0_15
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_IF_SPI_CARD_INT_CAUSE_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_IF_SPI_CIC_CMD_DOWNLOAD_OVER@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_spu_write_u16
	testl	%eax, %eax
	jne	LBB0_15
## %bb.11:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_HELPER_FW_LOAD_CHUNK_SZ@GOTPCREL(%rip), %rax
	movslq	(%rax), %rdx
	leaq	(%r13,%rdx,4), %r13
	subl	%edx, %ebx
	jg	LBB0_6
LBB0_12:
	movq	_IF_SPI_SCRATCH_1_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_FIRMWARE_DNLD_OK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_spu_write_u16
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_1
## %bb.13:
	movq	_IF_SPI_HOST_INT_STATUS_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_spu_write_u16
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_1
## %bb.14:
	movq	_IF_SPI_CARD_INT_CAUSE_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_IF_SPI_CIC_CMD_DOWNLOAD_OVER@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_spu_write_u16
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_1
	jmp	LBB0_2
LBB0_15:
	movl	%eax, %r14d
LBB0_1:
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %esi
	callq	_pr_err
	movl	%r14d, %ebx
LBB0_2:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_20
## %bb.3:
	movl	%ebx, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_20:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_HELPER_FW_LOAD_CHUNK_SZ,4,2    ## @HELPER_FW_LOAD_CHUNK_SZ
	.comm	_IF_SPI_SCRATCH_1_REG,4,2       ## @IF_SPI_SCRATCH_1_REG
	.comm	_IF_SPI_HOST_INT_STATUS_REG,4,2 ## @IF_SPI_HOST_INT_STATUS_REG
	.comm	_IF_SPI_HIST_CMD_DOWNLOAD_RDY,4,2 ## @IF_SPI_HIST_CMD_DOWNLOAD_RDY
	.comm	_IF_SPI_CMD_RDWRPORT_REG,4,2    ## @IF_SPI_CMD_RDWRPORT_REG
	.comm	_IF_SPI_CARD_INT_CAUSE_REG,4,2  ## @IF_SPI_CARD_INT_CAUSE_REG
	.comm	_IF_SPI_CIC_CMD_DOWNLOAD_OVER,4,2 ## @IF_SPI_CIC_CMD_DOWNLOAD_OVER
	.comm	_FIRMWARE_DNLD_OK,4,2           ## @FIRMWARE_DNLD_OK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to load helper firmware (err=%d)\n"

	.no_dead_strip	_if_spi_prog_helper_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function if_spi_prog_helper_firmware
_if_spi_prog_helper_firmware:           ; @if_spi_prog_helper_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
	sub	sp, sp, #16
	mov	x22, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
Lloh3:
	adrp	x25, _HELPER_FW_LOAD_CHUNK_SZ@GOTPAGE
Lloh4:
	ldr	x25, [x25, _HELPER_FW_LOAD_CHUNK_SZ@GOTPAGEOFF]
	ldr	w23, [x25]
	lsl	x8, x23, #2
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x20, x9, x8
	mov	sp, x20
	mov	w1, #1
	mov	w2, #0
	bl	_spu_set_interrupt_mode
	mov	x24, x0
	cbnz	w0, LBB0_13
; %bb.1:
	ldr	w21, [x22]
Lloh7:
	adrp	x26, _IF_SPI_SCRATCH_1_REG@GOTPAGE
Lloh8:
	ldr	x26, [x26, _IF_SPI_SCRATCH_1_REG@GOTPAGEOFF]
	cmp	w21, #1
	b.lt	LBB0_9
; %bb.2:
	ldr	x22, [x22, #8]
	lsl	w23, w23, #2
	ldr	w2, [x25]
Lloh9:
	adrp	x27, _IF_SPI_HOST_INT_STATUS_REG@GOTPAGE
Lloh10:
	ldr	x27, [x27, _IF_SPI_HOST_INT_STATUS_REG@GOTPAGEOFF]
Lloh11:
	adrp	x28, _IF_SPI_HIST_CMD_DOWNLOAD_RDY@GOTPAGE
Lloh12:
	ldr	x28, [x28, _IF_SPI_HIST_CMD_DOWNLOAD_RDY@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x26]
	mov	x0, x19
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_spu_write_u16
	cbnz	w0, LBB0_12
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w1, [x27]
	ldr	w2, [x28]
	mov	x0, x19
	mov	x3, x2
	bl	_spu_wait_for_u16
	cbnz	w0, LBB0_12
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x20
	mov	w1, #0
	mov	x2, x23
	bl	_memset
	ldr	w1, [x25]
	mov	x0, x21
	bl	_min
	mov	x2, x0
	mov	x0, x20
	mov	x1, x22
	bl	_memcpy
	mov	w0, #10
	bl	_mdelay
Lloh13:
	adrp	x8, _IF_SPI_CMD_RDWRPORT_REG@GOTPAGE
Lloh14:
	ldr	x8, [x8, _IF_SPI_CMD_RDWRPORT_REG@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	ldr	w3, [x25]
	mov	x0, x19
	mov	x2, x20
	bl	_spu_write
	cbnz	w0, LBB0_12
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w1, [x27]
	mov	x0, x19
	mov	w2, #0
	bl	_spu_write_u16
	cbnz	w0, LBB0_12
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh16:
	adrp	x8, _IF_SPI_CARD_INT_CAUSE_REG@GOTPAGE
Lloh17:
	ldr	x8, [x8, _IF_SPI_CARD_INT_CAUSE_REG@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
Lloh19:
	adrp	x8, _IF_SPI_CIC_CMD_DOWNLOAD_OVER@GOTPAGE
Lloh20:
	ldr	x8, [x8, _IF_SPI_CIC_CMD_DOWNLOAD_OVER@GOTPAGEOFF]
Lloh21:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_spu_write_u16
	cbnz	w0, LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	ldrsw	x2, [x25]
	sub	w21, w21, w2
	add	x22, x22, x2, lsl #2
	cmp	w21, #0
	b.gt	LBB0_3
LBB0_9:
	ldr	w1, [x26]
Lloh22:
	adrp	x8, _FIRMWARE_DNLD_OK@GOTPAGE
Lloh23:
	ldr	x8, [x8, _FIRMWARE_DNLD_OK@GOTPAGEOFF]
Lloh24:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_spu_write_u16
	mov	x24, x0
	cbnz	w0, LBB0_13
; %bb.10:
Lloh25:
	adrp	x8, _IF_SPI_HOST_INT_STATUS_REG@GOTPAGE
Lloh26:
	ldr	x8, [x8, _IF_SPI_HOST_INT_STATUS_REG@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_spu_write_u16
	mov	x24, x0
	cbnz	w0, LBB0_13
; %bb.11:
Lloh28:
	adrp	x8, _IF_SPI_CARD_INT_CAUSE_REG@GOTPAGE
Lloh29:
	ldr	x8, [x8, _IF_SPI_CARD_INT_CAUSE_REG@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
Lloh31:
	adrp	x8, _IF_SPI_CIC_CMD_DOWNLOAD_OVER@GOTPAGE
Lloh32:
	ldr	x8, [x8, _IF_SPI_CIC_CMD_DOWNLOAD_OVER@GOTPAGEOFF]
Lloh33:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_spu_write_u16
	mov	x24, x0
	cbnz	w0, LBB0_13
	b	LBB0_14
LBB0_12:
	mov	x24, x0
LBB0_13:
Lloh34:
	adrp	x0, l_.str@PAGE
Lloh35:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x24
	bl	_pr_err
LBB0_14:
	ldur	x8, [x29, #-88]
Lloh36:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh37:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh38:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_16
; %bb.15:
	mov	x0, x24
	sub	sp, x29, #80
	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
LBB0_16:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_HELPER_FW_LOAD_CHUNK_SZ,4,2    ; @HELPER_FW_LOAD_CHUNK_SZ
	.comm	_IF_SPI_SCRATCH_1_REG,4,2       ; @IF_SPI_SCRATCH_1_REG
	.comm	_IF_SPI_HOST_INT_STATUS_REG,4,2 ; @IF_SPI_HOST_INT_STATUS_REG
	.comm	_IF_SPI_HIST_CMD_DOWNLOAD_RDY,4,2 ; @IF_SPI_HIST_CMD_DOWNLOAD_RDY
	.comm	_IF_SPI_CMD_RDWRPORT_REG,4,2    ; @IF_SPI_CMD_RDWRPORT_REG
	.comm	_IF_SPI_CARD_INT_CAUSE_REG,4,2  ; @IF_SPI_CARD_INT_CAUSE_REG
	.comm	_IF_SPI_CIC_CMD_DOWNLOAD_OVER,4,2 ; @IF_SPI_CIC_CMD_DOWNLOAD_OVER
	.comm	_FIRMWARE_DNLD_OK,4,2           ; @FIRMWARE_DNLD_OK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to load helper firmware (err=%d)\n"

	.no_dead_strip	_if_spi_prog_helper_firmware
.subsections_via_symbols
