	.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_config_flash
LCPI0_0:
	.long	2048                            ## 0x800
	.long	65536                           ## 0x10000
	.space	4
	.space	4
LCPI0_1:
	.long	64                              ## 0x40
	.long	4                               ## 0x4
	.long	2                               ## 0x2
	.long	3                               ## 0x3
LCPI0_2:
	.long	16                              ## 0x10
	.long	2                               ## 0x2
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_pxa3xx_nand_config_flash:              ## @pxa3xx_nand_config_flash
	.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	%rsi, %r15
	movq	%rdi, %r14
	movq	32(%rdi), %rax
	movq	(%rax), %rcx
	movl	(%rsi), %esi
	cmpl	$512, %esi                      ## imm = 0x200
	je	LBB0_3
## %bb.1:
	cmpl	$2048, %esi                     ## imm = 0x800
	jne	LBB0_2
LBB0_3:
	movl	4(%r15), %eax
	cmpl	$8, %eax
	je	LBB0_5
## %bb.4:
	cmpl	$16, %eax
	jne	LBB0_2
LBB0_5:
	movl	12(%r15), %edx
	movl	8(%r15), %edi
	imull	%edx, %edi
	movd	%esi, %xmm0
	pinsrd	$1, %edi, %xmm0
	movdqa	LCPI0_0(%rip), %xmm1            ## xmm1 = <2048,65536,u,u>
	movdqa	%xmm0, %xmm2
	pcmpeqd	%xmm1, %xmm2
	pmovsxdq	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm0
	pblendw	$243, %xmm3, %xmm0              ## xmm0 = xmm3[0,1],xmm0[2,3],xmm3[4,5,6,7]
	pshufd	$64, %xmm0, %xmm0               ## xmm0 = xmm0[0,0,0,1]
	movq	%xmm2, %rdi
	movaps	LCPI0_2(%rip), %xmm1            ## xmm1 = [16,2,1,2]
	blendvps	%xmm0, LCPI0_1(%rip), %xmm1
	movups	%xmm1, (%r14)
	movq	_NDCR_ND_ARB_EN@GOTPCREL(%rip), %rsi
	movl	$4095, %ebx                     ## imm = 0xFFF
	movl	(%rsi), %esi
	orl	%ebx, %esi
	cmpq	$0, (%rcx)
	cmovel	%ebx, %esi
	movq	_NDCR_RA_START@GOTPCREL(%rip), %rcx
	xorl	%r12d, %r12d
	testb	$1, %dil
	movl	(%rcx), %ebx
	cmovel	%r12d, %ebx
	movq	_NDCR_PAGE_SZ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmovel	%r12d, %ecx
	movl	$0, %edi
	cmpl	$64, %edx
	jne	LBB0_7
## %bb.6:
	movq	_NDCR_PG_PER_BLK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edi
LBB0_7:
	orl	%edi, %esi
	orl	%esi, %ebx
	movl	$0, %edx
	cmpl	$16, %eax
	jne	LBB0_9
## %bb.8:
	movq	_NDCR_DWIDTH_M@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
LBB0_9:
	orl	%edx, %ecx
	orl	%ecx, %ebx
	cmpl	$16, 16(%r15)
	movl	$0, %r13d
	jne	LBB0_11
## %bb.10:
	movq	_NDCR_DWIDTH_C@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
LBB0_11:
	extractps	$1, %xmm1, %edi
	callq	_NDCR_RD_ID_CNT
	orl	%r13d, %eax
	orl	%eax, %ebx
	movq	_NDCR_SPARE_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movl	%ebx, 16(%r14)
	movl	20(%r15), %esi
	movq	%r14, %rdi
	callq	_pxa3xx_nand_set_timing
	movq	%r15, 24(%r14)
	jmp	LBB0_12
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_12:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_NDCR_ND_ARB_EN,4,2             ## @NDCR_ND_ARB_EN
	.comm	_NDCR_RA_START,4,2              ## @NDCR_RA_START
	.comm	_NDCR_PG_PER_BLK,4,2            ## @NDCR_PG_PER_BLK
	.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	_NDCR_SPARE_EN,4,2              ## @NDCR_SPARE_EN
	.no_dead_strip	_pxa3xx_nand_config_flash
.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_config_flash
lCPI0_0:
	.long	2                               ; 0x2
	.long	1                               ; 0x1
