	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function if_cs_prog_helper
_if_cs_prog_helper:                     ## @if_cs_prog_helper
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	cmpq	$0, (%rdi)
	movq	_IF_CS_SCRATCH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	je	LBB0_2
## %bb.1:
	callq	_if_cs_read16
	sarl	$8, %eax
	jmp	LBB0_3
LBB0_2:
	callq	_if_cs_read8
LBB0_3:
	movq	_IF_CS_SCRATCH_HELPER_OK@GOTPCREL(%rip), %rcx
	xorl	%r13d, %r13d
	cmpl	(%rcx), %eax
	je	LBB0_12
## %bb.4:
	movq	_IF_CS_SCRATCH_BOOT_OK@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_5
## %bb.6:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdi
	callq	_lbs_deb_cs
	xorl	%r12d, %r12d
	movq	_IF_CS_BIT_COMMAND@GOTPCREL(%rip), %r14
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movl	(%r13), %ebx
	subl	%r12d, %ebx
	cmpl	$256, %ebx                      ## imm = 0x100
	movl	$256, %eax                      ## imm = 0x100
	cmovgel	%eax, %ebx
	movq	_IF_CS_CMD_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_if_cs_write16
	testl	%ebx, %ebx
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	_IF_CS_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movslq	%r12d, %rdx
	shlq	$2, %rdx
	addq	8(%r13), %rdx
	movl	%ebx, %ecx
	sarl	%ecx
	movq	%r15, %rdi
	callq	_if_cs_write16_rep
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	movq	_IF_CS_HOST_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r14), %edx
	movq	%r15, %rdi
	callq	_if_cs_write8
	movq	_IF_CS_HOST_INT_CAUSE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r14), %edx
	movq	%r15, %rdi
	callq	_if_cs_write16
	movq	_IF_CS_CARD_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r14), %edx
	movq	%r15, %rdi
	callq	_if_cs_poll_while_fw_download
	movl	%eax, %r13d
	testl	%eax, %eax
	js	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	addl	%ebx, %r12d
	testl	%ebx, %ebx
	jne	LBB0_7
	jmp	LBB0_12
LBB0_5:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_12
LBB0_10:
	leaq	L_.str.1(%rip), %rdi
	movl	%r12d, %esi
	movl	%r13d, %edx
	callq	_pr_err
LBB0_12:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IF_CS_SCRATCH,4,2              ## @IF_CS_SCRATCH
	.comm	_IF_CS_SCRATCH_HELPER_OK,4,2    ## @IF_CS_SCRATCH_HELPER_OK
	.comm	_IF_CS_SCRATCH_BOOT_OK,4,2      ## @IF_CS_SCRATCH_BOOT_OK
	.comm	_ENODEV,4,2                     ## @ENODEV
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"helper size %td\n"

	.comm	_IF_CS_CMD_LEN,4,2              ## @IF_CS_CMD_LEN
	.comm	_IF_CS_CMD,4,2                  ## @IF_CS_CMD
	.comm	_IF_CS_HOST_STATUS,4,2          ## @IF_CS_HOST_STATUS
	.comm	_IF_CS_BIT_COMMAND,4,2          ## @IF_CS_BIT_COMMAND
	.comm	_IF_CS_HOST_INT_CAUSE,4,2       ## @IF_CS_HOST_INT_CAUSE
	.comm	_IF_CS_CARD_STATUS,4,2          ## @IF_CS_CARD_STATUS
L_.str.1:                               ## @.str.1
	.asciz	"can't download helper at 0x%x, ret %d\n"

	.no_dead_strip	_if_cs_prog_helper
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function if_cs_prog_helper
_if_cs_prog_helper:                     ; @if_cs_prog_helper
	.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	x19, x1
	mov	x20, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _IF_CS_SCRATCH@GOTPAGE
Lloh1:
	ldr	x9, [x9, _IF_CS_SCRATCH@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x9]
	cbz	x8, LBB0_2
; %bb.1:
	bl	_if_cs_read16
	asr	w0, w0, #8
	b	LBB0_3
LBB0_2:
	bl	_if_cs_read8
LBB0_3:
Lloh3:
	adrp	x8, _IF_CS_SCRATCH_HELPER_OK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _IF_CS_SCRATCH_HELPER_OK@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_5
