// File: /workspace/github_cpp_makefile_star2_O3/j-faria[P]kima/src/Data.cpp
// Function: Data::load_multi(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
void Data::load_multi(vector<std::string> filenames, const std::string units, 
                      int skip, const vector<std::string>& indicators)
{

  data_t data;

  // Empty the vectors
  t.clear();
  y.clear();
  sig.clear();
  obsi.clear();

  // check for indicator correlations and store stuff
  int nempty = count(indicators.begin(), indicators.end(), "");
  number_indicators = indicators.size() - nempty;
  indicator_correlations = number_indicators > 0;
  indicator_names = indicators;
  indicator_names.erase(
    std::remove( indicator_names.begin(), indicator_names.end(), "" ), 
    indicator_names.end() );

  // Empty the indicator vectors as well
  actind.clear();
  actind.resize(number_indicators);
  for (unsigned n = 0; n < number_indicators; n++)
    actind[n].clear();


  std::string dump; // to dump the first skip lines of each file
  int filecount = 1;
  int last_file_size = 0;

  // Read the files into the data container
  for (auto &filename : filenames) {
    ifstream infile( filename );
    for (int i=0; i<skip; i++)  // skip the first `skip` lines of each file
      getline(infile, dump);
    infile >> data;

    // Complain if something went wrong.
    if (!infile.eof())
    {
      printf("Could not read data file (%s)!\n", filename.c_str());
      exit(1);
    }

    infile.close();

    // Assign instrument int identifier to obsi
    for(unsigned i=last_file_size; i<data.size(); i++){
      obsi.push_back(filecount);
    }
    
    last_file_size = data.size();
    filecount++;
  }

  datafile = "";
  datafiles = filenames;
  dataunits = units;
  dataskip = skip;
  datamulti = true;


  double factor = 1.;
  if(units == "kms") factor = 1E3;

  for (unsigned n=0; n<data.size(); n++)
    {
      // if (n<skip) continue;
      t.push_back(data[n][0]);
      y.push_back(data[n][1] * factor);
      sig.push_back(data[n][2] * factor);

      if (indicator_correlations)
      {
        int j = 0;
        for (unsigned i = 0; i < number_indicators + nempty; i++)
        {
          if (indicators[i] == "")
            continue; // skip column
          else
          {
            actind[j].push_back(data[n][3+i] * factor);
            j++;
          }
        }
      }

    }

  // How many points did we read?
  printf("# Loaded %zu data points from files\n", t.size());
  cout << "#   ";
  for (auto f: filenames){
    cout << f.c_str();
    (f != filenames.back()) ? cout << " | " : cout << " ";
  }
  cout << endl;

  // Did we read activity indicators? how many?
  if(indicator_correlations){
    printf("# Loaded %d observations of %d activity indicators: ", actind[0].size(), actind.size());
    for (const auto i: indicators){
      if (i != ""){
        cout << "'" << i << "'";
        (i != indicators.back()) ? cout << ", " : cout << " ";
      }
    }
    cout << endl;
  }

  // Of how many instruments?
  std::set<int> s( obsi.begin(), obsi.end() );
  // set<int>::iterator iter;
  // for(iter=s.begin(); iter!=s.end();++iter) {  cout << (*iter) << endl;}
  printf("# RVs come from %zu different instruments.\n", s.size());
  number_instruments = s.size();

  if(units == "kms") 
    cout << "# Multiplied all RVs by 1000; units are now m/s." << endl;

  if(number_instruments > 1)
  {
    // We need to sort t because it comes from different instruments
    int N = t.size();
    std::vector<double> tt(N), yy(N);
    std::vector<double> sigsig(N), obsiobsi(N);
    std::vector<int> order(N);
    std::vector<std::vector<double>> actindactind(number_indicators, std::vector<double>(N));

    // order = argsort(t)
    int x=0;
    std::iota(order.begin(), order.end(), x++);
    sort( order.begin(),order.end(), [&](int i,int j){return t[i] < t[j];} );

    for(unsigned i=0; i<N; i++){
      tt[i] = t[order[i]];
      yy[i] = y[order[i]];
      sigsig[i] = sig[order[i]];
      obsiobsi[i] = obsi[order[i]];
      for(unsigned j=0; j<number_indicators; j++)
        actindactind[j][i] = actind[j][order[i]];
    }

    for(unsigned i=0; i<N; i++){
      t[i] = tt[i];
      y[i] = yy[i];
      sig[i] = sigsig[i];
      obsi[i] = obsiobsi[i];
      for(unsigned j=0; j<number_indicators; j++)
        actind[j][i] = actindactind[j][i];
    }

    // debug
    // for(std::vector<int>::size_type i = 0; i != t.size(); i++)
    //     cout << t[i] << "\t" << y[i] << "\t" << sig[i] << "\t" << obsi[i] <<  endl;
  }

  // epoch for the mean anomaly, by default the time of the first observation
  M0_epoch = t[0];

  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x348, %rsp            # imm = 0x348
movq %r8, 0x10(%rsp)
movl %ecx, 0x20(%rsp)
movq %rdx, %r13
movq %rsi, 0x18(%rsp)
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq (%rdi), %rax
cmpq %rax, 0x8(%rdi)
je 0x9ee5
movq %rax, 0x8(%rbx)
movq 0x18(%rbx), %rax
cmpq %rax, 0x20(%rbx)
je 0x9ef3
movq %rax, 0x20(%rbx)
movq 0x30(%rbx), %rax
cmpq %rax, 0x38(%rbx)
je 0x9f01
movq %rax, 0x38(%rbx)
movq 0x48(%rbx), %rax
cmpq %rax, 0x50(%rbx)
je 0x9f0f
movq %rax, 0x50(%rbx)
movq 0x10(%rsp), %rax
movq (%rax), %r14
movq 0x8(%rax), %r12
xorl %ebp, %ebp
cmpq %r12, %r14
je 0x9f52
leaq 0x33bb4(%rip), %r15     # 0x3dadd
movq %r14, %rdi
movq %r15, %rsi
callq 0x6100
cmpl $0x1, %eax
adcq $0x0, %rbp
addq $0x20, %r14
cmpq %r12, %r14
jne 0x9f29
movq 0x10(%rsp), %rsi
movq (%rsi), %r14
movq 0x8(%rsi), %rax
jmp 0x9f5a
movq %r14, %rax
movq 0x10(%rsp), %rsi
subq %r14, %rax
shrq $0x5, %rax
movq %rbp, 0x28(%rsp)
subl %ebp, %eax
movl %eax, 0x7c(%rbx)
testl %eax, %eax
setg 0x78(%rbx)
leaq 0x80(%rbx), %r14
movq %r14, %rdi
callq 0xb9b6
movq 0x80(%rbx), %rdi
movq 0x88(%rbx), %rsi
leaq 0x33b48(%rip), %rdx     # 0x3dadd
callq 0xc52d
movq 0x88(%rbx), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0xc682
leaq 0x60(%rbx), %r14
movq 0x60(%rbx), %rsi
movq %r14, %rdi
callq 0xc750
movslq 0x7c(%rbx), %rsi
movq %r14, 0x50(%rsp)
movq %r14, %rdi
callq 0xbb4c
movl 0x7c(%rbx), %ecx
testq %rcx, %rcx
je 0xa000
movq 0x50(%rsp), %rax
movq (%rax), %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
movq (%rax,%rdx), %rsi
cmpq %rsi, 0x8(%rax,%rdx)
je 0x9ff7
movq %rsi, 0x8(%rax,%rdx)
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0x9fe7
movq %r13, 0x60(%rsp)
leaq 0x118(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl $0x1, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %r14
movq 0x8(%rax), %rax
movq %rax, 0x58(%rsp)
cmpq %rax, %r14
je 0xa16f
leaq 0x48(%rbx), %rax
movq %rax, (%rsp)
xorl %r12d, %r12d
leaq 0x140(%rsp), %rbp
leaq 0x108(%rsp), %r15
movq %rbp, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x6640
movl 0x20(%rsp), %eax
movl %eax, %r13d
testl %eax, %eax
jle 0xa0a0
movq 0x140(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x6430
movsbl %al, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x6780
decl %r13d
jne 0xa074
movq %rbp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x9287
movq 0x140(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x160(%rsp,%rax)
je 0xac7e
movq %rbp, %rdi
callq 0x60a0
movl %r12d, %edx
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
movq %rcx, %r13
subq %rax, %r13
sarq $0x3, %r13
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %r13
cmpq %rdx, %r13
jbe 0xa151
incl %r12d
movq 0x50(%rbx), %rsi
cmpq 0x58(%rbx), %rsi
je 0xa116
movl 0x8(%rsp), %edx
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x50(%rbx)
jmp 0xa12e
movq (%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xcbd0
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
movl %r12d, %edx
movq %rcx, %r13
subq %rax, %r13
sarq $0x3, %r13
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %r13
incl %r12d
cmpq %rdx, %r13
ja 0xa0fc
incl 0x8(%rsp)
movq %rbp, %rdi
callq 0x60e0
addq $0x20, %r14
movl %r13d, %r12d
cmpq 0x58(%rsp), %r14
jne 0xa059
leaq 0x98(%rbx), %rdi
movq 0xa0(%rbx), %rdx
leaq 0x33959(%rip), %rcx     # 0x3dadd
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x6600
movq 0x60(%rsp), %r14
movq 0x10(%rsp), %r13
leaq 0xb8(%rbx), %rdi
movq 0x18(%rsp), %rsi
callq 0xb9b6
leaq 0xd0(%rbx), %rdi
movq %r14, %rsi
callq 0x6210
movl 0x20(%rsp), %eax
movl %eax, 0xf0(%rbx)
movb $0x1, 0xf4(%rbx)
leaq 0x33340(%rip), %rsi     # 0x3d510
movq %r14, %rdi
callq 0x6100
xorl %ecx, %ecx
testl %eax, %eax
sete %dl
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
movq 0x28(%rsp), %rsi
je 0xa3ce
leaq 0x18(%rbx), %rdi
movq %rdi, 0xe8(%rsp)
leaq 0x30(%rbx), %rdi
movq %rdi, 0xe0(%rsp)
movb %dl, %cl
leaq 0x3328b(%rip), %rdx     # 0x3d4a0
movsd (%rdx,%rcx,8), %xmm0
movsd %xmm0, (%rsp)
movl %esi, %ecx
negl %ecx
movl %ecx, 0x58(%rsp)
xorl %r14d, %r14d
leaq (%r14,%r14,2), %r15
movq (%rax,%r15,8), %rdx
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xa24e
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xa25f
movq %rbx, %rdi
callq 0xc042
movq 0x30(%rsp), %rax
movq (%rax,%r15,8), %rdx
movsd 0x8(%rdx), %xmm0
mulsd (%rsp), %xmm0
movsd %xmm0, 0x140(%rsp)
movq 0x20(%rbx), %rsi
cmpq 0x28(%rbx), %rsi
je 0xa28a
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x20(%rbx)
jmp 0xa2a4
movq 0xe8(%rsp), %rdi
leaq 0x140(%rsp), %rdx
callq 0x7488
movq 0x30(%rsp), %rax
movq %r14, 0x20(%rsp)
movq (%rax,%r15,8), %rax
movsd 0x10(%rax), %xmm0
mulsd (%rsp), %xmm0
movsd %xmm0, 0x140(%rsp)
movq 0x38(%rbx), %rsi
cmpq 0x40(%rbx), %rsi
je 0xa2d8
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x38(%rbx)
jmp 0xa2ed
movq 0xe0(%rsp), %rdi
leaq 0x140(%rsp), %rdx
callq 0x7488
cmpb $0x1, 0x78(%rbx)
jne 0xa39e
movl 0x58(%rsp), %eax
cmpl %eax, 0x7c(%rbx)
je 0xa39e
xorl %r12d, %r12d
movl $0x3, %r14d
xorl %ebp, %ebp
movq (%r13), %rdi
addq %r12, %rdi
leaq 0x337c0(%rip), %rsi     # 0x3dadd
callq 0x6100
testl %eax, %eax
je 0xa37f
movslq %ebp, %rax
movq 0x50(%rsp), %rcx
movq (%rcx), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rdi
movq 0x30(%rsp), %rax
movl %r14d, %ecx
movq (%rax,%r15,8), %rax
movsd (%rax,%rcx,8), %xmm0
mulsd (%rsp), %xmm0
movsd %xmm0, 0x140(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0xa370
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xa37d
leaq 0x140(%rsp), %rdx
callq 0x7488
incl %ebp
movl 0x7c(%rbx), %eax
addl 0x28(%rsp), %eax
leaq 0x1(%r14), %rcx
addq $0x20, %r12
addq $-0x2, %r14
cmpq %rax, %r14
movq %rcx, %r14
jb 0xa30f
movq 0x20(%rsp), %r14
incl %r14d
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
cmpq %r14, %rcx
ja 0xa22a
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x3, %rsi
leaq 0x331c3(%rip), %rdi     # 0x3d5a3
xorl %eax, %eax
callq 0x6050
movq 0x45baa(%rip), %r14     # 0x4ff98
leaq 0x331d3(%rip), %rsi     # 0x3d5c8
movl $0x4, %edx
movq %r14, %rdi
callq 0x64a0
movq 0x18(%rsp), %rax
movq (%rax), %r13
movq 0x8(%rax), %r15
cmpq %r15, %r13
je 0xa505
leaq 0x150(%rsp), %rbp
movq %rbp, 0x140(%rsp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0x140(%rsp), %rdi
callq 0xbf78
movq 0x140(%rsp), %r12
testq %r12, %r12
je 0xa464
movq %r12, %rdi
callq 0x61a0
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x64a0
jmp 0xa47c
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x6690
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x148(%rsp), %rdx
movl $0x3, %r12d
cmpq -0x18(%rax), %rdx
jne 0xa4c9
testq %rdx, %rdx
je 0xa4ba
movq -0x20(%rax), %rsi
movq 0x140(%rsp), %rdi
callq 0x6470
leaq 0x33117(%rip), %rsi     # 0x3d5cd
testl %eax, %eax
jne 0xa4d0
movl $0x1, %r12d
leaq 0x33104(%rip), %rsi     # 0x3d5cb
jmp 0xa4d0
leaq 0x330fd(%rip), %rsi     # 0x3d5cd
movq %r14, %rdi
movq %r12, %rdx
callq 0x64a0
movq 0x140(%rsp), %rdi
cmpq %rbp, %rdi
je 0xa4f8
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x6460
addq $0x20, %r13
cmpq %r15, %r13
jne 0xa41f
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x6430
movsbl %al, %esi
movq 0x45a75(%rip), %rdi     # 0x4ff98
callq 0x6030
movq %rax, %rdi
callq 0x6300
cmpb $0x1, 0x78(%rbx)
jne 0xa6cc
movq 0x60(%rbx), %rax
movq 0x68(%rbx), %rdx
movq 0x8(%rax), %rsi
subq (%rax), %rsi
sarq $0x3, %rsi
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rdx
leaq 0x33068(%rip), %rdi     # 0x3d5d1
xorl %eax, %eax
callq 0x6050
movq 0x10(%rsp), %rax
movq (%rax), %r12
movq 0x8(%rax), %r13
cmpq %r13, %r12
je 0xa69d
leaq 0x150(%rsp), %rbp
leaq 0x140(%rsp), %r15
movq %rbp, 0x140(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0xbf78
movq %r15, %rdi
leaq 0x33522(%rip), %rsi     # 0x3dadd
callq 0x6100
testl %eax, %eax
je 0xa673
movl $0x1, %edx
movq 0x459c4(%rip), %rdi     # 0x4ff98
leaq 0x334ff(%rip), %rsi     # 0x3dada
callq 0x64a0
movq 0x140(%rsp), %rsi
movq 0x148(%rsp), %rdx
movq 0x459a1(%rip), %rdi     # 0x4ff98
callq 0x64a0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x334cf(%rip), %rsi     # 0x3dada
callq 0x64a0
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x148(%rsp), %rdx
movl $0x2, %r14d
cmpq -0x18(%rax), %rdx
jne 0xa65d
testq %rdx, %rdx
je 0xa64e
movq -0x20(%rax), %rsi
movq 0x140(%rsp), %rdi
callq 0x6470
leaq 0x3af61(%rip), %rsi     # 0x455ab
testl %eax, %eax
jne 0xa664
movl $0x1, %r14d
leaq 0x32f70(%rip), %rsi     # 0x3d5cb
jmp 0xa664
leaq 0x3af47(%rip), %rsi     # 0x455ab
movq 0x4592d(%rip), %rdi     # 0x4ff98
movq %r14, %rdx
callq 0x64a0
movq 0x140(%rsp), %rdi
cmpq %rbp, %rdi
je 0xa690
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x6460
addq $0x20, %r12
cmpq %r13, %r12
jne 0xa595
movq 0x458f4(%rip), %rdi     # 0x4ff98
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x6430
movsbl %al, %esi
movq 0x458d9(%rip), %rdi     # 0x4ff98
callq 0x6030
movq %rax, %rdi
callq 0x6300
movq 0x48(%rbx), %rsi
movq 0x50(%rbx), %rdx
leaq 0x140(%rsp), %rdi
callq 0xbbdc
movq 0x60(%rsp), %r14
movq 0x168(%rsp), %rsi
leaq 0x32e82(%rip), %rdi     # 0x3d577
xorl %eax, %eax
callq 0x6050
movl 0x168(%rsp), %eax
movl %eax, 0xf8(%rbx)
leaq 0x32e00(%rip), %rsi     # 0x3d510
movq %r14, %rdi
callq 0x6100
testl %eax, %eax
jne 0xa762
movq 0x45875(%rip), %r14     # 0x4ff98
leaq 0x32f51(%rip), %rsi     # 0x3d67b
movl $0x30, %edx
movq %r14, %rdi
callq 0x64a0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x6430
movsbl %al, %esi
movq 0x45843(%rip), %rdi     # 0x4ff98
callq 0x6030
movq %rax, %rdi
callq 0x6300
cmpl $0x2, 0xf8(%rbx)
jl 0xac21
movq 0x8(%rbx), %r13
subq (%rbx), %r13
shrq $0x3, %r13
movslq %r13d, %r14
leaq 0xc8(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
movq %r14, %rsi
callq 0xbc58
leaq 0xb0(%rsp), %rdi
leaq 0x98(%rsp), %rdx
movq %r14, %rsi
callq 0xbc58
leaq 0x98(%rsp), %rdi
leaq 0x80(%rsp), %rdx
movq %r14, %rsi
callq 0xbc58
leaq 0x80(%rsp), %rdi
leaq 0x68(%rsp), %rdx
movq %r14, %rsi
callq 0xbc58
leaq 0x68(%rsp), %rdi
leaq 0x128(%rsp), %rdx
movq %r14, %rsi
callq 0xbce6
movslq 0x7c(%rbx), %r15
leaq 0xf0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
callq 0xbc58
leaq 0x128(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
leaq 0xe(%rsp), %rcx
movq %r15, %rsi
callq 0xbd72
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0xa842
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movq 0x68(%rsp), %r15
movq 0x70(%rsp), %r14
cmpq %r14, %r15
je 0xa9e5
movq %r14, %r12
subq %r15, %r12
leaq -0x4(%r12), %rax
movq %rax, %xmm0
shrq $0x2, %rax
addq $0x4, %rax
andq $-0x4, %rax
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
psrlq $0x2, %xmm0
xorl %ecx, %ecx
movdqa 0x32c2b(%rip), %xmm1    # 0x3d4b0
movdqa 0x32c33(%rip), %xmm2    # 0x3d4c0
movdqa 0x32c3b(%rip), %xmm3    # 0x3d4d0
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rcx, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edx
notl %edx
testb $0x1, %dl
je 0xa8e3
movl %ecx, (%r15,%rcx,4)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0xa8f9
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r15,%rcx,4)
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %edx
testb $0x1, %dl
je 0xa935
leal 0x2(%rcx), %edx
movl %edx, 0x8(%r15,%rcx,4)
pextrw $0x4, %xmm5, %edx
testb $0x1, %dl
je 0xa947
leal 0x3(%rcx), %edx
movl %edx, 0xc(%r15,%rcx,4)
addq $0x4, %rcx
cmpq %rcx, %rax
jne 0xa89d
movq %r12, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rcx
callq 0xb599
cmpq $0x41, %r12
jl 0xa9d7
leaq 0x40(%r15), %r12
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0xb82f
cmpq %r14, %r12
je 0xa9e5
movq (%rbx), %rax
movslq (%r12), %rcx
movsd (%rax,%rcx,8), %xmm0
movslq -0x4(%r12), %rdx
movsd (%rax,%rdx,8), %xmm1
ucomisd %xmm0, %xmm1
movq %r12, %rsi
jbe 0xa9ca
movq %r12, %rsi
movl %edx, (%rsi)
movslq -0x8(%rsi), %rdx
movsd (%rax,%rdx,8), %xmm1
addq $-0x4, %rsi
ucomisd %xmm0, %xmm1
ja 0xa9b5
movl %ecx, (%rsi)
addq $0x4, %r12
cmpq %r14, %r12
jne 0xa996
jmp 0xa9e5
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xb82f
testl %r13d, %r13d
je 0xab89
movq 0x68(%rsp), %rax
movq %rax, 0x28(%rsp)
movq (%rbx), %rax
movq %rax, (%rsp)
movq 0x18(%rbx), %rax
movq %rax, 0x50(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xb0(%rsp), %rdi
movq 0x30(%rbx), %r8
movq 0x98(%rsp), %r9
movq 0x48(%rbx), %r10
movq 0x80(%rsp), %r11
movl 0x7c(%rbx), %r14d
movq 0x60(%rbx), %r15
movq 0x128(%rsp), %r12
movq %r13, 0x18(%rsp)
movl %r13d, %ebp
movq %r14, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %r13
xorl %eax, %eax
movq 0x28(%rsp), %rcx
movslq (%rcx,%rax,4), %rcx
movq (%rsp), %rdx
movsd (%rdx,%rcx,8), %xmm0
movq 0x20(%rsp), %rdx
movsd %xmm0, (%rdx,%rax,8)
movq 0x50(%rsp), %rdx
movsd (%rdx,%rcx,8), %xmm0
movsd %xmm0, (%rdi,%rax,8)
movsd (%r8,%rcx,8), %xmm0
movsd %xmm0, (%r9,%rax,8)
xorps %xmm0, %xmm0
cvtsi2sdl (%r10,%rcx,4), %xmm0
movsd %xmm0, (%r11,%rax,8)
testl %r14d, %r14d
je 0xaac2
xorl %edx, %edx
movq (%r15,%rdx), %rsi
movsd (%rsi,%rcx,8), %xmm0
movq (%r12,%rdx), %rsi
movsd %xmm0, (%rsi,%rax,8)
addq $0x18, %rdx
cmpq %rdx, %r13
jne 0xaaa7
incq %rax
cmpq %rbp, %rax
jne 0xaa5a
movq 0x18(%rsp), %rax
testl %eax, %eax
je 0xab89
movq 0xc8(%rsp), %rcx
movq %rcx, 0x28(%rsp)
movq (%rbx), %rcx
movq 0x18(%rbx), %rdx
movq 0xb0(%rsp), %rsi
movq 0x98(%rsp), %rdi
movq 0x30(%rbx), %r8
movq 0x80(%rsp), %r9
movq 0x48(%rbx), %r10
movq 0x128(%rsp), %r11
movq 0x60(%rbx), %r14
movl %eax, %r15d
xorl %r12d, %r12d
movq 0x28(%rsp), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rcx,%r12,8)
movsd (%rsi,%r12,8), %xmm0
movsd %xmm0, (%rdx,%r12,8)
movsd (%rdi,%r12,8), %xmm0
movsd %xmm0, (%r8,%r12,8)
cvttsd2si (%r9,%r12,8), %ebp
movl %ebp, (%r10,%r12,4)
movl 0x7c(%rbx), %r13d
testq %r13, %r13
je 0xab81
shlq $0x3, %r13
leaq (%r13,%r13,2), %r13
xorl %ebp, %ebp
movq (%r11,%rbp), %rax
movsd (%rax,%r12,8), %xmm0
movq (%r14,%rbp), %rax
movsd %xmm0, (%rax,%r12,8)
addq $0x18, %rbp
cmpq %rbp, %r13
jne 0xab64
incq %r12
cmpq %r15, %r12
jne 0xab1d
leaq 0x128(%rsp), %rdi
callq 0xbb88
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0xabad
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0xabca
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xabe7
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xac04
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0xac21
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movq (%rbx), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x100(%rbx)
leaq 0x140(%rsp), %rdi
callq 0xbf28
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0xac62
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x6460
leaq 0x30(%rsp), %rdi
callq 0xbb88
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rsi
leaq 0x32868(%rip), %rdi     # 0x3d4f0
xorl %eax, %eax
callq 0x6050
movl $0x1, %edi
callq 0x64e0
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0xacbe
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
jmp 0xacbe
movq %rax, %rbx
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0xacda
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
jmp 0xacda
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0xacfc
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
jmp 0xacfc
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xad1e
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
jmp 0xad1e
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xad40
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
jmp 0xad40
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0xad6a
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
jmp 0xad6a
jmp 0xad67
jmp 0xadb4
jmp 0xad79
jmp 0xad79
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0xbf28
jmp 0xadcb
movq %rax, %rbx
jmp 0xadf0
jmp 0xadb4
jmp 0xadb4
jmp 0xadb4
jmp 0xadb4
jmp 0xadb4
jmp 0xadb4
jmp 0xadb4
jmp 0xadb4
jmp 0xad92
jmp 0xadbb
movq %rax, %rbx
movq 0x140(%rsp), %rdi
cmpq %rbp, %rdi
je 0xadcb
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x6460
jmp 0xadcb
movq %rax, %rbx
jmp 0xadcb
jmp 0xadbb
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x60e0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0xadf0
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x6460
leaq 0x30(%rsp), %rdi
callq 0xbb88
movq %rbx, %rdi
callq 0x6710