	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cafe_nand_attach_chip
_cafe_nand_attach_chip:                 ## @cafe_nand_attach_chip
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %rbx
	movq	8(%rax), %rdi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	$2112, %esi                     ## imm = 0x840
	movq	%rbx, %rdx
	callq	_dma_alloc_coherent
	movl	%eax, 4(%rbx)
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movl	(%rbx), %edi
	callq	_lower_32_bits
	movq	_NAND_DMA_ADDR0@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_cafe_writel
	movl	(%rbx), %edi
	callq	_upper_32_bits
	movq	_NAND_DMA_ADDR1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_cafe_writel
	movq	8(%rbx), %r15
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_cafe_readl
	movl	4(%rbx), %ecx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movl	%eax, %edx
	callq	_cafe_dev_dbg
	movq	_usedma@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 68(%rbx)
	movl	$27, %edi
	callq	_BIT
	movl	%eax, 64(%rbx)
	cmpl	$2048, (%r14)                   ## imm = 0x800
	jne	LBB0_4
## %bb.3:
	movl	$29, %edi
	callq	_BIT
	orl	%eax, 64(%rbx)
LBB0_4:
	movq	_cafe_ooblayout_ops@GOTPCREL(%rip), %rsi
	movq	%r14, %rdi
	callq	_mtd_set_ooblayout
	movl	(%r14), %edx
	cmpl	$2048, %edx                     ## imm = 0x800
	je	LBB0_5
## %bb.6:
	cmpl	$512, %edx                      ## imm = 0x200
	jne	LBB0_10
## %bb.7:
	movq	_cafe_bbt_mirror_descr_512@GOTPCREL(%rip), %rax
	movq	_cafe_bbt_main_descr_512@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_9
LBB0_5:
	movq	_cafe_bbt_mirror_descr_2048@GOTPCREL(%rip), %rax
	movq	_cafe_bbt_main_descr_2048@GOTPCREL(%rip), %rcx
LBB0_8:
	movq	%rcx, 56(%rbx)
	movq	%rax, 48(%rbx)
	movq	_NAND_ECC_HW_SYNDROME@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 44(%rbx)
	movl	%edx, 16(%rbx)
	movabsq	$17179869198, %rax              ## imm = 0x40000000E
	movq	%rax, 20(%rbx)
	movq	_cafe_nand_write_page_lowlevel@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%rbx)
	movq	_cafe_nand_write_oob@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 36(%rbx)
	movq	_cafe_nand_read_page@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rbx)
	movq	_cafe_nand_read_oob@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 28(%rbx)
	xorl	%r14d, %r14d
	jmp	LBB0_9
LBB0_10:
	movq	8(%rbx), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_warn
	movq	_ENOTSUPP@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	movq	8(%rbx), %rdi
	movl	(%rbx), %ecx
	movl	4(%rbx), %edx
	movl	$2112, %esi                     ## imm = 0x840
	callq	_dma_free_coherent
LBB0_9:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_NAND_DMA_ADDR0,4,2             ## @NAND_DMA_ADDR0
	.comm	_NAND_DMA_ADDR1,4,2             ## @NAND_DMA_ADDR1
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Set DMA address to %x (virt %p)\n"

	.comm	_usedma,4,2                     ## @usedma
	.comm	_cafe_ooblayout_ops,4,2         ## @cafe_ooblayout_ops
	.comm	_cafe_bbt_main_descr_2048,4,2   ## @cafe_bbt_main_descr_2048
	.comm	_cafe_bbt_mirror_descr_2048,4,2 ## @cafe_bbt_mirror_descr_2048
	.comm	_cafe_bbt_main_descr_512,4,2    ## @cafe_bbt_main_descr_512
	.comm	_cafe_bbt_mirror_descr_512,4,2  ## @cafe_bbt_mirror_descr_512
