	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_MergeLeafPortals               ## -- Begin function MergeLeafPortals
	.p2align	4, 0x90
_MergeLeafPortals:                      ## @MergeLeafPortals
	.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
	movq	_portalclusters@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	testl	%ecx, %ecx
	jle	LBB0_1
## %bb.2:
	xorl	%edi, %edi
	movq	_leafs@GOTPCREL(%rip), %rbx
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movl	$0, -48(%rbp)                   ## 4-byte Folded Spill
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_portalclusters@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	_leafs@GOTPCREL(%rip), %rbx
LBB0_19:                                ##   in Loop: Header=BB0_3 Depth=1
	incl	%edi
	cmpl	%ecx, %edi
	jge	LBB0_20
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
                                        ##       Child Loop BB0_10 Depth 3
	movq	(%rbx), %rdx
	movslq	%edi, %rax
	leaq	(%rax,%rax,2), %rsi
	cmpq	$0, (%rdx,%rsi,8)
	jns	LBB0_19
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	8(%rdx,%rsi,8), %eax
	testl	%eax, %eax
	jle	LBB0_19
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	leaq	(%rdx,%rsi,8), %r15
	addq	$8, %r15
	movl	$2, %esi
	xorl	%edi, %edi
	jmp	LBB0_6
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=2
	movq	%rdi, %r14
	cmpl	%r14d, %eax
	jle	LBB0_17
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_10 Depth 3
	movq	8(%r15), %rcx
	movq	(%rcx,%rdi,8), %r12
	incq	%rdi
	cmpq	$0, 8(%r12)
	jne	LBB0_17
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=2
	movslq	%eax, %rdx
	cmpq	%rdx, %rdi
	jge	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=2
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r14
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_3 Depth=1
                                        ##     Parent Loop BB0_6 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movq	-8(%rcx,%r14,8), %r13
	cmpq	$0, 8(%r13)
	jne	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=3
	movq	(%r12), %rcx
	cmpq	(%r13), %rcx
	jne	LBB0_14
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=3
	movq	24(%r12), %rdi
	movq	24(%r13), %rsi
	movl	32(%r12), %edx
	callq	_TryMergeWinding
	testq	%rax, %rax
	jne	LBB0_21
## %bb.13:                              ##   in Loop: Header=BB0_10 Depth=3
	movl	(%r15), %eax
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_10 Depth=3
	cmpl	%r14d, %eax
	jle	LBB0_15
## %bb.22:                              ##   in Loop: Header=BB0_10 Depth=3
	movq	8(%r15), %rcx
	incq	%r14
	jmp	LBB0_10
LBB0_21:                                ##   in Loop: Header=BB0_6 Depth=2
	movq	%rax, %rbx
	movq	24(%r12), %rdi
	callq	_FreeWinding
	movq	%rbx, 24(%r12)
	movl	16(%r12), %eax
	testl	%eax, %eax
	setne	%cl
	movl	16(%r13), %edx
	testl	%edx, %edx
	setne	%bl
	andb	%cl, %bl
	movzbl	%bl, %ecx
	addl	%ecx, -48(%rbp)                 ## 4-byte Folded Spill
	orl	%eax, %edx
	movl	%edx, 16(%r12)
	movq	%r12, %rdi
	callq	_SetPortalSphere
	movq	_qtrue@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%r13)
	incl	-44(%rbp)                       ## 4-byte Folded Spill
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	decl	%eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	(%r15), %eax
	decq	%r14
LBB0_15:                                ##   in Loop: Header=BB0_6 Depth=2
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	cmpl	%r14d, %eax
	jg	LBB0_18
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_6 Depth=2
	movslq	%eax, %rcx
	incq	%rsi
	cmpq	%rcx, %rdi
	jl	LBB0_6
	jmp	LBB0_18
LBB0_1:
	movl	$0, -48(%rbp)                   ## 4-byte Folded Spill
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
LBB0_20:
	leaq	L_.str(%rip), %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	__printf
	leaq	L_.str.1(%rip), %rdi
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	addq	$40, %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
	.comm	_qtrue,8,3                      ## @qtrue
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%6d portals merged\n"

L_.str.1:                               ## @.str.1
	.asciz	"%6d hint portals merged\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_MergeLeafPortals               ; -- Begin function MergeLeafPortals
	.p2align	2
_MergeLeafPortals:                      ; @MergeLeafPortals
	.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
Lloh0:
	adrp	x8, _portalclusters@GOTPAGE
Lloh1:
	ldr	x8, [x8, _portalclusters@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x8]
	cmp	w9, #1
	b.lt	LBB0_21
