// File: /workspace/github_cpp_makefile_star2_O1/FreeSlave[P]vhlt/hlbsp/merge.cpp
// Function: MergeFaceToList(face_s*, face_s*)
static face_t*  MergeFaceToList(face_t* face, face_t* list)
{
    face_t*         newf;
    face_t*         f;

    for (f = list; f; f = f->next)
    {
        //CheckColinear (f);            
        newf = TryMerge(face, f);
        if (!newf)
        {
            continue;
        }
        FreeFace(face);
        f->numpoints = -1;                                 // merged out
        return MergeFaceToList(newf, list);
    }

    // didn't merge, so add at start
    face->next = list;
    return face;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r13
movq %rdi, %r14
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movapd 0xea66(%rip), %xmm5     # 0x212e0
testq %r13, %r13
je 0x12ef8
leaq 0x38(%r14), %rax
movq %rax, 0x18(%rsp)
leaq 0x20(%r14), %rcx
movq %r13, %rbx
movl 0x2c(%r14), %esi
cmpq %r12, %rsi
je 0x12a01
movslq 0x2c(%rbx), %r8
cmpq $-0x1, %r8
movsd 0xebe0(%rip), %xmm6     # 0x21490
je 0x12a01
movl 0xc(%r14), %eax
cmpl 0xc(%rbx), %eax
jne 0x12a01
movl 0x10(%r14), %eax
cmpl 0x10(%rbx), %eax
jne 0x12a01
movslq 0x8(%r14), %rdx
cmpl 0x8(%rbx), %edx
jne 0x12a01
movl 0x30(%r14), %eax
cmpl 0x30(%rbx), %eax
jne 0x12a01
movl 0x14(%r14), %eax
cmpl 0x14(%rbx), %eax
jne 0x12a01
testl %esi, %esi
movq %rcx, (%rsp)
jle 0x12a1e
movq %rdx, 0x20(%rsp)
movq %r13, 0x8(%rsp)
leaq 0x38(%rbx), %r13
testl %r8d, %r8d
movl $0x0, %r11d
cmovgl %r8d, %r11d
leaq (%rsi,%rsi,2), %rax
leaq (%rcx,%rax,8), %rax
movq %rax, 0x30(%rsp)
movq 0x18(%rsp), %r10
xorl %r12d, %r12d
leaq (%r12,%r12,2), %rax
movq 0x18(%rsp), %rdx
leaq (%rdx,%rax,8), %rax
movq %rax, 0x10(%rsp)
movq %r12, %rdi
incq %r12
cmpq %rsi, %r12
movq %r12, %rax
movl $0x0, %ecx
cmoveq %rcx, %rax
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,8), %r15
movq %r13, %r9
xorl %ecx, %ecx
cmpq %r11, %rcx
je 0x129dc
movq %rcx, %rbp
incq %rcx
movl %ecx, %eax
cltd
idivl %r8d
leaq (%rdx,%rdx,2), %rax
leaq (,%rax,8), %rdx
addq %r13, %rdx
movq $-0x3, %rax
movsd 0x18(%r10,%rax,8), %xmm0
subsd 0x18(%rdx,%rax,8), %xmm0
andpd %xmm5, %xmm0
ucomisd %xmm6, %xmm0
ja 0x129c9
movsd 0x18(%r15,%rax,8), %xmm0
subsd 0x18(%r9,%rax,8), %xmm0
andpd %xmm5, %xmm0
ucomisd %xmm6, %xmm0
ja 0x129c9
incq %rax
jne 0x1298e
movl $0x3, %eax
jmp 0x129cc
addl $0x3, %eax
addq $0x18, %r9
cmpl $0x3, %eax
jne 0x12967
cmpq %r8, %rbp
jge 0x129df
jmp 0x12a2a
movl %r11d, %ebp
addq $0x18, %r10
cmpq %rsi, %r12
jne 0x12933
movl %esi, %r8d
movq 0x30(%rsp), %rdi
movq 0x8(%rsp), %r13
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x12a3d
xorl %r15d, %r15d
testq %r15, %r15
jne 0x12ed9
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x12893
jmp 0x12ef8
xorl %r8d, %r8d
xorl %ebp, %ebp
xorl %r15d, %r15d
xorl %edi, %edi
jmp 0x12a42
movq 0x8(%rsp), %r13
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq %rdi, %r8
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rdx
cmpl %esi, %r8d
je 0x12bf7
shlq $0x6, %rdx
leaq 0x20c1fca(%rip), %rax   # 0x20d4a20
movsd (%rax,%rdx), %xmm10
movsd 0x8(%rax,%rdx), %xmm8
movsd 0x10(%rax,%rdx), %xmm9
leal (%rsi,%r8), %eax
decl %eax
cltd
idivl %esi
movslq %edx, %rax
leaq (%rax,%rax,2), %rax
movsd (%rdi), %xmm0
movq 0x18(%rsp), %rcx
subsd (%rcx,%rax,8), %xmm0
movsd 0x8(%rdi), %xmm1
subsd 0x8(%rcx,%rax,8), %xmm1
movsd 0x10(%rdi), %xmm2
subsd 0x10(%rcx,%rax,8), %xmm2
movapd %xmm10, %xmm4
mulsd %xmm1, %xmm4
mulsd %xmm9, %xmm1
movapd %xmm8, %xmm3
mulsd %xmm2, %xmm3
subsd %xmm1, %xmm3
mulsd %xmm10, %xmm2
movapd %xmm9, %xmm7
mulsd %xmm0, %xmm7
subsd %xmm2, %xmm7
mulsd %xmm8, %xmm0
subsd %xmm0, %xmm4
movapd %xmm7, %xmm0
mulsd %xmm7, %xmm0
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movapd %xmm4, %xmm0
mulsd %xmm4, %xmm0
addsd %xmm1, %xmm0
ucomisd 0xe784(%rip), %xmm0     # 0x21280
movq %r8, 0x8(%rsp)
jb 0x12b09
sqrtsd %xmm0, %xmm0
jmp 0x12b7b
movapd %xmm8, 0x20(%rsp)
movq %rdi, 0x10(%rsp)
movapd %xmm9, 0x30(%rsp)
movapd %xmm10, 0x40(%rsp)
movapd %xmm3, 0x70(%rsp)
movapd %xmm4, 0x60(%rsp)
movapd %xmm7, 0x50(%rsp)
callq 0x4240
movapd 0x50(%rsp), %xmm7
movapd 0x60(%rsp), %xmm4
movapd 0x70(%rsp), %xmm3
movapd 0x40(%rsp), %xmm10
movapd 0x30(%rsp), %xmm9
movq 0x10(%rsp), %rdi
movapd 0x20(%rsp), %xmm8
movq 0x8(%rsp), %r8
movsd 0xe91d(%rip), %xmm6     # 0x21490
movapd 0xe765(%rip), %xmm5     # 0x212e0
movsd 0xb58d(%rip), %xmm1     # 0x1e110
ucomisd %xmm0, %xmm1
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
ja 0x12ba1
divsd %xmm0, %xmm7
divsd %xmm0, %xmm4
movapd %xmm7, %xmm2
movapd %xmm4, %xmm1
divsd %xmm0, %xmm3
cmpltsd 0xb562(%rip), %xmm0     # 0x1e110
andnpd %xmm3, %xmm0
leal 0x2(%rbp), %eax
cltd
idivl 0x2c(%rbx)
leaq (%rdx,%rdx,2), %rax
movsd 0x38(%rbx,%rax,8), %xmm4
movsd 0x40(%rbx,%rax,8), %xmm3
subsd (%rdi), %xmm4
subsd 0x8(%rdi), %xmm3
mulsd %xmm2, %xmm3
movsd 0x48(%rbx,%rax,8), %xmm2
subsd 0x10(%rdi), %xmm2
mulsd %xmm1, %xmm2
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
addsd %xmm2, %xmm4
ucomisd %xmm6, %xmm4
jbe 0x12bff
xorl %r15d, %r15d
jmp 0x12da1
movsd %xmm4, 0x10(%rsp)
movapd %xmm9, %xmm0
movapd 0xe6be(%rip), %xmm7     # 0x212d0
xorpd %xmm7, %xmm0
movapd %xmm10, %xmm1
xorpd %xmm7, %xmm1
leal 0x2(%r8), %eax
cltd
idivl 0x2c(%r14)
leaq (%rdx,%rdx,2), %rax
movq 0x18(%rsp), %rcx
movsd (%rcx,%rax,8), %xmm2
movsd 0x8(%rcx,%rax,8), %xmm11
subsd (%r15), %xmm2
subsd 0x8(%r15), %xmm11
movapd %xmm8, %xmm3
movsd 0x10(%rcx,%rax,8), %xmm4
subsd 0x10(%r15), %xmm4
xorpd %xmm7, %xmm3
mulsd %xmm11, %xmm0
mulsd %xmm4, %xmm8
addsd %xmm0, %xmm8
mulsd %xmm1, %xmm4
mulsd %xmm2, %xmm9
addsd %xmm4, %xmm9
mulsd %xmm3, %xmm2
mulsd %xmm10, %xmm11
addsd %xmm2, %xmm11
movapd %xmm9, %xmm0
mulsd %xmm9, %xmm0
movapd %xmm8, %xmm1
mulsd %xmm8, %xmm1
addsd %xmm0, %xmm1
movapd %xmm11, %xmm0
mulsd %xmm11, %xmm0
addsd %xmm1, %xmm0
ucomisd 0xe5ca(%rip), %xmm0     # 0x21280
jb 0x12cbe
sqrtsd %xmm0, %xmm0
jmp 0x12cfd
movapd %xmm8, 0x20(%rsp)
movapd %xmm9, 0x30(%rsp)
movsd %xmm11, 0x40(%rsp)
callq 0x4240
movsd 0x40(%rsp), %xmm11
movapd 0x30(%rsp), %xmm9
movapd 0x20(%rsp), %xmm8
movsd 0xe79b(%rip), %xmm6     # 0x21490
movapd 0xe5e3(%rip), %xmm5     # 0x212e0
movsd 0xb40b(%rip), %xmm1     # 0x1e110
ucomisd %xmm0, %xmm1
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
ja 0x12d27
divsd %xmm0, %xmm9
divsd %xmm0, %xmm11
movapd %xmm9, %xmm2
movapd %xmm11, %xmm1
leaq 0x38(%rbx), %r12
divsd %xmm0, %xmm8
cmpltsd 0xb3d7(%rip), %xmm0     # 0x1e110
andnpd %xmm8, %xmm0
movl 0x2c(%rbx), %ecx
leal (%rcx,%rbp), %eax
decl %eax
cltd
idivl %ecx
movslq %edx, %rax
leaq (%rax,%rax,2), %rax
movsd (%r12,%rax,8), %xmm4
movsd 0x8(%r12,%rax,8), %xmm3
subsd (%r15), %xmm4
subsd 0x8(%r15), %xmm3
mulsd %xmm2, %xmm3
movsd 0x10(%r12,%rax,8), %xmm2
subsd 0x10(%r15), %xmm2
mulsd %xmm1, %xmm2
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
addsd %xmm2, %xmm4
ucomisd %xmm6, %xmm4
ja 0x12d98
addl 0x2c(%r14), %ecx
cmpl $0x30, %ecx
jle 0x12daa
xorl %r15d, %r15d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq (%rsp), %rcx
jmp 0x12a04
movq %r14, %rdi
movsd %xmm4, 0x20(%rsp)
callq 0x1493f
movsd 0x20(%rsp), %xmm3
movq %rax, %r15
movq 0x8(%rsp), %r9
leal 0x1(%r9), %ecx
movl %ecx, %eax
cltd
idivl 0x2c(%r14)
cmpl %r9d, %edx
movsd 0xe6cc(%rip), %xmm1     # 0x214a8
movsd 0x10(%rsp), %xmm2
je 0x12e52
movl %edx, %esi
leaq 0x38(%r15), %rdi
movl %ecx, %eax
cltd
idivl 0x2c(%r14)
ucomisd %xmm3, %xmm1
ja 0x12dfb
cmpl %edx, %esi
je 0x12e42
movslq %esi, %rax
leaq (%rax,%rax,2), %rax
movq 0x18(%rsp), %r8
movsd (%r8,%rax,8), %xmm0
movslq 0x2c(%r15), %rdx
leaq (%rdx,%rdx,2), %rdx
movsd %xmm0, (%rdi,%rdx,8)
movsd 0x8(%r8,%rax,8), %xmm0
movsd %xmm0, 0x8(%rdi,%rdx,8)
movsd 0x10(%r8,%rax,8), %xmm0
movslq 0x2c(%r15), %rax
leaq (%rax,%rax,2), %rdx
movsd %xmm0, 0x10(%rdi,%rdx,8)
incl %eax
movl %eax, 0x2c(%r15)
incl %esi
movl %esi, %eax
cltd
idivl 0x2c(%r14)
movl %edx, %esi
cmpl %r9d, %edx
jne 0x12dea
leal 0x1(%rbp), %ecx
movl %ecx, %eax
cltd
idivl 0x2c(%rbx)
cmpl %ebp, %edx
movapd 0xe47b(%rip), %xmm5     # 0x212e0
je 0x12d9b
movl %edx, %esi
movq %r15, %rdi
addq $0x38, %rdi
movl %ecx, %eax
cltd
idivl 0x2c(%rbx)
ucomisd %xmm2, %xmm1
ja 0x12e84
cmpl %edx, %esi
je 0x12ec6
movslq %esi, %rax
leaq (%rax,%rax,2), %rax
movsd (%r12,%rax,8), %xmm0
movslq 0x2c(%r15), %rdx
leaq (%rdx,%rdx,2), %rdx
movsd %xmm0, (%rdi,%rdx,8)
movsd 0x8(%r12,%rax,8), %xmm0
movsd %xmm0, 0x8(%rdi,%rdx,8)
movsd 0x10(%r12,%rax,8), %xmm0
movslq 0x2c(%r15), %rax
leaq (%rax,%rax,2), %rdx
movsd %xmm0, 0x10(%rdi,%rdx,8)
incl %eax
movl %eax, 0x2c(%r15)
incl %esi
movl %esi, %eax
cltd
idivl 0x2c(%rbx)
movl %edx, %esi
cmpl %ebp, %edx
jne 0x12e74
jmp 0x12d9b
movq %r14, %rdi
callq 0x150c0
movapd 0xe3f7(%rip), %xmm5     # 0x212e0
movl $0xffffffff, 0x2c(%rbx) # imm = 0xFFFFFFFF
movq %r15, %r14
jmp 0x1287a
movq %r13, (%r14)
movq %r14, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq