LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/main.c
// Function: execute
int execute (int c, int f, int n)
{
  KEYTAB *ktp;
  int status;

  ktp = &keytab[0];	       /* Look in key table */
  while (ktp->k_fp != NULL)
    {
      if (ktp->k_code == c)
	{
	  thisflag = 0;
	  status = (*ktp->k_fp) (f, n);
	  lastflag = thisflag;
	  return (status);
	}
      ++ktp;
    }

  if ((c >= 0x20 && c <= 0x7E)	/* Self inserting */
      || (c >= 0xA0 && c <= 0xFE))
    {
      if (n <= 0)
	{			/* Fenceposts */
	  lastflag = 0;
	  return (n < 0 ? FALSE : TRUE);
	}
      thisflag = 0;		/* For the future */

      status = linsert (n, c);

      lastflag = thisflag;
      return (status);
    }
  mlwrite ("\007[Key not bound]"); /* complain */
  lastflag = 0;			/* Fake last flags */
  return (FALSE);
}

// Assembly:
pushq %rbx
movl %edi, %eax
movq 0x76db(%rip), %rcx      # 0xd338
testq %rcx, %rcx
je 0x5c9e
movswl 0x76c7(%rip), %edi      # 0xd330
cmpl %eax, %edi
je 0x5c8a
leaq 0x76d4(%rip), %rdi      # 0xd348
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x5c9e
movswl -0x8(%rdi), %r8d
addq $0x10, %rdi
cmpl %eax, %r8d
jne 0x5c74
movl $0x0, 0x7be4(%rip)      # 0xd878
movl %esi, %edi
movl %edx, %esi
xorl %eax, %eax
callq *%rcx
jmp 0x5cc5
movl %eax, %ecx
andl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
addl $-0x20, %ecx
cmpl $0x5e, %ecx
ja 0x5cd3
testl %edx, %edx
jle 0x5cef
movl $0x0, 0x7bbc(%rip)      # 0xd878
movl %edx, %edi
movl %eax, %esi
callq 0x50c0
movl 0x7bad(%rip), %ecx      # 0xd878
movl %ecx, 0x7b7f(%rip)      # 0xd850
jmp 0x5d01
leaq 0x36aa(%rip), %rdi      # 0x9384
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4352
movl $0x0, 0x7b63(%rip)      # 0xd850
jmp 0x5cff
movl $0x0, 0x7b57(%rip)      # 0xd850
sete %al
movzbl %al, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/main.c
// Function: quickexit
int quickexit (int f, int n)
{
  BUFFER *bp;			/* scanning pointer to buffers */

  bp = bheadp;
  while (bp != NULL)
    {
      if ((bp->b_flag & BFCHG) != 0 /* Changed */
	  && (bp->b_flag & BFTEMP) == 0)
	{			/* Real */
	  curbp = bp;		/* make that buffer current */
	  mlwrite ("[Saving %s]", (int*)bp->b_fname);
	  filesave (f, n);
	}
      bp = bp->b_bufp;		/* on to the next buffer */
    }
  return quit (f, n);		/* conditionally quit */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
movq 0x7afe(%rip), %r15      # 0xd880
testq %r15, %r15
je 0x5dc2
movl %esi, %ebp
leaq 0x3605(%rip), %r14      # 0x9395
movb 0x32(%r15), %al
andb $0x3, %al
cmpb $0x2, %al
jne 0x5dba
movq %r15, 0x7aa7(%rip)      # 0xd848
leaq 0x33(%r15), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x4352
movl %ebx, %edi
movl %ebp, %esi
xorl %eax, %eax
callq 0x4d0e
movq (%r15), %r15
testq %r15, %r15
jne 0x5d90
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5dd3
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/main.c
// Function: extendedcmd
int extendedcmd (int f, int n)
{
  int (*cmd)();
  int c;

  c = getctl();
  switch (c)
    {
    case 'A': cmd = backline; break;
    case 'B': cmd = forwline; break;
    case 'C': cmd = forwchar; break;
    case 'D': cmd = backchar; break;
    case 'H': cmd = gotobob; break;
    case 'W': cmd = gotoeob; break;
    case '5': cmd = backpage; getctl(); break;
    case '6': cmd = forwpage; getctl(); break;
    case '7': cmd = gotobob; getctl(); break;
    case '8': cmd = gotoeob; getctl(); break;
    default: mlwrite ("\007[Key not bound]");
      return (FALSE);
    }
  return cmd(f, n);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %ebp
leaq 0x77db(%rip), %r14      # 0xd790
xorl %eax, %eax
callq *0x20(%r14)
leal -0x61(%rax), %ecx
leal -0x20(%rax), %edx
cmpl $0x1a, %ecx
cmovael %eax, %edx
movl %edx, %eax
orl $0x140, %eax            # imm = 0x140
cmpl $0x20, %edx
cmovael %edx, %eax
leal -0x35(%rax), %ecx
cmpl $0x13, %ecx
ja 0x5ffb
leaq 0x3331(%rip), %rax      # 0x9314
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
xorl %eax, %eax
callq *0x20(%r14)
leaq -0x37bb(%rip), %rcx     # 0x283e
jmp 0x6064
cmpl $0x57, %eax
je 0x6024
leaq 0x337d(%rip), %rdi      # 0x9384
xorl %eax, %eax
callq 0x4352
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq -0x3caa(%rip), %rcx     # 0x2372
jmp 0x6064
xorl %eax, %eax
callq *0x20(%r14)
leaq -0x3b05(%rip), %rcx     # 0x2526
jmp 0x6064
leaq -0x3bc0(%rip), %rcx     # 0x2474
jmp 0x6064
xorl %eax, %eax
callq *0x20(%r14)
leaq -0x3b4e(%rip), %rcx     # 0x24f5
jmp 0x6064
xorl %eax, %eax
callq *0x20(%r14)
leaq -0x3890(%rip), %rcx     # 0x27c2
jmp 0x6064
leaq -0x3b07(%rip), %rcx     # 0x2554
jmp 0x6064
leaq -0x3c94(%rip), %rcx     # 0x23d0
movl %ebp, %edi
movl %ebx, %esi
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmpq *%rcx
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/random.c
// Function: showcpos
int showcpos (int f, int n)
{
  LINE *clp;
  long nch, nbc;
  int cbo, cac, ratio, col;

  clp = lforw (curbp->b_linep);	/* Grovel the data */
  cbo = 0;
  nch = 0;
  nbc = 0;
  cac = 0;
  for (;;)
    {
      if (clp == curwp->w_dotp && cbo == curwp->w_doto)
	{
	  nbc = nch;
	  if (cbo == llength (clp))
	    cac = '\n';
	  else
	    cac = lgetc (clp, cbo);
	}
      if (cbo == llength (clp))
	{
	  if (clp == curbp->b_linep)
	    break;
	  clp = lforw (clp);
	  cbo = 0;
	}
      else
	++cbo;
      ++nch;
    }
  col = getccol (FALSE);       /* Get real column */
  ratio = 0;		       /* Ratio before dot */
  if (nch != 0)
    ratio = (100L * nbc) / nch;
  mlwrite ("Char: %c (0%o, %d, 0x%x)  point=%D of %D(%d%%) column %d",
	   ((cac > 31) && (cac < 128) ? cac : 32),
	   cac, cac, cac, nbc + 1, nch, ratio, col);
  return (TRUE);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x77aa(%rip), %rax      # 0xd848
movq (%rax), %rax
movq 0x28(%rax), %rax
movq (%rax), %rcx
leaq 0x77a9(%rip), %rdx      # 0xd858
movq (%rdx), %rdx
movq 0x18(%rdx), %rsi
xorl %r12d, %r12d
xorl %ebx, %ebx
xorl %edi, %edi
xorl %r14d, %r14d
cmpq %rsi, %rcx
jne 0x60e5
movslq %edi, %r8
cmpq %r8, 0x20(%rdx)
jne 0x60e5
movl $0xa, %r14d
movq %r12, %rbx
cmpl 0x14(%rcx), %edi
je 0x60e5
movzbl 0x18(%rcx,%r8), %r14d
movq %r12, %rbx
cmpl 0x14(%rcx), %edi
jne 0x60f6
cmpq %rax, %rcx
je 0x60fd
movq (%rcx), %rcx
xorl %edi, %edi
jmp 0x60f8
incl %edi
incq %r12
jmp 0x60c0
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x6167
movl %eax, %r10d
testq %r12, %r12
je 0x611b
imulq $0x64, %rbx, %rax
cqto
idivq %r12
movq %rax, %r15
leal -0x20(%r14), %eax
cmpl $0x60, %eax
movl $0x20, %esi
cmovbl %r14d, %esi
incq %rbx
subq $0x8, %rsp
leaq 0x32de(%rip), %rdi      # 0x9417
movl %r14d, %edx
movl %r14d, %ecx
movl %r14d, %r8d
movq %rbx, %r9
xorl %eax, %eax
pushq %r10
pushq %r15
pushq %r12
callq 0x4352
addq $0x20, %rsp
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/random.c
// Function: twiddle
int twiddle (int f, int n)
{
  LINE *dotp;
  int doto, cl, cr;

  dotp = curwp->w_dotp;
  doto = curwp->w_doto;
  if (doto == llength (dotp) && --doto < 0)
    return (FALSE);
  cr = lgetc (dotp, doto);
  if (--doto < 0)
    return (FALSE);
  cl = lgetc (dotp, doto);
  lputc (dotp, doto + 0, cr);
  lputc (dotp, doto + 1, cl);
  lchange (WFEDIT);
  return (TRUE);
}

// Assembly:
leaq 0x7684(%rip), %rax      # 0xd858
movq (%rax), %rcx
movq 0x18(%rcx), %rax
movl 0x20(%rcx), %ecx
cmpl %ecx, 0x14(%rax)
jne 0x61e9
testl %ecx, %ecx
jle 0x621a
decl %ecx
testl %ecx, %ecx
jle 0x621a
pushq %rax
movl %ecx, %edx
decl %ecx
movb 0x18(%rax,%rdx), %sil
movb 0x18(%rax,%rcx), %dil
movb %sil, 0x18(%rax,%rcx)
movb %dil, 0x18(%rax,%rdx)
movl $0x4, %edi
callq 0x507e
movl $0x1, %eax
addq $0x8, %rsp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/random.c
// Function: openline
int openline (int f, int n)
{
  int i, s;

  if (n < 0)
    return (FALSE);
  if (n == 0)
    return (TRUE);
  i = n;		       /* Insert newlines */
  do
    {
      s = lnewline ();
    }
  while (s == TRUE && --i);
  if (s == TRUE)	       /* Then back up overtop */
    s = backchar (f, n);       /* of them all */
  return (s);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testl %esi, %esi
js 0x62c5
je 0x62c9
movl %esi, %ebx
movl %edi, %ebp
movl $0x1, %r14d
xorl %eax, %eax
callq 0x52ef
cmpl $0x1, %eax
jne 0x62b3
leal 0x1(%r14), %ecx
cmpl %r14d, %ebx
movl %ecx, %r14d
jne 0x629b
cmpl $0x1, %eax
jne 0x62ce
movl %ebp, %edi
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x2372
xorl %eax, %eax
jmp 0x62ce
movl $0x1, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/search.c
// Function: forwsearch
int forwsearch (int f, int n)
{
  int status=FALSE;

  if (n == 0)			/* resolve the repeat count */
    n = 1;
  if (n < 1)			/* search backwards */
    return (backsearch (f, -n));

  /* ask the user for the text of a pattern */
  if ((status = readpattern ("Search")) != TRUE)
    return (status);

  /* search for the pattern */
  while (n-- > 0)
    {
      if ((status = forscan (&pat[0], PTEND)) == FALSE)
	break;
    }

  /* and complain if not there */
  if (status == FALSE)
    mlwrite ("Not found");
  return (status);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
cmpl $0x1, %esi
adcl $0x0, %ebx
testl %ebx, %ebx
jle 0x6749
leaq 0x2d78(%rip), %rdi      # 0x9483
callq 0x6794
movl %eax, %ebp
cmpl $0x1, %eax
jne 0x675b
incl %ebx
leaq 0x7170(%rip), %r14      # 0xd890
decl %ebx
testl %ebx, %ebx
jle 0x6756
movq %r14, %rdi
movl $0x2, %esi
callq 0x684a
testl %eax, %eax
jne 0x6720
leaq 0x2d4c(%rip), %rdi      # 0x948a
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4352
jmp 0x675b
negl %ebx
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x6762
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/search.c
// Function: backsearch
int backsearch (int f, int n)
{
  int s;

  if (n == 0)			/* resolve null and negative arguments */
    n = 1;
  if (n < 1)
    return (forwsearch (f, -n));

  if ((s = readpattern("Reverse search")) != TRUE)/* get a pattern to search */
    return (s);

  return bsearch (f, n);	/* and go search for it */
}

// Assembly:
pushq %rbx
movl %esi, %ebx
cmpl $0x1, %esi
adcl $0x0, %ebx
testl %ebx, %ebx
jle 0x6788
leaq 0x2d2d(%rip), %rdi      # 0x94a3
callq 0x6794
cmpl $0x1, %eax
jne 0x6792
movl %ebx, %esi
popq %rbx
jmp 0x6a17
negl %ebx
movl %ebx, %esi
popq %rbx
jmp 0x66f4
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/search.c
// Function: readpattern
int readpattern (char *prompt)
{
  char tpat[NPAT + 20];
  int s;

  strncpy (tpat, prompt, NPAT-12); /* copy prompt to output string */
  strncat (tpat, " [", 3);	/* build new prompt string */
  expandp (&pat[0], &tpat[strlen (tpat)], NPAT / 2); /* add old pattern */
  strncat (tpat, "]<ESC>: ", 9);

  s = mlreplyt (tpat, tpat, NPAT, 27); /* Read pattern */

  if (s == TRUE)		/* Specified */
    strncpy (pat, tpat, NPAT);
  else if (s == FALSE && pat[0] != 0) /* CR, but old one */
    s = TRUE;

  return (s);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rsi
movq %rsp, %rbx
movl $0x44, %edx
movq %rbx, %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x20c0
xorl %ebp, %ebp
movb %bpl, 0x2(%rsp,%rax)
movw $0x5b20, (%rsp,%rax)    # imm = 0x5B20
movq %rbx, %rdi
callq 0x20c0
leaq (%rsp,%rax), %rsi
leaq 0x70b9(%rip), %r14      # 0xd890
movq %r14, %rdi
movl $0x28, %edx
callq 0x6bae
movq %rbx, %rdi
callq 0x20c0
movabsq $0x203a3e4353453c5d, %rcx # imm = 0x203A3E4353453C5D
movq %rcx, (%rsp,%rax)
movb %bpl, 0x8(%rsp,%rax)
movq %rbx, %rdi
movq %rbx, %rsi
movl $0x50, %edx
movl $0x1b, %ecx
callq 0x3fc0
testl %eax, %eax
je 0x6838
cmpl $0x1, %eax
jne 0x6841
leaq 0x706c(%rip), %rdi      # 0xd890
movq %rsp, %rsi
movl $0x50, %edx
callq 0x2060
movl $0x1, %eax
jmp 0x6841
xorl %eax, %eax
cmpb $0x0, (%r14)
setne %al
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/search.c
// Function: forwhunt
int forwhunt (int f, int n)
{
  int status=FALSE;

  /* resolve the repeat count */
  if (n == 0)
    n = 1;
  if (n < 1)			/* search backwards */
    return (backhunt (f, -n));

  /* Make sure a pattern exists */
  if (pat[0] == 0)
    {
      mlwrite ("No pattern set");
      return (FALSE);
    }
  /* search for the pattern */
  while (n-- > 0)
    {
      if ((status = forscan (&pat[0], PTEND)) == FALSE)
	break;
    }

  /* and complain if not there */
  if (status == FALSE)
    mlwrite ("Not found");
  return (status);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
cmpl $0x1, %esi
adcl $0x0, %ebx
testl %ebx, %ebx
jle 0x69af
leaq 0x6f0e(%rip), %rax      # 0xd890
cmpb $0x0, (%rax)
je 0x69bf
incl %ebx
leaq 0x6f00(%rip), %r14      # 0xd890
movq %r14, %rdi
movl $0x2, %esi
callq 0x684a
testl %eax, %eax
je 0x69c8
decl %ebx
cmpl $0x2, %ebx
jge 0x6990
movl $0x1, %ebx
jmp 0x69d8
negl %ebx
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x69e2
leaq 0x2ace(%rip), %rdi      # 0x9494
jmp 0x69cf
leaq 0x2abb(%rip), %rdi      # 0x948a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4352
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/search.c
// Function: backhunt
int backhunt (int f, int n)
{
  if (n == 0)			/* resolve null and negative arguments */
    n = 1;
  if (n < 1)
    return (forwhunt (f, -n));

  if (pat[0] == 0)		/* Make sure a pattern exists */
    {
      mlwrite ("No pattern set");
      return (FALSE);
    }
  return bsearch (f, n);	/* go search */
}

// Assembly:
cmpl $0x1, %esi
adcl $0x0, %esi
testl %esi, %esi
jle 0x69fd
leaq 0x6e9d(%rip), %rax      # 0xd890
cmpb $0x0, (%rax)
je 0x6a04
jmp 0x6a17
negl %esi
jmp 0x696b
pushq %rax
leaq 0x2a88(%rip), %rdi      # 0x9494
xorl %eax, %eax
callq 0x4352
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/window.c
// Function: enlargewind
int enlargewind (int f, int n)
{
  WINDOW *adjwp;
  LINE *lp;
  int i;

  if (n < 0)
    return (shrinkwind (f, -n));
  if (wheadp->w_wndp == NULL)
    {
      mlwrite ("Only one window");
      return (FALSE);
    }
  if ((adjwp = curwp->w_wndp) == NULL)
    {
      adjwp = wheadp;
      while (adjwp->w_wndp != curwp)
	adjwp = adjwp->w_wndp;
    }
  if (adjwp->w_ntrows <= n)
    {
      mlwrite ("Impossible change");
      return (FALSE);
    }
  if (curwp->w_wndp == adjwp)
    {				/* Shrink below */
      lp = adjwp->w_linep;
      for (i = 0; i < n && lp != adjwp->w_bufp->b_linep; ++i)
	lp = lforw (lp);
      adjwp->w_linep = lp;
      adjwp->w_toprow += n;
    }
  else
    {				/* Shrink above */
      lp = curwp->w_linep;
      for (i = 0; i < n && lback (lp) != curbp->b_linep; ++i)
	lp = lback (lp);
      curwp->w_linep = lp;
      curwp->w_toprow -= n;
    }
  curwp->w_ntrows += n;
  adjwp->w_ntrows -= n;
  curwp->w_flag |= WFMODE | WFHARD;
  adjwp->w_flag |= WFMODE | WFHARD;
  return (TRUE);
}

// Assembly:
testl %esi, %esi
js 0x776f
pushq %rbx
leaq 0x6166(%rip), %rax      # 0xd870
movq (%rax), %rdi
cmpq $0x0, (%rdi)
je 0x7776
leaq 0x613e(%rip), %rax      # 0xd858
movq (%rax), %rax
movq (%rax), %rdx
movq %rdx, %rcx
testq %rdx, %rdx
jne 0x7733
movq %rdi, %rcx
movq (%rdi), %rdi
cmpq %rax, %rdi
jne 0x7728
movsbl 0x39(%rcx), %edi
cmpl %esi, %edi
jle 0x777f
cmpq %rcx, %rdx
je 0x7791
movq 0x10(%rax), %rdx
testl %esi, %esi
je 0x77bb
leaq 0x60f9(%rip), %rdi      # 0xd848
movq (%rdi), %rdi
movq 0x28(%rdi), %rdi
movl %esi, %r8d
movq %rdx, %r9
movq 0x8(%rdx), %rdx
cmpq %rdi, %rdx
je 0x77be
movq %rdx, %r9
decl %r8d
jne 0x7759
jmp 0x77be
negl %esi
jmp 0x77df
leaq 0x1f52(%rip), %rdi      # 0x96cf
jmp 0x7786
leaq 0x1f59(%rip), %rdi      # 0x96df
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4352
jmp 0x77db
movq 0x10(%rcx), %rdx
testl %esi, %esi
je 0x77b1
movq 0x8(%rcx), %rdi
movq 0x28(%rdi), %rdi
movl %esi, %r8d
cmpq %rdi, %rdx
je 0x77b1
movq (%rdx), %rdx
decl %r8d
jne 0x77a4
movq %rdx, 0x10(%rcx)
addb %sil, 0x38(%rcx)
jmp 0x77c6
movq %rdx, %r9
movq %r9, 0x10(%rax)
subb %sil, 0x38(%rax)
addb %sil, 0x39(%rax)
subb %sil, 0x39(%rcx)
orb $0x18, 0x3b(%rax)
orb $0x18, 0x3b(%rcx)
movl $0x1, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/window.c
// Function: shrinkwind
int shrinkwind (int f, int n)
{
  WINDOW *adjwp;
  LINE *lp;
  int i;

  if (n < 0)
    return (enlargewind (f, -n));
  if (wheadp->w_wndp == NULL)
    {
      mlwrite ("Only one window");
      return (FALSE);
    }
  if ((adjwp = curwp->w_wndp) == NULL)
    {
      adjwp = wheadp;
      while (adjwp->w_wndp != curwp)
	adjwp = adjwp->w_wndp;
    }
  if (curwp->w_ntrows <= n)
    {
      mlwrite ("Impossible change");
      return (FALSE);
    }
  if (curwp->w_wndp == adjwp)
    {				/* Grow below */
      lp = adjwp->w_linep;
      for (i = 0; i < n && lback (lp) != adjwp->w_bufp->b_linep; ++i)
	lp = lback (lp);
      adjwp->w_linep = lp;
      adjwp->w_toprow -= n;
    }
  else
    {				/* Grow above */
      lp = curwp->w_linep;
      for (i = 0; i < n && lp != curbp->b_linep; ++i)
	lp = lforw (lp);
      curwp->w_linep = lp;
      curwp->w_toprow += n;
    }
  curwp->w_ntrows -= n;
  adjwp->w_ntrows += n;
  curwp->w_flag |= WFMODE | WFHARD;
  adjwp->w_flag |= WFMODE | WFHARD;
  return (TRUE);
}

// Assembly:
testl %esi, %esi
js 0x7851
pushq %rbx
leaq 0x6085(%rip), %rax      # 0xd870
movq (%rax), %rdx
cmpq $0x0, (%rdx)
je 0x7858
leaq 0x605d(%rip), %rax      # 0xd858
movq (%rax), %rax
movq (%rax), %rdi
movq %rdi, %rcx
testq %rdi, %rdi
jne 0x7814
movq %rdx, %rcx
movq (%rdx), %rdx
cmpq %rax, %rdx
jne 0x7809
movsbl 0x39(%rax), %edx
cmpl %esi, %edx
jle 0x7861
cmpq %rcx, %rdi
je 0x7873
movq 0x10(%rax), %rdi
testl %esi, %esi
je 0x7847
leaq 0x6018(%rip), %r8       # 0xd848
movq (%r8), %r8
movq 0x28(%r8), %r8
movl %esi, %r9d
cmpq %r8, %rdi
je 0x7847
movq (%rdi), %rdi
decl %r9d
jne 0x783a
movq %rdi, 0x10(%rax)
addb %sil, 0x38(%rax)
jmp 0x78a7
negl %esi
jmp 0x76fe
leaq 0x1e70(%rip), %rdi      # 0x96cf
jmp 0x7868
leaq 0x1e77(%rip), %rdi      # 0x96df
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4352
jmp 0x78be
movq 0x10(%rcx), %rdi
testl %esi, %esi
je 0x789c
movq 0x8(%rcx), %r8
movq 0x28(%r8), %r8
movl %esi, %r9d
movq %rdi, %r10
movq 0x8(%rdi), %rdi
cmpq %r8, %rdi
je 0x789f
movq %rdi, %r10
decl %r9d
jne 0x7886
jmp 0x789f
movq %rdi, %r10
movq %r10, 0x10(%rcx)
subb %sil, 0x38(%rcx)
subb %sil, %dl
movb %dl, 0x39(%rax)
addb %sil, 0x39(%rcx)
orb $0x18, 0x3b(%rax)
orb $0x18, 0x3b(%rcx)
movl $0x1, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/word.c
// Function: backword
int backword (int f, int n)
{
  if (n < 0)
    return (forwword (f, -n));
  if (backchar (FALSE, 1) == FALSE)
    return (FALSE);
  while (n--)
    {
      while (inword () == FALSE)
	{
	  if (backchar (FALSE, 1) == FALSE)
	    return (FALSE);
	}
      while (inword () != FALSE)
	{
	  if (backchar (FALSE, 1) == FALSE)
	    return (FALSE);
	}
    }
  return (forwchar (FALSE, 1));
}

// Assembly:
pushq %rbx
movl %esi, %ebx
testl %esi, %esi
js 0x7a6f
xorl %edi, %edi
movl $0x1, %esi
callq 0x2372
testl %eax, %eax
je 0x7a6b
testl %ebx, %ebx
je 0x7a79
decl %ebx
callq 0x7dea
testl %eax, %eax
jne 0x7a60
xorl %edi, %edi
movl $0x1, %esi
callq 0x2372
testl %eax, %eax
jne 0x7a35
jmp 0x7a6b
xorl %edi, %edi
movl $0x1, %esi
callq 0x2372
testl %eax, %eax
je 0x7a6b
callq 0x7dea
testl %eax, %eax
jne 0x7a50
jmp 0x7a2f
xorl %eax, %eax
popq %rbx
retq
negl %ebx
movl %ebx, %esi
popq %rbx
jmp 0x7a86
xorl %edi, %edi
movl $0x1, %esi
popq %rbx
jmp 0x23d0
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/word.c
// Function: forwword
int forwword (int f, int n)
{
  if (n < 0)
    return (backword (f, -n));
  while (n--)
    {
      while (inword () != FALSE)
	{
	  if (forwchar (FALSE, 1) == FALSE)
	    return (FALSE);
	}
      while (inword () == FALSE)
	{
	  if (forwchar (FALSE, 1) == FALSE)
	    return (FALSE);
	}
    }
  return (TRUE);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
testl %esi, %esi
js 0x7ad6
je 0x7ae5
decl %ebx
callq 0x7dea
testl %eax, %eax
je 0x7ac2
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
jne 0x7a93
jmp 0x7aea
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
je 0x7aea
callq 0x7dea
testl %eax, %eax
je 0x7ab0
movl $0x1, %ebp
testl %ebx, %ebx
jne 0x7a91
jmp 0x7aea
negl %ebx
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x7a18
movl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/word.c
// Function: upperword
int upperword (int f, int n)
{
  int c;

  if (n < 0)
    return (FALSE);
  while (n--)
    {
      while (inword () == FALSE)
	{
	  if (forwchar (FALSE, 1) == FALSE)
	    return (FALSE);
	}
      while (inword () != FALSE)
	{
	  c = lgetc (curwp->w_dotp, curwp->w_doto);
	  if (c >= 'a' && c <= 'z')
	    {
	      c -= 'a' - 'A';
	      lputc (curwp->w_dotp, curwp->w_doto, c);
	      lchange (WFHARD);
	    }
	  if (forwchar (FALSE, 1) == FALSE)
	    return (FALSE);
	}
    }
  return (TRUE);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testl %esi, %esi
js 0x7b74
je 0x7b78
movl %esi, %ebx
leaq 0x5d52(%rip), %r14      # 0xd858
decl %ebx
callq 0x7dea
testl %eax, %eax
jne 0x7b60
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
jne 0x7b08
jmp 0x7b7d
movq (%r14), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rcx
movb 0x18(%rax,%rcx), %dl
leal -0x61(%rdx), %esi
cmpb $0x19, %sil
ja 0x7b4e
addb $-0x20, %dl
movb %dl, 0x18(%rax,%rcx)
movl $0x8, %edi
callq 0x507e
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
je 0x7b7d
callq 0x7dea
testl %eax, %eax
jne 0x7b25
movl $0x1, %ebp
testl %ebx, %ebx
jne 0x7b06
jmp 0x7b7d
xorl %ebp, %ebp
jmp 0x7b7d
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/word.c
// Function: lowerword
int lowerword (int f, int n)
{
  int c;

  if (n < 0)
    return (FALSE);
  while (n--)
    {
      while (inword () == FALSE)
	{
	  if (forwchar (FALSE, 1) == FALSE)
	    return (FALSE);
	}
      while (inword () != FALSE)
	{
	  c = lgetc (curwp->w_dotp, curwp->w_doto);
	  if (c >= 'A' && c <= 'Z')
	    {
	      c += 'a' - 'A';
	      lputc (curwp->w_dotp, curwp->w_doto, c);
	      lchange (WFHARD);
	    }
	  if (forwchar (FALSE, 1) == FALSE)
	    return (FALSE);
	}
    }
  return (TRUE);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testl %esi, %esi
js 0x7c05
je 0x7c09
movl %esi, %ebx
leaq 0x5cc1(%rip), %r14      # 0xd858
decl %ebx
callq 0x7dea
testl %eax, %eax
jne 0x7bf1
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
jne 0x7b99
jmp 0x7c0e
movq (%r14), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rcx
movb 0x18(%rax,%rcx), %dl
leal -0x41(%rdx), %esi
cmpb $0x19, %sil
ja 0x7bdf
orb $0x20, %dl
movb %dl, 0x18(%rax,%rcx)
movl $0x8, %edi
callq 0x507e
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
je 0x7c0e
callq 0x7dea
testl %eax, %eax
jne 0x7bb6
movl $0x1, %ebp
testl %ebx, %ebx
jne 0x7b97
jmp 0x7c0e
xorl %ebp, %ebp
jmp 0x7c0e
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/word.c
// Function: capword
int capword (int f, int n)
{
  int c;

  if (n < 0)
    return (FALSE);
  while (n--)
    {
      while (inword () == FALSE)
	{
	  if (forwchar (FALSE, 1) == FALSE)
	    return (FALSE);
	}
      if (inword () != FALSE)
	{
	  c = lgetc (curwp->w_dotp, curwp->w_doto);
	  if (c >= 'a' && c <= 'z')
	    {
	      c -= 'a' - 'A';
	      lputc (curwp->w_dotp, curwp->w_doto, c);
	      lchange (WFHARD);
	    }
	  if (forwchar (FALSE, 1) == FALSE)
	    return (FALSE);
	  while (inword () != FALSE)
	    {
	      c = lgetc (curwp->w_dotp, curwp->w_doto);
	      if (c >= 'A' && c <= 'Z')
		{
		  c += 'a' - 'A';
		  lputc (curwp->w_dotp, curwp->w_doto, c);
		  lchange (WFHARD);
		}
	      if (forwchar (FALSE, 1) == FALSE)
		return (FALSE);
	    }
	}
    }
  return (TRUE);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testl %esi, %esi
js 0x7cbf
je 0x7cc3
movl %esi, %ebx
leaq 0x5c28(%rip), %r14      # 0xd858
decl %ebx
callq 0x7dea
testl %eax, %eax
jne 0x7c4f
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
jne 0x7c32
jmp 0x7cc8
movq (%r14), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rcx
movb 0x18(%rax,%rcx), %dl
leal -0x61(%rdx), %esi
cmpb $0x19, %sil
ja 0x7c78
addb $-0x20, %dl
movb %dl, 0x18(%rax,%rcx)
movl $0x8, %edi
callq 0x507e
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
je 0x7cc8
callq 0x7dea
testl %eax, %eax
je 0x7cb0
movq (%r14), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rcx
movb 0x18(%rax,%rcx), %dl
leal -0x41(%rdx), %esi
cmpb $0x19, %sil
ja 0x7c78
orb $0x20, %dl
jmp 0x7c6a
movl $0x1, %ebp
testl %ebx, %ebx
jne 0x7c30
jmp 0x7cc8
xorl %ebp, %ebp
jmp 0x7cc8
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/word.c
// Function: delfword
int delfword (int f, int n)
{
  LINE *dotp;
  int size, doto;

  if (n < 0)
    return (FALSE);
  dotp = curwp->w_dotp;
  doto = curwp->w_doto;
  size = 0;
  while (n--)
    {
      while (inword () != FALSE)
	{
	  if (forwchar (FALSE, 1) == FALSE)
	    return (FALSE);
	  ++size;
	}
      while (inword () == FALSE)
	{
	  if (forwchar (FALSE, 1) == FALSE)
	    return (FALSE);
	  ++size;
	}
    }
  curwp->w_dotp = dotp;
  curwp->w_doto = doto;
  return (ldelete (size, TRUE));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %esi, %esi
js 0x7d36
leaq 0x5b76(%rip), %r12      # 0xd858
movq (%r12), %rax
movq 0x18(%rax), %r15
movq 0x20(%rax), %r14
je 0x7d41
movl %esi, %ebp
xorl %ebx, %ebx
callq 0x7dea
testl %eax, %eax
je 0x7d23
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
je 0x7d36
incl %ebx
jmp 0x7cf4
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
je 0x7d36
incl %ebx
callq 0x7dea
testl %eax, %eax
je 0x7d11
decl %ebp
jne 0x7cf4
movq (%r12), %rax
jmp 0x7d43
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
movq %r15, 0x18(%rax)
movslq %r14d, %rcx
movq %rcx, 0x20(%rax)
movl %ebx, %edi
movl $0x1, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x53f3
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/word.c
// Function: delbword
int delbword (int f, int n)
{
  int size;

  if (n < 0)
    return (FALSE);
  if (backchar (FALSE, 1) == FALSE)
    return (FALSE);
  size = 0;
  while (n--)
    {
      while (inword () == FALSE)
	{
	  if (backchar (FALSE, 1) == FALSE)
	    return (FALSE);
	  ++size;
	}
      while (inword () != FALSE)
	{
	  if (backchar (FALSE, 1) == FALSE)
	    return (FALSE);
	  ++size;
	}
    }
  if (forwchar (FALSE, 1) == FALSE)
    return (FALSE);
  return (ldelete (size, TRUE));
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testl %esi, %esi
js 0x7de1
movl %esi, %ebp
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x1, %esi
callq 0x2372
testl %eax, %eax
je 0x7de1
testl %ebp, %ebp
je 0x7dbf
xorl %ebx, %ebx
callq 0x7dea
testl %eax, %eax
jne 0x7db2
xorl %edi, %edi
movl $0x1, %esi
callq 0x2372
testl %eax, %eax
je 0x7de1
incl %ebx
jmp 0x7d83
xorl %edi, %edi
movl $0x1, %esi
callq 0x2372
testl %eax, %eax
je 0x7de1
incl %ebx
callq 0x7dea
testl %eax, %eax
jne 0x7da0
decl %ebp
jne 0x7d83
xorl %edi, %edi
movl $0x1, %esi
callq 0x23d0
testl %eax, %eax
je 0x7de1
movl %ebx, %edi
movl $0x1, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x53f3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ThomasMadappattu[P]Sandmacs/word.c
// Function: inword
int inword ()
{
  int c;

  if (curwp->w_doto == llength (curwp->w_dotp))
    return (FALSE);
  c = lgetc (curwp->w_dotp, curwp->w_doto);
  if (c >= 'a' && c <= 'z')
    return (TRUE);
  if (c >= 'A' && c <= 'Z')
    return (TRUE);
  if (c >= '0' && c <= '9')
    return (TRUE);
  if (c == '$' || c == '_')	/* For identifiers */
    return (TRUE);
  return (FALSE);
}

// Assembly:
leaq 0x5a67(%rip), %rax      # 0xd858
movq (%rax), %rax
movq 0x18(%rax), %rcx
movq 0x20(%rax), %rdx
movslq 0x14(%rcx), %rsi
xorl %eax, %eax
cmpq %rsi, %rdx
je 0x7e36
movb 0x18(%rcx,%rdx), %cl
leal -0x30(%rcx), %edx
movl $0x1, %eax
cmpb $0xa, %dl
jb 0x7e36
movl %ecx, %edx
andb $-0x21, %dl
addb $-0x41, %dl
cmpb $0x1a, %dl
jb 0x7e36
cmpb $0x5f, %cl
sete %al
cmpb $0x24, %cl
sete %cl
orb %al, %cl
movzbl %cl, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/rikuu[P]kermit/kermit-color.c
// Function: color_stats
static void color_stats(const km_multicolor_t *colors, const size_t n_reads)
{
	size_t uncolored=0, ones=0, twos=0, multis=0;
	for (size_t i = 0; i < n_reads; i++) {
		if (colors[i].n == 0) uncolored++;
		else if (colors[i].n == 1) ones++;
		else if (colors[i].n == 2) twos++;
		else multis++;
	}
	fprintf(stderr, "[M::%s] %zu ones, %zu twos, %zu multis, %zu uncolored\n", __func__, ones, twos, multis, uncolored);
}

// Assembly:
pushq %rax
testq %rsi, %rsi
jne 0x279a
xorl %eax, %eax
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
jmp 0x27d3
xorl %r9d, %r9d
xorl %r8d, %r8d
xorl %ecx, %ecx
xorl %eax, %eax
movq (%rdi), %rdx
cmpq $0x2, %rdx
je 0x27c2
cmpq $0x1, %rdx
je 0x27bd
testq %rdx, %rdx
jne 0x27c7
incq %rax
jmp 0x27ca
incq %rcx
jmp 0x27ca
incq %r8
jmp 0x27ca
incq %r9
addq $0x18, %rdi
decq %rsi
jne 0x27a4
movq 0xb81e(%rip), %rdx      # 0xdff8
movq (%rdx), %rdi
movq %rax, (%rsp)
leaq 0x8358(%rip), %rsi      # 0xab40
leaq 0x8388(%rip), %rdx      # 0xab77
xorl %eax, %eax
callq 0x1100
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/rikuu[P]kermit/kermit-color.c
// Function: km_align_reference
km_multicolor_t *km_align_reference(km_idx_t *idx, size_t n_reads, int unicolor)
{
	km_multicolor_t *colors = (km_multicolor_t*) calloc(n_reads, sizeof(km_multicolor_t));
	for (size_t i = 0; i < idx->d->n_seq; i++) {
		km_target_t *target = &idx->targets[i];
		for (size_t j = 0; j < target->n_bins; j++) {
			const uint64_t color = unicolor ? (i << 16) : (i << 16 | (j + 1));
			for (size_t k = 0; k < target->bins[j].n; k++) {
				int32_t id = target->bins[j].a[k].qn;
				if (id == -1 || id >= (int32_t) n_reads || (colors[id].n > 0 && colors[id].a[colors[id].n - 1] == color)) continue;
				kv_push(uint64_t, colors[id], color);
			}
		}
	}
	color_stats(colors, n_reads);
	return colors;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, 0xc(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x10d0
movq %rbx, %r8
movq %rax, %rbp
movq 0x8(%r14), %rax
movl (%rax), %ecx
testl %ecx, %ecx
je 0x2972
xorl %esi, %esi
movq %r14, 0x10(%rsp)
movq %rbp, 0x38(%rsp)
movq %r8, 0x30(%rsp)
movq 0x10(%r14), %rdi
movq %rsi, %rdx
shlq $0x4, %rdx
movl (%rdi,%rdx), %eax
testl %eax, %eax
je 0x2964
addq %rdx, %rdi
movq %rsi, 0x18(%rsp)
shlq $0x10, %rsi
movq %rsi, 0x20(%rsp)
movq 0x8(%rdi), %rcx
xorl %esi, %esi
movq %rdi, 0x40(%rsp)
movq %rsi, %rdx
incq %rsi
cmpl $0x0, 0xc(%rsp)
movl $0x0, %r9d
cmoveq %rsi, %r9
imulq $0x18, %rdx, %r13
cmpq $0x0, (%rcx,%r13)
je 0x2949
movq %rsi, 0x28(%rsp)
orq 0x20(%rsp), %r9
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x10(%rcx,%r13), %rax
movslq (%rax,%r14), %rax
cmpl $-0x1, %eax
sete %dl
cmpl %r8d, %eax
setge %sil
orb %dl, %sil
jne 0x2931
imulq $0x18, %rax, %rax
leaq (%rax,%rbp), %rbx
movq (%rbp,%rax), %r15
testq %r15, %r15
je 0x28de
movq 0x10(%rbx), %rax
cmpq %r9, -0x8(%rax,%r15,8)
je 0x2931
cmpq 0x8(%rbx), %r15
jne 0x2922
leaq (%r15,%r15), %rsi
testq %r15, %r15
pushq $0x2
popq %rax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x3, %rsi
movq %r9, %rbp
callq 0x1160
movq %rbp, %r9
movq 0x40(%rsp), %rdi
movq 0x30(%rsp), %r8
movq 0x38(%rsp), %rbp
movq %rax, 0x10(%rbx)
movq 0x8(%rdi), %rcx
jmp 0x2926
movq 0x10(%rbx), %rax
leaq 0x1(%r15), %rdx
movq %rdx, (%rbx)
movq %r9, (%rax,%r15,8)
incq %r12
addq $0xc, %r14
cmpq (%rcx,%r13), %r12
jb 0x28a6
movl (%rdi), %eax
movq 0x28(%rsp), %rsi
movl %eax, %edx
cmpq %rdx, %rsi
jb 0x2872
movq 0x10(%rsp), %r14
movq 0x8(%r14), %rax
movl (%rax), %ecx
movq 0x18(%rsp), %rsi
incq %rsi
movl %ecx, %eax
cmpq %rax, %rsi
jb 0x2840
movq %rbp, %rdi
movq %r8, %rsi
callq 0x2788
movq %rbp, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mijallen[P]SimpleHTTPServer/lib/libyaml/tests/run-dumper.c
// Function: compare_documents
int compare_documents(yaml_document_t *document1, yaml_document_t *document2)
{
    int k;

    if ((document1->version_directive && !document2->version_directive)
            || (!document1->version_directive && document2->version_directive)
            || (document1->version_directive && document2->version_directive
                && (document1->version_directive->major != document2->version_directive->major
                    || document1->version_directive->minor != document2->version_directive->minor)))
        return 0;

    if ((document1->tag_directives.end - document1->tag_directives.start) !=
            (document2->tag_directives.end - document2->tag_directives.start))
        return 0;
    for (k = 0; k < (document1->tag_directives.end - document1->tag_directives.start); k ++) {
        if ((strcmp((char *)document1->tag_directives.start[k].handle,
                        (char *)document2->tag_directives.start[k].handle) != 0)
                || (strcmp((char *)document1->tag_directives.start[k].prefix,
                    (char *)document2->tag_directives.start[k].prefix) != 0))
            return 0;
    }

    if ((document1->nodes.top - document1->nodes.start) !=
            (document2->nodes.top - document2->nodes.start))
        return 0;

    if (document1->nodes.top != document1->nodes.start) {
        if (!compare_nodes(document1, 1, document2, 1))
            return 0;
    }

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movq 0x18(%rdi), %rcx
movq 0x18(%rsi), %rax
xorl %ebx, %ebx
testq %rcx, %rcx
je 0x16f1
testq %rax, %rax
je 0x179c
movl (%rcx), %edx
cmpl (%rax), %edx
jne 0x179c
movl 0x4(%rcx), %ecx
cmpl 0x4(%rax), %ecx
je 0x16fa
jmp 0x179c
testq %rax, %rax
jne 0x179c
movq 0x20(%r15), %r12
movq 0x28(%r15), %r13
subq %r12, %r13
movq 0x20(%r14), %rbp
movq 0x28(%r14), %rax
subq %rbp, %rax
xorl %ebx, %ebx
cmpq %rax, %r13
jne 0x179c
sarq $0x4, %r13
testq %r13, %r13
jle 0x1757
movl $0x8, %ebx
movq -0x8(%r12,%rbx), %rdi
movq -0x8(%rbp,%rbx), %rsi
callq 0x1170
testl %eax, %eax
jne 0x179a
movq (%r12,%rbx), %rdi
movq (%rbp,%rbx), %rsi
callq 0x1170
testl %eax, %eax
jne 0x179a
addq $0x10, %rbx
decq %r13
jne 0x1729
movq (%r15), %rax
movq 0x10(%r15), %rcx
movq %rcx, %rdx
subq %rax, %rdx
movq 0x10(%r14), %rsi
subq (%r14), %rsi
cmpq %rsi, %rdx
jne 0x179a
cmpq %rax, %rcx
movl $0x0, %ebx
je 0x1793
movq %r15, %rdi
movl $0x1, %esi
movq %r14, %rdx
movl $0x1, %ecx
callq 0x14d5
testl %eax, %eax
je 0x179c
movl $0x1, %ebx
jmp 0x179c
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/aes.c
// Function: AES_CBC_encrypt_buffer
void AES_CBC_encrypt_buffer(struct AES_ctx *ctx,uint8_t* buf, uint32_t length)
{
  uintptr_t i;
  uint8_t *Iv = ctx->Iv;
  for (i = 0; i < length; i += AES_BLOCKLEN)
  {
    XorWithIv(buf, Iv);
    Cipher((state_t*)buf, ctx->RoundKey);
    Iv = buf;
    buf += AES_BLOCKLEN;
    //printf("Step %d - %d", i/16, i);
  }
  /* store Iv in ctx for next call */
  memcpy(ctx->Iv, Iv, AES_BLOCKLEN);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0xb0(%rdi), %r15
movq %r15, %r14
testl %edx, %edx
je 0x2aaa
movq %rdi, %rbx
movl %edx, %r12d
xorl %r13d, %r13d
movq %r15, %rax
movq %rsi, %r14
xorl %ecx, %ecx
movb (%rax,%rcx), %dl
xorb %dl, (%r14,%rcx)
incq %rcx
cmpq $0x10, %rcx
jne 0x2a7f
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2386
leaq 0x10(%r14), %rsi
addq $0x10, %r13
movq %r14, %rax
cmpq %r12, %r13
jb 0x2a7a
movups (%r14), %xmm0
movups %xmm0, (%r15)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/aes.c
// Function: AES_CBC_decrypt_buffer
void AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf,  uint32_t length)
{
  uintptr_t i;
  uint8_t storeNextIv[AES_BLOCKLEN];
  for (i = 0; i < length; i += AES_BLOCKLEN)
  {
    memcpy(storeNextIv, buf, AES_BLOCKLEN);
    InvCipher((state_t*)buf, ctx->RoundKey);
    XorWithIv(buf, ctx->Iv);
    memcpy(ctx->Iv, storeNextIv, AES_BLOCKLEN);
    buf += AES_BLOCKLEN;
  }

}

// Assembly:
testl %edx, %edx
je 0x2b27
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl %edx, %r15d
leaq 0xb0(%rdi), %r12
xorl %r13d, %r13d
movups (%rbx), %xmm0
movaps %xmm0, (%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x265c
xorl %eax, %eax
movb (%r12,%rax), %cl
xorb %cl, (%rbx,%rax)
incq %rax
cmpq $0x10, %rax
jne 0x2af4
movaps (%rsp), %xmm0
movups %xmm0, (%r12)
addq $0x10, %rbx
addq $0x10, %r13
cmpq %r15, %r13
jb 0x2ae0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/crypto.c
// Function: aes128_cbc_encrypt
int aes128_cbc_encrypt(void *key, void *plaintext, void *ciphertext, int length, void *iv) {
    struct AES_ctx ctx;

    unsigned char *temp = (unsigned char *)malloc(length);
    if(!temp) {
        return 1;
    }

    memcpy(temp, plaintext, length);

    AES_init_ctx_iv(&ctx, key, iv);
    AES_CBC_encrypt_buffer(&ctx, temp, length);

    memcpy(ciphertext, temp, length);
    free(temp);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %r8, %r12
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r13
movslq %ecx, %r14
movq %r14, %rdi
callq 0x2150
testq %rax, %rax
je 0x2c35
movq %rax, %r15
movq %rax, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x2140
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x234e
movq %rbp, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x2a57
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2140
movq %r15, %rdi
callq 0x2030
xorl %eax, %eax
jmp 0x2c3a
movl $0x1, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/crypto.c
// Function: aes128_cbc_decrypt
int aes128_cbc_decrypt(void *key, void *ciphertext, void *plaintext, int length, void *iv) {
    struct AES_ctx ctx;

    unsigned char *temp = (unsigned char *)malloc(length);
    if(!temp) {
        return 1;
    }

    memcpy(temp, ciphertext, length);

    AES_init_ctx_iv(&ctx, key, iv);
    AES_CBC_decrypt_buffer(&ctx, temp, length);

    memcpy(plaintext, temp, length);
    free(temp);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %r8, %r12
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r13
movslq %ecx, %r14
movq %r14, %rdi
callq 0x2150
testq %rax, %rax
je 0x2cc5
movq %rax, %r15
movq %rax, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x2140
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x234e
movq %rbp, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x2abc
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2140
movq %r15, %rdi
callq 0x2030
xorl %eax, %eax
jmp 0x2cca
movl $0x1, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/flashtool.c
// Function: find_consolemap
struct consolemap_entry *find_consolemap(char *model) {
    int i, k;
    int good;
    char *m;

    for(i = 0; i < NUM_CONSOLES; i++) {
        m = g_consolemap[i].model;

        // loop and take wildcard into account
        good = 0;
        for(k = 0; k < MIN(strlen(m), strlen(model)); k++) {
            if(m[k] == '?' || m[k] == model[k]) {
                good = 1;
            } else {
                good = 0;
                break;
            }
        }

        if(good) {
            return &g_consolemap[i];
        }
    }

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x2090
movq %rax, %r14
xorl %r13d, %r13d
leaq 0x88e0(%rip), %rbp      # 0xc0e0
movq %r13, %r15
shlq $0x4, %r15
movq (%r15,%rbp), %r12
movq %r12, %rdi
callq 0x2090
cmpq %r14, %rax
cmovaeq %r14, %rax
testq %rax, %rax
je 0x383c
addq %rbp, %r15
xorl %ecx, %ecx
movb (%r12,%rcx), %dl
cmpb $0x3f, %dl
je 0x3832
cmpb (%rbx,%rcx), %dl
jne 0x383c
incq %rcx
cmpq %rcx, %rax
jne 0x3824
jmp 0x3848
incq %r13
cmpq $0x6, %r13
jne 0x3800
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/flashtool.c
// Function: find_codename
struct codename_entry *find_codename(char *codename) {
    int i;

    for(i = 0; i < NUM_CODENAMES; i++) {
        if(!strcmp(g_codenames[i].codename, codename)) {
            return &g_codenames[i];
        }
    }

    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
xorl %ebx, %ebx
leaq 0x88d2(%rip), %r15      # 0xc140
xorl %r12d, %r12d
movq (%r12,%r15), %rdi
movq %r14, %rsi
callq 0x2110
testl %eax, %eax
je 0x3890
addq $0x18, %r12
cmpq $0x1e0, %r12            # imm = 0x1E0
jne 0x3871
jmp 0x3896
addq %r12, %r15
movq %r15, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/flashtool.c
// Function: hexdump
void hexdump(unsigned char *data, int length, int newlines) {
    int i, k;

    for(i = 0; i < length; i++) {
        printf("%02X ", data[i]);

        if(newlines) {
            if(i != 0 && (i + 1) % 16 == 0) {
                printf("\n");
            }
        }
    }

    printf("\n");
}

// Assembly:
testl %esi, %esi
jle 0x3918
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
movl %esi, %r12d
negq %r12
movl $0x1, %r13d
leaq 0x4c05(%rip), %r15      # 0x84d1
testl %ebx, %ebx
setne %bpl
movzbl -0x1(%r14,%r13), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x20b0
testb $0xf, %r13b
sete %al
andb %bpl, %al
cmpb $0x1, %al
jne 0x38fa
movl $0xa, %edi
callq 0x2040
leaq (%r12,%r13), %rax
incq %rax
incq %r13
cmpq $0x1, %rax
jne 0x38cc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movl $0xa, %edi
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/flashtool.c
// Function: dumpbin
int dumpbin(unsigned char *filename, unsigned char *data, int length) {
    FILE *fp;

    fp = fopen(filename, "wb");
    if(!fp) {
        return 1;
    }
    
    fwrite(data, 1, length, fp);
    fclose(fp);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
leaq 0x4ba5(%rip), %rsi      # 0x84d7
callq 0x2180
testq %rax, %rax
je 0x395e
movq %rax, %r14
movslq %ebp, %rdx
movl $0x1, %esi
movq %rbx, %rdi
movq %rax, %rcx
callq 0x2190
movq %r14, %rdi
callq 0x2080
xorl %eax, %eax
jmp 0x3963
movl $0x1, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/flashtool.c
// Function: readbin
int readbin(unsigned char *filename, unsigned char **data, int *length) {
    FILE *fp;
    unsigned char *ptr;
    long size;

    fp = fopen(filename, "rb");
    if(!fp) {
        return 1;
    }

    fseek(fp, 0, SEEK_END);
    size = ftell(fp);
    fseek(fp, 0, SEEK_SET);
    
    ptr = (unsigned char *)malloc(size);
    if(!ptr) {
        return 1;
    }

    memset(ptr, 0, size);
    fread(ptr, 1, size, fp);
    fclose(fp);

    if(data) {
        *data = ptr;
    } else {
        free(ptr);
    }

    if(length) {
        *length = size;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x4b5a(%rip), %rsi      # 0x84da
callq 0x2180
movl $0x1, %ebp
testq %rax, %rax
je 0x3a04
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x2160
movq %r12, %rdi
callq 0x2130
movq %rax, %r15
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2160
movl $0x1, %edi
movq %r15, %rsi
callq 0x2100
testq %rax, %rax
je 0x3a04
movq %rax, %r13
movl $0x1, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %r12, %rcx
callq 0x2070
movq %r12, %rdi
callq 0x2080
testq %r14, %r14
je 0x39f2
movq %r13, (%r14)
jmp 0x39fa
movq %r13, %rdi
callq 0x2030
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x3a04
movl %r15d, (%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/flashtool.c
// Function: load_flashdump
unsigned char *load_flashdump(char *flashfile) {
    FILE *fp;
    unsigned char *data;
    int length;

    printf("loading flash dump '%s' ...\n", flashfile);

    if(readbin(flashfile, &data, &length)) {
        return NULL;
    }

    if(length != FLASH_SIZE) {
        printf("warning: flash size mismatch. is your flash really 32MB?\n");
    }

    return data;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x4ab7(%rip), %rdi      # 0x84dd
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x20b0
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
movq %r14, %rdi
callq 0x3968
testl %eax, %eax
jne 0x3a63
cmpl $0x2000000, 0xc(%rsp)   # imm = 0x2000000
je 0x3a5e
leaq 0x4ec4(%rip), %rdi      # 0x891d
callq 0x2060
movq 0x10(%rsp), %rbx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/flashtool.c
// Function: dump_console_info
int dump_console_info(unsigned char *flashdata, unsigned char *path) {
    struct nvs_console_info cinfo;
    char macaddress[6];
    FILE *fp = NULL;
    int i;

    // read console info and mac address
    nvs_read(flashdata, 0, 2, NVS_VAR_BLOCK2_CONSOLE_INF0, sizeof(cinfo), (unsigned char *)&cinfo);
    nvs_read(flashdata, 0, 0, NVS_VAR_BLOCK0_MAC_ADDRESS, sizeof(macaddress), macaddress);

    fp = fopen(path, "w");
    if(!fp) {
        return 1;
    }

    fprintf(fp, "motherboard serial: %.*s\n", (int)sizeof(cinfo.moboserial), cinfo.moboserial);
    fprintf(fp, "serial: %.*s\n", (int)sizeof(cinfo.serial), cinfo.serial);
    fprintf(fp, "model: %.*s\n", (int)sizeof(cinfo.model), cinfo.model);
    fprintf(fp, "mac address: ");
    for(i = 0; i < sizeof(macaddress); i++) {
        fprintf(fp, "%02X%c", macaddress[i] & 0xFF, (i == sizeof(macaddress) - 1) ? '\n' : ':');
    }

    fprintf(fp, "\n");

    fclose(fp);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xa(%rsp), %r9
xorl %esi, %esi
movl $0x2, %edx
xorl %ecx, %ecx
movl $0x4e, %r8d
callq 0x4e28
leaq 0x4(%rsp), %r9
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl $0x21, %ecx
movl $0x6, %r8d
callq 0x4e28
leaq 0x4910(%rip), %rsi      # 0x83ca
movq %rbx, %rdi
callq 0x2180
testq %rax, %rax
je 0x3b87
movq %rax, %rbx
leaq 0x4a2e(%rip), %rsi      # 0x8503
leaq 0xa(%rsp), %rcx
movq %rax, %rdi
movl $0xe, %edx
xorl %eax, %eax
callq 0x2120
leaq 0x3a(%rsp), %rcx
leaq 0x4a2a(%rip), %rsi      # 0x851f
movl $0xa, %ebp
movq %rbx, %rdi
movl $0xa, %edx
xorl %eax, %eax
callq 0x2120
leaq 0x4b(%rsp), %rcx
leaq 0x4a1a(%rip), %rsi      # 0x852f
movq %rbx, %rdi
movl $0xd, %edx
xorl %eax, %eax
callq 0x2120
leaq 0x4a13(%rip), %rdi      # 0x853e
movl $0xd, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2190
movq $-0x6, %r15
leaq 0x49af(%rip), %r14      # 0x84fa
movzbl 0xa(%rsp,%r15), %edx
incq %r15
movl $0x3a, %ecx
cmovel %ebp, %ecx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2120
testq %r15, %r15
jne 0x3b4b
movl $0xa, %edi
movq %rbx, %rsi
callq 0x20e0
movq %rbx, %rdi
callq 0x2080
xorl %eax, %eax
jmp 0x3b8c
movl $0x1, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq