// File: Luthaf[P]zeopp/networkstorage.cc
// Function: ATOM_NETWORK::CalculateTetrahedrality4Atoms(ATOM const&, ATOM const&, ATOM const&, ATOM const&) const
double ATOM_NETWORK::CalculateTetrahedrality4Atoms(const ATOM& atm1, const ATOM& atm2, const ATOM& atm3, const ATOM& atm4) const {
    
    vector <double> edges; // tetrahedra edges' lengths
    double d_mean=0.0; // mean value
    double Tindex=0.0;
    
    edges.push_back(calcDistance(atm1,atm2));
    edges.push_back(calcDistance(atm1,atm3));
    edges.push_back(calcDistance(atm1,atm4));
    edges.push_back(calcDistance(atm2,atm3));
    edges.push_back(calcDistance(atm2,atm4));
    edges.push_back(calcDistance(atm3,atm4));
    
    for(int i=0;i<6;i++) d_mean+=edges[i];
    
    d_mean=d_mean/6.0;
    
    for(int i=0;i<5;i++) {
        for(int j=i+1;j<6;j++) {
            Tindex+=((edges[i]-edges[j])*(edges[i]-edges[j]))/(15.0*d_mean*d_mean);
        }
    }
    
    return Tindex;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xf650
movq -0xb0(%rbp), %rdi
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x979b0
movsd %xmm0, -0xa8(%rbp)
jmp 0x992a1
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xf6d0
jmp 0x992bd
movq -0xb0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x979b0
movsd %xmm0, -0xb8(%rbp)
jmp 0x992db
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xf6d0
jmp 0x992f7
movq -0xb0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x979b0
movsd %xmm0, -0xc0(%rbp)
jmp 0x99315
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xf6d0
jmp 0x99331
movq -0xb0(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x979b0
movsd %xmm0, -0xc8(%rbp)
jmp 0x9934f
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xf6d0
jmp 0x9936b
movq -0xb0(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x979b0
movsd %xmm0, -0xd0(%rbp)
jmp 0x99389
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xf6d0
jmp 0x993ab
movq -0xb0(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x979b0
movsd %xmm0, -0xd8(%rbp)
jmp 0x993c9
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xf6d0
jmp 0x993eb
movl $0x0, -0x94(%rbp)
cmpl $0x6, -0x94(%rbp)
jge 0x99447
movslq -0x94(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xedb0
movsd (%rax), %xmm0
addsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x993f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xf9d0
jmp 0x99585
movsd -0x48(%rbp), %xmm0
movsd 0x15df6c(%rip), %xmm1   # 0x1f73c0
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movl $0x0, -0x98(%rbp)
cmpl $0x5, -0x98(%rbp)
jge 0x9955e
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
cmpl $0x6, -0x9c(%rbp)
jge 0x99548
movslq -0x98(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xedb0
movsd (%rax), %xmm0
movsd %xmm0, -0xf0(%rbp)
movslq -0x9c(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xedb0
movsd -0xf0(%rbp), %xmm0
subsd (%rax), %xmm0
movsd %xmm0, -0xe0(%rbp)
movslq -0x98(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xedb0
movsd (%rax), %xmm0
movsd %xmm0, -0xe8(%rbp)
movslq -0x9c(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xedb0
movsd -0xe8(%rbp), %xmm1
movsd -0xe0(%rbp), %xmm0
subsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd 0x15e35c(%rip), %xmm1   # 0x1f7878
mulsd -0x48(%rbp), %xmm1
mulsd -0x48(%rbp), %xmm1
divsd %xmm1, %xmm0
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x99483
jmp 0x9954a
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x99467
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0xf8(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xf9d0
movsd -0xf8(%rbp), %xmm0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x58f0
nop