	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sd_search_final_phase
_sd_search_final_phase:                 ## @sd_search_final_phase
	.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
	testq	%rsi, %rsi
	je	LBB0_3
## %bb.1:
	movq	%rsi, %r15
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	_MAX_PHASE@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	testl	%eax, %eax
	js	LBB0_2
## %bb.4:
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
	xorl	%ebx, %ebx
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	addl	%ecx, %ebx
	movl	(%r14), %eax
	cmpl	%eax, %ebx
	jg	LBB0_8
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_get_phase_len
	cmpl	%eax, %r12d
	cmovll	%ebx, %r13d
	cmovlel	%eax, %r12d
	movl	$1, %ecx
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	%eax, %ecx
	jmp	LBB0_7
LBB0_3:
	callq	_sdmmc_dev
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	xorl	%edx, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	$255, %ebx
	jmp	LBB0_9
LBB0_2:
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
LBB0_8:
	movl	%r12d, %ebx
	shrl	$31, %ebx
	addl	%r12d, %ebx
	sarl	%ebx
	addl	%r13d, %ebx
	andl	%eax, %ebx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_sdmmc_dev
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edi
	movq	%r15, %rdx
	movl	%r12d, %ecx
	movl	%ebx, %r8d
	xorl	%eax, %eax
	callq	_dev_dbg
LBB0_9:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Phase: [map:%x]\n"

	.comm	_MAX_PHASE,4,2                  ## @MAX_PHASE
L_.str.1:                               ## @.str.1
	.asciz	"Phase: [map:%x] [maxlen:%d] [final:%d]\n"

	.no_dead_strip	_sd_search_final_phase
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sd_search_final_phase
_sd_search_final_phase:                 ; @sd_search_final_phase
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x20, x0
	cbz	x1, LBB0_4
; %bb.1:
	mov	x19, x1
Lloh0:
	adrp	x24, _MAX_PHASE@GOTPAGE
Lloh1:
	ldr	x24, [x24, _MAX_PHASE@GOTPAGEOFF]
	ldr	w8, [x24]
	tbnz	w8, #31, LBB0_5
; %bb.2:
	mov	w22, #0
	mov	w23, #0
	mov	w21, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x21
	bl	_get_phase_len
	cmp	w22, w0
	csel	w23, w21, w23, lt
	csel	w22, w22, w0, gt
	cmp	w0, #0
	csinc	w9, w0, wzr, ne
	ldr	w8, [x24]
	add	w21, w9, w21
	cmp	w21, w8
	b.le	LBB0_3
	b	LBB0_6
LBB0_4:
	mov	x0, x20
	bl	_sdmmc_dev
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, #0
	bl	_dev_dbg
	mov	w21, #255
	b	LBB0_7
LBB0_5:
	mov	w23, #0
	mov	w22, #0
LBB0_6:
	cmp	w22, #0
	cinc	w9, w22, lt
	add	w9, w23, w9, asr #1
	and	w21, w9, w8
	mov	x0, x20
	bl	_sdmmc_dev
	stp	x22, x21, [sp]
Lloh4:
	adrp	x1, l_.str.1@PAGE
Lloh5:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x19
	bl	_dev_dbg
LBB0_7:
	mov	x0, x21
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Phase: [map:%x]\n"

	.comm	_MAX_PHASE,4,2                  ; @MAX_PHASE
l_.str.1:                               ; @.str.1
	.asciz	"Phase: [map:%x] [maxlen:%d] [final:%d]\n"

	.no_dead_strip	_sd_search_final_phase
.subsections_via_symbols
