// File: atfrank[P]PCASA/lib/Trajectory.cpp
// Function: Trajectory::readFrame(std::basic_ifstream<char, std::char_traits<char>>&, unsigned int)
bool Trajectory::readFrame(std::ifstream &trjin, unsigned int frame){
  double *dbuffer; //Needed for crystal!
  float *xbuffer;
  float *ybuffer;
  float *zbuffer;
  int length;
  int i;
  unsigned int j;
  unsigned int maxSeekFrame;

  if (this->getFrameSize() == 0){
    this->setFrameSize((this->getNAtom()*sizeof(float)+sizeof(int)*2)*3);
    if (qcrystal > 0){
      this->setFrameSize(this->getFrameSize()+sizeof(double)*6+2*sizeof(int));
    }
  }

  maxSeekFrame=(std::numeric_limits<int>::max()/this->getFrameSize())-10; //10 buffer

  //Assume header has been read
  //Seek frames
  if (frame-this->getLastFrame() > maxSeekFrame){
    //Seek frame by frame to be safe
    for (j=0; j< frame-this->getLastFrame(); j++){
      trjin.seekg(this->getFrameSize(), std::ios::cur);
    }
  }
  else{
    trjin.seekg((frame-this->getLastFrame())*this->getFrameSize(), std::ios::cur);
  }
  this->setLastFrame(frame+1); 
  //The "+1" positions the pointer at the end of this frame after it has been read


  if (trjin.tellg() == this->getLastPos()){
    //End-of-file, note that trjin.good()/trjin.eof() wouldn't work!
    return false;
  }

  this->iframe++;
  if (this->getShow() == true || this->getScan() == true){
    std::cout << std::fixed;
    std::cout << "Frame : " << this->iframe << " ( " << frame+1 << " / " << getNFrame() << " ) " << std::endl; 
  }

  dbuffer=NULL;
  xbuffer=NULL;
  ybuffer=NULL;
  zbuffer=NULL;

  if (qcrystal > 0){
    dbuffer=readFortran(trjin, dbuffer, length);

    if (this->getScan() == false){ //
      pb.resize(6);
      for (j=0; j< pb.size(); j++){
        pb.at(j)=dbuffer[j];
      }

      //Box dimensions
      pbx=sqrt(pb.at(0)*pb.at(0)+pb.at(1)*pb.at(1)+pb.at(3)*pb.at(3));
      pby=sqrt(pb.at(1)*pb.at(1)+pb.at(2)*pb.at(2)+pb.at(4)*pb.at(4));
      pbz=sqrt(pb.at(3)*pb.at(3)+pb.at(4)*pb.at(4)+pb.at(5)*pb.at(5));

      //Box angles
      pbalpha=acos(pb.at(4)*(pb.at(2)+pb.at(5))+pb.at(1)*pb.at(3)/(pby*pbz))*180.0/PI;
      pbbeta=acos(pb.at(3)*(pb.at(0)+pb.at(5))+pb.at(1)*pb.at(4)/(pbz*pbx))*180.0/PI;
      pbgamma=acos(pb.at(1)*(pb.at(0)+pb.at(2))+pb.at(3)*pb.at(4)/(pbx*pby))*180.0/PI;

      if (this->getShow() == true){ 
        std::cout << "Periodic Box :  ";
        std::cout << pbx << " x " << pby << " x " << pbz << " ";
        std::cout << "( " << pbalpha << " x " << pbbeta << " x " << pbgamma << " )" << std::endl;
      }
    }

    if (dbuffer != NULL){
      delete dbuffer;
    }
  }

  //Coordinates
  xbuffer=readFortran(trjin, xbuffer, length);
  ybuffer=readFortran(trjin, ybuffer, length);
  zbuffer=readFortran(trjin, zbuffer, length);

  if (this->getScan() == false){
    if (x.size() == 0 || y.size() == 0 || z.size() == 0){
      x.resize(natom);
      y.resize(natom);
      z.resize(natom);
    }
    if (natom != static_cast<int>(x.size()) || 
      natom != static_cast<int>(y.size()) || 
      natom != static_cast<int>(z.size())){
        std::cerr << "Error: The number of atoms \"natom\" does not match the number of atoms in each frame" << std::endl;
    }

    if (nfixed > 0){
      for (i=0; i< nfixed; i++){
        //Do something
      }
      std::cerr << "Warning: Fixed atoms has yet to be implemented"<< std::endl;
    }
    else{
      if (mol != NULL && length/sizeof(float) != mol->getNAtom()){
        std::cerr << "Error: The natom mismatch!" << std::endl;
      }
      for (i=0; i< natom; i++){
        if (mol == NULL){
          x.at(i)=xbuffer[i];
          y.at(i)=ybuffer[i];
          z.at(i)=zbuffer[i];
        }
        else{
          mol->getAtom(i)->setCoor(Coor(static_cast<double>(xbuffer[i]), static_cast<double>(ybuffer[i]), static_cast<double>(zbuffer[i])));
        }
  
        if (this->getShow() == true){
          std::cout << std::fixed;
          std::cout << "coor" << std::setw(10) << std::right << i+1;
          std::cout << std::setw(14) << xbuffer[i] << " ";
          std::cout << std::setw(14) << ybuffer[i] << " ";
          std::cout << std::setw(14) << zbuffer[i] << std::endl;
        } 
      }
    }
  }

  if (xbuffer != NULL){
    delete xbuffer;
  }
  if (ybuffer != NULL){
    delete ybuffer;
  }
  if (zbuffer != NULL){
    delete zbuffer;
  }

  return true; 
}

