	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nand_default_block_markbad
_nand_default_block_markbad:            ## @nand_default_block_markbad
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r15
	movq	16(%rdi), %rbx
	movq	$0, -32(%rbp)
	movq	8(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movb	(%rbx), %cl
	movl	%r14d, %edx
	sarl	%cl, %edx
	leal	(%rdx,%rdx), %ecx
	andb	$6, %cl
	movl	$1, %esi
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %esi
	sarl	$2, %edx
	movslq	%edx, %rcx
	orl	%esi, (%rax,%rcx,4)
LBB0_2:
	movq	_NAND_USE_FLASH_BBT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 16(%rbx)
	je	LBB0_4
## %bb.3:
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_nand_update_bbt
	movl	%eax, %ebx
	testl	%ebx, %ebx
	jne	LBB0_7
LBB0_6:
	incl	(%r15)
LBB0_7:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	_FL_WRITING@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_nand_get_device
	addl	8(%r15), %r14d
	leaq	24(%rbx), %rdx
	movabsq	$8589934594, %rax               ## imm = 0x200000002
	movq	%rax, 24(%rbx)
	movq	$0, 48(%rbx)
	leaq	-32(%rbp), %rax
	movq	%rax, 40(%rbx)
	movl	20(%rbx), %eax
	andl	$-2, %eax
	movl	%eax, 32(%rbx)
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_nand_do_write_oob
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_nand_release_device
	testl	%ebx, %ebx
	jne	LBB0_7
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_USE_FLASH_BBT,4,2         ## @NAND_USE_FLASH_BBT
	.comm	_FL_WRITING,4,2                 ## @FL_WRITING
	.no_dead_strip	_nand_default_block_markbad
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nand_default_block_markbad
_nand_default_block_markbad:            ; @nand_default_block_markbad
	.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	x21, x1
	mov	x19, x0
	ldr	x20, [x0, #16]
	str	xzr, [sp, #8]
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	w9, [x20]
	asr	w9, w21, w9
	ubfiz	w10, w9, #1, #2
	mov	w11, #1
	lsl	w10, w11, w10
	asr	w9, w9, #2
	sbfiz	x9, x9, #2, #32
	ldr	w11, [x8, x9]
	orr	w10, w10, w11
	str	w10, [x8, x9]
LBB0_2:
	ldr	w8, [x20, #16]
Lloh0:
	adrp	x9, _NAND_USE_FLASH_BBT@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NAND_USE_FLASH_BBT@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.3:
	mov	x0, x19
	mov	x1, x21
	bl	_nand_update_bbt
	mov	x20, x0
	cbnz	w20, LBB0_5
LBB0_4:
	ldr	w8, [x19]
	add	w8, w8, #1
	str	w8, [x19]
LBB0_5:
	mov	x0, x20
	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_6:
Lloh3:
	adrp	x8, _FL_WRITING@GOTPAGE
Lloh4:
	ldr	x8, [x8, _FL_WRITING@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x1, x19
	bl	_nand_get_device
	ldr	w8, [x19, #8]
	add	w1, w8, w21
	movi.2s	v0, #2
	str	d0, [x20, #24]!
	add	x8, sp, #8
	stp	x8, xzr, [x20, #16]
	ldur	w8, [x20, #-4]
	and	w8, w8, #0xfffffffe
	str	w8, [x20, #8]
	mov	x0, x19
	mov	x2, x20
	bl	_nand_do_write_oob
	mov	x20, x0
	mov	x0, x19
	bl	_nand_release_device
	cbnz	w20, LBB0_5
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_USE_FLASH_BBT,4,2         ; @NAND_USE_FLASH_BBT
	.comm	_FL_WRITING,4,2                 ; @FL_WRITING
	.no_dead_strip	_nand_default_block_markbad
.subsections_via_symbols
