// File: /workspace/github_cpp_makefile_star2_O2/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, %r12d
movl %edx, 0x4(%rsp)
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x18d7e
leaq 0x8(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4390
movq %rbx, %rdi
callq 0x4170
pushq $0x60
popq %rdi
callq 0x4320
movq %rax, %rbx
movq %rax, %rdi
callq 0x287e8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2440c
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1acae
leaq 0x40(%rsp), %r13
leaq 0x8(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2896e
movq %rbp, %rdi
callq 0xf036
movq (%r13), %rdi
movq 0x8(%r13), %rsi
callq 0x289bf
leaq 0x9054(%rip), %rsi      # 0x2d233
movq %r15, %rdi
xorl %edx, %edx
callq 0x45f0
cmpq $-0x1, %rax
je 0x24206
leaq 0xa58c(%rip), %rsi      # 0x2e782
movq %r15, %rdi
xorl %edx, %edx
callq 0x45f0
cmpq $-0x1, %rax
jne 0x2423c
movq 0x3c0de3(%rip), %rdi    # 0x3e4ff0
callq 0x4180
leaq 0xa573(%rip), %rsi      # 0x2e78c
movq %rax, %rdi
callq 0x4300
movq 0x3c0dc8(%rip), %rdi    # 0x3e4ff0
leaq 0xa590(%rip), %rsi      # 0x2e7bf
callq 0x4300
movq %rax, %rdi
callq 0x4180
leaq 0x9253(%rip), %rsi      # 0x2d496
leaq 0x8(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x58d8
leaq 0x28(%rsp), %rdi
leaq 0x40(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %rbx, %rsi
movq %r15, %rdx
callq 0x26f88
leaq 0x8(%rsp), %rdi
callq 0x4170
movq 0x30(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x2433d
testb %r12b, %r12b
je 0x24336
movq 0x3c0d5a(%rip), %rdi    # 0x3e4ff0
callq 0x4180
leaq 0xa553(%rip), %rsi      # 0x2e7f5
movq %rax, %rdi
callq 0x4300
movq 0x3c0d3f(%rip), %rdi    # 0x3e4ff0
movq %r15, %rsi
callq 0x42c0
leaq 0xa548(%rip), %rsi      # 0x2e808
movq %rax, %rdi
callq 0x4300
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1a55c
leaq 0x8(%rsp), %rdi
movq 0x8(%rdi), %r15
callq 0x4170
testq %r15, %r15
je 0x24322
movq 0x3c0d01(%rip), %rdi    # 0x3e4ff0
leaq 0xa52c(%rip), %rsi      # 0x2e822
callq 0x4300
movq %rax, %r15
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1a55c
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x42c0
leaq 0x8(%rsp), %rdi
callq 0x4170
movq 0x3c0cc7(%rip), %rdi    # 0x3e4ff0
callq 0x4180
movq %rax, %rdi
callq 0x4180
cmpb $0x0, 0x4(%rsp)
jne 0x243b6
movq %r14, %rdi
callq 0x1b6b6
xorl %r14d, %r14d
leaq 0x28(%rsp), %r15
pushq $0x1
popq %rbp
movl %r14d, %r14d
movq 0x30(%rsp), %rax
subq 0x28(%rsp), %rax
sarq $0x3, %rax
cmpq %r14, %rax
jbe 0x24380
movq %r15, %rdi
movq %r14, %rsi
callq 0xeff6
movq (%rax), %rdi
movl %ebp, %esi
callq 0xee92
incl %r14d
jmp 0x24350
movq %rbx, %rdi
callq 0x2881e
pushq $0x60
popq %rsi
movq %rbx, %rdi
callq 0x4330
leaq 0x28(%rsp), %rdi
callq 0xf036
leaq 0x40(%rsp), %rdi
callq 0xf036
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rdi
callq 0x4380
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4170
jmp 0x243f0
jmp 0x243ed
jmp 0x243ed
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4170
jmp 0x243fa
jmp 0x243e8
jmp 0x243e8
jmp 0x243e8
jmp 0x243ed
movq %rax, %rbx
jmp 0x243fa
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xf036
leaq 0x40(%rsp), %rdi
callq 0xf036
movq %rbx, %rdi
callq 0x4560