	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mxcnd_attach_chip
_mxcnd_attach_chip:                     ## @mxcnd_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, %r15
	movq	%rbx, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %r14
	movq	16(%r15), %r12
	movl	4(%rbx), %eax
	cmpl	$128, %eax
	je	LBB0_3
## %bb.1:
	cmpl	$129, %eax
	jne	LBB0_7
## %bb.2:
	movq	_mxc_nand_read_page@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 36(%rbx)
	movq	_mxc_nand_read_page_raw@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rbx)
	movq	_mxc_nand_read_oob@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 28(%rbx)
	movq	_mxc_nand_write_page_ecc@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%rbx)
	movq	_mxc_nand_write_page_raw@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%rbx)
	movq	_mxc_nand_write_oob@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%rbx)
LBB0_3:
	movq	_NAND_BBT_USE_FLASH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_5
## %bb.4:
	movq	_bbt_main_descr@GOTPCREL(%rip), %rax
	movq	%rax, 48(%rbx)
	movq	_bbt_mirror_descr@GOTPCREL(%rip), %rax
	movq	%rax, 40(%rbx)
LBB0_5:
	movq	16(%r14), %rsi
	movq	%r12, %rdi
	callq	_devm_kfree
	movq	(%r15), %rsi
	addq	8(%r15), %rsi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_devm_kzalloc
	movq	%rax, 16(%r14)
	testq	%rax, %rax
	je	LBB0_6
## %bb.9:
	movq	8(%r14), %rax
	movq	%r15, %rdi
	callq	*(%rax)
	cmpl	$0, 8(%rbx)
	jne	LBB0_15
## %bb.10:
	movl	(%r14), %eax
	cmpl	$8, %eax
	je	LBB0_11
## %bb.12:
	cmpl	$4, %eax
	jne	LBB0_15
## %bb.13:
	movl	$9, %eax
	jmp	LBB0_14
LBB0_7:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_6:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_8:
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_20
LBB0_11:
	movl	$18, %eax
LBB0_14:
	movl	%eax, 8(%rbx)
LBB0_15:
	movq	(%r15), %rdi
	movl	$218, %esi
	callq	_min
	movl	%eax, 4(%r14)
	xorl	%r15d, %r15d
	cmpl	$129, 4(%rbx)
	jne	LBB0_20
## %bb.16:
	movq	%r14, %rdi
	callq	_is_imx21_nfc
	testq	%rax, %rax
	jne	LBB0_18
## %bb.17:
	movq	%r14, %rdi
	callq	_is_imx27_nfc
	testq	%rax, %rax
	je	LBB0_19
LBB0_18:
	movl	$1, 12(%rbx)