// Assembly:
subq $0x238, %rsp            # imm = 0x238
movq %rdi, 0x228(%rsp)
movq %rsi, 0x220(%rsp)
movl %edx, 0x21c(%rsp)
movq 0x228(%rsp), %rdi
movq %rdi, 0x180(%rsp)
callq 0x74050
cmpl $0x0, %eax
jne 0x72d85
movq 0x180(%rsp), %rdi
callq 0x72c60
movq 0x180(%rsp), %rdi
cltq
shlq $0x2, %rax
addq $0x8, %rax
imulq $0x3, %rax, %rax
movl %eax, 0x1e4(%rsp)
leaq 0x1e4(%rsp), %rsi
callq 0x74060
movq 0x180(%rsp), %rax
cmpl $0x0, 0x9c(%rax)
jle 0x72d83
movq 0x180(%rsp), %rdi
callq 0x74050
movq 0x180(%rsp), %rdi
movl %eax, %eax
addq $0x30, %rax
addq $0x8, %rax
movl %eax, 0x1e0(%rsp)
leaq 0x1e0(%rsp), %rsi
callq 0x74060
jmp 0x72d85
callq 0x77f0
movq 0x180(%rsp), %rdi
movl %eax, 0x178(%rsp)
callq 0x74050
movq 0x180(%rsp), %rdi
movl %eax, %ecx
movl 0x178(%rsp), %eax
xorl %edx, %edx
divl %ecx
subl $0xa, %eax
movl %eax, 0x1e8(%rsp)
movl 0x21c(%rsp), %eax
movl %eax, 0x17c(%rsp)
callq 0x74080
movl %eax, %ecx
movl 0x17c(%rsp), %eax
subl %ecx, %eax
cmpl 0x1e8(%rsp), %eax
jbe 0x72e7d
movl $0x0, 0x1ec(%rsp)
movq 0x180(%rsp), %rdi
movl 0x1ec(%rsp), %eax
movl %eax, 0x174(%rsp)
movl 0x21c(%rsp), %eax
movl %eax, 0x170(%rsp)
callq 0x74080
movl 0x170(%rsp), %ecx
movl %eax, %edx
movl 0x174(%rsp), %eax
subl %edx, %ecx
cmpl %ecx, %eax
jae 0x72e7b
movq 0x180(%rsp), %rdi
movq 0x220(%rsp), %rax
movq %rax, 0x168(%rsp)
callq 0x74050
movq 0x168(%rsp), %rdi
movl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x55e0
movl 0x1ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ec(%rsp)
jmp 0x72df3
jmp 0x72ee9
movq 0x180(%rsp), %rdi
movq 0x220(%rsp), %rax
movq %rax, 0x158(%rsp)
movl 0x21c(%rsp), %eax
movl %eax, 0x154(%rsp)
callq 0x74080
movq 0x180(%rsp), %rdi
movl %eax, %ecx
movl 0x154(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x164(%rsp)
callq 0x74050
movq 0x158(%rsp), %rdi
movl %eax, %ecx
movl 0x164(%rsp), %eax
imull %ecx, %eax
movl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x55e0
movq 0x180(%rsp), %rdi
movl 0x21c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1dc(%rsp)
leaq 0x1dc(%rsp), %rsi
callq 0x74090
movq 0x220(%rsp), %rdi
callq 0x5700
movq 0x180(%rsp), %rdi
movq %rax, 0x1c8(%rsp)
movq %rdx, 0x1d0(%rsp)
callq 0x740b0
movq %rax, 0x1b8(%rsp)
movq %rdx, 0x1c0(%rsp)
leaq 0x1c8(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x75130
testb $0x1, %al
jne 0x72f64
jmp 0x72f71
movb $0x0, 0x237(%rsp)
jmp 0x74037
movq 0x180(%rsp), %rdi
movl 0x34(%rdi), %eax
addl $0x1, %eax
movl %eax, 0x34(%rdi)
callq 0x71b10
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
je 0x72fac
movq 0x180(%rsp), %rdi
callq 0x740d0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x73057
movq 0x3c8005(%rip), %rdi    # 0x43afb8
leaq -0x5c11a(%rip), %rsi    # 0x16ea0
callq 0x5160
movq 0x3c7ff2(%rip), %rdi    # 0x43afb8
leaq 0xa068(%rip), %rsi      # 0x7d035
callq 0x53f0
movq %rax, %rdi
movq 0x180(%rsp), %rax
movl 0x34(%rax), %esi
callq 0x55b0
movq %rax, %rdi
leaq 0xa04f(%rip), %rsi      # 0x7d03e
callq 0x53f0
movq %rax, %rdi
movl 0x21c(%rsp), %esi
addl $0x1, %esi
callq 0x55b0
movq %rax, %rdi
leaq 0xa032(%rip), %rsi      # 0x7d042
callq 0x53f0
movq 0x180(%rsp), %rdi
movq %rax, 0x148(%rsp)
callq 0x72670
movq 0x148(%rsp), %rdi
movl %eax, %esi
callq 0x56f0
movq %rax, %rdi
leaq 0xa003(%rip), %rsi      # 0x7d046
callq 0x53f0
movq %rax, %rdi
movq 0x3c7f56(%rip), %rsi    # 0x43afa8
callq 0x5460
movq 0x180(%rsp), %rax
movq $0x0, 0x210(%rsp)
movq $0x0, 0x208(%rsp)
movq $0x0, 0x200(%rsp)
movq $0x0, 0x1f8(%rsp)
cmpl $0x0, 0x9c(%rax)
jle 0x739bf
movq 0x180(%rsp), %rdi
movq 0x220(%rsp), %rsi
movq 0x210(%rsp), %rdx
leaq 0x1f4(%rsp), %rcx
callq 0x74c00
movq 0x180(%rsp), %rdi
movq %rax, 0x210(%rsp)
callq 0x740d0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x7398e
movq 0x180(%rsp), %rdi
addq $0xe8, %rdi
movl $0x6, %esi
callq 0x175e0
movl $0x0, 0x1ec(%rsp)
movq 0x180(%rsp), %rdi
movl 0x1ec(%rsp), %eax
movq %rax, 0x140(%rsp)
addq $0xe8, %rdi
callq 0x17a60
movq %rax, %rcx
movq 0x140(%rsp), %rax
cmpq %rcx, %rax
jae 0x73198
movq 0x180(%rsp), %rdi
movq 0x210(%rsp), %rax
movl 0x1ec(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x138(%rsp)
addq $0xe8, %rdi
movl 0x1ec(%rsp), %eax
movl %eax, %esi
callq 0x16f90
movsd 0x138(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x1ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ec(%rsp)
jmp 0x73108
movq 0x180(%rsp), %rdi
addq $0xe8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
addq $0xe8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
addq $0xe8, %rdi
movl $0x1, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
addq $0xe8, %rdi
movl $0x1, %esi
callq 0x16f90
movsd 0x60(%rsp), %xmm1
movsd 0x68(%rsp), %xmm0
movsd 0x70(%rsp), %xmm2
movq 0x180(%rsp), %rdi
mulsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x80(%rsp)
addq $0xe8, %rdi
movl $0x3, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
addq $0xe8, %rdi
movl $0x3, %esi
callq 0x16f90
movsd 0x78(%rsp), %xmm0
movsd 0x80(%rsp), %xmm1
movsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x5300
movq 0x180(%rsp), %rdi
movsd %xmm0, 0x100(%rdi)
addq $0xe8, %rdi
movl $0x1, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x90(%rsp)
addq $0xe8, %rdi
movl $0x1, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x98(%rsp)
addq $0xe8, %rdi
movl $0x2, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
addq $0xe8, %rdi
movl $0x2, %esi
callq 0x16f90
movsd 0x88(%rsp), %xmm1
movsd 0x90(%rsp), %xmm0
movsd 0x98(%rsp), %xmm2
movq 0x180(%rsp), %rdi
mulsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xa8(%rsp)
addq $0xe8, %rdi
movl $0x4, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0xa0(%rsp)
addq $0xe8, %rdi
movl $0x4, %esi
callq 0x16f90
movsd 0xa0(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm1
movsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x5300
movq 0x180(%rsp), %rdi
movsd %xmm0, 0x108(%rdi)
addq $0xe8, %rdi
movl $0x3, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0xb8(%rsp)
addq $0xe8, %rdi
movl $0x3, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0xc0(%rsp)
addq $0xe8, %rdi
movl $0x4, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0xb0(%rsp)
addq $0xe8, %rdi
movl $0x4, %esi
callq 0x16f90
movsd 0xb0(%rsp), %xmm1
movsd 0xb8(%rsp), %xmm0
movsd 0xc0(%rsp), %xmm2
movq 0x180(%rsp), %rdi
mulsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xd0(%rsp)
addq $0xe8, %rdi
movl $0x5, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0xc8(%rsp)
addq $0xe8, %rdi
movl $0x5, %esi
callq 0x16f90
movsd 0xc8(%rsp), %xmm0
movsd 0xd0(%rsp), %xmm1
movsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x5300
movq 0x180(%rsp), %rdi
movsd %xmm0, 0x110(%rdi)
addq $0xe8, %rdi
movl $0x4, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0xe8(%rsp)
addq $0xe8, %rdi
movl $0x2, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0xd8(%rsp)
addq $0xe8, %rdi
movl $0x5, %esi
callq 0x16f90
movsd 0xd8(%rsp), %xmm0
movq 0x180(%rsp), %rdi
addsd (%rax), %xmm0
movsd %xmm0, 0xf0(%rsp)
addq $0xe8, %rdi
movl $0x1, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0xe0(%rsp)
addq $0xe8, %rdi
movl $0x3, %esi
callq 0x16f90
movsd 0xe0(%rsp), %xmm1
movsd 0xe8(%rsp), %xmm0
movsd 0xf0(%rsp), %xmm2
movq %rax, %rcx
movq 0x180(%rsp), %rax
mulsd (%rcx), %xmm1
movsd 0x108(%rax), %xmm3
mulsd 0x110(%rax), %xmm3
divsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x53c0
movq 0x180(%rsp), %rdi
movsd 0x7d86(%rip), %xmm1     # 0x7b388
mulsd %xmm1, %xmm0
divsd 0x3c7e3a(%rip), %xmm0   # 0x43b448
movsd %xmm0, 0x118(%rdi)
addq $0xe8, %rdi
movl $0x3, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x108(%rsp)
addq $0xe8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0xf8(%rsp)
addq $0xe8, %rdi
movl $0x5, %esi
callq 0x16f90
movsd 0xf8(%rsp), %xmm0
movq 0x180(%rsp), %rdi
addsd (%rax), %xmm0
movsd %xmm0, 0x110(%rsp)
addq $0xe8, %rdi
movl $0x1, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x100(%rsp)
addq $0xe8, %rdi
movl $0x4, %esi
callq 0x16f90
movsd 0x100(%rsp), %xmm1
movsd 0x108(%rsp), %xmm0
movsd 0x110(%rsp), %xmm2
movq %rax, %rcx
movq 0x180(%rsp), %rax
mulsd (%rcx), %xmm1
movsd 0x110(%rax), %xmm3
mulsd 0x100(%rax), %xmm3
divsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x53c0
movq 0x180(%rsp), %rdi
movsd 0x7c66(%rip), %xmm1     # 0x7b388
mulsd %xmm1, %xmm0
divsd 0x3c7d1a(%rip), %xmm0   # 0x43b448
movsd %xmm0, 0x120(%rdi)
addq $0xe8, %rdi
movl $0x1, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x128(%rsp)
addq $0xe8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x118(%rsp)
addq $0xe8, %rdi
movl $0x2, %esi
callq 0x16f90
movsd 0x118(%rsp), %xmm0
movq 0x180(%rsp), %rdi
addsd (%rax), %xmm0
movsd %xmm0, 0x130(%rsp)
addq $0xe8, %rdi
movl $0x3, %esi
callq 0x16f90
movq 0x180(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x120(%rsp)
addq $0xe8, %rdi
movl $0x4, %esi
callq 0x16f90
movsd 0x120(%rsp), %xmm1
movsd 0x128(%rsp), %xmm0
movsd 0x130(%rsp), %xmm2
movq %rax, %rcx
movq 0x180(%rsp), %rax
mulsd (%rcx), %xmm1
movsd 0x100(%rax), %xmm3
mulsd 0x108(%rax), %xmm3
divsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x53c0
movq 0x180(%rsp), %rdi
movsd 0x7b46(%rip), %xmm1     # 0x7b388
mulsd %xmm1, %xmm0
divsd 0x3c7bfa(%rip), %xmm0   # 0x43b448
movsd %xmm0, 0x128(%rdi)
callq 0x71b10
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x7398c
movq 0x3c7748(%rip), %rdi    # 0x43afb8
leaq 0x97d3(%rip), %rsi      # 0x7d04a
callq 0x53f0
movq 0x180(%rsp), %rax
movsd 0x100(%rax), %xmm0
movq 0x3c7725(%rip), %rdi    # 0x43afb8
callq 0x5780
movq %rax, %rdi
leaq 0x97b9(%rip), %rsi      # 0x7d05b
callq 0x53f0
movq %rax, %rdi
movq 0x180(%rsp), %rax
movsd 0x108(%rax), %xmm0
callq 0x5780
movq %rax, %rdi
leaq 0x9792(%rip), %rsi      # 0x7d05b
callq 0x53f0
movq %rax, %rdi
movq 0x180(%rsp), %rax
movsd 0x110(%rax), %xmm0
callq 0x5780
movq %rax, %rdi
leaq 0x8ca8(%rip), %rsi      # 0x7c598
callq 0x53f0
movq 0x3c76bc(%rip), %rdi    # 0x43afb8
leaq 0x973c(%rip), %rsi      # 0x7d03f
callq 0x53f0
movq %rax, %rdi
movq 0x180(%rsp), %rax
movsd 0x118(%rax), %xmm0
callq 0x5780
movq %rax, %rdi
leaq 0x9731(%rip), %rsi      # 0x7d05b
callq 0x53f0
movq %rax, %rdi
movq 0x180(%rsp), %rax
movsd 0x120(%rax), %xmm0
callq 0x5780
movq %rax, %rdi
leaq 0x970a(%rip), %rsi      # 0x7d05b
callq 0x53f0
movq %rax, %rdi
movq 0x180(%rsp), %rax
movsd 0x128(%rax), %xmm0
callq 0x5780
movq %rax, %rdi
leaq 0x89ab(%rip), %rsi      # 0x7c323
callq 0x53f0
movq %rax, %rdi
movq 0x3c7621(%rip), %rsi    # 0x43afa8
callq 0x5460
jmp 0x7398e
cmpq $0x0, 0x210(%rsp)
je 0x739bd
movq 0x210(%rsp), %rax
movq %rax, 0x58(%rsp)
cmpq $0x0, %rax
je 0x739bb
movq 0x58(%rsp), %rdi
movl $0x8, %esi
callq 0x5420
jmp 0x739bd
jmp 0x739bf
movq 0x180(%rsp), %rdi
movq 0x220(%rsp), %rsi
movq 0x208(%rsp), %rdx
leaq 0x1f4(%rsp), %rcx
callq 0x74ce0
movq 0x180(%rsp), %rdi
movq %rax, 0x208(%rsp)
movq 0x220(%rsp), %rsi
movq 0x200(%rsp), %rdx
leaq 0x1f4(%rsp), %rcx
callq 0x74ce0
movq 0x180(%rsp), %rdi
movq %rax, 0x200(%rsp)
movq 0x220(%rsp), %rsi
movq 0x1f8(%rsp), %rdx
leaq 0x1f4(%rsp), %rcx
callq 0x74ce0
movq 0x180(%rsp), %rdi
movq %rax, 0x1f8(%rsp)
callq 0x740d0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x73fa2
movq 0x180(%rsp), %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x412e0
cmpq $0x0, %rax
je 0x73aaf
movq 0x180(%rsp), %rdi
addq $0x148, %rdi            # imm = 0x148
callq 0x412e0
cmpq $0x0, %rax
je 0x73aaf
movq 0x180(%rsp), %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x412e0
cmpq $0x0, %rax
jne 0x73b09
movq 0x180(%rsp), %rax
movq %rax, %rdi
addq $0x130, %rdi            # imm = 0x130
movslq 0xc8(%rax), %rsi
callq 0x75170
movq 0x180(%rsp), %rax
movq %rax, %rdi
addq $0x148, %rdi            # imm = 0x148
movslq 0xc8(%rax), %rsi
callq 0x75170
movq 0x180(%rsp), %rax
movq %rax, %rdi
addq $0x160, %rdi            # imm = 0x160
movslq 0xc8(%rax), %rsi
callq 0x75170
movq 0x180(%rsp), %rdi
movl 0xc8(%rdi), %eax
movl %eax, 0x54(%rsp)
addq $0x130, %rdi            # imm = 0x130
callq 0x412e0
movq %rax, %rcx
movl 0x54(%rsp), %eax
cmpl %ecx, %eax
jne 0x73b84
movq 0x180(%rsp), %rdi
movl 0xc8(%rdi), %eax
movl %eax, 0x50(%rsp)
addq $0x148, %rdi            # imm = 0x148
callq 0x412e0
movq %rax, %rcx
movl 0x50(%rsp), %eax
cmpl %ecx, %eax
jne 0x73b84
movq 0x180(%rsp), %rdi
movl 0xc8(%rdi), %eax
movl %eax, 0x4c(%rsp)
addq $0x160, %rdi            # imm = 0x160
callq 0x412e0
movq %rax, %rcx
movl 0x4c(%rsp), %eax
cmpl %ecx, %eax
je 0x73ba6
movq 0x3c7465(%rip), %rdi    # 0x43aff0
leaq 0x94cd(%rip), %rsi      # 0x7d05f
callq 0x53f0
movq %rax, %rdi
movq 0x3c7407(%rip), %rsi    # 0x43afa8
callq 0x5460
movq 0x180(%rsp), %rax
cmpl $0x0, 0x94(%rax)
jle 0x73c15
movl $0x0, 0x1f0(%rsp)
movq 0x180(%rsp), %rcx
movl 0x1f0(%rsp), %eax
cmpl 0x94(%rcx), %eax
jge 0x73bee
jmp 0x73bdb
movl 0x1f0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1f0(%rsp)
jmp 0x73bc2
movq 0x3c73fb(%rip), %rdi    # 0x43aff0
leaq 0x9315(%rip), %rsi      # 0x7cf11
callq 0x53f0
movq %rax, %rdi
movq 0x3c739d(%rip), %rsi    # 0x43afa8
callq 0x5460
jmp 0x73fa0
movq 0x180(%rsp), %rax
cmpq $0x0, 0x28(%rax)
je 0x73c76
movq 0x180(%rsp), %rax
movslq 0x1f4(%rsp), %rcx
shrq $0x2, %rcx
movq %rcx, 0x40(%rsp)
movq 0x28(%rax), %rdi
callq 0x44a80
movl %eax, %ecx
movq 0x40(%rsp), %rax
movl %ecx, %ecx
cmpq %rcx, %rax
je 0x73c76
movq 0x3c7395(%rip), %rdi    # 0x43aff0
leaq 0x9451(%rip), %rsi      # 0x7d0b3
callq 0x53f0
movq %rax, %rdi
movq 0x3c7337(%rip), %rsi    # 0x43afa8
callq 0x5460
movl $0x0, 0x1f0(%rsp)
movq 0x180(%rsp), %rcx
movl 0x1f0(%rsp), %eax
cmpl 0xc8(%rcx), %eax
jge 0x73f9e
movq 0x180(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x73d77
movq 0x180(%rsp), %rdi
movq 0x208(%rsp), %rax
movslq 0x1f0(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, 0x34(%rsp)
addq $0x130, %rdi            # imm = 0x130
movslq 0x1f0(%rsp), %rsi
callq 0x75210
movss 0x34(%rsp), %xmm0
movq 0x180(%rsp), %rdi
movss %xmm0, (%rax)
movq 0x200(%rsp), %rax
movslq 0x1f0(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, 0x38(%rsp)
addq $0x148, %rdi            # imm = 0x148
movslq 0x1f0(%rsp), %rsi
callq 0x75210
movss 0x38(%rsp), %xmm0
movq 0x180(%rsp), %rdi
movss %xmm0, (%rax)
movq 0x1f8(%rsp), %rax
movslq 0x1f0(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, 0x3c(%rsp)
addq $0x160, %rdi            # imm = 0x160
movslq 0x1f0(%rsp), %rsi
callq 0x75210
movss 0x3c(%rsp), %xmm0
movss %xmm0, (%rax)
jmp 0x73e0d
movq 0x180(%rsp), %rax
movq 0x28(%rax), %rdi
movl 0x1f0(%rsp), %eax
movl %eax, 0x1b4(%rsp)
leaq 0x1b4(%rsp), %rsi
callq 0x43580
movq %rax, 0x28(%rsp)
movq 0x208(%rsp), %rax
movslq 0x1f0(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movq 0x200(%rsp), %rax
movslq 0x1f0(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
cvtss2sd %xmm1, %xmm1
movq 0x1f8(%rsp), %rax
movslq 0x1f0(%rsp), %rcx
movss (%rax,%rcx,4), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x198(%rsp), %rdi
callq 0x76090
movq 0x28(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0x1ffe0
movq 0x180(%rsp), %rdi
callq 0x71b10
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x73f86
movq 0x3c7189(%rip), %rdi    # 0x43afb8
leaq -0x5cf96(%rip), %rsi    # 0x16ea0
callq 0x5160
movq 0x3c7176(%rip), %rdi    # 0x43afb8
leaq 0x9285(%rip), %rsi      # 0x7d0ce
callq 0x53f0
movq %rax, 0x20(%rsp)
movl $0xa, %edi
callq 0x16ec0
movq 0x20(%rsp), %rdi
movl %eax, 0x194(%rsp)
movl 0x194(%rsp), %esi
callq 0x54e0
movq %rax, %rdi
leaq -0x5cf9f(%rip), %rsi    # 0x16ee0
callq 0x5160
movq %rax, %rdi
movl 0x1f0(%rsp), %esi
addl $0x1, %esi
callq 0x56f0
movl $0xe, %edi
callq 0x16ec0
movl %eax, 0x190(%rsp)
movl 0x190(%rsp), %esi
movq 0x3c7103(%rip), %rdi    # 0x43afb8
callq 0x54e0
movq %rax, %rdi
movq 0x208(%rsp), %rax
movslq 0x1f0(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
callq 0x52d0
movq %rax, %rdi
leaq 0x86b7(%rip), %rsi      # 0x7c598
callq 0x53f0
movl $0xe, %edi
callq 0x16ec0
movl %eax, 0x18c(%rsp)
movl 0x18c(%rsp), %esi
movq 0x3c70b3(%rip), %rdi    # 0x43afb8
callq 0x54e0
movq %rax, %rdi
movq 0x200(%rsp), %rax
movslq 0x1f0(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
callq 0x52d0
movq %rax, %rdi
leaq 0x8667(%rip), %rsi      # 0x7c598
callq 0x53f0
movl $0xe, %edi
callq 0x16ec0
movl %eax, 0x188(%rsp)
movl 0x188(%rsp), %esi
movq 0x3c7063(%rip), %rdi    # 0x43afb8
callq 0x54e0
movq %rax, %rdi
movq 0x1f8(%rsp), %rax
movslq 0x1f0(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
callq 0x52d0
movq %rax, %rdi
movq 0x3c7027(%rip), %rsi    # 0x43afa8
callq 0x5460
jmp 0x73f88
movl 0x1f0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1f0(%rsp)
jmp 0x73c81
jmp 0x73fa0
jmp 0x73fa2
cmpq $0x0, 0x208(%rsp)
je 0x73fd1
movq 0x208(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0x73fcf
movq 0x18(%rsp), %rdi
movl $0x4, %esi
callq 0x5420
jmp 0x73fd1
cmpq $0x0, 0x200(%rsp)
je 0x74000
movq 0x200(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x73ffe
movq 0x10(%rsp), %rdi
movl $0x4, %esi
callq 0x5420
jmp 0x74000
cmpq $0x0, 0x1f8(%rsp)
je 0x7402f
movq 0x1f8(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x7402d
movq 0x8(%rsp), %rdi
movl $0x4, %esi
callq 0x5420
jmp 0x7402f
movb $0x1, 0x237(%rsp)
movb 0x237(%rsp), %al
andb $0x1, %al
addq $0x238, %rsp            # imm = 0x238
retq
nopl (%rax,%rax)