// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DB.c
// Function: Open_QVs
int Open_QVs(DAZZ_DB *db)
{ FILE        *quiva, *istub, *indx;
  char        *root;
  uint16      *table;
  DAZZ_QV     *qvtrk;
  QVcoding    *coding, *nx;
  int          ncodes = 0;

  if (db->tracks != NULL && db->tracks->name == qtrack_name)
    return (0);

  if (db->trimmed)
    { EPRINTF(EPLACE,"%s: Cannot load QVs after trimming the DB\n",Prog_Name);
      EXIT(1);
    }

  if (db->reads[db->nreads-1].coff < 0)
    { if (db->part > 0)
        { EPRINTF(EPLACE,"%s: All QVs for this block have not been added to the DB!\n",Prog_Name);
          EXIT(1);
        }
      else
        { EPRINTF(EPLACE,"%s: All QVs for this DB have not been added!\n",Prog_Name);
          EXIT(1);
        }
    }

  //  Open .qvs, .idx, and .db files

  quiva = Fopen(MyCatenate(db->path,"","",".qvs"),"r");
  if (quiva == NULL)
    return (-1);

  istub  = NULL;
  indx   = NULL; 
  table  = NULL;
  coding = NULL;
  qvtrk  = NULL;

  root = rindex(db->path,'/');
  if (root[1] == '.')
    { *root = '\0';
      istub = Fopen(MyCatenate(db->path,"/",root+2,".db"),"r");
      *root = '/';
    }
  else
    istub = Fopen(MyCatenate(db->path,"","",".db"),"r");
  if (istub == NULL)
    goto error;

  { int   first, last, nfiles;
    char  prolog[MAX_NAME], fname[MAX_NAME];
    int   i, j;

    if (fscanf(istub,DB_NFILE,&nfiles) != 1)
      { EPRINTF(EPLACE,"%s: Stub file (.db) of %s is junk\n",Prog_Name,root);
        goto error;
      }

    if (db->part > 0)
      { int       pfirst, plast;
        int       fbeg, fend;
        int       n, k;
        FILE     *indx;

        //  Determine first how many and which files span the block (fbeg to fend)

        pfirst = db->ufirst;
        plast  = pfirst + db->nreads;

        first = 0;
        for (fbeg = 0; fbeg < nfiles; fbeg++)
          { if (fscanf(istub,DB_FDATA,&last,fname,prolog) != 3)
              { EPRINTF(EPLACE,"%s: Stub file (.db) of %s is junk\n",Prog_Name,root);
                goto error;
              }
            if (last > pfirst)
              break;
            first = last;
          }
        for (fend = fbeg+1; fend <= nfiles; fend++)
          { if (last >= plast)
              break;
            if (fscanf(istub,DB_FDATA,&last,fname,prolog) != 3)
              { EPRINTF(EPLACE,"%s: Stub file (.db) of %s is junk\n",Prog_Name,root);
                goto error;
              }
            first = last;
          }

        indx   = Fopen(MyCatenate(db->path,"","",".idx"),"r");
        ncodes = fend-fbeg;
        coding = (QVcoding *) Malloc(sizeof(QVcoding)*ncodes,"Allocating coding schemes");
        table  = (uint16 *) Malloc(sizeof(uint16)*db->nreads,"Allocating QV table indices");
        if (indx == NULL || coding == NULL || table == NULL)
          { ncodes = 0;
            goto error;
          }

        //  Carefully get the first coding scheme (its offset is most likely in a DAZZ_RECORD
        //    in .idx that is *not* in memory).  Get all the other coding schemes normally and
        //    assign the tables # for each read in the block in "tables".

        rewind(istub);
        (void) fscanf(istub,DB_NFILE,&nfiles);

        first = 0;
        for (n = 0; n < fbeg; n++)
          { (void) fscanf(istub,DB_FDATA,&last,fname,prolog);
            first = last;
          }

        for (n = fbeg; n < fend; n++)
          { (void) fscanf(istub,DB_FDATA,&last,fname,prolog);

            i = n-fbeg;
            if (first < pfirst)
              { DAZZ_READ read;

                fseeko(indx,sizeof(DAZZ_DB) + sizeof(DAZZ_READ)*first,SEEK_SET);
                if (fread(&read,sizeof(DAZZ_READ),1,indx) != 1)
                  { EPRINTF(EPLACE,"%s: Index file (.idx) of %s is junk\n",Prog_Name,root);
                    ncodes = i;
                    goto error;
                  }
                fseeko(quiva,read.coff,SEEK_SET);
                nx = Read_QVcoding(quiva);
                if (nx == NULL)
                  { ncodes = i;
                    goto error;
                  }
                coding[i] = *nx;
              }
            else
              { fseeko(quiva,db->reads[first-pfirst].coff,SEEK_SET);
                nx = Read_QVcoding(quiva);
                if (nx == NULL)
                  { ncodes = i;
                    goto error;
                  }
                coding[i] = *nx;
                db->reads[first-pfirst].coff = ftello(quiva);
              }

            j = first-pfirst;
            if (j < 0)
              j = 0;
            k = last-pfirst;
            if (k > db->nreads)
              k = db->nreads;
            while (j < k)
              table[j++] = (uint16) i;

            first = last;
	  }

        fclose(indx);
        indx = NULL;
      }

    else
      { //  Load in coding scheme for each file, adjust .coff of first read in the file, and
        //    record which table each read uses

        ncodes = nfiles;
        coding = (QVcoding *) Malloc(sizeof(QVcoding)*nfiles,"Allocating coding schemes");
        table  = (uint16 *) Malloc(sizeof(uint16)*db->nreads,"Allocating QV table indices");
        if (coding == NULL || table == NULL)
          goto error;
  
        first = 0;
        for (i = 0; i < nfiles; i++)
          { if (fscanf(istub,DB_FDATA,&last,fname,prolog) != 3)
              { EPRINTF(EPLACE,"%s: Stub file (.db) of %s is junk\n",Prog_Name,root);
                goto error;
              }
  
            fseeko(quiva,db->reads[first].coff,SEEK_SET);
            nx = Read_QVcoding(quiva);
            if (nx == NULL)
              { ncodes = i;
                goto error;
              }
            coding[i] = *nx;
	    db->reads[first].coff = ftello(quiva);

            for (j = first; j < last; j++)
              table[j] = (uint16) i;

            first = last;
          }
      }

    //  Allocate and fill in the DAZZ_QV record and add it to the front of the
    //    track list

    qvtrk = (DAZZ_QV *) Malloc(sizeof(DAZZ_QV),"Allocating QV pseudo-track");
    if (qvtrk == NULL)
      goto error;
    qvtrk->name   = qtrack_name;
    if (qvtrk->name == NULL)
      goto error;
    qvtrk->next   = db->tracks;
    db->tracks    = (DAZZ_TRACK *) qvtrk;
    qvtrk->ncodes = ncodes;
    qvtrk->table  = table;
    qvtrk->coding = coding;
    qvtrk->quiva  = quiva;
  }

  fclose(istub);
  return (0);

error:
  if (qvtrk != NULL)
    free(qvtrk);
  if (table != NULL)
    free(table);
  if (coding != NULL)
    { int i;
      for (i = 0; i < ncodes; i++)
        Free_QVcoding(coding+i);
      free(coding);
    }
  if (indx != NULL)
    fclose(indx);
  if (istub != NULL)
    fclose(istub);
  fclose(quiva);
  EXIT(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4ee0, %rsp           # imm = 0x4EE0
movq %rdi, -0x10(%rbp)
movl $0x0, -0x54(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x82e2
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movq 0x8(%rax), %rax
cmpq 0xa074(%rip), %rax      # 0x12348
jne 0x82e2
movl $0x0, -0x4(%rbp)
jmp 0x8c9a
movq -0x10(%rbp), %rax
cmpl $0x0, 0x34(%rax)
je 0x8315
movq 0x9d05(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xc78b(%rip), %rdx      # 0x14a88
leaq 0x694f(%rip), %rsi      # 0xec53
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x30(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x18(%rax)
jge 0x8394
movq -0x10(%rbp), %rax
cmpl $0x0, 0x38(%rax)
jle 0x836b
movq 0x9caf(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xc735(%rip), %rdx      # 0x14a88
leaq 0x6924(%rip), %rsi      # 0xec7e
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
movq 0x9c86(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xc70c(%rip), %rdx      # 0x14a88
leaq 0x6936(%rip), %rsi      # 0xecb9
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
leaq 0x65ba(%rip), %rdx      # 0xe95d
leaq 0x693d(%rip), %rcx      # 0xece7
movq %rdx, %rsi
callq 0x4550
movq %rax, %rdi
leaq 0x6998(%rip), %rsi      # 0xed54
callq 0x2480
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x83d8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8c9a
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movl $0x2f, %esi
callq 0x1240
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2e, %eax
jne 0x8469
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x30(%rbp), %rdx
addq $0x2, %rdx
leaq 0x604d(%rip), %rsi      # 0xe48e
leaq 0x6042(%rip), %rcx      # 0xe48a
callq 0x4550
movq %rax, %rdi
leaq 0x68fd(%rip), %rsi      # 0xed54
callq 0x2480
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
movb $0x2f, (%rax)
jmp 0x849a
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
leaq 0x64e5(%rip), %rdx      # 0xe95d
leaq 0x600b(%rip), %rcx      # 0xe48a
movq %rdx, %rsi
callq 0x4550
movq %rax, %rdi
leaq 0x68c3(%rip), %rsi      # 0xed54
callq 0x2480
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x84a6
jmp 0x8bfa
movq -0x20(%rbp), %rdi
leaq 0x5f48(%rip), %rsi      # 0xe3f9
leaq -0x60(%rbp), %rdx
movb $0x0, %al
callq 0x1080
cmpl $0x1, %eax
je 0x84e9
movq 0x9b30(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xc5b6(%rip), %rdx      # 0x14a88
movq -0x30(%rbp), %rcx
leaq 0x603d(%rip), %rsi      # 0xe51a
movb $0x0, %al
callq 0x1180
jmp 0x8bfa
movq -0x10(%rbp), %rax
cmpl $0x0, 0x38(%rax)
jle 0x89c5
movq -0x10(%rbp), %rax
movl 0x3c(%rax), %eax
movl %eax, -0x4e8c(%rbp)
movl -0x4e8c(%rbp), %eax
movq -0x10(%rbp), %rcx
addl 0x30(%rcx), %eax
movl %eax, -0x4e90(%rbp)
movl $0x0, -0x58(%rbp)
movl $0x0, -0x4e94(%rbp)
movl -0x4e94(%rbp), %eax
cmpl -0x60(%rbp), %eax
jge 0x85a8
movq -0x20(%rbp), %rdi
leaq -0x4e80(%rbp), %rcx
leaq -0x2770(%rbp), %r8
leaq 0x5eba(%rip), %rsi      # 0xe406
leaq -0x5c(%rbp), %rdx
movb $0x0, %al
callq 0x1080
cmpl $0x3, %eax
je 0x8584
movq 0x9a95(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xc51b(%rip), %rdx      # 0x14a88
movq -0x30(%rbp), %rcx
leaq 0x5fa2(%rip), %rsi      # 0xe51a
movb $0x0, %al
callq 0x1180
jmp 0x8bfa
movl -0x5c(%rbp), %eax
cmpl -0x4e8c(%rbp), %eax
jle 0x8591
jmp 0x85a8
movl -0x5c(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x4e94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e94(%rbp)
jmp 0x8528
movl -0x4e94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e98(%rbp)
movl -0x4e98(%rbp), %eax
cmpl -0x60(%rbp), %eax
jg 0x8637
movl -0x5c(%rbp), %eax
cmpl -0x4e90(%rbp), %eax
jl 0x85cf
jmp 0x8637
movq -0x20(%rbp), %rdi
leaq -0x4e80(%rbp), %rcx
leaq -0x2770(%rbp), %r8
leaq 0x5e1e(%rip), %rsi      # 0xe406
leaq -0x5c(%rbp), %rdx
movb $0x0, %al
callq 0x1080
cmpl $0x3, %eax
je 0x8620
movq 0x99f9(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xc47f(%rip), %rdx      # 0x14a88
movq -0x30(%rbp), %rcx
leaq 0x5f06(%rip), %rsi      # 0xe51a
movb $0x0, %al
callq 0x1180
jmp 0x8bfa
movl -0x5c(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x4e98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e98(%rbp)
jmp 0x85b7
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
leaq 0x6317(%rip), %rdx      # 0xe95d
leaq 0x5ea3(%rip), %rcx      # 0xe4f0
movq %rdx, %rsi
callq 0x4550
movq %rax, %rdi
leaq 0x66f5(%rip), %rsi      # 0xed54
callq 0x2480
movq %rax, -0x4ea8(%rbp)
movl -0x4e98(%rbp), %eax
subl -0x4e94(%rbp), %eax
movl %eax, -0x54(%rbp)
movslq -0x54(%rbp), %rax
imulq $0x48, %rax, %rdi
leaq 0x6663(%rip), %rsi      # 0xecec
callq 0x22c0
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movslq 0x30(%rax), %rdi
shlq %rdi
leaq 0x6662(%rip), %rsi      # 0xed06
callq 0x22c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x4ea8(%rbp)
je 0x86c5
cmpq $0x0, -0x48(%rbp)
je 0x86c5
cmpq $0x0, -0x38(%rbp)
jne 0x86d1
movl $0x0, -0x54(%rbp)
jmp 0x8bfa
movq -0x20(%rbp), %rdi
callq 0x1100
movq -0x20(%rbp), %rdi
leaq 0x5d14(%rip), %rsi      # 0xe3f9
leaq -0x60(%rbp), %rdx
movb $0x0, %al
callq 0x1080
movl $0x0, -0x58(%rbp)
movl $0x0, -0x4e9c(%rbp)
movl -0x4e9c(%rbp), %eax
cmpl -0x4e94(%rbp), %eax
jge 0x874a
movq -0x20(%rbp), %rdi
leaq -0x4e80(%rbp), %rcx
leaq -0x2770(%rbp), %r8
leaq 0x5cde(%rip), %rsi      # 0xe406
leaq -0x5c(%rbp), %rdx
movb $0x0, %al
callq 0x1080
movl -0x5c(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x4e9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e9c(%rbp)
jmp 0x8701
movl -0x4e94(%rbp), %eax
movl %eax, -0x4e9c(%rbp)
movl -0x4e9c(%rbp), %eax
cmpl -0x4e98(%rbp), %eax
jge 0x89a9
movq -0x20(%rbp), %rdi
leaq -0x4e80(%rbp), %rcx
leaq -0x2770(%rbp), %r8
leaq 0x5c85(%rip), %rsi      # 0xe406
leaq -0x5c(%rbp), %rdx
movb $0x0, %al
callq 0x1080
movl -0x4e9c(%rbp), %eax
subl -0x4e94(%rbp), %eax
movl %eax, -0x4e84(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x4e8c(%rbp), %eax
jge 0x8874
movq -0x4ea8(%rbp), %rdi
movslq -0x58(%rbp), %rax
imulq $0x28, %rax, %rsi
addq $0x70, %rsi
xorl %edx, %edx
callq 0x1220
movq -0x4ea8(%rbp), %rcx
leaq -0x4ed0(%rbp), %rdi
movl $0x28, %esi
movl $0x1, %edx
callq 0x10a0
cmpq $0x1, %rax
je 0x881b
movq 0x9807(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xc28d(%rip), %rdx      # 0x14a88
movq -0x30(%rbp), %rcx
leaq 0x5cef(%rip), %rsi      # 0xe4f5
movb $0x0, %al
callq 0x1180
movl -0x4e84(%rbp), %eax
movl %eax, -0x54(%rbp)
jmp 0x8bfa
movq -0x18(%rbp), %rdi
movq -0x4eb8(%rbp), %rsi
xorl %edx, %edx
callq 0x1220
movq -0x18(%rbp), %rdi
callq 0xb1d0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x884f
movl -0x4e84(%rbp), %eax
movl %eax, -0x54(%rbp)
jmp 0x8bfa
movq -0x48(%rbp), %rdi
movslq -0x4e84(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rdi
movq -0x50(%rbp), %rsi
movl $0x48, %edx
callq 0x11c0
jmp 0x890b
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movl -0x58(%rbp), %ecx
subl -0x4e8c(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rsi
xorl %edx, %edx
callq 0x1220
movq -0x18(%rbp), %rdi
callq 0xb1d0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x88c0
movl -0x4e84(%rbp), %eax
movl %eax, -0x54(%rbp)
jmp 0x8bfa
movq -0x48(%rbp), %rdi
movslq -0x4e84(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rdi
movq -0x50(%rbp), %rsi
movl $0x48, %edx
callq 0x11c0
movq -0x18(%rbp), %rdi
callq 0x1070
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movl -0x58(%rbp), %edx
subl -0x4e8c(%rbp), %edx
movslq %edx, %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movl -0x58(%rbp), %eax
subl -0x4e8c(%rbp), %eax
movl %eax, -0x4e88(%rbp)
cmpl $0x0, -0x4e88(%rbp)
jge 0x892d
movl $0x0, -0x4e88(%rbp)
movl -0x5c(%rbp), %eax
subl -0x4e8c(%rbp), %eax
movl %eax, -0x4ea0(%rbp)
movl -0x4ea0(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jle 0x8958
movq -0x10(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x4ea0(%rbp)
jmp 0x895a
movl -0x4e88(%rbp), %eax
cmpl -0x4ea0(%rbp), %eax
jge 0x898f
movl -0x4e84(%rbp), %eax
movw %ax, %dx
movq -0x38(%rbp), %rax
movl -0x4e88(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x4e88(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
jmp 0x895a
movl -0x5c(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x4e9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e9c(%rbp)
jmp 0x8756
movq -0x4ea8(%rbp), %rdi
callq 0x10b0
movq $0x0, -0x4ea8(%rbp)
jmp 0x8b62
movl -0x60(%rbp), %eax
movl %eax, -0x54(%rbp)
movslq -0x60(%rbp), %rax
imulq $0x48, %rax, %rdi
leaq 0x6312(%rip), %rsi      # 0xecec
callq 0x22c0
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movslq 0x30(%rax), %rdi
shlq %rdi
leaq 0x6311(%rip), %rsi      # 0xed06
callq 0x22c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x8a0c
cmpq $0x0, -0x38(%rbp)
jne 0x8a11
jmp 0x8bfa
movl $0x0, -0x58(%rbp)
movl $0x0, -0x4e84(%rbp)
movl -0x4e84(%rbp), %eax
cmpl -0x60(%rbp), %eax
jge 0x8b60
movq -0x20(%rbp), %rdi
leaq -0x4e80(%rbp), %rcx
leaq -0x2770(%rbp), %r8
leaq 0x59bc(%rip), %rsi      # 0xe406
leaq -0x5c(%rbp), %rdx
movb $0x0, %al
callq 0x1080
cmpl $0x3, %eax
je 0x8a82
movq 0x9597(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xc01d(%rip), %rdx      # 0x14a88
movq -0x30(%rbp), %rcx
leaq 0x5aa4(%rip), %rsi      # 0xe51a
movb $0x0, %al
callq 0x1180
jmp 0x8bfa
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x58(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rsi
xorl %edx, %edx
callq 0x1220
movq -0x18(%rbp), %rdi
callq 0xb1d0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x8ac6
movl -0x4e84(%rbp), %eax
movl %eax, -0x54(%rbp)
jmp 0x8bfa
movq -0x48(%rbp), %rdi
movslq -0x4e84(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rdi
movq -0x50(%rbp), %rsi
movl $0x48, %edx
callq 0x11c0
movq -0x18(%rbp), %rdi
callq 0x1070
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x58(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movl -0x58(%rbp), %eax
movl %eax, -0x4e88(%rbp)
movl -0x4e88(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jge 0x8b46
movl -0x4e84(%rbp), %eax
movw %ax, %dx
movq -0x38(%rbp), %rax
movslq -0x4e88(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x4e88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e88(%rbp)
jmp 0x8b12
movl -0x5c(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x4e84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e84(%rbp)
jmp 0x8a22
jmp 0x8b62
movl $0x30, %edi
leaq 0x61b4(%rip), %rsi      # 0xed22
callq 0x22c0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x8b80
jmp 0x8bfa
movq 0x97c1(%rip), %rcx      # 0x12348
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x8b9c
jmp 0x8bfa
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movl -0x54(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rdi
callq 0x10b0
movl $0x0, -0x4(%rbp)
jmp 0x8c9a
cmpq $0x0, -0x40(%rbp)
je 0x8c0a
movq -0x40(%rbp), %rdi
callq 0x1030
cmpq $0x0, -0x38(%rbp)
je 0x8c1a
movq -0x38(%rbp), %rdi
callq 0x1030
cmpq $0x0, -0x48(%rbp)
je 0x8c67
movl $0x0, -0x4ed4(%rbp)
movl -0x4ed4(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x8c5e
movq -0x48(%rbp), %rdi
movslq -0x4ed4(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rdi
callq 0xb8c0
movl -0x4ed4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4ed4(%rbp)
jmp 0x8c2b
movq -0x48(%rbp), %rdi
callq 0x1030
cmpq $0x0, -0x28(%rbp)
je 0x8c77
movq -0x28(%rbp), %rdi
callq 0x10b0
cmpq $0x0, -0x20(%rbp)
je 0x8c87
movq -0x20(%rbp), %rdi
callq 0x10b0
movq -0x18(%rbp), %rdi
callq 0x10b0
movl $0x1, %edi
callq 0x1260
movl -0x4(%rbp), %eax
addq $0x4ee0, %rsp           # imm = 0x4EE0
popq %rbp
retq
nopw %cs:(%rax,%rax)