LBB0_20:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_19:
	xorl	%eax, %eax
	cmpl	$4, (%r14)
	setne	%al
	leal	4(,%rax,4), %eax
	movl	%eax, 12(%rbx)
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_mxc_nand_read_page,4,2         ## @mxc_nand_read_page
	.comm	_mxc_nand_read_page_raw,4,2     ## @mxc_nand_read_page_raw
	.comm	_mxc_nand_read_oob,4,2          ## @mxc_nand_read_oob
	.comm	_mxc_nand_write_page_ecc,4,2    ## @mxc_nand_write_page_ecc
	.comm	_mxc_nand_write_page_raw,4,2    ## @mxc_nand_write_page_raw
	.comm	_mxc_nand_write_oob,4,2         ## @mxc_nand_write_oob
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_NAND_BBT_USE_FLASH,4,2         ## @NAND_BBT_USE_FLASH
	.comm	_bbt_main_descr,4,2             ## @bbt_main_descr
	.comm	_bbt_mirror_descr,4,2           ## @bbt_mirror_descr
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_mxcnd_attach_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mxcnd_attach_chip
_mxcnd_attach_chip:                     ; @mxcnd_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	x21, x0
	mov	x0, x19
	bl	_nand_get_controller_data
	mov	x20, x0
	ldr	x22, [x21, #16]
	ldr	w8, [x19, #4]
	cmp	w8, #128
	b.eq	LBB0_3
; %bb.1:
	cmp	w8, #129
	b.ne	LBB0_10
; %bb.2:
Lloh0:
	adrp	x8, _mxc_nand_read_page@GOTPAGE
Lloh1:
	ldr	x8, [x8, _mxc_nand_read_page@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _mxc_nand_read_page_raw@GOTPAGE
Lloh4:
	ldr	x9, [x9, _mxc_nand_read_page_raw@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #32]
Lloh6:
	adrp	x8, _mxc_nand_read_oob@GOTPAGE
Lloh7:
	ldr	x8, [x8, _mxc_nand_read_oob@GOTPAGEOFF]
Lloh8:
	adrp	x9, _mxc_nand_write_page_ecc@GOTPAGE
Lloh9:
	ldr	x9, [x9, _mxc_nand_write_page_ecc@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #24]
Lloh12:
	adrp	x8, _mxc_nand_write_page_raw@GOTPAGE
Lloh13:
	ldr	x8, [x8, _mxc_nand_write_page_raw@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _mxc_nand_write_oob@GOTPAGE
Lloh16:
	ldr	x9, [x9, _mxc_nand_write_oob@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #16]
LBB0_3:
	ldr	w8, [x19]
Lloh18:
	adrp	x9, _NAND_BBT_USE_FLASH@GOTPAGE
Lloh19:
	ldr	x9, [x9, _NAND_BBT_USE_FLASH@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.4:
Lloh21:
	adrp	x8, _bbt_main_descr@GOTPAGE
Lloh22:
	ldr	x8, [x8, _bbt_main_descr@GOTPAGEOFF]
Lloh23:
	adrp	x9, _bbt_mirror_descr@GOTPAGE
Lloh24:
	ldr	x9, [x9, _bbt_mirror_descr@GOTPAGEOFF]
	stp	x9, x8, [x19, #40]
LBB0_5:
	ldr	x1, [x20, #16]
	mov	x0, x22
	bl	_devm_kfree
	ldp	x9, x8, [x21]
	add	x1, x9, x8
Lloh25:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh26:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh27:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_devm_kzalloc
	str	x0, [x20, #16]
	cbz	x0, LBB0_11
; %bb.6:
	ldr	x8, [x20, #8]
	ldr	x8, [x8]
	mov	x0, x21
	blr	x8
	ldr	w8, [x19, #8]
	cbnz	w8, LBB0_15
; %bb.7:
	ldr	w8, [x20]
	cmp	w8, #8
	b.eq	LBB0_13
; %bb.8:
	cmp	w8, #4
	b.ne	LBB0_15
; %bb.9:
	mov	w8, #9
	b	LBB0_14
LBB0_10:
Lloh28:
	adrp	x8, _EINVAL@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
Lloh30:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh31:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_21
LBB0_13:
	mov	w8, #18
LBB0_14:
	str	w8, [x19, #8]
LBB0_15:
	ldr	x0, [x21]
	mov	w1, #218
	bl	_min
	str	w0, [x20, #4]
	ldr	w8, [x19, #4]
	cmp	w8, #129
	b.ne	LBB0_20
; %bb.16:
	mov	x0, x20
	bl	_is_imx21_nfc
	cbnz	x0, LBB0_18
; %bb.17:
	mov	x0, x20
	bl	_is_imx27_nfc
	cbz	x0, LBB0_22
LBB0_18:
	mov	w0, #0
	mov	w8, #1
LBB0_19:
	str	w8, [x19, #12]
	b	LBB0_21
LBB0_20:
	mov	w0, #0
LBB0_21:
	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
LBB0_22:
	ldr	w8, [x20]
	mov	w9, #8
	cmp	w8, #4
	csel	w8, w8, w9, eq
	b	LBB0_19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh10
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_mxc_nand_read_page,4,2         ; @mxc_nand_read_page
	.comm	_mxc_nand_read_page_raw,4,2     ; @mxc_nand_read_page_raw
	.comm	_mxc_nand_read_oob,4,2          ; @mxc_nand_read_oob
	.comm	_mxc_nand_write_page_ecc,4,2    ; @mxc_nand_write_page_ecc
	.comm	_mxc_nand_write_page_raw,4,2    ; @mxc_nand_write_page_raw
	.comm	_mxc_nand_write_oob,4,2         ; @mxc_nand_write_oob
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_NAND_BBT_USE_FLASH,4,2         ; @NAND_BBT_USE_FLASH
	.comm	_bbt_main_descr,4,2             ; @bbt_main_descr
	.comm	_bbt_mirror_descr,4,2           ; @bbt_mirror_descr
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_mxcnd_attach_chip
.subsections_via_symbols
