	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function search_bbt
_search_bbt:                            ## @search_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
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r13
	movq	%rsi, -104(%rbp)                ## 8-byte Spill
	movq	%rdi, %rbx
	leaq	8(%rdi), %r12
	movq	%r12, %rdi
	callq	_nanddev_target_size
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movq	%rbx, %rdi
	callq	_nand_to_mtd
	movq	%rax, %r14
	movl	4(%rax), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	(%rbx), %r15d
	movl	(%r13), %eax
	movq	_NAND_BBT_LASTBLOCK@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_1
## %bb.2:
	movl	8(%r14), %edx
	movl	%r15d, %ecx
	sarl	%cl, %edx
	decl	%edx
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	$-1, -80(%rbp)                  ## 8-byte Folded Spill
	jmp	LBB0_3
LBB0_1:
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movl	$1, %ecx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
LBB0_3:
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	addl	(%r14), %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	subl	4(%rbx), %r15d
	movq	_NAND_BBT_PERCHIP@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.5:
	movq	%r12, %rdi
	callq	_nanddev_ntargets
	movb	(%rbx), %cl
	movl	-56(%rbp), %edx                 ## 4-byte Reload
	sarl	%cl, %edx
	testl	%eax, %eax
	jle	LBB0_20
## %bb.6:
	movl	%r15d, -52(%rbp)                ## 4-byte Spill
	movq	%r14, -96(%rbp)                 ## 8-byte Spill
	decl	%edx
	andl	%edx, -44(%rbp)                 ## 4-byte Folded Spill
	jmp	LBB0_7
LBB0_4:
	movl	%r15d, -52(%rbp)                ## 4-byte Spill
	movq	%r14, -96(%rbp)                 ## 8-byte Spill
	movl	$1, %eax
LBB0_7:
	movl	%eax, %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	xorl	%ecx, %ecx
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	movq	-96(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_8 Depth=1
	movb	(%rbx), %cl
	movl	-56(%rbp), %eax                 ## 4-byte Reload
	sarl	%cl, %eax
	addl	%eax, -44(%rbp)                 ## 4-byte Folded Spill
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	incq	%rcx
	cmpq	-72(%rbp), %rcx                 ## 8-byte Folded Reload
	je	LBB0_15
LBB0_8:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_11 Depth 2
	movq	24(%r13), %rax
	movq	$0, (%rax,%rcx,8)
	movq	8(%r13), %rax
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movl	$-1, (%rax,%rcx,4)
	cmpl	$0, 16(%r13)
	jle	LBB0_14
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movslq	-44(%rbp), %r12                 ## 4-byte Folded Reload
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_8 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movzbl	(%rbx), %ecx
	movq	%r12, %rdx
	shlq	%cl, %rdx
	movl	(%r15), %ecx
	movq	%rbx, %rdi
	movq	%r13, %rbx
	movq	-104(%rbp), %r13                ## 8-byte Reload
	movq	%r13, %rsi
	movq	%rbx, %r8
	callq	_scan_read
	movl	(%r15), %edx
	movq	%r13, %rdi
	movq	%rbx, %r13
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movq	%rbx, %rcx
	callq	_check_pattern
	testl	%eax, %eax
	je	LBB0_12
## %bb.10:                              ##   in Loop: Header=BB0_11 Depth=2
	incq	%r14
	movslq	16(%r13), %rax
	addq	-80(%rbp), %r12                 ## 8-byte Folded Reload
	cmpq	%rax, %r14
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	jl	LBB0_11
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_8 Depth=1
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %r12d
	movq	8(%r13), %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movl	%r12d, (%rax,%rcx,4)
	movq	_NAND_BBT_VERSION@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r13)
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_bbt_get_ver_offs
	movq	-104(%rbp), %rcx                ## 8-byte Reload
	movq	(%rcx,%rax,8), %rax
	movq	24(%r13), %rcx
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movq	%rax, (%rcx,%rdx,8)
	jmp	LBB0_14
LBB0_15:
	xorl	%r14d, %r14d
	leaq	L_.str(%rip), %r15
	leaq	L_.str.1(%rip), %r12
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_16 Depth=1
	movq	24(%r13), %rax
	movq	(%rax,%r14,8), %rdx
	movq	%r12, %rdi
	callq	_pr_info
LBB0_19:                                ##   in Loop: Header=BB0_16 Depth=1
	incq	%r14
	cmpq	%r14, -72(%rbp)                 ## 8-byte Folded Reload
	je	LBB0_20
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r13), %rax
	movl	(%rax,%r14,4), %esi
	cmpl	$-1, %esi
	jne	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_pr_warn
	jmp	LBB0_19
