	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtdswap_handle_badblock
_mtdswap_handle_badblock:               ## @mtdswap_handle_badblock
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r12
	decl	8(%rdi)
	movq	_EBLOCK_BAD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 8(%rsi)
	callq	_mtdswap_eb_detach
	movq	$0, (%rbx)
	movl	4(%r12), %edi
	callq	_mtd_can_have_bb
	movl	$1, %r14d
	testl	%eax, %eax
	je	LBB0_3
## %bb.1:
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_mtdswap_eb_offset
	movl	%eax, %r15d
	movl	(%r12), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_warn
	movl	4(%r12), %edi
	movl	%r15d, %esi
	callq	_mtd_block_markbad
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movl	%eax, %ebx
	movl	(%r12), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r15d, %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_dev_warn
	movl	%ebx, %r14d
LBB0_3:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EBLOCK_BAD,4,2                 ## @EBLOCK_BAD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Marking bad block at %08llx\n"

L_.str.1:                               ## @.str.1
	.asciz	"Mark block bad failed for block at %08llx error %d\n"

	.no_dead_strip	_mtdswap_handle_badblock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtdswap_handle_badblock
_mtdswap_handle_badblock:               ; @mtdswap_handle_badblock
	.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	x19, x0
	ldr	w8, [x0, #8]
	sub	w8, w8, #1
	str	w8, [x0, #8]
Lloh0:
	adrp	x8, _EBLOCK_BAD@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EBLOCK_BAD@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldr	w9, [x1, #8]
	orr	w8, w9, w8
	str	w8, [x1, #8]
	bl	_mtdswap_eb_detach
	str	xzr, [x20]
	ldr	w0, [x19, #4]
	bl	_mtd_can_have_bb
	cbz	w0, LBB0_3
; %bb.1:
	mov	x0, x19
	mov	x1, x20
	bl	_mtdswap_eb_offset
	mov	x20, x0
	ldr	w0, [x19]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_dev_warn
	ldr	w0, [x19, #4]
	mov	x1, x20
	bl	_mtd_block_markbad
	cbz	w0, LBB0_3
; %bb.2:
	mov	x21, x0
	ldr	w0, [x19]
	str	x21, [sp]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	bl	_dev_warn
	b	LBB0_4
LBB0_3:
	mov	w21, #1
LBB0_4:
	mov	x0, x21
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_EBLOCK_BAD,4,2                 ; @EBLOCK_BAD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Marking bad block at %08llx\n"

l_.str.1:                               ; @.str.1
	.asciz	"Mark block bad failed for block at %08llx error %d\n"

	.no_dead_strip	_mtdswap_handle_badblock
.subsections_via_symbols
