	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nand_block_bad
_nand_block_bad:                        ## @nand_block_bad
	.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	%rdi, %r15
	movq	(%rdi), %rbx
	movb	(%rbx), %cl
	movl	%esi, %r12d
	sarl	%cl, %r12d
	movl	%edx, %r14d
	andl	4(%rbx), %r12d
	testl	%edx, %edx
	je	LBB0_2
## %bb.1:
	movl	%esi, %r13d
	movb	8(%rbx), %cl
	sarl	%cl, %r13d
	movq	_FL_READING@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_nand_get_device
	movq	%r15, %rdi
	movl	%r13d, %esi
	callq	*48(%rbx)
LBB0_2:
	movq	_NAND_BUSWIDTH_16@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	32(%rbx), %rax
	movq	_NAND_CMD_READOOB@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	movl	16(%rbx), %edx
	testl	%ecx, 12(%rbx)
	je	LBB0_4
## %bb.3:
	andl	$254, %edx
	movq	%r15, %rdi
	movl	%r12d, %ecx
	callq	*%rax
	movq	%r15, %rdi
	callq	*40(%rbx)
	movl	%eax, %edi
	callq	_cpu_to_le16
	movl	%eax, %ecx
	shrl	$8, %ecx
	testb	$1, 16(%rbx)
	cmovel	%eax, %ecx
	movzbl	%cl, %ebx
	testl	%r14d, %r14d
	je	LBB0_7
LBB0_6:
	movq	%r15, %rdi
	callq	_nand_release_device
LBB0_7:
	xorl	%eax, %eax
	cmpl	$255, %ebx
	setne	%al
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	%r15, %rdi
	movl	%r12d, %ecx
	callq	*%rax
	movq	%r15, %rdi
	callq	*24(%rbx)
	movl	%eax, %ebx
	testl	%r14d, %r14d
	jne	LBB0_6
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.comm	_FL_READING,4,2                 ## @FL_READING
	.comm	_NAND_BUSWIDTH_16,4,2           ## @NAND_BUSWIDTH_16
	.comm	_NAND_CMD_READOOB,4,2           ## @NAND_CMD_READOOB
	.no_dead_strip	_nand_block_bad
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nand_block_bad
_nand_block_bad:                        ; @nand_block_bad
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x2
	mov	x19, x0
	ldr	x21, [x0]
	ldp	w8, w9, [x21]
	asr	w8, w1, w8
	and	w22, w8, w9
	cbz	w2, LBB0_2
; %bb.1:
	ldr	w8, [x21, #8]
	asr	w23, w1, w8
Lloh0:
	adrp	x8, _FL_READING@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FL_READING@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	mov	x0, x21
	mov	x1, x19
	bl	_nand_get_device
	ldr	x8, [x21, #48]
	mov	x0, x19
	mov	x1, x23
	blr	x8
LBB0_2:
Lloh3:
	adrp	x8, _NAND_BUSWIDTH_16@GOTPAGE
Lloh4:
	ldr	x8, [x8, _NAND_BUSWIDTH_16@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x8]
	ldr	x8, [x21, #32]
Lloh6:
	adrp	x10, _NAND_CMD_READOOB@GOTPAGE
Lloh7:
	ldr	x10, [x10, _NAND_CMD_READOOB@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x10]
	ldp	w10, w2, [x21, #12]
	tst	w9, w10
	b.eq	LBB0_6
; %bb.3:
	and	w2, w2, #0xfe
	mov	x0, x19
	mov	x3, x22
	blr	x8
	ldr	x8, [x21, #40]
	mov	x0, x19
	blr	x8
	bl	_cpu_to_le16
	lsr	w8, w0, #8
	ldrb	w9, [x21, #16]
	tst	w9, #0x1
	csel	w8, w0, w8, eq
	and	w21, w8, #0xff
	cbz	w20, LBB0_5
LBB0_4:
	mov	x0, x19
	bl	_nand_release_device
LBB0_5:
	cmp	w21, #255
	cset	w0, ne
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_6:
	mov	x0, x19
	mov	x3, x22
	blr	x8
	ldr	x8, [x21, #24]
	mov	x0, x19
	blr	x8
	mov	x21, x0
	cbnz	w20, LBB0_4
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_FL_READING,4,2                 ; @FL_READING
	.comm	_NAND_BUSWIDTH_16,4,2           ; @NAND_BUSWIDTH_16
	.comm	_NAND_CMD_READOOB,4,2           ; @NAND_CMD_READOOB
	.no_dead_strip	_nand_block_bad
.subsections_via_symbols
