	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function TH_CreateTriangle
LCPI0_0:
	.space	16
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_TH_CreateTriangle
	.p2align	4, 0x90
_TH_CreateTriangle:                     ## @TH_CreateTriangle
	.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	%rdi, %r12
	movq	_thworld@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	testl	%eax, %eax
	jne	LBB0_2
## %bb.1:
	movl	$1, (%r15)
	movl	$1, %eax
LBB0_2:
	movq	_MAX_TH_TRIANGLES@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jl	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rdi
	callq	_Error
	movl	(%r15), %eax
LBB0_4:
	movq	24(%r15), %r13
	leal	1(%rax), %ecx
	movl	%ecx, (%r15)
	cltq
	leaq	(%rax,%rax,8), %rbx
	leaq	(,%rbx,8), %r14
	addq	%r13, %r14
	movl	(%r12), %edi
	movl	4(%r12), %esi
	callq	_TH_FindOrCreateEdge
	movq	64(%r13,%rbx,8), %rcx
	movl	%eax, (%rcx)
	movl	%eax, %edi
	negl	%edi
	cmovsl	%eax, %edi
	callq	_TH_AddEdgeUser
	movl	4(%r12), %edi
	movl	8(%r12), %esi
	callq	_TH_FindOrCreateEdge
	movq	64(%r13,%rbx,8), %rcx
	movl	%eax, 4(%rcx)
	movl	%eax, %edi
	negl	%edi
	cmovsl	%eax, %edi
	callq	_TH_AddEdgeUser
	movl	(%r12), %esi
	movl	8(%r12), %edi
	callq	_TH_FindOrCreateEdge
	movq	64(%r13,%rbx,8), %rcx
	movl	%eax, 8(%rcx)
	movl	%eax, %edi
	negl	%edi
	cmovsl	%eax, %edi
	callq	_TH_AddEdgeUser
	xorps	%xmm0, %xmm0
	movups	%xmm0, 48(%r13,%rbx,8)
	movl	(%r12), %edi
	movl	4(%r12), %esi
	movl	8(%r12), %edx
	callq	_TH_PlaneFromPoints
	movq	%rax, (%r13,%rbx,8)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 24(%r13,%rbx,8)
	movq	$0, 40(%r13,%rbx,8)
	leaq	(,%rax,4), %rsi
	addq	16(%r15), %rsi
	movl	16(%r13,%rbx,8), %edx
	movq	%r12, %rdi
	callq	_TH_CreateTrianglePlanes
	movq	%r14, %rdi
	callq	_TH_AddTriangleToHash
	movl	8(%r13,%rbx,8), %esi
	movl	12(%r13,%rbx,8), %edi
	callq	_ClearBounds
	movq	8(%r15), %rax
	movslq	(%r12), %rcx
	movl	(%rax,%rcx,4), %edi
	movl	8(%r13,%rbx,8), %edx
	movl	12(%r13,%rbx,8), %esi
	callq	_AddPointToBounds
	movq	8(%r15), %rax
	movslq	4(%r12), %rcx
	movl	(%rax,%rcx,4), %edi
	movl	8(%r13,%rbx,8), %edx
	movl	12(%r13,%rbx,8), %esi
	callq	_AddPointToBounds
	movq	8(%r15), %rax
	movslq	8(%r12), %rcx
	movl	(%rax,%rcx,4), %edi
	movl	8(%r13,%rbx,8), %edx
	movl	12(%r13,%rbx,8), %esi
	callq	_AddPointToBounds
	movl	(%r15), %eax
	decl	%eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_thworld,32,3                   ## @thworld
	.comm	_MAX_TH_TRIANGLES,4,2           ## @MAX_TH_TRIANGLES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MAX_TH_TRIANGLES"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_TH_CreateTriangle              ; -- Begin function TH_CreateTriangle
	.p2align	2
_TH_CreateTriangle:                     ; @TH_CreateTriangle
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
Lloh0:
	adrp	x21, _thworld@GOTPAGE
Lloh1:
	ldr	x21, [x21, _thworld@GOTPAGEOFF]
	ldr	w8, [x21]
	cbnz	w8, LBB0_2
; %bb.1:
	mov	w8, #1
	str	w8, [x21]
LBB0_2:
Lloh2:
	adrp	x9, _MAX_TH_TRIANGLES@GOTPAGE
Lloh3:
	ldr	x9, [x9, _MAX_TH_TRIANGLES@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	cmp	w8, w9
	b.lt	LBB0_4
; %bb.3:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_Error
	ldr	w8, [x21]
LBB0_4:
	ldr	x9, [x21, #24]
	add	w10, w8, #1
	str	w10, [x21]
	mov	w10, #72
	smaddl	x20, w8, w10, x9
	ldp	w0, w1, [x19]
	bl	_TH_FindOrCreateEdge
	ldr	x8, [x20, #64]
	str	w0, [x8]
	cmp	w0, #0
	cneg	w0, w0, mi
	bl	_TH_AddEdgeUser
	ldp	w0, w1, [x19, #4]
	bl	_TH_FindOrCreateEdge
	ldr	x8, [x20, #64]
	str	w0, [x8, #4]
	cmp	w0, #0
	cneg	w0, w0, mi
	bl	_TH_AddEdgeUser
	ldr	w0, [x19, #8]
	ldr	w1, [x19]
	bl	_TH_FindOrCreateEdge
	ldr	x8, [x20, #64]
	str	w0, [x8, #8]
	cmp	w0, #0
	cneg	w0, w0, mi
	bl	_TH_AddEdgeUser
	stp	xzr, xzr, [x20, #48]
	ldp	w0, w1, [x19]
	ldr	w2, [x19, #8]
	bl	_TH_PlaneFromPoints
	str	x0, [x20]
	stp	xzr, xzr, [x20, #32]
	str	xzr, [x20, #24]
	ldr	x8, [x21, #16]
	add	x1, x8, x0, lsl #2
	ldr	w2, [x20, #16]
	mov	x0, x19
	bl	_TH_CreateTrianglePlanes
	mov	x0, x20
	bl	_TH_AddTriangleToHash
	ldp	w1, w0, [x20, #8]
	bl	_ClearBounds
	ldr	x8, [x21, #8]
	ldrsw	x9, [x19]
	ldr	w0, [x8, x9, lsl #2]
	ldp	w2, w1, [x20, #8]
	bl	_AddPointToBounds
	ldr	x8, [x21, #8]
	ldrsw	x9, [x19, #4]
	ldr	w0, [x8, x9, lsl #2]
	ldp	w2, w1, [x20, #8]
	bl	_AddPointToBounds
	ldr	x8, [x21, #8]
	ldrsw	x9, [x19, #8]
	ldr	w0, [x8, x9, lsl #2]
	ldp	w2, w1, [x20, #8]
	bl	_AddPointToBounds
	ldr	w8, [x21]
	sub	w0, w8, #1
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_thworld,32,3                   ; @thworld
	.comm	_MAX_TH_TRIANGLES,4,2           ; @MAX_TH_TRIANGLES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MAX_TH_TRIANGLES"

.subsections_via_symbols
