	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	%rdi, %r10
	movq	8(%rdi), %r15
	movl	(%rsi), %eax
	movq	_NAND_BBT_PERCHIP@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_1
## %bb.2:
	movl	(%r15), %edx
	movl	4(%r15), %esi
	movb	8(%r15), %cl
	sarl	%cl, %esi
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	testl	%edx, %edx
	jg	LBB0_3
LBB0_21:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movl	(%r10), %edx
	movb	8(%r15), %cl
	sarl	%cl, %edx
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movl	$1, %edx
LBB0_3:
	movl	%edx, %r11d
	xorl	%r14d, %r14d
	movq	_NAND_BBT_ABSPAGE@GOTPCREL(%rip), %r8
	movl	$1, %r12d
	testl	%eax, (%r8)
	je	LBB0_5
	.p2align	4, 0x90
LBB0_6:
	movq	8(%r13), %rax
	movl	(%rax,%r14,4), %esi
	cmpl	$-1, %esi
	je	LBB0_19
## %bb.7:
	movl	8(%r15), %ecx
	subl	12(%r15), %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	sarl	%cl, %esi
	addl	%esi, %esi
	movq	16(%r15), %rax
	movl	%esi, %ecx
	sarl	$3, %ecx
	movslq	%ecx, %rdx
	movl	%esi, %ecx
	andb	$6, %cl
	movl	$2, %edi
	shll	%cl, %edi
	movl	(%rax,%rdx,4), %ecx
	orl	%ecx, %edi
	movl	%edi, (%rax,%rdx,4)
	cmpl	%edi, %ecx
	je	LBB0_19
## %bb.8:
	cmpq	$0, 24(%r13)
	jne	LBB0_18
	jmp	LBB0_19
	.p2align	4, 0x90
LBB0_5:
	movq	_NAND_BBT_WRITE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_6
## %bb.9:
	movq	_NAND_BBT_LASTBLOCK@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_11
## %bb.10:
	leal	1(%r14), %esi
	imull	-44(%rbp), %esi                 ## 4-byte Folded Reload
	movl	16(%r13), %eax
	subl	%eax, %esi
	testl	%eax, %eax
	jg	LBB0_13
	jmp	LBB0_19
	.p2align	4, 0x90
LBB0_11:
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	imull	%r14d, %esi
	movl	16(%r13), %eax
	testl	%eax, %eax
	jle	LBB0_19
LBB0_13:
	addl	%esi, %esi
	movq	16(%r15), %r8
	xorl	%eax, %eax
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movl	%esi, %ecx
	sarl	$3, %ecx
	movslq	%ecx, %rbx
	movl	(%r8,%rbx,4), %r9d
	movl	%esi, %ecx
	andb	$6, %cl
	movl	$2, %edx
	shll	%cl, %edx
	orl	%r9d, %edx
	movl	%edx, (%r8,%rbx,4)
	cmpl	%edx, %r9d
	cmovnel	%r12d, %eax
	addl	$2, %esi
	incl	%edi
	cmpl	16(%r13), %edi
	jl	LBB0_14
## %bb.15:
	testl	%eax, %eax
	movq	_NAND_BBT_ABSPAGE@GOTPCREL(%rip), %r8
	je	LBB0_19
## %bb.16:
	cmpq	$0, 24(%r13)
	je	LBB0_19
## %bb.17:
	addl	$-2, %esi
LBB0_18:
	movb	8(%r15), %cl
	decb	%cl
	shll	%cl, %esi
	movq	%r10, %rdi
	movq	%r11, %rbx
	movq	%r15, %r12
	movq	%r10, %r15
	callq	_nand_update_bbt
	movq	%r15, %r10
	movq	%r12, %r15
	movl	$1, %r12d
	movq	_NAND_BBT_ABSPAGE@GOTPCREL(%rip), %r8
	movq	%rbx, %r11
LBB0_19:
	incq	%r14
	cmpq	%r11, %r14
	je	LBB0_21
