// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/merge.cpp
// Function: MergePlaneFaces(surface_s*)
void            MergePlaneFaces(surface_t* plane)
{
    face_t*         f1;
    face_t*         next;
    face_t*         merged;

    merged = NULL;

    for (f1 = plane->faces; f1; f1 = next)
    {
        next = f1->next;
        merged = MergeFaceToList(f1, merged);
    }

    // chain all of the non-empty faces to the plane
    plane->faces = FreeMergeListScraps(merged);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r15
movq 0x48(%rdi), %r14
xorl %ebp, %ebp
testq %r14, %r14
je 0x12c3a
movq %r15, 0x30(%rsp)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movapd 0xdcb0(%rip), %xmm12    # 0x202c0
movsd 0xde67(%rip), %xmm13    # 0x20480
movapd 0xdc8e(%rip), %xmm14    # 0x202b0
movsd 0xaaed(%rip), %xmm15    # 0x1d118
movq (%r14), %rbx
testq %rbp, %rbp
je 0x12c00
leaq 0x38(%r14), %r11
movq %rbp, %r12
movl 0x2c(%r14), %esi
cmpq %r13, %rsi
je 0x12bb4
movl 0x2c(%r12), %edi
cmpl $-0x1, %edi
je 0x12bb4
movl 0xc(%r14), %eax
cmpl 0xc(%r12), %eax
jne 0x12bb4
movl 0x10(%r14), %eax
cmpl 0x10(%r12), %eax
jne 0x12bb4
movslq 0x8(%r14), %r9
cmpl 0x8(%r12), %r9d
jne 0x12bb4
movl 0x30(%r14), %eax
cmpl 0x30(%r12), %eax
jne 0x12bb4
movl 0x14(%r14), %eax
cmpl 0x14(%r12), %eax
jne 0x12bb4
testl %esi, %esi
jle 0x127ab
leaq 0x38(%r12), %rax
movq %rax, 0x10(%rsp)
testl %edi, %edi
movl $0x0, %eax
cmovgl %edi, %eax
movq %rax, 0x20(%rsp)
movq %r11, %r10
xorl %eax, %eax
movq %rbx, 0x28(%rsp)
movq %r11, (%rsp)
movq %rax, 0x8(%rsp)
leaq 0x1(%rax), %rbx
cmpq %rsi, %rbx
movl $0x0, %eax
cmovneq %rbx, %rax
testl %edi, %edi
jle 0x12775
movq 0x8(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rsp), %rdx
leaq (%rdx,%rcx,8), %rcx
movq %rcx, 0x18(%rsp)
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,8), %r8
movq 0x10(%rsp), %r11
xorl %ecx, %ecx
movq %rcx, %r15
incq %rcx
movl %ecx, %eax
cltd
idivl %edi
leaq (%rdx,%rdx,2), %rax
movq 0x10(%rsp), %rdx
leaq (%rdx,%rax,8), %rax
xorl %edx, %edx
movsd (%r10,%rdx), %xmm0
subsd (%rax,%rdx), %xmm0
andpd %xmm12, %xmm0
ucomisd %xmm13, %xmm0
ja 0x1276a
movsd (%r8,%rdx), %xmm0
subsd (%r11,%rdx), %xmm0
andpd %xmm12, %xmm0
ucomisd %xmm13, %xmm0
ja 0x1276a
addq $0x8, %rdx
cmpq $0x18, %rdx
jne 0x1272f
jmp 0x12793
addq $0x18, %r11
cmpq 0x20(%rsp), %rcx
jne 0x12715
addq $0x18, %r10
movq %rbx, %rax
cmpq %rsi, %rbx
movq 0x28(%rsp), %rbx
movq (%rsp), %r11
jne 0x126d3
jmp 0x12bb4
movq 0x28(%rsp), %rbx
movq (%rsp), %r11
movq %r15, %rcx
movq 0x8(%rsp), %r10
movq 0x18(%rsp), %r15
jmp 0x127b6
xorl %r10d, %r10d
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r15d, %r15d
cmpl %esi, %r10d
je 0x12bb4
shlq $0x6, %r9
leaq 0x20c1246(%rip), %rax   # 0x20d3a10
movsd (%rax,%r9), %xmm2
movsd 0x8(%rax,%r9), %xmm0
movsd 0x10(%rax,%r9), %xmm1
leal (%rsi,%r10), %eax
decl %eax
cltd
idivl %esi
movslq %edx, %rax
leaq (%rax,%rax,2), %rax
movsd (%r15), %xmm5
movsd 0x8(%r15), %xmm4
movapd %xmm5, %xmm7
subsd (%r11,%rax,8), %xmm7
movapd %xmm4, %xmm9
subsd 0x8(%r11,%rax,8), %xmm9
movsd 0x10(%r15), %xmm3
movapd %xmm3, %xmm11
subsd 0x10(%r11,%rax,8), %xmm11
movapd %xmm2, %xmm6
mulsd %xmm9, %xmm6
mulsd %xmm1, %xmm9
movapd %xmm0, %xmm8
mulsd %xmm11, %xmm8
subsd %xmm9, %xmm8
mulsd %xmm2, %xmm11
movapd %xmm1, %xmm10
mulsd %xmm7, %xmm10
subsd %xmm11, %xmm10
mulsd %xmm0, %xmm7
subsd %xmm7, %xmm6
movapd %xmm10, %xmm7
mulsd %xmm10, %xmm7
movapd %xmm8, %xmm9
mulsd %xmm8, %xmm9
addsd %xmm7, %xmm9
movapd %xmm6, %xmm7
mulsd %xmm6, %xmm7
addsd %xmm9, %xmm7
sqrtsd %xmm7, %xmm7
ucomisd %xmm7, %xmm15
xorpd %xmm9, %xmm9
xorpd %xmm11, %xmm11
ja 0x128a9
divsd %xmm7, %xmm8
divsd %xmm7, %xmm10
movapd %xmm10, %xmm9
movapd %xmm8, %xmm11
divsd %xmm7, %xmm6
cmpltsd %xmm15, %xmm7
andnpd %xmm6, %xmm7
leal 0x2(%rcx), %eax
cltd
idivl %edi
leaq (%rdx,%rdx,2), %rax
movsd 0x38(%r12,%rax,8), %xmm6
movsd 0x40(%r12,%rax,8), %xmm8
subsd %xmm5, %xmm6
mulsd %xmm11, %xmm6
subsd %xmm4, %xmm8
mulsd %xmm9, %xmm8
addsd %xmm6, %xmm8
movsd 0x48(%r12,%rax,8), %xmm4
subsd %xmm3, %xmm4
mulsd %xmm7, %xmm4
addsd %xmm8, %xmm4
movsd %xmm4, 0x10(%rsp)
ucomisd %xmm13, %xmm4
ja 0x12bb4
movapd %xmm1, %xmm8
xorpd %xmm14, %xmm8
movapd %xmm2, %xmm9
xorpd %xmm14, %xmm9
movapd %xmm0, %xmm7
xorpd %xmm14, %xmm7
leal 0x2(%r10), %eax
cltd
idivl %esi
leaq (%rdx,%rdx,2), %rax
movsd (%r11,%rax,8), %xmm10
movsd 0x8(%r11,%rax,8), %xmm6
movsd (%r8), %xmm5
movsd 0x8(%r8), %xmm4
subsd %xmm5, %xmm10
subsd %xmm4, %xmm6
movsd 0x10(%r11,%rax,8), %xmm11
movsd 0x10(%r8), %xmm3
subsd %xmm3, %xmm11
mulsd %xmm6, %xmm8
mulsd %xmm11, %xmm0
addsd %xmm8, %xmm0
mulsd %xmm9, %xmm11
mulsd %xmm10, %xmm1
addsd %xmm11, %xmm1
mulsd %xmm7, %xmm10
mulsd %xmm2, %xmm6
addsd %xmm10, %xmm6
movapd %xmm1, %xmm2
mulsd %xmm1, %xmm2
movapd %xmm0, %xmm7
mulsd %xmm0, %xmm7
addsd %xmm2, %xmm7
movapd %xmm6, %xmm2
mulsd %xmm6, %xmm2
addsd %xmm7, %xmm2
sqrtsd %xmm2, %xmm2
ucomisd %xmm2, %xmm15
xorpd %xmm7, %xmm7
xorpd %xmm8, %xmm8
ja 0x129d8
divsd %xmm2, %xmm0
divsd %xmm2, %xmm1
movapd %xmm1, %xmm7
movapd %xmm0, %xmm8
leaq 0x38(%r12), %r8
divsd %xmm2, %xmm6
cmpltsd %xmm15, %xmm2
andnpd %xmm6, %xmm2
leal (%rdi,%rcx), %eax
decl %eax
cltd
idivl %edi
movslq %edx, %rax
leaq (%rax,%rax,2), %rax
movsd (%r8,%rax,8), %xmm0
movsd 0x8(%r8,%rax,8), %xmm1
subsd %xmm5, %xmm0
mulsd %xmm8, %xmm0
subsd %xmm4, %xmm1
mulsd %xmm7, %xmm1
addsd %xmm0, %xmm1
movq %r8, 0x20(%rsp)
movsd 0x10(%r8,%rax,8), %xmm0
subsd %xmm3, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
ucomisd %xmm13, %xmm0
ja 0x12bb4
addl %esi, %edi
cmpl $0x30, %edi
jg 0x12bb4
movq %r14, %rdi
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rcx, %r15
movsd %xmm0, 0x18(%rsp)
callq 0x146f5
movsd 0x18(%rsp), %xmm3
movq %r15, %r9
movq (%rsp), %r11
movsd 0xda27(%rip), %xmm1     # 0x204a0
movq %rax, %r15
movq 0x8(%rsp), %rdi
leal 0x1(%rdi), %ecx
movl 0x2c(%r14), %r8d
movl %ecx, %eax
cltd
idivl %r8d
cmpl %edi, %edx
movsd 0x10(%rsp), %xmm2
je 0x12b06
movl %edx, %esi
movq %rdi, %r10
leaq 0x38(%r15), %rdi
movl %ecx, %eax
cltd
idivl %r8d
ucomisd %xmm3, %xmm1
ja 0x12ab1
cmpl %edx, %esi
je 0x12af7
movslq %esi, %rax
leaq (%rax,%rax,2), %rax
movsd (%r11,%rax,8), %xmm0
movslq 0x2c(%r15), %rdx
leaq (%rdx,%rdx,2), %rdx
movsd %xmm0, (%rdi,%rdx,8)
movsd 0x8(%r11,%rax,8), %xmm0
movsd %xmm0, 0x8(%rdi,%rdx,8)
movsd 0x10(%r11,%rax,8), %xmm0
movslq 0x2c(%r15), %rax
leaq (%rax,%rax,2), %rdx
movsd %xmm0, 0x10(%rdi,%rdx,8)
incl %eax
movl %eax, 0x2c(%r15)
movl 0x2c(%r14), %r8d
incl %esi
movl %esi, %eax
cltd
idivl %r8d
movl %edx, %esi
cmpl %r10d, %edx
jne 0x12aa1
leal 0x1(%r9), %ecx
movl 0x2c(%r12), %r8d
movl %ecx, %eax
cltd
idivl %r8d
cmpl %r9d, %edx
movapd 0xd79f(%rip), %xmm12    # 0x202c0
movsd 0xd956(%rip), %xmm13    # 0x20480
movapd 0xd77d(%rip), %xmm14    # 0x202b0
movsd 0xa5dc(%rip), %xmm15    # 0x1d118
movq 0x20(%rsp), %r10
je 0x12baf
movl %edx, %esi
leaq 0x38(%r15), %rdi
movl %ecx, %eax
cltd
idivl %r8d
ucomisd %xmm2, %xmm1
ja 0x12b59
cmpl %edx, %esi
je 0x12ba0
movslq %esi, %rax
leaq (%rax,%rax,2), %rax
movsd (%r10,%rax,8), %xmm0
movslq 0x2c(%r15), %rdx
leaq (%rdx,%rdx,2), %rdx
movsd %xmm0, (%rdi,%rdx,8)
movsd 0x8(%r10,%rax,8), %xmm0
movsd %xmm0, 0x8(%rdi,%rdx,8)
movsd 0x10(%r10,%rax,8), %xmm0
movslq 0x2c(%r15), %rax
leaq (%rax,%rax,2), %rdx
movsd %xmm0, 0x10(%rdi,%rdx,8)
incl %eax
movl %eax, 0x2c(%r15)
movl 0x2c(%r12), %r8d
incl %esi
movl %esi, %eax
cltd
idivl %r8d
movl %edx, %esi
cmpl %r9d, %edx
jne 0x12b49
testq %r15, %r15
jne 0x12bc3
movq (%r12), %r12
testq %r12, %r12
jne 0x1263e
jmp 0x12c00
movq %r14, %rdi
callq 0x14e49
movsd 0xa544(%rip), %xmm15    # 0x1d118
movapd 0xd6d3(%rip), %xmm14    # 0x202b0
movsd 0xd89a(%rip), %xmm13    # 0x20480
movapd 0xd6d1(%rip), %xmm12    # 0x202c0
movl $0xffffffff, 0x2c(%r12) # imm = 0xFFFFFFFF
movq %r15, %r14
jmp 0x12637
movq %r14, %rdi
movq %rbp, (%r14)
movq %r14, %rbp
movq %rbx, %r14
testq %rbx, %rbx
jne 0x1262b
xorl %ebp, %ebp
movq 0x30(%rsp), %r15
movq (%rdi), %rbx
cmpl $-0x1, 0x2c(%rdi)
je 0x12c2d
movq %rbp, (%rdi)
movq %rdi, %rbp
jmp 0x12c32
callq 0x14e49
movq %rbx, %rdi
testq %rbx, %rbx
jne 0x12c1c
movq %rbp, 0x48(%r15)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq