	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function pxa3xx_nand_detect_config
LCPI0_0:
	.long	32                              ## 0x20
	.long	512                             ## 0x200
	.long	8                               ## 0x8
	.long	8                               ## 0x8
LCPI0_1:
	.long	64                              ## 0x40
	.long	2048                            ## 0x800
	.long	16                              ## 0x10
	.long	16                              ## 0x10
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_pxa3xx_nand_detect_config:             ## @pxa3xx_nand_detect_config
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	_NDCR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_nand_readl
	movl	$-1, -36(%rbp)
	movq	_NDCR_PG_PER_BLK@GOTPCREL(%rip), %rcx
	movq	_NDCR_PAGE_SZ@GOTPCREL(%rip), %rdx
	movq	_NDCR_DWIDTH_M@GOTPCREL(%rip), %rsi
	movq	_NDCR_DWIDTH_C@GOTPCREL(%rip), %rdi
	movd	(%rcx), %xmm0                   ## xmm0 = mem[0],zero,zero,zero
	pinsrd	$1, (%rdx), %xmm0
	pinsrd	$2, (%rsi), %xmm0
	pinsrd	$3, (%rdi), %xmm0
	movd	%eax, %xmm1
	pshufd	$0, %xmm1, %xmm1                ## xmm1 = xmm1[0,0,0,0]
	pand	%xmm0, %xmm1
	pxor	%xmm0, %xmm0
	pcmpeqd	%xmm1, %xmm0
	movaps	LCPI0_1(%rip), %xmm1            ## xmm1 = [64,2048,16,16]
	blendvps	%xmm0, LCPI0_0(%rip), %xmm1
	movq	_default_flash@GOTPCREL(%rip), %r15
	movups	%xmm1, (%r15)
	pextrb	$4, %xmm0, %ecx
	testb	$1, %cl
	je	LBB0_1
## %bb.2:
	movq	_smallpage_cmdset@GOTPCREL(%rip), %rdx
	jmp	LBB0_3
LBB0_1:
	movq	_largepage_cmdset@GOTPCREL(%rip), %rdx
LBB0_3:
	movq	%rdx, 32(%r15)
	movq	%r15, 24(%rbx)
	notb	%cl
	movzbl	%cl, %ecx
	andl	$1, %ecx
	addl	%ecx, %ecx
	addl	$2, %ecx
	movl	%ecx, (%rbx)
	movl	%eax, 4(%rbx)
	leaq	-36(%rbp), %rsi
	movq	%rbx, %rdi
	callq	___readid
	testq	%rax, %rax
	je	LBB0_5
LBB0_4:
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_10:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movzbl	-35(%rbp), %eax
	movl	%eax, -36(%rbp)
	movq	_nand_flash_ids@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r14
	cmpq	$0, 8(%r14)
	je	LBB0_4
## %bb.6:
	xorl	%ecx, %ecx
	movq	%r14, %rdx
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	(%rdx), %eax
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	incq	%rcx
	cmpq	$0, 24(%rdx)
	leaq	16(%rdx), %rdx
	jne	LBB0_7
	jmp	LBB0_4
LBB0_9:
	movl	%ecx, %r12d
	movl	4(%r15), %edi
	imull	(%r15), %edi
	callq	___ffs
	shlq	$4, %r12
	movl	4(%r14,%r12), %edx
	movb	$20, %cl
	subb	%al, %cl
	shll	%cl, %edx
	movl	%edx, 16(%r15)
	xorl	%eax, %eax
	cmpl	$2048, 4(%r15)                  ## imm = 0x800
	sete	%al
	movl	$64, %ecx
	movl	$16, %esi
	cmovel	%ecx, %esi
	movl	%esi, 8(%rbx)
	incl	%eax
	movl	%eax, 12(%rbx)
	imull	(%r15), %edx
	xorl	%eax, %eax
	cmpl	$65537, %edx                    ## imm = 0x10001
	setge	%al
	orl	$2, %eax
	movl	%eax, 16(%rbx)
	movq	_default_timing@GOTPCREL(%rip), %r14
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_pxa3xx_nand_detect_timing
	movq	%r14, 24(%r15)
	xorl	%eax, %eax
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_NDCR,4,2                       ## @NDCR
	.comm	_NDCR_PG_PER_BLK,4,2            ## @NDCR_PG_PER_BLK
	.comm	_default_flash,40,3             ## @default_flash
	.comm	_NDCR_PAGE_SZ,4,2               ## @NDCR_PAGE_SZ
	.comm	_NDCR_DWIDTH_M,4,2              ## @NDCR_DWIDTH_M
	.comm	_NDCR_DWIDTH_C,4,2              ## @NDCR_DWIDTH_C
	.comm	_largepage_cmdset,4,2           ## @largepage_cmdset
	.comm	_smallpage_cmdset,4,2           ## @smallpage_cmdset
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_nand_flash_ids,8,3             ## @nand_flash_ids
	.comm	_default_timing,4,2             ## @default_timing
	.no_dead_strip	_pxa3xx_nand_detect_config
.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 pxa3xx_nand_detect_config
lCPI0_0:
	.long	16                              ; 0x10
	.long	1                               ; 0x1
