	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar934x_nfc_attach_chip
_ar934x_nfc_attach_chip:                ## @ar934x_nfc_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, %r12
	callq	_nand_to_mtd
	movq	%rax, %rbx
	movq	%r12, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %r15
	movq	(%rbx), %r14
	movq	%rbx, %rdi
	callq	_ar934x_nfc_init_tail
	testl	%eax, %eax
	je	LBB0_1
LBB0_4:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movl	4(%r12), %edx
	movq	_NAND_ECC_HW@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	jne	LBB0_5
## %bb.2:
	movq	%r15, %rdi
	callq	_ar934x_nfc_setup_hwecc
	testl	%eax, %eax
	jne	LBB0_4
	jmp	LBB0_3
LBB0_5:
	movq	_NAND_ECC_SOFT@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	jne	LBB0_6
## %bb.8:
	movl	(%r12), %edx
	movq	_NAND_ECC_BCH@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	je	LBB0_3
## %bb.9:
	movq	_NAND_ECC_HAMMING@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	je	LBB0_3
## %bb.10:
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_7
LBB0_3:
	xorl	%eax, %eax
	jmp	LBB0_4
LBB0_6:
	leaq	L_.str(%rip), %rsi
LBB0_7:
	movq	%r14, %rdi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_ECC_HW,4,2                ## @NAND_ECC_HW
	.comm	_NAND_ECC_SOFT,4,2              ## @NAND_ECC_SOFT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unknown ECC mode %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_NAND_ECC_BCH,4,2               ## @NAND_ECC_BCH
	.comm	_NAND_ECC_HAMMING,4,2           ## @NAND_ECC_HAMMING
L_.str.1:                               ## @.str.1
	.asciz	"unknown software ECC algo %d\n"

	.no_dead_strip	_ar934x_nfc_attach_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ar934x_nfc_attach_chip
_ar934x_nfc_attach_chip:                ; @ar934x_nfc_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	x20, x0
	bl	_nand_to_mtd
	mov	x22, x0
	mov	x0, x20
	bl	_nand_get_controller_data
	mov	x21, x0
	ldr	x19, [x22]
	mov	x0, x22
	bl	_ar934x_nfc_init_tail
	cbz	w0, LBB0_2
LBB0_1:
	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_2:
	ldr	w2, [x20, #4]
Lloh0:
	adrp	x8, _NAND_ECC_HW@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NAND_ECC_HW@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w2, w8
	b.ne	LBB0_4
; %bb.3:
	mov	x0, x21
	bl	_ar934x_nfc_setup_hwecc
	cbnz	w0, LBB0_1
	b	LBB0_6
LBB0_4:
Lloh3:
	adrp	x8, _NAND_ECC_SOFT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _NAND_ECC_SOFT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w2, w8
	b.ne	LBB0_7
; %bb.5:
	ldr	w2, [x20]
Lloh6:
	adrp	x8, _NAND_ECC_BCH@GOTPAGE
Lloh7:
	ldr	x8, [x8, _NAND_ECC_BCH@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _NAND_ECC_HAMMING@GOTPAGE
Lloh10:
	ldr	x9, [x9, _NAND_ECC_HAMMING@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	cmp	w2, w8
	ccmp	w2, w9, #4, ne
	b.ne	LBB0_8
LBB0_6:
	mov	w0, #0
	b	LBB0_1
LBB0_7:
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_9
LBB0_8:
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_9:
	mov	x0, x19
	bl	_dev_err
Lloh16:
	adrp	x8, _EINVAL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_1
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_ECC_HW,4,2                ; @NAND_ECC_HW
	.comm	_NAND_ECC_SOFT,4,2              ; @NAND_ECC_SOFT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unknown ECC mode %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_NAND_ECC_BCH,4,2               ; @NAND_ECC_BCH
	.comm	_NAND_ECC_HAMMING,4,2           ; @NAND_ECC_HAMMING
l_.str.1:                               ; @.str.1
	.asciz	"unknown software ECC algo %d\n"

	.no_dead_strip	_ar934x_nfc_attach_chip
.subsections_via_symbols
