// File: /workspace/github_cpp_makefile_star2_O1/atfrank[P]PCASA/lib/Select.cpp
// Function: Select::makeSel(Molecule*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, bool)
void Select::makeSel (Molecule* mol, std::string selin, bool dieFlag, bool verbose){

  std::vector<Atom *> ref;
  unsigned int i;

  //Convert selection to uppercase
  selin=Misc::toupper(selin);

  //Initialize special selection keys
  Select *sel=new Select;
  sel->initKeys(mol);

  ref=mol->getAtmVecClone(); //Always make a clone of the pointers and sort it!
  std::sort(ref.begin(), ref.end());

  //Passing mol->getAtmVec() directly won't work
  //because it is not properly sorted!
  if (selin.find(":") == std::string::npos || selin.find(".") == std::string::npos){
    std::cerr << std::endl << "Warning: Each selection expression should contain ";
    std::cerr << "both a \":\" and a \".\" in order to be parsed correctly!" << std::endl;
  }
  std::vector<Atom *> atmSel=sel->recursiveDescentParser(selin, ref);

  if (atmSel.size() == 0){
    if (verbose == true){
      std::cerr << std::endl << "Error: Selection \"";
      std::cerr << selin << "\" did not match any atoms";
      if (mol->getTag().length() > 0){
        std::cerr << " in tag " << mol->getTag();
      }
      std::cerr << std::endl << std::endl;
    }
    if (dieFlag == true){
      exit(1);
    }
  }

  mol->deselAll();
  for (i=0; i< atmSel.size(); i++){
    atmSel.at(i)->setSel(true);
  }

  delete sel;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %ecx, 0x3c(%rsp)
movl %edx, 0x38(%rsp)
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq %rsp, %rdi
callq 0x22186
movq %rsp, %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4370
movq (%rbx), %rdi
leaq 0x10(%rsp), %r12
cmpq %r12, %rdi
je 0x3017d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movl $0x60, %edi
callq 0x42d0
movq %rax, %rbx
addq $0x8, %rax
xorl %ecx, %ecx
movl %ecx, 0x8(%rbx)
movq %rcx, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq %rcx, 0x28(%rbx)
leaq 0x38(%rbx), %rax
movl %ecx, 0x38(%rbx)
movq %rcx, 0x40(%rbx)
movq %rax, 0x48(%rbx)
movq %rax, 0x50(%rbx)
movq %rcx, 0x58(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x305ec
movq %rsp, %rdi
movq %r14, %rsi
callq 0x248de
movq 0x20(%rsp), %rdi
movq 0x30(%rsp), %rsi
movaps (%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
testq %rdi, %rdi
je 0x3020a
subq %rdi, %rsi
callq 0x42e0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x30220
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x42e0
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbp
cmpq %rbp, %r13
je 0x3025c
movq %rbp, %rax
subq %r13, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x36836
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3691f
leaq 0xbfd0(%rip), %rsi      # 0x3c233
movl $0x1, %ecx
movq %r15, %rdi
xorl %edx, %edx
callq 0x4520
cmpq $-0x1, %rax
je 0x30298
leaq 0xd5df(%rip), %rsi      # 0x3d85e
movl $0x1, %ecx
movq %r15, %rdi
xorl %edx, %edx
callq 0x4520
cmpq $-0x1, %rax
jne 0x30322
movq 0x3c0d51(%rip), %rdi    # 0x3f0ff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq 0x3c0d36(%rip), %rdi    # 0x3f0ff0
callq 0x4040
movq %rax, %rdi
callq 0x41f0
leaq 0xd59a(%rip), %rsi      # 0x3d868
movl $0x32, %edx
movq %rax, %rdi
callq 0x4340
movq 0x3c0d0e(%rip), %r13    # 0x3f0ff0
leaq 0xd5b2(%rip), %rsi      # 0x3d89b
movl $0x35, %edx
movq %r13, %rdi
callq 0x4340
movq (%r13), %rax
addq -0x18(%rax), %r13
movq %r13, %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq 0x3c0cdb(%rip), %rdi    # 0x3f0ff0
callq 0x4040
movq %rax, %rdi
callq 0x41f0
movq %rsp, %rdi
movq %r12, (%rdi)
leaq 0xc187(%rip), %rdx      # 0x3c4b6
movq %rdx, %rsi
callq 0x6516
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rcx
movq %rsp, %r8
movq %rbx, %rsi
movq %r15, %rdx
callq 0x342ce
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x30365
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
jne 0x304c6
cmpb $0x0, 0x3c(%rsp)
je 0x304bb
movq 0x3c0c69(%rip), %rdi    # 0x3f0ff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq 0x3c0c4e(%rip), %rdi    # 0x3f0ff0
callq 0x4040
movq %rax, %rdi
callq 0x41f0
leaq 0xd51b(%rip), %rsi      # 0x3d8d1
movl $0x12, %edx
movq %rax, %rdi
callq 0x4340
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x3c0c1f(%rip), %r15    # 0x3f0ff0
movq %r15, %rdi
callq 0x4340
leaq 0xd504(%rip), %rsi      # 0x3d8e4
movl $0x19, %edx
movq %rax, %rdi
callq 0x4340
movq %rsp, %rdi
movq %r14, %rsi
callq 0x23f8a
movq (%rsp), %rdi
movq 0x8(%rsp), %r13
cmpq %r12, %rdi
je 0x30413
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
testq %r13, %r13
je 0x30466
movq 0x3c0bd1(%rip), %rdi    # 0x3f0ff0
leaq 0xd4d8(%rip), %rsi      # 0x3d8fe
movl $0x8, %edx
callq 0x4340
movq %rsp, %rdi
movq %r14, %rsi
callq 0x23f8a
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x3c0ba5(%rip), %rdi    # 0x3f0ff0
callq 0x4340
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x30466
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq 0x3c0b6c(%rip), %rdi    # 0x3f0ff0
callq 0x4040
movq %rax, %rdi
callq 0x41f0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41f0
cmpb $0x0, 0x38(%rsp)
jne 0x30567
movq %r14, %rdi
callq 0x2578a
movq 0x40(%rsp), %rax
cmpq %rax, 0x48(%rsp)
je 0x30509
movl $0x1, %ebp
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdi
movl $0x1, %esi
callq 0x150b0
movl %ebp, %ecx
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %ebp
cmpq %rcx, %rdx
ja 0x304e1
movq %rbx, %rdi
addq $0x30, %rdi
callq 0x217ba
movq %rbx, %rdi
callq 0x217ba
movl $0x60, %esi
movq %rbx, %rdi
callq 0x42e0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x30541
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x42e0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x30558
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x42e0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x4360
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x305b6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
jmp 0x305b6
jmp 0x305b3
jmp 0x305b3
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x305cd
movq 0x10(%rsp), %rsi
incq %rsi
jmp 0x305c8
jmp 0x305ae
jmp 0x305ae
jmp 0x305ae
jmp 0x305b3
movq %rax, %rbx
jmp 0x305cd
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x305cd
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x42e0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x305e4
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x42e0
movq %rbx, %rdi
callq 0x4550