	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fsl_elbc_ooblayout_free
_fsl_elbc_ooblayout_free:               ## @fsl_elbc_ooblayout_free
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movl	%esi, %r12d
	movq	%rdi, %r15
	callq	_mtd_to_nand
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_nand_get_controller_data
	movl	(%rbx), %ecx
	cmpl	%r12d, %ecx
	jge	LBB0_2
## %bb.1:
	movq	_ERANGE@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_8
LBB0_2:
	testl	%r12d, %r12d
	je	LBB0_3
## %bb.4:
	movl	%r12d, %edx
	shll	$4, %edx
	movq	_FMR_ECCM@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	xorl	%edi, %edi
	andl	(%rax), %esi
	setne	%dil
	leal	(%rdx,%rdi,2), %eax
	addl	$-7, %eax
	movl	%eax, (%r14)
	cmpl	%r12d, %ecx
	jle	LBB0_6
## %bb.5:
	movl	$13, 4(%r14)
	jmp	LBB0_7
LBB0_3:
	xorl	%ecx, %ecx
	cmpl	$513, (%r15)                    ## imm = 0x201
	setge	%cl
	movl	%ecx, (%r14)
	movq	_FMR_ECCM@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	xorl	%edx, %edx
	andl	(%rax), %ecx
	setne	%dl
	leal	(%rdx,%rdx), %eax
	addl	$5, %eax
	movl	%eax, 4(%r14)
	jmp	LBB0_7
LBB0_6:
	movl	4(%r15), %ecx
	subl	%eax, %ecx
	movl	%ecx, 4(%r14)
LBB0_7:
	xorl	%eax, %eax
LBB0_8:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ERANGE,4,2                     ## @ERANGE
	.comm	_FMR_ECCM,4,2                   ## @FMR_ECCM
	.no_dead_strip	_fsl_elbc_ooblayout_free
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fsl_elbc_ooblayout_free
_fsl_elbc_ooblayout_free:               ; @fsl_elbc_ooblayout_free
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x19, x2
	mov	x21, x1
	mov	x20, x0
	bl	_mtd_to_nand
	mov	x22, x0
	bl	_nand_get_controller_data
	ldr	w9, [x22]
	cmp	w9, w21
	b.ge	LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _ERANGE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_8
LBB0_2:
	mov	x8, x0
	cbz	w21, LBB0_5
; %bb.3:
	ldr	w8, [x8]
Lloh3:
	adrp	x10, _FMR_ECCM@GOTPAGE
Lloh4:
	ldr	x10, [x10, _FMR_ECCM@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	tst	w10, w8
	mov	w8, #-5
	mov	w10, #-7
	csel	w8, w10, w8, eq
	add	w8, w8, w21, lsl #4
	str	w8, [x19]
	cmp	w9, w21
	b.le	LBB0_6
; %bb.4:
	mov	w0, #0
	mov	w8, #13
	b	LBB0_7
LBB0_5:
	mov	w0, #0
	ldr	w9, [x20]
	cmp	w9, #512
	cset	w9, gt
	str	w9, [x19]
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _FMR_ECCM@GOTPAGE
Lloh7:
	ldr	x9, [x9, _FMR_ECCM@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	tst	w9, w8
	mov	w8, #7
	mov	w9, #5
	csel	w8, w9, w8, eq
	b	LBB0_7
LBB0_6:
	mov	w0, #0
	ldr	w9, [x20, #4]
	sub	w8, w9, w8
LBB0_7:
	str	w8, [x19, #4]
LBB0_8:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_ERANGE,4,2                     ; @ERANGE
	.comm	_FMR_ECCM,4,2                   ; @FMR_ECCM
	.no_dead_strip	_fsl_elbc_ooblayout_free
.subsections_via_symbols
