	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sharpsl_nand_init_ftl
_sharpsl_nand_init_ftl:                 ## @sharpsl_nand_init_ftl
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r13
	movl	4(%rdi), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	callq	_kzalloc
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	_SHARPSL_FTL_PART_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r13, %rsi
	callq	_mtd_div_by_eb
	movl	%eax, %r12d
	imull	$95, %eax, %eax
	imulq	$1374389535, %rax, %rdi         ## imm = 0x51EB851F
	shrq	$37, %rdi
	decl	%edi
	movl	%edi, (%r15)
	movl	(%rbx), %edx
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$4, %esi
	callq	_kmalloc_array
	movq	%rax, 8(%r15)
	testq	%rax, %rax
	je	LBB0_20
## %bb.3:
	cmpl	$0, (%r15)
	je	LBB0_4
## %bb.18:
	xorl	%ecx, %ecx
	movq	_UINT_MAX@GOTPCREL(%rip), %rsi
	.p2align	4, 0x90
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rsi), %edx
	movl	%edx, (%rax,%rcx,4)
	incq	%rcx
	movl	(%r15), %edx
	cmpq	%rdx, %rcx
	jb	LBB0_19
## %bb.5:
	testl	%r12d, %r12d
	jne	LBB0_6
	jmp	LBB0_15
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_17
LBB0_20:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_16
LBB0_4:
	xorl	%edx, %edx
	testl	%r12d, %r12d
	je	LBB0_15
LBB0_6:
	xorl	%r14d, %r14d
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_7 Depth=1
	incl	%r14d
	cmpl	%r14d, %r12d
	je	LBB0_14
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %ebx
	imull	%r14d, %ebx
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_mtd_block_isbad
	testq	%rax, %rax
	jne	LBB0_13
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	%r13, %rdi
	movl	%ebx, %esi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_sharpsl_nand_read_oob
	testq	%rax, %rax
	jne	LBB0_13
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_sharpsl_nand_get_logical_num
	testl	%eax, %eax
	je	LBB0_13
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	cmpl	(%r15), %eax
	jae	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	8(%r15), %rcx
	movl	%eax, %eax
	movl	(%rcx,%rax,4), %edx
	movq	_UINT_MAX@GOTPCREL(%rip), %rsi
	cmpl	(%rsi), %edx
	jne	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	%r14d, (%rcx,%rax,4)
	jmp	LBB0_13
LBB0_14:
	movl	(%r15), %edx
LBB0_15:
	movl	%r12d, %ecx
	subl	%edx, %ecx
	leaq	L_.str(%rip), %rdi
	movl	%r12d, %esi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_pr_info
	xorl	%ebx, %ebx
LBB0_16:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
LBB0_17:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_SHARPSL_FTL_PART_SIZE,4,2      ## @SHARPSL_FTL_PART_SIZE
	.comm	_UINT_MAX,4,2                   ## @UINT_MAX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Sharp SL FTL: %d blocks used (%d logical, %d reserved)\n"

	.no_dead_strip	_sharpsl_nand_init_ftl
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sharpsl_nand_init_ftl
_sharpsl_nand_init_ftl:                 ; @sharpsl_nand_init_ftl
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x1
	mov	x21, x0
	ldr	w0, [x0, #4]
Lloh0:
	adrp	x23, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x23, [x23, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x23]
	bl	_kzalloc
	cbz	x0, LBB0_6
; %bb.1:
	mov	x19, x0
Lloh2:
	adrp	x8, _SHARPSL_FTL_PART_SIZE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SHARPSL_FTL_PART_SIZE@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	mov	x1, x21
	bl	_mtd_div_by_eb
	mov	x22, x0
	mov	w8, #95
	mul	w8, w0, w8
	mov	w9, #34079
	movk	w9, #20971, lsl #16
	umull	x8, w8, w9
	lsr	x8, x8, #37
	sub	w0, w8, #1
	str	w0, [x20]
	ldr	w2, [x23]
	mov	w1, #4
	bl	_kmalloc_array
	str	x0, [x20, #8]
	cbz	x0, LBB0_7
; %bb.2:
	ldr	w8, [x20]
Lloh5:
	adrp	x24, _UINT_MAX@GOTPAGE
Lloh6:
	ldr	x24, [x24, _UINT_MAX@GOTPAGEOFF]
	cbz	w8, LBB0_8
; %bb.3:
	mov	x8, #0
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x24]
	str	w9, [x0, x8, lsl #2]
	add	x8, x8, #1
	ldr	w2, [x20]
	cmp	x8, x2
	b.lo	LBB0_4
; %bb.5:
	cbnz	w22, LBB0_9
	b	LBB0_18
LBB0_6:
Lloh7:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_20
LBB0_7:
Lloh10:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_19
LBB0_8:
	mov	w2, #0
	cbz	w22, LBB0_18
LBB0_9:
	mov	w25, #0
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	w25, w25, #1
	cmp	w22, w25
	b.eq	LBB0_17
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x21]
	mul	w23, w8, w25
	mov	x0, x21
	mov	x1, x23
	bl	_mtd_block_isbad
	cbnz	x0, LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x0, x21
	mov	x1, x23
	mov	x2, x19
	bl	_sharpsl_nand_read_oob
	cbnz	x0, LBB0_10
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x0, x19
	bl	_sharpsl_nand_get_logical_num
	cbz	w0, LBB0_10
; %bb.14:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	w8, [x20]
	cmp	w0, w8
	b.hs	LBB0_10
; %bb.15:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	x8, [x20, #8]
	ldr	w9, [x8, w0, uxtw #2]
	ldr	w10, [x24]
	cmp	w9, w10
	b.ne	LBB0_10
; %bb.16:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	w9, w0
	str	w25, [x8, x9, lsl #2]
	b	LBB0_10
LBB0_17:
	ldr	w2, [x20]
LBB0_18:
	sub	w3, w22, w2
Lloh13:
	adrp	x0, l_.str@PAGE
Lloh14:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x22
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_pr_info
	mov	w20, #0
LBB0_19:
	mov	x0, x19
	bl	_kfree
LBB0_20:
	mov	x0, x20
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_SHARPSL_FTL_PART_SIZE,4,2      ; @SHARPSL_FTL_PART_SIZE
	.comm	_UINT_MAX,4,2                   ; @UINT_MAX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Sharp SL FTL: %d blocks used (%d logical, %d reserved)\n"

	.no_dead_strip	_sharpsl_nand_init_ftl
.subsections_via_symbols
