	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sunxi_nand_ooblayout_free
_sunxi_nand_ooblayout_free:             ## @sunxi_nand_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movl	%esi, %ebx
	movq	%rdi, %r15
	callq	_mtd_to_nand
	movl	(%rax), %ecx
	cmpl	%ebx, %ecx
	jge	LBB0_2
## %bb.1:
	movq	_ERANGE@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_9
LBB0_2:
	testl	%ebx, %ebx
	jne	LBB0_5
## %bb.3:
	movq	8(%rax), %rdx
	movq	_NAND_ECC_HW@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	jne	LBB0_5
## %bb.4:
	movabsq	$8589934594, %rax               ## imm = 0x200000002
	movq	%rax, (%r14)
	jmp	LBB0_8
LBB0_5:
	movl	16(%rax), %eax
	addl	$4, %eax
	imull	%ebx, %eax
	movl	%eax, (%r14)
	cmpl	%ebx, %ecx
	jle	LBB0_7
## %bb.6:
	movl	$4, 4(%r14)
	jmp	LBB0_8
LBB0_7:
	movl	(%r15), %ecx
	subl	%eax, %ecx
	movl	%ecx, (%r14)
LBB0_8:
	xorl	%eax, %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ERANGE,4,2                     ## @ERANGE
	.comm	_NAND_ECC_HW,8,3                ## @NAND_ECC_HW
	.no_dead_strip	_sunxi_nand_ooblayout_free
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sunxi_nand_ooblayout_free
_sunxi_nand_ooblayout_free:             ; @sunxi_nand_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
	ldr	w8, [x0]
	cmp	w8, 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:
	cbnz	w21, LBB0_5
; %bb.3:
	ldr	x9, [x0, #8]
Lloh3:
	adrp	x10, _NAND_ECC_HW@GOTPAGE
Lloh4:
	ldr	x10, [x10, _NAND_ECC_HW@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_5
; %bb.4:
	mov	w0, #0
	movi.2s	v0, #2
	str	d0, [x19]
	b	LBB0_8
LBB0_5:
	ldr	w9, [x0, #16]
	add	w9, w9, #4
	mul	w9, w9, w21
	str	w9, [x19]
	cmp	w8, w21
	b.le	LBB0_7
; %bb.6:
	mov	w0, #0
	mov	w8, #4
	str	w8, [x19, #4]
	b	LBB0_8
LBB0_7:
	mov	w0, #0
	ldr	w8, [x20]
	sub	w8, w8, w9
	str	w8, [x19]
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
	.cfi_endproc
                                        ; -- End function
	.comm	_ERANGE,4,2                     ; @ERANGE
	.comm	_NAND_ECC_HW,8,3                ; @NAND_ECC_HW
	.no_dead_strip	_sunxi_nand_ooblayout_free
.subsections_via_symbols
