	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ClusterMerge                   ## -- Begin function ClusterMerge
	.p2align	4, 0x90
_ClusterMerge:                          ## @ClusterMerge
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %ebx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_MAX_PORTALS@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leal	7(%rcx), %eax
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	sarl	$3, %eax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r12
	movq	_MAX_MAP_LEAFS@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leal	7(%rcx), %eax
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	sarl	$3, %eax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, -64(%rbp)                 ## 8-byte Spill
	movq	_leafs@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	movl	%ebx, -52(%rbp)                 ## 4-byte Spill
	movl	%ebx, %ecx
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movslq	%ecx, %r13
	movq	%r13, %rbx
	shlq	$4, %rbx
	movl	(%rax,%rbx), %ecx
	testl	%ecx, %ecx
	jns	LBB0_1
## %bb.2:
	movq	_portalbytes@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_memset
	movq	(%r14), %rcx
	movl	4(%rcx,%rbx), %eax
	testl	%eax, %eax
	jle	LBB0_16
## %bb.3:
	addq	%rcx, %rbx
	addq	$4, %rbx
	xorl	%r14d, %r14d
	movq	_stat_done@GOTPCREL(%rip), %rdi
	movq	_portallongs@GOTPCREL(%rip), %r9
	movq	_portals@GOTPCREL(%rip), %r10
	movabsq	$-6148914691236517205, %r11     ## imm = 0xAAAAAAAAAAAAAAAB
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_4 Depth=1
	subq	(%r10), %r15
	sarq	$3, %r15
	imulq	%r11, %r15
	movl	%r15d, %ecx
	andb	$7, %cl
	movl	$1, %eax
	shll	%cl, %eax
	sarl	$3, %r15d
	movslq	%r15d, %rcx
	orl	%eax, (%r12,%rcx,4)
	movl	(%rbx), %eax
LBB0_15:                                ##   in Loop: Header=BB0_4 Depth=1
	incq	%r14
	movslq	%eax, %rcx
	cmpq	%rcx, %r14
	jge	LBB0_16
LBB0_4:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_11 Depth 2
	movq	4(%rbx), %rcx
	movq	(%rcx,%r14,8), %r15
	cmpq	$0, 16(%r15)
	jne	LBB0_15
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	(%r15), %rax
	cmpq	(%rdi), %rax
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	leaq	L_.str(%rip), %rdi
	callq	_Error
	movabsq	$-6148914691236517205, %r11     ## imm = 0xAAAAAAAAAAAAAAAB
	movq	_portals@GOTPCREL(%rip), %r10
	movq	_portallongs@GOTPCREL(%rip), %r9
	movq	_stat_done@GOTPCREL(%rip), %rdi
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=1
	movl	(%r9), %eax
	testl	%eax, %eax
	jle	LBB0_14
## %bb.8:                               ##   in Loop: Header=BB0_4 Depth=1
	cmpl	$1, %eax
	jne	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=1
	xorl	%ecx, %ecx
	jmp	LBB0_12
LBB0_10:                                ##   in Loop: Header=BB0_4 Depth=1
	movl	%eax, %edx
	andl	$-2, %edx
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_4 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	8(%r15), %rsi
	movq	(%rsi,%rcx,8), %rsi
	orq	%rsi, (%r12,%rcx,8)
	movq	8(%r15), %rsi
	movq	8(%rsi,%rcx,8), %rsi
	orq	%rsi, 8(%r12,%rcx,8)
	addq	$2, %rcx
	cmpq	%rcx, %rdx
	jne	LBB0_11
LBB0_12:                                ##   in Loop: Header=BB0_4 Depth=1
	testb	$1, %al
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_4 Depth=1
	movq	8(%r15), %rax
	movq	(%rax,%rcx,8), %rax
	orq	%rax, (%r12,%rcx,8)
	jmp	LBB0_14
