	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtdswap_eblk_passes
_mtdswap_eblk_passes:                   ## @mtdswap_eblk_passes
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	24(%rdi), %r14
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	_MTD_OPS_AUTO_OOB@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -88(%rbp)
	movl	(%r14), %eax
	movl	%eax, -120(%rbp)
	movl	4(%r14), %eax
	movl	%eax, -116(%rbp)
	movq	$0, -96(%rbp)
	movq	%rdx, -80(%rbp)                 ## 8-byte Spill
	movq	%rdx, -104(%rbp)
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movq	%rcx, -112(%rbp)
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	callq	_mtdswap_eb_offset
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	imull	(%r15), %esi
	movl	(%r14), %edi
	xorl	%ebx, %ebx
	movl	%esi, %eax
	xorl	%edx, %edx
	divl	%edi
	cmpl	$2, %eax
	movl	$1, %ecx
	cmovael	%eax, %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movl	%esi, -56(%rbp)                 ## 4-byte Spill
	movl	%edi, -52(%rbp)                 ## 4-byte Spill
	cmpl	%esi, %edi
	ja	LBB0_34
## %bb.1:
	movl	-44(%rbp), %r13d                ## 4-byte Reload
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %edi
	callq	_mtdswap_test_patt
	movl	%eax, %r12d
	movq	16(%r15), %rdi
	movl	(%r14), %edx
	movl	%eax, %esi
	callq	_memset
	movq	8(%r15), %rdi
	movl	4(%r14), %edx
	movl	%r12d, %esi
	callq	_memset
	movq	%r14, %rdi
	movl	%r13d, %esi
	leaq	-120(%rbp), %rdx
	callq	_mtd_write_oob
	testl	%eax, %eax
	jne	LBB0_35
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	addl	(%r14), %r13d
	incl	%ebx
	cmpl	-48(%rbp), %ebx                 ## 4-byte Folded Reload
	jne	LBB0_2
## %bb.4:
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	cmpl	-56(%rbp), %eax                 ## 4-byte Folded Reload
	jbe	LBB0_5
LBB0_34:
	movq	%r15, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_mtdswap_erase_block
	testl	%eax, %eax
	je	LBB0_13
LBB0_35:
	movq	%r15, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_mtdswap_handle_badblock
	xorl	%eax, %eax
LBB0_36:
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	cmpl	-56(%rbp), %eax                 ## 4-byte Folded Reload
	ja	LBB0_29
## %bb.14:
	xorl	%ebx, %ebx
	movl	-44(%rbp), %r13d                ## 4-byte Reload
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	incl	%ebx
	movl	%ebx, %edi
	callq	_mtdswap_test_patt
	movl	%eax, %r12d
	movq	16(%r15), %rdi
	movl	(%r14), %edx
	movl	%eax, %esi
	callq	_memset
	movq	8(%r15), %rdi
	movl	4(%r14), %edx
	movl	%r12d, %esi
	callq	_memset
	movq	%r14, %rdi
	movl	%r13d, %esi
	leaq	-120(%rbp), %rdx
	callq	_mtd_write_oob
	testl	%eax, %eax
	jne	LBB0_35
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	addl	(%r14), %r13d
	cmpl	-48(%rbp), %ebx                 ## 4-byte Folded Reload
	jne	LBB0_15
## %bb.17:
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	cmpl	-56(%rbp), %eax                 ## 4-byte Folded Reload
	jbe	LBB0_18
LBB0_29:
	movq	%r15, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_mtdswap_erase_block
	testl	%eax, %eax
	jne	LBB0_35
## %bb.30:
	movq	_EBLOCK_READERR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	andl	%eax, (%rcx)
	movl	$1, %eax
	jmp	LBB0_36
LBB0_5:
	xorl	%r12d, %r12d
	leaq	-120(%rbp), %r13
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
                                        ##     Child Loop BB0_32 Depth 2
	movq	%r14, %rdi
	movl	%ebx, %esi
	movq	%r13, %rdx
	callq	_mtd_read_oob
	testl	%eax, %eax
	jne	LBB0_35
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	%r12d, %edi
	callq	_mtdswap_test_patt
	movl	(%r14), %ecx
	cmpq	$4, %rcx
	jb	LBB0_11
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%rcx, %rdx
	shrq	$2, %rdx
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_9:                                 ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	cmpl	%eax, (%rdi,%rsi,4)
	jne	LBB0_35
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=2
	incq	%rsi
	cmpq	%rsi, %rdx
	jne	LBB0_9
LBB0_11:                                ##   in Loop: Header=BB0_6 Depth=1
	movl	4(%r14), %edx
	testq	%rdx, %rdx
	je	LBB0_33
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_32:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	cmpb	%al, (%rdi,%rsi)
	jne	LBB0_35
## %bb.31:                              ##   in Loop: Header=BB0_32 Depth=2
	incq	%rsi
	cmpq	%rsi, %rdx
	jne	LBB0_32
LBB0_33:                                ##   in Loop: Header=BB0_6 Depth=1
	addl	%ebx, %ecx
	incl	%r12d
	movl	%ecx, %ebx
	cmpl	-48(%rbp), %r12d                ## 4-byte Folded Reload
	jne	LBB0_6
	jmp	LBB0_34
