	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_BuildFaceTree_r                ## -- Begin function BuildFaceTree_r
	.p2align	4, 0x90
_BuildFaceTree_r:                       ## @BuildFaceTree_r
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r12
	movq	%rsi, %rdi
	callq	_CountFaceList
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_SelectSplitPlaneNum
	cmpl	$-1, %eax
	je	LBB0_1
## %bb.2:
	movl	%eax, (%r12)
	movq	_hintsplit@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 40(%r12)
	movq	_mapplanes@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r14
	movslq	%eax, %r15
	shlq	$4, %r15
	leaq	(%r14,%r15), %r13
	testq	%rbx, %rbx
	je	LBB0_3
## %bb.6:
	movq	%r14, -88(%rbp)                 ## 8-byte Spill
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	addq	%r15, %r14
	addq	$8, %r14
	xorl	%ecx, %ecx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	xorl	%ecx, %ecx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%rbx), %r15
	cmpl	%eax, (%rbx)
	je	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	24(%rbx), %rdi
	movq	(%r13), %rsi
	movl	(%r14), %edx
	callq	_WindingOnPlaneSide
	movq	_SIDE_CROSS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_14
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	24(%rbx), %rdi
	movq	(%r13), %rsi
	movl	(%r14), %edx
	movq	_CLIP_EPSILON@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	addl	%ecx, %ecx
	leaq	-72(%rbp), %r8
	leaq	-64(%rbp), %r9
	callq	_ClipWindingEpsilon
	cmpq	$0, -72(%rbp)
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	xorl	%eax, %eax
	callq	_AllocBspFace
	movq	-72(%rbp), %rcx
	movq	%rcx, 24(%rax)
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	%rcx, 8(%rax)
	movl	(%rbx), %ecx
	movl	%ecx, (%rax)
	movl	20(%rbx), %ecx
	movl	%ecx, 20(%rax)
	movl	16(%rbx), %ecx
	movl	%ecx, 16(%rax)
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=1
	cmpq	$0, -64(%rbp)
	je	LBB0_8
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	xorl	%eax, %eax
	callq	_AllocBspFace
	movq	-64(%rbp), %rcx
	movq	%rcx, 24(%rax)
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%rcx, 8(%rax)
	movl	(%rbx), %ecx
	movl	%ecx, (%rax)
	movl	20(%rbx), %ecx
	movl	%ecx, 20(%rax)
	movl	16(%rbx), %ecx
	movl	%ecx, 16(%rax)
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
LBB0_8:                                 ##   in Loop: Header=BB0_7 Depth=1
	movq	%rbx, %rdi
	callq	_FreeBspFace
LBB0_18:                                ##   in Loop: Header=BB0_7 Depth=1
	testq	%r15, %r15
	je	LBB0_19
## %bb.20:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	(%r12), %eax
	movq	%r15, %rbx
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	_SIDE_FRONT@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 8(%rbx)
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_18
LBB0_16:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	_SIDE_BACK@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 8(%rbx)
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_18
LBB0_19:
	movq	-88(%rbp), %r14                 ## 8-byte Reload
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_4
LBB0_1:
	movq	_PLANENUM_LEAF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r12)
	movq	_c_faceLeafs@GOTPCREL(%rip), %rax
	incl	(%rax)
	jmp	LBB0_25
LBB0_3:
	xorl	%eax, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
LBB0_4:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_AllocNode
	movq	8(%r12), %rcx
	movq	%rax, (%rcx)
	movq	8(%r12), %rax
	movq	(%rax), %rcx
	movq	%r12, 32(%rcx)
	movq	24(%r12), %rdi
	movq	(%rax), %rax
	movq	24(%rax), %rsi
	callq	_VectorCopy
	movq	8(%r12), %rax
	movq	16(%r12), %rdi
	movq	(%rax), %rax
	movq	16(%rax), %rsi
	callq	_VectorCopy
	xorl	%eax, %eax
	callq	_AllocNode
	movq	8(%r12), %rcx
	movq	%rax, 8(%rcx)
	movq	8(%r12), %rax
	movq	8(%rax), %rcx
	movq	%r12, 32(%rcx)
	movq	24(%r12), %rdi
	movq	8(%rax), %rax
	movq	24(%rax), %rsi
	callq	_VectorCopy
	movq	8(%r12), %rax
	movq	16(%r12), %rdi
	movq	8(%rax), %rax
	movq	16(%rax), %rsi
	callq	_VectorCopy
	movq	(%r13), %rax
	cmpl	$1, (%rax)
	je	LBB0_5
