	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function legacy_set_geometry
_legacy_set_geometry:                   ## @legacy_set_geometry
	.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	%rdi, %rbx
	addq	$20, %rdi
	callq	_nand_to_mtd
	movq	%rax, %r14
	movabsq	$55834574858, %rax              ## imm = 0xD0000000A
	movq	%rax, 24(%rbx)
	movl	$512, 32(%rbx)                  ## imm = 0x200
	movl	(%r14), %eax
	movl	$512, %ecx                      ## imm = 0x200
	cmpl	$513, %eax                      ## imm = 0x201
	jl	LBB0_4
## %bb.1:
	movl	$14, 28(%rbx)
	movl	$512, %ecx                      ## imm = 0x200
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	addl	%ecx, %ecx
	cmpl	%eax, %ecx
	jl	LBB0_2
## %bb.3:
	movl	%ecx, 32(%rbx)
LBB0_4:
	movl	4(%r14), %eax
	cltd
	idivl	%ecx
	movl	%eax, 36(%rbx)
	movq	%rbx, %rdi
	callq	_get_ecc_strength
	movl	%eax, 40(%rbx)
	movq	%rbx, %rdi
	callq	_gpmi_check_ecc
	testl	%eax, %eax
	je	LBB0_5
## %bb.6:
	movl	4(%r14), %eax
	movl	24(%rbx), %edi
	movl	40(%rbx), %ecx
	leal	(%rdi,%rax), %edx
	imull	28(%rbx), %ecx
	imull	36(%rbx), %ecx
	leal	7(%rcx), %esi
	testl	%ecx, %ecx
	cmovnsl	%ecx, %esi
	sarl	$3, %esi
	addl	%edx, %esi
	movl	%esi, 44(%rbx)
	movl	%eax, 48(%rbx)
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$4, %esi
	callq	_ALIGN
	movl	%eax, %r15d
	movl	36(%rbx), %edi
	movl	$4, %esi
	callq	_ALIGN
	addl	%r15d, %eax
	movl	%eax, 52(%rbx)
	movl	%r15d, 56(%rbx)
	xorl	%eax, %eax
	cmpl	$0, (%rbx)
	je	LBB0_8
## %bb.7:
	movl	4(%r14), %ecx
	shll	$3, %ecx
	movl	28(%rbx), %edx
	imull	40(%rbx), %edx
	movl	24(%rbx), %esi
	movl	$1, %edi
	subl	36(%rbx), %edi
	imull	%edx, %edi
	shll	$3, %esi
	subl	%esi, %ecx
	addl	%edi, %ecx
	movl	%ecx, %edx
	shrl	$3, %edx
	movl	%edx, 60(%rbx)
	andl	$7, %ecx
	movl	%ecx, 64(%rbx)
	jmp	LBB0_8
LBB0_5:
	movl	16(%rbx), %edi
	movl	40(%rbx), %edx
	movq	8(%rbx), %rax
	movl	(%rax), %ecx
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ecc strength: %d cannot be supported by the controller (%d)\ntry to use minimum ecc strength that NAND chip required\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_legacy_set_geometry
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function legacy_set_geometry
lCPI0_0:
	.long	10                              ; 0xa
	.long	13                              ; 0xd
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_legacy_set_geometry:                   ; @legacy_set_geometry
	.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, x0
	add	x0, x0, #20
	bl	_nand_to_mtd
	mov	x20, x0
Lloh0:
	adrp	x8, lCPI0_0@PAGE
Lloh1:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [x19, #24]
	mov	w8, #512
	str	w8, [x19, #32]
	ldr	w9, [x0]
	cmp	w9, #513
	b.lt	LBB0_4
; %bb.1:
	mov	w8, #14
	str	w8, [x19, #28]
	mov	w8, #512
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	lsl	w8, w8, #1
	cmp	w8, w9
	b.lt	LBB0_2
; %bb.3:
	str	w8, [x19, #32]
LBB0_4:
	ldr	w9, [x20, #4]
	sdiv	w8, w9, w8
	str	w8, [x19, #36]
	mov	x0, x19
	bl	_get_ecc_strength
	str	w0, [x19, #40]
	mov	x0, x19
	bl	_gpmi_check_ecc
	cbz	w0, LBB0_7
; %bb.5:
	ldr	w8, [x20, #4]
	ldp	w0, w9, [x19, #24]
	add	w10, w0, w8
	ldp	w12, w11, [x19, #36]
	mul	w9, w11, w9
	mul	w9, w9, w12
	add	w11, w9, #7
	cmp	w9, #0
	csel	w9, w11, w9, lt
	add	w9, w10, w9, asr #3
	stp	w9, w8, [x19, #44]
	mov	w1, #4
	bl	_ALIGN
	mov	x21, x0
	ldr	w0, [x19, #36]
	mov	w1, #4
	bl	_ALIGN
	add	w8, w0, w21
	stp	w8, w21, [x19, #52]
	ldr	w8, [x19]
	cbz	w8, LBB0_8
; %bb.6:
	mov	w0, #0
	ldp	w9, w8, [x19, #36]
	ldp	w11, w10, [x19, #24]
	mul	w8, w10, w8
	msub	w8, w8, w9, w8
	ldr	w9, [x20, #4]
	lsl	w9, w9, #3
	sub	w9, w9, w11, lsl #3
	add	w8, w9, w8
	lsr	w9, w8, #3
	and	w8, w8, #0x7
	stp	w9, w8, [x19, #60]
	b	LBB0_9
LBB0_7:
	ldr	w0, [x19, #16]
	ldr	w2, [x19, #40]
	ldr	x8, [x19, #8]
	ldr	w3, [x8]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_8:
	mov	w0, #0
LBB0_9:
	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 AdrpLdr	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ecc strength: %d cannot be supported by the controller (%d)\ntry to use minimum ecc strength that NAND chip required\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_legacy_set_geometry
.subsections_via_symbols
