	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mark_bbt_region
_mark_bbt_region:                       ## @mark_bbt_region
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r15
	leaq	8(%rdi), %r12
	movq	%r12, %rdi
	callq	_nanddev_target_size
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_nand_to_mtd
	movq	_NAND_BBT_PERCHIP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%r14)
	je	LBB0_1
## %bb.2:
	movq	%r12, %rdi
	callq	_nanddev_ntargets
	movb	(%r15), %cl
	sarl	%cl, %ebx
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	jg	LBB0_3
LBB0_20:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movl	(%rax), %eax
	movb	(%r15), %cl
	sarl	%cl, %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	$1, %eax
LBB0_3:
	movl	%eax, %eax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	movq	_BBT_BLOCK_RESERVED@GOTPCREL(%rip), %r12
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_4 Depth=1
	movb	(%r15), %cl
	shll	%cl, %ebx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_nand_update_bbt
LBB0_19:                                ##   in Loop: Header=BB0_4 Depth=1
	incq	%r13
	cmpq	-80(%rbp), %r13                 ## 8-byte Folded Reload
	je	LBB0_20
LBB0_4:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_14 Depth 2
	movl	(%r14), %eax
	movq	_NAND_BBT_ABSPAGE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_5
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	8(%r14), %rax
	movl	(%rax,%r13,4), %ebx
	cmpl	$-1, %ebx
	je	LBB0_19
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	(%r15), %ecx
	subl	4(%r15), %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	sarl	%cl, %ebx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_bbt_get_entry
	movq	%r13, %r14
	movq	%rax, %r13
	movq	(%r12), %rdx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_bbt_mark_entry
	cmpq	(%r12), %r13
	movq	%r14, %r13
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_19
## %bb.8:                               ##   in Loop: Header=BB0_4 Depth=1
	cmpq	$0, 24(%r14)
	jne	LBB0_18
	jmp	LBB0_19
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	_NAND_BBT_WRITE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_6
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	_NAND_BBT_LASTBLOCK@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_4 Depth=1
	leal	1(%r13), %ebx
	imull	-44(%rbp), %ebx                 ## 4-byte Folded Reload
	movl	16(%r14), %eax
	subl	%eax, %ebx
	testl	%eax, %eax
	jg	LBB0_13
	jmp	LBB0_19
LBB0_11:                                ##   in Loop: Header=BB0_4 Depth=1
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	imull	%r13d, %ebx
	movl	16(%r14), %eax
	testl	%eax, %eax
	jle	LBB0_19
LBB0_13:                                ##   in Loop: Header=BB0_4 Depth=1
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_14:                                ##   Parent Loop BB0_4 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_bbt_get_entry
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	_BBT_BLOCK_RESERVED@GOTPCREL(%rip), %r12
	movq	(%r12), %rdx
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_bbt_mark_entry
	movl	$1, %eax
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	cmpq	(%r12), %rcx
	cmovnel	%eax, %r14d
	incl	%ebx
	incl	%r15d
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	cmpl	16(%rax), %r15d
	jl	LBB0_14
## %bb.15:                              ##   in Loop: Header=BB0_4 Depth=1
	testl	%r14d, %r14d
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	_BBT_BLOCK_RESERVED@GOTPCREL(%rip), %r12
	je	LBB0_19
## %bb.16:                              ##   in Loop: Header=BB0_4 Depth=1
	cmpq	$0, 24(%r14)
	je	LBB0_19
## %bb.17:                              ##   in Loop: Header=BB0_4 Depth=1
	decl	%ebx
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_BBT_PERCHIP,4,2           ## @NAND_BBT_PERCHIP
	.comm	_NAND_BBT_ABSPAGE,4,2           ## @NAND_BBT_ABSPAGE
	.comm	_NAND_BBT_WRITE,4,2             ## @NAND_BBT_WRITE
	.comm	_BBT_BLOCK_RESERVED,8,3         ## @BBT_BLOCK_RESERVED
	.comm	_NAND_BBT_LASTBLOCK,4,2         ## @NAND_BBT_LASTBLOCK
	.no_dead_strip	_mark_bbt_region
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mark_bbt_region
_mark_bbt_region:                       ; @mark_bbt_region
	.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	x19, x1
	mov	x20, x0
	add	x22, x0, #8
	mov	x0, x22
	bl	_nanddev_target_size
	mov	x21, x0
	mov	x0, x20
	bl	_nand_to_mtd
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _NAND_BBT_PERCHIP@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NAND_BBT_PERCHIP@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_3
; %bb.1:
	mov	x0, x22
	bl	_nanddev_ntargets
	cmp	w0, #1
	b.lt	LBB0_21
