LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_gpr.c
// Function: gprsetclipwindow
void gprsetclipwindow(window)
     Window_t *window;
{
  clipr.x = (window->base.x-XOFF)*XM/XD;
  clipr.y = (window->base.y-YOFF)*XM/XD;
  clipr.width = window->size.x*XM/XD;
  clipr.height =  window->size.y*YM/YD;
}

// Assembly:
movl (%rdi), %eax
leal (,%rax,8), %ecx
subl %eax, %ecx
movl $0xfffffea2, %eax       # imm = 0xFFFFFEA2
addl %eax, %ecx
movslq %ecx, %rcx
imulq $0x66666667, %rcx, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x22, %rcx
addl %edx, %ecx
movw %cx, 0xce86(%rip)       # 0x146a0
movl 0x4(%rdi), %ecx
leal (,%rcx,8), %edx
subl %ecx, %edx
addl %eax, %edx
movslq %edx, %rax
imulq $0x66666667, %rax, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x22, %rax
addl %ecx, %eax
movw %ax, 0xce5c(%rip)       # 0x146a2
movl 0x8(%rdi), %eax
leal (,%rax,8), %ecx
subl %eax, %ecx
movl $0xcccccccd, %eax       # imm = 0xCCCCCCCD
imulq %rax, %rcx
shrq $0x23, %rcx
movw %cx, 0xce3e(%rip)       # 0x146a4
movl 0xc(%rdi), %ecx
leal (,%rcx,8), %edx
subl %ecx, %edx
imulq %rax, %rdx
shrq $0x23, %rdx
movw %dx, 0xce25(%rip)       # 0x146a6
retq
// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_gpr.c
// Function: waitforkey
void waitforkey(c)
     char c;
{
  char keystr;
  XEvent ev;

  XFlush(d);                    /* out with the old */
  while (XPending(d))
    XNextEvent(d, &ev);
                                /* now wait for the new */
  while (1) {
    XWindowEvent(d, w, KeyPressMask|ButtonPressMask, &ev);
    switch(ev.type) {
    case KeyPress:
      if (!c || XLookupString(&ev.xkey,&keystr,1,(KeySym *) 0,
                        (XComposeStatus *) 0) == 1 &&
          keystr == c)
        return;
      break;
    case ButtonPress:
      if (!c)
        return;
      break;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movl %edi, %ebx
movq 0xcd71(%rip), %rdi      # 0x14628
callq 0x4400
movq 0xcd65(%rip), %rdi      # 0x14628
callq 0x45c0
testl %eax, %eax
je 0x78f0
leaq 0x8(%rsp), %r14
movq 0xcd50(%rip), %rdi      # 0x14628
movq %r14, %rsi
callq 0x4340
movq 0xcd41(%rip), %rdi      # 0x14628
callq 0x45c0
testl %eax, %eax
jne 0x78d1
movsbl %bl, %ebp
leaq 0x8(%rsp), %r14
leaq 0x7(%rsp), %r15
movq 0xcd24(%rip), %rdi      # 0x14628
movq 0xcd25(%rip), %rsi      # 0x14630
movl $0x5, %edx
movq %r14, %rcx
callq 0x4350
movl 0x8(%rsp), %eax
cmpl $0x4, %eax
je 0x794f
cmpl $0x2, %eax
jne 0x78fd
testb %bl, %bl
je 0x7953
movq %r14, %rdi
movq %r15, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x40e0
cmpl $0x1, %eax
jne 0x78fd
movsbl 0x7(%rsp), %eax
cmpl %eax, %ebp
jne 0x78fd
jmp 0x7953
testb %bl, %bl
jne 0x78fd
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_graphics.c
// Function: message
void message(number, bell)
     int number;
     Bool bell;
{
  static int xpt = 70;
  static int ypt[] = {507, 567, 627};
  static char* messages[] = {"ENEMY TANK IN FIRING ARC",
                               "MOVEMENT BLOCKED BY OBJECT",
                               "SALVO FIRED BY ENEMY TANK"};
  int ind;
  char text[41];

  ind = abs(number) - 1;
  if (number < 0)
    sprintf(text,"%-40s"," ");
  else
    sprintf(text,"%-40s",messages[ind]);

  gprsetclippingactive(False);
  printstring(xpt, ypt[ind], text, 40);
  gprsetclippingactive(True);
  if (bell)
    tonetime();
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl %esi, %ebx
movl %edi, %ebp
negl %ebp
cmovsl %edi, %ebp
decl %ebp
testl %edi, %edi
js 0x7ad7
movslq %ebp, %r14
leaq 0x6caf(%rip), %rax      # 0xe76c
movslq (%rax,%r14,4), %rdx
addq %rax, %rdx
leaq 0x6f63(%rip), %rsi      # 0xea2e
movq %rsp, %rdi
xorl %eax, %eax
callq 0x42e0
jmp 0x7af2
leaq 0x6f50(%rip), %rsi      # 0xea2e
leaq 0x6f4f(%rip), %rdx      # 0xea34
movq %rsp, %rdi
xorl %eax, %eax
callq 0x42e0
movslq %ebp, %r14
xorl %edi, %edi
xorl %eax, %eax
callq 0x7212
leaq 0x6c5e(%rip), %rax      # 0xe760
movl (%rax,%r14,4), %esi
movq %rsp, %rdx
movl $0x46, %edi
movl $0x28, %ecx
xorl %eax, %eax
callq 0x6d9f
movl $0x1, %edi
xorl %eax, %eax
callq 0x7212
testl %ebx, %ebx
je 0x7b31
xorl %eax, %eax
callq 0x7296
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_graphics.c
// Function: screeninit
void screeninit()
{
  controlfont = gprloadfontfile(CONTROLFONT);
  titlefont = gprloadfontfile(TITLEFONT);
  generalfont = gprloadfontfile(GENERALFONT);
  staticscreen();
}

// Assembly:
pushq %rax
leaq 0x6ef4(%rip), %rdi      # 0xea36
xorl %eax, %eax
callq 0x75e9
movq %rax, 0xcbf0(%rip)      # 0x14740
leaq 0x6f0c(%rip), %rdi      # 0xea63
xorl %eax, %eax
callq 0x75e9
movq %rax, 0xcbe3(%rip)      # 0x14748
leaq 0x6f25(%rip), %rdi      # 0xea91
xorl %eax, %eax
callq 0x75e9
movq %rax, 0xcbd6(%rip)      # 0x14750
popq %rax
jmp 0x7b80
// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_graphics.c
// Function: xhairs
void xhairs (aligned)
     Bool aligned;
{
  static Bool last = False;
  static short pt1[] = {500, 215, 500, 235, 500, 285, 500, 305, 475, 240,
                          475, 235, 475, 235, 525, 235, 525, 235, 525, 240,
                          475, 280, 475, 285, 475, 285, 525, 285, 525, 285,
                          525, 280};
  static short pt2[] = {500, 215, 500, 235, 500, 285, 500, 305, 475, 245,
                          500, 235, 500, 235, 525, 245, 475, 275, 500, 285,
                          500, 285, 525, 275};
  static Bool draw = True;
  if (draw) {
    if (aligned) {
      if (!last) {
        gprsetdrawvalue(opt->cpi[COLOR_BG]);       /* erase the old */
        multiline(pt1, 8);
        last = True;
      }
      gprsetdrawvalue(opt->cpi[COLOR_XHAIR]);        /* draw the new */
      multiline(pt2, 6);
    }
    else {
      if (last) {
        gprsetdrawvalue(opt->cpi[COLOR_BG]);       /* erase the old */
        multiline(pt2, 6);
        last = False;
      }
      gprsetdrawvalue(opt->cpi[COLOR_XHAIR]);        /* draw the new */
      multiline(pt1, 8);
    }
  }
  draw = !draw;
}

// Assembly:
cmpl $0x0, 0xbcfa(%rip)      # 0x14400
je 0x87d4
pushq %rax
movb 0xc085(%rip), %al       # 0x14798
testl %edi, %edi
je 0x8771
testb $0x1, %al
jne 0x874c
leaq 0xbe5e(%rip), %rax      # 0x14580
movq (%rax), %rax
movl 0xf0(%rax), %edi
xorl %eax, %eax
callq 0x7660
leaq 0xbc57(%rip), %rdi      # 0x14390
movl $0x8, %esi
xorl %eax, %eax
callq 0x6ed0
movb $0x1, 0xc04c(%rip)      # 0x14798
leaq 0xbe2d(%rip), %rax      # 0x14580
movq (%rax), %rax
movl 0x104(%rax), %edi
xorl %eax, %eax
callq 0x7660
leaq 0xbc66(%rip), %rdi      # 0x143d0
movl $0x6, %esi
jmp 0x87c9
testb $0x1, %al
je 0x87a6
leaq 0xbe04(%rip), %rax      # 0x14580
movq (%rax), %rax
movl 0xf0(%rax), %edi
xorl %eax, %eax
callq 0x7660
leaq 0xbc3d(%rip), %rdi      # 0x143d0
movl $0x6, %esi
xorl %eax, %eax
callq 0x6ed0
movb $0x0, 0xbff2(%rip)      # 0x14798
leaq 0xbdd3(%rip), %rax      # 0x14580
movq (%rax), %rax
movl 0x104(%rax), %edi
xorl %eax, %eax
callq 0x7660
leaq 0xbbcc(%rip), %rdi      # 0x14390
movl $0x8, %esi
xorl %eax, %eax
callq 0x6ed0
addq $0x8, %rsp
xorl %eax, %eax
cmpl $0x0, 0xbc23(%rip)      # 0x14400
sete %al
movl %eax, 0xbc1a(%rip)      # 0x14400
retq
// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_main.c
// Function: initarray
void initarray(o)
     Genericp o;
{
  Genericp s;
  Genericp g;
  Genericp pl = o;
  int i, j;

  pl->type = IS_PLAYER;                 /* player is always the first */
  pl->attr = START_LIVING;              /* object.  Same size as the */
  pl->criticalx = 45.0;                 /* other tanks.  */
  pl->criticaly = 70.0;
  for (g=o; g<o+opt->mobjects; g++) {
    g->ca = 1.0;                        /* for those objects which */
    for (j=0; j<5; j++)                 /* have rotating parts, set */
      g->dc[j].ctp = g->dc[j].cta = 1.0;  /* the cos to 1.0 */
  }

  s = o+opt->sstart;                    /* player gets msalvos, each  */
  pl->salvo = s;                        /* enemy gets one.  the salvos */
  for (i=0; i<opt->msalvos; i++) {      /* must know who their owner */
    s->salvo = pl;                      /* is for a variety of reasons */
    s->type = IS_SALVO;                 /* first the player */
    s->lntype = LN_SALVO;
    s++;
  }
  for (g=o+opt->estart; g<o+opt->lstart; g++) {
    g->salvo = s;                       /* now the enemies */
    s->salvo = g;
    s->type = IS_SALVO;
    s->lntype = LN_SALVO;
    s++;
  }
}

// Assembly:
movl $0x100, (%rdi)          # imm = 0x100
movl $0x3, 0x8(%rdi)
movsd 0x5bbb(%rip), %xmm0     # 0xeb00
movsd %xmm0, 0x38(%rdi)
movq 0xb62f(%rip), %rax      # 0x14580
movslq 0x1c(%rax), %rcx
testq %rcx, %rcx
jle 0x8f9e
imulq $0x660, %rcx, %rcx      # imm = 0x660
addq %rdi, %rcx
movl $0x3f800000, %edx       # imm = 0x3F800000
movq %rdi, %rsi
movl $0x3f800000, 0x24(%rsi) # imm = 0x3F800000
movl $0x180, %r8d            # imm = 0x180
movl %edx, -0x8(%rsi,%r8)
movl %edx, (%rsi,%r8)
addq $0x130, %r8             # imm = 0x130
cmpq $0x770, %r8             # imm = 0x770
jne 0x8f79
addq $0x660, %rsi            # imm = 0x660
cmpq %rcx, %rsi
jb 0x8f6c
movslq 0x28(%rax), %rcx
imulq $0x660, %rcx, %rcx      # imm = 0x660
addq %rdi, %rcx
movq %rcx, 0x650(%rdi)
movl 0x10(%rax), %esi
movabsq $0x700000080, %rdx      # imm = 0x700000080
testl %esi, %esi
jle 0x8fd9
movq %rdi, 0x650(%rcx)
movq %rdx, (%rcx)
addq $0x660, %rcx            # imm = 0x660
decl %esi
jne 0x8fc4
movslq 0x20(%rax), %rsi
movslq 0x24(%rax), %rax
cmpl %eax, %esi
jge 0x901a
imulq $0x660, %rax, %rax      # imm = 0x660
addq %rdi, %rax
imulq $0x660, %rsi, %rsi      # imm = 0x660
addq %rdi, %rsi
movl $0x660, %edi            # imm = 0x660
movq %rcx, 0x650(%rsi)
movq %rsi, 0x650(%rcx)
movq %rdx, (%rcx)
addq %rdi, %rcx
addq %rdi, %rsi
cmpq %rax, %rsi
jb 0x8ffe
retq
// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_move.c
// Function: movelander
void movelander(g, pl)
     Genericp g;
     Genericp pl;
{
  float dx, dy, theta;

  if (++g->pcount > 20) {
    g->pcount = 0;

    if (g->range <= 750.0) {
      dx = g->x - pl->x;
      dy = g->y - pl->y;
      theta = atan (dy / (fabs(dx) + 1.0));
      if (dx <= 0.0)
        theta = PI - theta;
      /* the original fortran went to all the trouble of calculating
       * theta above, but never used it.  perhaps the following
       * statement was left out.
       */
      g->azm = theta;
    }

    if (frand() >= 0.5) {
      g->azm += frand() * PI / 4.0;
    }
    else {
      g->azm -= frand() * PI / 4.0;
    }
    g->speed = frand() * 20.0;
  }
}

// Assembly:
movl 0x4c(%rdi), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x4c(%rdi)
cmpl $0x14, %eax
jl 0xcec6
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x0, 0x4c(%rdi)
movss 0x2014(%rip), %xmm0     # 0xedac
ucomiss 0x34(%rdi), %xmm0
jb 0xce11
movss 0xc(%rbx), %xmm2
movss 0x10(%rbx), %xmm0
subss 0xc(%rsi), %xmm2
movaps %xmm2, (%rsp)
subss 0x10(%rsi), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x128f(%rip), %xmm1     # 0xe050
andps %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
addsd 0x1358(%rip), %xmm1     # 0xe128
divsd %xmm1, %xmm0
callq 0x4270
cvtsd2ss %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x1f24(%rip), %xmm2     # 0xed10
subsd %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsd2ss %xmm2, %xmm1
xorps %xmm2, %xmm2
movaps (%rsp), %xmm3
cmpnless %xmm2, %xmm3
andps %xmm3, %xmm0
andnps %xmm1, %xmm3
orps %xmm0, %xmm3
movss %xmm3, 0x20(%rbx)
callq 0x4510
movl $0xffff, %ebp           # imm = 0xFFFF
andl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x1244(%rip), %xmm0     # 0xe070
movsd %xmm0, (%rsp)
callq 0x4510
andl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x1229(%rip), %xmm0     # 0xe070
mulsd 0x1ec1(%rip), %xmm0     # 0xed10
mulsd 0x1f01(%rip), %xmm0     # 0xed58
xorps %xmm1, %xmm1
cvtss2sd 0x20(%rbx), %xmm1
movapd 0x17d9(%rip), %xmm2     # 0xe640
xorpd %xmm0, %xmm2
movsd 0x1e15(%rip), %xmm3     # 0xec88
cmpnlesd (%rsp), %xmm3
movapd %xmm3, %xmm4
andnpd %xmm0, %xmm4
andpd %xmm2, %xmm3
orpd %xmm4, %xmm3
addsd %xmm1, %xmm3
xorps %xmm0, %xmm0
cvtsd2ss %xmm3, %xmm0
movss %xmm0, 0x20(%rbx)
callq 0x4510
andl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x11c1(%rip), %xmm0     # 0xe070
mulsd 0x11c1(%rip), %xmm0     # 0xe078
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x2c(%rbx)
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_parseopts.c
// Function: pager
int pager(file)
     char* file;
{
  char buf[100], *pager, *getenv();
  static char defaultpager[] = PAGER;
  FILE *f;

  if ((pager = getenv("PAGER")) == NULL)
    pager = defaultpager;
  sprintf(buf,"%s%s",TANKDIR,file);
  if ((f=fopen(buf,"r")) != NULL) {
    fclose(f);
    switch (fork()) {
    case 0:
#ifndef WIN31
      execl(pager,pager,buf,0);
#endif
      fprintf(stderr,"Exec of %s failed\n", pager);
      return 1;
    case -1:
      fprintf(stderr,"Unable to fork process\n");
      return 1;
    default:
#ifndef WIN31
      wait(0);
#endif
      break;
    }
  }
  else {
    fprintf(stderr,"File %s not found or unreadable.\n", buf);
    return 1;
  }
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %r14
leaq 0x1fdd(%rip), %rdi      # 0xeeb8
callq 0x43d0
testq %rax, %rax
leaq 0x76ae(%rip), %rbx      # 0x14598
cmovneq %rax, %rbx
leaq 0x1fc9(%rip), %rsi      # 0xeebe
leaq 0x1fc7(%rip), %rdx      # 0xeec3
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x42e0
leaq 0x1bc1(%rip), %rsi      # 0xead4
movq %r15, %rdi
callq 0x41a0
testq %rax, %rax
je 0xcf4b
movq %rax, %rdi
callq 0x4500
callq 0x4530
cmpl $-0x1, %eax
je 0xcf75
testl %eax, %eax
je 0xcf68
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x4090
movl %ebx, %eax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0x5096(%rip), %rax      # 0x11fe8
movq (%rax), %rdi
leaq 0x1f9c(%rip), %rsi      # 0xeef8
movq %rsp, %rdx
xorl %eax, %eax
callq 0x4570
jmp 0xcf7a
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x460c
jmp 0xcf7a
callq 0x45f0
movl $0x1, %ebx
jmp 0xcf3f
// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_parseopts.c
// Function: getoptionint
int getoptionint(s)
     char *s;
{
  char rest[100];
  int num;

  if (sscanf(s, "%d%s", &num, rest) != 1) {
    printf("Error in optional argument %s; use -help for help.\n",
           s);
    exit(0);
  }
  return(num);
}

// Assembly:
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
leaq 0x1f87(%rip), %rsi      # 0xef1a
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x40f0
cmpl $0x1, %eax
jne 0xcfb6
movl 0xc(%rsp), %eax
addq $0x80, %rsp
popq %rbx
retq
leaq 0x1f62(%rip), %rdi      # 0xef1f
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4050
xorl %edi, %edi
callq 0x4110
// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_scores.c
// Function: printandwait
void printandwait(s, c)                 /* print a string and then */
     char* s;                           /* wait for a character c  */
     char c;                            /* to be pressed.  If c==0 */
{                                       /* then any keypress will  */
  y += ydelta;                          /* do.                     */
  xprintf(s, True);
  waitforkey(c);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl 0x7535(%rip), %ebp      # 0x14908
addl 0x7533(%rip), %ebp      # 0x1490c
movl %ebp, 0x7529(%rip)      # 0x14908
movl 0x751e(%rip), %r15d     # 0x14904
callq 0x4280
movl %r15d, %edi
movl %ebp, %esi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x6d9f
movl 0x7509(%rip), %eax      # 0x1490c
addl %eax, 0x74ff(%rip)      # 0x14908
movsbl %bl, %edi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x78a1
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/xpack.c
// Function: stat_file
static int
stat_file(struct file_stream *in, struct stat *stbuf, bool allow_hard_links)
{
	if (fstat(in->fd, stbuf) != 0) {
		msg("%"TS": unable to stat file", in->name);
		return -1;
	}

	if (!S_ISREG(stbuf->st_mode) && !in->is_standard_stream) {
		msg("%"TS" is %s -- skipping",
		    in->name, S_ISDIR(stbuf->st_mode) ? "a directory" :
							"not a regular file");
		return -2;
	}

	if (stbuf->st_nlink > 1 && !allow_hard_links) {
		msg("%"TS" has multiple hard links -- skipping "
		    "(use -f to process anyway)", in->name);
		return -2;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl (%rdi), %edi
callq 0x11d0
testl %eax, %eax
je 0x4940
movq 0x8(%rbx), %rsi
leaq 0x2aa2(%rip), %rdi      # 0x73d4
xorl %eax, %eax
callq 0x4b84
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x49a7
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%r14), %eax
cmpl $0x8000, %eax           # imm = 0x8000
je 0x4956
cmpb $0x0, 0x10(%rbx)
je 0x4979
cmpq $0x2, 0x10(%r14)
setb %cl
xorl %eax, %eax
orb %bpl, %cl
jne 0x49a7
movq 0x8(%rbx), %rsi
leaq 0x2ab0(%rip), %rdi      # 0x7420
xorl %eax, %eax
callq 0x4b84
jmp 0x49a2
movq 0x8(%rbx), %rsi
cmpl $0x4000, %eax           # imm = 0x4000
leaq 0x2a78(%rip), %rax      # 0x7401
leaq 0x2a7d(%rip), %rdx      # 0x740d
cmoveq %rax, %rdx
leaq 0x2a51(%rip), %rdi      # 0x73ec
xorl %eax, %eax
callq 0x4b84
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/prog_util.c
// Function: xmalloc
void *
xmalloc(size_t size)
{
	void *p = malloc(size);
	if (p == NULL && size == 0)
		p = malloc(1);
	if (p == NULL)
		msg("Out of memory");
	return p;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x1160
movq %rax, %rbx
orq %rax, %r14
jne 0x4c2f
movl $0x1, %edi
callq 0x1160
movq %rax, %rbx
testq %rbx, %rbx
jne 0x4c42
leaq 0x2a59(%rip), %rdi      # 0x7694
xorl %eax, %eax
callq 0x4b84
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/prog_util.c
// Function: xopen_for_read
int
xopen_for_read(const tchar *path, struct file_stream *strm)
{
	if (path == NULL) {
		strm->is_standard_stream = true;
		strm->name = T("standard input");
		strm->fd = STDIN_FILENO;
	#ifdef _WIN32
		_setmode(strm->fd, O_BINARY);
	#endif
		return 0;
	}

	strm->is_standard_stream = false;

	strm->name = quote_path(path);
	if (strm->name == NULL)
		return -1;

	strm->fd = topen(path, O_RDONLY | O_BINARY | O_NOFOLLOW);
	if (strm->fd < 0) {
		msg_errno("Can't open %"TS" for reading", strm->name);
		free(strm->name);
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
testq %rdi, %rdi
je 0x4ce5
movq %rdi, %r14
movb $0x0, 0x10(%rbx)
callq 0x4d03
movq %rax, 0x8(%rbx)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x4cfc
xorl %ebp, %ebp
movq %r14, %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %eax, %eax
callq 0x1180
movl %eax, (%rbx)
testl %eax, %eax
jns 0x4cfc
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x133c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x4cfc
movb $0x1, 0x10(%rbx)
leaq 0x29b2(%rip), %rax      # 0x76a2
movq %rax, 0x8(%rbx)
movl $0x0, (%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/prog_util.c
// Function: quote_path
static tchar *
quote_path(const tchar *path)
{
	size_t len = tstrlen(path);
	tchar *result;

	result = xmalloc((1 + len + 1 + 1) * sizeof(tchar));
	if (result == NULL)
		return NULL;
	result[0] = '"';
	tmemcpy(&result[1], path, len);
	result[1 + len] = '"';
	result[1 + len + 1] = '\0';
	return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x10a0
movq %rax, %r14
leaq 0x3(%rax), %rdi
callq 0x4c0e
movq %rax, %r15
testq %rax, %rax
je 0x4d41
movb $0x22, (%r15)
movq %r15, %rdi
incq %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1150
movw $0x22, 0x1(%r15,%r14)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/prog_util.c
// Function: xopen_for_write
int
xopen_for_write(const tchar *path, bool overwrite, struct file_stream *strm)
{
	if (path == NULL) {
		strm->is_standard_stream = true;
		strm->name = T("standard output");
		strm->fd = STDOUT_FILENO;
	#ifdef _WIN32
		_setmode(strm->fd, O_BINARY);
	#endif
		return 0;
	}

	strm->is_standard_stream = false;

	strm->name = quote_path(path);
	if (strm->name == NULL)
		goto err;
retry:
	strm->fd = topen(path, O_WRONLY | O_BINARY | O_NOFOLLOW |
				O_CREAT | O_EXCL, 0644);
	if (strm->fd < 0) {
		if (errno != EEXIST) {
			msg_errno("Can't open %"TS" for writing", strm->name);
			goto err;
		}
		if (!overwrite) {
			if (!isatty(STDERR_FILENO) || !isatty(STDIN_FILENO)) {
				msg("%"TS" already exists; use -f to overwrite",
				    strm->name);
				goto err;
			}
			fprintf(stderr, "%"TS": %"TS" already exists; "
				"overwrite? (y/n) ",
				program_invocation_name, strm->name);
			if (getchar() != 'y') {
				msg("Not overwriting.");
				goto err;
			}
		}
		if (tunlink(path) != 0) {
			msg_errno("Unable to delete %"TS, strm->name);
			goto err;
		}
		goto retry;
	}

	return 0;

err:
	free(strm->name);
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
testq %rdi, %rdi
je 0x4df0
movl %esi, %ebp
movq %rdi, %r15
movb $0x0, 0x10(%r14)
callq 0x4d03
leaq 0x8(%r14), %rbx
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x4e1d
xorl %r12d, %r12d
movq %r15, %rdi
movl $0x200c1, %esi          # imm = 0x200C1
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
callq 0x1180
movl %eax, (%r14)
testl %eax, %eax
jns 0x4e2b
callq 0x1050
cmpl $0x11, (%rax)
jne 0x4e37
testb %bpl, %bpl
jne 0x4dd8
movl $0x2, %edi
callq 0x1080
testl %eax, %eax
je 0x4e0c
xorl %edi, %edi
callq 0x1080
testl %eax, %eax
je 0x4e0c
movq %rbx, %rdi
callq 0x135a
testb $0x1, %al
je 0x4e1d
movq %r15, %rdi
callq 0x1060
testl %eax, %eax
je 0x4d81
movq (%rbx), %rsi
leaq 0x2968(%rip), %rdi      # 0x7756
jmp 0x4e41
movb $0x1, 0x10(%r14)
leaq 0x28cf(%rip), %rax      # 0x76cb
movq %rax, 0x8(%r14)
movl $0x1, (%r14)
xorl %r12d, %r12d
jmp 0x4e2b
movq (%rbx), %rsi
leaq 0x28df(%rip), %rdi      # 0x76f5
xorl %eax, %eax
callq 0x4b84
movq (%rbx), %rdi
callq 0x1040
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rsi
leaq 0x289a(%rip), %rdi      # 0x76db
xorl %eax, %eax
callq 0x12b1
jmp 0x4e1d
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/prog_util.c
// Function: xread
ssize_t
xread(struct file_stream *strm, void *buf, size_t count)
{
	char *p = buf;
	size_t orig_count = count;

	while (count != 0) {
		ssize_t res = read(strm->fd, p, MIN(count, INT_MAX));
		if (res == 0)
			break;
		if (res < 0) {
			msg_errno("Error reading from %"TS, strm->name);
			return -1;
		}
		p += res;
		count -= res;
	}
	return orig_count - count;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
testq %rdx, %rdx
je 0x4e90
movq %rsi, %r15
movq %rdi, %r14
movl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
movq %rbx, %r12
movl (%r14), %edi
cmpq %r13, %r12
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
cmovbq %r12, %rdx
movq %r15, %rsi
callq 0x1110
testq %rax, %rax
je 0x4e93
js 0x4ea3
addq %rax, %r15
subq %rax, %r12
jne 0x4e6a
xorl %r12d, %r12d
subq %r12, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x8(%r14), %rsi
leaq 0x28bc(%rip), %rdi      # 0x776a
xorl %eax, %eax
callq 0x12b1
movq $-0x1, %rbx
jmp 0x4e96
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/prog_util.c
// Function: skip_bytes
int
skip_bytes(struct file_stream *strm, size_t count)
{
	size_t bufsize;
	char *buffer;
	ssize_t ret;

	if (count == 0)
		return 0;

	bufsize = MIN(count, 4096);
	buffer = xmalloc(bufsize);
	if (buffer == NULL)
		return -1;
	do {
		size_t n = MIN(count, bufsize);
		ret = xread(strm, buffer, n);
		if (ret < 0)
			goto out;
		if (ret != n) {
			msg("%"TS": unexpected end-of-file", strm->name);
			ret = -1;
			goto out;
		}
		count -= ret;
	} while (count != 0);
	ret = 0;
out:
	free(buffer);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x4f36
movq %rsi, %r15
movq %rdi, %r14
movl $0x1000, %r12d          # imm = 0x1000
cmpq %r12, %rsi
cmovbq %rsi, %r12
movq %r12, %rdi
callq 0x4c0e
testq %rax, %rax
je 0x4f3b
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x4e4a
movq %rax, %r13
testq %rax, %rax
js 0x4f61
movq %r12, %rbp
cmpq %rbp, %r13
jne 0x4f43
subq %r13, %r15
je 0x4f5e
cmpq %r12, %r15
movq %r12, %rbp
cmovbq %r15, %rbp
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4e4a
movq %rax, %r13
testq %rax, %rax
jns 0x4f0a
jmp 0x4f61
xorl %r13d, %r13d
jmp 0x4f69
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x4f69
movq 0x8(%r14), %rsi
leaq 0x2525(%rip), %rdi      # 0x7473
xorl %eax, %eax
callq 0x4b84
movq $-0x1, %r13
jmp 0x4f61
xorl %r13d, %r13d
movq %rbx, %rdi
callq 0x1040
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/prog_util.c
// Function: full_write
int
full_write(struct file_stream *strm, const void *buf, size_t count)
{
	const char *p = buf;

	while (count != 0) {
		ssize_t res = write(strm->fd, p, MIN(count, INT_MAX));
		if (res <= 0) {
			msg_errno("Error writing to %"TS, strm->name);
			return -1;
		}
		p += res;
		count -= res;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %ebx, %ebx
testq %rdx, %rdx
je 0x4fbe
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
movl (%r15), %edi
cmpq %r13, %r14
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
cmovbq %r14, %rdx
movq %r12, %rsi
callq 0x1090
testq %rax, %rax
jle 0x4fca
addq %rax, %r12
subq %rax, %r14
jne 0x4f9a
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x8(%r15), %rsi
leaq 0x27ab(%rip), %rdi      # 0x7780
xorl %eax, %eax
callq 0x12b1
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x4fbe
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/prog_util.c
// Function: xclose
int
xclose(struct file_stream *strm)
{
	int ret = 0;
	if (strm->fd >= 0 && !strm->is_standard_stream) {
		if (close(strm->fd) != 0) {
			msg_errno("Error closing %"TS, strm->name);
			ret = -1;
		}
		free(strm->name);
	}
	strm->fd = -1;
	strm->name = NULL;
	return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rdi), %edi
xorl %ebp, %ebp
testl %edi, %edi
js 0x500b
cmpb $0x0, 0x10(%rbx)
jne 0x500b
callq 0x10f0
xorl %ebp, %ebp
testl %eax, %eax
jne 0x5022
movq 0x8(%rbx), %rdi
callq 0x1040
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq 0x8(%rbx), %rsi
leaq 0x2767(%rip), %rdi      # 0x7794
xorl %eax, %eax
callq 0x12b1
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x5002
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/prog_util.c
// Function: alloc_compressor
struct xpack_compressor *
alloc_compressor(u32 chunk_size, int level)
{
	struct xpack_compressor *c;

	c = xpack_alloc_compressor(chunk_size, level);
	if (c == NULL) {
		msg_errno("Unable to allocate compressor with "
			  "chunk size %"PRIu32" and compression level %d",
			  chunk_size, level);
	}
	return c;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %ebp
movl %edi, %edi
callq 0x5358
movq %rax, %r14
testq %rax, %rax
je 0x50ec
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2749(%rip), %rdi      # 0x783c
movl %ebp, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x12b1
jmp 0x50e4
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/programs/prog_util.c
// Function: alloc_decompressor
struct xpack_decompressor *
alloc_decompressor(void)
{
	struct xpack_decompressor *d;

	d = xpack_alloc_decompressor();
	if (d == NULL)
		msg_errno("Unable to allocate decompressor");

	return d;
}

// Assembly:
pushq %rbx
callq 0x68b4
movq %rax, %rbx
testq %rax, %rax
je 0x5113
movq %rbx, %rax
popq %rbx
retq
leaq 0x276c(%rip), %rdi      # 0x7886
xorl %eax, %eax
callq 0x12b1
jmp 0x510e
nop
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/zmac/getoptn.c
// Function: getoptn
int getoptn(int argc,char *argv[],char *optstring)
{
char *ptr;

/* check for end of arg list */
if(optnind==argc || *(argv[optnind])!='-' || strlen(argv[optnind])<=1)
  return(-1);

if((ptr=strchr(optstring,argv[optnind][optnpos]))==NULL)
  return('?');		/* error: unknown option */
else
  {
  optnopt=*ptr;
  if(ptr[1]==':')
    {
    if(optnind==argc-1) return(':');	/* error: missing option */
    optnarg=argv[optnind+1];
    optnpos=1;
    optnind+=2;
    return(optnopt);	/* return early, avoiding the normal increment */
    }
  }

/* now increment position ready for next time.
 * no checking is done for the end of args yet - this is done on
 * the next call.
 */
optnpos++;
if(optnpos>=strlen(argv[optnind]))
  {
  optnpos=1;
  optnind++;
  }

return(optnopt);	/* return the found option */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0xba12(%rip), %r13      # 0xe100
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpl %edi, %r13d
je 0x27aa
movq %rsi, %rbx
movq (%rsi,%r13,8), %r14
cmpb $0x2d, (%r14)
jne 0x27aa
movq %rdx, %r12
movl %edi, %ebp
movq %r14, %rdi
callq 0x2080
cmpq $0x2, %rax
jb 0x27aa
movl 0xb9d8(%rip), %r15d     # 0xe104
movsbl (%r14,%r15), %esi
movq %r12, %rdi
callq 0x2060
testq %rax, %rax
je 0x276f
movsbl (%rax), %r12d
movl %r12d, 0xc9cf(%rip)     # 0xf118
cmpb $0x3a, 0x1(%rax)
jne 0x2777
decl %ebp
movl $0x3a, %r15d
cmpl %ebp, %r13d
je 0x27aa
movq 0x8(%rbx,%r13,8), %rax
movq %rax, 0xc9b8(%rip)      # 0xf120
movl $0x2, %ecx
jmp 0x2793
movl $0x3f, %r15d
jmp 0x27aa
incl %r15d
movl %r15d, 0xb983(%rip)     # 0xe104
movq %r14, %rdi
callq 0x2080
movl $0x1, %ecx
cmpq %r15, %rax
ja 0x27a7
movl $0x1, 0xb967(%rip)      # 0xe104
addl %ecx, %r13d
movl %r13d, 0xb959(%rip)     # 0xe100
movl %r12d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/zmac/mio.c
// Function: mfputc
int mfputc(unsigned int c,FILE *f)
{
	unsigned char *p;
	UNUSED (f);
	while (mptr >= mhead + msize) {
		if ((p = realloc(mhead,msize+MALLOC_SIZE)) == (unsigned char *)-1) {
			fputs("mio: out of memory\n",stderr);
			return (-1);
		}
		else {
			msize += MALLOC_SIZE;
			mptr = (unsigned char *) (p + (unsigned int)(mptr - mhead));
			mhead = p;
		}
	}
	*mptr = c & 255;
	mend = ++mptr;
	return c;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edi, %ebx
movq 0xc909(%rip), %r12      # 0xf138
movq 0xc8f2(%rip), %r14      # 0xf128
movl 0xc8f3(%rip), %r13d     # 0xf130
leaq (%r14,%r13), %rax
cmpq %rax, %r12
jae 0x284b
movq %r12, %rcx
jmp 0x2896
addl $0x2710, %r13d          # imm = 0x2710
movl %r13d, %r15d
movq %r14, %rdi
movq %r15, %rsi
callq 0x21b0
cmpq $-0x1, %rax
je 0x28b5
movl %r13d, 0xc8c3(%rip)     # 0xf130
subl %r14d, %r12d
movq %rax, %rcx
addq %r12, %rcx
movq %rcx, 0xc8bb(%rip)      # 0xf138
movq %rax, 0xc8a4(%rip)      # 0xf128
addl $0x2710, %r13d          # imm = 0x2710
movq %rax, %r14
cmpq %r15, %r12
movq %rcx, %r12
jae 0x2852
movb %bl, (%rcx)
incq %rcx
movq %rcx, 0xc896(%rip)      # 0xf138
movq %rcx, 0xc897(%rip)      # 0xf140
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x21f0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x28a9
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/zmac/mio.c
// Function: mfread
int mfread(char *ptr, unsigned int size, unsigned int nitems, FILE *f)
{
	unsigned int i = 0;
	UNUSED (f);
	while (i < nitems) {
		if ((mptr + size) > mend)
			break;
		memcpy(ptr,mptr,size);
		ptr += size;
		mptr += size;
		i++;
	}
	return (i);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movl %edx, 0x4(%rsp)
testl %edx, %edx
je 0x297e
movq 0xc80c(%rip), %rax      # 0xf138
movl %esi, %r15d
movq 0xc80a(%rip), %r13      # 0xf140
movq %rax, 0x8(%rsp)
leaq (%rax,%r15), %r14
xorl %ebx, %ebx
xorl %ebp, %ebp
leaq (%r14,%rbx), %r12
cmpq %r13, %r12
ja 0x2980
movq 0x10(%rsp), %rax
leaq (%rax,%rbx), %rdi
movq 0x8(%rsp), %rax
leaq (%rax,%rbx), %rsi
movq %r15, %rdx
callq 0x20a0
movq %r12, 0xc7cb(%rip)      # 0xf138
incl %ebp
addq %r15, %rbx
cmpl %ebp, 0x4(%rsp)
jne 0x2943
movl 0x4(%rsp), %ebp
jmp 0x2980
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/zmac/mio.c
// Function: mfwrite
int mfwrite(char *ptr, int size, int nitems, FILE *f)
{
	int i = 0;
	unsigned char *p;
	UNUSED (f);
	while (i < nitems) {
		while (mptr + size >= mhead + msize) {
			if ((p = realloc(mhead,msize+MALLOC_SIZE)) == (unsigned char *)-1){
				fputs("mio: out of memory\n",stderr);
				return (-1);
			}
			else {
				msize += MALLOC_SIZE;
				mptr = (unsigned char *) (p + (unsigned int)(mptr - mhead));
				mhead = p;
			}
		}
		if ((mptr + size) > mhead + msize)
			break;
		memcpy(mend,ptr,size);
		ptr += size;
		mend += size;
		mptr = mend;
	}
	return (i);
}

// Assembly:
xorl %eax, %eax
testl %edx, %edx
jg 0x2998
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, (%rsp)
movq 0xc792(%rip), %rbx      # 0xf140
movq 0xc773(%rip), %r13      # 0xf128
movq 0xc77c(%rip), %r14      # 0xf138
movl 0xc76d(%rip), %r15d     # 0xf130
movslq %esi, %r12
leaq (%r14,%r12), %rax
movl %r15d, %ecx
addq %r13, %rcx
cmpq %rcx, %rax
jae 0x29da
movq %r13, %rbp
jmp 0x2a20
addl $0x2710, %r15d          # imm = 0x2710
movq %r13, %rdi
movq %r15, %rsi
callq 0x21b0
cmpq $-0x1, %rax
je 0x2a55
movq %rax, %rbp
movl %r15d, 0xc734(%rip)     # 0xf130
subl %r13d, %r14d
addq %rax, %r14
movq %r14, 0xc72f(%rip)      # 0xf138
movq %rax, 0xc718(%rip)      # 0xf128
leaq (%r14,%r12), %rax
leaq (%r15,%rbp), %rcx
movq %rbp, %r13
cmpq %rcx, %rax
jae 0x29da
movq %rbx, %rdi
movq (%rsp), %r14
movq %r14, %rsi
movq %r12, %rdx
callq 0x20a0
addq %r12, %r14
movq %r14, (%rsp)
addq %r12, %rbx
movq %rbx, 0xc6fd(%rip)      # 0xf140
movq %rbx, 0xc6ee(%rip)      # 0xf138
movq %rbx, %r14
movq %rbp, %r13
jmp 0x29c6
movq 0xb584(%rip), %rax      # 0xdfe0
movq (%rax), %rsi
leaq 0x559e(%rip), %rdi      # 0x8004
callq 0x2100
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/nmea0183/../common/common.c
// Function: getNow
uint64_t getNow(void)
{
  struct timeval tv;

  if (*fixedTimestamp != '\0')
  {
    return UINT64_C(1672527600000); // 2023-01-01 00:00
  }

  if (gettimeofday(&tv, (void *) 0) == 0)
  {
    uint64_t t    = tv.tv_sec;
    uint64_t msec = tv.tv_usec / 1000L;

    return t * 1000L + msec;
  }
  return 0L;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
cmpb $0x0, 0x4b14(%rip)      # 0x7190
je 0x268a
movabsq $0x1856a69d980, %rbx    # imm = 0x1856A69D980
jmp 0x26c2
xorl %ebx, %ebx
movq %rsp, %rdi
xorl %esi, %esi
callq 0x2120
testl %eax, %eax
jne 0x26c2
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x8(%rsp)
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
imulq $0x3e8, (%rsp), %rbx    # imm = 0x3E8
addq %rdx, %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/nmea0183/../common/common.c
// Function: fmtTimestamp
const char *fmtTimestamp(char str[DATE_LENGTH], uint64_t when)
{
  if (fixedTimestamp[0] != '\0')
  {
    return (const char *) fixedTimestamp;
  }
  else
  {
    time_t    t;
    struct tm tm;
    int       msec;
    size_t    len;

    if (when == UINT64_C(0))
    {
      when = getNow();
    }

    t    = when / 1000L;
    msec = when % 1000L;
    gmtime_r(&t, &tm);
    strftime(str, DATE_LENGTH - 5, "%Y-%m-%dT%H:%M:%S", &tm);
    len = strlen(str);
    snprintf(str + len, DATE_LENGTH - len, ".%3.3dZ", msec);
    return str;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
cmpb $0x0, 0x4ab5(%rip)      # 0x7190
je 0x26e9
leaq 0x4aac(%rip), %rbx      # 0x7190
jmp 0x276c
movq %rsi, %r14
movq %rdi, %rbx
testq %rsi, %rsi
jne 0x26fc
callq 0x2670
movq %rax, %r14
movq %r14, %rax
shrq $0x3, %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
mulq %rcx
shrq $0x4, %rdx
movq %rsp, %rdi
movq %rdx, (%rdi)
imull $0x3e8, %edx, %eax      # imm = 0x3E8
subl %eax, %r14d
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x2110
leaq 0x1d21(%rip), %rdx      # 0x4458
movl $0x37, %esi
movq %rbx, %rdi
movq %r15, %rcx
callq 0x21d0
movq %rbx, %rdi
callq 0x20b0
leaq (%rbx,%rax), %rdi
movl $0x3c, %esi
subq %rax, %rsi
leaq 0x1d08(%rip), %rdx      # 0x446a
movl %r14d, %ecx
xorl %eax, %eax
callq 0x20e0
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/nmea0183/../common/common.c
// Function: logBase
static int logBase(LogLevel level, const char *format, va_list ap)
{
  char strTmp[DATE_LENGTH];

  if (level > logLevel)
  {
    return 0;
  }

  fprintf(stderr, "%s %s [%s] ", logLevels[level], fmtNow(strTmp), progName);

  return vfprintf(stderr, format, ap);
}

// Assembly:
xorl %eax, %eax
cmpl %edi, 0x495d(%rip)      # 0x7178
jae 0x281e
retq
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq 0x47c0(%rip), %r13      # 0x6ff8
movq (%r13), %r15
movl %edi, %eax
leaq 0x1c03(%rip), %rcx      # 0x4448
movslq (%rcx,%rax,4), %r12
addq %rcx, %r12
movq %rsp, %rdi
xorl %esi, %esi
callq 0x26cb
movq 0x4973(%rip), %r8       # 0x71d0
leaq 0x1da5(%rip), %rsi      # 0x4609
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2150
movq (%r13), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2210
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/nmea0183/../common/common.c
// Function: logAbort
void logAbort(const char *format, ...)
{
  va_list ap;
  va_start(ap, format);

  logBase(LOGLEVEL_FATAL, format, ap);
  va_end(ap);
  fflush(stderr);
  fflush(stdout);
  exit(2);
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x2a15
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rdx
movq %rdi, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
xorl %edi, %edi
movq %r10, %rsi
callq 0x2813
movq 0x45b2(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
callq 0x21a0
movq 0x4583(%rip), %rax      # 0x6fd8
movq (%rax), %rdi
callq 0x21a0
movl $0x2, %edi
callq 0x2220
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/nmea0183/../common/common.c
// Function: die
void die(const char *t)
{
  int   e = errno;
  char *s = 0;

  if (e)
  {
    s = strerror(e);
  }

  if (s)
  {
    logAbort("%s: %s\n", t, s);
  }
  else
  {
    logAbort("%s\n", t);
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x2050
movl (%rax), %edi
testl %edi, %edi
je 0x2a80
callq 0x2260
testq %rax, %rax
jne 0x2a91
leaq 0x1c13(%rip), %rdi      # 0x469a
movq %rbx, %rsi
xorl %eax, %eax
callq 0x29b7
leaq 0x1b15(%rip), %rdi      # 0x45ad
movq %rbx, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x29b7
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/nmea0183/../common/common.c
// Function: setProgName
void setProgName(char *name)
{
  progName = strrchr(name, '/');
  if (!progName)
  {
    progName = strrchr(name, '\\');
  }
  if (!progName)
  {
    progName = name;
  }
  else
  {
    progName++;
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x2f, %esi
callq 0x2100
testq %rax, %rax
jne 0x2aee
movq %rbx, %rdi
movl $0x5c, %esi
callq 0x2100
leaq 0x1(%rax), %rcx
testq %rax, %rax
cmoveq %rbx, %rcx
movq %rcx, 0x46d0(%rip)      # 0x71d0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/nmea0183/../common/common.c
// Function: sbDelete
void sbDelete(StringBuffer *sb, size_t start, size_t end)
{
  if (end >= sb->len)
  {
    sbTruncate(sb, start);
  }
  else if (start < sb->len && sb->data)
  {
    end = CB_MIN(sb->len, end);
    if (end < sb->len)
    {
      memmove(sb->data + start, sb->data + end, sb->len - end);
    }
    sb->len -= end - start;
    sbTerminate(sb);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq %rax, %rdx
subq %r15, %rdx
jbe 0x2bd9
cmpq %rbx, %rax
jbe 0x2bf2
movq (%r14), %rsi
testq %rsi, %rsi
je 0x2bf2
leaq (%rsi,%rbx), %rdi
addq %r15, %rsi
callq 0x21e0
subq %r15, %rbx
addq 0x8(%r14), %rbx
jmp 0x2be0
cmpq %rbx, %rax
cmovbq %rax, %rbx
movq %rbx, 0x8(%r14)
movq (%r14), %rax
testq %rax, %rax
je 0x2bf2
addq %rbx, %rax
movb $0x0, (%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/nmea0183/../common/common.c
// Function: sbAppendEncodeHex
void sbAppendEncodeHex(StringBuffer *sb, const void *data, size_t len, char separator)
{
  sbEnsureCapacity(sb, sb->len + len * 3);

  for (; len > 0; len--, data++)
  {
    sbAppendFormat(sb, "%c%c", hexDigit(((uint8_t *) data)[0] >> 4), hexDigit(((uint8_t *) data)[0] & 0x0f));
    if (len > 1 && separator != '\0')
    {
      sbAppendData(sb, &separator, 1);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, 0x10(%rsp)
movq %rdi, %r12
leaq (%rdx,%rdx,2), %rsi
addq 0x8(%rdi), %rsi
callq 0x2b26
testq %r14, %r14
je 0x2d2e
leaq -0x1(%r14), %rax
movq %rax, 0x8(%rsp)
movl $0xff, %r13d
xorl %r15d, %r15d
testb %bl, %bl
sete %bpl
movq 0x10(%rsp), %rax
movb (%rax,%r15), %al
movl %eax, %ecx
shrb $0x4, %cl
leal 0x57(%rcx), %edx
orb $0x30, %cl
cmpb $-0x60, %al
movzbl %dl, %esi
movzbl %cl, %edx
cmovael %esi, %edx
andl %r13d, %edx
andb $0xf, %al
leal 0x57(%rax), %ecx
leal 0x30(%rax), %esi
cmpb $0xa, %al
movzbl %cl, %eax
movzbl %sil, %ecx
cmovael %eax, %ecx
andl %r13d, %ecx
movq %r12, %rdi
leaq 0x17b9(%rip), %rsi      # 0x4494
xorl %eax, %eax
callq 0x2d3d
cmpq %r15, 0x8(%rsp)
sete %al
orb %bpl, %al
jne 0x2d22
movq 0x8(%r12), %rsi
incq %rsi
movq %r12, %rdi
callq 0x2b26
movq (%r12), %rax
movq 0x8(%r12), %rcx
movb %bl, (%rax,%rcx)
movq (%r12), %rax
movq 0x8(%r12), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r12)
movb $0x0, 0x1(%rax,%rcx)
incq %r15
cmpq %r15, %r14
jne 0x2c92
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/nmea0183/../common/common.c
// Function: sbAppendDecodeHex
void sbAppendDecodeHex(StringBuffer *sb, const char *data, size_t len)
{
  uint8_t  nibble1;
  uint8_t  nibble2;
  uint8_t *d;

  sbEnsureCapacity(sb, len / 2 + 1 + sbGetLength(sb));
  d = (uint8_t *) sbGet(sb) + sbGetLength(sb);

  while (len >= 2)
  {
    nibble1 = (*data >= 'a') ? (*data - 'a' + 10) : (*data >= 'A' ? (*data - 'A' + 10) : (*data - '0'));
    data++;
    nibble2 = (*data >= 'a') ? (*data - 'a' + 10) : (*data >= 'A' ? (*data - 'A' + 10) : (*data - '0'));
    data++;
    *d++ = nibble1 << 4 | nibble2;
    len -= 2;
  }

  sb->len = d - (uint8_t *) sbGet(sb);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rdx, %rax
shrq %rax
movq 0x8(%rdi), %rcx
leaq (%rax,%rcx), %rsi
incq %rsi
callq 0x2b26
movq (%rbx), %rdx
testq %rdx, %rdx
leaq 0x159b(%rip), %rax      # 0x438d
movq %rdx, %rcx
cmoveq %rax, %rcx
addq 0x8(%rbx), %rcx
cmpq $0x2, %r14
jb 0x2e5d
movl $0xa9, %edx
movb (%r15), %sil
movl $0x9, %edi
cmpb $0x41, %sil
jge 0x2e1b
movl $0x40, %edi
movb 0x1(%r15), %r9b
movl $0xc9, %r8d
cmpb $0x41, %r9b
jge 0x2e31
movl $0xd0, %r8d
addb %dil, %sil
cmpb $0x61, %r9b
cmovgel %edx, %r8d
addb %r9b, %r8b
shlb $0x4, %sil
orb %r8b, %sil
movb %sil, (%rcx)
incq %rcx
addq $-0x2, %r14
addq $0x2, %r15
cmpq $0x1, %r14
ja 0x2e08
movq (%rbx), %rdx
testq %rdx, %rdx
cmovneq %rdx, %rax
subq %rax, %rcx
movq %rcx, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/nmea0183/../common/common.c
// Function: sbAppendFormatV
void sbAppendFormatV(StringBuffer *const sb, const char *const format, va_list ap)
{
  int     n;
  size_t  len;
  va_list ap2;

  len = 128;

  while (len < 4 * 1024 * 1024)
  {
    sbEnsureCapacity(sb, sb->len + len);

    va_copy(ap2, ap);
    n = vsnprintf(sb->data + sb->len, len, format, ap2);
    va_end(ap2);
    /*
     * Platform returned not an error, and the number of bytes was less
     * than the size of the buffer -> we're done
     * Note that some implementations (tru64) nicely guarantee zero terminated strings,
     * so we test for len - 1, not len.
     */
    if (n > -1 && (size_t) n < len - 1)
    {
      sb->len += n;
      sbTerminate(sb);
      break;
    }

    /*
     * Otherwise, increase the buffer smartly
     */

    if (n == -1)
    {
      len *= 2;
    }
    else
    {
      len = n + 2;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl $0x80, %r12d
movq %rsp, %r13
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x8(%rbx), %rsi
addq %r12, %rsi
movq %rbx, %rdi
callq 0x2b26
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
movups (%r14), %xmm0
movaps %xmm0, (%rsp)
movq (%rbx), %rdi
addq 0x8(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x2090
testl %eax, %eax
setns %cl
movl %eax, %eax
leaq -0x1(%r12), %rdx
cmpq %rax, %rdx
seta %dl
andb %cl, %dl
cmpb $0x1, %dl
je 0x2f87
addq %r12, %r12
leal 0x2(%rax), %ecx
cmpq %rbp, %rax
movslq %ecx, %rax
cmovneq %rax, %r12
cmpq $0x400000, %r12         # imm = 0x400000
jb 0x2f1e
jmp 0x2f9b
addq 0x8(%rbx), %rax
movq %rax, 0x8(%rbx)
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x2f9b
movb $0x0, (%rcx,%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq