// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/networkstorage.cc
// Function: ATOM_NETWORK::find_tetrahedra(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<double> ATOM_NETWORK::find_tetrahedra(string element) {
    vector<double> tetras;
    double d_ij = -1, d_ik = -1, d_il = -1, d_jk = -1, d_jl = -1, d_kl = -1; //stores distances between each pair of atoms in a potential tetrahedral arrangement
    double maxDist = 5, minDist = 0.1; //four atoms are considered to be in a tetrahedral arrangement if they are each within this distance range of each other - if this is true, we then calculate the index of tetrahedral distortion
    for(int i=0; i<numAtoms; i++) {
        if(atoms.at(i).type.compare(element)==0) {
            for(int j=i+1; j<numAtoms; j++) {
                if(atoms.at(j).type.compare(element)==0) {
                    d_ij = getDistCalc().minimum_periodic_distance(atoms.at(i).a_coord, atoms.at(i).b_coord, atoms.at(i).c_coord, atoms.at(j).a_coord, atoms.at(j).b_coord, atoms.at(j).c_coord);
                    if(d_ij>minDist && d_ij<maxDist) {
                        for(int k=j+1; k<numAtoms; k++) {
                            if(atoms.at(k).type.compare(element)==0) {
                                d_ik = getDistCalc().minimum_periodic_distance(atoms.at(i).a_coord, atoms.at(i).b_coord, atoms.at(i).c_coord, atoms.at(k).a_coord, atoms.at(k).b_coord, atoms.at(k).c_coord);
                                if(d_ik>minDist && d_ik<maxDist) {
                                    d_jk = getDistCalc().minimum_periodic_distance(atoms.at(j).a_coord, atoms.at(j).b_coord, atoms.at(j).c_coord, atoms.at(k).a_coord, atoms.at(k).b_coord, atoms.at(k).c_coord);
                                    if(d_jk>minDist && d_jk<maxDist) {
                                        for(int l=k+1; l<numAtoms; l++) {
                                            if(atoms.at(l).type.compare(element)==0) {
                                                d_il = getDistCalc().minimum_periodic_distance(atoms.at(i).a_coord, atoms.at(i).b_coord, atoms.at(i).c_coord, atoms.at(l).a_coord, atoms.at(l).b_coord, atoms.at(l).c_coord);
                                                if(d_il>minDist && d_il<maxDist) {
                                                    d_jl = getDistCalc().minimum_periodic_distance(atoms.at(j).a_coord, atoms.at(j).b_coord, atoms.at(j).c_coord, atoms.at(l).a_coord, atoms.at(l).b_coord, atoms.at(l).c_coord);
                                                    if(d_jl>minDist && d_jl<maxDist) {
                                                        d_kl = getDistCalc().minimum_periodic_distance(atoms.at(k).a_coord, atoms.at(k).b_coord, atoms.at(k).c_coord, atoms.at(l).a_coord, atoms.at(l).b_coord, atoms.at(l).c_coord);
                                                        if(d_kl>minDist && d_kl<maxDist) {
                                                            //we have found four atoms within the tolerance
                                                            double t = CalculateTetrahedrality4Atoms(atoms.at(i), atoms.at(j), atoms.at(k), atoms.at(l));
                                                            tetras.push_back(t);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    //sort before returning
    sort(tetras.begin(), tetras.end());
    return tetras;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdx, 0x38(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq %rdi, 0x20(%rsp)
movq $0x0, 0x10(%rdi)
cmpl $0x0, 0x110(%rsi)
jle 0x54806
movq %rsi, %r12
movl $0x3, 0x18(%rsp)
movl $0x2, %eax
movq %rax, 0xc0(%rsp)
movl $0x1, %eax
movq %rax, 0xb8(%rsp)
xorl %ebx, %ebx
movq 0x2f0(%r12), %rax
movq 0x2f8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rdx
cmpq %rbx, %rdx
jbe 0x54900
imulq $0x98, %rbx, %rcx
movq %rcx, 0x30(%rsp)
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
movq 0x38(%rsp), %rsi
callq 0x4050
testl %eax, %eax
sete %cl
movl 0x110(%r12), %eax
leaq 0x1(%rbx), %rsi
movslq %eax, %rdx
movq %rsi, 0xc8(%rsp)
cmpq %rdx, %rsi
setl %dl
andb %cl, %dl
movq 0xb8(%rsp), %r14
movq 0xc0(%rsp), %r15
movl 0x18(%rsp), %esi
movl %esi, 0x1c(%rsp)
movq %rbx, 0x8(%rsp)
cmpb $0x1, %dl
jne 0x5479e
movq 0x2f0(%r12), %rax
movq 0x2f8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rdx
cmpq %r14, %rdx
jbe 0x5489f
imulq $0x98, %r14, %rcx
movq %rcx, 0x28(%rsp)
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
movq 0x38(%rsp), %rsi
callq 0x4050
testl %eax, %eax
movq %r14, 0x10(%rsp)
movq %r15, 0xd0(%rsp)
je 0x54022
movl 0x110(%r12), %eax
movq 0x10(%rsp), %rbx
leaq 0x1(%rbx), %r14
incl 0x1c(%rsp)
movq 0xd0(%rsp), %r15
incq %r15
cmpl %r14d, %eax
jg 0x53f97
jmp 0x5479e
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x527f2
movq 0x2f0(%r12), %rax
movq 0x2f8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rdx
cmpq 0x8(%rsp), %rdx
jbe 0x548e8
cmpq %r14, %rdx
jbe 0x548ef
movq 0x30(%rsp), %rcx
movsd 0x28(%rax,%rcx), %xmm2
movsd 0x18(%rax,%rcx), %xmm0
movsd 0x20(%rax,%rcx), %xmm1
movq 0x28(%rsp), %rcx
movsd 0x18(%rax,%rcx), %xmm3
movsd 0x20(%rax,%rcx), %xmm4
movsd 0x28(%rax,%rcx), %xmm5
leaq 0x40(%rsp), %rdi
callq 0x77fb0
movapd %xmm0, %xmm1
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
movsd %xmm0, (%rsp)
je 0x540c8
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x540e4
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x54100
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
ucomisd 0xf8f60(%rip), %xmm1    # 0x14d068
movl 0x110(%r12), %eax
jbe 0x53ffc
movsd 0xfe642(%rip), %xmm0    # 0x152760
ucomisd %xmm1, %xmm0
jbe 0x53ffc
addl $0x2, %ebx
movq %r15, %r14
movl 0x1c(%rsp), %ecx
movl %ecx, %r15d
cmpl %eax, %ebx
jge 0x53ffc
movq 0x2f0(%r12), %rax
movq 0x2f8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rdx
cmpq %r14, %rdx
jbe 0x5482e
imulq $0x98, %r14, %r13
leaq (%rax,%r13), %rdi
addq $0x40, %rdi
movq 0x38(%rsp), %rsi
callq 0x4050
movl %r15d, %r15d
testl %eax, %eax
je 0x541a3
incq %r14
movl 0x110(%r12), %eax
incl %r15d
cmpl %r14d, %eax
jg 0x5413d
jmp 0x53ffc
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x527f2
movq 0x2f0(%r12), %rax
movq 0x2f8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rdx
cmpq 0x8(%rsp), %rdx
jbe 0x5485c
cmpq %r14, %rdx
jbe 0x54857
movq 0x30(%rsp), %rcx
movsd 0x28(%rax,%rcx), %xmm2
movsd 0x18(%rax,%rcx), %xmm0
movsd 0x20(%rax,%rcx), %xmm1
movsd 0x18(%rax,%r13), %xmm3
movsd 0x20(%rax,%r13), %xmm4
movsd 0x28(%rax,%r13), %xmm5
leaq 0x40(%rsp), %rdi
callq 0x77fb0
movapd %xmm0, %xmm1
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
movsd %xmm0, (%rsp)
je 0x54247
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x54263
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x5427f
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
ucomisd 0xf8de1(%rip), %xmm1    # 0x14d068
jbe 0x5418b
movsd 0xfe4cb(%rip), %xmm0    # 0x152760
ucomisd %xmm1, %xmm0
jbe 0x5418b
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x527f2
movq 0x2f0(%r12), %rax
movq 0x2f8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rdx
cmpq 0x10(%rsp), %rdx
jbe 0x54887
cmpq %r14, %rdx
jbe 0x5488e
movq 0x28(%rsp), %rcx
movsd 0x28(%rax,%rcx), %xmm2
movsd 0x18(%rax,%rcx), %xmm0
movsd 0x20(%rax,%rcx), %xmm1
movsd 0x18(%rax,%r13), %xmm3
movsd 0x20(%rax,%r13), %xmm4
movsd 0x28(%rax,%r13), %xmm5
leaq 0x40(%rsp), %rdi
callq 0x77fb0
movapd %xmm0, %xmm1
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
movsd %xmm0, (%rsp)
je 0x54343
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x5435f
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x5437b
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
ucomisd 0xf8ce5(%rip), %xmm1    # 0x14d068
jbe 0x5418b
movsd 0xfe3cf(%rip), %xmm0    # 0x152760
ucomisd %xmm1, %xmm0
jbe 0x5418b
leal 0x1(%r14), %eax
cmpl 0x110(%r12), %eax
jge 0x5418b
imulq $0x98, %r15, %rbp
movq %r15, %rbx
movq 0x2f0(%r12), %rax
movq 0x2f8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rdx
cmpq %rbx, %rdx
jbe 0x5481d
leaq (%rax,%rbp), %rdi
addq $0x40, %rdi
movq 0x38(%rsp), %rsi
callq 0x4050
testl %eax, %eax
je 0x54414
incq %rbx
addq $0x98, %rbp
cmpl %ebx, 0x110(%r12)
jg 0x543b7
jmp 0x5418b
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x527f2
movq 0x2f0(%r12), %rax
movq 0x2f8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rdx
cmpq 0x8(%rsp), %rdx
jbe 0x54844
cmpq %rbx, %rdx
jbe 0x5483f
movq 0x30(%rsp), %rcx
movsd 0x28(%rax,%rcx), %xmm2
movsd 0x18(%rax,%rcx), %xmm0
movsd 0x20(%rax,%rcx), %xmm1
movsd 0x18(%rax,%rbp), %xmm3
movsd 0x20(%rax,%rbp), %xmm4
movsd 0x28(%rax,%rbp), %xmm5
leaq 0x40(%rsp), %rdi
callq 0x77fb0
movapd %xmm0, %xmm1
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
movsd %xmm0, (%rsp)
je 0x544b5
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x544d1
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x544ed
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
ucomisd 0xf8b73(%rip), %xmm1    # 0x14d068
jbe 0x543fb
movsd 0xfe25d(%rip), %xmm0    # 0x152760
ucomisd %xmm1, %xmm0
jbe 0x543fb
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x527f2
movq 0x2f0(%r12), %rax
movq 0x2f8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rdx
cmpq 0x10(%rsp), %rdx
jbe 0x5486f
cmpq %rbx, %rdx
jbe 0x54876
movq 0x28(%rsp), %rcx
movsd 0x28(%rax,%rcx), %xmm2
movsd 0x18(%rax,%rcx), %xmm0
movsd 0x20(%rax,%rcx), %xmm1
movsd 0x18(%rax,%rbp), %xmm3
movsd 0x20(%rax,%rbp), %xmm4
movsd 0x28(%rax,%rbp), %xmm5
leaq 0x40(%rsp), %rdi
callq 0x77fb0
movapd %xmm0, %xmm1
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
movsd %xmm0, (%rsp)
je 0x545ae
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x545ca
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x545e6
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
ucomisd 0xf8a7a(%rip), %xmm1    # 0x14d068
jbe 0x543fb
movsd 0xfe164(%rip), %xmm0    # 0x152760
ucomisd %xmm1, %xmm0
jbe 0x543fb
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x527f2
movq 0x2f0(%r12), %rax
movq 0x2f8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rdx
cmpq %r14, %rdx
jbe 0x548b3
cmpq %rbx, %rdx
jbe 0x548b0
movsd 0x28(%rax,%r13), %xmm2
movsd 0x18(%rax,%r13), %xmm0
movsd 0x20(%rax,%r13), %xmm1
movsd 0x18(%rax,%rbp), %xmm3
movsd 0x20(%rax,%rbp), %xmm4
movsd 0x28(%rax,%rbp), %xmm5
leaq 0x40(%rsp), %rdi
callq 0x77fb0
movapd %xmm0, %xmm1
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
movsd %xmm0, (%rsp)
je 0x546a3
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x546bf
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x546db
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movsd (%rsp), %xmm1
ucomisd 0xf8985(%rip), %xmm1    # 0x14d068
jbe 0x543fb
movsd 0xfe06f(%rip), %xmm0    # 0x152760
ucomisd %xmm1, %xmm0
jbe 0x543fb
movq 0x2f0(%r12), %r8
movq 0x2f8(%r12), %rdx
subq %r8, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rax # imm = 0x86BCA1AF286BCA1B
imulq %rax, %rdx
cmpq 0x8(%rsp), %rdx
jbe 0x548c9
cmpq 0x10(%rsp), %rdx
jbe 0x548d5
cmpq %r14, %rdx
jbe 0x548c4
cmpq %rbx, %rdx
jbe 0x548d0
movq 0x30(%rsp), %rax
leaq (%r8,%rax), %rsi
movq 0x28(%rsp), %rax
leaq (%r8,%rax), %rdx
leaq (%r8,%r13), %rcx
addq %rbp, %r8
movq %r12, %rdi
callq 0x5497a
movsd %xmm0, 0x40(%rsp)
movq 0x20(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x5478f
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x543fb
leaq 0x40(%rsp), %rdx
callq 0x1481e
jmp 0x543fb
cltq
incl 0x18(%rsp)
incq 0xc0(%rsp)
incq 0xb8(%rsp)
movq 0xc8(%rsp), %rcx
movq %rcx, %rbx
cmpq %rax, %rcx
jl 0x53f01
movq 0x20(%rsp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %r14
cmpq %r14, %rbx
je 0x54806
movq %r14, %rax
subq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3bc39
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3bd32
movq 0x20(%rsp), %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf8ed1(%rip), %rdi     # 0x14d6f5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf8ec0(%rip), %rdi     # 0x14d6f5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630
movq %rbx, %rsi
jmp 0x54849
movq 0x8(%rsp), %rsi
leaq 0xf8ea5(%rip), %rdi     # 0x14d6f5
xorl %eax, %eax
callq 0x4630
movq %r14, %rsi
jmp 0x54861
movq 0x8(%rsp), %rsi
leaq 0xf8e8d(%rip), %rdi     # 0x14d6f5
xorl %eax, %eax
callq 0x4630
movq 0x10(%rsp), %rsi
jmp 0x54879
movq %rbx, %rsi
leaq 0xf8e75(%rip), %rdi     # 0x14d6f5
xorl %eax, %eax
callq 0x4630
movq 0x10(%rsp), %rsi
jmp 0x54891
movq %r14, %rsi
leaq 0xf8e5d(%rip), %rdi     # 0x14d6f5
xorl %eax, %eax
callq 0x4630
leaq 0xf8e4f(%rip), %rdi     # 0x14d6f5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630
movq %rbx, %r14
leaq 0xf8e3b(%rip), %rdi     # 0x14d6f5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630
movq %r14, %rsi
jmp 0x548da
movq 0x8(%rsp), %rsi
jmp 0x548da
movq %rbx, %rsi
jmp 0x548da
movq 0x10(%rsp), %rsi
leaq 0xf8e14(%rip), %rdi     # 0x14d6f5
xorl %eax, %eax
callq 0x4630
movq 0x8(%rsp), %rsi
jmp 0x548f2
movq %r14, %rsi
leaq 0xf8dfc(%rip), %rdi     # 0x14d6f5
xorl %eax, %eax
callq 0x4630
leaq 0xf8dee(%rip), %rdi     # 0x14d6f5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
jmp 0x54956
jmp 0x54956
jmp 0x54956
jmp 0x54956
jmp 0x54945
jmp 0x54956
jmp 0x54945
jmp 0x54956
jmp 0x54945
jmp 0x54956
jmp 0x54956
jmp 0x54945
jmp 0x54956
jmp 0x54945
jmp 0x54956
jmp 0x54945
jmp 0x54956
jmp 0x54945
jmp 0x54956
jmp 0x54945
jmp 0x54945
jmp 0x54956
jmp 0x54945
jmp 0x54945
jmp 0x54956
jmp 0x54956
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x385cc
jmp 0x54959
jmp 0x54956
movq %rax, %rbx
movq 0x20(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x54972
movq 0x10(%rax), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780