// File: FreeSlave[P]vhlt/hlrad/lerp.cpp
// Function: CollectUsedPatches(facetriangulation_t*)
static void CollectUsedPatches (facetriangulation_t *facetrian)
{
	int i;
	int j;
	int k;
	int patchnum;
	const localtriangulation_t *lt;
	const localtriangulation_t::Wedge *w;

	facetrian->usedpatches.resize (0);
	for (i = 0; i < (int)facetrian->localtriangulations.size (); i++)
	{
		lt = facetrian->localtriangulations[i];

		patchnum = lt->patchnum;
		for (k = 0; k < (int)facetrian->usedpatches.size (); k++)
		{
			if (facetrian->usedpatches[k] == patchnum)
			{
				break;
			}
		}
		if (k == (int)facetrian->usedpatches.size ())
		{
			facetrian->usedpatches.push_back (patchnum);
		}

		for (j = 0; j < (int)lt->sortedwedges.size (); j++)
		{
			w = &lt->sortedwedges[j];

			patchnum = w->leftpatchnum;
			for (k = 0; k < (int)facetrian->usedpatches.size (); k++)
			{
				if (facetrian->usedpatches[k] == patchnum)
				{
					break;
				}
			}
			if (k == (int)facetrian->usedpatches.size ())
			{
				facetrian->usedpatches.push_back (patchnum);
			}
		}
	}
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq 0x40(%rsp), %rdi
addq $0x50, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fb10
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
movl %eax, 0x1c(%rsp)
movq 0x40(%rsp), %rdi
addq $0x38, %rdi
callq 0x1ef20
movq %rax, %rcx
movl 0x1c(%rsp), %eax
cmpl %ecx, %eax
jge 0x18456
movq 0x40(%rsp), %rdi
addq $0x38, %rdi
movslq 0x3c(%rsp), %rsi
callq 0x1f430
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movl 0x50(%rax), %eax
movl %eax, 0x30(%rsp)
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
movl %eax, 0x18(%rsp)
movq 0x40(%rsp), %rdi
addq $0x50, %rdi
callq 0x1eee0
movq %rax, %rcx
movl 0x18(%rsp), %eax
cmpl %ecx, %eax
jge 0x18324
movq 0x40(%rsp), %rdi
addq $0x50, %rdi
movslq 0x34(%rsp), %rsi
callq 0x1fc20
movl (%rax), %eax
cmpl 0x30(%rsp), %eax
jne 0x18315
jmp 0x18324
jmp 0x18317
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x182d7
movl 0x34(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x40(%rsp), %rdi
addq $0x50, %rdi
callq 0x1eee0
movq %rax, %rcx
movl 0x14(%rsp), %eax
cmpl %ecx, %eax
jne 0x18358
movq 0x40(%rsp), %rdi
addq $0x50, %rdi
leaq 0x30(%rsp), %rsi
callq 0x1fbb0
movl $0x0, 0x38(%rsp)
movl 0x38(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x28(%rsp), %rdi
addq $0x70, %rdi
callq 0x1f6c0
movq %rax, %rcx
movl 0x10(%rsp), %eax
cmpl %ecx, %eax
jge 0x18444
movq 0x28(%rsp), %rdi
addq $0x70, %rdi
movslq 0x38(%rsp), %rsi
callq 0x1f6e0
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0x30(%rsp)
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x40(%rsp), %rdi
addq $0x50, %rdi
callq 0x1eee0
movq %rax, %rcx
movl 0xc(%rsp), %eax
cmpl %ecx, %eax
jge 0x183fe
movq 0x40(%rsp), %rdi
addq $0x50, %rdi
movslq 0x34(%rsp), %rsi
callq 0x1fc20
movl (%rax), %eax
cmpl 0x30(%rsp), %eax
jne 0x183ef
jmp 0x183fe
jmp 0x183f1
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x183b1
movl 0x34(%rsp), %eax
movl %eax, 0x8(%rsp)
movq 0x40(%rsp), %rdi
addq $0x50, %rdi
callq 0x1eee0
movq %rax, %rcx
movl 0x8(%rsp), %eax
cmpl %ecx, %eax
jne 0x18432
movq 0x40(%rsp), %rdi
addq $0x50, %rdi
leaq 0x30(%rsp), %rsi
callq 0x1fbb0
jmp 0x18434
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x18360
jmp 0x18446
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x18283
addq $0x48, %rsp
retq
nopl (%rax,%rax)