// File: /workspace/github_c_makefile_star2_O2/thegenemyers[P]DASCRUBBER/DAScover.c
// Function: main
int main(int argc, char *argv[])
{ char  *root, *dpwd;
  int64  novl, hgap64;
  int    c;

  DAZZ_EXTRA ex_covr, ex_hgap;

  //  Process arguments

  { int  i, j, k;
    int  flags[128];
    char *eptr;
    int   mmax;

    ARG_INIT("DAScover")

    HGAP_MIN = 0;
    NUM_MASK = 0;

    mmax  = 10;
    MASKS = (Mask *) Malloc(mmax*sizeof(Mask),"Allocating mask array");
    if (MASKS == NULL)
      exit (1);

    j = 1;
    for (i = 1; i < argc; i++)
      if (argv[i][0] == '-')
        switch (argv[i][1])
        { default:
            ARG_FLAGS("v")
            break;
          case 'm':
            if (NUM_MASK >= mmax)
              { mmax  = 1.2*NUM_MASK + 10;
                MASKS = (Mask *) Realloc(MASKS,mmax*sizeof(Mask),"Reallocating mask array");
                if (MASKS == NULL)
                  exit (1);
              }
            MASKS[NUM_MASK++].name = argv[i]+2;
            break;
          case 'H':
            ARG_POSITIVE(HGAP_MIN,"HGAP threshold (in bp.s)")
            break;
        }
      else
        argv[j++] = argv[i];
    argc = j;

    VERBOSE = flags['v'];

    if (argc < 3)
      { fprintf(stderr,"Usage: %s %s\n",Prog_Name,Usage);
        fprintf(stderr,"\n");
        fprintf(stderr,"      -v: Verbose mode, output statistics as proceed.\n");
        fprintf(stderr,"      -H: HGAP minimum length threshold.\n");
        fprintf(stderr,"      -m: repeat masks, stats not collected over these intervals\n");
        exit (1);
      }
  }

  //  Open trimmed DB and any mask tracks

  { DAZZ_TRACK *track;
    int64      *anno;
    int         status, kind;
    int         i, j, k;

    status = Open_DB(argv[1],DB);
    if (status < 0)
      exit (1);
    if (status == 1)
      { fprintf(stderr,"%s: Cannot be called on a .dam index: %s\n",Prog_Name,argv[1]);
        exit (1);
      }
    if (DB->part)
      { fprintf(stderr,"%s: Cannot be called on a block: %s\n",Prog_Name,argv[1]);
        exit (1);
      }
    Trim_DB(DB);
    Reads = DB->reads;

    k = 0;
    for (i = 0; i < NUM_MASK; i++)
      { status = Check_Track(DB,MASKS[i].name,&kind);
        switch (status)
        { case 0:
            fprintf(stderr,"%s: [WARNING] %s track is for the *un*trimmed DB?\n",
                           Prog_Name,MASKS[i].name);
            continue;
          case -1:
            fprintf(stderr,"%s: [WARNING] %s track size not correct for trimmed DB.\n",
                           Prog_Name,MASKS[i].name);
            continue;
          case -2:
            fprintf(stderr,"%s: [WARNING] -m%s option given but no track found.\n",
                           Prog_Name,MASKS[i].name);
            continue;
          default:
            if (kind != MASK_TRACK)
              { fprintf(stderr,"%s: [WARNING] %s track is not a mask track.\n",
                               Prog_Name,MASKS[i].name);
                continue;
              }
            break;
        }

        track = Open_Track(DB,MASKS[i].name);
        Load_All_Track_Data(track);

        anno = (int64 *) (track->anno);
        for (j = 0; j <= DB->nreads; j++)
          anno[j] /= sizeof(int);

        MASKS[k].name = MASKS[i].name;
        MASKS[k].idx  = anno;
        MASKS[k].data = (int *) (track->data);
        k += 1;
      }
    NUM_MASK = k;
  }

  //  Determine if overlap block is being processed and if so get first and last read
  //    from .db file

  ex_covr.vtype = DB_INT;
  ex_covr.nelem = MAX_COVER+1;
  ex_covr.accum = DB_SUM;
  ex_covr.name  = Cov_Name;
  ex_covr.value = Cov_Hist; 

  ex_hgap.vtype = DB_INT;
  ex_hgap.nelem = 1;
  ex_hgap.accum = DB_EXACT;
  ex_hgap.name  = Hgap_Name;
  hgap64 = HGAP_MIN;
  ex_hgap.value = &hgap64;

  dpwd = PathTo(argv[1]);
  root = Root(argv[1],".db");

  for (c = 2; c < argc; c++)
    { Block_Looper *parse;
      FILE         *input;

      parse = Parse_Block_LAS_Arg(argv[c]);

      while ((input = Next_Block_Arg(parse)) != NULL)
        { DB_PART  = 0;
          DB_FIRST = 0;
          DB_LAST  = DB->nreads;

          { FILE *dbfile;
            char  buffer[2*MAX_NAME+100];
            char *p, *eptr;
            int   i, part, nfiles, nblocks, cutoff, all, oindx;
            int64 size;

            p = rindex(Block_Arg_Root(parse),'.');
            if (p != NULL)
              { part = strtol(p+1,&eptr,10);
                if (*eptr == '\0' && eptr != p+1)
                  { dbfile = Fopen(Catenate(dpwd,"/",root,".db"),"r");
                    if (dbfile == NULL)
                      exit (1);
                    if (fscanf(dbfile,DB_NFILE,&nfiles) != 1)
                      SYSTEM_READ_ERROR
                    for (i = 0; i < nfiles; i++)
                      if (fgets(buffer,2*MAX_NAME+100,dbfile) == NULL)
                        SYSTEM_READ_ERROR
                    if (fscanf(dbfile,DB_NBLOCK,&nblocks) != 1)
                      SYSTEM_READ_ERROR
                    if (fscanf(dbfile,DB_PARAMS,&size,&cutoff,&all) != 3)
                      SYSTEM_READ_ERROR
                    for (i = 1; i <= part; i++)
                      if (fscanf(dbfile,DB_BDATA,&oindx,&DB_FIRST) != 2)
                        SYSTEM_READ_ERROR
                    if (fscanf(dbfile,DB_BDATA,&oindx,&DB_LAST) != 2)
                      SYSTEM_READ_ERROR
                    fclose(dbfile);
                    DB_PART = part;
                  }
              }
          }

          //  Set up cover extra's track

          if (DB_PART > 0)
           CV_ANAME = Strdup(Catenate(dpwd,PATHSEP,root,
                           Numbered_Suffix(".",DB_PART,".covr.anno")),"Allocating cover anno name");
          else
           CV_ANAME = Strdup(Catenate(dpwd,PATHSEP,root,".covr.anno"),"Allocating cover anno name");
          CV_AFILE = Fopen(CV_ANAME,"w");
          if (CV_ANAME == NULL || CV_AFILE == NULL)
            exit (1);

          { int size, length;

            length = 0;
            size   = 1;
            fwrite(&length,sizeof(int),1,CV_AFILE);
            fwrite(&size,sizeof(int),1,CV_AFILE);
          }

          //  Get trace point spacing information

          fread(&novl,sizeof(int64),1,input);
          fread(&TRACE_SPACING,sizeof(int),1,input);

          //  Initialize statistics gathering

          if (VERBOSE)
            { nreads = 0;
              totlen = 0;
              printf("\nDAScover %s %s\n",argv[1],Block_Arg_Root(parse));
            }

          { int i;

            for (i = 0; i <= MAX_COVER; i++)
              Cov_Hist[i] = 0;
          }

          //  Process each read pile

          make_a_pass(input,HISTOGRAM_COVER,0);

          //  If verbose output statistics summary to stdout

          if (VERBOSE)
            { int   i, cover;
              int64 ssum, stotal;

              printf("\nInput:  ");
              Print_Number(nreads,7,stdout);
              printf(" reads,  ");
              Print_Number(totlen,12,stdout);
              printf(" bases");
              if (HGAP_MIN > 0)
                { printf(" (another ");
                  Print_Number((DB_LAST-DB_FIRST) - nreads,0,stdout);
                  printf(" were < H-length)");
                }
              printf("\n");
 
              stotal = 0;
              for (i = 0; i <= MAX_COVER; i++)
                stotal += Cov_Hist[i];

              printf("\nCoverage Histogram\n\n");
              ssum = Cov_Hist[MAX_COVER];
              if (ssum > 0)
                printf("    %4d:  %9lld  %5.1f%%\n\n",
                       MAX_COVER,Cov_Hist[MAX_COVER],(100.*ssum)/stotal);
              stotal -= ssum;
              ssum    = 0;
              for (i = MAX_COVER-1; i >= 0; i--) 
                if (Cov_Hist[i] > 0)
                  { ssum += Cov_Hist[i];
                    printf("    %4d:  %9lld  %5.1f%%\n",
                           i,Cov_Hist[i],(100.*ssum)/stotal);
                  }

              i = 0;
              while (Cov_Hist[i+1] < Cov_Hist[i])
                i += 1;
              for (cover = i++; i < MAX_COVER; i++)
                if (Cov_Hist[cover] < Cov_Hist[i])
                  cover = i;

              printf("\n  Coverage is estimated at %d\n\n",cover);
            }

          //  Output coverage histogram

          Write_Extra(CV_AFILE,&ex_covr);
          Write_Extra(CV_AFILE,&ex_hgap);

          fclose(CV_AFILE);
          free(CV_ANAME);
          fclose(input);
        }

      Free_Block_Arg(parse);
    }

  free(dpwd);
  free(root);

  Close_DB(DB);
  free(Prog_Name);

  exit (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4f88, %rsp           # imm = 0x4F88
movq %rsi, 0x18(%rsp)
movl %edi, %ebp
leaq 0x16c35(%rip), %rdi     # 0x18020
leaq 0x16fb0(%rip), %rsi     # 0x183a2
callq 0x10bec
leaq 0x1edda(%rip), %rcx     # 0x201d8
movq %rax, (%rcx)
xorl %eax, %eax
cmpq $0x80, %rax
je 0x1418
andl $0x0, 0x100(%rsp,%rax,4)
incq %rax
jmp 0x1403
andl $0x0, 0x1cd81(%rip)     # 0x1e1a0
andl $0x0, 0x1cd7e(%rip)     # 0x1e1a4
leaq 0x16bfc(%rip), %rsi     # 0x18029
movl $0xf0, %edi
callq 0x10b31
movq %rax, 0x1cd6a(%rip)     # 0x1e1a8
testq %rax, %rax
je 0x15f1
movslq %ebp, %rbx
pushq $0x1
popq %r15
pushq $0xa
popq %rax
pushq $0x1
popq %r14
leaq 0x16be3(%rip), %r12     # 0x1803f
movl %eax, 0x8(%rsp)
movq 0x18(%rsp), %rbp
movq %rbx, 0x48(%rsp)
cmpq %rbx, %r14
jge 0x15f9
movq (%rbp,%r14,8), %r13
cmpb $0x2d, (%r13)
jne 0x14b3
movzbl 0x1(%r13), %ebp
cmpl $0x48, %ebp
je 0x14c3
cmpl $0x6d, %ebp
jne 0x1513
movl 0x1cd0c(%rip), %ecx     # 0x1e1a4
movq 0x1cd09(%rip), %rax     # 0x1e1a8
cmpl 0x8(%rsp), %ecx
jge 0x155e
movq 0x18(%rsp), %rbp
jmp 0x15ac
movslq %r15d, %rax
incl %r15d
movq %r13, (%rbp,%rax,8)
jmp 0x15c4
addq $0x2, %r13
movq %r13, %rdi
leaq 0xb0(%rsp), %rsi
pushq $0xa
popq %rdx
callq 0x11d0
movl %eax, 0x1ccc0(%rip)     # 0x1e1a0
movq 0xb0(%rsp), %rcx
cmpb $0x0, (%rcx)
movq 0x18(%rsp), %rbp
movq (%rbp,%r14,8), %r8
jne 0x16cc
cmpb $0x0, 0x2(%r8)
je 0x16cc
testl %eax, %eax
jg 0x15c4
jmp 0x16fc
movl %r15d, %ebx
addq $0x2, %r13
testb %bpl, %bpl
je 0x154f
movsbl %bpl, %r15d
movq %r12, %rdi
movl %r15d, %esi
callq 0x1150
testq %rax, %rax
je 0x15cc
movsbq %bpl, %rax
movl $0x1, 0x100(%rsp,%rax,4)
movb (%r13), %bpl
incq %r13
jmp 0x151a
movq 0x18(%rsp), %rbp
movl %ebx, %r15d
movq 0x48(%rsp), %rbx
jmp 0x15c4
cvtsi2sd %ecx, %xmm0
mulsd 0x16aa6(%rip), %xmm0    # 0x18010
addsd 0x16aa6(%rip), %xmm0    # 0x18018
cvttsd2si %xmm0, %ecx
movl %ecx, 0x8(%rsp)
movslq %ecx, %rcx
imulq $0x18, %rcx, %rsi
movq %rax, %rdi
leaq 0x16ad4(%rip), %rdx     # 0x1805f
callq 0x10b89
movq %rax, 0x1cc11(%rip)     # 0x1e1a8
testq %rax, %rax
movq 0x18(%rsp), %rbp
je 0x15f1
movq (%rbp,%r14,8), %r13
movl 0x1cbf8(%rip), %ecx     # 0x1e1a4
addq $0x2, %r13
leal 0x1(%rcx), %edx
movl %edx, 0x1cbeb(%rip)     # 0x1e1a4
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
movq %r13, (%rax,%rcx)
incq %r14
jmp 0x146a
movq 0x1ca25(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1ebfb(%rip), %rax     # 0x201d8
movq (%rax), %rdx
leaq 0x16a5a(%rip), %rsi     # 0x18041
movl %r15d, %ecx
xorl %eax, %eax
callq 0x11b0
pushq $0x1
popq %rdi
callq 0x1290
movl 0x2d8(%rsp), %eax
movl %eax, 0x1cbaa(%rip)     # 0x1e1b0
cmpl $0x2, %r15d
jg 0x1687
movq 0x1c9e5(%rip), %r14     # 0x1dff8
movq (%r14), %rdi
leaq 0x1ebbb(%rip), %rax     # 0x201d8
movq (%rax), %rdx
leaq 0x16ab0(%rip), %rsi     # 0x180d7
leaq 0x16db0(%rip), %rcx     # 0x183de
xorl %eax, %eax
callq 0x11b0
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x1180
movq (%r14), %rcx
leaq 0x16a9b(%rip), %rdi     # 0x180e5
pushq $0x36
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x12a0
movq (%r14), %rcx
leaq 0x16aba(%rip), %rdi     # 0x1811c
pushq $0x29
popq %rsi
movq %rbx, %rdx
callq 0x12a0
movq (%r14), %rcx
leaq 0x16acf(%rip), %rdi     # 0x18146
pushq $0x41
popq %rsi
movq %rbx, %rdx
callq 0x12a0
jmp 0x15f1
movq 0x8(%rbp), %rdi
leaq 0x1eaae(%rip), %rsi     # 0x20140
callq 0x119d4
testl %eax, %eax
js 0x15f1
cmpl $0x1, %eax
jne 0x172d
movq 0x1c949(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1eb1f(%rip), %rax     # 0x201d8
movq (%rax), %rdx
movq 0x8(%rbp), %rcx
leaq 0x16ac1(%rip), %rsi     # 0x18188
jmp 0x18f6
movq 0x1c925(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1eafb(%rip), %rax     # 0x201d8
movq (%rax), %rdx
movsbl 0x1(%r8), %ecx
addq $0x2, %r8
leaq 0x16987(%rip), %rsi     # 0x18077
xorl %eax, %eax
callq 0x11b0
jmp 0x15f1
movq 0x1c8f5(%rip), %rcx     # 0x1dff8
movq (%rcx), %rdi
leaq 0x1eacb(%rip), %rcx     # 0x201d8
movq (%rcx), %rdx
leaq 0x16989(%rip), %rsi     # 0x180a0
leaq 0x169a0(%rip), %rcx     # 0x180be
movl %eax, %r8d
xorl %eax, %eax
callq 0x11b0
jmp 0x15f1
cmpl $0x0, 0x1ea44(%rip)     # 0x20178
jne 0x18d7
leaq 0x1e9ff(%rip), %r12     # 0x20140
movq %r12, %rdi
callq 0x1227a
movq 0x1ea50(%rip), %rax     # 0x201a0
movq %rax, 0x1ca61(%rip)     # 0x1e1b8
xorl %r13d, %r13d
xorl %ebx, %ebx
movl %r15d, 0x14(%rsp)
movslq 0x1ca3c(%rip), %rax     # 0x1e1a4
cmpq %rax, %r13
jge 0x1902
movq 0x1ca30(%rip), %rax     # 0x1e1a8
imulq $0x18, %r13, %r15
movq (%rax,%r15), %rsi
movq %r12, %rdi
leaq 0x100(%rsp), %rdx
callq 0x1356e
cmpl $-0x2, %eax
je 0x184d
cmpl $-0x1, %eax
je 0x1825
testl %eax, %eax
je 0x1875
cmpl $0x1, 0x100(%rsp)
jne 0x189d
movq 0x1c9e9(%rip), %rax     # 0x1e1a8
movq (%rax,%r15), %rsi
movq %r12, %r14
movq %r12, %rdi
callq 0x13797
movq %rax, %r12
movq %rax, %rdi
callq 0x140f9
movq 0x18(%r12), %rax
movslq 0x1e98b(%rip), %rcx     # 0x20170
xorl %edx, %edx
cmpq %rcx, %rdx
jg 0x17f6
shrq $0x2, (%rax,%rdx,8)
incq %rdx
jmp 0x17e7
movq 0x1c9ab(%rip), %rcx     # 0x1e1a8
movq (%rcx,%r15), %rdx
movslq %ebx, %rsi
imulq $0x18, %rsi, %rsi
movq %rdx, (%rcx,%rsi)
movq %rax, 0x8(%rcx,%rsi)
movq 0x28(%r12), %rax
movq %rax, 0x10(%rcx,%rsi)
incl %ebx
movq %r14, %r12
jmp 0x18ca
movq 0x1c7cc(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1e9a2(%rip), %rax     # 0x201d8
movq (%rax), %rdx
movq 0x1c968(%rip), %rax     # 0x1e1a8
movq (%rax,%r15), %rcx
leaq 0x169bf(%rip), %rsi     # 0x1820a
jmp 0x18c3
movq 0x1c7a4(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1e97a(%rip), %rax     # 0x201d8
movq (%rax), %rdx
movq 0x1c940(%rip), %rax     # 0x1e1a8
movq (%rax,%r15), %rcx
leaq 0x169d0(%rip), %rsi     # 0x18243
jmp 0x18c3
movq 0x1c77c(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1e952(%rip), %rax     # 0x201d8
movq (%rax), %rdx
movq 0x1c918(%rip), %rax     # 0x1e1a8
movq (%rax,%r15), %rcx
leaq 0x1693c(%rip), %rsi     # 0x181d7
jmp 0x18c3
movq 0x1c754(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1e92a(%rip), %rax     # 0x201d8
movq (%rax), %rdx
movq 0x1c8f0(%rip), %rax     # 0x1e1a8
movq (%rax,%r15), %rcx
leaq 0x169b5(%rip), %rsi     # 0x18278
xorl %eax, %eax
callq 0x11b0
incq %r13
movl 0x14(%rsp), %r15d
jmp 0x1761
movq 0x1c71a(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1e8f0(%rip), %rax     # 0x201d8
movq (%rax), %rdx
movq 0x8(%rbp), %rcx
leaq 0x168bc(%rip), %rsi     # 0x181b2
xorl %eax, %eax
callq 0x11b0
jmp 0x15f1
movl %ebx, 0x1c89c(%rip)     # 0x1e1a4
movabsq $0x3e900000000, %rax    # imm = 0x3E900000000
leaq 0xb0(%rsp), %rcx
movq %rax, (%rcx)
movl $0x1, 0x8(%rcx)
leaq 0x16aee(%rip), %rax     # 0x18419
movq %rax, 0x10(%rcx)
leaq 0x1c88a(%rip), %rsi     # 0x1e1c0
movabsq $0x100000000, %rax      # imm = 0x100000000
leaq 0xe0(%rsp), %rdx
movq %rax, (%rdx)
andl $0x0, 0x8(%rdx)
movq %rsi, 0x18(%rcx)
leaq 0x16ad2(%rip), %rax     # 0x1842c
movq %rax, 0x10(%rdx)
movslq 0x1c83b(%rip), %rax     # 0x1e1a0
leaq 0xd0(%rsp), %rcx
movq %rax, (%rcx)
movq %rcx, 0x18(%rdx)
movq 0x8(%rbp), %rdi
callq 0x10caf
movq %rax, 0x30(%rsp)
movq 0x8(%rbp), %rdi
leaq 0x16918(%rip), %rsi     # 0x182a5
callq 0x10d07
movq %rax, 0x28(%rsp)
movl %r15d, %eax
movq %rax, 0x78(%rsp)
pushq $0x2
popq %rax
cmpq 0x78(%rsp), %rax
je 0x260a
movq %rax, 0x80(%rsp)
movq (%rbp,%rax,8), %rdi
callq 0x152f7
movq %rax, %rbx
movq %rax, 0x50(%rsp)
movq %rbx, %rdi
callq 0x150f3
testq %rax, %rax
je 0x25a3
movq %rax, 0x38(%rsp)
andl $0x0, 0x1e724(%rip)     # 0x20108
andl $0x0, 0x1e721(%rip)     # 0x2010c
movl 0x1e77f(%rip), %eax     # 0x20170
movl %eax, 0x1e719(%rip)     # 0x20110
movq %rbx, %rdi
callq 0x151e3
movq %rax, %rdi
pushq $0x2e
popq %rsi
callq 0x1270
testq %rax, %rax
je 0x1b77
movq %rax, %r15
incq %r15
movq %r15, %rdi
leaq 0x58(%rsp), %rsi
pushq $0xa
popq %rdx
callq 0x11d0
movq %rax, %r14
movq 0x58(%rsp), %rax
cmpq %r15, %rax
je 0x1b77
cmpb $0x0, (%rax)
jne 0x1b77
movq 0x30(%rsp), %rdi
leaq 0x1685a(%rip), %rsi     # 0x182a9
movq 0x28(%rsp), %rdx
leaq 0x1684a(%rip), %rcx     # 0x182a5
callq 0x10dcb
movq %rax, %rdi
leaq 0x17932(%rip), %rsi     # 0x1939c
callq 0x10c4f
testq %rax, %rax
je 0x15f1
movq %rax, %r15
movq %rax, %rdi
leaq 0x16826(%rip), %rsi     # 0x182ab
leaq 0x64(%rsp), %rdx
xorl %eax, %eax
callq 0x1090
cmpl $0x1, %eax
jne 0x25bb
pushq $-0x1
popq %rbx
incl %ebx
cmpl 0x64(%rsp), %ebx
jge 0x1ac4
leaq 0x100(%rsp), %rdi
movl $0x4e84, %esi           # imm = 0x4E84
movq %r15, %rdx
callq 0x1190
testq %rax, %rax
jne 0x1a9d
jmp 0x25bb
movq %r15, %rdi
leaq 0x1680a(%rip), %rsi     # 0x182d8
leaq 0xa4(%rsp), %rdx
xorl %eax, %eax
callq 0x1090
cmpl $0x1, %eax
jne 0x25bb
movq %r15, %rdi
leaq 0x167f6(%rip), %rsi     # 0x182e6
leaq 0xa8(%rsp), %rdx
leaq 0xa0(%rsp), %rcx
leaq 0x9c(%rsp), %r8
xorl %eax, %eax
callq 0x1090
cmpl $0x3, %eax
jne 0x25bb
testl %r14d, %r14d
movl $0x0, %ebx
cmovgl %r14d, %ebx
incl %ebx
movq %r15, %rdi
leaq 0x167dc(%rip), %rsi     # 0x1830c
leaq 0x60(%rsp), %rdx
decl %ebx
je 0x1b51
leaq 0x1e5cc(%rip), %rcx     # 0x2010c
xorl %eax, %eax
callq 0x1090
cmpl $0x2, %eax
je 0x1b26
jmp 0x25bb
leaq 0x1e5b8(%rip), %rcx     # 0x20110
xorl %eax, %eax
callq 0x1090
cmpl $0x2, %eax
jne 0x25bb
movq %r15, %rdi
callq 0x10d0
movl %r14d, 0x1e591(%rip)    # 0x20108
movl 0x1e58b(%rip), %esi     # 0x20108
testl %esi, %esi
jle 0x1baa
leaq 0x1688f(%rip), %rdi     # 0x18417
leaq 0x1678a(%rip), %rdx     # 0x18319
callq 0x10ef2
movq 0x30(%rsp), %rdi
leaq 0x16776(%rip), %rsi     # 0x18316
movq 0x28(%rsp), %rdx
movq %rax, %rcx
jmp 0x1bc2
movq 0x30(%rsp), %rdi
leaq 0x16760(%rip), %rsi     # 0x18316
movq 0x28(%rsp), %rdx
leaq 0x16757(%rip), %rcx     # 0x18319
callq 0x10dcb
movq 0x50(%rsp), %r15
movq %rax, %rdi
leaq 0x1674e(%rip), %rsi     # 0x18324
callq 0x10bec
movq %rax, 0x1e536(%rip)     # 0x20118
movq %rax, %rdi
leaq 0x171d0(%rip), %rsi     # 0x18dbc
callq 0x10c4f
movq %rax, 0x1e528(%rip)     # 0x20120
cmpq $0x0, 0x1e518(%rip)     # 0x20118
je 0x15f1
testq %rax, %rax
je 0x15f1
andl $0x0, 0x58(%rsp)
movl $0x1, 0x100(%rsp)
leaq 0x58(%rsp), %rdi
pushq $0x4
popq %rbx
movq %rbx, %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
movq %rax, %rcx
callq 0x12a0
movq 0x1e4e0(%rip), %rcx     # 0x20120
leaq 0x100(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x12a0
leaq 0xd8(%rsp), %rdi
pushq $0x8
popq %rsi
movq %r14, %rdx
movq 0x38(%rsp), %r12
movq %r12, %rcx
callq 0x10c0
leaq 0x1e4b3(%rip), %rdi     # 0x20128
movq %rbx, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x10c0
cmpl $0x0, 0x1c526(%rip)     # 0x1e1b0
je 0x1cbc
andq $0x0, 0x1e49c(%rip)     # 0x20130
andq $0x0, 0x1e49c(%rip)     # 0x20138
movq 0x8(%rbp), %r14
movq %r15, %rdi
callq 0x151e3
leaq 0x16690(%rip), %rdi     # 0x1833f
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1110
xorl %eax, %eax
movq 0x38(%rsp), %r14
leaq 0x1c4f6(%rip), %rcx     # 0x1e1c0
cmpq $0x1f48, %rax           # imm = 0x1F48
je 0x1cdd
andq $0x0, (%rax,%rcx)
addq $0x8, %rax
jmp 0x1cca
cmpq $0x0, 0x1e4cb(%rip)     # 0x201b0
jne 0x1d0e
movslq 0x1c48a(%rip), %rax     # 0x1e178
imulq $0x30, %rax, %rdi
leaq 0x16742(%rip), %rsi     # 0x1843b
callq 0x10b31
movq %rax, 0x1e4ab(%rip)     # 0x201b0
testq %rax, %rax
je 0x15f1
movq %r14, %rdi
callq 0x1120
leaq 0x100(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
movq %r14, %rcx
callq 0x10c0
leaq 0x1e3f2(%rip), %rdi     # 0x20128
pushq $0x4
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x10c0
xorl %eax, %eax
cmpl $0x7e, 0x1e3db(%rip)    # 0x20128
setge %al
incl %eax
movl %eax, 0x1e460(%rip)     # 0x201b8
movq 0x1e451(%rip), %rsi     # 0x201b0
movq %r14, %rdi
callq 0x813d
testl %eax, %eax
je 0x1d81
movq 0x1e43e(%rip), %rax     # 0x201b0
movl $0x7fffffff, 0x24(%rax) # imm = 0x7FFFFFFF
movl 0x1e38d(%rip), %eax     # 0x2010c
jmp 0x1db8
movslq 0x1e430(%rip), %rax     # 0x201b8
movq 0x1e421(%rip), %rcx     # 0x201b0
movslq 0x8(%rcx), %rsi
imulq %rax, %rsi
movq %r14, %rdi
pushq $0x1
popq %rdx
callq 0x1220
movq 0x1e407(%rip), %rcx     # 0x201b0
movl 0x1e35d(%rip), %eax     # 0x2010c
cmpl %eax, 0x24(%rcx)
jl 0x25e4
movslq %eax, %rdi
leal 0x1(%rdi), %r8d
xorl %r11d, %r11d
movslq 0x1e347(%rip), %rcx     # 0x20110
movq 0x1e3e0(%rip), %r15     # 0x201b0
movslq %r11d, %rax
imulq $0x30, %rax, %rax
cmpq %rcx, %rdi
jge 0x236f
movupd (%r15,%rax), %xmm0
movupd 0x10(%r15,%rax), %xmm1
movups 0x20(%r15,%rax), %xmm2
movups %xmm2, 0x20(%r15)
movupd %xmm1, 0x10(%r15)
movupd %xmm0, (%r15)
movslq 0x24(%r15), %r14
xorl %r11d, %r11d
cmpq %r14, %rdi
movq %rdi, 0x68(%rsp)
movl %r8d, 0x20(%rsp)
jne 0x1f13
pushq $0x30
popq %r12
pushq $0x1
popq %rbx
addq %r12, %r15
movq 0x38(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x813d
testl %eax, %eax
jne 0x1ed4
movslq 0x1e372(%rip), %rax     # 0x201b8
movq 0x1e363(%rip), %rcx     # 0x201b0
movslq 0x8(%rcx,%r12), %rsi
imulq %rax, %rsi
movq %r13, %rdi
pushq $0x1
popq %rdx
callq 0x1220
movq 0x1e348(%rip), %r15     # 0x201b0
cmpl %r14d, 0x24(%r15,%r12)
jne 0x1ee4
movq %rbx, %rax
incq %rax
cmpl %eax, 0x1c2fd(%rip)     # 0x1e178
jle 0x1e82
movq %rax, %rbx
jmp 0x1ecb
movq %rax, %rbx
cvtsi2sd %eax, %xmm0
mulsd 0x1617f(%rip), %xmm0    # 0x18010
addsd 0x1616f(%rip), %xmm0    # 0x18008
cvttsd2si %xmm0, %eax
movl %eax, 0x1c2d5(%rip)     # 0x1e178
cltq
imulq $0x30, %rax, %rsi
movq %r15, %rdi
leaq 0x165e6(%rip), %rdx     # 0x18499
callq 0x10b89
movq %rax, %r15
movq %rax, 0x1e2ee(%rip)     # 0x201b0
testq %rax, %rax
je 0x15f1
addq $0x30, %r12
jmp 0x1e24
movq 0x1e2d5(%rip), %r15     # 0x201b0
movl $0x7fffffff, 0x24(%r15,%r12) # imm = 0x7FFFFFFF
movq %rbx, %r11
leaq 0x8(%r15), %rax
xorl %ecx, %ecx
movq %rbx, %rdx
movq 0x68(%rsp), %rdi
movl 0x20(%rsp), %r8d
subq $0x1, %rdx
jb 0x1f13
movslq %ecx, %rcx
leaq (%rcx,%rcx), %rsi
movq %rsi, -0x8(%rax)
addl (%rax), %ecx
addq $0x30, %rax
jmp 0x1efa
movq 0x1e286(%rip), %rax     # 0x201a0
movslq %edi, %rdx
movq %rdx, 0x8(%rsp)
imulq $0x28, %rdx, %rcx
movslq 0x4(%rax,%rcx), %r12
movl 0x1e1f7(%rip), %ecx     # 0x20128
leal (%rcx,%r12), %eax
decl %eax
cltd
idivl %ecx
cmpl 0x1c25f(%rip), %r12d    # 0x1e1a0
jl 0x2364
movl %eax, %ebx
cmpl $0x0, 0x1e26c(%rip)     # 0x201bc
movq %r11, 0x40(%rsp)
jne 0x2026
movq %rbx, %r13
movl %r8d, %ebp
movq %rdi, %r14
leal -0x1(%rcx), %eax
addl 0x1e1f3(%rip), %eax     # 0x20160
cltd
idivl %ecx
movl %eax, 0x1e246(%rip)     # 0x201bc
movslq %eax, %rdi
shlq $0x2, %rdi
leaq 0x1652e(%rip), %rsi     # 0x184b2
callq 0x10b31
movq %rax, 0x1e230(%rip)     # 0x201c0
movslq 0x1e225(%rip), %rdi     # 0x201bc
shlq $0x2, %rdi
leaq 0x16527(%rip), %rbx     # 0x184c9
movq %rbx, %rsi
callq 0x10b31
movq %rax, 0x1e217(%rip)     # 0x201c8
movslq 0x1e204(%rip), %rdi     # 0x201bc
shlq $0x2, %rdi
movq %rbx, %rsi
callq 0x10b31
movq %rax, 0x1e205(%rip)     # 0x201d0
movq 0x1e1ee(%rip), %rcx     # 0x201c0
testq %rcx, %rcx
je 0x15f1
movq 0x1e1e6(%rip), %rdx     # 0x201c8
testq %rdx, %rdx
je 0x15f1
testq %rax, %rax
je 0x15f1
movl 0x1e1c2(%rip), %esi     # 0x201bc
movq %r14, %rdi
movl %ebp, %r8d
movq 0x40(%rsp), %r11
movq %r13, %rbx
testl %esi, %esi
jle 0x2020
andl $0x0, -0x4(%rax,%rsi,4)
andl $0x0, -0x4(%rdx,%rsi,4)
andl $0x0, -0x4(%rcx,%rsi,4)
decq %rsi
jmp 0x2008
movl 0x1e102(%rip), %ecx     # 0x20128
movslq %r8d, %rax
imulq $0x28, %rax, %rsi
movl %ecx, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %ecx
movl %eax, %r9d
decl %r9d
movslq 0x1e12c(%rip), %r10     # 0x20170
leal 0x1(%rdi), %eax
movq 0x1c16a(%rip), %r14     # 0x1e1b8
cltq
cmpl %eax, %r10d
movl %eax, %edx
cmovgl %r10d, %edx
movl %edx, 0x24(%rsp)
leaq (%r14,%rsi), %rdx
addq $0x20, %rdx
movq %rax, 0x48(%rsp)
cmpq %r10, %rax
jge 0x2082
testb $0x4, 0x1(%rdx)
je 0x207e
incq %rax
addq $0x28, %rdx
jmp 0x206a
movl %eax, 0x24(%rsp)
cmpl $-0x1, %edi
pushq $-0x1
popq %rsi
cmovll %edi, %esi
movl %edi, %eax
movq %r12, 0x90(%rsp)
movq %rbx, 0x88(%rsp)
movq %r14, 0x70(%rsp)
testl %eax, %eax
js 0x20b8
movl %eax, %edx
imulq $0x28, %rdx, %rdx
testb $0x4, 0x21(%r14,%rdx)
je 0x20bc
decl %eax
jmp 0x20a2
movl %esi, %edx
jmp 0x20be
movl %eax, %edx
movq 0x1e0fb(%rip), %rbp     # 0x201c0
movq 0x1e0fc(%rip), %r8      # 0x201c8
movslq %r11d, %r13
addq $0x48, 0x70(%rsp)
xorl %ebx, %ebx
movl %edx, 0x14(%rsp)
cmpl %r11d, %ebx
jge 0x21ea
movslq %ebx, %rbx
imulq $0x30, %rbx, %rax
movl 0x28(%r15,%rax), %eax
cmpl %eax, 0x14(%rsp)
jg 0x2102
cmpl 0x24(%rsp), %eax
jge 0x2102
incl %edx
movl %edx, %ebx
jmp 0x20db
movslq %eax, %rdx
imulq $0x28, %rdx, %rsi
addq 0x70(%rsp), %rsi
incq %rdx
movl %eax, %r11d
cmpq %r10, %rdx
jge 0x212a
leal 0x1(%r11), %eax
incq %rdx
testb $0x4, 0x1(%rsi)
leaq 0x28(%rsi), %rsi
jne 0x2111
movq %rbx, %r12
cmpq %r13, %r12
jge 0x21be
imulq $0x30, %r12, %rdi
cmpl %r11d, 0x28(%r15,%rdi)
jg 0x21be
addq %r15, %rdi
movl 0x18(%rdi), %eax
addl %ecx, %eax
movl 0x1dfd8(%rip), %r14d    # 0x20128
cltd
idivl %r14d
movl %eax, %esi
movl 0x10(%rdi), %eax
addl %r9d, %eax
cltd
idivl %r14d
cltq
movslq %esi, %rdx
cmpq %rdx, %rax
jge 0x2177
movl $0x1, (%rbp,%rax,4)
incq %rax
jmp 0x2165
incq %r12
jmp 0x212d
addq %r15, %r12
movl 0x18(%r12), %eax
addl %ecx, %eax
movl 0x1df9c(%rip), %edi     # 0x20128
cltd
idivl %edi
movl %eax, %esi
movl 0x10(%r12), %eax
addl %r9d, %eax
cltd
idivl %edi
cltq
movslq %esi, %rdx
cmpq %rdx, %rax
jge 0x21bb
cmpl $0x0, (%rbp,%rax,4)
jle 0x21b6
andl $0x0, (%rbp,%rax,4)
incl (%r8,%rax,4)
incq %rax
jmp 0x21a1
incq %rbx
cmpq %r13, %rbx
jge 0x21da
imulq $0x30, %rbx, %r12
cmpl %r11d, 0x28(%r15,%r12)
jle 0x217c
movl %ebx, %edx
movq 0x40(%rsp), %r11
jmp 0x20db
movq 0x40(%rsp), %r11
movl %r11d, %edx
movl %r11d, %ebx
jmp 0x20db
movl 0x1bfb3(%rip), %r9d     # 0x1e1a4
movq 0x1bfb0(%rip), %r10     # 0x1e1a8
movq 0x1dfd1(%rip), %r11     # 0x201d0
testl %r9d, %r9d
movl $0x0, %eax
cmovlel %eax, %r9d
xorl %r14d, %r14d
movq 0x18(%rsp), %rbp
movq 0x90(%rsp), %r13
cmpq %r9, %r14
je 0x2287
imulq $0x18, %r14, %rax
leaq (%r10,%rax), %rbx
movq 0x8(%r10,%rax), %rax
movq 0x8(%rsp), %rcx
movslq (%rax,%rcx,8), %r15
movq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %r12
cmpq %r15, %r12
jle 0x2282
movq 0x10(%rbx), %rax
movl (%rax,%r15,4), %ecx
movl 0x4(%rax,%r15,4), %eax
movl 0x1ded1(%rip), %edi     # 0x20128
addl %edi, %eax
decl %eax
cltd
idivl %edi
movl %eax, %esi
movl %ecx, %eax
cltd
idivl %edi
cltq
movslq %esi, %rcx
cmpq %rcx, %rax
jge 0x227c
movl $0x1, (%r11,%rax,4)
incq %rax
jmp 0x226a
addq $0x2, %r15
jmp 0x223f
incq %r14
jmp 0x221b
movq 0x88(%rsp), %rsi
testl %esi, %esi
movl $0x0, %eax
cmovlel %eax, %esi
xorl %eax, %eax
cmpq %rax, %rsi
je 0x22d2
cmpl $0x0, (%r11,%rax,4)
jne 0x22c8
movslq (%r8,%rax,4), %rcx
cmpq $0x3e8, %rcx            # imm = 0x3E8
jl 0x22bd
incq 0x1de45(%rip)           # 0x20100
jmp 0x22c8
leaq 0x1befc(%rip), %rdx     # 0x1e1c0
incq (%rdx,%rcx,8)
andl $0x0, (%r8,%rax,4)
incq %rax
jmp 0x229b
xorl %r8d, %r8d
cmpq %r9, %r8
je 0x233e
imulq $0x18, %r8, %rax
leaq (%r10,%rax), %rbx
movq 0x8(%r10,%rax), %rax
movq 0x8(%rsp), %rcx
movslq (%rax,%rcx,8), %r14
movq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %r15
cmpq %r14, %r15
jle 0x2339
movq 0x10(%rbx), %rax
movl (%rax,%r14,4), %ecx
movl 0x4(%rax,%r14,4), %eax
movl 0x1de17(%rip), %edi     # 0x20128
addl %edi, %eax
decl %eax
cltd
idivl %edi
movl %eax, %esi
movl %ecx, %eax
cltd
idivl %edi
cltq
movslq %esi, %rcx
cmpq %rcx, %rax
jge 0x2333
andl $0x0, (%r11,%rax,4)
incq %rax
jmp 0x2324
addq $0x2, %r14
jmp 0x22f9
incq %r8
jmp 0x22d5
cmpl $0x0, 0x1be6b(%rip)     # 0x1e1b0
movq 0x68(%rsp), %rdi
movl 0x20(%rsp), %r8d
movq 0x40(%rsp), %r11
je 0x2364
incq 0x1ddd3(%rip)           # 0x20130
addq %r13, 0x1ddd4(%rip)     # 0x20138
incq %rdi
incl %r8d
jmp 0x1dc2
cmpl $0x7fffffff, 0x24(%r15,%rax) # imm = 0x7FFFFFFF
jne 0x25e4
cmpl $0x0, 0x1be2b(%rip)     # 0x1e1b0
movq 0x1bc4c(%rip), %rbx     # 0x1dfd8
leaq 0x16010(%rip), %r15     # 0x183a3
je 0x254f
leaq 0x15fb0(%rip), %rdi     # 0x18350
xorl %eax, %eax
callq 0x1110
movq 0x1dd82(%rip), %rdi     # 0x20130
movq (%rbx), %rdx
pushq $0x7
popq %rsi
callq 0x10fc1
leaq 0x15f9a(%rip), %rdi     # 0x1835a
xorl %eax, %eax
callq 0x1110
movq 0x1dd6a(%rip), %rdi     # 0x20138
movq (%rbx), %rdx
pushq $0xc
popq %rsi
callq 0x10fc1
leaq 0x15f84(%rip), %rdi     # 0x18364
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x1bdb2(%rip)     # 0x1e1a0
jle 0x242e
leaq 0x15f74(%rip), %rdi     # 0x1836b
xorl %eax, %eax
callq 0x1110
movslq 0x1dd0b(%rip), %rdi     # 0x20110
movslq 0x1dd00(%rip), %rax     # 0x2010c
subq %rax, %rdi
subq 0x1dd1a(%rip), %rdi     # 0x20130
movq (%rbx), %rdx
xorl %esi, %esi
callq 0x10fc1
leaq 0x15f4f(%rip), %rdi     # 0x18376
xorl %eax, %eax
callq 0x1110
pushq $0xa
popq %rdi
callq 0x1040
xorl %eax, %eax
xorl %ebx, %ebx
leaq 0x1bd7f(%rip), %rcx     # 0x1e1c0
cmpq $0x1f48, %rax           # imm = 0x1F48
je 0x2453
addq (%rax,%rcx), %rbx
addq $0x8, %rax
jmp 0x2441
leaq 0x16086(%rip), %rdi     # 0x184e0
callq 0x10a0
movq 0x1dc9a(%rip), %r14     # 0x20100
testq %r14, %r14
jle 0x2497
cvtsi2sd %r14, %xmm0
mulsd 0x15b90(%rip), %xmm0    # 0x18008
cvtsi2sd %rbx, %xmm1
divsd %xmm1, %xmm0
leaq 0x15f00(%rip), %rdi     # 0x18388
movl $0x3e8, %esi            # imm = 0x3E8
movq %r14, %rdx
movb $0x1, %al
callq 0x1110
subq %r14, %rbx
cvtsi2sd %rbx, %xmm0
movsd %xmm0, 0x8(%rsp)
movl $0x3e7, %r14d           # imm = 0x3E7
xorl %ebx, %ebx
leaq 0x1bd0c(%rip), %r8      # 0x1e1c0
testl %r14d, %r14d
js 0x24f4
movl %r14d, %eax
movq (%r8,%rax,8), %rdx
testq %rdx, %rdx
jle 0x24ef
addq %rdx, %rbx
cvtsi2sd %rbx, %xmm0
mulsd 0x15b33(%rip), %xmm0    # 0x18008
divsd 0x8(%rsp), %xmm0
movq %r15, %rdi
movl %r14d, %esi
movb $0x1, %al
callq 0x1110
leaq 0x1bcd1(%rip), %r8      # 0x1e1c0
decl %r14d
jmp 0x24b4
movq 0x1bcc5(%rip), %rdx     # 0x1e1c0
leaq 0x1bcc6(%rip), %rsi     # 0x1e1c8
xorl %eax, %eax
movq %rsi, %rcx
movq 0x8(%r8,%rax,8), %rdi
incq %rax
addq $0x8, %rsi
cmpq %rdx, %rdi
movq %rdi, %rdx
jl 0x2504
leal -0x1(%rax), %esi
cmpq $0x3e7, %rax            # imm = 0x3E7
ja 0x2541
movslq %esi, %rdx
movq (%r8,%rdx,8), %rdi
movl %eax, %edx
cmpq (%rcx), %rdi
jl 0x2536
movl %esi, %edx
incq %rax
addq $0x8, %rcx
movl %edx, %esi
jmp 0x251e
leaq 0x15e75(%rip), %rdi     # 0x183bd
xorl %eax, %eax
callq 0x1110
movq 0x1dbca(%rip), %rdi     # 0x20120
leaq 0xb0(%rsp), %rsi
callq 0x14695
movq 0x1dbb6(%rip), %rdi     # 0x20120
leaq 0xe0(%rsp), %rsi
callq 0x14695
movq 0x1dba2(%rip), %rdi     # 0x20120
callq 0x10d0
movq 0x1db8e(%rip), %rdi     # 0x20118
callq 0x1030
movq 0x38(%rsp), %rdi
callq 0x10d0
movq 0x50(%rsp), %rbx
jmp 0x19c7
movq %rbx, %rdi
callq 0x1520e
movq 0x80(%rsp), %rax
incq %rax
jmp 0x19a2
movq 0x1ba36(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1dc0c(%rip), %rax     # 0x201d8
movq (%rax), %rdx
leaq 0x15ce2(%rip), %rsi     # 0x182b8
xorl %eax, %eax
callq 0x11b0
pushq $0x2
jmp 0x15f3
movq 0x1ba0d(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1dbe3(%rip), %rax     # 0x201d8
movq (%rax), %rdx
movl 0x1db0a(%rip), %ecx     # 0x20108
leaq 0x15e50(%rip), %rsi     # 0x18455
jmp 0x15ea
movq 0x30(%rsp), %rdi
callq 0x1030
movq 0x28(%rsp), %rdi
callq 0x1030
leaq 0x1db1b(%rip), %rdi     # 0x20140
callq 0x12a33
leaq 0x1dba7(%rip), %rax     # 0x201d8
movq (%rax), %rdi
callq 0x1030
xorl %edi, %edi
callq 0x1290