	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function best_bisection_sorted
_best_bisection_sorted:                 ## @best_bisection_sorted
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r12d
	movq	%rdi, %r15
	movl	%esi, %edi
	movl	$16, %esi
	callq	_xcalloc
	movq	%rax, %rsi
	movq	_STRBUF_INIT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	testq	%r15, %r15
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	je	LBB0_13
## %bb.1:
	xorl	%r13d, %r13d
	movq	_TREESAME@GOTPCREL(%rip), %r14
	movq	%r15, %rbx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rbx
	testq	%rbx, %rbx
	je	LBB0_5
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%rbx), %rax
	movl	(%r14), %ecx
	testl	%ecx, (%rax)
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %rdi
	callq	_weight
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	%r12d, %ecx
	subl	%eax, %ecx
	cmpl	%eax, %ecx
	cmovgel	%eax, %ecx
	movq	8(%rbx), %rax
	movslq	%r13d, %r13
	movq	%r13, %rdx
	shlq	$4, %rdx
	movq	%rax, 8(%rsi,%rdx)
	movl	%ecx, (%rsi,%rdx)
	incl	%r13d
	jmp	LBB0_4
LBB0_5:
	movq	_compare_commit_dist@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rsi, %rdi
	movl	%r13d, %esi
	callq	_QSORT
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	%r15, %r14
	testl	%r13d, %r13d
	jle	LBB0_10
## %bb.6:
	leal	-1(%r13), %eax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movl	%r13d, %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	addq	$8, %r12
	xorl	%r15d, %r15d
	leaq	-48(%rbp), %r13
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	incq	%r15
	addq	$16, %r12
	cmpq	%r15, -72(%rbp)                 ## 8-byte Folded Reload
	je	LBB0_10
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rbx
	movq	%r13, %rdi
	callq	_strbuf_reset
	movl	-8(%r12), %edx
	movq	%r13, %rdi
	leaq	L_.str(%rip), %rsi
	callq	_strbuf_addf
	movq	_DECORATION_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	-48(%rbp), %esi
	movq	%rbx, %rdx
	callq	_add_name_decoration
	movq	(%r12), %rax
	movq	%rax, 8(%r14)
	cmpq	-80(%rbp), %r15                 ## 8-byte Folded Reload
	jae	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	(%r14), %r14
	jmp	LBB0_9
LBB0_10:
	testq	%r14, %r14
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_12
## %bb.11:
	movq	(%r14), %rdi
	callq	_free_commit_list
	movq	$0, (%r14)
	jmp	LBB0_12
LBB0_13:
	movq	_compare_commit_dist@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rsi, %rdi
	xorl	%esi, %esi
	callq	_QSORT
LBB0_12:
	leaq	-48(%rbp), %rdi
	callq	_strbuf_release
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_free
	movq	%r15, %rax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STRBUF_INIT,4,2                ## @STRBUF_INIT
	.comm	_TREESAME,4,2                   ## @TREESAME
	.comm	_compare_commit_dist,4,2        ## @compare_commit_dist
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"dist=%d"

	.comm	_DECORATION_NONE,4,2            ## @DECORATION_NONE
	.no_dead_strip	_best_bisection_sorted
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function best_bisection_sorted
_best_bisection_sorted:                 ; @best_bisection_sorted
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x1
	mov	x19, x0
	mov	x0, x1
	mov	w1, #16
	bl	_xcalloc
	mov	x20, x0
Lloh0:
	adrp	x8, _STRBUF_INIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STRBUF_INIT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [sp, #8]
	cbz	x19, LBB0_12
; %bb.1:
	mov	w22, #0
Lloh3:
	adrp	x24, _TREESAME@GOTPAGE
Lloh4:
	ldr	x24, [x24, _TREESAME@GOTPAGEOFF]
	mov	x23, x19
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	x23, [x23]
	cbz	x23, LBB0_5
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23, #8]
	ldr	w8, [x8]
	ldr	w9, [x24]
	tst	w9, w8
	b.ne	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x23
	bl	_weight
	sub	w8, w21, w0
	cmp	w8, w0
	csel	w8, w8, w0, lt
	ldr	x9, [x23, #8]
	add	x10, x20, w22, sxtw #4
	str	x9, [x10, #8]
	str	w8, [x10]
	add	w22, w22, #1
	b	LBB0_2
LBB0_5:
Lloh5:
	adrp	x8, _compare_commit_dist@GOTPAGE
Lloh6:
	ldr	x8, [x8, _compare_commit_dist@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x1, x22
	bl	_QSORT
	mov	x24, x19
	subs	w23, w22, #1
	b.lt	LBB0_10
; %bb.6:
	mov	x25, #0
	mov	w26, w22
	add	x27, x20, #8
Lloh8:
	adrp	x28, _DECORATION_NONE@GOTPAGE
Lloh9:
	ldr	x28, [x28, _DECORATION_NONE@GOTPAGEOFF]
	mov	x24, x19
Lloh10:
	adrp	x21, l_.str@PAGE
Lloh11:
	add	x21, x21, l_.str@PAGEOFF
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	x25, x25, #1
	add	x27, x27, #16
	cmp	x26, x25
	b.eq	LBB0_10
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x22, [x27]
	add	x0, sp, #8
	bl	_strbuf_reset
	ldur	w2, [x27, #-8]
	add	x0, sp, #8
	mov	x1, x21
	bl	_strbuf_addf
	ldr	w0, [x28]
	ldr	w1, [sp, #8]
	mov	x2, x22
	bl	_add_name_decoration
	ldr	x8, [x27]
	str	x8, [x24, #8]
	cmp	x25, x23
	b.hs	LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	x24, [x24]
	b	LBB0_7
LBB0_10:
	cbz	x24, LBB0_13
; %bb.11:
	ldr	x0, [x24]
	bl	_free_commit_list
	str	xzr, [x24]
	b	LBB0_13
LBB0_12:
Lloh12:
	adrp	x8, _compare_commit_dist@GOTPAGE
Lloh13:
	ldr	x8, [x8, _compare_commit_dist@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	x0, x20
	mov	w1, #0
	bl	_QSORT
LBB0_13:
	add	x0, sp, #8
	bl	_strbuf_release
	mov	x0, x20
	bl	_free
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_STRBUF_INIT,4,2                ; @STRBUF_INIT
	.comm	_TREESAME,4,2                   ; @TREESAME
	.comm	_compare_commit_dist,4,2        ; @compare_commit_dist
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"dist=%d"

	.comm	_DECORATION_NONE,4,2            ; @DECORATION_NONE
	.no_dead_strip	_best_bisection_sorted
.subsections_via_symbols
