// File: /workspace/github_cpp_makefile_star2_O2/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, %rbx
leaq 0x38(%rdi), %rax
movq %rax, 0x10(%rsp)
movsd 0xd836(%rip), %xmm1     # 0x1e3e0
movapd 0xd65e(%rip), %xmm2     # 0x1e210
movq %rsi, %r14
testq %r14, %r14
je 0x1108f
movl 0x2c(%rbx), %edi
cmpl $-0x1, %edi
je 0x1107d
movl 0x2c(%r14), %r9d
cmpl $-0x1, %r9d
je 0x1107d
movl 0xc(%rbx), %eax
cmpl 0xc(%r14), %eax
jne 0x1107d
movl 0x10(%rbx), %eax
cmpl 0x10(%r14), %eax
jne 0x1107d
movslq 0x8(%rbx), %r8
cmpl 0x8(%r14), %r8d
jne 0x1107d
movl 0x30(%rbx), %eax
cmpl 0x30(%r14), %eax
jne 0x1107d
movl 0x14(%rbx), %eax
cmpl 0x14(%r14), %eax
jne 0x1107d
leaq 0x38(%r14), %rax
movq %rax, 0x18(%rsp)
xorl %r10d, %r10d
testl %r9d, %r9d
movl $0x0, %r11d
cmovgl %r9d, %r11d
testl %edi, %edi
movl $0x0, %eax
cmovgl %edi, %eax
movq 0x10(%rsp), %rcx
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %r13, 0x50(%rsp)
movq %rax, 0x8(%rsp)
cmpq %rax, %r10
je 0x11085
imulq $0x18, %r10, %rbp
movq 0x10(%rsp), %rsi
addq %rsi, %rbp
leaq 0x1(%r10), %rax
movq %rax, 0x40(%rsp)
cltd
idivl %edi
imulq $0x18, %rdx, %r12
addq %rsi, %r12
movq 0x18(%rsp), %r13
xorl %r15d, %r15d
cmpq %r11, %r15
je 0x10cdc
leaq 0x1(%r15), %rsi
movl %esi, %eax
cltd
idivl %r9d
imulq $0x18, %rdx, %rax
addq 0x18(%rsp), %rax
xorl %edx, %edx
cmpq $0x18, %rdx
je 0x10cf7
movsd (%rcx,%rdx), %xmm0
subsd (%rax,%rdx), %xmm0
andpd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
ja 0x10cd3
movsd (%r12,%rdx), %xmm0
subsd (%r13,%rdx), %xmm0
andpd %xmm2, %xmm0
addq $0x8, %rdx
ucomisd %xmm1, %xmm0
jbe 0x10c9e
addq $0x18, %r13
movq %rsi, %r15
jmp 0x10c84
addq $0x18, %rcx
movq 0x40(%rsp), %r10
movl %r11d, %r15d
movq 0x50(%rsp), %r13
movq 0x8(%rsp), %rax
jmp 0x10c54
movq 0x50(%rsp), %r13
cmpl %edi, %r10d
je 0x1107d
shlq $0x6, %r8
leaq 0x20c1d10(%rip), %rsi   # 0x20d2a20
movsd (%rsi,%r8), %xmm3
leal (%rdi,%r10), %eax
decl %eax
cltd
idivl %edi
movslq %edx, %rax
imulq $0x18, %rax, %rax
movsd 0x8(%rbp), %xmm0
movq 0x10(%rsp), %rcx
subsd 0x8(%rcx,%rax), %xmm0
movupd 0x8(%rsi,%r8), %xmm4
movapd %xmm4, %xmm5
shufpd $0x1, %xmm3, %xmm5      # xmm5 = xmm5[1],xmm3[0]
movsd 0x10(%rbp), %xmm1
movhpd (%rbp), %xmm1           # xmm1 = xmm1[0],mem[0]
movsd 0x10(%rcx,%rax), %xmm2
movhpd (%rcx,%rax), %xmm2      # xmm2 = xmm2[0],mem[0]
subpd %xmm2, %xmm1
movapd %xmm3, 0x40(%rsp)
movapd %xmm3, %xmm2
mulsd %xmm0, %xmm2
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd %xmm5, 0x60(%rsp)
mulpd %xmm5, %xmm0
movapd %xmm4, %xmm3
mulpd %xmm1, %xmm3
subpd %xmm0, %xmm3
movapd %xmm3, 0x20(%rsp)
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
movapd %xmm4, 0x70(%rsp)
mulsd %xmm4, %xmm1
subsd %xmm1, %xmm2
movsd %xmm2, 0x30(%rsp)
leaq 0x20(%rsp), %rdi
movq %r10, 0x8(%rsp)
callq 0xc073
movq 0x8(%rsp), %rsi
movapd 0xd44f(%rip), %xmm2     # 0x1e210
movapd 0xd437(%rip), %xmm4     # 0x1e200
leal 0x2(%r15), %eax
cltd
idivl 0x2c(%r14)
movslq %edx, %rax
imulq $0x18, %rax, %rax
movq 0x18(%rsp), %rcx
movsd (%rcx,%rax), %xmm0
subsd (%rbp), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
subsd 0x8(%rbp), %xmm1
movsd 0x10(%rcx,%rax), %xmm3
subsd 0x10(%rbp), %xmm3
mulsd 0x28(%rsp), %xmm1
mulsd 0x20(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm3
addsd %xmm1, %xmm0
movsd 0xd5c4(%rip), %xmm1     # 0x1e3e0
addsd %xmm0, %xmm3
movsd %xmm3, 0x58(%rsp)
ucomisd %xmm1, %xmm3
ja 0x1107d
leal 0x2(%rsi), %eax
cltd
idivl 0x2c(%rbx)
imulq $0x18, %rdx, %rax
movq 0x10(%rsp), %rcx
movsd 0x8(%rcx,%rax), %xmm0
subsd 0x8(%r12), %xmm0
movapd 0x60(%rsp), %xmm6
xorpd %xmm4, %xmm6
movsd 0x10(%rcx,%rax), %xmm1
movhpd (%rcx,%rax), %xmm1      # xmm1 = xmm1[0],mem[0]
movapd 0x70(%rsp), %xmm5
movapd %xmm5, %xmm2
movsd 0x10(%r12), %xmm3
movhpd (%r12), %xmm3           # xmm3 = xmm3[0],mem[0]
xorpd %xmm4, %xmm2
subpd %xmm3, %xmm1
movapd 0x40(%rsp), %xmm3
mulsd %xmm0, %xmm3
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
mulpd %xmm6, %xmm0
mulpd %xmm1, %xmm5
addpd %xmm0, %xmm5
movapd %xmm5, 0x20(%rsp)
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
mulsd %xmm2, %xmm1
addsd %xmm3, %xmm1
movsd %xmm1, 0x30(%rsp)
leaq 0x20(%rsp), %rdi
callq 0xc073
movapd 0xd34b(%rip), %xmm2     # 0x1e210
movl 0x2c(%r14), %ecx
leal (%r15,%rcx), %eax
decl %eax
cltd
idivl %ecx
movslq %edx, %rax
imulq $0x18, %rax, %rax
movq 0x18(%rsp), %rdx
movsd (%rdx,%rax), %xmm0
subsd (%r12), %xmm0
movsd 0x8(%rdx,%rax), %xmm1
subsd 0x8(%r12), %xmm1
movsd 0x10(%rdx,%rax), %xmm3
subsd 0x10(%r12), %xmm3
mulsd 0x28(%rsp), %xmm1
mulsd 0x20(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm3
addsd %xmm1, %xmm0
movsd 0xd4bf(%rip), %xmm1     # 0x1e3e0
addsd %xmm0, %xmm3
ucomisd %xmm1, %xmm3
ja 0x1107d
addl 0x2c(%rbx), %ecx
cmpl $0x30, %ecx
jg 0x1107d
movq %rbx, %rdi
movsd %xmm3, 0x40(%rsp)
callq 0x128f6
movsd 0x40(%rsp), %xmm1
movq 0x8(%rsp), %r9
movsd 0xd4a4(%rip), %xmm2     # 0x1e400
movq %rax, %r12
leal 0x1(%r9), %ecx
movl 0x2c(%rbx), %r8d
movl %ecx, %eax
cltd
idivl %r8d
movl %edx, %esi
leaq 0x38(%r12), %rdi
cmpl %r9d, %esi
je 0x10fe3
movl %ecx, %eax
cltd
idivl %r8d
ucomisd %xmm1, %xmm2
ja 0x10f89
cmpl %edx, %esi
je 0x10fd7
movslq %esi, %rax
imulq $0x18, %rax, %rax
movq 0x10(%rsp), %r8
movsd (%r8,%rax), %xmm0
movslq 0x2c(%r12), %rdx
imulq $0x18, %rdx, %rdx
movsd %xmm0, (%rdi,%rdx)
movsd 0x8(%r8,%rax), %xmm0
movsd %xmm0, 0x8(%rdi,%rdx)
movsd 0x10(%r8,%rax), %xmm0
movslq 0x2c(%r12), %rax
imulq $0x18, %rax, %rdx
movsd %xmm0, 0x10(%rdi,%rdx)
incl %eax
movl %eax, 0x2c(%r12)
movl 0x2c(%rbx), %r8d
incl %esi
movl %esi, %eax
cltd
idivl %r8d
movl %edx, %esi
jmp 0x10f74
leal 0x1(%r15), %ecx
movl 0x2c(%r14), %r8d
movl %ecx, %eax
cltd
idivl %r8d
movl %edx, %esi
movsd 0xd3e5(%rip), %xmm1     # 0x1e3e0
movsd 0x58(%rsp), %xmm3
cmpl %r15d, %esi
je 0x11070
movl %ecx, %eax
cltd
idivl %r8d
ucomisd %xmm3, %xmm2
ja 0x11016
cmpl %edx, %esi
je 0x11064
movslq %esi, %rax
imulq $0x18, %rax, %rax
movq 0x18(%rsp), %r8
movsd (%r8,%rax), %xmm0
movslq 0x2c(%r12), %rdx
imulq $0x18, %rdx, %rdx
movsd %xmm0, (%rdi,%rdx)
movsd 0x8(%r8,%rax), %xmm0
movsd %xmm0, 0x8(%rdi,%rdx)
movsd 0x10(%r8,%rax), %xmm0
movslq 0x2c(%r12), %rax
imulq $0x18, %rax, %rdx
movsd %xmm0, 0x10(%rdi,%rdx)
incl %eax
movl %eax, 0x2c(%r12)
movl 0x2c(%r14), %r8d
incl %esi
movl %esi, %eax
cltd
idivl %r8d
movl %edx, %esi
jmp 0x11001
testq %r12, %r12
movapd 0xd195(%rip), %xmm2     # 0x1e210
jne 0x110a7
movq (%r14), %r14
jmp 0x10bb5
movq 0x8(%rsp), %r10
jmp 0x10cfc
movq %r13, (%rbx)
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x12fa3
orl $-0x1, 0x2c(%r14)
movq %r12, %rdi
movq %r13, %rsi
callq 0x10b82
movq %rax, %rbx
jmp 0x11092