	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sunxi_nfc_select_chip
_sunxi_nfc_select_chip:                 ## @sunxi_nfc_select_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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r12d
	movq	%rdi, %r15
	callq	_nand_to_mtd
	movq	%rax, %r14
	movq	%r15, %rdi
	callq	_to_sunxi_nand
	movq	%rax, %rbx
	movl	32(%rax), %edi
	callq	_to_sunxi_nfc
	testl	%r12d, %r12d
	je	LBB0_2
## %bb.1:
	cmpl	%r12d, (%rbx)
	jbe	LBB0_7
LBB0_2:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	_NFC_REG_CTL@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdi
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	addq	8(%rax), %rdi
	callq	_readl
	movq	_NFC_PAGE_SHIFT_MSK@GOTPCREL(%rip), %rcx
	movq	_NFC_CE_SEL_MSK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r14d
	orl	(%rcx), %r14d
	movq	_NFC_RB_SEL_MSK@GOTPCREL(%rip), %rcx
	orl	(%rcx), %r14d
	movq	_NFC_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %r14d
	notl	%r14d
	andl	%eax, %r14d
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	24(%rbx), %r13
	movl	%r12d, %r12d
	shlq	$4, %r12
	movl	8(%r13,%r12), %edi
	callq	_NFC_CE_SEL
	movq	%r15, %rcx
	movl	%eax, %r15d
	movl	(%rcx), %edi
	orl	%r14d, %r15d
	movq	_NFC_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %r15d
	callq	_NFC_PAGE_SHIFT
	movl	%eax, %r14d
	orl	%r15d, %r14d
	movq	(%r13,%r12), %rdi
	testq	%rdi, %rdi
	js	LBB0_4
## %bb.3:
	callq	_NFC_RB_SEL
	orl	%eax, %r14d
LBB0_4:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movq	_NFC_REG_SPARE_AREA@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	addq	8(%rbx), %rsi
	callq	_writel
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	8(%r15), %rsi
	cmpq	%rsi, (%rbx)
	je	LBB0_6
## %bb.5:
	movl	16(%rbx), %edi
	callq	_clk_set_rate
	movq	8(%r15), %rax
	movq	%rax, (%rbx)
LBB0_6:
	movl	16(%r15), %edi
	movq	_NFC_REG_TIMING_CTL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%rbx), %rsi
	callq	_writel
	movl	20(%r15), %edi
	movq	_NFC_REG_TIMING_CFG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%rbx), %rsi
	callq	_writel
	movq	_NFC_REG_CTL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%rbx), %rsi
	movl	%r14d, %edi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_writel                         ## TAILCALL
LBB0_7:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NFC_REG_CTL,8,3                ## @NFC_REG_CTL
	.comm	_NFC_PAGE_SHIFT_MSK,4,2         ## @NFC_PAGE_SHIFT_MSK
	.comm	_NFC_CE_SEL_MSK,4,2             ## @NFC_CE_SEL_MSK
	.comm	_NFC_RB_SEL_MSK,4,2             ## @NFC_RB_SEL_MSK
	.comm	_NFC_EN,4,2                     ## @NFC_EN
	.comm	_NFC_REG_SPARE_AREA,8,3         ## @NFC_REG_SPARE_AREA
	.comm	_NFC_REG_TIMING_CTL,8,3         ## @NFC_REG_TIMING_CTL
	.comm	_NFC_REG_TIMING_CFG,8,3         ## @NFC_REG_TIMING_CFG
	.no_dead_strip	_sunxi_nfc_select_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sunxi_nfc_select_chip
