	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function onenand_probe
_onenand_probe:                         ## @onenand_probe
	.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	%rdi, %r14
	movq	24(%rdi), %rbx
	callq	*(%rbx)
	testl	%eax, %eax
	jne	LBB0_15
## %bb.1:
	movq	_ONENAND_REG_DEVICE_ID@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	56(%rbx), %rdi
	callq	*8(%rbx)
	movl	%eax, %r15d
	movq	_ONENAND_REG_VERSION_ID@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	56(%rbx), %rdi
	callq	*8(%rbx)
	movl	%eax, %r12d
	movq	_ONENAND_REG_TECHNOLOGY@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	56(%rbx), %rdi
	callq	*8(%rbx)
	movl	%eax, 16(%rbx)
	movl	%r15d, %edi
	movl	%r12d, %esi
	callq	_onenand_print_device_info
	movl	%r15d, 20(%rbx)
	movl	%r12d, 24(%rbx)
	movq	%r14, %rdi
	callq	_onenand_check_features
	movl	%r15d, %edi
	callq	_onenand_get_density
	movl	%eax, %r15d
	movq	%rbx, %rdi
	callq	_FLEXONENAND
	testq	%rax, %rax
	je	LBB0_4
## %bb.2:
	movq	%rbx, %rdi
	callq	_ONENAND_IS_DDP
	cmpq	$1, %rax
	movl	$2, %edi
	sbbl	$0, %edi
	movl	%edi, 28(%rbx)
	addl	%edi, %edi
	movl	%edi, (%r14)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$4, %esi
	callq	_kcalloc
	movl	%eax, 20(%r14)
	testl	%eax, %eax
	je	LBB0_3
LBB0_4:
	movl	$16777216, %eax                 ## imm = 0x1000000
	movl	%r15d, %ecx
	shll	%cl, %eax
	movl	%eax, 32(%rbx)
	movq	_ONENAND_REG_DATA_BUFFER_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	56(%rbx), %rdi
	callq	*8(%rbx)
	movl	%eax, 4(%r14)
	movq	%rbx, %rdi
	callq	_ONENAND_IS_4KB_PAGE
	movl	4(%r14), %ecx
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	addl	%ecx, %ecx
	movl	%ecx, 4(%r14)
LBB0_6:
	movl	%ecx, %eax
	sarl	$5, %eax
	movl	%eax, 8(%r14)
	shll	$6, %ecx
	movl	%ecx, 12(%r14)
	movq	%rbx, %rdi
	callq	_FLEXONENAND
	movl	12(%r14), %edi
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	addl	%edi, %edi
	movl	%edi, 12(%r14)
LBB0_8:
	callq	_ffs
	decl	%eax
	movl	%eax, 36(%rbx)
	movl	4(%r14), %edi
	callq	_ffs
	decl	%eax
	movl	%eax, 40(%rbx)
	movl	36(%rbx), %ecx
	subl	%eax, %ecx
	movl	$-1, %eax
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	notl	%eax
	movl	%eax, 44(%rbx)
	movq	%rbx, %rdi
	callq	_ONENAND_IS_DDP
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	movl	32(%rbx), %eax
	movb	36(%rbx), %cl
	incb	%cl
	sarl	%cl, %eax
	movl	%eax, 48(%rbx)
LBB0_10:
	movl	4(%r14), %eax
	movl	%eax, 52(%rbx)
	movq	%rbx, %rdi
	callq	_FLEXONENAND
	testq	%rax, %rax
	je	LBB0_12
## %bb.11:
	movq	%r14, %rdi
	callq	_flexonenand_get_size
	jmp	LBB0_13
LBB0_12:
	movl	32(%rbx), %eax
	movl	%eax, 16(%r14)
LBB0_13:
	movq	%rbx, %rdi
	callq	_ONENAND_IS_2PLANE
	movq	%rax, %rcx
	xorl	%eax, %eax
	testq	%rcx, %rcx
	je	LBB0_15
