	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtdswap_gc
_mtdswap_gc:                            ## @mtdswap_gc
	.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
	movq	(%rdi), %rax
	movq	_MIN_SPARE_EBLOCKS@GOTPCREL(%rip), %rcx
	movl	$1, %r15d
	cmpq	(%rcx), %rax
	jl	LBB0_6
## %bb.1:
	movq	%rdi, %rbx
	callq	_mtdswap_pick_gc_eblk
	testq	%rax, %rax
	je	LBB0_6
## %bb.2:
	movq	%rax, %r14
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_mtdswap_gc_eblock
	movq	_ENOSPC@GOTPCREL(%rip), %rcx
	addl	(%rcx), %eax
	je	LBB0_6
## %bb.3:
	movl	(%r14), %eax
	movq	_EBLOCK_FAILED@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_7
## %bb.4:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mtdswap_handle_badblock
LBB0_5:
	xorl	%r15d, %r15d
LBB0_6:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_EBLOCK_BITFLIP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%ecx, %eax
	movl	%eax, (%r14)
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mtdswap_erase_block
	movq	_EBLOCK_READERR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%r14)
	je	LBB0_10
## %bb.8:
	xorl	%r15d, %r15d
	testl	%eax, %eax
	jne	LBB0_6
## %bb.9:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mtdswap_eblk_passes
	testl	%eax, %eax
	jne	LBB0_11
	jmp	LBB0_6
LBB0_10:
	testl	%eax, %eax
	jne	LBB0_12
LBB0_11:
	movq	_MTDSWAP_TYPE_CLEAN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mtdswap_write_marker
	testl	%eax, %eax
	je	LBB0_15
LBB0_12:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%r15d, %r15d
	movl	(%rcx), %ecx
	addl	%eax, %ecx
	je	LBB0_6
## %bb.13:
	movl	%eax, %edi
	callq	_mtd_is_eccerr
	testl	%eax, %eax
	jne	LBB0_6
## %bb.14:
	movq	_MTDSWAP_DIRTY@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mtdswap_rb_add
	jmp	LBB0_6
LBB0_15:
	movq	_MTDSWAP_CLEAN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mtdswap_rb_add
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_MIN_SPARE_EBLOCKS,8,3          ## @MIN_SPARE_EBLOCKS
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_EBLOCK_FAILED,4,2              ## @EBLOCK_FAILED
	.comm	_EBLOCK_BITFLIP,4,2             ## @EBLOCK_BITFLIP
	.comm	_EBLOCK_READERR,4,2             ## @EBLOCK_READERR
	.comm	_MTDSWAP_TYPE_CLEAN,4,2         ## @MTDSWAP_TYPE_CLEAN
	.comm	_MTDSWAP_CLEAN,4,2              ## @MTDSWAP_CLEAN
	.comm	_EIO,4,2                        ## @EIO
	.comm	_MTDSWAP_DIRTY,4,2              ## @MTDSWAP_DIRTY
	.no_dead_strip	_mtdswap_gc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtdswap_gc
_mtdswap_gc:                            ; @mtdswap_gc
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _MIN_SPARE_EBLOCKS@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MIN_SPARE_EBLOCKS@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.lt	LBB0_3
; %bb.1:
	mov	x19, x0
	bl	_mtdswap_pick_gc_eblk
	cbz	x0, LBB0_3
; %bb.2:
	mov	x20, x0
	mov	x0, x19
	mov	x1, x20
	bl	_mtdswap_gc_eblock
Lloh3:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmn	w0, w8
	b.ne	LBB0_5
LBB0_3:
	mov	w0, #1
LBB0_4:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_5:
	ldr	w8, [x20]
Lloh6:
	adrp	x9, _EBLOCK_FAILED@GOTPAGE
Lloh7:
	ldr	x9, [x9, _EBLOCK_FAILED@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.6:
	mov	x0, x19
	mov	x1, x20
	bl	_mtdswap_handle_badblock
LBB0_7:
	mov	w0, #0
	b	LBB0_4
LBB0_8:
Lloh9:
	adrp	x9, _EBLOCK_BITFLIP@GOTPAGE
Lloh10:
	ldr	x9, [x9, _EBLOCK_BITFLIP@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	bic	w8, w8, w9
	str	w8, [x20]
	mov	x0, x19
	mov	x1, x20
	bl	_mtdswap_erase_block
	ldr	w8, [x20]
Lloh12:
	adrp	x9, _EBLOCK_READERR@GOTPAGE
Lloh13:
	ldr	x9, [x9, _EBLOCK_READERR@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_11
; %bb.9:
	cbnz	w0, LBB0_7
; %bb.10:
	mov	x0, x19
	mov	x1, x20
	bl	_mtdswap_eblk_passes
	cbnz	w0, LBB0_12
	b	LBB0_4
LBB0_11:
	cbnz	w0, LBB0_13
LBB0_12:
Lloh15:
	adrp	x8, _MTDSWAP_TYPE_CLEAN@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MTDSWAP_TYPE_CLEAN@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x20
	bl	_mtdswap_write_marker
	cbz	w0, LBB0_16
LBB0_13:
Lloh18:
	adrp	x8, _EIO@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cmn	w0, w8
	b.eq	LBB0_7
; %bb.14:
	bl	_mtd_is_eccerr
	cbnz	w0, LBB0_7
; %bb.15:
Lloh21:
	adrp	x8, _MTDSWAP_DIRTY@GOTPAGE
Lloh22:
	ldr	x8, [x8, _MTDSWAP_DIRTY@GOTPAGEOFF]
	b	LBB0_17
LBB0_16:
Lloh23:
	adrp	x8, _MTDSWAP_CLEAN@GOTPAGE
Lloh24:
	ldr	x8, [x8, _MTDSWAP_CLEAN@GOTPAGEOFF]
LBB0_17:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x20
	bl	_mtdswap_rb_add
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_MIN_SPARE_EBLOCKS,8,3          ; @MIN_SPARE_EBLOCKS
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_EBLOCK_FAILED,4,2              ; @EBLOCK_FAILED
	.comm	_EBLOCK_BITFLIP,4,2             ; @EBLOCK_BITFLIP
	.comm	_EBLOCK_READERR,4,2             ; @EBLOCK_READERR
	.comm	_MTDSWAP_TYPE_CLEAN,4,2         ; @MTDSWAP_TYPE_CLEAN
	.comm	_MTDSWAP_CLEAN,4,2              ; @MTDSWAP_CLEAN
	.comm	_EIO,4,2                        ; @EIO
	.comm	_MTDSWAP_DIRTY,4,2              ; @MTDSWAP_DIRTY
	.no_dead_strip	_mtdswap_gc
.subsections_via_symbols
