	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function qcom_nandc_block_bad
_qcom_nandc_block_bad:                  ## @qcom_nandc_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
	movl	%esi, %ebx
	movq	%rdi, %r13
	callq	_nand_to_mtd
	movq	%rax, %r14
	movq	%r13, %rdi
	callq	_to_qcom_nand_host
	movq	%rax, %r15
	movq	%r13, %rdi
	callq	_get_qcom_nand_controller
	movb	(%r13), %cl
	sarl	%cl, %ebx
	movq	%rax, %r12
	andl	4(%r13), %ebx
	movl	$0, (%r15)
	movq	%rax, %rdi
	callq	_clear_bam_transaction
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_copy_last_cw
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	xorl	%ecx, %ecx
	jmp	LBB0_7
LBB0_2:
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_check_flash_errors
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movl	8(%r12), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_warn
	xorl	%ecx, %ecx
	jmp	LBB0_7
LBB0_4:
	movslq	(%r14), %rax
	movslq	4(%r15), %rcx
	movslq	12(%r13), %rdx
	decq	%rdx
	imulq	%rcx, %rdx
	subq	%rdx, %rax
	movq	(%r12), %rdx
	movl	(%rdx,%rax,4), %esi
	movl	%esi, %ecx
	movq	_NAND_BUSWIDTH_16@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edi
	andl	8(%r13), %edi
	xorl	$255, %ecx
	orl	%edi, %ecx
	setne	%cl
	testl	%edi, %edi
	je	LBB0_7
## %bb.5:
	cmpl	$255, %esi
	jne	LBB0_7
## %bb.6:
	cltq
	cmpl	$255, 4(%rdx,%rax,4)
	setne	%cl
LBB0_7:
	movzbl	%cl, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"error when trying to read BBM\n"

	.comm	_NAND_BUSWIDTH_16,4,2           ## @NAND_BUSWIDTH_16
	.no_dead_strip	_qcom_nandc_block_bad
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function qcom_nandc_block_bad
_qcom_nandc_block_bad:                  ; @qcom_nandc_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	x23, x1
	mov	x19, x0
	bl	_nand_to_mtd
	mov	x21, x0
	mov	x0, x19
	bl	_to_qcom_nand_host
	mov	x22, x0
	mov	x0, x19
	bl	_get_qcom_nand_controller
	mov	x20, x0
	ldp	w8, w9, [x19]
	asr	w8, w23, w8
	and	w23, w8, w9
	str	wzr, [x22]
	bl	_clear_bam_transaction
	mov	x0, x22
	mov	x1, x23
	bl	_copy_last_cw
	mov	x8, x0
	mov	w0, #0
	cbnz	w8, LBB0_6
; %bb.1:
	mov	x0, x22
	mov	w1, #1
	bl	_check_flash_errors
	cbz	x0, LBB0_3
; %bb.2:
	ldr	w0, [x20, #8]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
	mov	w0, #0
	b	LBB0_6
LBB0_3:
	ldrsw	x8, [x21]
	ldrsw	x9, [x22, #4]
	ldp	w11, w10, [x19, #8]
                                        ; kill: def $w10 killed $w10 def $x10
	sxtw	x10, w10
	sub	x10, x10, #1
	msub	x8, x10, x9, x8
	ldr	x9, [x20]
	ldr	w10, [x9, x8, lsl #2]
	cmp	w10, #255
	cset	w12, ne
Lloh2:
	adrp	x13, _NAND_BUSWIDTH_16@GOTPAGE
Lloh3:
	ldr	x13, [x13, _NAND_BUSWIDTH_16@GOTPAGEOFF]
Lloh4:
	ldr	w13, [x13]
	ands	w11, w13, w11
	cset	w13, ne
	orr	w0, w13, w12
	cbz	w11, LBB0_6
; %bb.4:
	cmp	w10, #255
	b.ne	LBB0_6
; %bb.5:
	add	x8, x9, x8, lsl #2
	ldr	w8, [x8, #4]
	cmp	w8, #255
	cset	w0, ne
LBB0_6:
	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
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"error when trying to read BBM\n"

	.comm	_NAND_BUSWIDTH_16,4,2           ; @NAND_BUSWIDTH_16
	.no_dead_strip	_qcom_nandc_block_bad
.subsections_via_symbols
