	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtdswap_writesect
_mtdswap_writesect:                     ## @mtdswap_writesect
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %r14
	callq	_MTDSWAP_MBD_TO_MTDSWAP
	movq	%rax, %r12
	incl	48(%rax)
	movq	(%rax), %rax
	movq	_MIN_SPARE_EBLOCKS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_2
## %bb.1:
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_10
LBB0_2:
	movq	_header@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_5
## %bb.3:
	xorl	%edi, %edi
	testq	%r14, %r14
	sete	%dil
	callq	_unlikely
	xorl	%ebx, %ebx
	testq	%rax, %rax
	jne	LBB0_10
## %bb.4:
	decq	%r14
LBB0_5:
	movq	8(%r12), %rax
	movl	(%rax,%r14,4), %ebx
	movq	_BLOCK_MAX@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	ja	LBB0_7
## %bb.6:
	movq	24(%r12), %rcx
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	16(%r12)
                                        ## kill: def $eax killed $eax def $rax
	leaq	(%rcx,%rax,4), %rsi
	decl	(%rcx,%rax,4)
	movq	%r12, %rdi
	callq	_mtdswap_store_eb
	movq	_BLOCK_UNDEF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	8(%r12), %rcx
	movl	%eax, (%rcx,%r14,4)
	movq	_PAGE_UNDEF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	40(%r12), %rcx
	movl	%eax, (%rcx,%rbx,4)
LBB0_7:
	leaq	-36(%rbp), %rcx
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	xorl	%r8d, %r8d
	callq	_mtdswap_write_block
	incl	32(%r12)
	testl	%eax, %eax
	js	LBB0_8
## %bb.9:
	movl	-36(%rbp), %eax
	movq	8(%r12), %rcx
	movl	%eax, (%rcx,%r14,4)
	jmp	LBB0_10
LBB0_8:
	movl	%eax, %ebx
LBB0_10:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MIN_SPARE_EBLOCKS,8,3          ## @MIN_SPARE_EBLOCKS
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_header,8,3                     ## @header
	.comm	_BLOCK_MAX,4,2                  ## @BLOCK_MAX
	.comm	_BLOCK_UNDEF,4,2                ## @BLOCK_UNDEF
	.comm	_PAGE_UNDEF,4,2                 ## @PAGE_UNDEF
	.no_dead_strip	_mtdswap_writesect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtdswap_writesect
_mtdswap_writesect:                     ; @mtdswap_writesect
	.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, x2
	mov	x19, x1
	bl	_MTDSWAP_MBD_TO_MTDSWAP
	ldr	w8, [x0, #48]
	add	w8, w8, #1
	str	w8, [x0, #48]
	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.ge	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_10
LBB0_2:
	mov	x20, x0
Lloh6:
	adrp	x8, _header@GOTPAGE
Lloh7:
	ldr	x8, [x8, _header@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	cbz	x8, LBB0_6
; %bb.3:
	cmp	x19, #0
	cset	w0, eq
	bl	_unlikely
	cbz	x0, LBB0_5
; %bb.4:
	mov	w0, #0
	b	LBB0_10
LBB0_5:
	sub	x19, x19, #1
LBB0_6:
	ldr	x8, [x20, #8]
	ldr	w22, [x8, x19, lsl #2]
Lloh9:
	adrp	x8, _BLOCK_MAX@GOTPAGE
Lloh10:
	ldr	x8, [x8, _BLOCK_MAX@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w22, w8
	b.hi	LBB0_8
; %bb.7:
	ldr	x8, [x20, #24]
	ldr	w9, [x20, #16]
	udiv	w9, w22, w9
	add	x1, x8, w9, uxtw #2
	ldr	w8, [x1]
	sub	w8, w8, #1
	str	w8, [x1]
	mov	x0, x20
	bl	_mtdswap_store_eb
Lloh12:
	adrp	x8, _BLOCK_UNDEF@GOTPAGE
Lloh13:
	ldr	x8, [x8, _BLOCK_UNDEF@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	ldr	x9, [x20, #8]
	str	w8, [x9, x19, lsl #2]
Lloh15:
	adrp	x8, _PAGE_UNDEF@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PAGE_UNDEF@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	ldr	x9, [x20, #40]
	str	w8, [x9, x22, lsl #2]
LBB0_8:
	add	x3, sp, #12
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	mov	w4, #0
	bl	_mtdswap_write_block
	ldr	w8, [x20, #32]
	add	w8, w8, #1
	str	w8, [x20, #32]
	tbnz	w0, #31, LBB0_10
; %bb.9:
	mov	w0, #0
	ldr	w8, [sp, #12]
	ldr	x9, [x20, #8]
	str	w8, [x9, x19, lsl #2]
LBB0_10:
	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 AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_MIN_SPARE_EBLOCKS,8,3          ; @MIN_SPARE_EBLOCKS
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_header,8,3                     ; @header
	.comm	_BLOCK_MAX,4,2                  ; @BLOCK_MAX
	.comm	_BLOCK_UNDEF,4,2                ; @BLOCK_UNDEF
	.comm	_PAGE_UNDEF,4,2                 ; @PAGE_UNDEF
	.no_dead_strip	_mtdswap_writesect
.subsections_via_symbols
