	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nand_scan_bbt
_nand_scan_bbt:                         ## @nand_scan_bbt
	.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, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r13
	movl	(%rax), %eax
	movb	(%rbx), %cl
	addb	$2, %cl
	sarl	%cl, %eax
	movq	24(%rbx), %r12
	movq	16(%rbx), %r14
	testl	%eax, %eax
	movl	$1, %edi
	cmovnel	%eax, %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kzalloc
	movq	%rax, 8(%rbx)
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rbx, %rdi
	testq	%r12, %r12
	je	LBB0_3
## %bb.6:
	movq	%r12, %rsi
	callq	_verify_bbt_descr
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_verify_bbt_descr
	movb	(%rbx), %cl
	movl	$1, %eax
	shll	%cl, %eax
	movb	4(%rbx), %cl
	movl	%eax, %edi
	sarl	%cl, %edi
	imull	4(%r13), %edi
	addl	%eax, %edi
	callq	_vmalloc
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:
	movq	%rax, %r13
	movq	_NAND_BBT_ABSPAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_10
## %bb.9:
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movq	%r12, %rdx
	movq	%r14, %rcx
	callq	_read_abs_bbts
	jmp	LBB0_11
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_17
LBB0_3:
	movq	%r15, %rsi
	callq	_nand_memory_bbt
	testl	%eax, %eax
	je	LBB0_4
## %bb.5:
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_16
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_16
LBB0_10:
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movq	%r12, %rdx
	movq	%r14, %rcx
	callq	_search_read_bbts
LBB0_11:
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	callq	_check_create
	testl	%eax, %eax
	je	LBB0_12
## %bb.15:
	movl	%eax, %r15d
	movq	%r13, %rdi
	callq	_vfree
LBB0_16:
	movq	8(%rbx), %rdi
	callq	_kfree
	movq	$0, 8(%rbx)
LBB0_17:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	xorl	%r15d, %r15d
	jmp	LBB0_17
LBB0_12:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_mark_bbt_region
	testq	%r14, %r14
	je	LBB0_14
## %bb.13:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mark_bbt_region
LBB0_14:
	movq	%r13, %rdi
	callq	_vfree
	xorl	%r15d, %r15d
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"nand_bbt: can't scan flash and build the RAM-based BBT\n"

	.comm	_NAND_BBT_ABSPAGE,4,2           ## @NAND_BBT_ABSPAGE
	.no_dead_strip	_nand_scan_bbt
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nand_scan_bbt
_nand_scan_bbt:                         ; @nand_scan_bbt
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x21, x1
	mov	x19, x0
	bl	_nand_to_mtd
	mov	x23, x0
	ldp	x20, x22, [x19, #16]
	ldr	w8, [x0]
	ldr	w9, [x19]
	add	w9, w9, #2
	asr	w8, w8, w9
	cmp	w8, #0
	csinc	w0, w8, wzr, ne
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_kzalloc
	str	x0, [x19, #8]
	cbz	x0, LBB0_5
; %bb.1:
	mov	x0, x19
	cbz	x22, LBB0_6
; %bb.2:
	mov	x1, x22
	bl	_verify_bbt_descr
	mov	x0, x19
	mov	x1, x20
	bl	_verify_bbt_descr
	mov	w8, #1
	ldp	w9, w10, [x19]
	lsl	w8, w8, w9
	asr	w9, w8, w10
	ldr	w10, [x23, #4]
	madd	w0, w9, w10, w8
	bl	_vmalloc
	cbz	x0, LBB0_8
; %bb.3:
	mov	x23, x0
	ldr	w8, [x22]
Lloh3:
	adrp	x9, _NAND_BBT_ABSPAGE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _NAND_BBT_ABSPAGE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	mov	x0, x19
	mov	x1, x23
	mov	x2, x22
	mov	x3, x20
	tst	w9, w8
	b.eq	LBB0_9
; %bb.4:
	bl	_read_abs_bbts
	b	LBB0_10
LBB0_5:
Lloh6:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_13
LBB0_6:
	mov	x1, x21
	bl	_nand_memory_bbt
	mov	x21, x0
	cbz	w0, LBB0_13
; %bb.7:
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
	b	LBB0_12
LBB0_8:
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_12
LBB0_9:
	bl	_search_read_bbts
LBB0_10:
	mov	x0, x19
	mov	x1, x23
	mov	x2, x21
	bl	_check_create
	cbz	w0, LBB0_14
; %bb.11:
	mov	x21, x0
	mov	x0, x23
	bl	_vfree
LBB0_12:
	ldr	x0, [x19, #8]
	bl	_kfree
	str	xzr, [x19, #8]
LBB0_13:
	mov	x0, x21
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_14:
	mov	x0, x19
	mov	x1, x22
	bl	_mark_bbt_region
	cbz	x20, LBB0_16
; %bb.15:
	mov	x0, x19
	mov	x1, x20
	bl	_mark_bbt_region
LBB0_16:
	mov	x0, x23
	bl	_vfree
	mov	w21, #0
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"nand_bbt: can't scan flash and build the RAM-based BBT\n"

	.comm	_NAND_BBT_ABSPAGE,4,2           ; @NAND_BBT_ABSPAGE
	.no_dead_strip	_nand_scan_bbt
.subsections_via_symbols