; %bb.2:
	ldr	w8, [x20]
	asr	w8, w21, w8
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	b	LBB0_4
LBB0_3:
	ldr	w8, [x0]
	ldr	w9, [x20]
	asr	w8, w8, w9
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	mov	w0, #1
LBB0_4:
	mov	x24, #0
Lloh3:
	adrp	x25, _NAND_BBT_ABSPAGE@GOTPAGE
Lloh4:
	ldr	x25, [x25, _NAND_BBT_ABSPAGE@GOTPAGEOFF]
Lloh5:
	adrp	x23, _NAND_BBT_WRITE@GOTPAGE
Lloh6:
	ldr	x23, [x23, _NAND_BBT_WRITE@GOTPAGEOFF]
	mov	w28, w0
Lloh7:
	adrp	x27, _BBT_BLOCK_RESERVED@GOTPAGE
Lloh8:
	ldr	x27, [x27, _BBT_BLOCK_RESERVED@GOTPAGEOFF]
	b	LBB0_7
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
	mov	x0, x20
	bl	_nand_update_bbt
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x24, x24, #1
	cmp	x24, x28
	b.eq	LBB0_21
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_17 Depth 2
	ldr	w8, [x19]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_12
LBB0_8:                                 ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [x19, #8]
	ldr	w8, [x8, x24, lsl #2]
	cmn	w8, #1
	b.eq	LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	ldp	w9, w10, [x20]
	sub	w9, w9, w10
	asr	w21, w8, w9
	mov	x0, x20
	mov	x1, x21
	bl	_bbt_get_entry
	mov	x22, x0
	ldr	x2, [x27]
	mov	x0, x20
	mov	x1, x21
	bl	_bbt_mark_entry
	ldr	x8, [x27]
	cmp	x22, x8
	b.eq	LBB0_6
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_6
; %bb.11:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	w8, [x20]
	lsl	w1, w21, w8
	b	LBB0_5
LBB0_12:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w9, [x23]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.13:                               ;   in Loop: Header=BB0_7 Depth=1
Lloh9:
	adrp	x9, _NAND_BBT_LASTBLOCK@GOTPAGE
Lloh10:
	ldr	x9, [x9, _NAND_BBT_LASTBLOCK@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	madd	w9, w8, w24, w8
	ldr	w8, [x19, #16]
	sub	w21, w9, w8
	cmp	w8, #1
	b.ge	LBB0_16
	b	LBB0_6
LBB0_15:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	mul	w21, w8, w24
	ldr	w8, [x19, #16]
	cmp	w8, #1
	b.lt	LBB0_6
LBB0_16:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x25, x23
	mov	w26, #0
	mov	w23, #0
LBB0_17:                                ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x20
	mov	x1, x21
	bl	_bbt_get_entry
	mov	x22, x0
	ldr	x2, [x27]
	mov	x0, x20
	mov	x1, x21
	bl	_bbt_mark_entry
	ldr	x8, [x27]
	cmp	x22, x8
	csinc	w26, w26, wzr, eq
	add	w21, w21, #1
	add	w23, w23, #1
	ldr	w8, [x19, #16]
	cmp	w23, w8
	b.lt	LBB0_17
; %bb.18:                               ;   in Loop: Header=BB0_7 Depth=1
	mov	x23, x25
Lloh12:
	adrp	x25, _NAND_BBT_ABSPAGE@GOTPAGE
Lloh13:
	ldr	x25, [x25, _NAND_BBT_ABSPAGE@GOTPAGEOFF]
	cbz	w26, LBB0_6
; %bb.19:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_6
; %bb.20:                               ;   in Loop: Header=BB0_7 Depth=1
	sub	w8, w21, #1
	ldr	w9, [x20]
	lsl	w1, w8, w9
	b	LBB0_5
LBB0_21:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_BBT_PERCHIP,4,2           ; @NAND_BBT_PERCHIP
	.comm	_NAND_BBT_ABSPAGE,4,2           ; @NAND_BBT_ABSPAGE
	.comm	_NAND_BBT_WRITE,4,2             ; @NAND_BBT_WRITE
	.comm	_BBT_BLOCK_RESERVED,8,3         ; @BBT_BLOCK_RESERVED
	.comm	_NAND_BBT_LASTBLOCK,4,2         ; @NAND_BBT_LASTBLOCK
	.no_dead_strip	_mark_bbt_region
.subsections_via_symbols
