	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_nfc_attach_chip
_mtk_nfc_attach_chip:                   ## @mtk_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	%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
	callq	_nand_to_mtd
	movq	%rax, %r13
	movq	8(%rax), %r15
	movq	%rbx, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_to_mtk_nand
	movq	%rax, %r12
	movq	_NAND_BUSWIDTH_16@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_8:
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_9
LBB0_2:
	movl	4(%rbx), %eax
	movq	_NAND_BBT_USE_FLASH@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.3:
	movq	_NAND_BBT_NO_OOB@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, 4(%rbx)
LBB0_4:
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_mtk_nfc_ecc_init
	testl	%eax, %eax
	jne	LBB0_9
## %bb.5:
	leaq	8(%r12), %rdi
	movq	%r13, %rsi
	callq	_mtk_nfc_set_spare_per_sector
	testl	%eax, %eax
	jne	LBB0_9
## %bb.6:
	movq	%r12, %rdi
	addq	$4, %rdi
	movq	%r13, %rsi
	callq	_mtk_nfc_set_fdm
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	_mtk_nfc_set_bad_mark_ctl
	movl	4(%r13), %esi
	addl	(%r13), %esi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_devm_kzalloc
	movl	%eax, %ecx
	movl	%eax, (%r14)
	xorl	%eax, %eax
	testl	%ecx, %ecx
	je	LBB0_7
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_BUSWIDTH_16,4,2           ## @NAND_BUSWIDTH_16
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"16bits buswidth not supported"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_NAND_BBT_USE_FLASH,4,2         ## @NAND_BBT_USE_FLASH
	.comm	_NAND_BBT_NO_OOB,4,2            ## @NAND_BBT_NO_OOB
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_mtk_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 mtk_nfc_attach_chip
_mtk_nfc_attach_chip:                   ; @mtk_nfc_attach_chip
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x23, x0
	bl	_nand_to_mtd
	mov	x21, x0
	ldr	x19, [x0, #8]
	mov	x0, x23
	bl	_nand_get_controller_data
	mov	x20, x0
	mov	x0, x23
	bl	_to_mtk_nand
	ldr	w8, [x23]
Lloh0:
	adrp	x9, _NAND_BUSWIDTH_16@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NAND_BUSWIDTH_16@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_3
; %bb.1:
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_err
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_3:
	mov	x22, x0
	ldr	w8, [x23, #4]
Lloh7:
	adrp	x9, _NAND_BBT_USE_FLASH@GOTPAGE
Lloh8:
	ldr	x9, [x9, _NAND_BBT_USE_FLASH@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.4:
Lloh10:
	adrp	x9, _NAND_BBT_NO_OOB@GOTPAGE
Lloh11:
	ldr	x9, [x9, _NAND_BBT_NO_OOB@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x23, #4]
LBB0_5:
	mov	x0, x19
	mov	x1, x21
	bl	_mtk_nfc_ecc_init
	cbnz	w0, LBB0_9
; %bb.6:
	add	x0, x22, #8
	mov	x1, x21
	bl	_mtk_nfc_set_spare_per_sector
	cbnz	w0, LBB0_9
; %bb.7:
	add	x0, x22, #4
	mov	x1, x21
	bl	_mtk_nfc_set_fdm
	mov	x0, x22
	mov	x1, x21
	bl	_mtk_nfc_set_bad_mark_ctl
	ldp	w8, w9, [x21]
	add	w1, w9, w8
Lloh13:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_devm_kzalloc
	str	w0, [x20]
	cbz	w0, LBB0_10
; %bb.8:
	mov	w0, #0
LBB0_9:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_10:
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_BUSWIDTH_16,4,2           ; @NAND_BUSWIDTH_16
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"16bits buswidth not supported"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_NAND_BBT_USE_FLASH,4,2         ; @NAND_BBT_USE_FLASH
	.comm	_NAND_BBT_NO_OOB,4,2            ; @NAND_BBT_NO_OOB
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_mtk_nfc_attach_chip
.subsections_via_symbols
