// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movsd 0x18(%rsi), %xmm0
movsd 0x20(%rsi), %xmm1
movsd 0x28(%rsi), %xmm2
movsd 0x18(%rdx), %xmm3
movsd 0x20(%rdx), %xmm4
movsd 0x28(%rdx), %xmm5
callq 0x5369a
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54cfb
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54d0a
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x139c2
movsd 0x18(%r13), %xmm0
movsd 0x20(%r13), %xmm1
movsd 0x28(%r13), %xmm2
movsd 0x18(%r15), %xmm3
movsd 0x20(%r15), %xmm4
movsd 0x28(%r15), %xmm5
movq %r14, %rdi
callq 0x5369a
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54d57
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54d66
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x139c2
movsd 0x18(%r13), %xmm0
movsd 0x20(%r13), %xmm1
movsd 0x28(%r13), %xmm2
movsd 0x18(%rbx), %xmm3
movsd 0x20(%rbx), %xmm4
movsd 0x28(%rbx), %xmm5
movq %r14, %rdi
callq 0x5369a
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54db0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54dbf
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x139c2
movsd 0x18(%r12), %xmm0
movsd 0x20(%r12), %xmm1
movsd 0x28(%r12), %xmm2
movsd 0x18(%r15), %xmm3
movsd 0x20(%r15), %xmm4
movsd 0x28(%r15), %xmm5
movq %r14, %rdi
callq 0x5369a
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54e0f
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54e1e
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x139c2
movsd 0x18(%r12), %xmm0
movsd 0x20(%r12), %xmm1
movsd 0x28(%r12), %xmm2
movsd 0x18(%rbx), %xmm3
movsd 0x20(%rbx), %xmm4
movsd 0x28(%rbx), %xmm5
movq %r14, %rdi
callq 0x5369a
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54e6b
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54e7a
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x139c2
movsd 0x18(%r15), %xmm0
movsd 0x20(%r15), %xmm1
movsd 0x28(%r15), %xmm2
movsd 0x18(%rbx), %xmm3
movsd 0x20(%rbx), %xmm4
movsd 0x28(%rbx), %xmm5
movq %r14, %rdi
callq 0x5369a
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54ec4
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54ed3
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x139c2
xorpd %xmm1, %xmm1
movq 0x10(%rsp), %rax
xorl %ecx, %ecx
addsd (%rax,%rcx,8), %xmm1
incq %rcx
cmpq $0x6, %rcx
jne 0x54ede
divsd 0xff2f4(%rip), %xmm1    # 0x1541e8
movq 0x10(%rsp), %rax
movsd 0xff7bf(%rip), %xmm3    # 0x1546c0
mulsd %xmm1, %xmm3
mulsd %xmm1, %xmm3
xorpd %xmm0, %xmm0
movl $0x1, %ecx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm1
incq %rdx
movq %rcx, %rsi
movapd %xmm1, %xmm2
subsd (%rax,%rsi,8), %xmm2
mulsd %xmm2, %xmm2
divsd %xmm3, %xmm2
addsd %xmm2, %xmm0
incq %rsi
cmpq $0x6, %rsi
jne 0x54f1f
incq %rcx
cmpq $0x5, %rdx
jne 0x54f14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x54f69
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
movsd %xmm0, 0x28(%rsp)
callq 0x4470
movsd 0x28(%rsp), %xmm0
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x54f81
jmp 0x54f81
jmp 0x54f81
jmp 0x54f81
jmp 0x54f81
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x54f9b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780
nop