// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/net.cc
// Function: write_molecule(_IO_FILE*, MOLECULE*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int, bool)
void write_molecule(FILE *rotmol, MOLECULE *rotated, string name, int vertex_ID, int sym_op, bool write_out_sites) {
  bool verbose = false;
  int num_atom = rotated->atoms_xyz.size();
  int num_atom_to_write = num_atom;
  int num_sites = rotated->sites.size();
  if(!write_out_sites) num_atom_to_write-=num_sites;
  fprintf(rotmol, "%d\n%s", num_atom_to_write, name.c_str());
  if(vertex_ID==-1 && sym_op==-1) { //obviously not a symmetry operation ...
    fprintf(rotmol,"\n");
  } else {
    fprintf(rotmol," - molecule rotated to align with basic vertex ID %d and symmetry operator %d\n", vertex_ID, sym_op);
  }
  for(int i=0; i<num_atom; i++) {
    bool write_this_one = true;
    if(!write_out_sites) {
      for(int j=0; j<num_sites && write_this_one; j++) {
        if(i==rotated->sites.at(j)) write_this_one = false;
      }
    }
    if(write_this_one) {
      fprintf(rotmol, "%s %.3f %.3f %.3f\n", rotated->atoms_type.at(i).c_str(), rotated->atoms_xyz.at(i).x, rotated->atoms_xyz.at(i).y, rotated->atoms_xyz.at(i).z);
    } else {
if(verbose) printf("DEBUG: not writing atom ID %d (%s) because it is a site\n", i, rotated->atoms_type.at(i).c_str());
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %r15d
movl %ecx, %r12d
movq %rsi, %rbx
movq 0x8(%rsi), %r13
subq (%rsi), %r13
movq 0x50(%rsi), %r14
sarq $0x3, %r13
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r13
subq 0x48(%rsi), %r14
shrq $0x2, %r14
xorl %eax, %eax
movl %r9d, 0xc(%rsp)
testl %r9d, %r9d
movl %r14d, %ecx
cmovnel %eax, %ecx
movq %rdi, %rbp
movl %r13d, %eax
subl %ecx, %eax
movq (%rdx), %rcx
leaq 0xb2c47(%rip), %rsi     # 0x155c96
movl %eax, %edx
xorl %eax, %eax
callq 0x45f0
movl %r15d, %eax
andl %r12d, %eax
cmpl $-0x1, %eax
movq %rbp, 0x10(%rsp)
je 0xa3081
leaq 0xb5461(%rip), %rsi     # 0x1584d0
movq %rbp, %rdi
movl %r12d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x45f0
jmp 0xa308e
movl $0xa, %edi
movq %rbp, %rsi
callq 0x4550
testl %r13d, %r13d
jle 0xa317f
testl %r14d, %r14d
setle %bpl
movslq %r14d, %r12
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
orb 0xc(%rsp), %bpl
xorl %r14d, %r14d
xorl %r15d, %r15d
testb %bpl, %bpl
jne 0xa3107
movq 0x48(%rbx), %rax
movq 0x50(%rbx), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
movq %rdx, %rcx
negq %rcx
movb $0x1, %sil
movl $0x1, %edi
leaq (%rcx,%rdi), %r8
cmpq $0x1, %r8
je 0xa318e
movl -0x4(%rax,%rdi,4), %r8d
cmpq %r8, %r15
movzbl %sil, %esi
cmovel %r14d, %esi
cmpq %r12, %rdi
jge 0xa3101
incq %rdi
testb $0x1, %sil
jne 0xa30d5
testb $0x1, %sil
je 0xa3173
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %r15, %rdx
jbe 0xa319f
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq %r15, %rdx
jbe 0xa319f
movq %r15, %rdx
shlq $0x5, %rdx
movq (%rax,%rdx), %rdx
leaq (%r15,%r15,2), %rax
movsd (%rcx,%rax,8), %xmm0
movsd 0x8(%rcx,%rax,8), %xmm1
movsd 0x10(%rcx,%rax,8), %xmm2
movq 0x10(%rsp), %rdi
leaq 0xb0dac(%rip), %rsi     # 0x153f18
movb $0x3, %al
callq 0x45f0
incq %r15
cmpq %r13, %r15
jne 0xa30b3
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xac510(%rip), %rdi     # 0x14f6a5
movq %rdx, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xac4ff(%rip), %rdi     # 0x14f6a5
movq %r15, %rsi
jmp 0xa3198