	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nand_jedec_detect              ## -- Begin function nand_jedec_detect
	.p2align	4, 0x90
_nand_jedec_detect:                     ## @nand_jedec_detect
	.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
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r12
	movq	%rbx, %rdi
	callq	_nanddev_get_memorg
	movq	%rax, %r15
	leaq	-49(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$64, %esi
	movl	$5, %ecx
	callq	_nand_readid_op
	xorl	%r13d, %r13d
	testl	%eax, %eax
	jne	LBB0_22
## %bb.1:
	leaq	L_.str(%rip), %rsi
	leaq	-49(%rbp), %rdi
	movl	$5, %edx
	callq	_strncmp
	testq	%rax, %rax
	jne	LBB0_22
## %bb.2:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$64, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %r14
	xorl	%r13d, %r13d
	movq	%rbx, %rdi
	movl	$64, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_nand_read_param_page_op
	testl	%eax, %eax
	jne	LBB0_21
## %bb.5:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$64, %edx
	movl	$1, %ecx
	callq	_nand_read_data_op
	testl	%eax, %eax
	je	LBB0_6
LBB0_21:
	movq	%r14, %rdi
	callq	_kfree
	jmp	LBB0_22
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_22:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	_ONFI_CRC_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r14, %rsi
	movl	$510, %edx                      ## imm = 0x1FE
	callq	_onfi_crc16
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	56(%r14), %edi
	callq	_le16_to_cpu
	cmpl	%eax, -44(%rbp)                 ## 4-byte Folded Reload
	jne	LBB0_7
LBB0_12:
	movl	52(%r14), %edi
	callq	_le16_to_cpu
	testb	$6, %al
	je	LBB0_13
## %bb.14:
	movl	48(%r14), %edi
	movl	$4, %esi
	callq	_sanitize_string
	movl	44(%r14), %edi
	movl	$4, %esi
	callq	_sanitize_string
	movl	44(%r14), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kstrdup
	movl	%eax, 12(%rbx)
	testl	%eax, %eax
	je	LBB0_15
## %bb.16:
	movl	40(%r14), %edi
	callq	_le32_to_cpu
	movl	%eax, (%r15)
	movl	%eax, (%r12)
	movl	36(%r14), %edi
	callq	_le32_to_cpu
	movl	%eax, %edi
	callq	_fls
                                        ## kill: def $eax killed $eax def $rax
	leal	-1(%rax), %ecx
	movl	$1, %eax
	shll	%cl, %eax
	movl	%eax, 4(%r15)
	movl	(%r15), %eax
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	movl	$1, %r13d
	movl	%eax, 4(%r12)
	movl	32(%r14), %edi
	callq	_le16_to_cpu
	movl	%eax, 8(%r15)
	movl	%eax, 8(%r12)
	movl	28(%r14), %eax
	movl	%eax, 24(%r15)
	movb	(%r14), %cl
	movl	$1, %eax
	shll	%cl, %eax
	movl	%eax, 12(%r15)
	movl	24(%r14), %edi
	callq	_le32_to_cpu
	movl	%eax, %edi
	callq	_fls
                                        ## kill: def $eax killed $eax def $rax
	leal	-1(%rax), %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %r13d
	movl	%r13d, 16(%r15)
	movl	20(%r14), %eax
	movl	%eax, 20(%r15)
	movl	16(%r14), %edi
	callq	_le16_to_cpu
	movq	_JEDEC_FEATURE_16_BIT_BUS@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_18
## %bb.17:
	movq	_NAND_BUSWIDTH_16@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 8(%rbx)
LBB0_18:
	movq	8(%r14), %rax
	movl	(%rax), %ecx
	cmpl	$9, %ecx
	jl	LBB0_20
## %bb.19:
	movl	4(%rax), %eax
	movl	%eax, 4(%rbx)
	movl	$1, %r13d
	movl	$1, %eax
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	movl	%eax, (%rbx)
	jmp	LBB0_21
LBB0_7:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$64, %edx
	movl	$1, %ecx
	callq	_nand_read_data_op
	testl	%eax, %eax
	jne	LBB0_21
## %bb.8:
	movq	_ONFI_CRC_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r14, %rsi
	movl	$510, %edx                      ## imm = 0x1FE
	callq	_onfi_crc16
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	56(%r14), %edi
	callq	_le16_to_cpu
	cmpl	%eax, -44(%rbp)                 ## 4-byte Folded Reload
	je	LBB0_12
## %bb.9:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$64, %edx
	movl	$1, %ecx
	callq	_nand_read_data_op
	testl	%eax, %eax
	jne	LBB0_21
## %bb.10:
	movq	_ONFI_CRC_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r14, %rsi
	movl	$510, %edx                      ## imm = 0x1FE
	callq	_onfi_crc16
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	56(%r14), %edi
	callq	_le16_to_cpu
	cmpl	%eax, -44(%rbp)                 ## 4-byte Folded Reload
	je	LBB0_12
## %bb.11:
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_21
LBB0_13:
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	callq	_pr_info
	jmp	LBB0_21
LBB0_15:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_21
LBB0_20:
	leaq	L_.str.3(%rip), %rdi
	callq	_pr_warn
	movl	$1, %r13d
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"JEDEC"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_ONFI_CRC_BASE,4,2              ## @ONFI_CRC_BASE
L_.str.1:                               ## @.str.1
	.asciz	"Could not find valid JEDEC parameter page; aborting\n"

L_.str.2:                               ## @.str.2
	.asciz	"unsupported JEDEC version: %d\n"

	.comm	_JEDEC_FEATURE_16_BIT_BUS,4,2   ## @JEDEC_FEATURE_16_BIT_BUS
	.comm	_NAND_BUSWIDTH_16,4,2           ## @NAND_BUSWIDTH_16
L_.str.3:                               ## @.str.3
	.asciz	"Invalid codeword size\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nand_jedec_detect              ; -- Begin function nand_jedec_detect
	.p2align	2
_nand_jedec_detect:                     ; @nand_jedec_detect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x20, x0
	bl	_nand_to_mtd
	mov	x22, x0
	mov	x0, x20
	bl	_nanddev_get_memorg
	mov	x21, x0
	add	x2, sp, #11
	mov	x0, x20
	mov	w1, #64
	mov	w3, #5
	bl	_nand_readid_op
	cbnz	w0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	add	x0, sp, #11
	mov	w2, #5
	bl	_strncmp
	cbz	x0, LBB0_4
LBB0_2:
	mov	w23, #0
LBB0_3:
	mov	x0, x23
	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
	add	sp, sp, #96
	ret
LBB0_4:
Lloh2:
	adrp	x24, _GFP_KERNEL@GOTPAGE
Lloh3:
	ldr	x24, [x24, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x24]
	mov	w0, #64
	bl	_kzalloc
	cbz	x0, LBB0_9
; %bb.5:
	mov	x19, x0
	mov	x0, x20
	mov	w1, #64
	mov	x2, #0
	mov	w3, #0
	bl	_nand_read_param_page_op
	mov	w23, #0
	cbnz	w0, LBB0_8
; %bb.6:
	mov	x0, x20
	mov	x1, x19
	mov	w2, #64
	mov	w3, #1
	bl	_nand_read_data_op
	cbz	w0, LBB0_10
LBB0_7:
	mov	w23, #0
LBB0_8:
	mov	x0, x19
	bl	_kfree
	b	LBB0_3
LBB0_9:
Lloh4:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_3
LBB0_10:
Lloh7:
	adrp	x25, _ONFI_CRC_BASE@GOTPAGE
Lloh8:
	ldr	x25, [x25, _ONFI_CRC_BASE@GOTPAGEOFF]
	ldr	w0, [x25]
	mov	x1, x19
	mov	w2, #510
	bl	_onfi_crc16
	mov	x23, x0
	ldr	w0, [x19, #56]
	bl	_le16_to_cpu
	cmp	w23, w0
	b.ne	LBB0_17
LBB0_11:
	ldr	w0, [x19, #52]
	bl	_le16_to_cpu
	tst	w0, #0x6
	b.eq	LBB0_22
; %bb.12:
	ldr	w0, [x19, #48]
	mov	w1, #4
	bl	_sanitize_string
	ldr	w0, [x19, #44]
	mov	w1, #4
	bl	_sanitize_string
	ldr	w0, [x19, #44]
	ldr	w1, [x24]
	bl	_kstrdup
	str	w0, [x20, #12]
	cbz	w0, LBB0_23
; %bb.13:
	ldr	w0, [x19, #40]
	bl	_le32_to_cpu
	str	w0, [x21]
	str	w0, [x22]
	ldr	w0, [x19, #36]
	bl	_le32_to_cpu
	bl	_fls
	sub	w8, w0, #1
	mov	w23, #1
	lsl	w9, w23, w8
	str	w9, [x21, #4]
	ldr	w9, [x21]
	lsl	w8, w9, w8
	str	w8, [x22, #4]
	ldr	w0, [x19, #32]
	bl	_le16_to_cpu
	str	w0, [x22, #8]
	ldp	w8, w9, [x19, #24]
	str	w9, [x21, #24]
	ldr	w9, [x19]
	lsl	w9, w23, w9
	stp	w0, w9, [x21, #8]
	mov	x0, x8
	bl	_le32_to_cpu
	bl	_fls
	sub	w8, w0, #1
	lsl	w8, w23, w8
	ldp	w0, w9, [x19, #16]
	stp	w8, w9, [x21, #16]
	bl	_le16_to_cpu
Lloh9:
	adrp	x8, _JEDEC_FEATURE_16_BIT_BUS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _JEDEC_FEATURE_16_BIT_BUS@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_15
; %bb.14:
Lloh12:
	adrp	x8, _NAND_BUSWIDTH_16@GOTPAGE
Lloh13:
	ldr	x8, [x8, _NAND_BUSWIDTH_16@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	ldr	w9, [x20, #8]
	orr	w8, w9, w8
	str	w8, [x20, #8]
LBB0_15:
	ldr	x9, [x19, #8]
	ldr	w8, [x9]
	cmp	w8, #9
	b.lt	LBB0_24
; %bb.16:
	ldr	w9, [x9, #4]
	mov	w23, #1
	lsl	w8, w23, w8
	stp	w8, w9, [x20]
	b	LBB0_8
LBB0_17:
	mov	x0, x20
	mov	x1, x19
	mov	w2, #64
	mov	w3, #1
	bl	_nand_read_data_op
	cbnz	w0, LBB0_7
; %bb.18:
	ldr	w0, [x25]
	mov	x1, x19
	mov	w2, #510
	bl	_onfi_crc16
	mov	x23, x0
	ldr	w0, [x19, #56]
	bl	_le16_to_cpu
	cmp	w23, w0
	b.eq	LBB0_11
; %bb.19:
	mov	x0, x20
	mov	x1, x19
	mov	w2, #64
	mov	w3, #1
	bl	_nand_read_data_op
	cbnz	w0, LBB0_7
; %bb.20:
	ldr	w0, [x25]
	mov	x1, x19
	mov	w2, #510
	bl	_onfi_crc16
	mov	x23, x0
	ldr	w0, [x19, #56]
	bl	_le16_to_cpu
	cmp	w23, w0
	b.eq	LBB0_11
; %bb.21:
Lloh15:
	adrp	x0, l_.str.1@PAGE
Lloh16:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
	b	LBB0_7
LBB0_22:
	mov	x1, x0
Lloh17:
	adrp	x0, l_.str.2@PAGE
Lloh18:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_info
	b	LBB0_7
LBB0_23:
Lloh19:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_8
LBB0_24:
Lloh22:
	adrp	x0, l_.str.3@PAGE
Lloh23:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_pr_warn
	mov	w23, #1
	b	LBB0_8
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"JEDEC"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_ONFI_CRC_BASE,4,2              ; @ONFI_CRC_BASE
l_.str.1:                               ; @.str.1
	.asciz	"Could not find valid JEDEC parameter page; aborting\n"

l_.str.2:                               ; @.str.2
	.asciz	"unsupported JEDEC version: %d\n"

	.comm	_JEDEC_FEATURE_16_BIT_BUS,4,2   ; @JEDEC_FEATURE_16_BIT_BUS
	.comm	_NAND_BUSWIDTH_16,4,2           ; @NAND_BUSWIDTH_16
l_.str.3:                               ; @.str.3
	.asciz	"Invalid codeword size\n"

.subsections_via_symbols
