// File: /workspace/github_cpp_makefile_star2_O3/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 0x5339c
leaq 0x8(%rsp), %rdx
movsd %xmm0, (%rdx)
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x1391c
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 0x5339c
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54a2c
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54a3b
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x1391c
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 0x5339c
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54a85
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54a94
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x1391c
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 0x5339c
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54ae4
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54af3
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x1391c
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 0x5339c
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54b40
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54b4f
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x1391c
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 0x5339c
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54b99
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54ba8
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x1391c
xorpd %xmm1, %xmm1
movq 0x10(%rsp), %rdi
xorl %eax, %eax
addsd (%rdi,%rax,8), %xmm1
incq %rax
cmpq $0x6, %rax
jne 0x54bb3
divsd 0xfd6cf(%rip), %xmm1    # 0x152298
movsd 0xfdb97(%rip), %xmm0    # 0x152768
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
xorpd %xmm3, %xmm3
movl $0x1, %eax
xorl %ecx, %ecx
movsd (%rdi,%rcx,8), %xmm1
incq %rcx
movq %rax, %rdx
movapd %xmm1, %xmm2
subsd (%rdi,%rdx,8), %xmm2
mulsd %xmm2, %xmm2
divsd %xmm0, %xmm2
addsd %xmm2, %xmm3
incq %rdx
cmpq $0x6, %rdx
jne 0x54bef
incq %rax
cmpq $0x5, %rcx
jne 0x54be4
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
movsd %xmm3, 0x28(%rsp)
callq 0x4470
movsd 0x28(%rsp), %xmm0
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x54c47
jmp 0x54c47
jmp 0x54c47
jmp 0x54c47
jmp 0x54c47
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x54c61
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780
nop