// File: /workspace/github_cpp_makefile_star2_O2/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 $0xf8, %rsp
movq %rdx, 0x38(%rsp)
movq %rsi, %r15
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq %rdi, 0x40(%rsp)
andq $0x0, 0x10(%rdi)
leaq 0x2f0(%rsi), %r12
leaq 0x340(%rsi), %rax
movq %rax, 0x30(%rsp)
pushq $0x2
popq %rax
movq %rax, 0x50(%rsp)
pushq $0x3
popq %rax
movq %rax, 0x48(%rsp)
xorl %r13d, %r13d
movq %rsi, 0x68(%rsp)
movslq 0x110(%r15), %rax
cmpq %rax, %r13
jge 0x403d8
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
addq $0x40, %rax
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x4040
testl %eax, %eax
je 0x3fcd5
incq %r13
incq 0x50(%rsp)
incq 0x48(%rsp)
jmp 0x3fc96
movq 0x48(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %r13, 0x8(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x58(%rsp)
movq %r13, 0x78(%rsp)
movq 0x8(%rsp), %rsi
incq %rsi
cmpl %esi, 0x110(%r15)
jle 0x3fcc6
movq %r12, %rdi
movq %rsi, 0x8(%rsp)
callq 0xa73a
addq $0x40, %rax
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x4040
testl %eax, %eax
je 0x3fd32
incq 0x58(%rsp)
incq 0x60(%rsp)
jmp 0x3fcf3
leaq 0x80(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x4b58a
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, (%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm5
leaq 0x80(%rsp), %rdi
movsd (%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm4
callq 0x59cea
movsd %xmm0, (%rsp)
leaq 0x80(%rsp), %rdi
callq 0xb0f0
movsd (%rsp), %xmm1
ucomisd 0xbc260(%rip), %xmm1    # 0xfc070
jbe 0x3fd26
movsd 0xc18b2(%rip), %xmm0    # 0x1016d0
ucomisd %xmm1, %xmm0
jbe 0x3fd26
movq 0x60(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x58(%rsp), %rbx
cmpl %ebx, 0x110(%r15)
jle 0x3fd26
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
addq $0x40, %rax
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x4040
testl %eax, %eax
je 0x3fe6e
incq %rbx
incq 0x70(%rsp)
jmp 0x3fe37
leaq 0x80(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x4b58a
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, (%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm5
leaq 0x80(%rsp), %rdi
movsd (%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm4
callq 0x59cea
leaq 0x80(%rsp), %rdi
movsd %xmm0, (%rsp)
callq 0xb0f0
movsd (%rsp), %xmm1
ucomisd 0xbc12a(%rip), %xmm1    # 0xfc070
jbe 0x3fe64
movsd 0xc177c(%rip), %xmm0    # 0x1016d0
ucomisd %xmm1, %xmm0
jbe 0x3fe64
leaq 0x80(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x4b58a
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, (%rsp)
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm5
leaq 0x80(%rsp), %rdi
movsd (%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm4
callq 0x59cea
leaq 0x80(%rsp), %rdi
movsd %xmm0, (%rsp)
callq 0xb0f0
movsd (%rsp), %xmm1
ucomisd 0xbc034(%rip), %xmm1    # 0xfc070
jbe 0x3fe64
movsd 0xc1686(%rip), %xmm0    # 0x1016d0
ucomisd %xmm1, %xmm0
jbe 0x3fe64
movq 0x70(%rsp), %r14
cmpl %r14d, 0x110(%r15)
jle 0x3fe64
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
addq $0x40, %rax
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x4040
testl %eax, %eax
je 0x4008b
incq %r14
jmp 0x40059
leaq 0x80(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x4b58a
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, (%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm5
leaq 0x80(%rsp), %rdi
movsd (%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm4
callq 0x59cea
leaq 0x80(%rsp), %rdi
movsd %xmm0, (%rsp)
callq 0xb0f0
movsd (%rsp), %xmm1
ucomisd 0xbbf0d(%rip), %xmm1    # 0xfc070
jbe 0x40086
movsd 0xc155f(%rip), %xmm0    # 0x1016d0
ucomisd %xmm1, %xmm0
jbe 0x40086
leaq 0x80(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x4b58a
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, (%rsp)
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm5
leaq 0x80(%rsp), %rdi
movsd (%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm4
callq 0x59cea
leaq 0x80(%rsp), %rdi
movsd %xmm0, (%rsp)
callq 0xb0f0
movsd (%rsp), %xmm1
ucomisd 0xbbe17(%rip), %xmm1    # 0xfc070
jbe 0x40086
movsd 0xc1469(%rip), %xmm0    # 0x1016d0
ucomisd %xmm1, %xmm0
jbe 0x40086
leaq 0x80(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x4b58a
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, (%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
movsd 0x28(%rax), %xmm5
leaq 0x80(%rsp), %rdi
movsd (%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm4
callq 0x59cea
leaq 0x80(%rsp), %rdi
movsd %xmm0, (%rsp)
callq 0xb0f0
movsd (%rsp), %xmm1
ucomisd 0xbbd27(%rip), %xmm1    # 0xfc070
jbe 0x40086
movsd 0xc1379(%rip), %xmm0    # 0x1016d0
ucomisd %xmm1, %xmm0
jbe 0x40086
movq %r12, %rdi
movq %r13, %rsi
callq 0xa73a
movq %rax, %r13
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xa73a
movq %rax, %r15
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa73a
movq %rax, %rbp
movq %r12, %rdi
movq %r14, %rsi
callq 0xa73a
movq 0x68(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movq %rax, %r8
callq 0x40446
movsd %xmm0, 0x80(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0xac88
movq 0x68(%rsp), %r15
movq 0x78(%rsp), %r13
jmp 0x40086
movq 0x40(%rsp), %rbx
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x2cc88
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4041e
jmp 0x4041e
jmp 0x4041e
jmp 0x4041e
jmp 0x4041e
jmp 0x4041e
jmp 0x4041e
jmp 0x40423
jmp 0x4041e
jmp 0x4041e
jmp 0x4041e
jmp 0x40423
jmp 0x40423
jmp 0x4041e
jmp 0x40423
jmp 0x40423
movq %rax, %rbx
jmp 0x40433
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xb0f0
movq 0x40(%rsp), %rdi
callq 0xb25c
movq %rbx, %rdi
callq 0x4780
nop