## %bb.21:
	movl	$1, %ebx
	cmpl	$1, 4(%rax)
	je	LBB0_5
## %bb.22:
	movl	$2, %ebx
	cmpl	$1, 8(%rax)
	jne	LBB0_23
LBB0_5:
	movl	8(%r14,%r15), %eax
	movq	8(%r12), %rcx
	movq	(%rcx), %rdi
	movq	24(%rdi), %rdx
	movl	%eax, (%rdx,%rbx,4)
	movl	8(%r14,%r15), %eax
	movq	8(%rcx), %rcx
	movq	16(%rcx), %rcx
	movl	%eax, (%rcx,%rbx,4)
LBB0_24:
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_BuildFaceTree_r
	movq	8(%r12), %rax
	movq	8(%rax), %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_BuildFaceTree_r
LBB0_25:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_23:
	movq	8(%r12), %rax
	movq	(%rax), %rdi
	jmp	LBB0_24
	.cfi_endproc
                                        ## -- End function
	.comm	_PLANENUM_LEAF,4,2              ## @PLANENUM_LEAF
	.comm	_c_faceLeafs,4,2                ## @c_faceLeafs
	.comm	_hintsplit,4,2                  ## @hintsplit
	.comm	_mapplanes,8,3                  ## @mapplanes
	.comm	_SIDE_CROSS,4,2                 ## @SIDE_CROSS
	.comm	_CLIP_EPSILON,4,2               ## @CLIP_EPSILON
	.comm	_SIDE_FRONT,4,2                 ## @SIDE_FRONT
	.comm	_SIDE_BACK,4,2                  ## @SIDE_BACK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_BuildFaceTree_r                ; -- Begin function BuildFaceTree_r
	.p2align	2
_BuildFaceTree_r:                       ; @BuildFaceTree_r
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x22, x1
	mov	x19, x0
	mov	x0, x1
	bl	_CountFaceList
	mov	x0, x19
	mov	x1, x22
	bl	_SelectSplitPlaneNum
                                        ; kill: def $w0 killed $w0 def $x0
	cmn	w0, #1
	b.eq	LBB0_17
; %bb.1:
	str	w0, [x19]
Lloh0:
	adrp	x8, _hintsplit@GOTPAGE