L_.str.1:                               ## @.str.1
	.asciz	"Unexpected NAND flash writesize %d. Aborting\n"

	.comm	_ENOTSUPP,4,2                   ## @ENOTSUPP
	.comm	_NAND_ECC_HW_SYNDROME,4,2       ## @NAND_ECC_HW_SYNDROME
	.comm	_cafe_nand_write_page_lowlevel,4,2 ## @cafe_nand_write_page_lowlevel
	.comm	_cafe_nand_write_oob,4,2        ## @cafe_nand_write_oob
	.comm	_cafe_nand_read_page,4,2        ## @cafe_nand_read_page
	.comm	_cafe_nand_read_oob,4,2         ## @cafe_nand_read_oob
	.no_dead_strip	_cafe_nand_attach_chip
.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 cafe_nand_attach_chip
lCPI0_0:
	.long	14                              ; 0xe
	.long	4                               ; 0x4
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_cafe_nand_attach_chip:                 ; @cafe_nand_attach_chip
	.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
	bl	_nand_to_mtd
	mov	x20, x0
	mov	x0, x19
	bl	_nand_get_controller_data
	mov	x19, x0
	ldr	x0, [x0, #8]
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	mov	w1, #2112
	mov	x2, x19
	bl	_dma_alloc_coherent
	str	w0, [x19, #4]
	cbz	w0, LBB0_6
; %bb.1:
	ldr	w0, [x19]
	bl	_lower_32_bits
	mov	x1, x0
Lloh3:
	adrp	x22, _NAND_DMA_ADDR0@GOTPAGE
Lloh4:
	ldr	x22, [x22, _NAND_DMA_ADDR0@GOTPAGEOFF]
	ldr	w2, [x22]
	mov	x0, x19
	bl	_cafe_writel
	ldr	w0, [x19]
	bl	_upper_32_bits
	mov	x1, x0
Lloh5:
	adrp	x8, _NAND_DMA_ADDR1@GOTPAGE
Lloh6:
	ldr	x8, [x8, _NAND_DMA_ADDR1@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_cafe_writel
	ldr	x21, [x19, #8]
	ldr	w1, [x22]
	mov	x0, x19
	bl	_cafe_readl
	mov	x2, x0
	ldr	w3, [x19, #4]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_cafe_dev_dbg
Lloh10:
	adrp	x8, _usedma@GOTPAGE
Lloh11:
	ldr	x8, [x8, _usedma@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	str	w8, [x19, #68]
	mov	w0, #27
	bl	_BIT
	str	w0, [x19, #64]
	ldr	w8, [x20]
	cmp	w8, #2048
	b.ne	LBB0_3
; %bb.2:
	mov	w0, #29
	bl	_BIT
	ldr	w8, [x19, #64]
	orr	w8, w8, w0
	str	w8, [x19, #64]
LBB0_3:
Lloh13:
	adrp	x1, _cafe_ooblayout_ops@GOTPAGE
Lloh14:
	ldr	x1, [x1, _cafe_ooblayout_ops@GOTPAGEOFF]
	mov	x0, x20
	bl	_mtd_set_ooblayout
	ldr	w2, [x20]
	cmp	w2, #2048
	b.eq	LBB0_7
; %bb.4:
	cmp	w2, #512
	b.ne	LBB0_9
; %bb.5:
Lloh15:
	adrp	x8, _cafe_bbt_mirror_descr_512@GOTPAGE
Lloh16:
	ldr	x8, [x8, _cafe_bbt_mirror_descr_512@GOTPAGEOFF]
Lloh17:
	adrp	x9, _cafe_bbt_main_descr_512@GOTPAGE
Lloh18:
	ldr	x9, [x9, _cafe_bbt_main_descr_512@GOTPAGEOFF]
	b	LBB0_8
LBB0_6:
Lloh19:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_10
LBB0_7:
Lloh22:
	adrp	x8, _cafe_bbt_mirror_descr_2048@GOTPAGE
Lloh23:
	ldr	x8, [x8, _cafe_bbt_mirror_descr_2048@GOTPAGEOFF]
Lloh24:
	adrp	x9, _cafe_bbt_main_descr_2048@GOTPAGE
Lloh25:
	ldr	x9, [x9, _cafe_bbt_main_descr_2048@GOTPAGEOFF]
LBB0_8:
	mov	w20, #0
	stp	x8, x9, [x19, #48]
Lloh26:
	adrp	x8, _NAND_ECC_HW_SYNDROME@GOTPAGE
Lloh27:
	ldr	x8, [x8, _NAND_ECC_HW_SYNDROME@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	str	w8, [x19, #44]
	str	w2, [x19, #16]
Lloh29:
	adrp	x8, lCPI0_0@PAGE
Lloh30:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	stur	d0, [x19, #20]
Lloh31:
	adrp	x8, _cafe_nand_write_page_lowlevel@GOTPAGE
Lloh32:
	ldr	x8, [x8, _cafe_nand_write_page_lowlevel@GOTPAGEOFF]
Lloh33:
	adrp	x9, _cafe_nand_write_oob@GOTPAGE
Lloh34:
	ldr	x9, [x9, _cafe_nand_write_oob@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
Lloh36:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #36]
Lloh37:
	adrp	x8, _cafe_nand_read_page@GOTPAGE
Lloh38:
	ldr	x8, [x8, _cafe_nand_read_page@GOTPAGEOFF]
Lloh39:
	ldr	w8, [x8]
Lloh40:
	adrp	x9, _cafe_nand_read_oob@GOTPAGE
Lloh41:
	ldr	x9, [x9, _cafe_nand_read_oob@GOTPAGEOFF]
Lloh42:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #28]
	b	LBB0_10
LBB0_9:
	ldr	x0, [x19, #8]
Lloh43:
	adrp	x1, l_.str.1@PAGE
Lloh44:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_warn
Lloh45:
	adrp	x8, _ENOTSUPP@GOTPAGE
Lloh46:
	ldr	x8, [x8, _ENOTSUPP@GOTPAGEOFF]
Lloh47:
	ldr	w8, [x8]
	neg	w20, w8
	ldr	x0, [x19, #8]
	ldp	w3, w2, [x19]
	mov	w1, #2112
	bl	_dma_free_coherent
LBB0_10:
	mov	x0, x20
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh35
	.loh AdrpAdrp	Lloh29, Lloh31
	.loh AdrpLdr	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpAdd	Lloh43, Lloh44
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_NAND_DMA_ADDR0,4,2             ; @NAND_DMA_ADDR0
	.comm	_NAND_DMA_ADDR1,4,2             ; @NAND_DMA_ADDR1
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Set DMA address to %x (virt %p)\n"

	.comm	_usedma,4,2                     ; @usedma
	.comm	_cafe_ooblayout_ops,4,2         ; @cafe_ooblayout_ops
	.comm	_cafe_bbt_main_descr_2048,4,2   ; @cafe_bbt_main_descr_2048
	.comm	_cafe_bbt_mirror_descr_2048,4,2 ; @cafe_bbt_mirror_descr_2048
	.comm	_cafe_bbt_main_descr_512,4,2    ; @cafe_bbt_main_descr_512
	.comm	_cafe_bbt_mirror_descr_512,4,2  ; @cafe_bbt_mirror_descr_512
l_.str.1:                               ; @.str.1
	.asciz	"Unexpected NAND flash writesize %d. Aborting\n"

	.comm	_ENOTSUPP,4,2                   ; @ENOTSUPP
	.comm	_NAND_ECC_HW_SYNDROME,4,2       ; @NAND_ECC_HW_SYNDROME
	.comm	_cafe_nand_write_page_lowlevel,4,2 ; @cafe_nand_write_page_lowlevel
	.comm	_cafe_nand_write_oob,4,2        ; @cafe_nand_write_oob
	.comm	_cafe_nand_read_page,4,2        ; @cafe_nand_read_page
	.comm	_cafe_nand_read_oob,4,2         ; @cafe_nand_read_oob
	.no_dead_strip	_cafe_nand_attach_chip
.subsections_via_symbols