_sunxi_nfc_select_chip:                 ; @sunxi_nfc_select_chip
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x23, x1
	mov	x22, x0
	bl	_nand_to_mtd
	mov	x21, x0
	mov	x0, x22
	bl	_to_sunxi_nand
	mov	x20, x0
	ldr	w0, [x0, #32]
	bl	_to_sunxi_nfc
	mov	x19, x0
	cbz	w23, LBB0_2
; %bb.1:
	ldr	w8, [x20]
	cmp	w8, w23
	b.ls	LBB0_7
LBB0_2:
	ldr	x8, [x19, #8]
Lloh0:
	adrp	x24, _NFC_REG_CTL@GOTPAGE
Lloh1:
	ldr	x24, [x24, _NFC_REG_CTL@GOTPAGEOFF]
	ldr	x9, [x24]
	add	x0, x9, x8
	bl	_readl
Lloh2:
	adrp	x8, _NFC_PAGE_SHIFT_MSK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _NFC_PAGE_SHIFT_MSK@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _NFC_CE_SEL_MSK@GOTPAGE
Lloh6:
	ldr	x9, [x9, _NFC_CE_SEL_MSK@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh8:
	adrp	x9, _NFC_RB_SEL_MSK@GOTPAGE
Lloh9:
	ldr	x9, [x9, _NFC_RB_SEL_MSK@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh11:
	adrp	x25, _NFC_EN@GOTPAGE
Lloh12:
	ldr	x25, [x25, _NFC_EN@GOTPAGEOFF]
	ldr	w9, [x25]
	orr	w8, w8, w9
	bic	w26, w0, w8
	ldr	x8, [x20, #24]
	add	x27, x8, w23, uxtw #4
	ldr	w0, [x27, #8]
	bl	_NFC_CE_SEL
	mov	x23, x0
	ldr	w25, [x25]
	ldr	w0, [x22]
	bl	_NFC_PAGE_SHIFT
	orr	w8, w23, w26
	orr	w8, w8, w25
	orr	w22, w8, w0
	ldr	x0, [x27]
	tbnz	x0, #63, LBB0_4
; %bb.3:
	bl	_NFC_RB_SEL
	orr	w22, w0, w22
LBB0_4:
	ldr	w0, [x21]
	ldr	x8, [x19, #8]
Lloh13:
	adrp	x9, _NFC_REG_SPARE_AREA@GOTPAGE
Lloh14:
	ldr	x9, [x9, _NFC_REG_SPARE_AREA@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [x19]
	ldr	x1, [x20, #8]
	cmp	x8, x1
	b.eq	LBB0_6
; %bb.5:
	ldr	w0, [x19, #16]
	bl	_clk_set_rate
	ldr	x8, [x20, #8]
	str	x8, [x19]
LBB0_6:
	ldr	w0, [x20, #16]
	ldr	x8, [x19, #8]
Lloh16:
	adrp	x9, _NFC_REG_TIMING_CTL@GOTPAGE
Lloh17:
	ldr	x9, [x9, _NFC_REG_TIMING_CTL@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	w0, [x20, #20]
	ldr	x8, [x19, #8]
Lloh19:
	adrp	x9, _NFC_REG_TIMING_CFG@GOTPAGE
Lloh20:
	ldr	x9, [x9, _NFC_REG_TIMING_CFG@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [x19, #8]
	ldr	x9, [x24]
	add	x1, x9, x8
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_writel
LBB0_7:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_NFC_REG_CTL,8,3                ; @NFC_REG_CTL
	.comm	_NFC_PAGE_SHIFT_MSK,4,2         ; @NFC_PAGE_SHIFT_MSK
	.comm	_NFC_CE_SEL_MSK,4,2             ; @NFC_CE_SEL_MSK
	.comm	_NFC_RB_SEL_MSK,4,2             ; @NFC_RB_SEL_MSK
	.comm	_NFC_EN,4,2                     ; @NFC_EN
	.comm	_NFC_REG_SPARE_AREA,8,3         ; @NFC_REG_SPARE_AREA
	.comm	_NFC_REG_TIMING_CTL,8,3         ; @NFC_REG_TIMING_CTL
	.comm	_NFC_REG_TIMING_CFG,8,3         ; @NFC_REG_TIMING_CFG
	.no_dead_strip	_sunxi_nfc_select_chip
.subsections_via_symbols
