// File: /workspace/github_cpp_makefile_star2_O3/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 0x21fea
movq %rsp, %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4370
movq (%rbx), %rdi
leaq 0x10(%rsp), %r12
cmpq %r12, %rdi
je 0x2febd
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 0x3032c
movq %rsp, %rdi
movq %r14, %rsi
callq 0x246e0
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 0x2ff60
subq %rdi, %rsi
callq 0x42e0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2ff60
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x42e0
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbp
cmpq %rbp, %r13
je 0x2ff9c
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 0x366ca
movq %r13, %rdi
movq %rbp, %rsi
callq 0x367b3
leaq 0xb290(%rip), %rsi      # 0x3b233
movl $0x1, %ecx
movq %r15, %rdi
xorl %edx, %edx
callq 0x4520
cmpq $-0x1, %rax
je 0x2ffd8
leaq 0xc87f(%rip), %rsi      # 0x3c83e
movl $0x1, %ecx
movq %r15, %rdi
xorl %edx, %edx
callq 0x4520
cmpq $-0x1, %rax
jne 0x30062
movq 0x3c0011(%rip), %rdi    # 0x3efff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq 0x3bfff6(%rip), %rdi    # 0x3efff0
callq 0x4040
movq %rax, %rdi
callq 0x41f0
leaq 0xc83a(%rip), %rsi      # 0x3c848
movl $0x32, %edx
movq %rax, %rdi
callq 0x4340
movq 0x3bffce(%rip), %r13    # 0x3efff0
leaq 0xc852(%rip), %rsi      # 0x3c87b
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 0x3bff9b(%rip), %rdi    # 0x3efff0
callq 0x4040
movq %rax, %rdi
callq 0x41f0
movq %rsp, %rdi
movq %r12, (%rdi)
leaq 0xb447(%rip), %rdx      # 0x3b4b6
movq %rdx, %rsi
callq 0x6512
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rcx
movq %rsp, %r8
movq %rbx, %rsi
movq %r15, %rdx
callq 0x3400e
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x300a5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
jne 0x30206
cmpb $0x0, 0x3c(%rsp)
je 0x301fb
movq 0x3bff29(%rip), %rdi    # 0x3efff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq 0x3bff0e(%rip), %rdi    # 0x3efff0
callq 0x4040
movq %rax, %rdi
callq 0x41f0
leaq 0xc7bb(%rip), %rsi      # 0x3c8b1
movl $0x12, %edx
movq %rax, %rdi
callq 0x4340
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x3bfedf(%rip), %r15    # 0x3efff0
movq %r15, %rdi
callq 0x4340
leaq 0xc7a4(%rip), %rsi      # 0x3c8c4
movl $0x19, %edx
movq %rax, %rdi
callq 0x4340
movq %rsp, %rdi
movq %r14, %rsi
callq 0x23d96
movq (%rsp), %rdi
movq 0x8(%rsp), %r13
cmpq %r12, %rdi
je 0x30153
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
testq %r13, %r13
je 0x301a6
movq 0x3bfe91(%rip), %rdi    # 0x3efff0
leaq 0xc778(%rip), %rsi      # 0x3c8de
movl $0x8, %edx
callq 0x4340
movq %rsp, %rdi
movq %r14, %rsi
callq 0x23d96
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x3bfe65(%rip), %rdi    # 0x3efff0
callq 0x4340
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x301a6
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 0x3bfe2c(%rip), %rdi    # 0x3efff0
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 0x302a7
movq %r14, %rdi
callq 0x2558a
movq 0x40(%rsp), %rax
cmpq %rax, 0x48(%rsp)
je 0x30249
movl $0x1, %ebp
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdi
movl $0x1, %esi
callq 0x14f3e
movl %ebp, %ecx
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %ebp
cmpq %rcx, %rdx
ja 0x30221
movq %rbx, %rdi
addq $0x30, %rdi
callq 0x2161a
movq %rbx, %rdi
callq 0x2161a
movl $0x60, %esi
movq %rbx, %rdi
callq 0x42e0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x30281
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x42e0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x30298
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 0x302f6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
jmp 0x302f6
jmp 0x302f3
jmp 0x302f3
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x3030d
movq 0x10(%rsp), %rsi
incq %rsi
jmp 0x30308
jmp 0x302ee
jmp 0x302ee
jmp 0x302ee
jmp 0x302f3
movq %rax, %rbx
jmp 0x3030d
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x3030d
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x42e0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x30324
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x42e0
movq %rbx, %rdi
callq 0x4550