LBB0_16:
	movq	_leafbytes@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_memset
	movl	%r13d, %ecx
	andb	$7, %cl
	movl	$1, %eax
	shll	%cl, %eax
	sarl	$3, %r13d
	movslq	%r13d, %rcx
	orl	%eax, (%r15,%rcx,4)
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_LeafVectorFromPortalVector
                                        ## kill: def $eax killed $eax def $rax
	leal	1(%rax), %edx
	movq	_totalvis@GOTPCREL(%rip), %rax
	addl	%edx, (%rax)
	leaq	L_.str.1(%rip), %rdi
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %esi
	callq	_qprintf
	movq	_visBytes@GOTPCREL(%rip), %rax
	movq	_VIS_HEADER_SIZE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	addq	(%rax), %rcx
	movl	(%r14), %edx
	imull	%edx, %ebx
	movslq	%ebx, %rdi
	addq	%rcx, %rdi
	movq	%r15, %rsi
	callq	_memcpy
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_18
## %bb.17:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_PORTALS,4,2                ## @MAX_PORTALS
	.comm	_MAX_MAP_LEAFS,4,2              ## @MAX_MAP_LEAFS
	.comm	_leafs,8,3                      ## @leafs
	.comm	_portalbytes,4,2                ## @portalbytes
	.comm	_stat_done,8,3                  ## @stat_done
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"portal not done"

	.comm	_portallongs,4,2                ## @portallongs
	.comm	_portals,8,3                    ## @portals
	.comm	_leafbytes,4,2                  ## @leafbytes
	.comm	_totalvis,4,2                   ## @totalvis
L_.str.1:                               ## @.str.1
	.asciz	"cluster %4i : %4i visible\n"

	.comm	_visBytes,8,3                   ## @visBytes
	.comm	_VIS_HEADER_SIZE,8,3            ## @VIS_HEADER_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ClusterMerge                   ; -- Begin function ClusterMerge
	.p2align	2
_ClusterMerge:                          ; @ClusterMerge
	.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
	sub	sp, sp, #32
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
Lloh3:
	adrp	x8, _MAX_PORTALS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX_PORTALS@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #3
	lsl	x9, x8, #2
	add	x8, x9, #15
	and	x8, x8, #0x7fffffff0
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	sub	x21, x9, x8
	mov	sp, x21
Lloh8:
	adrp	x8, _MAX_MAP_LEAFS@GOTPAGE