lCPI0_1:
	.long	4                               ; 0x4
	.long	2                               ; 0x2
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_pxa3xx_nand_config_flash:              ; @pxa3xx_nand_config_flash
	.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, x1
	mov	x20, x0
	ldr	x8, [x0, #32]
	ldr	x9, [x8]
	ldr	w10, [x1]
	cmp	w10, #512
	b.eq	LBB0_2
; %bb.1:
	cmp	w10, #2048
	b.ne	LBB0_4
LBB0_2:
	ldr	w8, [x19, #4]
	cmp	w8, #8
	ccmp	w8, #16, #4, ne
	b.ne	LBB0_4
; %bb.3:
	mov	w11, #16
	mov	w12, #64
	cmp	w10, #2048
	csel	w10, w12, w11, eq
	cset	w11, eq
	dup.2s	v0, w11
	str	w10, [x20]
	shl.2s	v0, v0, #31
	cmlt.2s	v0, v0, #0
Lloh0:
	adrp	x10, lCPI0_0@PAGE
Lloh1:
	ldr	d1, [x10, lCPI0_0@PAGEOFF]
Lloh2:
	adrp	x10, lCPI0_1@PAGE
Lloh3:
	ldr	d2, [x10, lCPI0_1@PAGEOFF]
	bsl.8b	v0, v2, v1
	stur	d0, [x20, #4]
	ldp	w10, w11, [x19, #8]
	mul	w10, w11, w10
Lloh4:
	adrp	x12, _NDCR_RA_START@GOTPAGE
Lloh5:
	ldr	x12, [x12, _NDCR_RA_START@GOTPAGEOFF]
Lloh6:
	ldr	w12, [x12]
	csel	w12, w12, wzr, eq
Lloh7:
	adrp	x13, _NDCR_PAGE_SZ@GOTPAGE
Lloh8:
	ldr	x13, [x13, _NDCR_PAGE_SZ@GOTPAGEOFF]
Lloh9:
	ldr	w13, [x13]
	csel	w13, w13, wzr, eq
	cmp	w10, #16, lsl #12               ; =65536
	mov	w10, #2
	cinc	w10, w10, gt
	str	w10, [x20, #12]
	ldr	x9, [x9]
Lloh10:
	adrp	x10, _NDCR_ND_ARB_EN@GOTPAGE
Lloh11:
	ldr	x10, [x10, _NDCR_ND_ARB_EN@GOTPAGEOFF]
Lloh12:
	ldr	w10, [x10]
	orr	w10, w10, #0xfff
	cmp	x9, #0
	mov	w9, #4095
	csel	w9, w9, w10, eq
	orr	w9, w9, w12
Lloh13:
	adrp	x10, _NDCR_PG_PER_BLK@GOTPAGE
Lloh14:
	ldr	x10, [x10, _NDCR_PG_PER_BLK@GOTPAGEOFF]
Lloh15:
	ldr	w10, [x10]
	cmp	w11, #64
	csel	w10, w10, wzr, eq
	orr	w9, w9, w10
	orr	w9, w9, w13
Lloh16:
	adrp	x10, _NDCR_DWIDTH_M@GOTPAGE
Lloh17:
	ldr	x10, [x10, _NDCR_DWIDTH_M@GOTPAGEOFF]
Lloh18:
	ldr	w10, [x10]
	cmp	w8, #16
	csel	w8, w10, wzr, eq
	orr	w8, w9, w8
Lloh19:
	adrp	x9, _NDCR_DWIDTH_C@GOTPAGE
Lloh20:
	ldr	x9, [x9, _NDCR_DWIDTH_C@GOTPAGEOFF]
	ldr	w10, [x19, #16]
Lloh21:
	ldr	w9, [x9]
	cmp	w10, #16
	csel	w9, w9, wzr, eq
	orr	w21, w8, w9
	fmov	w0, s0
	bl	_NDCR_RD_ID_CNT
	orr	w8, w21, w0
Lloh22:
	adrp	x9, _NDCR_SPARE_EN@GOTPAGE
Lloh23:
	ldr	x9, [x9, _NDCR_SPARE_EN@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [x20, #16]
	ldr	w1, [x19, #20]
	mov	x0, x20
	bl	_pxa3xx_nand_set_timing
	mov	w0, #0
	str	x19, [x20, #24]
	b	LBB0_5
LBB0_4:
Lloh25:
	adrp	x8, _EINVAL@GOTPAGE
Lloh26:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	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
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdr	Lloh2, Lloh3
	.loh AdrpAdrp	Lloh0, Lloh2
	.loh AdrpLdr	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_NDCR_ND_ARB_EN,4,2             ; @NDCR_ND_ARB_EN
	.comm	_NDCR_RA_START,4,2              ; @NDCR_RA_START
	.comm	_NDCR_PG_PER_BLK,4,2            ; @NDCR_PG_PER_BLK
	.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	_NDCR_SPARE_EN,4,2              ; @NDCR_SPARE_EN
	.no_dead_strip	_pxa3xx_nand_config_flash
.subsections_via_symbols
