// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/networkstorage.cc
// Function: apply_symmetry_operator(MOLECULE, int, int, ATOM_NETWORK*)
MOLECULE apply_symmetry_operator(MOLECULE orig, int sym_op, int sym_ID, ATOM_NETWORK *underlying_net) {
  MOLECULE rot = orig;
  int num_atom = orig.atoms_xyz.size();
  for(int i=0; i<num_atom+1; i++) {
    XYZ pos;
    if(i<num_atom) pos = orig.atoms_xyz.at(i); else pos = orig.com; //handle the centre of mass too!
    XYZ abc_pos = underlying_net->xyz_to_abc_returning_XYZ(pos);
    XYZ new_pos = underlying_net->abc_to_xyz_returning_XYZ(GetEquivalentPositions(sym_ID, &abc_pos).at(sym_op));
    if(i<num_atom) rot.atoms_xyz.at(i) = new_pos; else rot.com = new_pos; //handle the centre of mass too!
  }
  return rot;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r8, %r14
movl %ecx, 0x14(%rsp)
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
callq 0x67616
movq 0x8(%r15), %rcx
movq %r15, 0x18(%rsp)
subq (%r15), %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
testl %ecx, %ecx
js 0x60924
movq %rcx, %rdx
movl $0x90, %ecx
movq 0x18(%rsp), %rax
addq %rcx, %rax
movq %rax, 0x70(%rsp)
movslq %ebp, %rax
addq 0x8(%rsp), %rcx
movq %rcx, 0x68(%rsp)
movq %rdx, %rcx
movl %ecx, %ebp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
incl %ecx
movq %rcx, 0x60(%rsp)
xorl %r12d, %r12d
movq %rax, 0x20(%rsp)
leaq (%rax,%rax,2), %r15
xorl %r13d, %r13d
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
leaq 0x40(%rsp), %rdi
callq 0x84364
movq 0x70(%rsp), %rax
cmpq %rbp, %r13
jae 0x60822
movq 0x18(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r13, %rdx
jbe 0x6095f
addq %r12, %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x50(%rsp)
movups (%rax), %xmm0
movaps %xmm0, 0x40(%rsp)
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movsd 0x50(%rsp), %xmm2
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x52f42
leaq 0x28(%rsp), %rdi
movl 0x14(%rsp), %esi
movq %rbx, %rdx
callq 0xa2ee4
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq 0x20(%rsp), %rdx
jbe 0x6093b
movsd (%rax,%r15,8), %xmm0
movsd 0x8(%rax,%r15,8), %xmm1
movsd 0x10(%rax,%r15,8), %xmm2
leaq 0x78(%rsp), %rdi
movq %r14, %rsi
callq 0x52dd8
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x608cb
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x68(%rsp), %rax
cmpq %rbp, %r13
jae 0x608fe
movq 0x8(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r13, %rdx
jbe 0x6094e
addq %r12, %rax
movq 0x88(%rsp), %rcx
movq %rcx, 0x10(%rax)
movups 0x78(%rsp), %xmm0
movups %xmm0, (%rax)
incq %r13
addq $0x18, %r12
cmpq %r13, 0x60(%rsp)
jne 0x607d8
movq 0x8(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xecdb3(%rip), %rdi     # 0x14d6f5
movq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xecda0(%rip), %rdi     # 0x14d6f5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xecd8f(%rip), %rdi     # 0x14d6f5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
jmp 0x60978
jmp 0x60978
jmp 0x60978
jmp 0x60978
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x6771a
movq %rbx, %rdi
callq 0x4780
jmp 0x6098f
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x6097b
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x6097b