	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gpmi_chain_data_write
_gpmi_chain_data_write:                 ## @gpmi_chain_data_write
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r12d
	movq	%rsi, %r13
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	callq	_get_dma_chan
	movq	%rax, %rbx
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -80(%rbp)
	movq	$0, -64(%rbp)
	movq	%r15, %rdi
	callq	_get_next_transfer
	testq	%rax, %rax
	je	LBB0_9
## %bb.1:
	movq	%rbx, -104(%rbp)                ## 8-byte Spill
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movl	%r8d, 4(%rax)
	movq	%r15, %rdi
	movq	%r13, %rsi
	movl	%r12d, %edx
	movq	%rax, %rcx
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	callq	_prepare_data_dma
	movq	_BV_GPMI_CTRL0_COMMAND_MODE__WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_BF_GPMI_CTRL0_COMMAND_MODE
	movl	%eax, %r13d
	movq	_BM_GPMI_CTRL0_WORD_LENGTH@GOTPCREL(%rip), %rax
	orl	(%rax), %r13d
	movl	16(%r15), %edi
	movq	%r15, %rsi
	callq	_BF_GPMI_CTRL0_CS
	movl	%eax, %r14d
	movq	_LOCK_CS_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r15, %rsi
	callq	_BF_GPMI_CTRL0_LOCK_CS
	movl	%r12d, -84(%rbp)                ## 4-byte Spill
	movl	%eax, %r12d
	orl	%r14d, %r12d
	movq	_BV_GPMI_CTRL0_ADDRESS__NAND_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_BF_GPMI_CTRL0_ADDRESS
	movl	%eax, %ebx
	orl	%r12d, %ebx
	movl	-84(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %edi
	callq	_BF_GPMI_CTRL0_XFER_COUNT
	orl	%ebx, %eax
	orl	%r13d, %eax
	movq	-96(%rbp), %r13                 ## 8-byte Reload
	movl	%eax, -80(%rbp)
	cmpq	$0, 8(%r15)
	je	LBB0_3
## %bb.2:
	movq	_BM_GPMI_ECCCTRL_ENABLE_ECC@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_BV_GPMI_ECCCTRL_ECC_CMD__BCH_ENCODE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_BF_GPMI_ECCCTRL_ECC_CMD
	movl	%eax, %ebx
	orl	%r14d, %ebx
	movq	_BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_PAGE@GOTPCREL(%rip), %rax
	movq	_BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_AUXONLY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	callq	_BF_GPMI_ECCCTRL_BUFFER_MASK
	orl	%ebx, %eax
	movl	%eax, -72(%rbp)
	movl	%r12d, -68(%rbp)
	movl	(%r13), %eax
	movl	%eax, -64(%rbp)
	movl	(%r15), %eax
	movl	%eax, -60(%rbp)
LBB0_3:
	leaq	-80(%rbp), %r12
	movq	%r12, %rdi
	callq	_ARRAY_SIZE
	movq	_DMA_TRANS_NONE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpq	$0, 8(%r15)
	movq	_MXS_DMA_CTRL_WAIT4END@GOTPCREL(%rip), %r14
	movl	$0, %r8d
	movq	-104(%rbp), %rbx                ## 8-byte Reload
	je	LBB0_5
## %bb.4:
	movl	(%r14), %r8d
LBB0_5:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movl	%eax, %edx
	callq	_mxs_dmaengine_prep_pio
	testq	%rax, %rax
	je	LBB0_9
## %bb.6:
	cmpq	$0, 8(%r15)
	jne	LBB0_10
## %bb.7:
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	(%r14), %r8d
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movl	$1, %edx
	callq	_dmaengine_prep_slave_sg
	jmp	LBB0_10
LBB0_9:
	xorl	%eax, %eax
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_12
## %bb.11:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.comm	_BV_GPMI_CTRL0_COMMAND_MODE__WRITE,4,2 ## @BV_GPMI_CTRL0_COMMAND_MODE__WRITE
	.comm	_BM_GPMI_CTRL0_WORD_LENGTH,4,2  ## @BM_GPMI_CTRL0_WORD_LENGTH
	.comm	_LOCK_CS_ENABLE,4,2             ## @LOCK_CS_ENABLE
	.comm	_BV_GPMI_CTRL0_ADDRESS__NAND_DATA,4,2 ## @BV_GPMI_CTRL0_ADDRESS__NAND_DATA
	.comm	_BM_GPMI_ECCCTRL_ENABLE_ECC,4,2 ## @BM_GPMI_ECCCTRL_ENABLE_ECC
	.comm	_BV_GPMI_ECCCTRL_ECC_CMD__BCH_ENCODE,4,2 ## @BV_GPMI_ECCCTRL_ECC_CMD__BCH_ENCODE
	.comm	_BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_PAGE,4,2 ## @BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_PAGE
	.comm	_BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_AUXONLY,4,2 ## @BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_AUXONLY
	.comm	_DMA_TRANS_NONE,4,2             ## @DMA_TRANS_NONE
	.comm	_MXS_DMA_CTRL_WAIT4END,4,2      ## @MXS_DMA_CTRL_WAIT4END
	.comm	_DMA_MEM_TO_DEV,4,2             ## @DMA_MEM_TO_DEV
	.no_dead_strip	_gpmi_chain_data_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gpmi_chain_data_write
_gpmi_chain_data_write:                 ; @gpmi_chain_data_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x22, x2
	mov	x23, x1
	mov	x20, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	bl	_get_dma_chan
	mov	x19, x0
	stur	xzr, [sp, #12]
	stur	xzr, [sp, #4]
	str	wzr, [sp, #20]
	mov	x0, x20
	bl	_get_next_transfer
	cbz	x0, LBB0_6
; %bb.1:
	mov	x21, x0
Lloh3:
	adrp	x8, _DMA_TO_DEVICE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _DMA_TO_DEVICE@GOTPAGEOFF]
Lloh5:
	ldr	w4, [x8]
	str	w4, [x0, #4]
	mov	x0, x20
	mov	x1, x23
	mov	x2, x22
	mov	x3, x21
	bl	_prepare_data_dma
Lloh6:
	adrp	x8, _BV_GPMI_CTRL0_COMMAND_MODE__WRITE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _BV_GPMI_CTRL0_COMMAND_MODE__WRITE@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_BF_GPMI_CTRL0_COMMAND_MODE
Lloh9:
	adrp	x8, _BM_GPMI_CTRL0_WORD_LENGTH@GOTPAGE
Lloh10:
	ldr	x8, [x8, _BM_GPMI_CTRL0_WORD_LENGTH@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	orr	w23, w8, w0
	ldr	w0, [x20, #16]
	mov	x1, x20
	bl	_BF_GPMI_CTRL0_CS
	orr	w23, w23, w0
Lloh12:
	adrp	x8, _LOCK_CS_ENABLE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _LOCK_CS_ENABLE@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	mov	x1, x20
	bl	_BF_GPMI_CTRL0_LOCK_CS
	orr	w23, w23, w0
Lloh15:
	adrp	x8, _BV_GPMI_CTRL0_ADDRESS__NAND_DATA@GOTPAGE
Lloh16:
	ldr	x8, [x8, _BV_GPMI_CTRL0_ADDRESS__NAND_DATA@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
	bl	_BF_GPMI_CTRL0_ADDRESS
	orr	w23, w23, w0
	mov	x0, x22
	bl	_BF_GPMI_CTRL0_XFER_COUNT
	orr	w8, w23, w0
	str	w8, [sp]
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_3
; %bb.2:
Lloh18:
	adrp	x8, _BM_GPMI_ECCCTRL_ENABLE_ECC@GOTPAGE
Lloh19:
	ldr	x8, [x8, _BM_GPMI_ECCCTRL_ENABLE_ECC@GOTPAGEOFF]
Lloh20:
	ldr	w23, [x8]
Lloh21:
	adrp	x8, _BV_GPMI_ECCCTRL_ECC_CMD__BCH_ENCODE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _BV_GPMI_ECCCTRL_ECC_CMD__BCH_ENCODE@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	bl	_BF_GPMI_ECCCTRL_ECC_CMD
Lloh24:
	adrp	x8, _BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_PAGE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_PAGE@GOTPAGEOFF]
	orr	w23, w0, w23
Lloh26:
	ldr	w8, [x8]
Lloh27:
	adrp	x9, _BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_AUXONLY@GOTPAGE
Lloh28:
	ldr	x9, [x9, _BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_AUXONLY@GOTPAGEOFF]
Lloh29:
	ldr	w9, [x9]
	orr	w0, w9, w8
	bl	_BF_GPMI_ECCCTRL_BUFFER_MASK
	orr	w8, w23, w0
	stp	w8, w22, [sp, #8]
	ldr	w8, [x21]
	ldr	w9, [x20]
	stp	w8, w9, [sp, #16]
LBB0_3:
	mov	x0, sp
	bl	_ARRAY_SIZE
	mov	x2, x0
Lloh30:
	adrp	x8, _DMA_TRANS_NONE@GOTPAGE
Lloh31:
	ldr	x8, [x8, _DMA_TRANS_NONE@GOTPAGEOFF]
Lloh32:
	ldr	w3, [x8]
	ldr	x8, [x20, #8]
Lloh33:
	adrp	x22, _MXS_DMA_CTRL_WAIT4END@GOTPAGE
Lloh34:
	ldr	x22, [x22, _MXS_DMA_CTRL_WAIT4END@GOTPAGEOFF]
	ldr	w9, [x22]
	cmp	x8, #0
	csel	w4, wzr, w9, eq
	mov	x1, sp
	mov	x0, x19
	bl	_mxs_dmaengine_prep_pio
	cbz	x0, LBB0_6
; %bb.4:
	ldr	x8, [x20, #8]
	cbnz	x8, LBB0_6
; %bb.5:
Lloh35:
	adrp	x8, _DMA_MEM_TO_DEV@GOTPAGE
Lloh36:
	ldr	x8, [x8, _DMA_MEM_TO_DEV@GOTPAGEOFF]
Lloh37:
	ldr	w3, [x8]
	ldr	w4, [x22]
	mov	x0, x19
	mov	x1, x21
	mov	w2, #1
	bl	_dmaengine_prep_slave_sg
LBB0_6:
	ldr	x8, [sp, #24]
Lloh38:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh39:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh40:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_8
; %bb.7:
	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
	add	sp, sp, #96
	ret
LBB0_8:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.comm	_BV_GPMI_CTRL0_COMMAND_MODE__WRITE,4,2 ; @BV_GPMI_CTRL0_COMMAND_MODE__WRITE
	.comm	_BM_GPMI_CTRL0_WORD_LENGTH,4,2  ; @BM_GPMI_CTRL0_WORD_LENGTH
	.comm	_LOCK_CS_ENABLE,4,2             ; @LOCK_CS_ENABLE
	.comm	_BV_GPMI_CTRL0_ADDRESS__NAND_DATA,4,2 ; @BV_GPMI_CTRL0_ADDRESS__NAND_DATA
	.comm	_BM_GPMI_ECCCTRL_ENABLE_ECC,4,2 ; @BM_GPMI_ECCCTRL_ENABLE_ECC
	.comm	_BV_GPMI_ECCCTRL_ECC_CMD__BCH_ENCODE,4,2 ; @BV_GPMI_ECCCTRL_ECC_CMD__BCH_ENCODE
	.comm	_BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_PAGE,4,2 ; @BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_PAGE
	.comm	_BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_AUXONLY,4,2 ; @BV_GPMI_ECCCTRL_BUFFER_MASK__BCH_AUXONLY
	.comm	_DMA_TRANS_NONE,4,2             ; @DMA_TRANS_NONE
	.comm	_MXS_DMA_CTRL_WAIT4END,4,2      ; @MXS_DMA_CTRL_WAIT4END
	.comm	_DMA_MEM_TO_DEV,4,2             ; @DMA_MEM_TO_DEV
	.no_dead_strip	_gpmi_chain_data_write
.subsections_via_symbols
