	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function prep_bam_dma_desc_cmd
_prep_bam_dma_desc_cmd:                 ## @prep_bam_dma_desc_cmd
	.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
	movl	%r9d, %r12d
	movl	%esi, -52(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r15
	movq	8(%rdi), %rax
	movq	(%rax), %r13
	testl	%r8d, %r8d
	jle	LBB0_1
## %bb.2:
	movq	%rcx, %rbx
	movl	%edx, %r14d
	movl	%r12d, -48(%rbp)                ## 4-byte Spill
	shlq	$2, %r13
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	addq	32(%rax), %r13
	movl	%r8d, %r12d
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	_BAM_WRITE_COMMAND@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	(%rbx), %ecx
	movq	%r13, %rdi
	callq	_bam_prep_ce_le32
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	-44(%rbp), %r8d                 ## 4-byte Reload
	addl	$4, %r14d
	addq	$4, %rbx
	addq	$4, %r13
	decq	%r12
	je	LBB0_7
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_nandc_reg_phys
	movl	%eax, %esi
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_BAM_READ_COMMAND@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	%r15, %rdi
	movl	%esi, -56(%rbp)                 ## 4-byte Spill
	movq	%rbx, %rsi
	callq	_reg_buf_dma_addr
	movq	%r13, %rdi
	movl	-56(%rbp), %esi                 ## 4-byte Reload
	movl	-60(%rbp), %edx                 ## 4-byte Reload
	movl	%eax, %ecx
	callq	_bam_prep_ce
	jmp	LBB0_6
LBB0_7:
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movq	(%rbx), %r13
	movl	-48(%rbp), %r12d                ## 4-byte Reload
	jmp	LBB0_8
LBB0_1:
	movq	%rax, %rbx
LBB0_8:
	movslq	%r8d, %rdx
	addq	%r13, %rdx
	movq	%rdx, (%rbx)
	movq	_NAND_BAM_NEXT_SGL@GOTPCREL(%rip), %rax
	testl	%r12d, (%rax)
	je	LBB0_11
## %bb.9:
	movq	8(%rbx), %rax
	movq	16(%rbx), %rdi
	leaq	(,%rax,4), %rsi
	addq	32(%rbx), %rsi
	subl	%eax, %edx
	shll	$2, %edx
	shlq	$2, %rdi
	addq	24(%rbx), %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_sg_set_buf
	incq	16(%rbx)
	movq	(%rbx), %rax
	movq	%rax, 8(%rbx)
	movq	_NAND_BAM_NWD@GOTPCREL(%rip), %rax
	testl	%r12d, (%rax)
	je	LBB0_11
## %bb.10:
	movl	(%r15), %esi
	movq	_DMA_PREP_FENCE@GOTPCREL(%rip), %rax
	movq	_DMA_PREP_CMD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	%r15, %rdi
	callq	_prepare_bam_async_desc
	testl	%eax, %eax
	jne	LBB0_12
LBB0_11:
	xorl	%eax, %eax
LBB0_12:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BAM_READ_COMMAND,4,2           ## @BAM_READ_COMMAND
	.comm	_BAM_WRITE_COMMAND,4,2          ## @BAM_WRITE_COMMAND
	.comm	_NAND_BAM_NEXT_SGL,4,2          ## @NAND_BAM_NEXT_SGL
	.comm	_NAND_BAM_NWD,4,2               ## @NAND_BAM_NWD
	.comm	_DMA_PREP_FENCE,4,2             ## @DMA_PREP_FENCE
	.comm	_DMA_PREP_CMD,4,2               ## @DMA_PREP_CMD
	.no_dead_strip	_prep_bam_dma_desc_cmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function prep_bam_dma_desc_cmd
_prep_bam_dma_desc_cmd:                 ; @prep_bam_dma_desc_cmd
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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, x5
	mov	x19, x0
	ldr	x28, [x0, #8]
	ldr	x8, [x28]
	cmp	w4, #1
	b.lt	LBB0_7
; %bb.1:
	mov	x22, x3
	mov	x23, x2
	mov	x24, x1
	stp	w4, w20, [sp, #8]               ; 8-byte Folded Spill
	ldr	x9, [x28, #32]
	add	x25, x9, x8, lsl #2
	mov	w20, w4
Lloh0:
	adrp	x21, _BAM_READ_COMMAND@GOTPAGE
Lloh1:
	ldr	x21, [x21, _BAM_READ_COMMAND@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
Lloh2:
	adrp	x8, _BAM_WRITE_COMMAND@GOTPAGE
Lloh3:
	ldr	x8, [x8, _BAM_WRITE_COMMAND@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	ldr	w3, [x22]
	mov	x0, x25
	mov	x1, x26
	bl	_bam_prep_ce_le32
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	w23, w23, #4
	add	x22, x22, #4
	add	x25, x25, #4
	subs	x20, x20, #1
	b.eq	LBB0_6
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x23
	bl	_nandc_reg_phys
	mov	x26, x0
	cbz	w24, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w27, [x21]
	mov	x0, x19
	mov	x1, x22
	bl	_reg_buf_dma_addr
	mov	x3, x0
	mov	x0, x25
	mov	x1, x26
	mov	x2, x27
	bl	_bam_prep_ce
	b	LBB0_3
LBB0_6:
	ldr	x8, [x28]
	ldp	w4, w20, [sp, #8]               ; 8-byte Folded Reload
LBB0_7:
	add	x8, x8, w4, sxtw
	str	x8, [x28]
Lloh5:
	adrp	x9, _NAND_BAM_NEXT_SGL@GOTPAGE
Lloh6:
	ldr	x9, [x9, _NAND_BAM_NEXT_SGL@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w9, w20
	b.eq	LBB0_10
; %bb.8:
	ldp	x10, x9, [x28, #24]
	ldp	x11, x12, [x28, #8]
	add	x1, x9, x11, lsl #2
	sub	w8, w8, w11
	lsl	w2, w8, #2
	add	x0, x10, x12, lsl #2
	bl	_sg_set_buf
	ldr	x8, [x28, #16]
	add	x8, x8, #1
	ldr	x9, [x28]
	stp	x9, x8, [x28, #8]
Lloh8:
	adrp	x8, _NAND_BAM_NWD@GOTPAGE
Lloh9:
	ldr	x8, [x8, _NAND_BAM_NWD@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_10
; %bb.9:
Lloh11:
	adrp	x8, _DMA_PREP_FENCE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _DMA_PREP_FENCE@GOTPAGEOFF]
	ldr	w1, [x19]
Lloh13:
	ldr	w8, [x8]
Lloh14:
	adrp	x9, _DMA_PREP_CMD@GOTPAGE
Lloh15:
	ldr	x9, [x9, _DMA_PREP_CMD@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x19
	bl	_prepare_bam_async_desc
	cbnz	w0, LBB0_11
LBB0_10:
	mov	w0, #0
LBB0_11:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_BAM_READ_COMMAND,4,2           ; @BAM_READ_COMMAND
	.comm	_BAM_WRITE_COMMAND,4,2          ; @BAM_WRITE_COMMAND
	.comm	_NAND_BAM_NEXT_SGL,4,2          ; @NAND_BAM_NEXT_SGL
	.comm	_NAND_BAM_NWD,4,2               ; @NAND_BAM_NWD
	.comm	_DMA_PREP_FENCE,4,2             ; @DMA_PREP_FENCE
	.comm	_DMA_PREP_CMD,4,2               ; @DMA_PREP_CMD
	.no_dead_strip	_prep_bam_dma_desc_cmd
.subsections_via_symbols
