	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtdswap_move_block
_mtdswap_move_block:                    ## @mtdswap_move_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
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movl	%esi, %r14d
	movq	%rdi, %r13
	movq	40(%rdi), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %rax
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	%esi, %r15d
	shll	%cl, %r15d
	movl	%esi, %ecx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movl	(%rax,%rcx,4), %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movl	36(%r13), %r8d
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	%r15d, %esi
	leaq	-80(%rbp), %rcx
	callq	_mtd_read
	testl	%eax, %eax
	jns	LBB0_4
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_mtd_is_bitflip
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	24(%r13), %rcx
	movl	%r14d, %eax
	xorl	%edx, %edx
	divl	8(%r13)
                                        ## kill: def $eax killed $eax def $rax
	movq	_EBLOCK_READERR@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	%edx, 4(%rcx,%rax,8)
	movl	32(%r13), %edi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	movl	%r14d, %ecx
	xorl	%eax, %eax
	callq	_dev_err
	incl	%r12d
	movq	_MTDSWAP_IO_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jb	LBB0_1
	jmp	LBB0_6
LBB0_4:
	movq	-80(%rbp), %rdx
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	jne	LBB0_5
## %bb.7:
	movl	36(%r13), %esi
	movq	%r13, %rdi
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movl	%r15d, %edx
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rcx
	movl	$1, %r8d
	callq	_mtdswap_write_block
	testl	%eax, %eax
	js	LBB0_8
## %bb.9:
	movl	(%r12), %eax
	movq	16(%r13), %rcx
	movl	%eax, (%rcx,%r15,4)
	movq	_PAGE_UNDEF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	(%r13), %rcx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movl	%eax, (%rcx,%rdx,4)
	movq	24(%r13), %rcx
	movl	%r14d, %eax
	xorl	%edx, %edx
	divl	8(%r13)
                                        ## kill: def $eax killed $eax def $rax
	xorl	%ebx, %ebx
	decl	(%rcx,%rax,8)
	jmp	LBB0_10
LBB0_5:
	movl	32(%r13), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
                                        ## kill: def $edx killed $edx killed $rdx
	movl	%r14d, %ecx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
LBB0_6:
	movq	_BLOCK_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	16(%r13), %rcx
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movl	%eax, (%rcx,%rdx,4)
	movq	_PAGE_UNDEF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	(%r13), %rcx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movl	%eax, (%rcx,%rdx,4)
LBB0_10:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	%eax, %ebx
	movq	_BLOCK_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	16(%r13), %rcx
	movl	%eax, (%rcx,%r15,4)
	movl	32(%r13), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.comm	_EBLOCK_READERR,4,2             ## @EBLOCK_READERR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Read Error: %d (block %u)\n"

	.comm	_MTDSWAP_IO_RETRIES,4,2         ## @MTDSWAP_IO_RETRIES
L_.str.1:                               ## @.str.1
	.asciz	"Short read: %zd (block %u)\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_BLOCK_ERROR,8,3                ## @BLOCK_ERROR
