	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_MergeLeaves                    ## -- Begin function MergeLeaves
	.p2align	4, 0x90
_MergeLeaves:                           ## @MergeLeaves
	.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	_portalclusters@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	movq	_leafs@GOTPCREL(%rip), %r12
	xorl	%esi, %esi
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_1 Depth=1
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	addl	%ecx, %esi
	testl	%ecx, %ecx
	je	LBB0_13
LBB0_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
                                        ##       Child Loop BB0_6 Depth 3
	testl	%eax, %eax
	jle	LBB0_13
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	%esi, -48(%rbp)                 ## 4-byte Spill
	xorl	%ebx, %ebx
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	jmp	LBB0_3
LBB0_14:                                ##   in Loop: Header=BB0_3 Depth=2
	xorl	%eax, %eax
	callq	_UpdatePortals
	incl	-44(%rbp)                       ## 4-byte Folded Spill
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_3 Depth=2
	incq	%rbx
	movslq	(%r15), %rax
	cmpq	%rax, %rbx
	jge	LBB0_12
LBB0_3:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_6 Depth 3
	movq	(%r12), %rcx
	leaq	(%rbx,%rbx,2), %rdx
	cmpq	$0, (%rcx,%rdx,8)
	jns	LBB0_11
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=2
	movl	8(%rcx,%rdx,8), %eax
	testl	%eax, %eax
	jle	LBB0_11
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=2
	leaq	(%rcx,%rdx,8), %r13
	addq	$8, %r13
	xorl	%r14d, %r14d
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=3
	incq	%r14
	movslq	%eax, %rcx
	cmpq	%rcx, %r14
	jge	LBB0_11
LBB0_6:                                 ##   Parent Loop BB0_1 Depth=1
                                        ##     Parent Loop BB0_3 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movq	8(%r13), %rcx
	movq	(%rcx,%r14,8), %rcx
	cmpq	$0, 16(%rcx)
	jne	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=3
	cmpq	$0, 8(%rcx)
	jne	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=3
	movl	(%rcx), %esi
	movl	%ebx, %edi
	callq	_TryMergeLeaves
	testq	%rax, %rax
	jne	LBB0_14
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=3
	movl	(%r13), %eax
	jmp	LBB0_10
LBB0_13:
	leaq	L_.str(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	__printf                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_portalclusters,4,2             ## @portalclusters
	.comm	_leafs,8,3                      ## @leafs
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%6d leaves merged\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_MergeLeaves                    ; -- Begin function MergeLeaves
	.p2align	2
_MergeLeaves:                           ; @MergeLeaves
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	w19, #0
Lloh0:
	adrp	x21, _portalclusters@GOTPAGE
Lloh1:
	ldr	x21, [x21, _portalclusters@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh2:
	adrp	x22, _leafs@GOTPAGE
Lloh3:
	ldr	x22, [x22, _leafs@GOTPAGEOFF]
	mov	w23, #24
	b	LBB0_2
LBB0_1:                                 ;   in Loop: Header=BB0_2 Depth=1
	add	w19, w24, w19
	cbz	w24, LBB0_14
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_6 Depth 2
                                        ;       Child Loop BB0_10 Depth 3
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x20, #0
	mov	w24, #0
	b	LBB0_6
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=2
	bl	_UpdatePortals
	add	w24, w24, #1
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=2
	add	x20, x20, #1
	ldrsw	x8, [x21]
	cmp	x20, x8
	b.ge	LBB0_1
LBB0_6:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_10 Depth 3
	ldr	x9, [x22]
	mul	x8, x20, x23
	ldr	x8, [x9, x8]
	tbz	x8, #63, LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=2
	madd	x25, x20, x23, x9
	ldr	w8, [x25, #8]!
	cmp	w8, #1
	b.lt	LBB0_5
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=2
	mov	x26, #0
	madd	x9, x20, x23, x9
	add	x27, x9, #16
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=3
	add	x26, x26, #1
	cmp	x26, w8, sxtw
	b.ge	LBB0_5
LBB0_10:                                ;   Parent Loop BB0_2 Depth=1
                                        ;     Parent Loop BB0_6 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	ldr	x9, [x27]
	ldr	x9, [x9, x26, lsl #3]
	ldr	x10, [x9, #16]
	cbnz	x10, LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=3
	ldr	x10, [x9, #8]
	cbnz	x10, LBB0_9
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=3
	ldr	w1, [x9]
	mov	x0, x20
	bl	_TryMergeLeaves
	cbnz	x0, LBB0_4
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=3
	ldr	w8, [x25]
	b	LBB0_9
LBB0_14:
Lloh4:
	adrp	x0, l_.str@PAGE
Lloh5:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	__printf
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_portalclusters,4,2             ; @portalclusters
	.comm	_leafs,8,3                      ; @leafs
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%6d leaves merged\n"

.subsections_via_symbols
