	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function shrink_ecclayout
_shrink_ecclayout:                      ## @shrink_ecclayout
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	movq	%rsi, %r13
	testq	%rsi, %rsi
	je	LBB0_2
## %bb.3:
	movq	%rdi, %r14
	xorl	%r15d, %r15d
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	$32, %edx
	callq	_memset
	movq	$0, 16(%r13)
	movq	_MTD_MAX_ECCPOS_ENTRIES@GOTPCREL(%rip), %rbx
	cmpl	$0, (%rbx)
	jle	LBB0_13
## %bb.4:
	xorl	%r12d, %r12d
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_5 Depth=1
	incl	%r15d
	cmpl	%eax, %r12d
	jge	LBB0_13
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_10 Depth 2
	movq	%r14, %rdi
	movl	%r15d, %esi
	leaq	-64(%rbp), %rdx
	callq	_mtd_ooblayout_ecc
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movslq	(%rbx), %rax
	cmpl	%eax, %r12d
	jge	LBB0_12
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movslq	%r12d, %r12
	cmpq	$0, -56(%rbp)
	jle	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	-64(%rbp), %rcx
	movq	24(%r13), %rdx
	leaq	-1(%rax), %rsi
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%rcx, (%rdx,%r12,8)
	incq	16(%r13)
	cmpq	%r12, %rsi
	je	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=2
	incq	%rcx
	movq	-56(%rbp), %rdi
	addq	-64(%rbp), %rdi
	incq	%r12
	cmpq	%rdi, %rcx
	jl	LBB0_10
	jmp	LBB0_12
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_19
LBB0_6:
	movq	_ERANGE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	addl	%eax, %ecx
	jne	LBB0_19
LBB0_13:
	movq	_MTD_MAX_OOBFREE_ENTRIES@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_18
## %bb.14:
	xorl	%r12d, %r12d
	leaq	-64(%rbp), %r15
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	movq	%r15, %rdx
	callq	_mtd_ooblayout_free
	testl	%eax, %eax
	js	LBB0_16
## %bb.17:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	(%r13), %rax
	movaps	-64(%rbp), %xmm0
	extractps	$2, %xmm0, %ecx
	movups	%xmm0, (%rax,%r12)
	addl	%ecx, 8(%r13)
	incq	%rbx
	movq	_MTD_MAX_OOBFREE_ENTRIES@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	$16, %r12
	cmpq	%rax, %rbx
	jl	LBB0_15
	jmp	LBB0_18
LBB0_16:
	movq	_ERANGE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	addl	%eax, %ecx
	jne	LBB0_19
LBB0_18:
	xorl	%eax, %eax
LBB0_19:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MTD_MAX_ECCPOS_ENTRIES,4,2     ## @MTD_MAX_ECCPOS_ENTRIES
	.comm	_ERANGE,4,2                     ## @ERANGE
	.comm	_MTD_MAX_OOBFREE_ENTRIES,4,2    ## @MTD_MAX_OOBFREE_ENTRIES
	.no_dead_strip	_shrink_ecclayout
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function shrink_ecclayout
_shrink_ecclayout:                      ; @shrink_ecclayout
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	cbz	x0, LBB0_4
; %bb.1:
	mov	x19, x1
	cbz	x1, LBB0_4
; %bb.2:
	mov	x20, x0
	mov	x0, x19
	mov	w1, #0
	mov	w2, #32
	bl	_memset
	str	xzr, [x19, #16]
Lloh0:
	adrp	x22, _MTD_MAX_ECCPOS_ENTRIES@GOTPAGE
Lloh1:
	ldr	x22, [x22, _MTD_MAX_ECCPOS_ENTRIES@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.3:
	mov	w21, #0
	mov	w23, #0
	b	LBB0_7
LBB0_4:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_20
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
	mov	x23, x9
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	w21, w21, #1
	cmp	w23, w8
	b.ge	LBB0_14
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_11 Depth 2
	mov	x2, sp
	mov	x0, x20
	mov	x1, x21
	bl	_mtd_ooblayout_ecc
	tbnz	w0, #31, LBB0_13
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldrsw	x8, [x22]
	cmp	w23, w8
	b.ge	LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	sxtw	x9, w23
	ldr	x10, [sp, #8]
	cmp	x10, #1
	b.lt	LBB0_5
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	x10, [sp]
	ldr	x11, [x19, #24]
	sub	x12, x8, #1
LBB0_11:                                ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	str	x10, [x11, x9, lsl #3]
	ldr	x13, [x19, #16]
	add	x13, x13, #1
	str	x13, [x19, #16]
	cmp	x12, x9
	b.eq	LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=2
	add	x10, x10, #1
	ldp	x13, x14, [sp]
	add	x9, x9, #1
	add	x13, x14, x13
	cmp	x10, x13
	b.lt	LBB0_11
	b	LBB0_5
LBB0_13:
Lloh5:
	adrp	x8, _ERANGE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	cmn	w0, w8
	b.ne	LBB0_20
LBB0_14:
Lloh8:
	adrp	x22, _MTD_MAX_OOBFREE_ENTRIES@GOTPAGE
Lloh9:
	ldr	x22, [x22, _MTD_MAX_OOBFREE_ENTRIES@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_19
; %bb.15:
	mov	x23, #0
	mov	x21, #0
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	mov	x2, sp
	mov	x0, x20
	mov	x1, x21
	bl	_mtd_ooblayout_free
	tbnz	w0, #31, LBB0_18
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	ldr	x8, [sp]
	ldr	x9, [x19]
	add	x9, x9, x23
	str	x8, [x9]
	ldr	x8, [sp, #8]
	str	x8, [x9, #8]
	ldr	w9, [x19, #8]
	add	w8, w9, w8
	str	w8, [x19, #8]
	add	x21, x21, #1
	ldrsw	x8, [x22]
	add	x23, x23, #16
	cmp	x21, x8
	b.lt	LBB0_16
	b	LBB0_19
LBB0_18:
Lloh10:
	adrp	x8, _ERANGE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	cmn	w0, w8
	b.ne	LBB0_20
LBB0_19:
	mov	w0, #0
LBB0_20:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MTD_MAX_ECCPOS_ENTRIES,4,2     ; @MTD_MAX_ECCPOS_ENTRIES
	.comm	_ERANGE,4,2                     ; @ERANGE
	.comm	_MTD_MAX_OOBFREE_ENTRIES,4,2    ; @MTD_MAX_OOBFREE_ENTRIES
	.no_dead_strip	_shrink_ecclayout
.subsections_via_symbols
