// File: SpiritLooper[P]RDV_OBJRender/./triangle.hpp
// Function: barycentric(Vec3<float>, Vec3<float>, Vec3<float>, Vec3<float>)
Vec3f barycentric(Vec3f A, Vec3f B, Vec3f C, Vec3f P) {
    Vec3f s[2];
    for (int i=2; i--; ) {
        s[i][0] = C[i]-A[i];
        s[i][1] = B[i]-A[i];
        s[i][2] = A[i]-P[i];
    }
    Vec3f u = s[0] ^ s[1];
    if (std::abs(u[2])>1e-2) 
        return Vec3f(1.f-(u.x+u.y)/u.z, u.y/u.z, u.x/u.z);
    return Vec3f(-1,1,1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movlpd %xmm0, -0x28(%rbp)
movss %xmm1, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x10(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movlpd %xmm2, -0x48(%rbp)
movss %xmm3, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
movlpd %xmm4, -0x68(%rbp)
movss %xmm5, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x58(%rbp)
movlpd %xmm6, -0x84(%rbp)
movss %xmm7, -0x7c(%rbp)
movq -0x84(%rbp), %rax
movq %rax, -0x74(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x6c(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, %rcx
addq $0x18, %rcx
movq %rcx, -0xe0(%rbp)
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x5b90
movq -0xe8(%rbp), %rax
movq -0xe0(%rbp), %rcx
addq $0xc, %rax
cmpq %rcx, %rax
movq %rax, -0xd8(%rbp)
jne 0xd2cd
movl $0x2, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xa4(%rbp)
cmpl $0x0, %eax
je 0xd467
movslq -0xa4(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x5c40
movss (%rax), %xmm0
movss %xmm0, -0x100(%rbp)
movslq -0xa4(%rbp), %rsi
leaq -0x18(%rbp), %rdi
callq 0x5c40
movss -0x100(%rbp), %xmm0
subss (%rax), %xmm0
movss %xmm0, -0xfc(%rbp)
movslq -0xa4(%rbp), %rax
leaq -0xa0(%rbp), %rdi
imulq $0xc, %rax, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5c40
movss -0xfc(%rbp), %xmm0
movss %xmm0, (%rax)
movslq -0xa4(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x5c40
movss (%rax), %xmm0
movss %xmm0, -0xf8(%rbp)
movslq -0xa4(%rbp), %rsi
leaq -0x18(%rbp), %rdi
callq 0x5c40
movss -0xf8(%rbp), %xmm0
subss (%rax), %xmm0
movss %xmm0, -0xf4(%rbp)
movslq -0xa4(%rbp), %rax
leaq -0xa0(%rbp), %rdi
imulq $0xc, %rax, %rax
addq %rax, %rdi
movl $0x1, %esi
callq 0x5c40
movss -0xf4(%rbp), %xmm0
movss %xmm0, (%rax)
movslq -0xa4(%rbp), %rsi
leaq -0x18(%rbp), %rdi
callq 0x5c40
movss (%rax), %xmm0
movss %xmm0, -0xf0(%rbp)
movslq -0xa4(%rbp), %rsi
leaq -0x74(%rbp), %rdi
callq 0x5c40
movss -0xf0(%rbp), %xmm0
subss (%rax), %xmm0
movss %xmm0, -0xec(%rbp)
movslq -0xa4(%rbp), %rax
leaq -0xa0(%rbp), %rdi
imulq $0xc, %rax, %rax
addq %rax, %rdi
movl $0x2, %esi
callq 0x5c40
movss -0xec(%rbp), %xmm0
movss %xmm0, (%rax)
jmp 0xd308
leaq -0x94(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x5db0
movss %xmm1, -0xb8(%rbp)
movlpd %xmm0, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0xa8(%rbp)
leaq -0xb0(%rbp), %rdi
movl $0x2, %esi
callq 0x5c40
movss (%rax), %xmm0
callq 0xe810
cvtss2sd %xmm0, %xmm0
movsd 0x1d06(%rip), %xmm1     # 0xf1d0
ucomisd %xmm1, %xmm0
jbe 0xd51f
movss -0xb0(%rbp), %xmm1
addss -0xac(%rbp), %xmm1
divss -0xa8(%rbp), %xmm1
movss 0x1b14(%rip), %xmm0     # 0xf004
subss %xmm1, %xmm0
movss -0xac(%rbp), %xmm1
divss -0xa8(%rbp), %xmm1
movss -0xb0(%rbp), %xmm2
divss -0xa8(%rbp), %xmm2
leaq -0xc(%rbp), %rdi
callq 0x5c00
jmp 0xd53b
leaq -0xc(%rbp), %rdi
movss 0x1bc1(%rip), %xmm0     # 0xf0ec
movss 0x1ad1(%rip), %xmm2     # 0xf004
movaps %xmm2, %xmm1
callq 0x5c00
movl -0x4(%rbp), %eax
movl %eax, -0xc8(%rbp)
movq -0xc(%rbp), %rax
movq %rax, -0xd0(%rbp)
movsd -0xd0(%rbp), %xmm0
movss -0xc8(%rbp), %xmm1
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax,%rax)