Lloh9:
	ldr	x8, [x8, _MAX_MAP_LEAFS@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #3
	lsl	x9, x8, #2
	add	x8, x9, #15
	and	x8, x8, #0x7fffffff0
Lloh11:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh12:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	sub	x8, x9, x8
	stur	x8, [x29, #-104]                ; 8-byte Folded Spill
	mov	sp, x8
Lloh13:
	adrp	x19, _leafs@GOTPAGE
Lloh14:
	ldr	x19, [x19, _leafs@GOTPAGEOFF]
	ldr	x8, [x19]
	stur	w0, [x29, #-92]                 ; 4-byte Folded Spill
	mov	x10, x0
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	mov	x9, x10
	sbfiz	x10, x9, #4, #32
	ldr	w10, [x8, x10]
	tbz	w10, #31, LBB0_1
; %bb.2:
	sxtw	x20, w9
Lloh15:
	adrp	x8, _portalbytes@GOTPAGE
Lloh16:
	ldr	x8, [x8, _portalbytes@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	mov	x0, x21
	mov	w1, #0
	bl	_memset
	ldr	x8, [x19]
	stur	x20, [x29, #-112]               ; 8-byte Folded Spill
	add	x9, x8, x20, lsl #4
	mov	x24, x9
	ldr	w8, [x24, #4]!
	cmp	w8, #1
	b.lt	LBB0_12
; %bb.3:
	mov	x25, #0
	add	x26, x9, #8
Lloh18:
	adrp	x27, _stat_done@GOTPAGE
Lloh19:
	ldr	x27, [x27, _stat_done@GOTPAGEOFF]
Lloh20:
	adrp	x28, _portallongs@GOTPAGE
Lloh21:
	ldr	x28, [x28, _portallongs@GOTPAGEOFF]
Lloh22:
	adrp	x19, _portals@GOTPAGE
Lloh23:
	ldr	x19, [x19, _portals@GOTPAGEOFF]
	mov	w22, #43691
	movk	w22, #43690, lsl #16
	mov	w23, #1
	b	LBB0_6
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x19]
	sub	x8, x20, x8
	lsr	x8, x8, #3
	mul	w8, w8, w22
	and	w9, w8, #0x7
	lsl	w9, w23, w9
	asr	w8, w8, #3
	sbfiz	x8, x8, #2, #32
	ldr	w10, [x21, x8]
	orr	w9, w9, w10
	str	w9, [x21, x8]
	ldr	w8, [x24]
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	x25, x25, #1
	cmp	x25, w8, sxtw
	b.ge	LBB0_12
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_11 Depth 2
	ldr	x9, [x26]
	ldr	x20, [x9, x25, lsl #3]
	ldr	x9, [x20, #16]
	cbnz	x9, LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x20]
	ldr	x9, [x27]
	cmp	x8, x9
	b.eq	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh24:
	adrp	x0, l_.str@PAGE
Lloh25:
	add	x0, x0, l_.str@PAGEOFF
	bl	_Error
LBB0_9:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	w9, [x28]
	cmp	w9, #1
	b.lt	LBB0_4
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	x8, #0
	lsl	x9, x9, #3
LBB0_11:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x10, [x20, #8]
	ldr	x10, [x10, x8]
	ldr	x11, [x21, x8]
	orr	x10, x11, x10
	str	x10, [x21, x8]
	add	x8, x8, #8
	cmp	x9, x8
	b.ne	LBB0_11
	b	LBB0_4
LBB0_12:
Lloh26:
	adrp	x19, _leafbytes@GOTPAGE
Lloh27:
	ldr	x19, [x19, _leafbytes@GOTPAGEOFF]
	ldr	w2, [x19]
	ldur	x22, [x29, #-104]               ; 8-byte Folded Reload
	mov	x0, x22
	mov	w1, #0
	bl	_memset
	ldur	x10, [x29, #-112]               ; 8-byte Folded Reload
	and	w8, w10, #0x7
	mov	w9, #1
	lsl	w8, w9, w8
	asr	w9, w10, #3
	sbfiz	x9, x9, #2, #32
	ldr	w10, [x22, x9]
	orr	w8, w10, w8
	str	w8, [x22, x9]
	mov	x0, x21
	mov	x1, x22
	bl	_LeafVectorFromPortalVector
	add	w2, w0, #1
Lloh28:
	adrp	x8, _totalvis@GOTPAGE
Lloh29:
	ldr	x8, [x8, _totalvis@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w9, w9, w2
	str	w9, [x8]
Lloh30:
	adrp	x0, l_.str.1@PAGE
Lloh31:
	add	x0, x0, l_.str.1@PAGEOFF
	ldur	w20, [x29, #-92]                ; 4-byte Folded Reload
	mov	x1, x20
	bl	_qprintf
Lloh32:
	adrp	x8, _visBytes@GOTPAGE
Lloh33:
	ldr	x8, [x8, _visBytes@GOTPAGEOFF]
Lloh34:
	adrp	x9, _VIS_HEADER_SIZE@GOTPAGE
Lloh35:
	ldr	x9, [x9, _VIS_HEADER_SIZE@GOTPAGEOFF]
Lloh36:
	ldr	x8, [x8]
Lloh37:
	ldr	x9, [x9]
	add	x8, x9, x8
	ldr	w2, [x19]
	mul	w9, w2, w20
	add	x0, x8, w9, sxtw
	mov	x1, x22
	bl	_memcpy
	ldur	x8, [x29, #-88]
Lloh38:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh39:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh40:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_14
; %bb.13:
	sub	sp, x29, #80
	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
	ret
LBB0_14:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh36
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_PORTALS,4,2                ; @MAX_PORTALS
	.comm	_MAX_MAP_LEAFS,4,2              ; @MAX_MAP_LEAFS
	.comm	_leafs,8,3                      ; @leafs
	.comm	_portalbytes,4,2                ; @portalbytes
	.comm	_stat_done,8,3                  ; @stat_done
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"portal not done"

	.comm	_portallongs,4,2                ; @portallongs
	.comm	_portals,8,3                    ; @portals
	.comm	_leafbytes,4,2                  ; @leafbytes
	.comm	_totalvis,4,2                   ; @totalvis
l_.str.1:                               ; @.str.1
	.asciz	"cluster %4i : %4i visible\n"

	.comm	_visBytes,8,3                   ; @visBytes
	.comm	_VIS_HEADER_SIZE,8,3            ; @VIS_HEADER_SIZE
.subsections_via_symbols