LBB0_18:
	xorl	%r12d, %r12d
	leaq	-120(%rbp), %r13
LBB0_19:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_22 Depth 2
                                        ##     Child Loop BB0_26 Depth 2
	movq	%r14, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	%r13, %rdx
	callq	_mtd_read_oob
	testl	%eax, %eax
	jne	LBB0_35
## %bb.20:                              ##   in Loop: Header=BB0_19 Depth=1
	incl	%r12d
	movl	%r12d, %edi
	callq	_mtdswap_test_patt
	movl	(%r14), %ecx
	cmpq	$4, %rcx
	jb	LBB0_24
## %bb.21:                              ##   in Loop: Header=BB0_19 Depth=1
	movq	%rcx, %rdx
	shrq	$2, %rdx
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_22:                                ##   Parent Loop BB0_19 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	cmpl	%eax, (%rdi,%rsi,4)
	jne	LBB0_35
## %bb.23:                              ##   in Loop: Header=BB0_22 Depth=2
	incq	%rsi
	cmpq	%rsi, %rdx
	jne	LBB0_22
LBB0_24:                                ##   in Loop: Header=BB0_19 Depth=1
	movl	4(%r14), %edx
	testq	%rdx, %rdx
	je	LBB0_28
## %bb.25:                              ##   in Loop: Header=BB0_19 Depth=1
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_26:                                ##   Parent Loop BB0_19 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	cmpb	%al, (%rdi,%rsi)
	jne	LBB0_35
## %bb.27:                              ##   in Loop: Header=BB0_26 Depth=2
	incq	%rsi
	cmpq	%rsi, %rdx
	jne	LBB0_26
