	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function lpc32xx_write_page_lowlevel
_lpc32xx_write_page_lowlevel:           ## @lpc32xx_write_page_lowlevel
	.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	%ecx, %r13d
	movq	%rsi, %r12
	movq	%rdi, %r15
	callq	_nand_to_mtd
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %rbx
	movq	(%r15), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_use_dma@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	movq	%r12, %r14
	je	LBB0_3
## %bb.1:
	movq	_high_memory@GOTPCREL(%rip), %rax
	movq	%r12, %r14
	cmpq	%r12, (%rax)
	ja	LBB0_3
## %bb.2:
	movq	8(%rbx), %r14
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edx
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_memcpy
LBB0_3:
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	movl	%r13d, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_nand_prog_page_begin_op
	cmpl	$0, (%rbx)
	jle	LBB0_10
## %bb.4:
	xorl	%r14d, %r14d
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	%r14d, %eax
	shll	$9, %eax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax,4), %rsi
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	$512, %edx                      ## imm = 0x200
	callq	_lpc32xx_xmit_dma
	testl	%eax, %eax
	jne	LBB0_12
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	movl	(%r13), %r15d
	movl	4(%rbx), %edi
	callq	_MLC_BUFF
	movl	%r15d, %edi
	movl	%eax, %esi
	callq	_writel
	movl	16(%r13), %r15d
	movl	4(%rbx), %edi
	callq	_MLC_BUFF
	movl	%r15d, %edi
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movl	%eax, %esi
	callq	_writew
	addq	$64, %r13
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	movl	4(%rbx), %edi
	callq	_MLC_ECC_AUTO_ENC_REG
	xorl	%edi, %edi
	movl	%eax, %esi
	callq	_writeb
	movq	%r15, %rdi
	callq	_lpc32xx_waitfunc_controller
	incq	%r14
	movslq	(%rbx), %rax
	cmpq	%rax, %r14
	jge	LBB0_10
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
	movl	4(%rbx), %edi
	callq	_MLC_ECC_ENC_REG
	xorl	%edi, %edi
	movl	%eax, %esi
	callq	_writeb
	movq	_use_dma@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jne	LBB0_11
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_7:                                 ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r12,%r13), %r15d
	movl	4(%rbx), %edi
	callq	_MLC_BUFF
	movl	%r15d, %edi
	movl	%eax, %esi
	callq	_writel
	addq	$16, %r13
	cmpl	$2048, %r13d                    ## imm = 0x800
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	addq	%r13, %r12
	jmp	LBB0_9
LBB0_10:
	movq	%r15, %rdi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_nand_prog_page_end_op          ## TAILCALL
LBB0_12:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_use_dma,8,3                    ## @use_dma
	.comm	_high_memory,8,3                ## @high_memory
	.comm	_DMA_MEM_TO_DEV,4,2             ## @DMA_MEM_TO_DEV
	.no_dead_strip	_lpc32xx_write_page_lowlevel
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function lpc32xx_write_page_lowlevel
_lpc32xx_write_page_lowlevel:           ; @lpc32xx_write_page_lowlevel
	.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	x24, x3
	mov	x20, x1
	mov	x19, x0
	bl	_nand_to_mtd
	mov	x21, x0
	mov	x0, x19
	bl	_nand_get_controller_data
	mov	x22, x0
	ldr	x25, [x19]
Lloh0:
	adrp	x26, _use_dma@GOTPAGE
Lloh1:
	ldr	x26, [x26, _use_dma@GOTPAGEOFF]
	ldr	x8, [x26]
Lloh2:
	adrp	x9, _high_memory@GOTPAGE
Lloh3:
	ldr	x9, [x9, _high_memory@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, #0
	ccmp	x9, x20, #2, ne
	mov	x23, x20
	b.hi	LBB0_2
; %bb.1:
	ldr	x23, [x22, #8]
	ldr	w2, [x21]
	mov	x0, x23
	mov	x1, x20
	bl	_memcpy
LBB0_2:
	mov	x0, x19
	mov	x1, x24
	mov	w2, #0
	mov	x3, #0
	mov	w4, #0
	bl	_nand_prog_page_begin_op
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.3:
	mov	x27, #0
	b	LBB0_6
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=1
	lsl	w8, w27, #9
	add	x1, x23, w8, uxtw #2
Lloh5:
	adrp	x8, _DMA_MEM_TO_DEV@GOTPAGE
Lloh6:
	ldr	x8, [x8, _DMA_MEM_TO_DEV@GOTPAGEOFF]
Lloh7:
	ldr	w3, [x8]
	mov	x0, x21
	mov	w2, #512
	bl	_lpc32xx_xmit_dma
	cbnz	w0, LBB0_11
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	w24, [x25]
	ldr	w0, [x22, #4]
	bl	_MLC_BUFF
	mov	x1, x0
	mov	x0, x24
	bl	_writel
	ldr	w24, [x25, #16]
	ldr	w0, [x22, #4]
	bl	_MLC_BUFF
	mov	x1, x0
	mov	x0, x24
	bl	_writew
	add	x25, x25, #64
	ldr	w0, [x22, #4]
	bl	_MLC_ECC_AUTO_ENC_REG
	mov	x1, x0
	mov	w0, #0
	bl	_writeb
	mov	x0, x19
	bl	_lpc32xx_waitfunc_controller
	add	x27, x27, #1
	ldrsw	x8, [x22]
	cmp	x27, x8
	b.ge	LBB0_10
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	ldr	w0, [x22, #4]
	bl	_MLC_ECC_ENC_REG
	mov	x1, x0
	mov	w0, #0
	bl	_writeb
	ldr	x8, [x26]
	cbnz	x8, LBB0_4
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x28, #0
LBB0_8:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w24, [x20, x28]
	ldr	w0, [x22, #4]
	bl	_MLC_BUFF
	mov	x1, x0
	mov	x0, x24
	bl	_writel
	add	x28, x28, #16
	cmp	w28, #2048
	b.ne	LBB0_8
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	add	x20, x20, x28
	b	LBB0_5
LBB0_10:
	mov	x0, x19
	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
	b	_nand_prog_page_end_op
LBB0_11:
	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	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_use_dma,8,3                    ; @use_dma
	.comm	_high_memory,8,3                ; @high_memory
	.comm	_DMA_MEM_TO_DEV,4,2             ; @DMA_MEM_TO_DEV
	.no_dead_strip	_lpc32xx_write_page_lowlevel
.subsections_via_symbols
