	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nand_block_markbad_lowlevel
_nand_block_markbad_lowlevel:           ## @nand_block_markbad_lowlevel
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %r12
	callq	_nand_to_mtd
	movq	%rax, %r14
	movq	_NAND_BBT_NO_OOB_BBM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ebx, %ebx
	testl	%eax, (%r12)
	je	LBB0_1
## %bb.3:
	cmpq	$0, 16(%r12)
	je	LBB0_5
LBB0_4:
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_nand_markbad_bbt
	testl	%ebx, %ebx
	cmovel	%eax, %ebx
LBB0_5:
	testl	%ebx, %ebx
	jne	LBB0_7
## %bb.6:
	incl	(%r14)
	xorl	%ebx, %ebx
	jmp	LBB0_7
LBB0_1:
	leaq	-48(%rbp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$16, %edx
	callq	_memset
	movl	%r15d, -40(%rbp)
	movb	8(%r12), %cl
	movl	$1, %eax
	shlq	%cl, %rax
	movq	%rax, -48(%rbp)
	movq	%r12, %rdi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	callq	_nand_erase_nand
	movq	%r12, %rdi
	callq	_nand_get_device
	testl	%eax, %eax
	je	LBB0_2
## %bb.8:
	movl	%eax, %ebx
LBB0_7:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_nand_markbad_bbm
	movl	%eax, %ebx
	movq	%r12, %rdi
	callq	_nand_release_device
	cmpq	$0, 16(%r12)
	jne	LBB0_4
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_BBT_NO_OOB_BBM,4,2        ## @NAND_BBT_NO_OOB_BBM
	.no_dead_strip	_nand_block_markbad_lowlevel
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nand_block_markbad_lowlevel
_nand_block_markbad_lowlevel:           ; @nand_block_markbad_lowlevel
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x1
	mov	x21, x0
	bl	_nand_to_mtd
	mov	x19, x0
	ldr	w8, [x21]
Lloh0:
	adrp	x9, _NAND_BBT_NO_OOB_BBM@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NAND_BBT_NO_OOB_BBM@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.1:
	mov	w22, #0
	ldr	x8, [x21, #16]
	cbz	x8, LBB0_3
LBB0_2:
	mov	x0, x21
	mov	x1, x20
	bl	_nand_markbad_bbt
	cmp	w22, #0
	csel	w22, w0, w22, eq
LBB0_3:
	cbnz	w22, LBB0_7
; %bb.4:
	ldr	w8, [x19]
	add	w8, w8, #1
	str	w8, [x19]
	b	LBB0_7
LBB0_5:
	mov	x0, sp
	mov	w1, #0
	mov	w2, #16
	bl	_memset
	str	w20, [sp, #8]
	ldr	x8, [x21, #8]
	mov	w9, #1
	lsl	x8, x9, x8
	str	x8, [sp]
	mov	x1, sp
	mov	x0, x21
	mov	w2, #0
	bl	_nand_erase_nand
	mov	x0, x21
	bl	_nand_get_device
	cbz	w0, LBB0_8
; %bb.6:
	mov	x22, x0
LBB0_7:
	mov	x0, x22
	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
	add	sp, sp, #64
	ret
LBB0_8:
	mov	x0, x21
	mov	x1, x20
	bl	_nand_markbad_bbm
	mov	x22, x0
	mov	x0, x21
	bl	_nand_release_device
	ldr	x8, [x21, #16]
	cbnz	x8, LBB0_2
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_BBT_NO_OOB_BBM,4,2        ; @NAND_BBT_NO_OOB_BBM
	.no_dead_strip	_nand_block_markbad_lowlevel
.subsections_via_symbols
