	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtdswap_write_block
_mtdswap_write_block:                   ## @mtdswap_write_block
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r8d, %r15d
	movq	%rcx, %r14
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	movq	40(%rdi), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	testl	%r15d, %r15d
	jne	LBB0_5
	jmp	LBB0_2
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	movq	$0, 24(%rbx)
	decl	(%r13)
	movq	_PAGE_UNDEF@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	8(%rbx), %rcx
	movl	(%r14), %edx
	movq	%rax, (%rcx,%rdx,8)
	testl	%r15d, %r15d
	jne	LBB0_5
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_3:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_mtdswap_gc
	testq	%rax, %rax
	jg	LBB0_4
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_mtdswap_enough_free_pages
	testl	%eax, %eax
	je	LBB0_3
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	%r14, %rdx
	callq	_mtdswap_map_free_block
	movl	%eax, %r12d
	movl	(%r14), %eax
	xorl	%edx, %edx
	divl	(%rbx)
	movl	%eax, %r13d
	shlq	$2, %r13
	addq	32(%rbx), %r13
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r12d, %eax
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	%r12d, %edi
	callq	_mtd_is_eccerr
	testq	%rax, %rax
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	testl	%r12d, %r12d
	js	LBB0_17
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	(%r14), %esi
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movzbl	(%rax), %ecx
	shll	%cl, %esi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	leaq	-56(%rbp), %rcx
	movq	-72(%rbp), %r8                  ## 8-byte Reload
	callq	_mtd_write
	movl	%eax, %r12d
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r12d, %eax
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	%r12d, %edi
	callq	_mtd_is_eccerr
	testq	%rax, %rax
	je	LBB0_12
LBB0_11:                                ##   in Loop: Header=BB0_5 Depth=1
	decl	16(%rbx)
	decl	(%r13)
	movq	_PAGE_UNDEF@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	8(%rbx), %rcx
	movl	(%r14), %edx
	movq	%rax, (%rcx,%rdx,8)
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_mtdswap_handle_write_error
	testl	%r15d, %r15d
	jne	LBB0_5
	jmp	LBB0_2
LBB0_4:
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_17:
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	testl	%r12d, %r12d
	js	LBB0_13
## %bb.14:
	movq	-56(%rbp), %rdx
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	je	LBB0_17
## %bb.15:
	movl	20(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	jmp	LBB0_16
LBB0_13:
	movl	20(%rbx), %edi
	movslq	%r12d, %rdx
	movq	-56(%rbp), %rcx
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
LBB0_16:
	decl	16(%rbx)
	decl	(%r13)
	movq	_PAGE_UNDEF@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	8(%rbx), %rcx
	movl	(%r14), %edx
	movq	%rax, (%rcx,%rdx,8)
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_EIO,4,2                        ## @EIO
	.comm	_PAGE_UNDEF,8,3                 ## @PAGE_UNDEF
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Write to MTD device failed: %d (%zd written)"

L_.str.1:                               ## @.str.1
	.asciz	"Short write to MTD device: %zd written"

	.no_dead_strip	_mtdswap_write_block
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtdswap_write_block
_mtdswap_write_block:                   ; @mtdswap_write_block
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x4
	mov	x19, x3
	mov	x22, x2
	mov	x23, x1
	mov	x20, x0
	ldr	x24, [x0, #40]
Lloh0:
	adrp	x28, _EIO@GOTPAGE
Lloh1:
	ldr	x28, [x28, _EIO@GOTPAGEOFF]
Lloh2:
	adrp	x27, _PAGE_UNDEF@GOTPAGE
Lloh3:
	ldr	x27, [x27, _PAGE_UNDEF@GOTPAGEOFF]
	cbnz	w21, LBB0_4
	b	LBB0_3
LBB0_1:                                 ;   in Loop: Header=BB0_4 Depth=1
	str	xzr, [x20, #24]
	ldr	w8, [x25]
	sub	w8, w8, #1
	str	w8, [x25]
	ldr	x8, [x27]
	ldr	x9, [x20, #8]
	ldr	w10, [x19]
	str	x8, [x9, x10, lsl #3]
	cbnz	w21, LBB0_4
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x20
	mov	w1, #0
	bl	_mtdswap_gc
	cmp	x0, #1
	b.ge	LBB0_10
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_mtdswap_enough_free_pages
	cbz	w0, LBB0_2
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x22
	mov	x2, x19
	bl	_mtdswap_map_free_block
	ldr	x8, [x20, #32]
	ldr	w9, [x19]
	ldr	w10, [x20]
	udiv	w9, w9, w10
	add	x25, x8, w9, uxtw #2
	ldr	w8, [x28]
	cmn	w0, w8
	b.eq	LBB0_1
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x26, x0
	bl	_mtd_is_eccerr
	cbnz	x0, LBB0_1
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	tbnz	w26, #31, LBB0_11
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x19]
Lloh4:
	adrp	x9, _PAGE_SHIFT@GOTPAGE
Lloh5:
	ldr	x9, [x9, _PAGE_SHIFT@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	lsl	w1, w8, w9
Lloh7:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh9:
	ldr	x2, [x8]
	add	x3, sp, #8
	mov	x0, x24
	mov	x4, x23
	bl	_mtd_write
	ldr	w8, [x28]
	cmn	w0, w8
	b.eq	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x26, x0
	bl	_mtd_is_eccerr
	cbz	x0, LBB0_12
LBB0_9:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x20, #16]
	sub	w8, w8, #1
	str	w8, [x20, #16]
	ldr	w8, [x25]
	sub	w8, w8, #1
	str	w8, [x25]
	ldr	x8, [x27]
	ldr	x9, [x20, #8]
	ldr	w10, [x19]
	str	x8, [x9, x10, lsl #3]
	mov	x0, x20
	mov	x1, x25
	bl	_mtdswap_handle_write_error
	cbnz	w21, LBB0_4
	b	LBB0_3
LBB0_10:
Lloh10:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w26, w8
LBB0_11:
	mov	x0, x26
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_12:
	tbnz	w26, #31, LBB0_15
; %bb.13:
	ldr	x2, [sp, #8]
Lloh13:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	cmp	x2, x8
	b.eq	LBB0_11
; %bb.14:
	ldr	w0, [x20, #20]
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	ldr	w8, [x28]
	neg	w26, w8
	b	LBB0_16
LBB0_15:
	ldr	w0, [x20, #20]
	sxtw	x2, w26
	ldr	x8, [sp, #8]
	str	x8, [sp]
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_16:
	ldr	w8, [x20, #16]
	sub	w8, w8, #1
	str	w8, [x20, #16]
	ldr	w8, [x25]
	sub	w8, w8, #1
	str	w8, [x25]
	ldr	x8, [x27]
	ldr	x9, [x20, #8]
	ldr	w10, [x19]
	str	x8, [x9, x10, lsl #3]
	b	LBB0_11
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_EIO,4,2                        ; @EIO
	.comm	_PAGE_UNDEF,8,3                 ; @PAGE_UNDEF
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Write to MTD device failed: %d (%zd written)"

l_.str.1:                               ; @.str.1
	.asciz	"Short write to MTD device: %zd written"

	.no_dead_strip	_mtdswap_write_block
.subsections_via_symbols