lCPI0_1:
	.long	64                              ; 0x40
	.long	2                               ; 0x2
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_pxa3xx_nand_detect_config:             ; @pxa3xx_nand_detect_config
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, _NDCR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NDCR@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_nand_readl
	mov	w8, #-1
	str	w8, [sp, #12]
Lloh3:
	adrp	x8, _NDCR_PG_PER_BLK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _NDCR_PG_PER_BLK@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w0
	mov	w8, #64
	mov	w9, #32
Lloh6:
	adrp	x21, _default_flash@GOTPAGE
Lloh7:
	ldr	x21, [x21, _default_flash@GOTPAGEOFF]
	csel	w8, w9, w8, eq
Lloh8:
	adrp	x9, _NDCR_DWIDTH_M@GOTPAGE
Lloh9:
	ldr	x9, [x9, _NDCR_DWIDTH_M@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w0
	mov	w9, #16
	mov	w10, #8
	csel	w11, w10, w9, eq
Lloh11:
	adrp	x12, _NDCR_DWIDTH_C@GOTPAGE
Lloh12:
	ldr	x12, [x12, _NDCR_DWIDTH_C@GOTPAGEOFF]
Lloh13:
	ldr	w12, [x12]
	tst	w12, w0
Lloh14:
	adrp	x12, _NDCR_PAGE_SZ@GOTPAGE
Lloh15:
	ldr	x12, [x12, _NDCR_PAGE_SZ@GOTPAGEOFF]
Lloh16:
	ldr	w12, [x12]
	csel	w9, w10, w9, eq
	tst	w12, w0
	mov	w10, #2048
	mov	w12, #512
	csel	w10, w12, w10, eq
	stp	w8, w10, [x21]
	stp	w11, w9, [x21, #8]
Lloh17:
	adrp	x8, _largepage_cmdset@GOTPAGE
Lloh18:
	ldr	x8, [x8, _largepage_cmdset@GOTPAGEOFF]
Lloh19:
	adrp	x9, _smallpage_cmdset@GOTPAGE
Lloh20:
	ldr	x9, [x9, _smallpage_cmdset@GOTPAGEOFF]
	csel	x8, x9, x8, eq
	str	x8, [x21, #32]
	str	x21, [x19, #24]
	mov	w8, #4
	mov	w9, #2
	csel	w8, w9, w8, eq
	stp	w8, w0, [x19]
	add	x1, sp, #12
	mov	x0, x19
	bl	___readid
	cbz	x0, LBB0_3
LBB0_1:
Lloh21:
	adrp	x8, _ENODEV@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_2:
	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
	add	sp, sp, #64
	ret
LBB0_3:
	ldrb	w8, [sp, #13]
	str	w8, [sp, #12]
Lloh24:
	adrp	x9, _nand_flash_ids@GOTPAGE
Lloh25:
	ldr	x9, [x9, _nand_flash_ids@GOTPAGEOFF]
Lloh26:
	ldr	x20, [x9]
	ldr	x9, [x20, #8]
	cbz	x9, LBB0_1
; %bb.4:
	mov	x22, #0
	mov	x9, x20
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x9]
	cmp	w8, w10
	b.eq	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x22, x22, #1
	ldr	x10, [x9, #24]
	add	x9, x9, #16
	cbnz	x10, LBB0_5
	b	LBB0_1
LBB0_7:
	ldp	w8, w9, [x21]
	mul	w0, w9, w8
	bl	___ffs
	add	x8, x20, w22, uxtw #4
	ldr	w8, [x8, #4]
	mov	w9, #20
	sub	w9, w9, w0
	lsl	w8, w8, w9
	str	w8, [x21, #16]
	ldp	w10, w9, [x21]
	cmp	w9, #2048
	cset	w9, eq
	dup.2s	v0, w9
	shl.2s	v0, v0, #31
	cmlt.2s	v0, v0, #0
Lloh27:
	adrp	x9, lCPI0_0@PAGE
Lloh28:
	ldr	d1, [x9, lCPI0_0@PAGEOFF]
Lloh29:
	adrp	x9, lCPI0_1@PAGE
Lloh30:
	ldr	d2, [x9, lCPI0_1@PAGEOFF]
	bsl.8b	v0, v2, v1
	str	d0, [x19, #8]
	mul	w8, w10, w8
	cmp	w8, #16, lsl #12                ; =65536
	mov	w8, #2
	cinc	w8, w8, gt
	str	w8, [x19, #16]
Lloh31:
	adrp	x20, _default_timing@GOTPAGE
Lloh32:
	ldr	x20, [x20, _default_timing@GOTPAGEOFF]
	mov	x0, x19
	mov	x1, x20
	bl	_pxa3xx_nand_detect_timing
	mov	w0, #0
	str	x20, [x21, #24]
	b	LBB0_2
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdr	Lloh29, Lloh30
	.loh AdrpAdrp	Lloh27, Lloh29
	.loh AdrpLdr	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_NDCR,4,2                       ; @NDCR
	.comm	_NDCR_PG_PER_BLK,4,2            ; @NDCR_PG_PER_BLK
	.comm	_default_flash,40,3             ; @default_flash
	.comm	_NDCR_PAGE_SZ,4,2               ; @NDCR_PAGE_SZ
	.comm	_NDCR_DWIDTH_M,4,2              ; @NDCR_DWIDTH_M
	.comm	_NDCR_DWIDTH_C,4,2              ; @NDCR_DWIDTH_C
	.comm	_largepage_cmdset,4,2           ; @largepage_cmdset
	.comm	_smallpage_cmdset,4,2           ; @smallpage_cmdset
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_nand_flash_ids,8,3             ; @nand_flash_ids
	.comm	_default_timing,4,2             ; @default_timing
	.no_dead_strip	_pxa3xx_nand_detect_config
.subsections_via_symbols