## %bb.14:
	shll	4(%r14)
	shll	12(%r14)
	jmp	LBB0_15
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_15:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ONENAND_REG_DEVICE_ID,8,3      ## @ONENAND_REG_DEVICE_ID
	.comm	_ONENAND_REG_VERSION_ID,8,3     ## @ONENAND_REG_VERSION_ID
	.comm	_ONENAND_REG_TECHNOLOGY,8,3     ## @ONENAND_REG_TECHNOLOGY
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_ONENAND_REG_DATA_BUFFER_SIZE,8,3 ## @ONENAND_REG_DATA_BUFFER_SIZE
	.no_dead_strip	_onenand_probe
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function onenand_probe
_onenand_probe:                         ; @onenand_probe
	.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
	ldr	x20, [x0, #24]
	ldr	x8, [x20]
	blr	x8
	cbnz	w0, LBB0_15
; %bb.1:
	ldr	x8, [x20, #8]
	ldr	x9, [x20, #56]
Lloh0:
	adrp	x10, _ONENAND_REG_DEVICE_ID@GOTPAGE
Lloh1:
	ldr	x10, [x10, _ONENAND_REG_DEVICE_ID@GOTPAGEOFF]
Lloh2:
	ldr	x10, [x10]
	add	x0, x10, x9
	blr	x8
	mov	x21, x0
	ldr	x8, [x20, #8]
	ldr	x9, [x20, #56]
Lloh3:
	adrp	x10, _ONENAND_REG_VERSION_ID@GOTPAGE
Lloh4:
	ldr	x10, [x10, _ONENAND_REG_VERSION_ID@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x10]
	add	x0, x10, x9
	blr	x8
	mov	x22, x0
	ldr	x8, [x20, #8]
	ldr	x9, [x20, #56]
Lloh6:
	adrp	x10, _ONENAND_REG_TECHNOLOGY@GOTPAGE
Lloh7:
	ldr	x10, [x10, _ONENAND_REG_TECHNOLOGY@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
	add	x0, x10, x9
	blr	x8
	str	w0, [x20, #16]
	mov	x0, x21
	mov	x1, x22
	bl	_onenand_print_device_info
	stp	w21, w22, [x20, #20]
	mov	x0, x19
	bl	_onenand_check_features
	mov	x0, x21
	bl	_onenand_get_density
	mov	x21, x0
	mov	x0, x20
	bl	_FLEXONENAND
	cbz	x0, LBB0_3
; %bb.2:
	mov	x0, x20
	bl	_ONENAND_IS_DDP
	cmp	x0, #0
	mov	w8, #1
	cinc	w8, w8, ne
	str	w8, [x20, #28]
	lsl	w0, w8, #1
	str	w0, [x19]
Lloh9:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	w1, #4
	bl	_kcalloc
	str	w0, [x19, #20]
	cbz	w0, LBB0_14
LBB0_3:
	mov	w8, #16777216
	lsl	w8, w8, w21
	str	w8, [x20, #32]
	ldr	x8, [x20, #8]
	ldr	x9, [x20, #56]
Lloh12:
	adrp	x10, _ONENAND_REG_DATA_BUFFER_SIZE@GOTPAGE
Lloh13:
	ldr	x10, [x10, _ONENAND_REG_DATA_BUFFER_SIZE@GOTPAGEOFF]
Lloh14:
	ldr	x10, [x10]
	add	x0, x10, x9
	blr	x8
	str	w0, [x19, #4]
	mov	x0, x20
	bl	_ONENAND_IS_4KB_PAGE
	ldr	w8, [x19, #4]
	cbz	x0, LBB0_5
; %bb.4:
	lsl	w8, w8, #1
	str	w8, [x19, #4]
LBB0_5:
	asr	w9, w8, #5
	lsl	w8, w8, #6
	stp	w9, w8, [x19, #8]
	mov	x0, x20
	bl	_FLEXONENAND
	mov	x8, x0
	ldr	w0, [x19, #12]
	cbz	x8, LBB0_7
; %bb.6:
	lsl	w0, w0, #1
	str	w0, [x19, #12]
LBB0_7:
	bl	_ffs
	sub	w8, w0, #1
	str	w8, [x20, #36]
	ldr	w0, [x19, #4]
	bl	_ffs
	sub	w8, w0, #1
	ldr	w9, [x20, #36]
	sub	w9, w9, w8
	mov	w10, #-1
	lsl	w9, w10, w9
	mvn	w9, w9
	stp	w8, w9, [x20, #40]
	mov	x0, x20
	bl	_ONENAND_IS_DDP
	cbz	x0, LBB0_9
; %bb.8:
	ldp	w8, w9, [x20, #32]
	add	w9, w9, #1
	asr	w8, w8, w9
	str	w8, [x20, #48]
LBB0_9:
	ldr	w8, [x19, #4]
	str	w8, [x20, #52]
	mov	x0, x20
	bl	_FLEXONENAND
	cbz	x0, LBB0_11
; %bb.10:
	mov	x0, x19
	bl	_flexonenand_get_size
	b	LBB0_12
LBB0_11:
	ldr	w8, [x20, #32]
	str	w8, [x19, #16]
LBB0_12:
	mov	x0, x20
	bl	_ONENAND_IS_2PLANE
	cbz	x0, LBB0_15
; %bb.13:
	mov	w0, #0
	ldr	w8, [x19, #4]
	lsl	w8, w8, #1
	str	w8, [x19, #4]
	ldr	w8, [x19, #12]
	lsl	w8, w8, #1
	str	w8, [x19, #12]
	b	LBB0_15
LBB0_14:
Lloh15:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_15:
	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	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_ONENAND_REG_DEVICE_ID,8,3      ; @ONENAND_REG_DEVICE_ID
	.comm	_ONENAND_REG_VERSION_ID,8,3     ; @ONENAND_REG_VERSION_ID
	.comm	_ONENAND_REG_TECHNOLOGY,8,3     ; @ONENAND_REG_TECHNOLOGY
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_ONENAND_REG_DATA_BUFFER_SIZE,8,3 ; @ONENAND_REG_DATA_BUFFER_SIZE
	.no_dead_strip	_onenand_probe
.subsections_via_symbols