Lloh1:
	ldr	x8, [x8, _hintsplit@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x19, #40]
Lloh3:
	adrp	x8, _mapplanes@GOTPAGE
Lloh4:
	ldr	x8, [x8, _mapplanes@GOTPAGEOFF]
Lloh5:
	ldr	x23, [x8]
	sxtw	x24, w0
	add	x25, x23, w0, sxtw #4
	cbz	x22, LBB0_18
; %bb.2:
	mov	x20, #0
	mov	x21, #0
	stp	x24, x23, [sp]                  ; 16-byte Folded Spill
	add	x8, x23, x24, lsl #4
	add	x26, x8, #8
Lloh6:
	adrp	x27, _SIDE_CROSS@GOTPAGE
Lloh7:
	ldr	x27, [x27, _SIDE_CROSS@GOTPAGEOFF]
Lloh8:
	adrp	x28, _CLIP_EPSILON@GOTPAGE
Lloh9:
	ldr	x28, [x28, _CLIP_EPSILON@GOTPAGEOFF]
Lloh10:
	adrp	x24, _SIDE_FRONT@GOTPAGE
Lloh11:
	ldr	x24, [x24, _SIDE_FRONT@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x23, [x22, #8]
	ldr	w8, [x22]
	cmp	w8, w0
	b.eq	LBB0_9
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x0, [x22, #24]
	ldr	x1, [x25]
	ldr	w2, [x26]
	bl	_WindingOnPlaneSide
	ldr	w8, [x27]
	cmp	w0, w8
	b.ne	LBB0_12
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x0, [x22, #24]
	ldr	x1, [x25]
	ldr	w2, [x26]
	ldr	w8, [x28]
	lsl	w3, w8, #1
	add	x4, sp, #24
	add	x5, sp, #16
	bl	_ClipWindingEpsilon
	ldr	x8, [sp, #24]
	cbz	x8, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	bl	_AllocBspFace
	ldr	x8, [sp, #24]
	str	x8, [x0, #24]
	str	x21, [x0, #8]
	ldr	w8, [x22]
	str	w8, [x0]
	ldr	d0, [x22, #16]
	str	d0, [x0, #16]
	mov	x21, x0
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [sp, #16]
	cbz	x8, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	bl	_AllocBspFace
	ldr	x8, [sp, #16]
	str	x8, [x0, #24]
	str	x20, [x0, #8]
	ldr	w8, [x22]
	str	w8, [x0]
	ldr	d0, [x22, #16]
	str	d0, [x0, #16]
	mov	x20, x0
LBB0_9:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x22
	bl	_FreeBspFace
LBB0_10:                                ;   in Loop: Header=BB0_3 Depth=1
	cbz	x23, LBB0_16
; %bb.11:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x19]
	mov	x22, x23
	b	LBB0_3
LBB0_12:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x24]
	cmp	w0, w8
	b.ne	LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_3 Depth=1
	str	x21, [x22, #8]
	mov	x21, x22
	b	LBB0_10
LBB0_14:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh12:
	adrp	x8, _SIDE_BACK@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SIDE_BACK@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_10
; %bb.15:                               ;   in Loop: Header=BB0_3 Depth=1
	str	x20, [x22, #8]
	mov	x20, x22
	b	LBB0_10
LBB0_16:
	ldp	x24, x23, [sp]                  ; 16-byte Folded Reload
	b	LBB0_19
LBB0_17:
Lloh15:
	adrp	x8, _PLANENUM_LEAF@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PLANENUM_LEAF@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	str	w8, [x19]
Lloh18:
	adrp	x8, _c_faceLeafs@GOTPAGE
Lloh19:
	ldr	x8, [x8, _c_faceLeafs@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
	b	LBB0_27
LBB0_18:
	mov	x21, #0
	mov	x20, #0
LBB0_19:
	bl	_AllocNode
	ldr	x8, [x19, #8]
	str	x0, [x8]
	ldr	x8, [x19, #8]
	ldr	x9, [x8]
	str	x19, [x9, #32]
	ldr	x0, [x19, #24]
	ldr	x8, [x8]
	ldr	x1, [x8, #24]
	bl	_VectorCopy
	ldp	x8, x0, [x19, #8]
	ldr	x8, [x8]
	ldr	x1, [x8, #16]
	bl	_VectorCopy
	bl	_AllocNode
	ldr	x8, [x19, #8]
	str	x0, [x8, #8]
	ldr	x8, [x19, #8]
	ldr	x9, [x8, #8]
	str	x19, [x9, #32]
	ldr	x0, [x19, #24]
	ldr	x8, [x8, #8]
	ldr	x1, [x8, #24]
	bl	_VectorCopy
	ldp	x8, x0, [x19, #8]
	ldr	x8, [x8, #8]
	ldr	x1, [x8, #16]
	bl	_VectorCopy
	ldr	x8, [x25]
	ldr	w9, [x8]
	cmp	w9, #1
	b.ne	LBB0_21
; %bb.20:
	mov	x8, #0
	b	LBB0_25
LBB0_21:
	ldr	w9, [x8, #4]
	cmp	w9, #1
	b.ne	LBB0_23
; %bb.22:
	mov	w8, #1
	b	LBB0_25
LBB0_23:
	ldr	w8, [x8, #8]
	cmp	w8, #1
	b.ne	LBB0_28
; %bb.24:
	mov	w8, #2
LBB0_25:
	add	x9, x23, x24, lsl #4
	ldr	w10, [x9, #8]
	ldr	x11, [x19, #8]
	ldr	x0, [x11]
	ldr	x12, [x0, #24]
	lsl	x8, x8, #2
	str	w10, [x12, x8]
	ldr	w9, [x9, #8]
	ldr	x10, [x11, #8]
	ldr	x10, [x10, #16]
	str	w9, [x10, x8]
LBB0_26:
	mov	x1, x21
	bl	_BuildFaceTree_r
	ldr	x8, [x19, #8]
	ldr	x0, [x8, #8]
	mov	x1, x20
	bl	_BuildFaceTree_r
LBB0_27:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_28:
	ldr	x8, [x19, #8]
	ldr	x0, [x8]
	b	LBB0_26
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_PLANENUM_LEAF,4,2              ; @PLANENUM_LEAF
	.comm	_c_faceLeafs,4,2                ; @c_faceLeafs
	.comm	_hintsplit,4,2                  ; @hintsplit
	.comm	_mapplanes,8,3                  ; @mapplanes
	.comm	_SIDE_CROSS,4,2                 ; @SIDE_CROSS
	.comm	_CLIP_EPSILON,4,2               ; @CLIP_EPSILON
	.comm	_SIDE_FRONT,4,2                 ; @SIDE_FRONT
	.comm	_SIDE_BACK,4,2                  ; @SIDE_BACK
.subsections_via_symbols
