// File: /workspace/github_c_makefile_star2_O0/jrrk[P]cbzone/c_scores.c
// Function: scores
LONG scores(score)
     LONG score;
{
  struct score_struct {
    LONG score;
    int uid;
    char name[50];
    struct score_struct *next;
  } player, *current, *top_score, *prev_score;

  FILE *sfile;
  char buf[100];
  char version[100];
  char *login, *getlogin();
  int i;
  Font fontid;
  int numgame = 0;
  int numscore = 0;
  int numscoreable = 0;
  int player_scores = 0;
  int tries = MAX_RETRIES;
  Bool score_printed = False;
  Bool scoresonly = False;
  Bool wrong_version = False;
  Bool file_readable = False;
  Bool file_writeable = False;
  Bool practice = opt->practice;
  struct passwd* pw;
  void (*p)();

  version[0] ='\0';
  if (score < 0) {
    practice = True;
    scoresonly = True;
    p = nprintf;
  }
  else {
    p = xprintf;
    gprsetclippingactive(False);
    fontid = gprloadfontfile(GAMEOVERFONT);
    gprsettextfont(fontid);
    printstring (165, 300, "GAME OVER", 9);
    fontid = gprloadfontfile(GENERALFONT);
    gprsettextfont(fontid);
    printstring (165, 320, "1986 JSR", 8);
    flushwindow();
    sleep(1);
    clearentirescreen();
  }

  x = 350;
  y = 100;
  ydelta = 15;

  sprintf(buf,"%s%s",TANKDIR,SCOREFILE);
  sfile = fopen(buf,"r");       /* just check if it is there */

  if (sfile == NULL) {
    p("Score file not readable.", opt->output);
    if (scoresonly)
      return 1;
    else {
      p("Will try and create new scorefile.", opt->output);
    }
  }
  else
    file_readable = True;

  if (!scoresonly) {
    (void) signal(SIGINT, SIG_IGN); /* no leaving this routine */
    (void) signal(SIGHUP, SIG_IGN); /* no how, no way */
    file_writeable = True;
    if (sfile != NULL)
      fclose(sfile);

  retry:
    if (file_readable)
      sfile = fopen(buf,"r+");  /* okay, now open for update */
    else
      sfile = fopen(buf,"w");

    if (sfile != NULL) {
      if (flock(fileno(sfile),LOCK_EX) < 0) {
        if (errno == EWOULDBLOCK && AFS) {
          fclose(sfile);
          sleep(AFS_SLEEP);
          if (tries--)
            goto retry;
        }
        p("File not lockable, scores will not be saved.", opt->output);
        file_writeable = False;
      }
    }
    else {
      p("File not writeable, scores will not be saved.", opt->output);
      file_writeable = False;
    }

    /* okay, it's possible we could have closed the file and never
     * reopened it.  Also, we just may not have been able to lock
     * it.  In either case, lets close it again and then open only
     * for reading.
     */
    if (file_readable && !file_writeable) {
      if (sfile != NULL)
        fclose(sfile);
      if ((sfile = fopen(buf, "r")) == NULL)
        file_readable = False;
    }
  }

  if (!file_readable && !file_writeable) {
    p("Scorefile not readable or writeable...Goodbye!", opt->output);
    (void) signal(SIGINT, SIG_DFL); /* this would probably happen */
    (void) signal(SIGHUP, SIG_DFL); /* on exit anyway             */
    if (!scoresonly)
      printandwait("Press any key to continue...", 0);
    return 1;
  }

  if (file_readable) {
    if(fgets(version,200,sfile) && file_writeable) {
      version[strlen(version)-1] = '\0'; /* strip the newline */
      if (strcmp(version,VERSION)) {
        wrong_version = True;
        p("Incorrect version played for this scorefile.", opt->output);
        p("Score not valid for inclusion.", opt->output);
        sprintf(buf,"Your version is \"%s\", while",VERSION);
        p(buf, opt->output);
        sprintf(buf, "  the scorefile version is \"%s\"", version);
        p(buf, opt->output);
      }
    }

    if (*version == '\0')
      strcpy(version,VERSION);

    if(fgets(buf,200,sfile))
      sscanf(buf,"%d %d",&numgame,&numscoreable);
    top_score = (struct score_struct*) malloc(sizeof(struct score_struct));
    current = top_score;

    while(fgets(buf,200,sfile) && numscore < NUMHIGH)
      if (sscanf(buf,"%d %d %[^\n]",&current->score,
                 &current->uid,current->name) != 3) {
        p("Invalid line in score file...Skipping.", opt->output);
      }
      else {
        current->next = (struct score_struct*)
          malloc(sizeof(struct score_struct));
        prev_score = current;
        current = current->next;
        numscore ++;
      }
  }

  if (numscore)
    prev_score->next = NULL;
  else
    top_score = NULL;

  if (numgame < numscoreable)
    numgame = numscoreable;

  if (!scoresonly) {
    /* try to get it from the passwd file first, just in case this
     * person su'd from another acct.
     */
    player.uid = getuid();
    player.score = score;
    pw = getpwuid(player.uid);
    if (pw == NULL)
      if ((login = getlogin()) != NULL)
        strcpy(player.name, login);
      else {
        p("Can't find out who you are....bye.", opt->output);
        fclose(sfile);
        (void) signal(SIGINT, SIG_DFL);
        (void) signal(SIGHUP, SIG_DFL);
        if (!scoresonly)
          printandwait("Press any key to continue...", 0);
        return 1;
      }
    else
      strcpy(player.name, pw->pw_name);

    if (numscore < NUMHIGH || player.score > prev_score->score) {
      score_printed = True;
      numscore++;

      for (current = top_score;
           current != NULL && player.score <= current->score;
           prev_score = current, current = current->next);

      player.next = current;

      if (current == top_score)
        top_score = &player;
      else
        prev_score->next = &player;
    }

    numgame++;
    if (!practice && !wrong_version)
      numscoreable++;
  }

  sprintf(buf, "High scores after %d games, %d scoreable:",
          numgame, numscoreable);
  p(buf, opt->output);
  current = top_score;
  while (current != NULL) {
    if (current == &player)
      *buf = '>';
    else
      *buf = ' ';
    sprintf(buf+1, "%-20s %8d", current->name, current->score);
    p(buf, opt->output);

    if (((wrong_version || practice) && current==&player) ||
        (current->uid==player.uid && !strcmp(player.name, current->name) &&
         ++player_scores>INDIVIDUAL_SCORES)) {
      numscore--;
      if (current == top_score)
        top_score = current->next;
      else
        prev_score->next = current->next;
    }
    else
      prev_score = current;
    current = current->next;
  }

  if (!scoresonly && !score_printed) {
    p("...", opt->output);
    sprintf(buf, ">%-20s %8d", player.name,player.score);
    p(buf, opt->output);
  }

  if (file_writeable) {
    rewind(sfile);
    fprintf(sfile,"%s\n",version);
    fprintf(sfile,"%d %d\n",numgame,numscoreable);
    for(current = top_score, i = 0;
        current != NULL && i < NUMHIGH;
        current = current->next, i++)
      fprintf(sfile,"%d %d %s\n",current->score,current->uid,current->name);
    if (practice) {
      y += ydelta;
      p("Your game was for practice only...", opt->output);
      p("For a valid score use:  cbzone [-q] [-d 0-5]", opt->output);
    }
  }

  fclose(sfile);
  (void) signal(SIGINT, SIG_DFL);
  (void) signal(SIGHUP, SIG_DFL);

  if (!scoresonly)
    printandwait("Press any key when ready...", 0);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x10(%rbp)
movl $0x0, -0x16c(%rbp)
movl $0x0, -0x170(%rbp)
movl $0x0, -0x174(%rbp)
movl $0x0, -0x178(%rbp)
movl $0x5, -0x17c(%rbp)
movl $0x0, -0x180(%rbp)
movl $0x0, -0x184(%rbp)
movl $0x0, -0x188(%rbp)
movl $0x0, -0x18c(%rbp)
movl $0x0, -0x190(%rbp)
leaq 0x6a66(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x38(%rax), %eax
movl %eax, -0x194(%rbp)
movb $0x0, -0x150(%rbp)
cmpq $0x0, -0x10(%rbp)
jge 0x12f3b
movl $0x1, -0x194(%rbp)
movl $0x1, -0x184(%rbp)
leaq -0x12f(%rip), %rax      # 0x12e00
movq %rax, -0x1a8(%rbp)
jmp 0x12fea
leaq -0x1a2(%rip), %rax      # 0x12da0
movq %rax, -0x1a8(%rbp)
xorl %edi, %edi
movb $0x0, %al
callq 0x98e0
leaq 0x1d33(%rip), %rdi      # 0x14c8c
movb $0x0, %al
callq 0x9db0
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rdi
movb $0x0, %al
callq 0x9460
movl $0xa5, %edi
movl $0x12c, %esi            # imm = 0x12C
leaq 0x1d34(%rip), %rdx      # 0x14cba
movl $0x9, %ecx
movb $0x0, %al
callq 0x9490
leaq 0x181c(%rip), %rdi      # 0x147b5
movb $0x0, %al
callq 0x9db0
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rdi
movb $0x0, %al
callq 0x9460
movl $0xa5, %edi
movl $0x140, %esi            # imm = 0x140
leaq 0x1cfe(%rip), %rdx      # 0x14cc4
movl $0x8, %ecx
movb $0x0, %al
callq 0x9490
movb $0x0, %al
callq 0xa0d0
movl $0x1, %edi
callq 0x5310
movb $0x0, %al
callq 0xa0b0
movl $0x15e, 0x6d78(%rip)    # imm = 0x15E
movl $0x64, 0x6d72(%rip)     # 0x19d70
movl $0xf, 0x6d6c(%rip)      # 0x19d74
leaq -0xe0(%rbp), %rdi
leaq 0x1b48(%rip), %rsi      # 0x14b5e
leaq 0x1b46(%rip), %rdx      # 0x14b63
leaq 0x1ca9(%rip), %rcx      # 0x14ccd
movb $0x0, %al
callq 0x52d0
leaq -0xe0(%rbp), %rdi
leaq 0x17cd(%rip), %rsi      # 0x14806
callq 0x5190
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
jne 0x1309f
movq -0x1a8(%rbp), %rcx
leaq 0x6909(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x1c7b(%rip), %rdi      # 0x14cdf
movb $0x0, %al
callq *%rcx
cmpl $0x0, -0x184(%rbp)
je 0x1307e
movq $0x1, -0x8(%rbp)
jmp 0x13a3e
movq -0x1a8(%rbp), %rcx
leaq 0x68d4(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x1c5f(%rip), %rdi      # 0x14cf8
movb $0x0, %al
callq *%rcx
jmp 0x130a9
movl $0x1, -0x18c(%rbp)
cmpl $0x0, -0x184(%rbp)
jne 0x13225
movl $0x2, %edi
movl $0x1, %esi
callq 0x5390
movl $0x1, %edi
movl $0x1, %esi
callq 0x5390
movl $0x1, -0x190(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x130ee
movq -0x78(%rbp), %rdi
callq 0x54f0
jmp 0x130f0
cmpl $0x0, -0x18c(%rbp)
je 0x13112
leaq -0xe0(%rbp), %rdi
leaq 0x1c14(%rip), %rsi      # 0x14d1b
callq 0x5190
movq %rax, -0x78(%rbp)
jmp 0x13129
leaq -0xe0(%rbp), %rdi
leaq 0x14f4(%rip), %rsi      # 0x14614
callq 0x5190
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x131af
movq -0x78(%rbp), %rdi
callq 0x5030
movl %eax, %edi
movl $0x2, %esi
callq 0x5350
cmpl $0x0, %eax
jge 0x131ad
callq 0x53e0
cmpl $0xb, (%rax)
jne 0x13184
movq -0x78(%rbp), %rdi
callq 0x54f0
movl $0x2, %edi
callq 0x5310
movl -0x17c(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x17c(%rbp)
cmpl $0x0, %eax
je 0x13182
jmp 0x130f0
jmp 0x13184
movq -0x1a8(%rbp), %rcx
leaq 0x67ce(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x1b7f(%rip), %rdi      # 0x14d1e
movb $0x0, %al
callq *%rcx
movl $0x0, -0x190(%rbp)
jmp 0x131d8
movq -0x1a8(%rbp), %rcx
leaq 0x67a3(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x1b81(%rip), %rdi      # 0x14d4b
movb $0x0, %al
callq *%rcx
movl $0x0, -0x190(%rbp)
cmpl $0x0, -0x18c(%rbp)
je 0x13223
cmpl $0x0, -0x190(%rbp)
jne 0x13223
cmpq $0x0, -0x78(%rbp)
je 0x131fa
movq -0x78(%rbp), %rdi
callq 0x54f0
leaq -0xe0(%rbp), %rdi
leaq 0x15fe(%rip), %rsi      # 0x14806
callq 0x5190
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
jne 0x13221
movl $0x0, -0x18c(%rbp)
jmp 0x13223
jmp 0x13225
cmpl $0x0, -0x18c(%rbp)
jne 0x13296
cmpl $0x0, -0x190(%rbp)
jne 0x13296
movq -0x1a8(%rbp), %rcx
leaq 0x671b(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x1b27(%rip), %rdi      # 0x14d79
movb $0x0, %al
callq *%rcx
movl $0x2, %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x5390
movl $0x1, %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x5390
cmpl $0x0, -0x184(%rbp)
jne 0x13289
leaq 0x1b26(%rip), %rdi      # 0x14da8
xorl %esi, %esi
callq 0x12e30
movq $0x1, -0x8(%rbp)
jmp 0x13a3e
cmpl $0x0, -0x18c(%rbp)
je 0x13509
leaq -0x150(%rbp), %rdi
movq -0x78(%rbp), %rdx
movl $0xc8, %esi
callq 0x5220
cmpq $0x0, %rax
je 0x133c3
cmpl $0x0, -0x190(%rbp)
je 0x133c3
leaq -0x150(%rbp), %rdi
callq 0x5270
subq $0x1, %rax
movb $0x0, -0x150(%rbp,%rax)
leaq -0x150(%rbp), %rdi
leaq 0x191e(%rip), %rsi      # 0x14c13
callq 0x5430
cmpl $0x0, %eax
je 0x133c1
movl $0x1, -0x188(%rbp)
movq -0x1a8(%rbp), %rcx
leaq 0x6645(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x1a9d(%rip), %rdi      # 0x14dc5
movb $0x0, %al
callq *%rcx
movq -0x1a8(%rbp), %rcx
leaq 0x6626(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x1aab(%rip), %rdi      # 0x14df2
movb $0x0, %al
callq *%rcx
leaq -0xe0(%rbp), %rdi
leaq 0x1ab8(%rip), %rsi      # 0x14e11
leaq 0x18b3(%rip), %rdx      # 0x14c13
movb $0x0, %al
callq 0x52d0
movq -0x1a8(%rbp), %rcx
leaq -0xe0(%rbp), %rdi
leaq 0x65e4(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
movb $0x0, %al
callq *%rcx
leaq -0xe0(%rbp), %rdi
leaq -0x150(%rbp), %rdx
leaq 0x1a92(%rip), %rsi      # 0x14e2d
movb $0x0, %al
callq 0x52d0
movq -0x1a8(%rbp), %rcx
leaq -0xe0(%rbp), %rdi
leaq 0x65a9(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
movb $0x0, %al
callq *%rcx
jmp 0x133c3
movsbl -0x150(%rbp), %eax
cmpl $0x0, %eax
jne 0x133e2
leaq -0x150(%rbp), %rdi
leaq 0x1836(%rip), %rsi      # 0x14c13
callq 0x5460
leaq -0xe0(%rbp), %rdi
movq -0x78(%rbp), %rdx
movl $0xc8, %esi
callq 0x5220
cmpq $0x0, %rax
je 0x13420
leaq -0xe0(%rbp), %rdi
leaq 0x1a42(%rip), %rsi      # 0x14e4d
leaq -0x16c(%rbp), %rdx
leaq -0x174(%rbp), %rcx
movb $0x0, %al
callq 0x50e0
movl $0x48, %edi
callq 0x5180
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0xe0(%rbp), %rdi
movq -0x78(%rbp), %rdx
movl $0xc8, %esi
callq 0x5220
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x1a9(%rbp)
je 0x1346c
cmpl $0x14, -0x170(%rbp)
setl %al
movb %al, -0x1a9(%rbp)
movb -0x1a9(%rbp), %al
testb $0x1, %al
jne 0x1347b
jmp 0x13507
leaq -0xe0(%rbp), %rdi
movq -0x60(%rbp), %rdx
movq -0x60(%rbp), %rcx
addq $0x8, %rcx
movq -0x60(%rbp), %r8
addq $0xc, %r8
leaq 0x19b6(%rip), %rsi      # 0x14e53
movb $0x0, %al
callq 0x50e0
cmpl $0x3, %eax
je 0x134ca
movq -0x1a8(%rbp), %rcx
leaq 0x64a9(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x199b(%rip), %rdi      # 0x14e5f
movb $0x0, %al
callq *%rcx
jmp 0x13502
movl $0x48, %edi
callq 0x5180
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x60(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x60(%rbp)
movl -0x170(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x170(%rbp)
jmp 0x13436
jmp 0x13509
cmpl $0x0, -0x170(%rbp)
je 0x13520
movq -0x70(%rbp), %rax
movq $0x0, 0x40(%rax)
jmp 0x13528
movq $0x0, -0x68(%rbp)
movl -0x16c(%rbp), %eax
cmpl -0x174(%rbp), %eax
jge 0x13542
movl -0x174(%rbp), %eax
movl %eax, -0x16c(%rbp)
cmpl $0x0, -0x184(%rbp)
jne 0x13703
callq 0x5490
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x50(%rbp), %edi
callq 0x5230
movq %rax, -0x1a0(%rbp)
cmpq $0x0, -0x1a0(%rbp)
jne 0x1360e
callq 0x50a0
movq %rax, -0x158(%rbp)
cmpq $0x0, %rax
je 0x135a4
leaq -0x58(%rbp), %rdi
addq $0xc, %rdi
movq -0x158(%rbp), %rsi
callq 0x5460
jmp 0x1360c
movq -0x1a8(%rbp), %rcx
leaq 0x63ae(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x18c7(%rip), %rdi      # 0x14e86
movb $0x0, %al
callq *%rcx
movq -0x78(%rbp), %rdi
callq 0x54f0
movl $0x2, %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x5390
movl $0x1, %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x5390
cmpl $0x0, -0x184(%rbp)
jne 0x135ff
leaq 0x17b0(%rip), %rdi      # 0x14da8
xorl %esi, %esi
callq 0x12e30
movq $0x1, -0x8(%rbp)
jmp 0x13a3e
jmp 0x13625
leaq -0x58(%rbp), %rdi
addq $0xc, %rdi
movq -0x1a0(%rbp), %rax
movq (%rax), %rsi
callq 0x5460
cmpl $0x14, -0x170(%rbp)
jl 0x1363f
movq -0x58(%rbp), %rax
movq -0x70(%rbp), %rcx
cmpq (%rcx), %rax
jle 0x136d1
movl $0x1, -0x180(%rbp)
movl -0x170(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x170(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x60(%rbp)
movb %al, -0x1aa(%rbp)
je 0x13683
movq -0x58(%rbp), %rax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
setle %al
movb %al, -0x1aa(%rbp)
movb -0x1aa(%rbp), %al
testb $0x1, %al
jne 0x1368f
jmp 0x136a7
jmp 0x13691
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x60(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x13660
movq -0x60(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x68(%rbp), %rax
jne 0x136c3
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x136cf
movq -0x70(%rbp), %rax
leaq -0x58(%rbp), %rcx
movq %rcx, 0x40(%rax)
jmp 0x136d1
movl -0x16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
cmpl $0x0, -0x194(%rbp)
jne 0x13701
cmpl $0x0, -0x188(%rbp)
jne 0x13701
movl -0x174(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x174(%rbp)
jmp 0x13703
leaq -0xe0(%rbp), %rdi
movl -0x16c(%rbp), %edx
movl -0x174(%rbp), %ecx
leaq 0x178c(%rip), %rsi      # 0x14ea9
movb $0x0, %al
callq 0x52d0
movq -0x1a8(%rbp), %rcx
leaq -0xe0(%rbp), %rdi
leaq 0x6227(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
movb $0x0, %al
callq *%rcx
movq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x1385f
leaq -0x58(%rbp), %rax
cmpq %rax, -0x60(%rbp)
jne 0x13769
movb $0x3e, -0xe0(%rbp)
jmp 0x13770
movb $0x20, -0xe0(%rbp)
leaq -0xe0(%rbp), %rdi
addq $0x1, %rdi
movq -0x60(%rbp), %rdx
addq $0xc, %rdx
movq -0x60(%rbp), %rax
movq (%rax), %rcx
leaq 0x1743(%rip), %rsi      # 0x14ed4
movb $0x0, %al
callq 0x52d0
movq -0x1a8(%rbp), %rcx
leaq -0xe0(%rbp), %rdi
leaq 0x61b3(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
movb $0x0, %al
callq *%rcx
cmpl $0x0, -0x188(%rbp)
jne 0x137c9
cmpl $0x0, -0x194(%rbp)
je 0x137d3
leaq -0x58(%rbp), %rax
cmpq %rax, -0x60(%rbp)
je 0x1380d
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x50(%rbp), %eax
jne 0x13846
leaq -0x58(%rbp), %rdi
addq $0xc, %rdi
movq -0x60(%rbp), %rsi
addq $0xc, %rsi
callq 0x5430
cmpl $0x0, %eax
jne 0x13846
movl -0x178(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x178(%rbp)
cmpl $0x3, %eax
jle 0x13846
movl -0x170(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x170(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x68(%rbp), %rax
jne 0x13834
movq -0x60(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x13844
movq -0x60(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x70(%rbp), %rax
movq %rcx, 0x40(%rax)
jmp 0x1384e
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x60(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x1374b
cmpl $0x0, -0x184(%rbp)
jne 0x138d0
cmpl $0x0, -0x180(%rbp)
jne 0x138d0
movq -0x1a8(%rbp), %rcx
leaq 0x60e1(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x1535(%rip), %rdi      # 0x14dc1
movb $0x0, %al
callq *%rcx
leaq -0xe0(%rbp), %rdi
leaq -0x58(%rbp), %rdx
addq $0xc, %rdx
movq -0x58(%rbp), %rcx
leaq 0x1629(%rip), %rsi      # 0x14ed3
movb $0x0, %al
callq 0x52d0
movq -0x1a8(%rbp), %rcx
leaq -0xe0(%rbp), %rdi
leaq 0x609a(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
movb $0x0, %al
callq *%rcx
cmpl $0x0, -0x190(%rbp)
je 0x139fa
movq -0x78(%rbp), %rdi
callq 0x5360
movq -0x78(%rbp), %rdi
leaq -0x150(%rbp), %rdx
leaq 0x15f3(%rip), %rsi      # 0x14eeb
movb $0x0, %al
callq 0x5550
movq -0x78(%rbp), %rdi
movl -0x16c(%rbp), %edx
movl -0x174(%rbp), %ecx
leaq 0x15c8(%rip), %rsi      # 0x14ede
movb $0x0, %al
callq 0x5550
movq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x15c(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x60(%rbp)
movb %al, -0x1ab(%rbp)
je 0x1394e
cmpl $0x14, -0x15c(%rbp)
setl %al
movb %al, -0x1ab(%rbp)
movb -0x1ab(%rbp), %al
testb $0x1, %al
jne 0x1395a
jmp 0x1399f
movq -0x78(%rbp), %rdi
movq -0x60(%rbp), %rax
movq (%rax), %rdx
movq -0x60(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x60(%rbp), %r8
addq $0xc, %r8
leaq 0x156a(%rip), %rsi      # 0x14ee5
movb $0x0, %al
callq 0x5550
movq -0x60(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x60(%rbp)
movl -0x15c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x15c(%rbp)
jmp 0x1392f
cmpl $0x0, -0x194(%rbp)
je 0x139f8
movl 0x63c6(%rip), %eax      # 0x19d74
addl 0x63bc(%rip), %eax      # 0x19d70
movl %eax, 0x63b6(%rip)      # 0x19d70
movq -0x1a8(%rbp), %rcx
leaq 0x5f98(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x151a(%rip), %rdi      # 0x14eef
movb $0x0, %al
callq *%rcx
movq -0x1a8(%rbp), %rcx
leaq 0x5f79(%rip), %rax      # 0x19960
movq (%rax), %rax
movl 0x3c(%rax), %esi
leaq 0x151e(%rip), %rdi      # 0x14f12
movb $0x0, %al
callq *%rcx
jmp 0x139fa
movq -0x78(%rbp), %rdi
callq 0x54f0
movl $0x2, %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x5390
movl $0x1, %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x5390
cmpl $0x0, -0x184(%rbp)
jne 0x13a36
leaq 0x1510(%rip), %rdi      # 0x14f3f
xorl %esi, %esi
callq 0x12e30
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq