// File: /workspace/github_cpp_makefile_star2_O2/atfrank[P]PCASA/lib/Prmtop.cpp
// Function: Prmtop::readTopology(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Prmtop::readTopology(const std::string& topin){
  std::ifstream topFile;
  std::istream* topinp;
  std::string line;
  std::vector<std::string> s;
  double m; //mass
  double c; //charge
  std::map<std::string, double> massRef;
  std::string resname;
  std::string word;

  resname.clear();

  if (topin.length() > 0){
    topFile.open(topin.c_str(), std::ios::in);
    topinp=&topFile;

    if (topinp->good() == false){
      std::cerr << "Warning: Topology file \"" << topin;
      std::cerr << " could not be read!" << std::endl;
    }

    while (topinp->good() && !(topinp->eof())){
      getline(*topinp, line);
      word=Misc::toupper(Misc::trim(line).substr(0,4));
      if (word.compare(0,4,"MASS") == 0){
        Misc::splitStr(line, " \t", s, false);
        if (s.size() >= 4){
          std::stringstream(s.at(3)) >> m;
          massRef.insert(std::make_pair(s.at(2), m));
          atomTypes.push_back(s.at(2));
        }
      }
      else if (word.compare(0,4,"RESI") == 0 || Misc::trim(line).compare(0,4,"PRES") == 0){
        Misc::splitStr(line, " \t", s, false);
        if (s.size() >= 3){
          resname=s.at(1);
        }
      }
      else if (word.compare(0,4,"ATOM") == 0){
        Misc::splitStr(line, " \t", s, false);
        if (s.size() >= 3){
          atmtype.insert(std::make_pair(std::make_pair(resname, s.at(1)), s.at(2)));
          mass.insert(std::make_pair(std::make_pair(resname, s.at(1)), massRef[s.at(2)]));
          std::stringstream(s.at(3)) >> c;
          charge.insert(std::make_pair(std::make_pair(resname, s.at(1)), c));
        }
      }
      else{
        //Do nothing
      }
    }
  }

  //Sort, remove duplicates, and resize atom type vector
  std::sort(atomTypes.begin(), atomTypes.end());
  std::vector<std::string>::iterator it=std::unique(atomTypes.begin(), atomTypes.end());
  atomTypes.resize(distance(atomTypes.begin(),it));

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x518, %rsp            # imm = 0x518
movq %rsi, %rbx
movq %rdi, 0x28(%rsp)
leaq 0x310(%rsp), %rdi
callq 0x4360
leaq 0xa8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
andq $0x0, 0x20(%rsp)
leaq 0xc0(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
leaq 0x68(%rsp), %rax
leaq 0x88(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rdx)
movb %cl, (%rax)
cmpq %rcx, 0x8(%rbx)
je 0x2252e
movq (%rbx), %rsi
leaq 0x310(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x41e0
movq 0x310(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x330(%rsp,%rax)
je 0x220df
movq 0x3c2f43(%rip), %rdi    # 0x3e4ff0
leaq 0xc5ca(%rip), %rsi      # 0x2e67e
callq 0x4300
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42c0
movq 0x3c2f25(%rip), %rdi    # 0x3e4ff0
leaq 0xc5c5(%rip), %rsi      # 0x2e697
callq 0x4300
movq %rax, %rdi
callq 0x4180
movq 0x28(%rsp), %rax
leaq 0x60(%rax), %rcx
movq %rcx, 0x38(%rsp)
leaq 0x30(%rax), %rcx
movq %rcx, 0x30(%rsp)
addq $0x90, %rax
movq %rax, 0x40(%rsp)
leaq 0x98(%rsp), %rbp
leaq 0x168(%rsp), %rbx
leaq 0x128(%rsp), %r13
pushq $0x4
popq %r12
leaq 0x188(%rsp), %r14
movq 0x310(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x330(%rsp,%rax)
jne 0x2252e
leaq 0x310(%rsp), %rdi
movq %rbp, %rsi
callq 0x4080
leaq 0x108(%rsp), %r15
movq %r15, %rdi
leaq 0xc463(%rip), %rsi      # 0x2e5c4
leaq 0xf(%rsp), %rdx
callq 0x58d8
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x18be4
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r12, %rcx
callq 0x4340
movq %r14, %rdi
movq %r13, %rsi
callq 0x18d7e
leaq 0x78(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x4390
movq %r14, %rdi
callq 0x4170
movq %r13, %rdi
callq 0x4170
movq %rbx, %rdi
callq 0x4170
leaq 0x108(%rsp), %rdi
callq 0x4170
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
leaq 0xc4d3(%rip), %rcx      # 0x2e6ab
callq 0x43f0
testl %eax, %eax
je 0x22460
leaq 0x78(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
leaq 0xc4ba(%rip), %rcx      # 0x2e6b0
callq 0x43f0
testl %eax, %eax
je 0x22401
leaq 0xe8(%rsp), %r15
movq %r15, %rdi
leaq 0xc3af(%rip), %rsi      # 0x2e5c4
movq %r13, %rdx
callq 0x58d8
movq %r14, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x18be4
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
leaq 0xc47b(%rip), %rcx      # 0x2e6b5
callq 0x43f0
movl %eax, %r15d
movq %r14, %rdi
callq 0x4170
leaq 0xe8(%rsp), %rdi
callq 0x4170
testl %r15d, %r15d
je 0x22401
leaq 0x78(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
leaq 0xb3bf(%rip), %rcx      # 0x2d630
callq 0x43f0
testl %eax, %eax
jne 0x22125
movq %r14, %rdi
leaq 0xb20c(%rip), %rsi      # 0x2d494
movq %r13, %rdx
callq 0x58d8
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x10(%rsp), %rdx
xorl %ecx, %ecx
callq 0x188fc
movq %r14, %rdi
callq 0x4170
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
cmpq $0x41, %rax
jb 0x22125
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x5914
movq %r13, %rdi
leaq 0x58(%rsp), %rsi
movq %rax, %rdx
callq 0x18542
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x5914
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x22ba0
movq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x22f50
movq %r14, %rdi
callq 0x22a58
movq %r13, %rdi
callq 0x18578
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x5914
movq %r13, %rdi
leaq 0x58(%rsp), %rsi
movq %rax, %rdx
callq 0x18542
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x5914
leaq 0xb8(%rsp), %rdi
movq %rax, %rsi
callq 0x22a6e
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x22c00
movq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x2325a
movq %r14, %rdi
callq 0x18578
movq %r13, %rdi
callq 0x18578
leaq 0x10(%rsp), %rdi
pushq $0x3
popq %rsi
callq 0x5914
movq %r14, %rdi
movq %rax, %rsi
pushq $0x18
popq %rdx
callq 0x44b0
movq %r14, %rdi
leaq 0x48(%rsp), %rsi
callq 0x41f0
movq %r14, %rdi
callq 0x4260
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x5914
movq %r13, %rdi
leaq 0x58(%rsp), %rsi
movq %rax, %rdx
callq 0x18542
movq %r14, %rdi
movq %r13, %rsi
callq 0x22bd6
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x1c8(%rsp)
movq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x2325a
movq %r14, %rdi
callq 0x18578
movq %r13, %rdi
callq 0x18578
jmp 0x22125
movq %r14, %rdi
leaq 0xb089(%rip), %rsi      # 0x2d494
movq %r13, %rdx
callq 0x58d8
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x10(%rsp), %rdx
xorl %ecx, %ecx
callq 0x188fc
movq %r14, %rdi
callq 0x4170
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
cmpq $0x41, %rax
jb 0x22125
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x5914
leaq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0x41a0
jmp 0x22125
movq %r14, %rdi
leaq 0xb02a(%rip), %rsi      # 0x2d494
movq %r13, %rdx
callq 0x58d8
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x10(%rsp), %rdx
xorl %ecx, %ecx
callq 0x188fc
movq %r14, %rdi
callq 0x4170
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
cmpq $0x61, %rax
jb 0x22125
leaq 0x10(%rsp), %rdi
pushq $0x3
popq %rsi
callq 0x5914
movq %r14, %rdi
movq %rax, %rsi
pushq $0x18
popq %rdx
callq 0x44b0
movq %r14, %rdi
leaq 0x50(%rsp), %rsi
callq 0x41f0
movq %r14, %rdi
callq 0x4260
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x5914
movq %r14, %rdi
movq %rax, %rsi
callq 0x4430
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x1a8(%rsp)
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
callq 0x174a0
movq %r14, %rdi
callq 0x4170
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x5914
movq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x58ac
jmp 0x22125
movq 0x28(%rsp), %rax
movq 0x90(%rax), %rdi
movq 0x98(%rax), %rsi
callq 0x1e3d4
movq 0x28(%rsp), %rbx
movq 0x90(%rbx), %rdi
movq 0x98(%rbx), %rsi
callq 0x17300
addq $0x90, %rbx
subq (%rbx), %rax
sarq $0x5, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1707a
leaq 0x78(%rsp), %rdi
callq 0x4170
leaq 0x58(%rsp), %rdi
callq 0x4170
leaq 0xb8(%rsp), %rdi
callq 0x171a6
leaq 0x10(%rsp), %rdi
callq 0x59a0
leaq 0x98(%rsp), %rdi
callq 0x4170
leaq 0x310(%rsp), %rdi
callq 0x40e0
addq $0x518, %rsp            # imm = 0x518
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x225d2
jmp 0x22632
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x18578
jmp 0x2260a
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x22a58
jmp 0x2260a
jmp 0x226b6
jmp 0x226b6
jmp 0x22607
jmp 0x226b6
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x18578
jmp 0x226b9
jmp 0x226b6
jmp 0x2264e
jmp 0x226b6
jmp 0x226b6
jmp 0x226b6
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x4260
jmp 0x226b9
jmp 0x2264e
jmp 0x2264e
jmp 0x226b6
jmp 0x226b6
jmp 0x226b6
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
jmp 0x226af
jmp 0x226b6
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x4170
jmp 0x22672
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
jmp 0x226af
jmp 0x226b6
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x4170
jmp 0x2269a
jmp 0x226b6
movq %rax, %rbx
jmp 0x226a7
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
callq 0x4170
leaq 0x108(%rsp), %rdi
callq 0x4170
jmp 0x226b9
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x4170
leaq 0x58(%rsp), %rdi
callq 0x4170
leaq 0xb8(%rsp), %rdi
callq 0x171a6
leaq 0x10(%rsp), %rdi
callq 0x59a0
leaq 0x98(%rsp), %rdi
callq 0x4170
leaq 0x310(%rsp), %rdi
callq 0x40e0
movq %rbx, %rdi
callq 0x4560