## %bb.20:
	movl	(%r13), %eax
	testl	%eax, (%r8)
	jne	LBB0_6
	jmp	LBB0_5
	.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	_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:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x1
	mov	x20, x0
	ldr	x21, [x0, #8]
	ldr	w8, [x1]
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:
	ldr	w9, [x21]
	cmp	w9, #1
	b.lt	LBB0_21
; %bb.2:
	ldp	w10, w11, [x21, #4]
	asr	w22, w10, w11
	b	LBB0_4
LBB0_3:
	ldr	w9, [x20]
	ldr	w10, [x21, #8]
	asr	w22, w9, w10
	mov	w9, #1
LBB0_4:
	mov	x23, #0
Lloh3:
	adrp	x24, _NAND_BBT_ABSPAGE@GOTPAGE
Lloh4:
	ldr	x24, [x24, _NAND_BBT_ABSPAGE@GOTPAGEOFF]
Lloh5:
	adrp	x25, _NAND_BBT_WRITE@GOTPAGE
Lloh6:
	ldr	x25, [x25, _NAND_BBT_WRITE@GOTPAGEOFF]
	mov	w26, #2
Lloh7:
	adrp	x27, _NAND_BBT_LASTBLOCK@GOTPAGE
Lloh8:
	ldr	x27, [x27, _NAND_BBT_LASTBLOCK@GOTPAGEOFF]
	mov	w28, w9
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_14 Depth 2
	ldr	w9, [x24]
	tst	w9, w8
	b.eq	LBB0_9
LBB0_6:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x19, #8]
	ldr	w8, [x8, x23, lsl #2]
	cmn	w8, #1
	b.eq	LBB0_19
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldp	w9, w10, [x21, #8]
	sub	w9, w9, w10
	asr	w9, w8, w9
	lsl	w8, w9, #1
	ldr	x10, [x21, #16]
	sbfx	w9, w9, #2, #29
	sbfiz	x9, x9, #2, #32
	ldr	w11, [x10, x9]
	and	w12, w8, #0x6
	lsl	w12, w26, w12
	orr	w12, w12, w11
	str	w12, [x10, x9]
	cmp	w11, w12
	b.eq	LBB0_19
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x9, [x19, #24]
	cbnz	x9, LBB0_18
	b	LBB0_19
LBB0_9:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	w9, [x27]
	tst	w9, w8
	b.eq	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_5 Depth=1
	madd	w8, w22, w23, w22
	ldr	w9, [x19, #16]
	sub	w8, w8, w9
	cmp	w9, #1
	b.ge	LBB0_13
	b	LBB0_19
LBB0_12:                                ;   in Loop: Header=BB0_5 Depth=1
	mul	w8, w22, w23
	ldr	w9, [x19, #16]
	cmp	w9, #1
	b.lt	LBB0_19
LBB0_13:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	w9, #0
	mov	w10, #0
	lsl	w8, w8, #1
	ldr	x11, [x21, #16]
LBB0_14:                                ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	asr	w12, w8, #3
	sbfiz	x12, x12, #2, #32
	ldr	w13, [x11, x12]
	and	w14, w8, #0x6
	lsl	w14, w26, w14
	orr	w14, w13, w14
	str	w14, [x11, x12]
	cmp	w13, w14
	csinc	w9, w9, wzr, eq
	add	w8, w8, #2
	add	w10, w10, #1
	ldr	w12, [x19, #16]
	cmp	w10, w12
	b.lt	LBB0_14
; %bb.15:                               ;   in Loop: Header=BB0_5 Depth=1
	cbz	w9, LBB0_19
; %bb.16:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	x9, [x19, #24]
	cbz	x9, LBB0_19
; %bb.17:                               ;   in Loop: Header=BB0_5 Depth=1
	sub	w8, w8, #2
LBB0_18:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w9, [x21, #8]
	sub	w9, w9, #1
	lsl	w1, w8, w9
	mov	x0, x20
	bl	_nand_update_bbt
LBB0_19:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x23, x23, #1
	cmp	x23, x28
	b.eq	LBB0_21
; %bb.20:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x19]
	b	LBB0_5
LBB0_21:
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.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	_NAND_BBT_LASTBLOCK,4,2         ; @NAND_BBT_LASTBLOCK
	.no_dead_strip	_mark_bbt_region
.subsections_via_symbols