LBB0_20:
	xorl	%eax, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_BBT_LASTBLOCK,4,2         ## @NAND_BBT_LASTBLOCK
	.comm	_NAND_BBT_PERCHIP,4,2           ## @NAND_BBT_PERCHIP
	.comm	_NAND_BBT_VERSION,4,2           ## @NAND_BBT_VERSION
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Bad block table not found for chip %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Bad block table found at page %d, version 0x%02X\n"

	.no_dead_strip	_search_bbt
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function search_bbt
_search_bbt:                            ; @search_bbt
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x19, x2
	mov	x20, x1
	mov	x21, x0
	add	x24, x0, #8
	mov	x0, x24
	bl	_nanddev_target_size
	str	w0, [sp, #20]                   ; 4-byte Folded Spill
	mov	x0, x21
	bl	_nand_to_mtd
	mov	x23, x0
	ldr	w10, [x21]
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _NAND_BBT_LASTBLOCK@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NAND_BBT_LASTBLOCK@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	ldr	w9, [x23, #8]
	asr	w9, w9, w10
	sub	w9, w9, #1
	str	x9, [sp, #24]                   ; 8-byte Folded Spill
	mov	x26, #-1
	b	LBB0_3
LBB0_2:
	str	xzr, [sp, #24]                  ; 8-byte Folded Spill
	mov	w26, #1
LBB0_3:
	ldp	w22, w27, [x23]
	ldr	w25, [x21, #4]
Lloh3:
	adrp	x9, _NAND_BBT_PERCHIP@GOTPAGE
Lloh4:
	ldr	x9, [x9, _NAND_BBT_PERCHIP@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.4:
	mov	x28, x10
	mov	x0, x24
	bl	_nanddev_ntargets
	cmp	w0, #1
	b.lt	LBB0_20
; %bb.5:
	ldr	w8, [x21]
	ldr	w9, [sp, #20]                   ; 4-byte Folded Reload
	asr	w8, w9, w8
	sub	w8, w8, #1
	ldr	x9, [sp, #24]                   ; 8-byte Folded Reload
	and	w9, w8, w9
	str	x9, [sp, #24]                   ; 8-byte Folded Spill
	mov	x10, x28
	b	LBB0_7
LBB0_6:
	mov	w0, #1
LBB0_7:
	mov	x28, #0
	add	w24, w27, w22
	sub	w8, w10, w25
	str	w8, [sp, #4]                    ; 4-byte Folded Spill
	mov	w25, w0
	str	x25, [sp, #8]                   ; 8-byte Folded Spill
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldr	w8, [x21]
	ldr	w9, [sp, #20]                   ; 4-byte Folded Reload
	asr	w8, w9, w8
	ldr	x9, [sp, #24]                   ; 8-byte Folded Reload
	add	w9, w8, w9
	str	x9, [sp, #24]                   ; 8-byte Folded Spill
	add	x28, x28, #1
	ldr	x25, [sp, #8]                   ; 8-byte Folded Reload
	cmp	x28, x25
	b.eq	LBB0_15
LBB0_9:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_11 Depth 2
	ldr	x8, [x19, #24]
	str	xzr, [x8, x28, lsl #3]
	ldr	x8, [x19, #8]
	mov	w9, #-1
	str	w9, [x8, x28, lsl #2]
	ldr	w8, [x19, #16]
	cmp	w8, #1
	b.lt	LBB0_8
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	mov	x22, #0
	mov	x27, #0
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	sxtw	x25, w8
LBB0_11:                                ;   Parent Loop BB0_9 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	x8, x25, x22
	ldr	w9, [x21]
	lsl	x2, x8, x9
	ldr	w3, [x23]
	mov	x0, x21
	mov	x1, x20
	mov	x4, x19
	bl	_scan_read
	ldr	w2, [x23]
	mov	x0, x20
	mov	x1, x24
	mov	x3, x19
	bl	_check_pattern
	cbz	w0, LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=2
	add	x27, x27, #1
	ldrsw	x8, [x19, #16]
	add	x22, x22, x26
	cmp	x27, x8
	b.lt	LBB0_11
	b	LBB0_8
LBB0_13:                                ;   in Loop: Header=BB0_9 Depth=1
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	add	w8, w8, w22
	ldr	w9, [sp, #4]                    ; 4-byte Folded Reload
	lsl	w8, w8, w9
	ldr	x9, [x19, #8]
	str	w8, [x9, x28, lsl #2]
	ldr	w8, [x19]
Lloh6:
	adrp	x9, _NAND_BBT_VERSION@GOTPAGE
Lloh7:
	ldr	x9, [x9, _NAND_BBT_VERSION@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.14:                               ;   in Loop: Header=BB0_9 Depth=1
	mov	x0, x21
	mov	x1, x19
	bl	_bbt_get_ver_offs
	ldr	x8, [x20, x0, lsl #3]
	ldr	x9, [x19, #24]
	str	x8, [x9, x28, lsl #3]
	b	LBB0_8
LBB0_15:
	mov	x20, #0
Lloh9:
	adrp	x21, l_.str@PAGE
Lloh10:
	add	x21, x21, l_.str@PAGEOFF
Lloh11:
	adrp	x22, l_.str.1@PAGE
Lloh12:
	add	x22, x22, l_.str.1@PAGEOFF
	b	LBB0_18
LBB0_16:                                ;   in Loop: Header=BB0_18 Depth=1
	ldr	x8, [x19, #24]
	ldr	x2, [x8, x20, lsl #3]
	mov	x0, x22
	bl	_pr_info
LBB0_17:                                ;   in Loop: Header=BB0_18 Depth=1
	add	x20, x20, #1
	cmp	x25, x20
	b.eq	LBB0_20
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	ldr	w1, [x8, x20, lsl #2]
	cmn	w1, #1
	b.ne	LBB0_16
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=1
	mov	x0, x21
	mov	x1, x20
	bl	_pr_warn
	b	LBB0_17
LBB0_20:
	mov	w0, #0
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_BBT_LASTBLOCK,4,2         ; @NAND_BBT_LASTBLOCK
	.comm	_NAND_BBT_PERCHIP,4,2           ; @NAND_BBT_PERCHIP
	.comm	_NAND_BBT_VERSION,4,2           ; @NAND_BBT_VERSION
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Bad block table not found for chip %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Bad block table found at page %d, version 0x%02X\n"

	.no_dead_strip	_search_bbt
.subsections_via_symbols