LBB0_28:                                ##   in Loop: Header=BB0_19 Depth=1
	addl	-44(%rbp), %ecx                 ## 4-byte Folded Reload
	movl	%ecx, %eax
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	cmpl	-48(%rbp), %r12d                ## 4-byte Folded Reload
	jne	LBB0_19
	jmp	LBB0_29
	.cfi_endproc
                                        ## -- End function
	.comm	_MTD_OPS_AUTO_OOB,4,2           ## @MTD_OPS_AUTO_OOB
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_EBLOCK_READERR,4,2             ## @EBLOCK_READERR
	.no_dead_strip	_mtdswap_eblk_passes
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtdswap_eblk_passes
_mtdswap_eblk_passes:                   ; @mtdswap_eblk_passes
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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	x19, x1
	mov	x20, x0
	ldp	x9, x21, [x0, #16]
	ldr	x27, [x0, #8]
Lloh0:
	adrp	x8, _MTD_OPS_AUTO_OOB@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MTD_OPS_AUTO_OOB@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [sp, #56]
	ldr	d0, [x21]
	str	d0, [sp, #24]
	stp	x9, xzr, [sp, #40]
	str	x9, [sp, #8]                    ; 8-byte Folded Spill
	str	x27, [sp, #32]
	bl	_mtdswap_eb_offset
	str	w0, [sp, #20]                   ; 4-byte Folded Spill
	ldr	w8, [x20]
Lloh3:
	adrp	x9, _PAGE_SIZE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _PAGE_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	mul	w22, w9, w8
	ldr	w26, [x21]
	udiv	w8, w22, w26
	cmp	w8, #1
	csinc	w28, w8, wzr, hi
	cmp	w26, w22
	b.hi	LBB0_5
; %bb.1:
	mov	w23, #0
	ldr	w24, [sp, #20]                  ; 4-byte Folded Reload
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x23
	bl	_mtdswap_test_patt
	mov	x25, x0
	ldr	x0, [x20, #16]
	ldr	w2, [x21]
	mov	x1, x25
	bl	_memset
	ldr	x0, [x20, #8]
	ldr	w2, [x21, #4]
	mov	x1, x25
	bl	_memset
	add	x2, sp, #24
	mov	x0, x21
	mov	x1, x24
	bl	_mtd_write_oob
	cbnz	w0, LBB0_6
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [x21]
	add	w24, w8, w24
	add	w23, w23, #1
	cmp	w23, w28
	b.ne	LBB0_2
; %bb.4:
	cmp	w26, w22
	b.ls	LBB0_15
LBB0_5:
	mov	x0, x20
	mov	x1, x19
	bl	_mtdswap_erase_block
	cbz	w0, LBB0_8
LBB0_6:
	mov	x0, x20
	mov	x1, x19
	bl	_mtdswap_handle_badblock
	mov	w0, #0
LBB0_7:
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_8:
	cmp	w26, w22
	b.hi	LBB0_13
; %bb.9:
	mov	w23, #0
	ldr	w24, [sp, #20]                  ; 4-byte Folded Reload
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	add	w23, w23, #1
	mov	x0, x23
	bl	_mtdswap_test_patt
	mov	x25, x0
	ldr	x0, [x20, #16]
	ldr	w2, [x21]
	mov	x1, x25
	bl	_memset
	ldr	x0, [x20, #8]
	ldr	w2, [x21, #4]
	mov	x1, x25
	bl	_memset
	add	x2, sp, #24
	mov	x0, x21
	mov	x1, x24
	bl	_mtd_write_oob
	cbnz	w0, LBB0_6
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	w8, [x21]
	add	w24, w8, w24
	cmp	w23, w28
	b.ne	LBB0_10
; %bb.12:
	cmp	w26, w22
	b.ls	LBB0_26
LBB0_13:
	mov	x0, x20
	mov	x1, x19
	bl	_mtdswap_erase_block
	cbnz	w0, LBB0_6
; %bb.14:
Lloh6:
	adrp	x8, _EBLOCK_READERR@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EBLOCK_READERR@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ldr	w9, [x19]
	bic	w8, w9, w8
	str	w8, [x19]
	mov	w0, #1
	b	LBB0_7
LBB0_15:
	mov	w23, #0
	ldr	w24, [sp, #20]                  ; 4-byte Folded Reload
LBB0_16:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_19 Depth 2
                                        ;     Child Loop BB0_23 Depth 2
	add	x2, sp, #24
	mov	x0, x21
	mov	x1, x24
	bl	_mtd_read_oob
	cbnz	w0, LBB0_6
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	mov	x0, x23
	bl	_mtdswap_test_patt
	ldr	w8, [x21]
	cmp	w8, #4
	b.lo	LBB0_21
; %bb.18:                               ;   in Loop: Header=BB0_16 Depth=1
	lsr	x9, x8, #2
	ldr	x10, [sp, #8]                   ; 8-byte Folded Reload
LBB0_19:                                ;   Parent Loop BB0_16 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w11, [x10]
	cmp	w11, w0
	b.ne	LBB0_6
; %bb.20:                               ;   in Loop: Header=BB0_19 Depth=2
	add	x10, x10, #4
	subs	x9, x9, #1
	b.ne	LBB0_19
LBB0_21:                                ;   in Loop: Header=BB0_16 Depth=1
	ldr	w9, [x21, #4]
	cbz	w9, LBB0_25
; %bb.22:                               ;   in Loop: Header=BB0_16 Depth=1
	mov	x10, x27
LBB0_23:                                ;   Parent Loop BB0_16 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldrb	w11, [x10]
	cmp	w11, w0, uxtb
	b.ne	LBB0_6
; %bb.24:                               ;   in Loop: Header=BB0_23 Depth=2
	add	x10, x10, #1
	subs	x9, x9, #1
	b.ne	LBB0_23
LBB0_25:                                ;   in Loop: Header=BB0_16 Depth=1
	add	w24, w8, w24
	add	w23, w23, #1
	cmp	w23, w28
	b.ne	LBB0_16
	b	LBB0_5
LBB0_26:
	mov	w22, #0
LBB0_27:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_30 Depth 2
                                        ;     Child Loop BB0_34 Depth 2
	add	x2, sp, #24
	mov	x0, x21
	ldr	w1, [sp, #20]                   ; 4-byte Folded Reload
	bl	_mtd_read_oob
	cbnz	w0, LBB0_6
; %bb.28:                               ;   in Loop: Header=BB0_27 Depth=1
	add	w0, w22, #1
	bl	_mtdswap_test_patt
	ldr	w8, [x21]
	cmp	w8, #4
	b.lo	LBB0_32
; %bb.29:                               ;   in Loop: Header=BB0_27 Depth=1
	lsr	x9, x8, #2
	ldr	x10, [sp, #8]                   ; 8-byte Folded Reload
LBB0_30:                                ;   Parent Loop BB0_27 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w11, [x10]
	cmp	w11, w0
	b.ne	LBB0_6
; %bb.31:                               ;   in Loop: Header=BB0_30 Depth=2
	add	x10, x10, #4
	subs	x9, x9, #1
	b.ne	LBB0_30
LBB0_32:                                ;   in Loop: Header=BB0_27 Depth=1
	ldr	w9, [x21, #4]
	cbz	w9, LBB0_36
; %bb.33:                               ;   in Loop: Header=BB0_27 Depth=1
	mov	x10, x27
LBB0_34:                                ;   Parent Loop BB0_27 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldrb	w11, [x10]
	cmp	w11, w0, uxtb
	b.ne	LBB0_6
; %bb.35:                               ;   in Loop: Header=BB0_34 Depth=2
	add	x10, x10, #1
	subs	x9, x9, #1
	b.ne	LBB0_34
LBB0_36:                                ;   in Loop: Header=BB0_27 Depth=1
	ldr	w9, [sp, #20]                   ; 4-byte Folded Reload
	add	w9, w8, w9
	str	w9, [sp, #20]                   ; 4-byte Folded Spill
	add	w22, w22, #1
	cmp	w22, w28
	b.ne	LBB0_27
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_MTD_OPS_AUTO_OOB,4,2           ; @MTD_OPS_AUTO_OOB
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_EBLOCK_READERR,4,2             ; @EBLOCK_READERR
	.no_dead_strip	_mtdswap_eblk_passes
.subsections_via_symbols
