// File: /workspace/github_cpp_makefile_star2_O1/FreeSlave[P]vhlt/hlbsp/outside.cpp
// Function: MarkLeakTrail(portal_s*)
static void     MarkLeakTrail(portal_t* n2)
{
    int             i;
    vec3_t          p1, p2, dir;
    float           len;
    portal_t*       n1;

    n1 = prevleaknode;
    prevleaknode = n2;

    if (!n1)
    {
        return;
    }

#ifdef HLBSP_MarkLeakTrail_FIX
    n1->winding->getCenter(p1);
    n2->winding->getCenter(p2);
#else
    n2->winding->getCenter(p1);
    n1->winding->getCenter(p2);
#endif

    // Linefile
    fprintf(linefile, "%f %f %f - %f %f %f\n", p1[0], p1[1], p1[2], p2[0], p2[1], p2[2]);

    // Pointfile
    fprintf(pointfile, "%f %f %f\n", p1[0], p1[1], p1[2]);

    VectorSubtract(p2, p1, dir);
    len = VectorLength(dir);
    VectorNormalize(dir);

    while (len > 2)
    {
        fprintf(pointfile, "%f %f %f\n", p1[0], p1[1], p1[2]);
        for (i = 0; i < 3; i++)
            p1[i] += dir[i] * 2;
        len -= 2;
    }
}

// Assembly:
movq 0x20bbeae(%rip), %rax   # 0x20cf8f0
movq %rdi, 0x20bbea7(%rip)   # 0x20cf8f0
testq %rax, %rax
je 0x13c45
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rdi, %r14
movq 0x68(%rax), %rdi
leaq 0x40(%rsp), %rbx
movq %rbx, %rsi
callq 0xbc26
movq 0x68(%r14), %rdi
leaq 0x70(%rsp), %r14
movq %r14, %rsi
callq 0xbc26
movq 0x20bbe78(%rip), %rdi   # 0x20cf900
movsd (%rbx), %xmm0
movsd 0x8(%rbx), %xmm1
movsd 0x10(%rbx), %xmm2
movsd (%r14), %xmm3
movsd 0x8(%r14), %xmm4
movsd 0x10(%r14), %xmm5
leaq 0xe7ef(%rip), %rsi      # 0x2229d
movb $0x6, %al
callq 0x4440
movq 0x20bbe3c(%rip), %rdi   # 0x20cf8f8
movsd (%rbx), %xmm0
movsd 0x8(%rbx), %xmm1
movsd 0x10(%rbx), %xmm2
leaq 0xe7d7(%rip), %rsi      # 0x222a8
movb $0x3, %al
callq 0x4440
movapd (%r14), %xmm1
subpd (%rbx), %xmm1
movsd 0x10(%r14), %xmm2
subsd 0x10(%rbx), %xmm2
movapd %xmm1, 0x10(%rsp)
movsd %xmm2, 0x20(%rsp)
movapd %xmm1, %xmm0
mulpd %xmm1, %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movapd %xmm1, 0x30(%rsp)
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
movsd %xmm2, 0x58(%rsp)
movapd %xmm2, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
xorps %xmm3, %xmm3
sqrtsd %xmm0, %xmm3
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
movapd %xmm3, %xmm1
jae 0x13b64
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
movapd %xmm3, 0x60(%rsp)
callq 0x4240
xorpd %xmm2, %xmm2
movapd 0x60(%rsp), %xmm3
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
ucomisd %xmm2, %xmm0
jae 0x13b7f
movsd %xmm1, 0x8(%rsp)
callq 0x4240
movsd 0x8(%rsp), %xmm1
movapd %xmm0, %xmm3
cvtsd2ss %xmm1, %xmm1
movsd 0xa585(%rip), %xmm0     # 0x1e110
ucomisd %xmm3, %xmm0
jbe 0x13ba6
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
jmp 0x13bca
movsd 0x58(%rsp), %xmm2
divsd %xmm3, %xmm2
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
movapd 0x30(%rsp), %xmm0
divpd %xmm3, %xmm0
movapd %xmm0, 0x10(%rsp)
movsd %xmm2, 0x20(%rsp)
ucomiss 0xe29f(%rip), %xmm1     # 0x21e70
jbe 0x13c3b
leaq 0xe6ce(%rip), %rbx      # 0x222a8
movss %xmm1, 0x30(%rsp)
movq 0x20bbd11(%rip), %rdi   # 0x20cf8f8
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movsd 0x50(%rsp), %xmm2
movq %rbx, %rsi
movb $0x3, %al
callq 0x4440
xorl %eax, %eax
movsd 0x10(%rsp,%rax,8), %xmm0
addsd %xmm0, %xmm0
addsd 0x40(%rsp,%rax,8), %xmm0
movsd %xmm0, 0x40(%rsp,%rax,8)
incq %rax
cmpq $0x3, %rax
jne 0x13c05
movss 0x30(%rsp), %xmm1
addss 0xe242(%rip), %xmm1     # 0x21e74
ucomiss 0xe237(%rip), %xmm1     # 0x21e70
ja 0x13bda
addq $0x88, %rsp
popq %rbx
popq %r14
retq