; %bb.1:
	mov	w24, #0
	str	xzr, [sp, #8]                   ; 8-byte Folded Spill
Lloh3:
	adrp	x12, _leafs@GOTPAGE
Lloh4:
	ldr	x12, [x12, _leafs@GOTPAGEOFF]
	mov	w26, #24
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
Lloh5:
	adrp	x8, _portalclusters@GOTPAGE
Lloh6:
	ldr	x8, [x8, _portalclusters@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x8]
Lloh8:
	adrp	x12, _leafs@GOTPAGE
Lloh9:
	ldr	x12, [x12, _leafs@GOTPAGEOFF]
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	w24, w24, #1
	cmp	w24, w9
	b.ge	LBB0_22
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
                                        ;       Child Loop BB0_13 Depth 3
	ldr	x10, [x12]
	smull	x8, w24, w26
	ldr	x8, [x10, x8]
	tbz	x8, #63, LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	sxtw	x11, w24
	madd	x28, x11, x26, x10
	ldr	w8, [x28, #8]!
	cmp	w8, #1
	b.lt	LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x20, #0
	madd	x9, x11, x26, x10
	add	x23, x9, #16
	mov	w19, #1
	b	LBB0_10
LBB0_7:                                 ;   in Loop: Header=BB0_10 Depth=2
	mov	x27, x20
LBB0_8:                                 ;   in Loop: Header=BB0_10 Depth=2
	cmp	w8, w27
	b.gt	LBB0_2
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=2
	add	x19, x19, #1
	cmp	x20, w8, sxtw
	b.ge	LBB0_2
LBB0_10:                                ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_13 Depth 3
	ldr	x9, [x23]
	ldr	x21, [x9, x20, lsl #3]
	ldr	x10, [x21, #8]
	add	x20, x20, #1
	cbnz	x10, LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=2
	cmp	x20, w8, sxtw
	b.ge	LBB0_7
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=2
	mov	x27, x19
LBB0_13:                                ;   Parent Loop BB0_4 Depth=1
                                        ;     Parent Loop BB0_10 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	ldr	x25, [x9, x27, lsl #3]
	ldr	x9, [x25, #8]
	cbnz	x9, LBB0_17
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=3
	ldr	x9, [x21]
	ldr	x10, [x25]
	cmp	x9, x10
	b.ne	LBB0_17
; %bb.15:                               ;   in Loop: Header=BB0_13 Depth=3
	ldr	x0, [x21, #24]
	ldr	x1, [x25, #24]
	ldr	w2, [x21, #32]
	bl	_TryMergeWinding
	cbnz	x0, LBB0_20
; %bb.16:                               ;   in Loop: Header=BB0_13 Depth=3
	ldr	w8, [x28]
LBB0_17:                                ;   in Loop: Header=BB0_13 Depth=3
	add	w9, w27, #1
	cmp	w8, w9
	b.le	LBB0_19
; %bb.18:                               ;   in Loop: Header=BB0_13 Depth=3
	ldr	x9, [x23]
	add	x27, x27, #1
	b	LBB0_13
LBB0_19:                                ;   in Loop: Header=BB0_10 Depth=2
	add	x27, x27, #1
	b	LBB0_8
LBB0_20:                                ;   in Loop: Header=BB0_10 Depth=2
	mov	x22, x0
	ldr	x0, [x21, #24]
	bl	_FreeWinding
	str	x22, [x21, #24]
	ldr	w8, [x21, #16]
	cmp	w8, #0
	ldr	w9, [x25, #16]
	ccmp	w9, #0, #4, ne
	ldr	w10, [sp, #12]                  ; 4-byte Folded Reload
	cinc	w10, w10, ne
	str	w10, [sp, #12]                  ; 4-byte Folded Spill
	orr	w8, w9, w8
	str	w8, [x21, #16]
	mov	x0, x21
	bl	_SetPortalSphere
Lloh10:
	adrp	x8, _qtrue@GOTPAGE
Lloh11:
	ldr	x8, [x8, _qtrue@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	str	x8, [x25, #8]
	ldr	w8, [sp, #8]                    ; 4-byte Folded Reload
	add	w8, w8, #1
	str	w8, [sp, #8]                    ; 4-byte Folded Spill
	sub	w24, w24, #1
	ldr	w8, [x28]
	b	LBB0_8
LBB0_21:
	str	xzr, [sp, #8]                   ; 8-byte Folded Spill
LBB0_22:
Lloh13:
	adrp	x0, l_.str@PAGE
Lloh14:
	add	x0, x0, l_.str@PAGEOFF
	ldr	w1, [sp, #8]                    ; 4-byte Folded Reload
	bl	__printf
Lloh15:
	adrp	x0, l_.str.1@PAGE
Lloh16:
	add	x0, x0, l_.str.1@PAGEOFF
	ldr	w1, [sp, #12]                   ; 4-byte Folded Reload
	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
	b	__printf
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_portalclusters,4,2             ; @portalclusters
	.comm	_leafs,8,3                      ; @leafs
	.comm	_qtrue,8,3                      ; @qtrue
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%6d portals merged\n"

l_.str.1:                               ; @.str.1
	.asciz	"%6d hint portals merged\n"

.subsections_via_symbols
