LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/luau/xpfs.c
// Function: xpfs_chmod
static int xpfs_chmod(lua_State *L)
{
   const char *filename = luaL_checkstring(L, 1);
   const char *szmode = luaL_checkstring(L, 2);
   int n;

	struct stat info;

   /* we only want to change user bits here, so get the current state */
	n = stat(filename, &info);
   if (n == 0) {
      mode_t MMM = info.st_mode;
      char pm = szmode[0];
      if (pm == '+' || pm == '-') {
         ++szmode;
      } else {
         #ifdef _WIN32
            MMM &= ~( _S_IREAD | _S_IWRITE );
         #else
            MMM &= ~S_IRWXU;
         #endif
      }

      for (; *szmode; ++szmode) {
         int bit = 0;
         #ifdef _WIN32
            if (*szmode == 'r') { bit = _S_IREAD; }
            if (*szmode == 'w') { bit = _S_IWRITE; }
         #else
            if (*szmode == 'r') { bit = S_IRUSR; }
            if (*szmode == 'w') { bit = S_IWUSR; }
            if (*szmode == 'x') { bit = S_IXUSR; }
         #endif
         if (pm == '-') {
            MMM &= ~bit;
         } else {
            MMM |= bit;
         }
      }
      n = chmod(filename, MMM);
   }

   if (n==0) {
      lua_pushboolean(L, 1);
      return 1;
   } else {
      lua_pushnil(L);
      lua_pushstring(L, strerror(errno));
      return 2;
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1120
movq %rax, %r14
movl $0x2, %ebp
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1120
movq %rax, %r15
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x1150
testl %eax, %eax
jne 0x13c5
movl 0x20(%rsp), %ecx
movzbl (%r15), %eax
cmpl $0x2d, %eax
je 0x135c
cmpl $0x2b, %eax
jne 0x1361
incq %r15
jmp 0x1367
andl $0xfffffe3f, %ecx       # imm = 0xFFFFFE3F
movb (%r15), %r8b
testb %r8b, %r8b
je 0x13b7
incq %r15
movl $0x80, %edx
movl $0x40, %edi
xorl %esi, %esi
cmpb $0x72, %r8b
sete %sil
shll $0x8, %esi
cmpb $0x77, %r8b
cmovel %edx, %esi
cmpb $0x78, %r8b
cmovel %edi, %esi
movl %esi, %r8d
notl %r8d
andl %ecx, %r8d
orl %ecx, %esi
cmpb $0x2d, %al
cmovel %r8d, %esi
movb (%r15), %r8b
incq %r15
movl %esi, %ecx
testb %r8b, %r8b
jne 0x137c
jmp 0x13b9
movl %ecx, %esi
movq %r14, %rdi
callq 0x1190
testl %eax, %eax
je 0x13f4
movq %rbx, %rdi
callq 0x11a0
callq 0x1050
movl (%rax), %edi
callq 0x11d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11c0
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %ebp
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1180
jmp 0x13e4
// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/luau/xpfs.c
// Function: xpfs_remove
static int xpfs_remove(lua_State *L)
{
   const char *filename = luaL_checkstring(L, 1);

   int nerr = remove(filename);

   #ifdef _WIN32
   if (nerr) {
      nerr = chmod(filename, _S_IWRITE | _S_IREAD);
      if (nerr == 0) {
         nerr = remove(filename);
         if (nerr) { chmod(filename, _S_IREAD); }
      }
   }
   #endif

   if (nerr) {
      lua_pushnil(L);
      lua_pushstring(L, strerror(errno));
      return 2;
   }

   lua_pushboolean(L, 1);
   return 1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %ebp
movl $0x1, %esi
xorl %edx, %edx
callq 0x1120
movq %rax, %rdi
callq 0x1060
testl %eax, %eax
je 0x1997
movq %rbx, %rdi
callq 0x11a0
callq 0x1050
movl (%rax), %edi
callq 0x11d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11c0
movl $0x2, %ebp
jmp 0x19a4
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1180
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/luau/xpfs.c
// Function: xpfs_mkdir
static int xpfs_mkdir(lua_State *L)
{
   const char *dirname = luaL_checkstring(L, 1);

   if (mkdir(dirname, 0777)) {
      lua_pushnil(L);
      lua_pushstring(L, strerror(errno));
      return 2;
   }

   // success
   lua_pushboolean(L, 1);
   return 1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %ebp
movl $0x1, %esi
xorl %edx, %edx
callq 0x1120
movq %rax, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x1070
testl %eax, %eax
je 0x19fb
movq %rbx, %rdi
callq 0x11a0
callq 0x1050
movl (%rax), %edi
callq 0x11d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11c0
movl $0x2, %ebp
jmp 0x1a08
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1180
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/luau/xpfs.c
// Function: xpfs_chdir
static int xpfs_chdir(lua_State *L)
{
   const char *dirname = luaL_checkstring(L, 1);

   if (chdir(dirname)) {
      lua_pushnil(L);
      lua_pushstring(L, strerror(errno));
      return 2;
   }

   // success
   lua_pushboolean(L, 1);
   return 1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %ebp
movl $0x1, %esi
xorl %edx, %edx
callq 0x1120
movq %rax, %rdi
callq 0x10d0
testl %eax, %eax
je 0x1a5a
movq %rbx, %rdi
callq 0x11a0
callq 0x1050
movl (%rax), %edi
callq 0x11d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11c0
movl $0x2, %ebp
jmp 0x1a67
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1180
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/luau/xpfs.c
// Function: xpfs_rmdir
static int xpfs_rmdir(lua_State *L)
{
   const char *dirname = luaL_checkstring(L, 1);

   if (rmdir(dirname)) {
      lua_pushnil(L);
      lua_pushstring(L, strerror(errno));
      return 2;
   }

   // success
   lua_pushboolean(L, 1);
   return 1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %ebp
movl $0x1, %esi
xorl %edx, %edx
callq 0x1120
movq %rax, %rdi
callq 0x10a0
testl %eax, %eax
je 0x1ab9
movq %rbx, %rdi
callq 0x11a0
callq 0x1050
movl (%rax), %edi
callq 0x11d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11c0
movl $0x2, %ebp
jmp 0x1ac6
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1180
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/luau/xpfs.c
// Function: xpfs_getcwd
static int xpfs_getcwd(lua_State *L)
{
   char *dir = getcwd(NULL, 0);

   if (dir == NULL) {
      lua_pushnil(L);
      lua_pushstring(L, strerror(errno));
      return 2;
   }

   // success
   lua_pushstring(L, dir);
   free(dir);
   return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %edi, %edi
xorl %esi, %esi
callq 0x1100
testq %rax, %rax
je 0x1b01
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11c0
movq %r14, %rdi
callq 0x1040
movl $0x1, %eax
jmp 0x1b25
movq %rbx, %rdi
callq 0x11a0
callq 0x1050
movl (%rax), %edi
callq 0x11d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11c0
movl $0x2, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/luau/xpfs.c
// Function: xpfs_rename
static int xpfs_rename(lua_State *L)
{
   const char *from = luaL_checkstring(L, 1);
   const char *to = luaL_checkstring(L, 2);;

   if (rename(from, to)) {
      lua_pushnil(L);
      lua_pushstring(L, strerror(errno));
      return 2;
   }

   // success
   lua_pushboolean(L, 1);
   return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1120
movq %rax, %r14
movl $0x2, %ebp
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1120
movq %r14, %rdi
movq %rax, %rsi
callq 0x11b0
testl %eax, %eax
je 0x1b87
movq %rbx, %rdi
callq 0x11a0
callq 0x1050
movl (%rax), %edi
callq 0x11d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11c0
jmp 0x1b99
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1180
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/luau/xpfs.c
// Function: xpfs_dir
static int xpfs_dir(lua_State *L)
{
   int nargs = lua_gettop(L);
   const char *dirname = luaL_checkstring(L, 1);
   struct dirent *pde;
   DIR *pdir;
   int ndx;

   if (nargs > 1) {
      (void) luaL_checkstring(L, 2);
   }

   pdir = opendir(dirname);
   ndx = 0;

   if (!pdir) {
      lua_pushnil(L);
      lua_pushstring(L, strerror(errno));
      return 2;
   }

   lua_createtable(L, 2, 0); // at least two entries

   while ( (pde = readdir(pdir)) != NULL ) {
      lua_pushstring(L, pde->d_name);
      lua_rawseti(L, -2, ++ndx);
   }

   closedir(pdir);

   // success
   return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x1030
movl %eax, %ebp
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1120
movq %rax, %r14
cmpl $0x2, %ebp
jl 0x1bd4
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1120
movq %r14, %rdi
callq 0x1090
testq %rax, %rax
je 0x1c41
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x10b0
movq %r14, %rdi
callq 0x1170
testq %rax, %rax
je 0x1c32
movl $0x1, %ebp
addq $0x13, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11c0
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movl %ebp, %edx
callq 0x1140
movq %r14, %rdi
callq 0x1170
incl %ebp
testq %rax, %rax
jne 0x1c05
movq %r14, %rdi
callq 0x1110
movl $0x1, %eax
jmp 0x1c65
movq %rbx, %rdi
callq 0x11a0
callq 0x1050
movl (%rax), %edi
callq 0x11d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11c0
movl $0x2, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFUpdateHeader
void  DBFUpdateHeader(DBFHandle psDBF) {
  unsigned char abyFileHeader[32];

  if (psDBF->bNoHeader)
    DBFWriteHeader(psDBF);
  DBFFlushRecord(psDBF);
  fseek(psDBF->fp, 0, 0);
  fread(abyFileHeader, 32, 1, psDBF->fp);
  abyFileHeader[4] = (unsigned char) (psDBF->nRecords % 256);
  abyFileHeader[5] = (unsigned char) ((psDBF->nRecords / 256) % 256);
  abyFileHeader[6] = (unsigned char) ((psDBF->nRecords / (256 * 256)) % 256);
  abyFileHeader[7] = (unsigned char) ((psDBF->nRecords / (256 * 256 * 256)) % 256);
  fseek(psDBF->fp, 0, 0);
  fwrite(abyFileHeader, 32, 1, psDBF->fp);
  fflush(psDBF->fp);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x60(%rdi)
je 0x15a8
movq %rbx, %rdi
callq 0x163a
movq %rbx, %rdi
callq 0x16fc
movq (%rbx), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1180
movq (%rbx), %rcx
movq %rsp, %r14
movl $0x20, %esi
movl $0x1, %edx
movq %r14, %rdi
callq 0x10a0
movl 0x8(%rbx), %ecx
movb %cl, 0x4(%r14)
leal 0xff(%rcx), %eax
leal 0xffff(%rcx), %edx
leal 0xffffff(%rcx), %esi
testl %ecx, %ecx
cmovnsl %ecx, %eax
cmovnsl %ecx, %edx
movb %ah, 0x5(%rsp)
cmovnsl %ecx, %esi
shrl $0x10, %edx
movb %dl, 0x6(%r14)
shrl $0x18, %esi
movb %sil, 0x7(%r14)
movq (%rbx), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1180
movq (%rbx), %rcx
movl $0x20, %esi
movl $0x1, %edx
movq %r14, %rdi
callq 0x11e0
movq (%rbx), %rdi
addq $0x28, %rsp
popq %rbx
popq %r14
jmp 0x1170
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFWriteHeader
static void DBFWriteHeader(DBFHandle psDBF) {
  unsigned char abyHeader[XBASE_FLDHDR_SZ];
  int i;

  if (!psDBF->bNoHeader)
    return;
  psDBF->bNoHeader = FALSE;

  /* Initialize the file header information. */
  for (i = 0; i < XBASE_FLDHDR_SZ; i++)
    abyHeader[i] = 0;

  /* write out a dummy date */
  abyHeader[0] = 0x03;  /* memo field? - just copying */
  abyHeader[1] = 95;    /* YY */
  abyHeader[2] = 7;     /* MM */
  abyHeader[3] = 26;    /* DD */

  /* record count preset at zero */
  abyHeader[8] = (unsigned char) (psDBF->nHeaderLength % 256);
  abyHeader[9] = (unsigned char) (psDBF->nHeaderLength / 256);
  abyHeader[10] = (unsigned char) (psDBF->nRecordLength % 256);
  abyHeader[11] = (unsigned char) (psDBF->nRecordLength / 256);
  abyHeader[29] = (unsigned char) (psDBF->iLanguageDriver);

  /* Write the initial 32 byte file header, and all the field desc */
  fseek(psDBF->fp, 0, 0);
  fwrite(abyHeader, XBASE_FLDHDR_SZ, 1, psDBF->fp);
  fwrite(psDBF->pszHeader, XBASE_FLDHDR_SZ, psDBF->nFields, psDBF->fp);

  /* Write out the newline character if there is room for it. */
  if (psDBF->nHeaderLength > 32 * psDBF->nFields + 32) {
    char cNewline = 0x0d;
    fwrite(&cNewline, 1, 1, psDBF->fp);
  }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
cmpl $0x0, 0x60(%rdi)
je 0x16f4
movq %rdi, %rbx
movl $0x0, 0x60(%rdi)
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
movaps %xmm0, 0x10(%r14)
movl $0x1a075f03, (%r14)     # imm = 0x1A075F03
movl 0x10(%rdi), %ecx
movl $0xff, %eax
leal (%rcx,%rax), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
movb %cl, 0x8(%r14)
movb %dh, 0x9(%rsp)
movl 0xc(%rdi), %ecx
movb %cl, 0xa(%r14)
addl %ecx, %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
movb %ah, 0xb(%rsp)
movb 0x70(%rdi), %al
movb %al, 0x1d(%r14)
movq (%rdi), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1180
movq (%rbx), %rcx
movl $0x20, %esi
movl $0x1, %edx
movq %r14, %rdi
callq 0x11e0
movq (%rbx), %rcx
movq 0x38(%rbx), %rdi
movslq 0x14(%rbx), %rdx
movl $0x20, %esi
callq 0x11e0
movl 0x14(%rbx), %eax
shll $0x5, %eax
addl $0x20, %eax
cmpl %eax, 0x10(%rbx)
jle 0x16f4
movq (%rbx), %rsi
movl $0xd, %edi
addq $0x28, %rsp
popq %rbx
popq %r14
jmp 0x1100
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFFlushRecord
static int DBFFlushRecord(DBFHandle psDBF) {
  unsigned long nRecordOffset;

  if (psDBF->bCurrentRecordModified && psDBF->nCurrentRecord > -1) {
    psDBF->bCurrentRecordModified = FALSE;
    nRecordOffset = psDBF->nRecordLength * (unsigned long) psDBF->nCurrentRecord
      + psDBF->nHeaderLength;
    if (fseek(psDBF->fp, nRecordOffset, 0) != 0
        || fwrite(psDBF->pszCurrentRecord,psDBF->nRecordLength, 1, psDBF->fp) != 1) {
      char szMessage[128];
      sprintf(szMessage, "Failure writing DBF record %d.", psDBF->nCurrentRecord);
      fprintf(stderr, szMessage);
      return FALSE;
    }
  }
  return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x1, %ebx
cmpl $0x0, 0x44(%rdi)
je 0x1757
movq %rdi, %r14
movslq 0x40(%rdi), %rax
testq %rax, %rax
js 0x1757
movl $0x0, 0x44(%r14)
movslq 0xc(%r14), %rcx
imulq %rax, %rcx
movslq 0x10(%r14), %rsi
addq %rcx, %rsi
movq (%r14), %rdi
xorl %edx, %edx
callq 0x1180
testl %eax, %eax
jne 0x1761
movq (%r14), %rcx
movq 0x48(%r14), %rdi
movslq 0xc(%r14), %rsi
movl $0x1, %edx
callq 0x11e0
cmpq $0x1, %rax
jne 0x1761
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
addq $0x40, %r14
movq %r14, %rdi
callq 0x124a
xorl %ebx, %ebx
jmp 0x1757
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFClose
void  DBFClose(DBFHandle psDBF) {
  if (psDBF != NULL) {
    if (psDBF->bNoHeader)
      DBFWriteHeader(psDBF);
    DBFFlushRecord(psDBF);
    if (psDBF->bUpdated)
      DBFUpdateHeader(psDBF);
    fclose(psDBF->fp);
    free(psDBF->panFieldOffset);
    free(psDBF->panFieldSize);
    free(psDBF->panFieldDecimals);
    free(psDBF->pachFieldType);
    free(psDBF->pszWorkField);
    free(psDBF->pszHeader);
    free(psDBF->pszCurrentRecord);
    free(psDBF->pszCodePage);
    free(psDBF);
  }
}

// Assembly:
testq %rdi, %rdi
je 0x1ca6
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x60(%rdi)
je 0x1c37
movq %rbx, %rdi
callq 0x163a
movq %rbx, %rdi
callq 0x16fc
cmpl $0x0, 0x64(%rbx)
je 0x1c4d
movq %rbx, %rdi
callq 0x1590
movq (%rbx), %rdi
callq 0x10c0
movq 0x18(%rbx), %rdi
callq 0x1030
movq 0x20(%rbx), %rdi
callq 0x1030
movq 0x28(%rbx), %rdi
callq 0x1030
movq 0x30(%rbx), %rdi
callq 0x1030
movq 0x58(%rbx), %rdi
callq 0x1030
movq 0x38(%rbx), %rdi
callq 0x1030
movq 0x48(%rbx), %rdi
callq 0x1030
movq 0x78(%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
popq %rbx
jmp 0x1030
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFIsAttributeNULL
int  DBFIsAttributeNULL(DBFHandle psDBF, int iRecord, int iField) {
  const char *pszValue;

  pszValue = DBFReadStringAttribute(psDBF, iRecord, iField);

  if (pszValue == NULL)
    return TRUE;

  return DBFIsValueNULL(psDBF->pachFieldType[iField], pszValue);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
movl $0x43, %ecx
callq 0x21c0
testq %rax, %rax
je 0x232d
movq 0x30(%r14), %rcx
movslq %ebx, %rdx
movsbl (%rcx,%rdx), %edi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x233a
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFIsValueNULL
static int DBFIsValueNULL(char chType, const char *pszValue) {
  int i;

  if (pszValue == NULL)
    return TRUE;

  switch (chType) {
  case 'N':
  case 'F':
    /*
    ** We accept all asterisks or all blanks as NULL
    ** though according to the spec I think it should be all
    ** asterisks.
    */
    if (pszValue[0] == '*')
      return TRUE;
    for (i = 0; pszValue[i] != '\0'; i++) {
      if (pszValue[i] != ' ')
        return FALSE;
    }
    return TRUE;

  case 'D':
    /* NULL date fields have value "00000000" */
    return strncmp(pszValue, "00000000", 8) == 0;

  case 'L':
    /* NULL boolean fields have value "?" */
    return pszValue[0] == '?';

  default:
    /* empty string fields are considered NULL */
    return strlen(pszValue) == 0;
  }
}

// Assembly:
pushq %rax
movb $0x1, %al
testq %rsi, %rsi
je 0x23a0
movsbl %dil, %ecx
addl $-0x44, %ecx
rorl %ecx
cmpl $0x5, %ecx
ja 0x239a
leaq 0x1cfd(%rip), %rdx      # 0x4054
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpb $0x2a, (%rsi)
jne 0x236a
jmp 0x23a0
incq %rsi
movzbl (%rsi), %ecx
cmpl $0x20, %ecx
je 0x2367
testl %ecx, %ecx
je 0x23a0
xorl %eax, %eax
jmp 0x23a0
leaq 0x1d51(%rip), %rax      # 0x40d2
movl $0x8, %edx
movq %rsi, %rdi
movq %rax, %rsi
callq 0x1070
testl %eax, %eax
jmp 0x239d
cmpb $0x3f, (%rsi)
jmp 0x239d
cmpb $0x0, (%rsi)
sete %al
movzbl %al, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFGetFieldInfo
DBFFieldType  DBFGetFieldInfo(DBFHandle psDBF, int iField, char *pszFieldName,
                                         int *pnWidth, int *pnDecimals) {
  if (iField < 0 || iField >= psDBF->nFields)
    return (FTInvalid);

  if (pnWidth != NULL)
    *pnWidth = psDBF->panFieldSize[iField];
  if (pnDecimals != NULL)
    *pnDecimals = psDBF->panFieldDecimals[iField];
  if (pszFieldName != NULL) {
    int i;
    strncpy(pszFieldName, (char *) psDBF->pszHeader + iField * 32, 11);
    pszFieldName[11] = '\0';
    for (i = 10; i > 0 && pszFieldName[i] == ' '; i--)
      pszFieldName[i] = '\0';
  }

  if (psDBF->pachFieldType[iField] == 'L')
    return (FTLogical);
  else if (psDBF->pachFieldType[iField] == 'N'
           || psDBF->pachFieldType[iField] == 'F') {
    if (psDBF->panFieldDecimals[iField] > 0
        || psDBF->panFieldSize[iField] > 10)
      return (FTDouble);
    else
      return (FTInteger);
  } else {
    return (FTString);
  }
}

// Assembly:
movl $0x4, %eax
testl %esi, %esi
js 0x246e
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl %esi, 0x14(%rdi)
jle 0x2469
movq %rdx, %r14
movl %esi, %r15d
testq %rcx, %rcx
je 0x23e0
movq 0x20(%rbx), %rax
movl (%rax,%r15,4), %eax
movl %eax, (%rcx)
testq %r8, %r8
je 0x23f0
movq 0x28(%rbx), %rax
movl (%rax,%r15,4), %eax
movl %eax, (%r8)
testq %r14, %r14
je 0x2426
shll $0x5, %esi
addq 0x38(%rbx), %rsi
movl $0xb, %edx
movq %r14, %rdi
callq 0x1050
movb $0x0, 0xb(%r14)
movl $0xb, %eax
decl %eax
cmpb $0x20, (%r14,%rax)
jne 0x2426
movb $0x0, (%r14,%rax)
cmpl $0x1, %eax
ja 0x2413
movq 0x30(%rbx), %rax
movzbl (%rax,%r15), %eax
cmpl $0x4e, %eax
je 0x243e
cmpl $0x4c, %eax
je 0x2460
cmpl $0x46, %eax
jne 0x2467
movq 0x28(%rbx), %rcx
movl $0x2, %eax
cmpl $0x0, (%rcx,%r15,4)
jg 0x2469
movq 0x20(%rbx), %rcx
xorl %eax, %eax
cmpl $0xb, (%rcx,%r15,4)
setge %al
incl %eax
jmp 0x2469
movl $0x3, %eax
jmp 0x2469
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFWriteAttributeDirectly
int  DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,void *pValue) {
  int i, j;
  unsigned char *pabyRec;

  /* Is this a valid record? */
  if (hEntity < 0 || hEntity > psDBF->nRecords)
    return (FALSE);

  if (psDBF->bNoHeader)
    DBFWriteHeader(psDBF);

  /* Is this a brand new record? */
  if (hEntity == psDBF->nRecords) {
    if (!DBFFlushRecord(psDBF))
      return FALSE;

    psDBF->nRecords++;
    for (i = 0; i < psDBF->nRecordLength; i++)
      psDBF->pszCurrentRecord[i] = ' ';
    psDBF->nCurrentRecord = hEntity;
  }

  /* Is this an existing record, but different than the last one */
  /* we accessed? */
  if (!DBFLoadRecord(psDBF, hEntity))
    return FALSE;
  pabyRec = (unsigned char *) psDBF->pszCurrentRecord;

  /* Assign all the record fields. */
  if ((int) strlen((char *) pValue) > psDBF->panFieldSize[iField])
    j = psDBF->panFieldSize[iField];
  else {
    memset(pabyRec + psDBF->panFieldOffset[iField], ' ',psDBF->panFieldSize[iField]);
    j = strlen((char *) pValue);
  }

  strncpy((char *) (pabyRec + psDBF->panFieldOffset[iField]),(char *) pValue, j);
  psDBF->bCurrentRecordModified = TRUE;
  psDBF->bUpdated = TRUE;
  return (TRUE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebp, %ebp
testl %esi, %esi
js 0x254e
movl %esi, %r12d
movq %rdi, %rbx
cmpl %esi, 0x8(%rdi)
jl 0x254e
movq %rcx, %r14
movl %edx, %r15d
cmpl $0x0, 0x60(%rbx)
je 0x24a4
movq %rbx, %rdi
callq 0x163a
cmpl %r12d, 0x8(%rbx)
jne 0x24dd
movq %rbx, %rdi
callq 0x16fc
testl %eax, %eax
je 0x254e
incl 0x8(%rbx)
cmpl $0x0, 0xc(%rbx)
jle 0x24d9
xorl %eax, %eax
movq 0x48(%rbx), %rcx
movb $0x20, (%rcx,%rax)
incq %rax
movslq 0xc(%rbx), %rcx
cmpq %rcx, %rax
jl 0x24c5
movl %r12d, 0x40(%rbx)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x2559
testl %eax, %eax
je 0x254e
movq 0x48(%rbx), %r12
movq %r14, %rdi
callq 0x10d0
movq %rax, %rcx
movq 0x20(%rbx), %rax
movslq %r15d, %r15
movl (%rax,%r15,4), %eax
cmpl %ecx, %eax
jl 0x252a
movslq %eax, %rdx
movq 0x18(%rbx), %rax
movslq (%rax,%r15,4), %rdi
addq %r12, %rdi
movl $0x20, %esi
callq 0x10f0
movq %r14, %rdi
callq 0x10d0
movq 0x18(%rbx), %rcx
movslq (%rcx,%r15,4), %rcx
addq %rcx, %r12
movslq %eax, %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x1050
movl $0x1, %ebp
movl %ebp, 0x44(%rbx)
movl %ebp, 0x64(%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFLoadRecord
static int DBFLoadRecord(DBFHandle psDBF, int iRecord) {
  if (psDBF->nCurrentRecord != iRecord) {
    unsigned long nRecordOffset;
    char szMessage[128];

    if (!DBFFlushRecord(psDBF))
      return FALSE;
    nRecordOffset = psDBF->nRecordLength * (unsigned long) iRecord + psDBF->nHeaderLength;
    if (fseek(psDBF->fp, nRecordOffset, SEEK_SET) != 0) {
      sprintf(szMessage, "fseek(%ld) failed on DBF file.\n",(long) nRecordOffset);
      fprintf(stderr,szMessage);
      return FALSE;
    }
    if (fread(psDBF->pszCurrentRecord,psDBF->nRecordLength, 1, psDBF->fp) != 1) {
      sprintf(szMessage, "fread(%d) failed on DBF file.\n",psDBF->nRecordLength);
      fprintf(stderr,szMessage);
      return FALSE;
    }
    psDBF->nCurrentRecord = iRecord;
  }
  return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl $0x1, %ebx
cmpl %esi, 0x40(%rdi)
je 0x260a
movl %esi, %ebp
movq %rdi, %r14
callq 0x16fc
testl %eax, %eax
je 0x2608
movslq 0xc(%r14), %rax
movl %ebp, %ecx
imulq %rax, %rcx
movslq 0x10(%r14), %r15
addq %rcx, %r15
movq (%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x1180
testl %eax, %eax
jne 0x25c9
movq (%r14), %rcx
movq 0x48(%r14), %rdi
movslq 0xc(%r14), %rsi
movl $0x1, %edx
callq 0x10a0
cmpq $0x1, %rax
jne 0x25df
movl %ebp, 0x40(%r14)
jmp 0x260a
leaq 0x1b0b(%rip), %rsi      # 0x40db
movq %rsp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x11d0
jmp 0x25f4
movl 0xc(%r14), %edx
leaq 0x1b11(%rip), %rsi      # 0x40fb
movq %rsp, %rdi
xorl %eax, %eax
callq 0x11d0
movq 0x39fd(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
movq %rsp, %rsi
xorl %eax, %eax
callq 0x1140
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFWriteTuple
int  DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple) {
  int i;
  unsigned char *pabyRec;

  /* Is this a valid record? */
  if (hEntity < 0 || hEntity > psDBF->nRecords)
    return (FALSE);

  if (psDBF->bNoHeader)
    DBFWriteHeader(psDBF);

  /* Is this a brand new record? */
  if (hEntity == psDBF->nRecords) {
    if (!DBFFlushRecord(psDBF))
      return FALSE;
    psDBF->nRecords++;
    for (i = 0; i < psDBF->nRecordLength; i++)
      psDBF->pszCurrentRecord[i] = ' ';
    psDBF->nCurrentRecord = hEntity;
  }

  /* Is this an existing record, but different than the last one */
  /* we accessed? */
  if (!DBFLoadRecord(psDBF, hEntity))
    return FALSE;
  pabyRec = (unsigned char *) psDBF->pszCurrentRecord;
  memcpy(pabyRec, pRawTuple, psDBF->nRecordLength);
  psDBF->bCurrentRecordModified = TRUE;
  psDBF->bUpdated = TRUE;
  return (TRUE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
testl %esi, %esi
js 0x2943
movl %esi, %ebp
movq %rdi, %r14
cmpl %esi, 0x8(%rdi)
jl 0x2943
movq %rdx, %r15
cmpl $0x0, 0x60(%r14)
je 0x28e1
movq %r14, %rdi
callq 0x163a
cmpl %ebp, 0x8(%r14)
jne 0x2918
movq %r14, %rdi
callq 0x16fc
testl %eax, %eax
je 0x2943
incl 0x8(%r14)
cmpl $0x0, 0xc(%r14)
jle 0x2914
xorl %eax, %eax
movq 0x48(%r14), %rcx
movb $0x20, (%rcx,%rax)
incq %rax
movslq 0xc(%r14), %rcx
cmpq %rcx, %rax
jl 0x2900
movl %ebp, 0x40(%r14)
movq %r14, %rdi
movl %ebp, %esi
callq 0x2559
testl %eax, %eax
je 0x2943
movq 0x48(%r14), %rdi
movslq 0xc(%r14), %rdx
movq %r15, %rsi
callq 0x1150
movl $0x1, %ebx
movl %ebx, 0x44(%r14)
movl %ebx, 0x64(%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFCloneEmpty
DBFHandle  DBFCloneEmpty(DBFHandle psDBF, const char *pszFilename) {
  DBFHandle newDBF;

  newDBF = DBFCreateEx(pszFilename, psDBF->pszCodePage);
  if (newDBF == NULL)
    return (NULL);

  newDBF->nFields = psDBF->nFields;
  newDBF->nRecordLength = psDBF->nRecordLength;
  newDBF->nHeaderLength = psDBF->nHeaderLength;
  newDBF->pszHeader = (char *) malloc(newDBF->nHeaderLength);
  memcpy(newDBF->pszHeader, psDBF->pszHeader, newDBF->nHeaderLength);
  newDBF->panFieldOffset = (int *) malloc(sizeof(int) * psDBF->nFields);
  memcpy(newDBF->panFieldOffset, psDBF->panFieldOffset,  sizeof(int) * psDBF->nFields);
  newDBF->panFieldSize = (int *) malloc(sizeof(int) * psDBF->nFields);
  memcpy(newDBF->panFieldSize, psDBF->panFieldSize, sizeof(int) * psDBF->nFields);
  newDBF->panFieldDecimals = (int *) malloc(sizeof(int) * psDBF->nFields);
  memcpy(newDBF->panFieldDecimals, psDBF->panFieldDecimals, sizeof(int) * psDBF->nFields);
  newDBF->pachFieldType = (char *) malloc(sizeof(char) * psDBF->nFields);
  memcpy(newDBF->pachFieldType, psDBF->pachFieldType, sizeof(char) * psDBF->nFields);

  newDBF->bNoHeader = TRUE;
  newDBF->bUpdated = TRUE;
  DBFWriteHeader(newDBF);
  DBFClose(newDBF);
  newDBF = DBFOpen(pszFilename, "rb+");
  return (newDBF);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
movq 0x78(%rdi), %rsi
movq %rbx, %rdi
callq 0x1cb3
testq %rax, %rax
je 0x2a7a
movq %rax, %r14
movslq 0x14(%r15), %r12
movl %r12d, 0x14(%rax)
movl 0xc(%r15), %eax
movl %eax, 0xc(%r14)
movslq 0x10(%r15), %r13
movl %r13d, 0x10(%r14)
movq %r13, %rdi
callq 0x1160
movq %rax, 0x38(%r14)
movq 0x38(%r15), %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0x1150
leaq (,%r12,4), %r13
movq %r13, %rdi
callq 0x1160
movq %rax, 0x18(%r14)
movq 0x18(%r15), %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0x1150
movq %r13, %rdi
callq 0x1160
movq %rax, 0x20(%r14)
movq 0x20(%r15), %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0x1150
movq %r13, %rdi
callq 0x1160
movq %rax, 0x28(%r14)
movq 0x28(%r15), %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0x1150
movq %r12, %rdi
callq 0x1160
movq %rax, 0x30(%r14)
movq 0x30(%r15), %rsi
movq %rax, %rdi
movq %r12, %rdx
callq 0x1150
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x60(%r14)
movq %r14, %rdi
callq 0x163a
movq %r14, %rdi
callq 0x1c1c
leaq 0x1608(%rip), %rsi      # 0x4071
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1771
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFGetFieldIndex
int  DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName) {
  char name[12], name1[12], name2[12];
  int i;

  strncpy(name1, pszFieldName, 11);
  name1[11] = '\0';
  str_to_upper(name1);
  for (i = 0; i < DBFGetFieldCount(psDBF); i++) {
    DBFGetFieldInfo(psDBF, i, name, NULL, NULL);
    strncpy(name2, name, 11);
    str_to_upper(name2);
    if (!strncmp(name1, name2, 10))
      return (i);
  }
  return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x4(%rsp), %r14
movl $0xb, %edx
movq %r14, %rdi
callq 0x1050
movb $0x0, 0xb(%r14)
movq %r14, %rdi
callq 0x2b46
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x0, 0x14(%rbx)
jle 0x2b35
xorl %r14d, %r14d
leaq 0x1c(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x23ad
movl $0xb, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x1050
movq %r12, %rdi
callq 0x2b46
movl $0xa, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x1070
testl %eax, %eax
je 0x2b32
incl %r14d
cmpl 0x14(%rbx), %r14d
jl 0x2ae8
jmp 0x2b35
movl %r14d, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: str_to_upper
static void str_to_upper(char *string) {
  int len = strlen(string);
  short i = -1;
  while (++i < len)
    if (isalpha(string[i]) && islower(string[i]))
      string[i] = (char) toupper((int) string[i]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x10d0
movq %rax, %r14
testl %r14d, %r14d
jle 0x2b9f
movw $0x1, %r12w
callq 0x11f0
movq %rax, %r15
leal -0x1(%r12), %eax
movq (%r15), %rcx
movswq %ax, %r13
movsbq (%rbx,%r13), %rdi
movzwl (%rcx,%rdi,2), %eax
notl %eax
testl $0x600, %eax            # imm = 0x600
jne 0x2b93
callq 0x1090
movb %al, (%rbx,%r13)
movswl %r12w, %eax
incl %r12d
cmpl %r14d, %eax
jl 0x2b6c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFIsRecordDeleted
int  DBFIsRecordDeleted(DBFHandle psDBF, int iShape) {
  /* Verify selection. */
  if (iShape < 0 || iShape >= psDBF->nRecords)
    return TRUE;

  /* Have we read the record? */
  if (!DBFLoadRecord(psDBF, iShape))
    return FALSE;

  /* '*' means deleted. */
  return psDBF->pszCurrentRecord[0] == '*';
}

// Assembly:
movl $0x1, %eax
testl %esi, %esi
js 0x2bd8
pushq %rbx
movq %rdi, %rbx
cmpl %esi, 0x8(%rdi)
jle 0x2bd7
movq %rbx, %rdi
callq 0x2559
testl %eax, %eax
je 0x2bd5
movq 0x48(%rbx), %rcx
xorl %eax, %eax
cmpb $0x2a, (%rcx)
sete %al
jmp 0x2bd7
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFMarkRecordDeleted
int  DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted) {
  char chNewFlag;

  /* Verify selection. */
  if (iShape < 0 || iShape >= psDBF->nRecords)
    return FALSE;

  /* Is this an existing record, but different than the last one */
  /* we accessed? */
  if (!DBFLoadRecord(psDBF, iShape))
    return FALSE;

  /* Assign value, marking record as dirty if it changes. */
  if (bIsDeleted)
    chNewFlag = '*';
  else
    chNewFlag = ' ';

  if (psDBF->pszCurrentRecord[0] != chNewFlag) {
    psDBF->bCurrentRecordModified = TRUE;
    psDBF->bUpdated = TRUE;
    psDBF->pszCurrentRecord[0] = chNewFlag;
  }

  return TRUE;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
xorl %ebx, %ebx
testl %esi, %esi
js 0x2c1f
movq %rdi, %r14
cmpl %esi, 0x8(%rdi)
jle 0x2c1f
movl %edx, %ebp
movq %r14, %rdi
callq 0x2559
testl %eax, %eax
je 0x2c1f
testl %ebp, %ebp
movl $0x20, %ecx
movl $0x2a, %eax
cmovel %ecx, %eax
movq 0x48(%r14), %rcx
movl $0x1, %ebx
cmpb %al, (%rcx)
je 0x2c1f
movl %ebx, 0x44(%r14)
movl %ebx, 0x64(%r14)
movb %al, (%rcx)
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/kvlds/dispatch.c
// Function: callback_mrc_timer
static int
callback_mrc_timer(void * cookie)
{
	struct dispatch_state * D = cookie;

	/* If we have no pending cleaning, reset the timer. */
	if (!btree_cleaning_possible(D->T->cstate)) {
		if ((D->mrc_timer = events_timer_register(callback_mrc_timer,
		    D, &fivesec)) == NULL)
			return (-1);
		else
			return (0);
	}

	/* This timer isn't ticking any more. */
	D->mrc_timer = NULL;

	/* We want to force a batch of MRs so that we can clean. */
	D->docleans = 1;

	/* Launch a (possibly empty) batch of MRs if possible. */
	return (poke_mr(D));
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movq 0x40(%rax), %rdi
callq 0x7225
testl %eax, %eax
je 0x3955
movq $0x0, 0xb8(%rbx)
movl $0x1, 0xc0(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x3c2d
leaq -0x3a(%rip), %rdi       # 0x3922
leaq 0x10add(%rip), %rdx     # 0x14440
movq %rbx, %rsi
callq 0xc738
movq %rax, 0xb8(%rbx)
xorl %ecx, %ecx
cmpq $0x1, %rax
sbbl %ecx, %ecx
movl %ecx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/kvlds/dispatch.c
// Function: callback_accept
static int
callback_accept(void * cookie, int s)
{
	struct dispatch_state * D = cookie;

	/* We have a socket. */
	if ((D->s = s) == -1) {
		warnp("Error accepting connection");
		goto err0;
	}

	/* Make the accepted connection non-blocking. */
	if (fcntl(D->s, F_SETFL, O_NONBLOCK) == -1) {
		warnp("Cannot make connection non-blocking");
		goto err1;
	}

	/* Create a buffered writer for the connection. */
	if ((D->writeq = netbuf_write_init(D->s, dropconnection, D)) == NULL) {
		warnp("Cannot create packet write queue");
		goto err1;
	}

	/* Create a buffered reader for the connection. */
	if ((D->readq = netbuf_read_init(D->s)) == NULL) {
		warn0("Cannot create packet read queue");
		goto err2;
	}

	/* Start listening for packets. */
	if (readreqs(D))
		goto err3;

	/* Success! */
	return (0);

err3:
	netbuf_read_free(D->readq);
err2:
	netbuf_write_free(D->writeq);
err1:
	if (close(D->s))
		warnp("close");
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, 0x4(%rdi)
cmpl $-0x1, %esi
je 0x39f3
movq %rdi, %rbx
movl %esi, %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
callq 0x2120
cmpl $-0x1, %eax
je 0x3a16
movl 0x4(%rbx), %edi
leaq 0xcfb(%rip), %rsi       # 0x46aa
movq %rbx, %rdx
callq 0xcdb8
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x3a2c
movl 0x4(%rbx), %edi
callq 0xca24
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x3a68
movq %rbx, %rdi
callq 0x4155
testl %eax, %eax
je 0x3a95
movq 0x8(%rbx), %rdi
callq 0xcd4c
jmp 0x3a81
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3a50
movq %rax, %rbx
leaq 0x10bd9(%rip), %rdi     # 0x145e0
xorl %eax, %eax
callq 0x10048
movl $0x0, (%rbx)
jmp 0x3a5e
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3a8c
movq %rax, %r14
leaq 0x10bd1(%rip), %rdi     # 0x145fb
jmp 0x3a40
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3a99
movq %rax, %r14
leaq 0x10bdf(%rip), %rdi     # 0x1461f
xorl %eax, %eax
callq 0x10048
movl $0x0, (%r14)
jmp 0x3aa7
leaq 0x10b89(%rip), %rdi     # 0x145e0
xorl %eax, %eax
callq 0x10167
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x3aea
leaq 0x10bd1(%rip), %rdi     # 0x14640
xorl %eax, %eax
callq 0x10167
callq 0x20a0
movl $0x0, (%rax)
movq 0x10(%rbx), %rdi
callq 0xd137
jmp 0x3aa7
leaq 0x10b68(%rip), %rdi     # 0x145fb
jmp 0x3aa0
xorl %ebx, %ebx
jmp 0x3aea
leaq 0x10b7f(%rip), %rdi     # 0x1461f
xorl %eax, %eax
callq 0x10167
movl 0x4(%rbx), %edi
callq 0x21f0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0x3aea
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3adc
movq %rax, %r14
leaq 0x1245e(%rip), %rdi     # 0x15f2a
xorl %eax, %eax
callq 0x10048
movl $0x0, (%r14)
jmp 0x3aea
leaq 0x12447(%rip), %rdi     # 0x15f2a
xorl %eax, %eax
callq 0x10167
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/kvlds/dispatch.c
// Function: dispatch_done
int
dispatch_done(struct dispatch_state * D)
{

	/*
	 * There should not be a MR timer running, because there should be
	 * no requests in progress.  We should not be reading a request, and
	 * the connection should be dying.
	 */
	assert(D->mr_timer == NULL);
	assert(D->nrequests == 0);
	assert(D->read_cookie == NULL);
	assert(D->dying == 1);

	/* Stop the cleaning timer. */
	events_timer_cancel(D->mrc_timer);

	/* Free the buffered reader. */
	netbuf_read_free(D->readq);

	/* Free the buffered writer. */
	netbuf_write_free(D->writeq);

	/* Close the socket. */
	while (close(D->s)) {
		if (errno == EINTR)
			continue;
		warnp("close");
		goto err1;
	}

	/* Free the dispatcher state. */
	free(D);

	/* Success! */
	return (0);

err1:
	free(D);

	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpq $0x0, 0x90(%rdi)
jne 0x3bb1
movq %rdi, %rbx
cmpq $0x0, 0x20(%rdi)
jne 0x3bd0
cmpq $0x0, 0x18(%rbx)
jne 0x3bef
cmpl $0x1, (%rbx)
jne 0x3c0e
movq 0xb8(%rbx), %rdi
callq 0xc8b1
movq 0x8(%rbx), %rdi
callq 0xcd4c
movq 0x10(%rbx), %rdi
callq 0xd137
movl 0x4(%rbx), %edi
callq 0x21f0
testl %eax, %eax
je 0x3b8b
callq 0x20a0
movq %rax, %r14
movl (%rax), %eax
cmpl $0x4, %eax
je 0x3b5c
leaq 0x123ac(%rip), %rdi     # 0x15f2a
testl %eax, %eax
jne 0x3b8f
xorl %eax, %eax
callq 0x10167
jmp 0x3b9d
xorl %ebp, %ebp
jmp 0x3ba2
xorl %eax, %eax
callq 0x10048
movl $0x0, (%r14)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x108ae(%rip), %rdi     # 0x14466
leaq 0x108bb(%rip), %rsi     # 0x1447a
leaq 0x108bf(%rip), %rcx     # 0x14485
movl $0x2e3, %edx            # imm = 0x2E3
callq 0x21c0
leaq 0x108d9(%rip), %rdi     # 0x144b0
leaq 0x1089c(%rip), %rsi     # 0x1447a
leaq 0x108a0(%rip), %rcx     # 0x14485
movl $0x2e4, %edx            # imm = 0x2E4
callq 0x21c0
leaq 0x108cc(%rip), %rdi     # 0x144c2
leaq 0x1087d(%rip), %rsi     # 0x1447a
leaq 0x10881(%rip), %rcx     # 0x14485
movl $0x2e5, %edx            # imm = 0x2E5
callq 0x21c0
leaq 0x108c4(%rip), %rdi     # 0x144d9
leaq 0x1085e(%rip), %rsi     # 0x1447a
leaq 0x10862(%rip), %rcx     # 0x14485
movl $0x2e6, %edx            # imm = 0x2E6
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/kvlds/dispatch.c
// Function: readreqs
static int
readreqs(struct dispatch_state * D)
{

	/* If this connection is dying, do nothing. */
	if (D->dying)
		goto done;

	/* If we don't have a reader, don't try to read. */
	if (D->readq == NULL)
		goto done;

	/* If we are already reading, do nothing. */
	if (D->read_cookie != NULL)
		goto done;

	/* If we have MAXREQS requests in progress, do nothing. */
	if (D->nrequests == MAXREQS)
		goto done;

	/* Wait for a request to arrive. */
	if ((D->read_cookie = wire_readpacket_wait(D->readq,
	    gotrequest, D)) == NULL) {
		warnp("Error reading request from connection");
		goto err0;
	}

done:
	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpl $0x0, (%rdi)
je 0x416a
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rdi, %r14
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x4160
cmpq $0x0, 0x18(%r14)
jne 0x4160
cmpq $0x1000, 0x20(%r14)     # imm = 0x1000
je 0x4160
leaq 0x49(%rip), %rsi        # 0x41d7
movq %r14, %rdx
callq 0x11a39
movq %rax, 0x18(%r14)
testq %rax, %rax
jne 0x4160
callq 0x20a0
cmpl $0x0, (%rax)
je 0x41c2
movq %rax, %rbx
leaq 0x103dd(%rip), %rdi     # 0x14590
xorl %eax, %eax
callq 0x10048
movl $0x0, (%rbx)
jmp 0x41d0
leaq 0x103c7(%rip), %rdi     # 0x14590
xorl %eax, %eax
callq 0x10167
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x4160
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/kvlds/dispatch.c
// Function: poke_nmr
static int
poke_nmr(struct dispatch_state * D)
{
	struct requestq * RQ;

	/* If we have any queued requests, try to launch them. */
	while ((RQ = D->nmr_head) != NULL) {
		/* How many pages would this request need to touch? */
		if (RQ->R->type == PROTO_KVLDS_GET)
			RQ->npages = (size_t)(D->T->root_shadow->height + 1);
		else
			RQ->npages = (size_t)D->T->root_shadow->height +
			    D->T->pagelen / SERIALIZE_PERCHILD;

		/* Can we handle this request? */
		if ((D->nmr_ip > 0) &&
		    (D->nmr_ip + RQ->npages > D->nmr_concurrency))
			break;

		/* Dequeue this request. */
		D->nmr_head = RQ->next;

		/* Launch the request. */
		RQ->D = D;
		if (dispatch_nmr_launch(D->T, RQ->R, D->writeq,
		    callback_nmr_done, RQ))
			goto err0;
		D->nmr_ip += RQ->npages;
	}

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x40(%rdi), %r15
xorl %ebx, %ebx
testq %r15, %r15
je 0x469e
movq %rdi, %r14
leaq 0x2f6(%rip), %r12       # 0x48fc
movabsq $-0x3333333333333333, %r13 # imm = 0xCCCCCCCCCCCCCCCD
movq (%r15), %rsi
cmpl $0x130, 0x8(%rsi)       # imm = 0x130
jne 0x462e
movq 0x28(%r14), %rax
movq 0x20(%rax), %rax
movsbq 0x1d(%rax), %rdx
incq %rdx
jmp 0x4648
movq 0x28(%r14), %rcx
movq 0x20(%rcx), %rdi
movq %r13, %rax
mulq (%rcx)
movsbq 0x1d(%rdi), %rax
shrq $0x4, %rdx
addq %rax, %rdx
movq %rdx, 0x18(%r15)
movq 0x50(%r14), %rax
testq %rax, %rax
je 0x465f
addq 0x18(%r15), %rax
cmpq 0x58(%r14), %rax
ja 0x469e
movq 0x8(%r15), %rax
movq %rax, 0x40(%r14)
movq %r14, 0x10(%r15)
movq 0x10(%r14), %rdx
movq 0x28(%r14), %rdi
movq %r12, %rcx
movq %r15, %r8
callq 0x527c
testl %eax, %eax
jne 0x4699
movq 0x18(%r15), %rax
addq %rax, 0x50(%r14)
movq 0x40(%r14), %r15
testq %r15, %r15
jne 0x4610
jmp 0x469e
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/kvlds/dispatch_mr.c
// Function: mpool_reqcookie_free
static struct node *
finddirty(struct nodepair * V, size_t N, struct node * shadow)
{
	struct nodepair * pair;
	struct nodepair k;

	/* Binary search. */
	k.shadow = shadow;
	pair = bsearch(&k, V, N, sizeof(struct nodepair), compar_snp);

	/* If we found the shadow node, return the matching dirty node. */
	if (pair != NULL)
		return (pair->dirty);

	/* Otherwise, return the shadow node we were given. */
	return (shadow);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x50eb
movq %rdi, %rbx
movq 0x1822f(%rip), %rax     # 0x1d260
movq 0x18230(%rip), %r14     # 0x1d268
cmpq %r14, %rax
jae 0x5058
movq 0x1822c(%rip), %rcx     # 0x1d270
leaq 0x1(%rax), %rdx
movq %rdx, 0x18211(%rip)     # 0x1d260
movq %rbx, (%rcx,%rax,8)
jmp 0x50eb
movq 0x18219(%rip), %rax     # 0x1d278
shrq $0x8, %rax
cmpq %rax, 0x18216(%rip)     # 0x1d280
jbe 0x50d9
testq %r14, %r14
je 0x50f7
movq %r14, %rdi
shlq $0x4, %rdi
callq 0x22a0
testq %rax, %rax
je 0x50d9
movq %rax, %r15
movq 0x181e0(%rip), %r12     # 0x1d270
shlq $0x3, %r14
movq %rax, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x2280
cmpq 0x181e7(%rip), %r12     # 0x1d290
je 0x50b3
movq %r12, %rdi
callq 0x2040
movq %r15, 0x181b6(%rip)     # 0x1d270
shlq 0x181a7(%rip)           # 0x1d268
movq 0x18198(%rip), %rax     # 0x1d260
leaq 0x1(%rax), %rcx
movq %rcx, 0x1818d(%rip)     # 0x1d260
movq %rbx, (%r15,%rax,8)
jmp 0x50e1
movq %rbx, %rdi
callq 0x2040
xorps %xmm0, %xmm0
movups %xmm0, 0x1818d(%rip)    # 0x1d278
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xf437(%rip), %rdi      # 0x14535
leaq 0xf441(%rip), %rsi      # 0x14546
leaq 0xf45c(%rip), %rcx      # 0x14568
movl $0x5a, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/kvlds/dispatch_mr.c
// Function: callback_synced
static int
callback_synced(void * cookie)
{
	struct batch * B = cookie;
	struct req_cookie * req;
	struct proto_kvlds_request * R;
	size_t i;

	/* Send response packets. */
	for (i = 0; i < B->nreqs; i++) {
		req = B->reqs[i];
		R = req->R;

		switch (R->type) {
		case PROTO_KVLDS_SET:
			if (proto_kvlds_response_set(B->WQ, R->ID))
				goto err0;
			break;
		case PROTO_KVLDS_CAS:
			if (proto_kvlds_response_cas(B->WQ, R->ID,
			    req->opdone ? 0 : 1))
				goto err0;
			break;
		case PROTO_KVLDS_ADD:
			if (proto_kvlds_response_add(B->WQ, R->ID,
			    req->opdone ? 0 : 1))
				goto err0;
			break;
		case PROTO_KVLDS_MODIFY:
			if (proto_kvlds_response_modify(B->WQ, R->ID,
			    req->opdone ? 0 : 1))
				goto err0;
			break;
		case PROTO_KVLDS_DELETE:
			if (proto_kvlds_response_delete(B->WQ, R->ID))
				goto err0;
			break;
		case PROTO_KVLDS_CAD:
			if (proto_kvlds_response_cad(B->WQ, R->ID,
			    req->opdone ? 0 : 1))
				goto err0;
			break;
		}
	}

	/* Schedule completion callback. */
	if (!events_immediate_register(B->callback_done, B->cookie, 0))
		goto err0;

	/* Clean up requests and request cookies. */
	for (i = 0; i < B->nreqs; i++) {
		proto_kvlds_request_free(B->reqs[i]->R);
		mpool_reqcookie_free(B->reqs[i]);
	}

	/* Free batch cookie. */
	free(B->reqs);
	free(B);

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x10(%rdi)
je 0x5203
xorl %r14d, %r14d
leaq 0xf4cc(%rip), %r15      # 0x14670
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rcx
movl 0x8(%rcx), %edx
leal -0x110(%rdx), %esi
cmpl $0x3, %esi
ja 0x51c6
movslq (%r15,%rsi,4), %rdx
addq %r15, %rdx
jmpq *%rdx
cmpl $0x120, %edx            # imm = 0x120
je 0x51e8
cmpl $0x121, %edx            # imm = 0x121
jne 0x51fa
movq 0x20(%rbx), %rdi
movq (%rcx), %rsi
xorl %edx, %edx
cmpl $0x0, 0x18(%rax)
sete %dl
jmp 0x51f1
movq 0x20(%rbx), %rdi
movq (%rcx), %rsi
xorl %edx, %edx
callq 0x10d3a
testl %eax, %eax
jne 0x525b
incq %r14
cmpq 0x10(%rbx), %r14
jb 0x51a4
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
xorl %edx, %edx
callq 0xba4c
testq %rax, %rax
je 0x525b
cmpq $0x0, 0x10(%rbx)
je 0x5246
xorl %r14d, %r14d
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rdi
callq 0x10bd2
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x5016
incq %r14
cmpq 0x10(%rbx), %r14
jb 0x5220
movq 0x28(%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
xorl %eax, %eax
jmp 0x5260
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
retq