; %bb.4:
	mov	w23, #0
	b	LBB0_13
LBB0_5:
Lloh6:
	adrp	x8, _IF_CS_SCRATCH_BOOT_OK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _IF_CS_SCRATCH_BOOT_OK@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_11
; %bb.6:
	ldr	w1, [x19]
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	bl	_lbs_deb_cs
	mov	w21, #0
Lloh11:
	adrp	x25, _IF_CS_CMD_LEN@GOTPAGE
Lloh12:
	ldr	x25, [x25, _IF_CS_CMD_LEN@GOTPAGEOFF]
Lloh13:
	adrp	x26, _IF_CS_HOST_STATUS@GOTPAGE
Lloh14:
	ldr	x26, [x26, _IF_CS_HOST_STATUS@GOTPAGEOFF]
Lloh15:
	adrp	x27, _IF_CS_BIT_COMMAND@GOTPAGE
Lloh16:
	ldr	x27, [x27, _IF_CS_BIT_COMMAND@GOTPAGEOFF]
Lloh17:
	adrp	x28, _IF_CS_HOST_INT_CAUSE@GOTPAGE
Lloh18:
	ldr	x28, [x28, _IF_CS_HOST_INT_CAUSE@GOTPAGEOFF]
Lloh19:
	adrp	x24, _IF_CS_CARD_STATUS@GOTPAGE
Lloh20:
	ldr	x24, [x24, _IF_CS_CARD_STATUS@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x19]
	sub	w8, w8, w21
	cmp	w8, #256
	mov	w9, #256
	csel	w22, w8, w9, lt
	ldr	w1, [x25]
	mov	x0, x20
	mov	x2, x22
	bl	_if_cs_write16
	cbz	w22, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
Lloh21:
	adrp	x8, _IF_CS_CMD@GOTPAGE
Lloh22:
	ldr	x8, [x8, _IF_CS_CMD@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	ldr	x8, [x19, #8]
	add	x2, x8, w21, sxtw #2
	asr	w3, w22, #1
	mov	x0, x20
	bl	_if_cs_write16_rep
LBB0_9:                                 ;   in Loop: Header=BB0_7 Depth=1
	ldr	w1, [x26]
	ldr	w2, [x27]
	mov	x0, x20
	bl	_if_cs_write8
	ldr	w1, [x28]
	ldr	w2, [x27]
	mov	x0, x20
	bl	_if_cs_write16
	ldr	w1, [x24]
	ldr	w2, [x27]
	mov	x0, x20
	bl	_if_cs_poll_while_fw_download
	mov	x23, x0
	tbnz	w0, #31, LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	add	w21, w22, w21
	cbnz	w22, LBB0_7
	b	LBB0_13
LBB0_11:
Lloh24:
	adrp	x8, _ENODEV@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_13
LBB0_12:
Lloh27:
	adrp	x0, l_.str.1@PAGE
Lloh28:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x21
	mov	x2, x23
	bl	_pr_err
LBB0_13:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_IF_CS_SCRATCH,4,2              ; @IF_CS_SCRATCH
	.comm	_IF_CS_SCRATCH_HELPER_OK,4,2    ; @IF_CS_SCRATCH_HELPER_OK
	.comm	_IF_CS_SCRATCH_BOOT_OK,4,2      ; @IF_CS_SCRATCH_BOOT_OK
	.comm	_ENODEV,4,2                     ; @ENODEV
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"helper size %td\n"

	.comm	_IF_CS_CMD_LEN,4,2              ; @IF_CS_CMD_LEN
	.comm	_IF_CS_CMD,4,2                  ; @IF_CS_CMD
	.comm	_IF_CS_HOST_STATUS,4,2          ; @IF_CS_HOST_STATUS
	.comm	_IF_CS_BIT_COMMAND,4,2          ; @IF_CS_BIT_COMMAND
	.comm	_IF_CS_HOST_INT_CAUSE,4,2       ; @IF_CS_HOST_INT_CAUSE
	.comm	_IF_CS_CARD_STATUS,4,2          ; @IF_CS_CARD_STATUS
l_.str.1:                               ; @.str.1
	.asciz	"can't download helper at 0x%x, ret %d\n"

	.no_dead_strip	_if_cs_prog_helper
.subsections_via_symbols
