LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterface.cpp
// Function: t2::RunBuildScript(lua_State*, char const**, int)
bool RunBuildScript(lua_State *L, const char** args, int argc_count)
{
  // Push our error handler on the stack now (before the chunk to run)
  lua_pushcclosure(L, LuaGetTraceback, 0);
  int error_index = lua_gettop(L);

  switch (luaL_loadbuffer(L, s_BootSnippet, sizeof(s_BootSnippet)-1, "boot_snippet"))
  {
  case LUA_ERRMEM    : Croak("out of memory");
  case LUA_ERRSYNTAX : Croak("syntax error\n%s\n", lua_tostring(L, -1));
  }

  // Expose the path to tundra2 -- we're not that executable, so we'll need to find it.
  {
    PathBuffer exe_path;
    PathInit(&exe_path, GetExePath());
    PathStripLast(&exe_path);
    PathConcat(&exe_path, "tundra2" TUNDRA_EXE_SUFFIX);

    char tundra2_exe[kMaxPathLength];
    PathFormat(tundra2_exe, &exe_path);

    lua_pushstring(L, tundra2_exe);
    lua_setglobal(L, "TundraExePath");
  }

  // Push args from the command line
  for (int i = 0; i < argc_count; ++i)
  {
    lua_pushstring(L, args[i]);
  }

  int res = lua_pcall(L, /*narg:*/argc_count, /*nres:*/1, /*errorfunc:*/ error_index);

  if (0 == res)
  {
    return true;
  }
  else
  {
    // pcall failed
    if (lua_isstring(L, -1))
    {
      fprintf(stderr, "\nLua error\n%s\n", lua_tostring(L, -1));
    }
    return false;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x133(%rip), %rsi       # 0x7542
xorl %edx, %edx
callq 0x1a924
movq %rbx, %rdi
callq 0x1a02c
movl %eax, %r15d
leaq 0x28f28(%rip), %rsi     # 0x30350
leaq 0x28cdb(%rip), %rcx     # 0x3010a
movl $0x2e, %edx
movq %rbx, %rdi
callq 0x1c311
cmpl $0x3, %eax
je 0x7514
cmpl $0x4, %eax
je 0x7534
callq 0xa46c
leaq 0x20c(%rsp), %r12
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xad64
movq %r12, %rdi
callq 0xafa1
leaq 0x28cbf(%rip), %rsi     # 0x30136
movq %r12, %rdi
callq 0xafc1
movq %rsp, %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0xb0e6
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1a7f6
leaq 0x28c9f(%rip), %rdx     # 0x3013e
movq %rbx, %rdi
movl $0xffffd8ee, %esi       # imm = 0xFFFFD8EE
callq 0x1ac10
testl %ebp, %ebp
jle 0x74ca
movl %ebp, %r12d
xorl %r13d, %r13d
movq (%r14,%r13,8), %rsi
movq %rbx, %rdi
callq 0x1a7f6
incq %r13
cmpq %r13, %r12
jne 0x74b6
movq %rbx, %rdi
movl %ebp, %esi
movl $0x1, %edx
movl %r15d, %ecx
callq 0x1ae82
movl %eax, %ebp
testl %eax, %eax
je 0x74f3
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x1a424
testl %eax, %eax
jne 0x750a
testl %ebp, %ebp
sete %al
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x6910
jmp 0x74f3
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x1a5d4
leaq 0x28bfb(%rip), %rdi     # 0x30125
movq %rax, %rsi
xorl %eax, %eax
callq 0xa019
leaq 0x28bdc(%rip), %rdi     # 0x30117
xorl %eax, %eax
callq 0xa019
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterface.cpp
// Function: t2::DestroyLuaState(lua_State*)
void DestroyLuaState(lua_State* L)
{
  if (s_IsProfiling)
  {
    LuaProfilerDestroy();
    LinearAllocDestroy(&s_ProfilerAllocator);
  }

  lua_close(L);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpb $0x1, 0x3b07a(%rip)     # 0x42660
jne 0x75f9
callq 0x9bbd
leaq 0x3b074(%rip), %rdi     # 0x42668
callq 0xad02
movq %rbx, %rdi
popq %rbx
jmp 0x252db
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterface.cpp
// Function: t2::LuaTundraDigestGuid(lua_State*)
static int LuaTundraDigestGuid(lua_State* L)
{
  HashDigest digest;
  DoDigest(&digest, L);
  char result[kDigestStringSize];
  DigestToString(result, digest);
  lua_pushstring(L, result);
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7cab
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xabdf
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1a7f6
movl $0x1, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterface.cpp
// Function: t2::LuaTundraGetEnv(lua_State*)
static int LuaTundraGetEnv(lua_State *L)
{
  const char* key    = luaL_checkstring(L, 1);
  const char* result = getenv(key);

  if (result)
  {
    lua_pushstring(L, result);
    return 1;
  }
  else if (lua_gettop(L) >= 2)
  {
    lua_pushvalue(L, 2);
    return 1;
  }
  else
  {
    return luaL_error(L, "key %s not present in environment (and no default given)", key);
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
movq %rax, %r14
movq %rax, %rdi
callq 0x65c0
testq %rax, %rax
je 0x78b5
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1a7f6
jmp 0x78cf
movq %rbx, %rdi
callq 0x1a02c
cmpl $0x2, %eax
jl 0x78dc
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a37a
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x28934(%rip), %rsi     # 0x30217
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1b417
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterface.cpp
// Function: t2::LuaStatFile(lua_State*)
static int LuaStatFile(lua_State* L)
{
  const char* fn = luaL_checkstring(L, 1);

  FileInfo info = GetFileInfo(fn);

  // Push dir result table on stack
  lua_newtable(L);
  lua_pushinteger(L, (lua_Integer) info.m_Size);
  lua_setfield(L, -2, "size");
  lua_pushinteger(L, (lua_Integer) info.m_Timestamp);
  lua_setfield(L, -2, "timestamp");
  lua_pushboolean(L, info.IsDirectory());
  lua_setfield(L, -2, "isdirectory");
  lua_pushboolean(L, info.Exists());
  lua_setfield(L, -2, "exists");

  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0xa61c
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1aaed
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x1a78b
leaq 0x28916(%rip), %rdx     # 0x30250
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ac10
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x1a78b
leaq 0x288fb(%rip), %rdx     # 0x30255
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ac10
movl (%r14), %esi
shrl $0x3, %esi
andl $0x1, %esi
movq %rbx, %rdi
callq 0x1a9c2
leaq 0x288e0(%rip), %rdx     # 0x3025f
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ac10
movl (%r14), %esi
andl $0x1, %esi
movq %rbx, %rdi
callq 0x1a9c2
leaq 0x288ca(%rip), %rdx     # 0x3026b
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ac10
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterface.cpp
// Function: t2::LuaMakePathBuf(lua_State*)
static int LuaMakePathBuf(lua_State* L)
{
  const char* fn = luaL_checkstring(L, 1);
  PathBuffer buffer;
  PathInit(&buffer, fn);

  lua_newtable(L);
  lua_pushinteger(L, buffer.m_Type);
  lua_setfield(L, -2, "type");
  lua_pushinteger(L, buffer.m_Flags);
  lua_setfield(L, -2, "flags");
  lua_pushinteger(L, buffer.m_LeadingDotDots);
  lua_setfield(L, -2, "leading_dotdots");

  lua_newtable(L);
  for (int i = 0; i < buffer.m_SegCount; ++i)
  {
    lua_pushinteger(L, buffer.m_SegEnds[i]);
    lua_rawseti(L, -2, i + 1);
  }
  lua_setfield(L, -2, "seg_ends");

  int len = buffer.m_SegCount > 0 ? buffer.m_SegEnds[buffer.m_SegCount - 1] : 0;
  lua_pushlstring(L, buffer.m_Data, len);
  lua_setfield(L, -2, "data");

  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
leaq 0xc(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xad64
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1aaed
movl (%r14), %esi
movq %rbx, %rdi
callq 0x1a78b
leaq 0x28f16(%rip), %rdx     # 0x3091a
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ac10
movzwl 0x4(%r14), %esi
movq %rbx, %rdi
callq 0x1a78b
leaq 0x2884d(%rip), %rdx     # 0x30272
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ac10
movzwl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x1a78b
leaq 0x28832(%rip), %rdx     # 0x30278
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ac10
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1aaed
cmpw $0x0, 0x6(%r14)
je 0x7a95
xorl %r14d, %r14d
movzwl 0x16(%rsp,%r14,2), %esi
movq %rbx, %rdi
callq 0x1a78b
incq %r14
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movl %r14d, %edx
callq 0x1acd4
movzwl 0x12(%rsp), %eax
cmpq %rax, %r14
jb 0x7a6a
leaq 0x287ec(%rip), %rdx     # 0x30288
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ac10
movzwl 0x12(%rsp), %eax
testq %rax, %rax
je 0x7abc
decl %eax
movzwl 0x16(%rsp,%rax,2), %edx
jmp 0x7abe
xorl %edx, %edx
leaq 0x96(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a79f
leaq 0x29cc2(%rip), %rdx     # 0x31797
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ac10
movl $0x1, %eax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterface.cpp
// Function: t2::LuaTimeDiff(lua_State*)
static int LuaTimeDiff(lua_State* L)
{
  lua_Integer a = luaL_checkinteger(L, 1);
  lua_Integer b = luaL_checkinteger(L, 2);
  double d = t2::TimerDiffSeconds(a, b);
  char buffer[64];
  snprintf(buffer, sizeof buffer, "%.5f", d);
  lua_pushstring(L, buffer);
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl $0x1, %esi
callq 0x1b89c
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1b89c
movq %r14, %rdi
movq %rax, %rsi
callq 0xa541
leaq 0x28693(%rip), %rdx     # 0x302a4
movq %rsp, %r14
movl $0x40, %esi
movq %r14, %rdi
movb $0x1, %al
callq 0x6780
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a7f6
movl $0x1, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterface.cpp
// Function: t2::OnFileIter(void*, t2::FileInfo const&, char const*)
static void OnFileIter(void* user_data, const FileInfo& info, const char* name)
{
  lua_State* L = static_cast<lua_State*>(user_data);

  if (info.IsFile()) 
  {
    lua_pushstring(L, name);
    lua_rawseti(L, -2, (int) lua_objlen(L, -2) + 1);
  }
  else if (info.IsDirectory()) 
  {
    lua_pushstring(L, name);
    lua_rawseti(L, -3, (int) lua_objlen(L, -3) + 1);
  }
  else
  {
    Log(kWarning, "ignoring unsupported file type: %s\n", name);
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rsi), %eax
testb $0x4, %al
jne 0x7c5d
testb $0x8, %al
jne 0x7c82
leaq 0x285a3(%rip), %rsi     # 0x301f3
movl $0x2, %edi
xorl %eax, %eax
popq %rbx
jmp 0xa32c
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x1a7f6
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1a645
leal 0x1(%rax), %edx
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
jmp 0x7ca5
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x1a7f6
movq %rbx, %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x1a645
leal 0x1(%rax), %edx
movq %rbx, %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
popq %rbx
jmp 0x1acd4
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterface.cpp
// Function: t2::DoDigest(t2::HashDigest*, lua_State*)
static void DoDigest(HashDigest* out, lua_State* L)
{
  HashState h;
  HashInit(&h);

  int narg = lua_gettop(L);

  for (int i = 1; i <= narg; ++i)
  {
    size_t len;
    unsigned char* data = (unsigned char*) luaL_checklstring(L, i, &len);
    HashUpdate(&h, data, len);
  }

  HashFinalize(&h, out);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %rdi
callq 0xaa36
movq %r14, %rdi
callq 0x1a02c
testl %eax, %eax
jle 0x7d1b
movl %eax, %r15d
negl %r15d
movl $0x1, %ebp
leaq 0x8(%rsp), %r12
leaq 0x10(%rsp), %r13
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x1b664
movq 0x8(%rsp), %rdx
movq %r13, %rdi
movq %rax, %rsi
callq 0xa920
leal (%r15,%rbp), %eax
incl %eax
movl %ebp, %ecx
incl %ecx
movl %ecx, %ebp
cmpl $0x1, %eax
jne 0x7ced
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0xaa4d
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterpolate.cpp
// Function: t2::LuaInterpolate(lua_State*)
static int LuaInterpolate(lua_State* L)
{
  size_t input_len;
  const char* input = luaL_checklstring(L, 1, &input_len);
  luaL_checktype(L, 2, LUA_TTABLE);
  const bool has_vars = lua_type(L, 3) == LUA_TTABLE;

  MemAllocHeap* heap;
  lua_getallocf(L, (void**) &heap);

  LuaEnvLookup lookup = { L, 2, has_vars ? 3 : 0 };
  StringBuffer output(heap);

  if (DoInterpolate(output, input, input_len, lookup))
  {
    lua_pushlstring(L, output.GetBuffer(), output.GetSize());
    return 1;
  }

  return luaL_error(L, "interpolation failed: %s", input);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movl $0x1, %esi
movq %r15, %rdx
callq 0x1b664
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
movl $0x5, %edx
callq 0x1b7bf
movq %rbx, %rdi
movl $0x3, %esi
callq 0x1a39a
xorl %r13d, %r13d
cmpl $0x5, %eax
sete %r13b
movq %rsp, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1b1bc
leaq 0x10(%rsp), %rcx
movq %rbx, (%rcx)
movl $0x2, 0x8(%rcx)
leal (%r13,%r13,2), %eax
movl %eax, 0xc(%rcx)
movq (%r12), %rax
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
xorl %eax, %eax
movq %rax, 0x8(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rdi)
movq %rax, 0x60(%rdi)
movq (%r15), %rdx
movq %r14, %rsi
callq 0x7e75
testb %al, %al
je 0x7e2c
leaq 0x30(%rsp), %rax
movq 0x48(%rax), %rdx
testq %rdx, %rdx
movq 0x40(%rax), %rsi
cmoveq %rax, %rsi
cmoveq -0x8(%rax), %rdx
movl $0x1, %ebp
movq %rbx, %rdi
callq 0x1a79f
jmp 0x7e42
leaq 0x285ef(%rip), %rsi     # 0x30422
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1b417
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
callq 0x8616
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8616
movq %rbx, %rdi
callq 0x6820
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterpolate.cpp
// Function: t2::LuaEnvLookupScope::GetValue(unsigned long, unsigned long*)
const char* GetValue(size_t index, size_t* len_out)
  {
    lua_State* L = m_LuaState;
    CHECK(lua_type(L, -1) == LUA_TTABLE);
    lua_rawgeti(L, -1, int(index + 1));
    if (lua_type(L, -1) != LUA_TSTRING)
    {
      fprintf(stderr, "env lookup failed: elem %d is not a string: %s\n", (int) index + 1, lua_typename(L, lua_type(L, -1)));
      return nullptr;
    }
    // This is technically not allowed but we do it anyway for performance.
    // We check that the value is already a string, and we know it's being
    // kept alive by the table which is on our stack.
    const char* str = lua_tolstring(L, -1, len_out);
    lua_pop(L, 1);
    return str;
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq (%rdi), %rbx
incl %r15d
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %r15d, %edx
callq 0x1aab8
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x1a39a
cmpl $0x4, %eax
jne 0x884a
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r14, %rdx
callq 0x1a5d4
movq %rax, %r14
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1a039
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
movl %r15d, %esi
callq 0x695d
xorl %eax, %eax
jmp 0x8844
nop
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterpolate.cpp
// Function: t2::StringBuffer::AppendUnless(char const*, unsigned long)
void AppendUnless(const char* data, size_t data_len)
  {
    size_t len = GetSize();
    char* buf = GetBuffer();

    if (len < data_len || 0 != memcmp(buf + len - data_len, data, data_len))
    {
      Append(data, data_len);
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x58(%rdi), %rcx
movq %rcx, %rax
testq %rcx, %rcx
jne 0x8910
movq 0x8(%r15), %rax
cmpq %rbx, %rax
jb 0x8939
testq %rcx, %rcx
je 0x8920
movq 0x50(%r15), %rdi
jmp 0x8924
leaq 0x10(%r15), %rdi
addq %rax, %rdi
subq %rbx, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x64e0
testl %eax, %eax
je 0x8957
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8bc0
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x63d0
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterpolate.cpp
// Function: t2::StringBuffer::GetFilenameDir()
size_t GetSize()
  {
    if (size_t sz = m_Buffer.m_Size)
      return sz;
    else
      return m_InternalBufferUsed;
  }

// Assembly:
leaq 0x58(%rdi), %rax
movq 0x58(%rdi), %rdx
leaq 0x8(%rdi), %rcx
leaq 0x10(%rdi), %rsi
testq %rdx, %rdx
movq 0x8(%rdi), %r8
cmovneq %rdx, %r8
cmovneq 0x50(%rdi), %rsi
movl %r8d, %edi
testl %edi, %edi
jle 0x8a88
movzbl -0x1(%rsi,%rdi), %r8d
decq %rdi
cmpl $0x5c, %r8d
je 0x8a7e
cmpl $0x2f, %r8d
jne 0x8a65
testq %rdx, %rdx
cmoveq %rcx, %rax
movq %rdi, (%rax)
retq
nop
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterpolate.cpp
// Function: t2::StringBuffer::GetFilename()
void GetFilename()
  {
    size_t len = GetSize();
    char* buf = GetBuffer();
    for (int i = (int) len - 1; i >= 0; --i)
    {
      if ('/' == buf[i] || '\\' == buf[i])
      {
        int target_len = int(len - i - 1);
        memmove(buf, buf + i + 1, target_len);
        Shrink(target_len);
        break;
      }
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rax
movq 0x58(%rdi), %rcx
testq %rcx, %rcx
cmoveq 0x8(%rdi), %rcx
leaq 0x10(%rdi), %rdi
cmovneq 0x50(%rax), %rdi
leaq 0x58(%rax), %r14
leaq 0x8(%rax), %r15
movl %ecx, %eax
movq $-0x1, %rbx
testl %eax, %eax
jle 0x8a3b
movzbl -0x1(%rdi,%rax), %ecx
decq %rax
incq %rbx
cmpl $0x5c, %ecx
je 0x8a21
cmpl $0x2f, %ecx
jne 0x8a08
leaq (%rdi,%rax), %rsi
incq %rsi
movq %rbx, %rdx
callq 0x67c0
cmpq $0x0, (%r14)
cmovneq %r14, %r15
movq %rbx, (%r15)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterpolate.cpp
// Function: t2::StringBuffer::Quote()
void Quote()
  {
    // Avoid double quoting.
    {
      char* data = GetBuffer();
      const size_t orig_len = GetSize();

      if (orig_len > 0 && data[0] == '"' && data[orig_len-1] == '"')
      {
        // Already quoted. Make sure it doesn't end in a backslash.
        if (orig_len > 1 && data[orig_len-2] == '\\')
        {
          Shrink(orig_len - 1);
          size_t len = orig_len - 1;

          data = GetBuffer();
          data[len-1] = '"';
        }
        return;
      }
    }

    PrepQuoteCommon();
    Prepend("\"", 1);
    Append("\"", 1);
  }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x50(%rdi), %rax
movq 0x58(%rdi), %rdx
leaq 0x10(%rdi), %r14
movq %rax, %rsi
movq %rdx, %rcx
testq %rdx, %rdx
jne 0x8aaf
movq 0x8(%rbx), %rcx
movq %r14, %rsi
testq %rcx, %rcx
je 0x8af4
cmpb $0x22, (%rsi)
jne 0x8af4
cmpb $0x22, -0x1(%rsi,%rcx)
jne 0x8af4
cmpq $0x1, %rcx
je 0x8b3d
cmpb $0x5c, -0x2(%rsi,%rcx)
jne 0x8b3d
leaq 0x58(%rbx), %rsi
addq $0x8, %rbx
testq %rdx, %rdx
cmovneq %rsi, %rbx
leaq -0x1(%rcx), %rdx
movq %rdx, (%rbx)
cmpq $0x0, (%rsi)
cmoveq %r14, %rax
addq %rcx, %rax
addq $-0x2, %rax
jmp 0x8b3a
movq %rbx, %rdi
callq 0x8c94
movl $0x1, %esi
movq %rbx, %rdi
callq 0x8bc0
movq 0x58(%rbx), %rdx
testq %rdx, %rdx
cmovneq 0x50(%rbx), %r14
cmoveq 0x8(%rbx), %rdx
leaq 0x1(%r14), %rdi
decq %rdx
movq %r14, %rsi
callq 0x67c0
movb $0x22, (%r14)
movl $0x1, %esi
movq %rbx, %rdi
callq 0x8bc0
movb $0x22, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterpolate.cpp
// Function: t2::StringBuffer::Grow(unsigned long)
char* Grow(size_t len)
  {
    if (m_Buffer.m_Size)
    {
      return BufferAlloc(&m_Buffer, m_Heap, len);
    }
    else if (len + m_InternalBufferUsed <= kInternalBufferSize)
    {
      size_t offset = m_InternalBufferUsed;
      m_InternalBufferUsed += len;
      return m_InternalBuffer + offset;
    } 
    else
    {
      BufferAppend(&m_Buffer, m_Heap, m_InternalBuffer, m_InternalBufferUsed);
      return BufferAlloc(&m_Buffer, m_Heap, len);
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x50(%rdi), %r15
cmpq $0x0, 0x58(%rdi)
jne 0x8c1c
movq 0x8(%r14), %r12
leaq (%r12,%rbx), %rax
leaq 0x10(%r14), %r13
cmpq $0x40, %rax
ja 0x8c00
movq %rax, 0x8(%r14)
addq %r12, %r13
movq %r13, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq (%r14), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x8c33
movq %rax, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x63d0
movq (%r14), %rsi
movq %r15, %rdi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x8c33
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaInterpolate.cpp
// Function: t2::StringBuffer::PrepQuoteCommon()
void PrepQuoteCommon()
  {
    // Drop trailing backslash - can't be escaped on windows
    {
      size_t len = GetSize();
      char* buf = GetBuffer();
      if (len > 0 && buf[len - 1] == '\\')
        Shrink(len - 1);
    }

    size_t bs_count = 0;
    {
      size_t len = GetSize();
      char* buf = GetBuffer();

      for (size_t i = 0; i < len; ++i)
      {
        if (buf[i] == '\\')
          ++bs_count;
      }
    }

    if (bs_count > 0)
    {
      size_t orig_len = GetSize();
      Grow(bs_count);
      char* data = GetBuffer();
      memmove(data + bs_count, data, orig_len);

      size_t r = bs_count;
      size_t w = 0;
      while (r < orig_len + bs_count)
      {
        char ch = data[r++];
        data[w++] = ch;

        if (ch == '\\')
        {
          data[w++] = '\\';
        }
      }
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x58(%rdi), %rcx
testq %rcx, %rcx
movq 0x8(%rdi), %r14
movq 0x50(%rdi), %rax
movq %rcx, %rdx
cmoveq %r14, %rdx
leaq 0x10(%rdi), %rbx
testq %rdx, %rdx
je 0x8cf0
testq %rcx, %rcx
movq %rax, %rsi
cmoveq %rbx, %rsi
cmpb $0x5c, -0x1(%rsi,%rdx)
jne 0x8cf0
leaq 0x58(%r15), %rsi
leaq 0x8(%r15), %rdi
decq %rdx
testq %rcx, %rcx
movq %rsi, %rcx
cmoveq %rdi, %rcx
movq %rdx, (%rcx)
movq (%rsi), %rcx
movq (%rdi), %r14
testq %rcx, %rcx
cmovneq %rcx, %r14
cmoveq %rbx, %rax
testq %r14, %r14
je 0x8d8f
xorl %r12d, %r12d
xorl %ecx, %ecx
movq %r12, %r13
movb (%rax,%rcx), %bpl
xorl %r12d, %r12d
cmpb $0x5c, %bpl
sete %r12b
addq %r13, %r12
incq %rcx
cmpq %rcx, %r14
jne 0x8d09
testq %r12, %r12
je 0x8d8f
movq %r15, %rdi
movq %r12, %rsi
callq 0x8bc0
cmpq $0x0, 0x58(%r15)
je 0x8d41
movq 0x50(%r15), %rbx
leaq (%rbx,%r12), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x67c0
leaq (%r12,%r14), %rax
cmpq %rax, %r12
jae 0x8d8f
xorl %eax, %eax
cmpb $0x5c, %bpl
sete %al
addq %rax, %r13
addq %rbx, %r13
xorl %eax, %eax
xorl %ecx, %ecx
movb (%r13,%rax), %dl
movb %dl, (%rbx,%rcx)
cmpb $0x5c, %dl
jne 0x8d84
movb $0x5c, 0x1(%rbx,%rcx)
addq $0x2, %rcx
jmp 0x8d87
incq %rcx
incq %rax
cmpq %rax, %r14
jne 0x8d6c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::LuaJsonWriterNew(lua_State*)
static int LuaJsonWriterNew(lua_State* L)
{
  const char* filename = luaL_checkstring(L, 1);
  LuaJsonWriter* self = (LuaJsonWriter*) lua_newuserdata(L, sizeof(LuaJsonWriter));

  memset(self, 0, sizeof *self);

  self->m_FirstElem = true;

  if (FILE* f = fopen(filename, "w"))
  {
    BufferedWriterInit(&self->m_Writer, f);

    luaL_getmetatable(L, "tundra_jsonw");
    lua_setmetatable(L, -2);
    return 1;
  }
  else
  {
    return luaL_error(L, "couldn't open %s for writing", filename);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
movq %rax, %r14
movl $0x2018, %esi           # imm = 0x2018
movq %rbx, %rdi
callq 0x1b1e2
movq %rax, %r15
movl $0x2018, %edx           # imm = 0x2018
movq %rax, %rdi
xorl %esi, %esi
callq 0x62a0
movb $0x1, (%r15)
leaq 0x27314(%rip), %rsi     # 0x30194
movq %r14, %rdi
callq 0x6580
testq %rax, %rax
je 0x8ec8
movq $0x0, 0x8(%r15)
movq %rax, 0x2010(%r15)
leaq 0x27699(%rip), %rdx     # 0x3053c
movq %rbx, %rdi
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x1aa34
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1ad43
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x27682(%rip), %rsi     # 0x30551
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x1b417
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::LuaJsonWriteNumber(lua_State*)
static int LuaJsonWriteNumber(lua_State* L)
{
  LuaJsonWriter* self = (LuaJsonWriter*) luaL_checkudata(L, 1, "tundra_jsonw");
  lua_Number num = luaL_checknumber(L, 2);
  WriteCommon(L, self, 3);

  char buffer[64];
  lua_number2str(buffer, num);
  BufferedWriterAppendString(&self->m_Writer, buffer);
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x27648(%rip), %rdx     # 0x3053c
movl $0x1, %esi
callq 0x1b70d
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1b826
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq 0x91a6
leaq 0x2711b(%rip), %rsi     # 0x30043
movq %rsp, %rbx
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x6100
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x923d
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::LuaJsonWriteString(lua_State*)
static int LuaJsonWriteString(lua_State* L)
{
  LuaJsonWriter* self = (LuaJsonWriter*) luaL_checkudata(L, 1, "tundra_jsonw");
  size_t value_len;
  const char* value = lua_tolstring(L, 2, &value_len);
  WriteCommon(L, self, 3);
  WriteEscapedString(&self->m_Writer, value, value_len);
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x275d7(%rip), %rdx     # 0x3053c
movl $0x1, %esi
callq 0x1b70d
movq %rax, %r14
movq %rsp, %r15
movq %rbx, %rdi
movl $0x2, %esi
movq %r15, %rdx
callq 0x1a5d4
movq %rax, %r12
movq %rbx, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq 0x91a6
addq $0x8, %r14
movq (%r15), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x9282
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::LuaJsonWriteBool(lua_State*)
static int LuaJsonWriteBool(lua_State* L)
{
  LuaJsonWriter* self = (LuaJsonWriter*) luaL_checkudata(L, 1, "tundra_jsonw");
  int value = lua_toboolean(L, 2);
  WriteCommon(L, self, 3);
  BufferedWriterAppendString(&self->m_Writer, value ? "true" : "false");
  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x27576(%rip), %rdx     # 0x3053c
movl $0x1, %esi
callq 0x1b70d
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a5ae
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq 0x91a6
addq $0x8, %r14
testl %ebp, %ebp
leaq 0x27574(%rip), %rax     # 0x30573
leaq 0x27568(%rip), %rsi     # 0x3056e
cmoveq %rax, %rsi
movq %r14, %rdi
callq 0x923d
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::LuaJsonBeginObject(lua_State*)
static int LuaJsonBeginObject(lua_State* L)
{
  LuaJsonWriter* self = (LuaJsonWriter*) luaL_checkudata(L, 1, "tundra_jsonw");
  WriteCommon(L, self, 2);
  BufferedWriterAppend(&self->m_Writer, '{');
  self->m_FirstElem = true;
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x27515(%rip), %rdx     # 0x3053c
movl $0x1, %esi
callq 0x1b70d
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
movl $0x2, %edx
callq 0x91a6
movq 0x8(%rbx), %rax
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x905e
movq %rbx, %rdi
addq $0x8, %rdi
callq 0x9364
xorl %eax, %eax
movb $0x7b, 0x10(%rbx,%rax)
incq %rax
movq %rax, 0x8(%rbx)
movb $0x1, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::LuaJsonEndObject(lua_State*)
static int LuaJsonEndObject(lua_State* L)
{
  LuaJsonWriter* self = (LuaJsonWriter*) luaL_checkudata(L, 1, "tundra_jsonw");
  BufferedWriterAppend(&self->m_Writer, '}');
  self->m_FirstElem = false;
  return 0;
}

// Assembly:
pushq %rbx
leaq 0x274bd(%rip), %rdx     # 0x3053c
movl $0x1, %esi
callq 0x1b70d
movq %rax, %rbx
movq 0x8(%rax), %rax
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x90a6
movq %rbx, %rdi
addq $0x8, %rdi
callq 0x9364
xorl %eax, %eax
movb $0x7d, 0x10(%rbx,%rax)
incq %rax
movq %rax, 0x8(%rbx)
movb $0x0, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::LuaJsonEndArray(lua_State*)
static int LuaJsonEndArray(lua_State* L)
{
  LuaJsonWriter* self = (LuaJsonWriter*) luaL_checkudata(L, 1, "tundra_jsonw");
  BufferedWriterAppend(&self->m_Writer, ']');
  self->m_FirstElem = false;
  return 0;
}

// Assembly:
pushq %rbx
leaq 0x2741d(%rip), %rdx     # 0x3053c
movl $0x1, %esi
callq 0x1b70d
movq %rax, %rbx
movq 0x8(%rax), %rax
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x9146
movq %rbx, %rdi
addq $0x8, %rdi
callq 0x9364
xorl %eax, %eax
movb $0x5d, 0x10(%rbx,%rax)
incq %rax
movq %rax, 0x8(%rbx)
movb $0x0, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::LuaJsonGc(lua_State*)
static int LuaJsonGc(lua_State* L)
{
  LuaJsonWriter* self = (LuaJsonWriter*) luaL_checkudata(L, 1, "tundra_jsonw");
  if (FILE* f = self->m_Writer.m_File)
  {
    BufferedWriterFlush(&self->m_Writer);
    self->m_Writer.m_File = nullptr;
    fclose(f);
  }

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x273d8(%rip), %rdx     # 0x3053c
movl $0x1, %esi
callq 0x1b70d
movq 0x2010(%rax), %rbx
testq %rbx, %rbx
je 0x919c
movq %rax, %r14
movq %rax, %rdi
addq $0x8, %rdi
callq 0x9364
movq $0x0, 0x2010(%r14)
movq %rbx, %rdi
callq 0x64c0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::WriteCommon(lua_State*, t2::LuaJsonWriter*, int)
static void WriteCommon(lua_State* L, LuaJsonWriter* self, int name_index)
{
  WriteComma(self);
  if (lua_gettop(L) >= name_index)
  {
    size_t len;
    const char* str = luaL_checklstring(L, name_index, &len);
    WriteEscapedString(&self->m_Writer, str, len);
    BufferedWriterAppend(&self->m_Writer, ':');
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, (%rsi)
jne 0x91bf
movb $0x0, (%rbx)
jmp 0x91e2
movq 0x8(%rbx), %rax
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x91d6
leaq 0x8(%rbx), %rdi
callq 0x9364
xorl %eax, %eax
movb $0x2c, 0x10(%rbx,%rax)
incq %rax
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x1a02c
cmpl %ebp, %eax
jl 0x9232
movq %rsp, %r15
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x1b664
leaq 0x8(%rbx), %r14
movq (%r15), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x9282
movq 0x8(%rbx), %rax
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x9226
movq %r14, %rdi
callq 0x9364
xorl %eax, %eax
movb $0x3a, 0x10(%rbx,%rax)
incq %rax
movq %rax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::WriteEscapedString(t2::BufferedWriter*, char const*, unsigned long)
static void WriteEscapedString(BufferedWriter* w, const char* str, size_t len)
{
  BufferedWriterAppend(w, '"');

  for (size_t i = 0; i < len; ++i)
  {
    char ch = str[i];
    char escape_code = s_EscapeTable[(uint32_t) ch];

    if (escape_code)
    {
      BufferedWriterAppend(w, '\\');
      BufferedWriterAppend(w, escape_code);
    }
    else
    {
      BufferedWriterAppend(w, ch);
    }
  }

  BufferedWriterAppend(w, '"');
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %rax
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x92ab
movq %rbx, %rdi
callq 0x9364
xorl %eax, %eax
movb $0x22, 0x8(%rbx,%rax)
incq %rax
movq %rax, (%rbx)
testq %r14, %r14
je 0x9338
xorl %r12d, %r12d
movsbq (%r15,%r12), %r13
movl %r13d, %ecx
leaq 0x395d3(%rip), %rdx     # 0x428a0
movb (%rcx,%rdx), %bpl
testb %bpl, %bpl
je 0x92f1
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x9308
movq %rbx, %rdi
callq 0x9364
movb $0x5c, 0x8(%rbx)
movl $0x1, %eax
jmp 0x9325
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x9303
movq %rbx, %rdi
callq 0x9364
xorl %eax, %eax
movl %r13d, %ebp
jmp 0x9325
movb $0x5c, 0x8(%rbx,%rax)
incq %rax
movq %rax, (%rbx)
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x9325
movq %rbx, %rdi
callq 0x9364
xorl %eax, %eax
movb %bpl, 0x8(%rbx,%rax)
incq %rax
movq %rax, (%rbx)
incq %r12
cmpq %r12, %r14
jne 0x92be
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x934a
movq %rbx, %rdi
callq 0x9364
xorl %eax, %eax
movb $0x22, 0x8(%rbx,%rax)
incq %rax
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaJsonWriter.cpp
// Function: t2::BufferedWriterFlush(t2::BufferedWriter*)
static void BufferedWriterFlush(BufferedWriter* w)
{
  size_t remain = w->m_Used;
  const char* src = w->m_Buffer;
  while (remain)
  {
    size_t count = fwrite(src, 1, remain, w->m_File);
    src += count;
    remain -= count;
  }
  w->m_Used = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0x9397
leaq 0x8(%rbx), %r15
movq 0x2008(%rbx), %rcx
movl $0x1, %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x68e0
addq %rax, %r15
subq %rax, %r14
jne 0x9378
movq $0x0, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaPath.cpp
// Function: t2::LuaPathSplit(lua_State*)
static int LuaPathSplit(lua_State* L)
{
  PathBuffer pbuf;
  PathInit(&pbuf, luaL_checkstring(L, 1));

  if (pbuf.m_SegCount > 1)
  {
    char dir[kMaxPathLength];
    char file[kMaxPathLength];
    PathFormatPartial(dir, &pbuf, 0, pbuf.m_SegCount-2);
    PathFormatPartial(file, &pbuf, pbuf.m_SegCount-1, pbuf.m_SegCount-1);
    lua_pushstring(L, dir);
    lua_pushstring(L, file);
  }
  else
  {
    char file[kMaxPathLength];
    PathFormat(file, &pbuf);
    lua_pushstring(L, ".");
    lua_pushstring(L, file);
  }
  return 2;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x698, %rsp            # imm = 0x698
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
leaq 0x4(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xad64
movzwl 0x6(%r14), %ecx
cmpl $0x2, %ecx
jb 0x944e
addl $-0x2, %ecx
leaq 0x290(%rsp), %r14
leaq 0x4(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xb0f3
movzwl 0x6(%r15), %ecx
decl %ecx
leaq 0x490(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movl %ecx, %edx
callq 0xb0f3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a7f6
movq %rbx, %rdi
movq %r12, %rsi
jmp 0x9478
leaq 0x290(%rsp), %r14
leaq 0x4(%rsp), %rsi
movq %r14, %rdi
callq 0xb0e6
leaq 0x2aaf1(%rip), %rsi     # 0x33f5b
movq %rbx, %rdi
callq 0x1a7f6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a7f6
movl $0x2, %eax
addq $0x698, %rsp            # imm = 0x698
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaPath.cpp
// Function: t2::LuaPathNormalize(lua_State*)
static int LuaPathNormalize(lua_State* L)
{
  size_t input_len;
  const char* input = luaL_checklstring(L, 1, &input_len);

  PathBuffer buf;
  PathInit(&buf, input);

  char fmt[kMaxPathLength];
  PathFormat(fmt, &buf);

  lua_pushstring(L, fmt);
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x4a0, %rsp            # imm = 0x4A0
movq %rdi, %rbx
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0x1b664
leaq 0x214(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xad64
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xb0e6
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1a7f6
movl $0x1, %eax
addq $0x4a0, %rsp            # imm = 0x4A0
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaPath.cpp
// Function: t2::LuaPathJoin(lua_State*)
static int LuaPathJoin(lua_State* L)
{
  const char* p1 = luaL_checkstring(L, 1);
  const char* p2 = luaL_checkstring(L, 2);

  PathBuffer buf;
  PathInit(&buf, p1);
  PathConcat(&buf, p2);

  char fmt[kMaxPathLength];
  PathFormat(fmt, &buf);

  lua_pushstring(L, fmt);
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1b664
movq %rax, %r15
leaq 0x20c(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xad64
movq %r12, %rdi
movq %r15, %rsi
callq 0xafc1
movq %rsp, %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0xb0e6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a7f6
movl $0x1, %eax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaPath.cpp
// Function: t2::LuaPathGetFilenameDir(lua_State*)
static int LuaPathGetFilenameDir(lua_State* L)
{
  const char* path = luaL_checkstring(L, 1);

  PathBuffer buf;
  PathInit(&buf, path);
  if (PathStripLast(&buf))
  {
    char fmt[kMaxPathLength];
    PathFormat(fmt, &buf);
    lua_pushstring(L, fmt);
    return 1;
  }
  else
  {
    lua_pushstring(L, ".");
    return 1;
  }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
leaq 0x4(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xad64
movq %r14, %rdi
callq 0xafa1
testb %al, %al
je 0x95c4
leaq 0x290(%rsp), %r14
leaq 0x4(%rsp), %rsi
movq %r14, %rdi
callq 0xb0e6
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x95ce
leaq 0x2a990(%rip), %rsi     # 0x33f5b
movq %rbx, %rdi
callq 0x1a7f6
movl $0x1, %eax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaPath.cpp
// Function: t2::LuaPathGetFilename(lua_State*)
static int LuaPathGetFilename(lua_State* L)
{
  PathBuffer pbuf;
  PathInit(&pbuf, luaL_checkstring(L, 1));
  if (pbuf.m_SegCount > 0)
  {
    char buf[kMaxPathLength];
    PathFormatPartial(buf, &pbuf, pbuf.m_SegCount-1, pbuf.m_SegCount-1);
    lua_pushstring(L, buf);
  }
  else
  {
    lua_pushstring(L, "");
  }
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
leaq 0x4(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xad64
movzwl 0x6(%r14), %ecx
testl %ecx, %ecx
je 0x9638
decl %ecx
leaq 0x290(%rsp), %r14
leaq 0x4(%rsp), %rsi
movq %r14, %rdi
movl %ecx, %edx
callq 0xb0f3
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x9642
leaq 0x294d3(%rip), %rsi     # 0x32b12
movq %rbx, %rdi
callq 0x1a7f6
movl $0x1, %eax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaPath.cpp
// Function: t2::LuaPathGetExtension(lua_State*)
static int LuaPathGetExtension(lua_State* L)
{
  const char* input = luaL_checkstring(L, 1);
  
  // Make sure to look at the last path segment only.
  if (const char* pslash = strrchr(input, '/'))
  {
    input = pslash;
  }

  if (const char* pslash = strrchr(input, '\\'))
  {
    if (pslash > input)
      input = pslash;
  }

  if (const char* dot = strrchr(input, '.'))
    lua_pushstring(L, dot);
  else
    lua_pushstring(L, "");
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
movq %rax, %r14
movq %rax, %rdi
movl $0x2f, %esi
callq 0x6520
testq %rax, %rax
cmovneq %rax, %r14
movq %r14, %rdi
movl $0x5c, %esi
callq 0x6520
cmpq %r14, %rax
cmovaq %rax, %r14
movq %r14, %rdi
movl $0x2e, %esi
callq 0x6520
testq %rax, %rax
leaq 0x29466(%rip), %rsi     # 0x32b12
cmovneq %rax, %rsi
movq %rbx, %rdi
callq 0x1a7f6
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaPath.cpp
// Function: t2::LuaPathDropSuffix(lua_State*)
static int LuaPathDropSuffix(lua_State* L)
{
  const char* input = luaL_checkstring(L, 1);
  if (const char* dot = strrchr(input, '.'))
    lua_pushlstring(L, input, size_t(dot - input));
  else
    lua_pushvalue(L, 1);
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
movq %rax, %r14
movq %rax, %rdi
movl $0x2e, %esi
callq 0x6520
testq %rax, %rax
je 0x9700
subq %r14, %rax
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1a79f
jmp 0x970d
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1a37a
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaPath.cpp
// Function: t2::LuaPathGetFilenameBase(lua_State*)
static int LuaPathGetFilenameBase(lua_State* L)
{
  PathBuffer pbuf;
  PathInit(&pbuf, luaL_checkstring(L, 1));
  if (pbuf.m_SegCount > 0)
  {
    char buf[kMaxPathLength];
    PathFormatPartial(buf, &pbuf, pbuf.m_SegCount-1, pbuf.m_SegCount-1);
    if (char* dot = strrchr(buf, '.'))
      *dot = '\0';
    lua_pushstring(L, buf);
  }
  else
  {
    lua_pushstring(L, "");
  }
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
leaq 0x20c(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xad64
movzwl 0x6(%r14), %ecx
testl %ecx, %ecx
je 0x9782
decl %ecx
movq %rsp, %r14
leaq 0x20c(%rsp), %rsi
movq %r14, %rdi
movl %ecx, %edx
callq 0xb0f3
movq %r14, %rdi
movl $0x2e, %esi
callq 0x6520
testq %rax, %rax
je 0x977d
movb $0x0, (%rax)
movq %rsp, %rsi
jmp 0x9789
leaq 0x29389(%rip), %rsi     # 0x32b12
movq %rbx, %rdi
callq 0x1a7f6
movl $0x1, %eax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaPath.cpp
// Function: t2::LuaPathIsAbsolute(lua_State*)
static int LuaPathIsAbsolute(lua_State* L)
{
  PathBuffer pbuf;
  PathInit(&pbuf, luaL_checkstring(L, 1));
  lua_pushboolean(L, PathIsAbsolute(&pbuf) ? 1 : 0);
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x1b664
leaq 0xc(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xad64
movzwl 0x4(%r14), %esi
andl $0x1, %esi
movq %rbx, %rdi
callq 0x1a9c2
movl $0x1, %eax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaProfiler.cpp
// Function: t2::LuaProfilerInit(t2::MemAllocHeap*, t2::MemAllocLinear*, lua_State*)
void LuaProfilerInit(MemAllocHeap* heap, MemAllocLinear* alloc, lua_State* L)
{
  LuaProfilerState* self = &s_Profiler;

  memset(self, 0, sizeof *self);

  self->m_LuaState            = L;
  self->m_Heap                = heap;
  self->m_Allocator           = alloc;

  HashTableInit(&self->m_Functions, heap);

  RehashInvocationTable(1024);

  uint32_t toplevel_hash = Djb2Hash(s_TopLevelString);

  s_Profiler.m_CurrentInvocation = PushInvocation(&s_TopLevel, toplevel_hash);
  s_Profiler.m_CurrentInvocation->m_StartTick = TimerGet();

  // Install debug hook.
  lua_sethook(L, ProfilerLuaEvent, LUA_MASKCALL|LUA_MASKRET, 0);
}

// Assembly:
pushq %rbx
movq %rdx, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x391d6(%rip)    # 0x429d0
movups %xmm0, 0x391ef(%rip)    # 0x429f0
movups %xmm0, 0x391d8(%rip)    # 0x429e0
movq %rdx, 0x39191(%rip)     # 0x429a0
movq %rdi, 0x39192(%rip)     # 0x429a8
movq %rsi, 0x39193(%rip)     # 0x429b0
movups %xmm0, 0x39194(%rip)    # 0x429b8
movups %xmm0, 0x39199(%rip)    # 0x429c4
movq %rdi, 0x391a6(%rip)     # 0x429d8
movl $0x400, %edi            # imm = 0x400
callq 0x9884
leaq 0x26dbd(%rip), %rdi     # 0x30600
callq 0xa234
leaq 0x391b1(%rip), %rdi     # 0x42a00
movl %eax, %esi
callq 0x9929
movq %rax, 0x3919b(%rip)     # 0x429f8
callq 0xa4e2
movq 0x3918f(%rip), %rcx     # 0x429f8
movq %rax, 0x28(%rcx)
leaq 0x1ba(%rip), %rsi       # 0x9a2e
movq %rbx, %rdi
movl $0x3, %edx
xorl %ecx, %ecx
popq %rbx
jmp 0x1c3d0
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/LuaProfiler.cpp
// Function: t2::RehashInvocationTable(unsigned int)
static void RehashInvocationTable(uint32_t new_size)
{
  const uint32_t old_size = s_Profiler.m_InvocationTableSize;

  Invocation** new_table = HeapAllocateArrayZeroed<Invocation*>(s_Profiler.m_Heap, new_size);

  for (uint32_t i = 0; i < old_size; ++i)
  {
    Invocation* chain = s_Profiler.m_InvocationTable[i];
    while (chain)
    {
      Invocation* next = chain->m_Next;

      uint32_t new_index = chain->m_Hash & (new_size - 1);
      chain->m_Next = new_table[new_index];
      new_table[new_index] = chain;

      chain = next;
    }
  }

  HeapFree(s_Profiler.m_Heap, s_Profiler.m_InvocationTable);

  // Commit.
  s_Profiler.m_InvocationTable     = new_table;
  s_Profiler.m_InvocationTableSize = new_size;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
movl 0x39157(%rip), %r12d    # 0x429ec
movq 0x3910c(%rip), %rdi     # 0x429a8
movl %ebx, %esi
leaq (,%rsi,8), %r15
shlq $0x6, %rsi
callq 0xac52
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x62a0
testq %r12, %r12
je 0x98fd
leal -0x1(%rbx), %eax
xorl %ecx, %ecx
movq 0x39120(%rip), %rdx     # 0x429f0
movq (%rdx,%rcx,8), %rdx
testq %rdx, %rdx
je 0x98f5
movq 0x30(%rdx), %rsi
movl (%rdx), %edi
andl %eax, %edi
movq (%r14,%rdi,8), %r8
movq %r8, 0x30(%rdx)
movq %rdx, (%r14,%rdi,8)
movq %rsi, %rdx
testq %rsi, %rsi
jne 0x98d9
incq %rcx
cmpq %r12, %rcx
jne 0x98c9
movq 0x390a4(%rip), %rdi     # 0x429a8
movq 0x390e5(%rip), %rsi     # 0x429f0
callq 0xac5a
movq %r14, 0x390d9(%rip)     # 0x429f0
movl %ebx, 0x390cf(%rip)     # 0x429ec
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq