	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nand_scan_ident
_nand_scan_ident:                       ## @nand_scan_ident
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r13
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r14
	leaq	8(%rbx), %r15
	movq	%r15, %rdi
	callq	_nanddev_get_memorg
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	$-1, (%rbx)
	leaq	24(%rbx), %rdi
	callq	_mutex_init
	movq	_NAND_SDR_IFACE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_onfi_fill_data_interface
	movq	%rbx, %rdi
	callq	_nand_dt_init
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_19
## %bb.1:
	cmpq	$0, 16(%r14)
	jne	LBB0_4
## %bb.2:
	movq	8(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.3:
	callq	_dev_name
	movq	%rax, 16(%r14)
LBB0_4:
	movq	%rbx, %rdi
	callq	_nand_set_defaults
	movq	%rbx, %rdi
	callq	_nand_legacy_check_hooks
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_19
## %bb.5:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, (%rax)
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_nand_detect
	testl	%eax, %eax
	je	LBB0_9
## %bb.6:
	movl	%eax, %r12d
	movq	_NAND_SCAN_SILENT_NODEV@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 4(%rbx)
	jne	LBB0_8
## %bb.7:
	leaq	L_.str(%rip), %rdi
	callq	_pr_warn
LBB0_8:
	movq	%rbx, %rdi
	callq	_nand_deselect_target
	jmp	LBB0_19
LBB0_9:
	movq	16(%rbx), %rax
	movsd	(%rax), %xmm0                   ## xmm0 = mem[0],zero
	movapd	%xmm0, -80(%rbp)                ## 16-byte Spill
	movq	%rbx, %rdi
	callq	_nand_deselect_target
	movl	$1, %r13d
	cmpl	$2, -44(%rbp)                   ## 4-byte Folded Reload
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	jb	LBB0_18
## %bb.10:
	movl	$1, %r13d
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	%r13d, %esi
	callq	_nand_reset
	testl	%eax, %eax
	jne	LBB0_16
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	%rbx, %rdi
	movl	%r13d, %esi
	callq	_nand_select_target
	movq	%rbx, %rdi
	xorl	%esi, %esi
	leaq	-64(%rbp), %rdx
	movl	$8, %ecx
	callq	_nand_readid_op
	testl	%eax, %eax
	jne	LBB0_16
## %bb.13:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	-64(%rbp), %xmm0                ## xmm0 = mem[0],zero
	pcmpeqd	-80(%rbp), %xmm0                ## 16-byte Folded Reload
	pmovsxdq	%xmm0, %xmm0
	movmskpd	%xmm0, %r12d
	movq	%rbx, %rdi
	callq	_nand_deselect_target
	cmpb	$3, %r12b
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	jne	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_11 Depth=1
	incl	%r13d
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	cmpl	%r13d, %eax
	jne	LBB0_11
## %bb.15:
	movl	%eax, %r13d
LBB0_16:
	cmpl	$2, %r13d
	jb	LBB0_18
## %bb.17:
	leaq	L_.str.1(%rip), %rdi
	movl	%r13d, %esi
	callq	_pr_info
LBB0_18:
	movl	%r13d, (%r12)
	movq	%r15, %rdi
	callq	_nanddev_target_size
	imull	%r13d, %eax
	movl	%eax, (%r14)
	xorl	%r12d, %r12d
LBB0_19:
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_SDR_IFACE,4,2             ## @NAND_SDR_IFACE
	.comm	_NAND_SCAN_SILENT_NODEV,4,2     ## @NAND_SCAN_SILENT_NODEV
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No NAND device found\n"

L_.str.1:                               ## @.str.1
	.asciz	"%d chips detected\n"

	.no_dead_strip	_nand_scan_ident
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nand_scan_ident
_nand_scan_ident:                       ; @nand_scan_ident
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x24, x2
	mov	x23, x1
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #8]
	bl	_nand_to_mtd
	mov	x19, x0
	add	x20, x21, #8
	mov	x0, x20
	bl	_nanddev_get_memorg
	mov	x22, x0
	mov	w8, #-1
	mov	x0, x21
	str	w8, [x0], #24
	bl	_mutex_init
Lloh3:
	adrp	x8, _NAND_SDR_IFACE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _NAND_SDR_IFACE@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x21
	mov	w2, #0
	bl	_onfi_fill_data_interface
	mov	x0, x21
	bl	_nand_dt_init
	mov	x25, x0
	cbnz	w0, LBB0_19
; %bb.1:
	ldr	x8, [x19, #16]
	cbnz	x8, LBB0_4
; %bb.2:
	ldr	x0, [x19, #8]
	cbz	x0, LBB0_4
; %bb.3:
	bl	_dev_name
	str	x0, [x19, #16]
LBB0_4:
	mov	x0, x21
	bl	_nand_set_defaults
	mov	x0, x21
	bl	_nand_legacy_check_hooks
	mov	x25, x0
	cbnz	w0, LBB0_19
; %bb.5:
	str	w23, [x22]
	mov	x0, x21
	mov	x1, x24
	bl	_nand_detect
	cbz	w0, LBB0_9
; %bb.6:
	mov	x25, x0
	ldr	w8, [x21, #4]
Lloh6:
	adrp	x9, _NAND_SCAN_SILENT_NODEV@GOTPAGE
Lloh7:
	ldr	x9, [x9, _NAND_SCAN_SILENT_NODEV@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_8
; %bb.7:
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_warn
LBB0_8:
	mov	x0, x21
	bl	_nand_deselect_target
	b	LBB0_19
LBB0_9:
	ldr	x8, [x21, #16]
	ldp	w25, w26, [x8]
	mov	x0, x21
	bl	_nand_deselect_target
	mov	w24, #1
	cmp	w23, #2
	b.lo	LBB0_18
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	mov	x1, x24
	bl	_nand_reset
	cbnz	w0, LBB0_16
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x21
	mov	x1, x24
	bl	_nand_select_target
	mov	x2, sp
	mov	x0, x21
	mov	w1, #0
	mov	w3, #8
	bl	_nand_readid_op
	cbnz	w0, LBB0_16
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=1
	ldp	w28, w27, [sp]
	mov	x0, x21
	bl	_nand_deselect_target
	cmp	w25, w28
	b.ne	LBB0_16
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=1
	cmp	w26, w27
	b.ne	LBB0_16
; %bb.14:                               ;   in Loop: Header=BB0_10 Depth=1
	add	w24, w24, #1
	cmp	w23, w24
	b.ne	LBB0_10
; %bb.15:
	mov	x24, x23
LBB0_16:
	cmp	w24, #2
	b.lo	LBB0_18
; %bb.17:
Lloh11:
	adrp	x0, l_.str.1@PAGE
Lloh12:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x24
	bl	_pr_info
LBB0_18:
	str	w24, [x22]
	mov	x0, x20
	bl	_nanddev_target_size
	mov	w25, #0
	mul	w8, w0, w24
	str	w8, [x19]
LBB0_19:
	ldr	x8, [sp, #8]
Lloh13:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh14:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_21
; %bb.20:
	mov	x0, x25
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_21:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_SDR_IFACE,4,2             ; @NAND_SDR_IFACE
	.comm	_NAND_SCAN_SILENT_NODEV,4,2     ; @NAND_SCAN_SILENT_NODEV
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No NAND device found\n"

l_.str.1:                               ; @.str.1
	.asciz	"%d chips detected\n"

	.no_dead_strip	_nand_scan_ident
.subsections_via_symbols
