// File: lagoproject[P]arti/analysis/analysis.cc
// Function: main
int main(int argc, char *argv[]) {

  char nfi[256]; // filename container
  char *ifiname=NULL; // input
  int block=0;

  // reading arguments from command line
  for (int i=1;i<argc;i++) {
    char *tmparg=argv[i];
    if (*tmparg=='-') {
      switch (*(tmparg+1)) {
        case 'v':
          iverbose=1;
          break;
        case 'p':
          iprim=1;
          break;
        case 'f':
          iforce=1;
          break;
        case 'd':
          idegub=1;
          break;
        case 'i':
          iinclude=1;
          break;
        case 'c':
		  icurve=1;
		  i++;
		  h=(double)(atof(argv[i])*100.); // calculation is in cm...
		  hInM=h*cm2m;
		  break;
        case '?':
        default:
          Usage(argv[0]);
          break;
      }
    }
    else {
      ifiname=argv[i];
    }
  }
  if (!ifiname) {
    cerr << endl << "Error: Missing filename" << endl << endl;
    Usage(argv[0]);
  }
  //open input
  snprintf(nfi,256,"%s",ifiname);
  Open(nfi);
  //open output
  char *ifile2;
  char ifile[256];
  ifile2=ifiname;
  //remove dirs
  if (strrchr(ifile2,'/')!=NULL) {
    ifile2=strrchr(ifile2,'/')+1;
  }
  snprintf(ifile, 256,"%s",ifile2);
  if (strrchr(ifile,'.')!=NULL) {
    if (strncmp(strrchr(ifile,'.'),".bz2",4)==0) { // remove .bz2 if present
      *(strrchr(ifile,'.'))='\0';
    }
  }
  if (strrchr(ifile,'.')!=NULL) {
    if (strncmp(strrchr(ifile,'.'),".dat",4)==0) { // remove .dat if present
      *(strrchr(ifile,'.'))='\0';
    }
  }

  // open output file (.bz2) via popen
  //secondaries
  snprintf(nfi,256,"bzip2 -9z > %s.sec.bz2",ifile);
  if ((sec = popen(nfi,"w"))==NULL) {
    fprintf(stderr,"Failed to open compressed secondaries file. Abort.\n");
    exit(1);
  }
  fprintf(sec, "# # # sec\n");
  fprintf(sec, "# # This is the Secondaries file - ARTI     %s\n", VERSION);
  if (icurve)
	  fprintf(sec, "# # Curve mode was enabled and observation level is %.0lf m a.s.l. XYZ is printed instead of x'y't\n",hInM);
  fprintf(sec, "# # 12 column format is:\n");
  if (icurve)
	  fprintf(sec, "# # CorsikaId px py pz x y z shower_id prm_id prm_energy prm_theta prm_phi\n");
  else
	  fprintf(sec, "# # CorsikaId px py pz x' y' t shower_id prm_id prm_energy prm_theta prm_phi\n");
  if (iforce)
    cerr << "WARNING! Force mode is enabled. Consistency checks will be ignorated\n";
  //primaries
  if (iprim) {
    snprintf(nfi,256,"bzip2 -9z > %s.pri.bz2",ifile);
    if ((pri = popen(nfi,"w"))==NULL) {
      fprintf(stderr,"Failed to open compressed primaries file. Abort.\n");
      exit(1);
    }
    fprintf(pri, "# # # pri\n");
    fprintf(pri, "# # This is the Primaries file - ARTI     %s\n", VERSION);
    fprintf(pri, "# # 10 column format is:\n");
    fprintf(pri, "# # prm_Crk_id prm_energy prm_x0 prm_theta prm_phi ph_obs_lev el_obs_lev hd_obs_lev mu_obs_lev tot_obs_lev\n");
  }

  if (iforce)
    cerr << "WARNING! Force mode is enabled. Consistency checks will be ignorated\n";

  // stop talking, let's work

  for (int i=0; i<block_size; i++)
    data_block[i] = run_header[i] = evt_header[i] = evt_footer[i] = run_footer[i] = 0.;

  // Reading RUN HEADER (273=7x39)
  if (iverbose)
    cerr << "Files opened. Reading run header" << endl;
  if (!ReadBlock(run_header, 1) || bad_block)
    if (!iforce)
      exit(1);
  if (iinclude) {
    fprintf(sec, "# r");
    for (int i=0; i<block_size; i++)
      fprintf(sec, " %+.5E", run_header[i]);
    fprintf(sec, "\n");
  } 
  // Everything ok, continue
  // events
  // event header
  events=true;
  while (events) {
    if (!ReadBlock(evt_header, 2) || bad_block)
      if (!iforce)
        exit(1);
    if (!events)
      break;
    //reading data blocks for this events
    shower_id++;
    if (iverbose)
      cerr << "Reading event " << shower_id << endl;
    block = 1;
    b_data=true;
    if (iinclude) {
      fprintf(sec, "# h");
      for (int i=0; i<block_size; i++)
        fprintf(sec, " %+.5E", evt_header[i]);
      fprintf(sec, "\n");
    }
     
    if (iprim) {
      evt_buffer[0] = evt_header[2];
      evt_buffer[1] = evt_header[3];
      evt_buffer[2] = evt_header[6]/1e5;
      evt_buffer[3] = rad2deg(evt_header[10]);
      evt_buffer[4] = rad2deg(evt_header[11]);
    }
    while (b_data) {
      if (!ReadDataBlock(data_block, block))
        if (!iforce)
          exit(1);
      if (!b_data)
        break;
      for (int i=0; i<block_rows; i++) {
      if (iverbose)
        fprintf(stderr, "Reading block: %08d\r", block);
      if (data_block[i*block_cols]) {
        if (data_block[i*block_cols]>0) {
			x = data_block[i*block_cols+4];
			y = data_block[i*block_cols+5];
			z = data_block[i*block_cols+6];
			if (icurve)
			  curved(data_block[i*block_cols+4], data_block[i*block_cols+5]);
            fprintf (
              sec, "%04d %+.5E %+.5E %+.5E %+.5E %+.5E %+.5E %08ld %04d %+.5E %+07.3lf %+08.3lf\n",
              int(data_block[i*block_cols+0]/1000.),
              data_block[i*block_cols+1], 
              data_block[i*block_cols+2], 
              data_block[i*block_cols+3], 
              x,
			  y,
			  z,
              shower_id,
              int(evt_header[2]),
              evt_header[3],
              rad2deg(evt_header[10]),
              rad2deg(evt_header[11])
            ); 
            fflush(sec);
            counter++;
        }
      }
      else { // no more particles
          if (iverbose)
            fprintf(stderr,"\nNo more particles for this event.\n");
          b_data=false;
          break;
      }
    }
    block++;
    }
    if (!evt_footer[0])
      if (!ReadBlock(evt_footer, 3) || bad_block)
        if (!iforce)
          exit(1);
    if (iinclude) {
      fprintf(sec, "# f");
      for (int i=0; i<block_size; i++)
        fprintf(sec, " %+.5E", evt_footer[i]);
      fprintf(sec, "\n");
    } 
    if (iprim) {
      fprintf (
        pri, "%04d %+.5E %+.5E %+08.3lf %+08.3lf %+.5E %+.5E %+.5E %+.5E %+.5E\n",
        int(evt_buffer[0]),
        evt_buffer[1],
        evt_buffer[2],
        evt_buffer[3],
        evt_buffer[4],
        evt_footer[2],
        evt_footer[3],
        evt_footer[4],
        evt_footer[5],
        evt_footer[6]
      );
      for (int i=0; i<block_size; i++)
        evt_footer[i] = 0.;
    }
    else
      evt_footer[0] = 0.; // force lecture of the new event footer
  }
  fprintf(sec, "# # %ld lines read on %ld secondaries for %ld showers\n", lines, counter, shower_id);
  fprintf(stderr, "%ld lines read on %ld secondaries for %ld showers\nEverything fine. Goodbye\n\n", lines, counter, shower_id);
  pclose(sec);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x118(%rbp)
movl $0x0, -0x11c(%rbp)
movl $0x1, -0x120(%rbp)
movl -0x120(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x1eb5
movq -0x10(%rbp), %rax
movslq -0x120(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x1e89
movq -0x128(%rbp), %rax
movsbl 0x1(%rax), %eax
addl $-0x3f, %eax
movl %eax, %ecx
movq %rcx, -0x250(%rbp)
subl $0x37, %eax
ja 0x1e79
movq -0x250(%rbp), %rax
leaq 0x1262(%rip), %rcx      # 0x3030
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, 0x5e83(%rip)      # 0x7c64
jmp 0x1e87
movl $0x1, 0x5e78(%rip)      # 0x7c68
jmp 0x1e87
movl $0x1, 0x5e75(%rip)      # 0x7c74
jmp 0x1e87
movl $0x1, 0x5e5e(%rip)      # 0x7c6c
jmp 0x1e87
movl $0x1, 0x5e56(%rip)      # 0x7c70
jmp 0x1e87
movl $0x1, 0x5e52(%rip)      # 0x7c78
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
movq -0x10(%rbp), %rax
movslq -0x120(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1110
movsd 0x11c7(%rip), %xmm1     # 0x3018
mulsd %xmm1, %xmm0
movsd %xmm0, 0x5e3b(%rip)     # 0x7c98
movsd 0x5e33(%rip), %xmm0     # 0x7c98
mulsd 0x32ab(%rip), %xmm0     # 0x5118
movsd %xmm0, 0x5e2b(%rip)     # 0x7ca0
jmp 0x1e87
jmp 0x1e79
movq -0x10(%rbp), %rax
movq (%rax), %rdi
xorl %esi, %esi
callq 0x1a90
jmp 0x1e9f
movq -0x10(%rbp), %rax
movslq -0x120(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x118(%rbp)
jmp 0x1ea1
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
jmp 0x1d68
cmpq $0x0, -0x118(%rbp)
jne 0x1f0d
movq 0x312a(%rip), %rdi      # 0x4ff0
movq 0x30e3(%rip), %rsi      # 0x4fb0
callq 0x10c0
movq %rax, %rdi
leaq 0x179c(%rip), %rsi      # 0x3678
callq 0x10b0
movq %rax, %rdi
movq 0x30c5(%rip), %rsi      # 0x4fb0
callq 0x10c0
movq %rax, %rdi
movq 0x30b6(%rip), %rsi      # 0x4fb0
callq 0x10c0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
xorl %esi, %esi
callq 0x1a90
leaq -0x110(%rbp), %rdi
movq -0x118(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x1224(%rip), %rdx      # 0x314b
movb $0x0, %al
callq 0x1160
leaq -0x110(%rbp), %rdi
callq 0x12e0
movq -0x118(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rdi
movl $0x2f, %esi
callq 0x10d0
cmpq $0x0, %rax
je 0x1f7b
movq -0x130(%rbp), %rdi
movl $0x2f, %esi
callq 0x10d0
addq $0x1, %rax
movq %rax, -0x130(%rbp)
leaq -0x230(%rbp), %rdi
movq -0x130(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x11b6(%rip), %rdx      # 0x314b
movb $0x0, %al
callq 0x1160
leaq -0x230(%rbp), %rdi
movl $0x2e, %esi
callq 0x10d0
cmpq $0x0, %rax
je 0x1ff3
leaq -0x230(%rbp), %rdi
movl $0x2e, %esi
callq 0x10d0
movq %rax, %rdi
leaq 0x16d9(%rip), %rsi      # 0x36a7
movl $0x4, %edx
callq 0x1070
cmpl $0x0, %eax
jne 0x1ff1
leaq -0x230(%rbp), %rdi
movl $0x2e, %esi
callq 0x10d0
movb $0x0, (%rax)
jmp 0x1ff3
leaq -0x230(%rbp), %rdi
movl $0x2e, %esi
callq 0x10d0
cmpq $0x0, %rax
je 0x204a
leaq -0x230(%rbp), %rdi
movl $0x2e, %esi
callq 0x10d0
movq %rax, %rdi
leaq 0x166b(%rip), %rsi      # 0x3690
movl $0x4, %edx
callq 0x1070
cmpl $0x0, %eax
jne 0x2048
leaq -0x230(%rbp), %rdi
movl $0x2e, %esi
callq 0x10d0
movb $0x0, (%rax)
jmp 0x204a
leaq -0x110(%rbp), %rdi
leaq -0x230(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x1631(%rip), %rdx      # 0x3695
movb $0x0, %al
callq 0x1160
leaq -0x110(%rbp), %rdi
leaq 0x1633(%rip), %rsi      # 0x36ac
callq 0x1050
movq %rax, 0x30bb(%rip)      # 0x5140
cmpq $0x0, %rax
jne 0x20ad
movq 0x2f3e(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
leaq 0x1612(%rip), %rsi      # 0x36ae
movb $0x0, %al
callq 0x1130
movl $0x1, %edi
callq 0x1100
movq 0x308c(%rip), %rdi      # 0x5140
leaq 0x1627(%rip), %rsi      # 0x36e2
movb $0x0, %al
callq 0x1130
movq 0x3077(%rip), %rdi      # 0x5140
leaq 0x161d(%rip), %rsi      # 0x36ed
leaq 0x1207(%rip), %rdx      # 0x32de
movb $0x0, %al
callq 0x1130
cmpl $0x0, 0x5b93(%rip)      # 0x7c78
je 0x2104
movq 0x3052(%rip), %rdi      # 0x5140
movsd 0x5baa(%rip), %xmm0     # 0x7ca0
leaq 0x1620(%rip), %rsi      # 0x371d
movb $0x1, %al
callq 0x1130
movq 0x3035(%rip), %rdi      # 0x5140
leaq 0x166f(%rip), %rsi      # 0x3781
movb $0x0, %al
callq 0x1130
cmpl $0x0, 0x5b58(%rip)      # 0x7c78
je 0x2139
movq 0x3017(%rip), %rdi      # 0x5140
leaq 0x166b(%rip), %rsi      # 0x379b
movb $0x0, %al
callq 0x1130
jmp 0x214e
movq 0x3000(%rip), %rdi      # 0x5140
leaq 0x16a0(%rip), %rsi      # 0x37e7
movb $0x0, %al
callq 0x1130
cmpl $0x0, 0x5b1f(%rip)      # 0x7c74
je 0x216a
movq 0x2e92(%rip), %rdi      # 0x4ff0
leaq 0x16d0(%rip), %rsi      # 0x3835
callq 0x10b0
cmpl $0x0, 0x5af7(%rip)      # 0x7c68
je 0x2235
leaq -0x110(%rbp), %rdi
leaq -0x230(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x16ea(%rip), %rdx      # 0x387b
movb $0x0, %al
callq 0x1160
leaq -0x110(%rbp), %rdi
leaq 0x1506(%rip), %rsi      # 0x36ac
callq 0x1050
movq %rax, 0x2f96(%rip)      # 0x5148
cmpq $0x0, %rax
jne 0x21da
movq 0x2e11(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
leaq 0x16c9(%rip), %rsi      # 0x3892
movb $0x0, %al
callq 0x1130
movl $0x1, %edi
callq 0x1100
movq 0x2f67(%rip), %rdi      # 0x5148
leaq 0x16dc(%rip), %rsi      # 0x38c4
movb $0x0, %al
callq 0x1130
movq 0x2f52(%rip), %rdi      # 0x5148
leaq 0x16d2(%rip), %rsi      # 0x38cf
leaq 0x10da(%rip), %rdx      # 0x32de
movb $0x0, %al
callq 0x1130
movq 0x2f36(%rip), %rdi      # 0x5148
leaq 0x16e4(%rip), %rsi      # 0x38fd
movb $0x0, %al
callq 0x1130
movq 0x2f21(%rip), %rdi      # 0x5148
leaq 0x16e9(%rip), %rsi      # 0x3917
movb $0x0, %al
callq 0x1130
cmpl $0x0, 0x5a38(%rip)      # 0x7c74
je 0x2251
movq 0x2dab(%rip), %rdi      # 0x4ff0
leaq 0x15e9(%rip), %rsi      # 0x3835
callq 0x10b0
movl $0x0, -0x234(%rbp)
cmpl $0x111, -0x234(%rbp)    # imm = 0x111
jge 0x22ed
movslq -0x234(%rbp), %rcx
leaq 0x5117(%rip), %rax      # 0x7390
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movslq -0x234(%rbp), %rcx
leaq 0x4871(%rip), %rax      # 0x6b00
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movslq -0x234(%rbp), %rcx
leaq 0x3fcb(%rip), %rax      # 0x6270
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movslq -0x234(%rbp), %rcx
leaq 0x3725(%rip), %rax      # 0x59e0
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movslq -0x234(%rbp), %rcx
leaq 0x2e7f(%rip), %rax      # 0x5150
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x234(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x234(%rbp)
jmp 0x225b
cmpl $0x0, 0x5970(%rip)      # 0x7c64
je 0x2318
movq 0x2cf3(%rip), %rdi      # 0x4ff0
leaq 0x167f(%rip), %rsi      # 0x3983
callq 0x10b0
movq %rax, %rdi
movq 0x2c9d(%rip), %rsi      # 0x4fb0
callq 0x10c0
leaq 0x36c1(%rip), %rdi      # 0x59e0
movl $0x1, %esi
callq 0x13f0
cmpl $0x0, %eax
je 0x2337
cmpl $0x0, 0x592b(%rip)      # 0x7c60
je 0x234c
cmpl $0x0, 0x5936(%rip)      # 0x7c74
jne 0x234a
movl $0x1, %edi
callq 0x1100
jmp 0x234c
cmpl $0x0, 0x591d(%rip)      # 0x7c70
je 0x23ce
movq 0x2de4(%rip), %rdi      # 0x5140
leaq 0x1641(%rip), %rsi      # 0x39a4
movb $0x0, %al
callq 0x1130
movl $0x0, -0x238(%rbp)
cmpl $0x111, -0x238(%rbp)    # imm = 0x111
jge 0x23b9
movq 0x2db9(%rip), %rdi      # 0x5140
movslq -0x238(%rbp), %rcx
leaq 0x364b(%rip), %rax      # 0x59e0
movsd (%rax,%rcx,8), %xmm0
leaq 0x1607(%rip), %rsi      # 0x39a8
movb $0x1, %al
callq 0x1130
movl -0x238(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x238(%rbp)
jmp 0x2374
movq 0x2d80(%rip), %rdi      # 0x5140
leaq 0x1749(%rip), %rsi      # 0x3b10
movb $0x0, %al
callq 0x1130
movb $0x1, 0x2d33(%rip)      # 0x5108
testb $0x1, 0x2d2c(%rip)      # 0x5108
je 0x2a7d
leaq 0x3e87(%rip), %rdi      # 0x6270
movl $0x2, %esi
callq 0x13f0
cmpl $0x0, %eax
je 0x2401
cmpl $0x0, 0x5861(%rip)      # 0x7c60
je 0x2416
cmpl $0x0, 0x586c(%rip)      # 0x7c74
jne 0x2414
movl $0x1, %edi
callq 0x1100
jmp 0x2416
testb $0x1, 0x2ceb(%rip)      # 0x5108
jne 0x2424
jmp 0x2a7d
movq 0x5825(%rip), %rax      # 0x7c50
addq $0x1, %rax
movq %rax, 0x581a(%rip)      # 0x7c50
cmpl $0x0, 0x5827(%rip)      # 0x7c64
je 0x2470
movq 0x2baa(%rip), %rdi      # 0x4ff0
leaq 0x1562(%rip), %rsi      # 0x39af
callq 0x10b0
movq %rax, %rdi
movq 0x57f4(%rip), %rsi      # 0x7c50
callq 0x1180
movq %rax, %rdi
movq 0x2b45(%rip), %rsi      # 0x4fb0
callq 0x10c0
movl $0x1, -0x11c(%rbp)
movb $0x1, 0x2c88(%rip)      # 0x5109
cmpl $0x0, 0x57e8(%rip)      # 0x7c70
je 0x2503
movq 0x2caf(%rip), %rdi      # 0x5140
leaq 0x1526(%rip), %rsi      # 0x39be
movb $0x0, %al
callq 0x1130
movl $0x0, -0x23c(%rbp)
cmpl $0x111, -0x23c(%rbp)    # imm = 0x111
jge 0x24ee
movq 0x2c84(%rip), %rdi      # 0x5140
movslq -0x23c(%rbp), %rcx
leaq 0x3da6(%rip), %rax      # 0x6270
movsd (%rax,%rcx,8), %xmm0
leaq 0x14d2(%rip), %rsi      # 0x39a8
movb $0x1, %al
callq 0x1130
movl -0x23c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x23c(%rbp)
jmp 0x24a9
movq 0x2c4b(%rip), %rdi      # 0x5140
leaq 0x1614(%rip), %rsi      # 0x3b10
movb $0x0, %al
callq 0x1130
cmpl $0x0, 0x575e(%rip)      # 0x7c68
je 0x2572
movsd 0x3d6c(%rip), %xmm0     # 0x6280
movsd %xmm0, 0x5704(%rip)     # 0x7c20
movsd 0x3d64(%rip), %xmm0     # 0x6288
movsd %xmm0, 0x56fc(%rip)     # 0x7c28
movsd 0x3d6c(%rip), %xmm0     # 0x62a0
movsd 0xacc(%rip), %xmm1      # 0x3008
divsd %xmm1, %xmm0
movsd %xmm0, 0x56e8(%rip)     # 0x7c30
movsd 0x3d70(%rip), %xmm0     # 0x62c0
callq 0x2af0
movsd %xmm0, 0x56db(%rip)     # 0x7c38
movsd 0x3d63(%rip), %xmm0     # 0x62c8
callq 0x2af0
movsd %xmm0, 0x56ce(%rip)     # 0x7c40
jmp 0x2574
testb $0x1, 0x2b8e(%rip)      # 0x5109
je 0x28ea
movl -0x11c(%rbp), %esi
leaq 0x2bc2(%rip), %rdi      # 0x5150
callq 0x1810
cmpl $0x0, %eax
jne 0x25ad
cmpl $0x0, 0x56d5(%rip)      # 0x7c74
jne 0x25ab
movl $0x1, %edi
callq 0x1100
jmp 0x25ad
testb $0x1, 0x2b55(%rip)      # 0x5109
jne 0x25bb
jmp 0x28ea
movl $0x0, -0x240(%rbp)
cmpl $0x27, -0x240(%rbp)
jge 0x28d6
cmpl $0x0, 0x568b(%rip)      # 0x7c64
je 0x25f9
movq 0x29ee(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
movl -0x11c(%rbp), %edx
leaq 0x13d0(%rip), %rsi      # 0x39c2
movb $0x0, %al
callq 0x1130
imull $0x7, -0x240(%rbp), %eax
movslq %eax, %rcx
leaq 0x2b46(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x261f
jp 0x261f
jmp 0x2896
imull $0x7, -0x240(%rbp), %eax
movslq %eax, %rcx
leaq 0x2b20(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2894
imull $0x7, -0x240(%rbp), %eax
addl $0x4, %eax
movslq %eax, %rcx
leaq 0x2afa(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x561d(%rip)     # 0x7c80
imull $0x7, -0x240(%rbp), %eax
addl $0x5, %eax
movslq %eax, %rcx
leaq 0x2ad9(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x5604(%rip)     # 0x7c88
imull $0x7, -0x240(%rbp), %eax
addl $0x6, %eax
movslq %eax, %rcx
leaq 0x2ab8(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x55eb(%rip)     # 0x7c90
cmpl $0x0, 0x55cc(%rip)      # 0x7c78
je 0x26e5
imull $0x7, -0x240(%rbp), %eax
addl $0x4, %eax
movslq %eax, %rcx
leaq 0x2a8e(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm0
imull $0x7, -0x240(%rbp), %eax
addl $0x5, %eax
movslq %eax, %rcx
leaq 0x2a75(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm1
callq 0x16d0
movq 0x2a54(%rip), %rax      # 0x5140
movq %rax, -0x2b0(%rbp)
imull $0x7, -0x240(%rbp), %eax
addl $0x0, %eax
movslq %eax, %rcx
leaq 0x2a49(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm0
movsd 0x8fc(%rip), %xmm1      # 0x3010
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x2a4(%rbp)
imull $0x7, -0x240(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x2a1a(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x258(%rbp)
imull $0x7, -0x240(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq 0x29f9(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x2a0(%rbp)
imull $0x7, -0x240(%rbp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq 0x29d8(%rip), %rax      # 0x5150
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x298(%rbp)
movsd 0x54f3(%rip), %xmm0     # 0x7c80
movsd %xmm0, -0x290(%rbp)
movsd 0x54eb(%rip), %xmm0     # 0x7c88
movsd %xmm0, -0x288(%rbp)
movsd 0x54e3(%rip), %xmm0     # 0x7c90
movsd %xmm0, -0x280(%rbp)
movq 0x5494(%rip), %rax      # 0x7c50
movq %rax, -0x278(%rbp)
cvttsd2si 0x3ab5(%rip), %eax # 0x6280
movl %eax, -0x26c(%rbp)
movsd 0x3aaf(%rip), %xmm0     # 0x6288
movsd %xmm0, -0x268(%rbp)
movsd 0x3ad7(%rip), %xmm0     # 0x62c0
callq 0x2af0
movsd %xmm0, -0x260(%rbp)
movsd 0x3aca(%rip), %xmm0     # 0x62c8
callq 0x2af0
movq -0x2b0(%rbp), %rdi
movl -0x2a4(%rbp), %edx
movsd -0x2a0(%rbp), %xmm1
movsd -0x298(%rbp), %xmm2
movsd -0x290(%rbp), %xmm3
movsd -0x288(%rbp), %xmm4
movsd -0x280(%rbp), %xmm5
movq -0x278(%rbp), %rcx
movl -0x26c(%rbp), %r8d
movsd -0x268(%rbp), %xmm6
movsd -0x260(%rbp), %xmm7
movaps %xmm0, %xmm8
movsd -0x258(%rbp), %xmm0
leaq 0x116e(%rip), %rsi      # 0x39d7
movsd %xmm8, (%rsp)
movb $0x8, %al
callq 0x1130
movq 0x28c3(%rip), %rdi      # 0x5140
callq 0x10f0
movq 0x53cf(%rip), %rax      # 0x7c58
addq $0x1, %rax
movq %rax, 0x53c4(%rip)      # 0x7c58
jmp 0x28c0
cmpl $0x0, 0x53c7(%rip)      # 0x7c64
je 0x28b7
movq 0x272a(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
leaq 0x1174(%rip), %rsi      # 0x3a24
movb $0x0, %al
callq 0x1130
movb $0x0, 0x284b(%rip)      # 0x5109
jmp 0x28d6
jmp 0x28c2
movl -0x240(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x240(%rbp)
jmp 0x25c5
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x2574
movsd 0x420e(%rip), %xmm0     # 0x6b00
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2933
jp 0x2933
leaq 0x41fc(%rip), %rdi      # 0x6b00
movl $0x3, %esi
callq 0x13f0
cmpl $0x0, %eax
je 0x291c
cmpl $0x0, 0x5346(%rip)      # 0x7c60
je 0x2931
cmpl $0x0, 0x5351(%rip)      # 0x7c74
jne 0x292f
movl $0x1, %edi
callq 0x1100
jmp 0x2931
jmp 0x2933
cmpl $0x0, 0x5336(%rip)      # 0x7c70
je 0x29b5
movq 0x27fd(%rip), %rdi      # 0x5140
leaq 0x10fe(%rip), %rsi      # 0x3a48
movb $0x0, %al
callq 0x1130
movl $0x0, -0x244(%rbp)
cmpl $0x111, -0x244(%rbp)    # imm = 0x111
jge 0x29a0
movq 0x27d2(%rip), %rdi      # 0x5140
movslq -0x244(%rbp), %rcx
leaq 0x4184(%rip), %rax      # 0x6b00
movsd (%rax,%rcx,8), %xmm0
leaq 0x1020(%rip), %rsi      # 0x39a8
movb $0x1, %al
callq 0x1130
movl -0x244(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x244(%rbp)
jmp 0x295b
movq 0x2799(%rip), %rdi      # 0x5140
leaq 0x1162(%rip), %rsi      # 0x3b10
movb $0x0, %al
callq 0x1130
cmpl $0x0, 0x52ac(%rip)      # 0x7c68
je 0x2a6d
movq 0x277f(%rip), %rdi      # 0x5148
cvttsd2si 0x524f(%rip), %edx # 0x7c20
movsd 0x524f(%rip), %xmm0     # 0x7c28
movsd 0x524f(%rip), %xmm1     # 0x7c30
movsd 0x524f(%rip), %xmm2     # 0x7c38
movsd 0x524f(%rip), %xmm3     # 0x7c40
movsd 0x4117(%rip), %xmm4     # 0x6b10
movsd 0x4117(%rip), %xmm5     # 0x6b18
movsd 0x4117(%rip), %xmm6     # 0x6b20
movsd 0x4117(%rip), %xmm7     # 0x6b28
movsd 0x4116(%rip), %xmm8     # 0x6b30
leaq 0x102b(%rip), %rsi      # 0x3a4c
movsd %xmm8, (%rsp)
movb $0x8, %al
callq 0x1130
movl $0x0, -0x248(%rbp)
cmpl $0x111, -0x248(%rbp)    # imm = 0x111
jge 0x2a6b
movslq -0x248(%rbp), %rcx
leaq 0x40ae(%rip), %rax      # 0x6b00
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x248(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x248(%rbp)
jmp 0x2a38
jmp 0x2a78
xorps %xmm0, %xmm0
movsd %xmm0, 0x4088(%rip)     # 0x6b00
jmp 0x23d5
movq 0x26bc(%rip), %rdi      # 0x5140
movq 0x51bd(%rip), %rdx      # 0x7c48
movq 0x51c6(%rip), %rcx      # 0x7c58
movq 0x51b7(%rip), %r8       # 0x7c50
leaq 0xfee(%rip), %rsi       # 0x3a8e
movb $0x0, %al
callq 0x1130
movq 0x2522(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
movq 0x5190(%rip), %rdx      # 0x7c48
movq 0x5199(%rip), %rcx      # 0x7c58
movq 0x518a(%rip), %r8       # 0x7c50
leaq 0xff8(%rip), %rsi       # 0x3ac5
movb $0x0, %al
callq 0x1130
movq 0x2665(%rip), %rdi      # 0x5140
callq 0x1120
movl -0x4(%rbp), %eax
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
nopl (%rax)