	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_VS_LinkSurfaceIntoCluster      ## -- Begin function VS_LinkSurfaceIntoCluster
	.p2align	4, 0x90
_VS_LinkSurfaceIntoCluster:             ## @VS_LinkSurfaceIntoCluster
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	_leafs@GOTPCREL(%rip), %rax
	movq	(%rax), %r11
	movslq	%edi, %r9
	movl	(%r11,%r9,8), %r14d
	testl	%r14d, %r14d
	jle	LBB0_1
## %bb.14:
	movq	_clustersurfaces@GOTPCREL(%rip), %rdx
	movslq	4(%r11,%r9,8), %rcx
	movq	%rcx, %rax
	shlq	$2, %rax
	addq	(%rdx), %rax
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	cmpl	%esi, (%rax,%rdx,4)
	je	LBB0_13
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	incq	%rdx
	cmpq	%rdx, %r14
	jne	LBB0_15
	jmp	LBB0_2
LBB0_1:
	movl	4(%r11,%r9,8), %ecx
LBB0_2:
	movq	_numclustersurfaces@GOTPCREL(%rip), %r8
	movslq	(%r8), %rax
	leal	(%r14,%rcx), %edx
	cmpl	%edx, %eax
	jle	LBB0_5
## %bb.3:
	movq	_clustersurfaces@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r10
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	-4(%r10,%rax,4), %ecx
	movl	%ecx, (%r10,%rax,4)
	leaq	-1(%rax), %rbx
	movl	(%r11,%r9,8), %r14d
	movl	4(%r11,%r9,8), %ecx
	leal	(%r14,%rcx), %eax
	movslq	%eax, %rdx
	movq	%rbx, %rax
	cmpq	%rdx, %rbx
	jg	LBB0_4
LBB0_5:
	movq	_portalclusters@GOTPCREL(%rip), %r10
	movl	(%r10), %eax
	testl	%eax, %eax
	jle	LBB0_12
## %bb.6:
	movl	%edi, %ecx
	xorl	%edi, %edi
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_7 Depth=1
	incq	%rdi
	movslq	%eax, %rdx
	cmpq	%rdx, %rdi
	jge	LBB0_11
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rdi, %rcx
	je	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movl	4(%r11,%rdi,8), %edx
	movl	4(%r11,%r9,8), %ebx
	addl	%r14d, %ebx
	cmpl	%ebx, %edx
	jl	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	leaq	(%rdi,%rdi), %rax
	incl	%edx
	movl	%edx, 4(%r11,%rax,4)
	movl	(%r10), %eax
	jmp	LBB0_10
LBB0_11:
	movl	4(%r11,%r9,8), %ecx
LBB0_12:
	movq	_clustersurfaces@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	addl	%r14d, %ecx
	movslq	%ecx, %rcx
	movl	%esi, (%rax,%rcx,4)
	incl	(%r11,%r9,8)
	movl	(%r8), %eax
	incl	%eax
	movl	%eax, (%r8)
	movq	_MAX_MAP_LEAFFACES@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jge	LBB0_17
LBB0_13:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_17:
	leaq	L_.str(%rip), %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_Error                          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_leafs,8,3                      ## @leafs
	.comm	_clustersurfaces,8,3            ## @clustersurfaces
	.comm	_numclustersurfaces,4,2         ## @numclustersurfaces
	.comm	_portalclusters,4,2             ## @portalclusters
	.comm	_MAX_MAP_LEAFFACES,4,2          ## @MAX_MAP_LEAFFACES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MAX_MAP_LEAFFACES"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_VS_LinkSurfaceIntoCluster      ; -- Begin function VS_LinkSurfaceIntoCluster
	.p2align	2
_VS_LinkSurfaceIntoCluster:             ; @VS_LinkSurfaceIntoCluster
	.cfi_startproc
; %bb.0:
                                        ; kill: def $w0 killed $w0 def $x0
Lloh0:
	adrp	x8, _leafs@GOTPAGE
Lloh1:
	ldr	x8, [x8, _leafs@GOTPAGEOFF]
Lloh2:
	ldr	x12, [x8]
	sxtw	x13, w0
	add	x8, x12, w0, sxtw #3
	ldr	w10, [x8]
Lloh3:
	adrp	x9, _clustersurfaces@GOTPAGE
Lloh4:
	ldr	x9, [x9, _clustersurfaces@GOTPAGEOFF]
	cmp	w10, #0
	b.le	LBB0_4
; %bb.1:
	ldr	x11, [x9]
	add	x14, x12, x13, lsl #3
	ldrsw	x14, [x14, #4]
	add	x11, x11, x14, lsl #2
	mov	x15, x10
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w16, [x11]
	cmp	w16, w1
	b.eq	LBB0_16
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x11, x11, #4
	subs	x15, x15, #1
	b.ne	LBB0_2
	b	LBB0_5
LBB0_4:
	add	x11, x12, x13, lsl #3
	ldr	w14, [x11, #4]
LBB0_5:
Lloh5:
	adrp	x11, _numclustersurfaces@GOTPAGE
Lloh6:
	ldr	x11, [x11, _numclustersurfaces@GOTPAGEOFF]
	ldrsw	x15, [x11]
	add	x13, x12, x13, lsl #3
	add	x13, x13, #4
	add	w16, w10, w14
	cmp	w15, w16
	b.le	LBB0_8
; %bb.6:
	ldr	x16, [x9]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	add	x10, x16, x15, lsl #2
	sub	x15, x15, #1
	ldur	w14, [x10, #-4]
	str	w14, [x10]
	ldr	w14, [x13]
	ldr	w10, [x8]
	add	w17, w10, w14
	cmp	x15, w17, sxtw
	b.gt	LBB0_7
LBB0_8:
Lloh7:
	adrp	x15, _portalclusters@GOTPAGE
Lloh8:
	ldr	x15, [x15, _portalclusters@GOTPAGEOFF]
	ldr	w16, [x15]
	cmp	w16, #1
	b.lt	LBB0_15
; %bb.9:
	mov	x14, #0
	mov	w17, w0
	add	x12, x12, #4
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	x14, x14, #1
	add	x12, x12, #8
	cmp	x14, w16, sxtw
	b.ge	LBB0_14
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	cmp	x17, x14
	b.eq	LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	w0, [x12]
	ldr	w2, [x13]
	add	w2, w2, w10
	cmp	w0, w2
	b.lt	LBB0_10
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=1
	add	w16, w0, #1
	str	w16, [x12]
	ldr	w16, [x15]
	b	LBB0_10
LBB0_14:
	ldr	w14, [x13]
LBB0_15:
	ldr	x9, [x9]
	add	w10, w14, w10
	str	w1, [x9, w10, sxtw #2]
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
	ldr	w8, [x11]
	add	w8, w8, #1
	str	w8, [x11]
Lloh9:
	adrp	x9, _MAX_MAP_LEAFFACES@GOTPAGE
Lloh10:
	ldr	x9, [x9, _MAX_MAP_LEAFFACES@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ge	LBB0_17
LBB0_16:
	ret
LBB0_17:
Lloh12:
	adrp	x0, l_.str@PAGE
Lloh13:
	add	x0, x0, l_.str@PAGEOFF
	b	_Error
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_leafs,8,3                      ; @leafs
	.comm	_clustersurfaces,8,3            ; @clustersurfaces
	.comm	_numclustersurfaces,4,2         ; @numclustersurfaces
	.comm	_portalclusters,4,2             ; @portalclusters
	.comm	_MAX_MAP_LEAFFACES,4,2          ; @MAX_MAP_LEAFFACES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MAX_MAP_LEAFFACES"

.subsections_via_symbols