L_.str.2:                               ## @.str.2
	.asciz	"Write error: %d\n"

	.comm	_PAGE_UNDEF,8,3                 ## @PAGE_UNDEF
	.no_dead_strip	_mtdswap_move_block
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtdswap_move_block
_mtdswap_move_block:                    ; @mtdswap_move_block
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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, x1
	mov	x19, x0
	mov	w28, #0
	ldr	x24, [x0, #40]
	ldr	x8, [x0]
	mov	w9, w1
	stp	x2, x9, [sp, #16]               ; 16-byte Folded Spill
	ldr	w8, [x8, w1, uxtw #2]
	str	x8, [sp, #32]                   ; 8-byte Folded Spill
Lloh0:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	lsl	w25, w1, w8
Lloh3:
	adrp	x27, _PAGE_SIZE@GOTPAGE
Lloh4:
	ldr	x27, [x27, _PAGE_SIZE@GOTPAGEOFF]
Lloh5:
	adrp	x22, _EBLOCK_READERR@GOTPAGE
Lloh6:
	ldr	x22, [x22, _EBLOCK_READERR@GOTPAGEOFF]
Lloh7:
	adrp	x26, l_.str@PAGE
Lloh8:
	add	x26, x26, l_.str@PAGEOFF
Lloh9:
	adrp	x20, _MTDSWAP_IO_RETRIES@GOTPAGE
Lloh10:
	ldr	x20, [x20, _MTDSWAP_IO_RETRIES@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x2, [x27]
	ldr	w4, [x19, #36]
	add	x3, sp, #40
	mov	x0, x24
	mov	x1, x25
	bl	_mtd_read
	tbz	w0, #31, LBB0_4
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x23, x0
	bl	_mtd_is_bitflip
	cbnz	w0, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	x8, [x19, #24]
	ldr	w9, [x19, #8]
	udiv	w9, w21, w9
	ldr	w10, [x22]
	add	x8, x8, w9, uxtw #3
	ldr	w9, [x8, #4]
	orr	w9, w9, w10
	str	w9, [x8, #4]
	ldr	w0, [x19, #32]
	str	x21, [sp]
	mov	x1, x26
	mov	x2, x23
	bl	_dev_err
	add	w28, w28, #1
	ldr	w8, [x20]
	cmp	w28, w8
	b.lo	LBB0_1
	b	LBB0_8
LBB0_4:
	ldr	x2, [sp, #40]
	ldr	x8, [x27]
	cmp	x2, x8
	b.ne	LBB0_7
; %bb.5:
	ldr	w1, [x19, #36]
	mov	x0, x19
	ldr	x20, [sp, #32]                  ; 8-byte Folded Reload
	mov	x2, x20
	ldr	x22, [sp, #16]                  ; 8-byte Folded Reload
	mov	x3, x22
	mov	w4, #1
	bl	_mtdswap_write_block
	tbnz	w0, #31, LBB0_10
; %bb.6:
	mov	w23, #0
	ldr	w8, [x22]
	ldp	x9, x10, [x19, #16]
	str	w8, [x9, x20, lsl #2]
Lloh11:
	adrp	x8, _PAGE_UNDEF@GOTPAGE
Lloh12:
	ldr	x8, [x8, _PAGE_UNDEF@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
	ldr	x9, [x19]
	ldr	x11, [sp, #24]                  ; 8-byte Folded Reload
	str	w8, [x9, x11, lsl #2]
	ldr	w8, [x19, #8]
	udiv	w8, w21, w8
	lsl	x8, x8, #3
	ldr	w9, [x10, x8]
	sub	w9, w9, #1
	str	w9, [x10, x8]
	b	LBB0_9
LBB0_7:
	ldr	w0, [x19, #32]
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	str	x21, [sp]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_dev_err
Lloh16:
	adrp	x8, _EIO@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_8:
Lloh19:
	adrp	x8, _BLOCK_ERROR@GOTPAGE
Lloh20:
	ldr	x8, [x8, _BLOCK_ERROR@GOTPAGEOFF]
Lloh21:
	ldr	x8, [x8]
	ldr	x9, [x19, #16]
	ldr	x10, [sp, #32]                  ; 8-byte Folded Reload
	str	w8, [x9, x10, lsl #2]
Lloh22:
	adrp	x8, _PAGE_UNDEF@GOTPAGE
Lloh23:
	ldr	x8, [x8, _PAGE_UNDEF@GOTPAGEOFF]
Lloh24:
	ldr	x8, [x8]
	ldr	x9, [x19]
	ldr	x10, [sp, #24]                  ; 8-byte Folded Reload
	str	w8, [x9, x10, lsl #2]
LBB0_9:
	mov	x0, x23
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_10:
	mov	x23, x0
Lloh25:
	adrp	x8, _BLOCK_ERROR@GOTPAGE
Lloh26:
	ldr	x8, [x8, _BLOCK_ERROR@GOTPAGEOFF]
Lloh27:
	ldr	x8, [x8]
	ldr	x9, [x19, #16]
	str	w8, [x9, x20, lsl #2]
	ldr	w0, [x19, #32]
Lloh28:
	adrp	x1, l_.str.2@PAGE
Lloh29:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x23
	bl	_dev_err
	b	LBB0_9
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.comm	_EBLOCK_READERR,4,2             ; @EBLOCK_READERR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Read Error: %d (block %u)\n"

	.comm	_MTDSWAP_IO_RETRIES,4,2         ; @MTDSWAP_IO_RETRIES
l_.str.1:                               ; @.str.1
	.asciz	"Short read: %zd (block %u)\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_BLOCK_ERROR,8,3                ; @BLOCK_ERROR
l_.str.2:                               ; @.str.2
	.asciz	"Write error: %d\n"

	.comm	_PAGE_UNDEF,8,3                 ; @PAGE_UNDEF
	.no_dead_strip	_mtdswap_move_block
.subsections_via_symbols
