	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gpmi_nand_init
_gpmi_nand_init:                        ## @gpmi_nand_init
	.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	%rdi, %rbx
	leaq	40(%rdi), %r14
	movq	%r14, %rdi
	callq	_nand_to_mtd
	movq	%rax, %r15
	leaq	L_.str(%rip), %rax
	movq	%rax, (%r15)
	movl	32(%rbx), %eax
	movl	%eax, 8(%r15)
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_nand_set_controller_data
	movq	24(%rbx), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_nand_set_flash_node
	movq	_gpmi_block_markbad@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 64(%rbx)
	movq	_gpmi_bbt_descr@GOTPCREL(%rip), %rax
	movq	%rax, 56(%rbx)
	movq	_NAND_NO_SUBPAGE_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 48(%rbx)
	movq	%rbx, %rdi
	callq	_GPMI_IS_MX23
	xorl	%ecx, %ecx
	testl	%eax, %eax
	sete	%cl
	movl	%ecx, (%rbx)
	movabsq	$549755814912, %rax             ## imm = 0x8000000400
	movq	%rax, 16(%rbx)
	movq	%rbx, %rdi
	callq	_gpmi_alloc_dma_buffer
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_6
## %bb.1:
	leaq	8(%rbx), %r12
	movq	%r12, %rdi
	callq	_nand_controller_init
	movq	_gpmi_nand_controller_ops@GOTPCREL(%rip), %rax
	movq	%rax, 8(%rbx)
	movq	%r12, 40(%rbx)
	movq	%rbx, %rdi
	callq	_GPMI_IS_MX6
	cmpq	$1, %rax
	movl	$2, %esi
	sbbl	$0, %esi
	movq	%r14, %rdi
	callq	_nand_scan
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_6
## %bb.2:
	movq	%rbx, %rdi
	callq	_nand_boot_init
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_5
## %bb.3:
	movq	%r14, %rdi
	callq	_nand_create_bbt
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_5
## %bb.4:
	xorl	%r13d, %r13d
	movq	%r15, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_mtd_device_register
	movl	%eax, %r12d
	testl	%eax, %eax
	je	LBB0_7
LBB0_5:
	movq	%r14, %rdi
	callq	_nand_cleanup
LBB0_6:
	movq	%rbx, %rdi
	callq	_gpmi_free_dma_buffer
	movl	%r12d, %r13d
LBB0_7:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"gpmi-nand"

	.comm	_gpmi_block_markbad,4,2         ## @gpmi_block_markbad
	.comm	_gpmi_bbt_descr,4,2             ## @gpmi_bbt_descr
	.comm	_NAND_NO_SUBPAGE_WRITE,4,2      ## @NAND_NO_SUBPAGE_WRITE
	.comm	_gpmi_nand_controller_ops,4,2   ## @gpmi_nand_controller_ops
	.no_dead_strip	_gpmi_nand_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function gpmi_nand_init
lCPI0_0:
	.long	1024                            ; 0x400
	.long	128                             ; 0x80
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_gpmi_nand_init:                        ; @gpmi_nand_init
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
	add	x20, x0, #40
	mov	x0, x20
	bl	_nand_to_mtd
	mov	x21, x0
Lloh0:
	adrp	x8, l_.str@PAGE
Lloh1:
	add	x8, x8, l_.str@PAGEOFF
	str	x8, [x0]
	ldr	w8, [x19, #32]
	str	w8, [x0, #8]
	mov	x0, x20
	mov	x1, x19
	bl	_nand_set_controller_data
	ldr	x8, [x19, #24]
	ldr	w1, [x8]
	mov	x0, x20
	bl	_nand_set_flash_node
Lloh2:
	adrp	x8, _gpmi_block_markbad@GOTPAGE
Lloh3:
	ldr	x8, [x8, _gpmi_block_markbad@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	str	w8, [x19, #64]
Lloh5:
	adrp	x8, _gpmi_bbt_descr@GOTPAGE
Lloh6:
	ldr	x8, [x8, _gpmi_bbt_descr@GOTPAGEOFF]
	str	x8, [x19, #56]
Lloh7:
	adrp	x8, _NAND_NO_SUBPAGE_WRITE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _NAND_NO_SUBPAGE_WRITE@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	ldr	w9, [x19, #48]
	orr	w8, w9, w8
	str	w8, [x19, #48]
	mov	x0, x19
	bl	_GPMI_IS_MX23
	cmp	w0, #0
	cset	w8, eq
	str	w8, [x19]
Lloh10:
	adrp	x8, lCPI0_0@PAGE
Lloh11:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [x19, #16]
	mov	x0, x19
	bl	_gpmi_alloc_dma_buffer
	mov	x22, x0
	cbnz	w0, LBB0_6
; %bb.1:
	add	x22, x19, #8
	mov	x0, x22
	bl	_nand_controller_init
Lloh12:
	adrp	x8, _gpmi_nand_controller_ops@GOTPAGE
Lloh13:
	ldr	x8, [x8, _gpmi_nand_controller_ops@GOTPAGEOFF]
	str	x8, [x19, #8]
	str	x22, [x19, #40]
	mov	x0, x19
	bl	_GPMI_IS_MX6
	cmp	x0, #0
	mov	w8, #1
	cinc	w1, w8, ne
	mov	x0, x20
	bl	_nand_scan
	mov	x22, x0
	cbnz	w0, LBB0_6
; %bb.2:
	mov	x0, x19
	bl	_nand_boot_init
	mov	x22, x0
	cbnz	w0, LBB0_5
; %bb.3:
	mov	x0, x20
	bl	_nand_create_bbt
	mov	x22, x0
	cbnz	w0, LBB0_5
; %bb.4:
	mov	x0, x21
	mov	x1, #0
	mov	w2, #0
	bl	_mtd_device_register
	mov	x22, x0
	cbz	w0, LBB0_7
LBB0_5:
	mov	x0, x20
	bl	_nand_cleanup
LBB0_6:
	mov	x0, x19
	bl	_gpmi_free_dma_buffer
LBB0_7:
	mov	x0, x22
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdr	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"gpmi-nand"

	.comm	_gpmi_block_markbad,4,2         ; @gpmi_block_markbad
	.comm	_gpmi_bbt_descr,4,2             ; @gpmi_bbt_descr
	.comm	_NAND_NO_SUBPAGE_WRITE,4,2      ; @NAND_NO_SUBPAGE_WRITE
	.comm	_gpmi_nand_controller_ops,4,2   ; @gpmi_nand_controller_ops
	.no_dead_strip	_gpmi_nand_init
.subsections_via_symbols
