LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/MemAllocHeap.cpp
// Function: t2::HeapReallocate(t2::MemAllocHeap*, void*, unsigned long)
void* HeapReallocate(MemAllocHeap *heap, void *ptr, size_t size)
{
  void* new_ptr = realloc(ptr, size);

  if (!new_ptr && size > 0)
  {
    Croak("out of memory reallocating %d bytes at %p", (int) size, ptr);
  }

  return new_ptr;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x35b0
testq %rax, %rax
setne %cl
testq %r14, %r14
sete %dl
orb %cl, %dl
je 0xd7d7
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x7591(%rip), %rdi      # 0x14d6f
movl %r14d, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x56cd
nop
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/MemAllocLinear.cpp
// Function: t2::LinearAllocInit(t2::MemAllocLinear*, t2::MemAllocHeap*, unsigned long, char const*)
void LinearAllocInit(MemAllocLinear* self, MemAllocHeap* heap, size_t max_size, const char* debug_name)
{
  size_t alloc_size = max_size + MemAllocLinear::kMaxAlignment - 1;
  self->m_BasePointer = static_cast<char*>(HeapAllocate(heap, alloc_size));
  self->m_Pointer     = nullptr;
  self->m_Size        = max_size;
  self->m_Offset      = 0;
  self->m_BackingHeap = heap;
  self->m_DebugName   = debug_name;

  uintptr_t aligned_base = uintptr_t(self->m_BasePointer + MemAllocLinear::kMaxAlignment - 1) & ~(MemAllocLinear::kMaxAlignment - 1);
  uintptr_t delta        = aligned_base - uintptr_t(self->m_BasePointer);

  self->m_Pointer = self->m_BasePointer + delta;
  self->m_Size   -= (delta);

  self->m_OwnerThread = 0;

#if ENABLED(USE_VALGRIND)
  VALGRIND_MAKE_MEM_NOACCESS(self->m_BasePointer, alloc_size);
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x3f(%rdx), %rsi
movq %r15, %rdi
callq 0xd79a
movq %rax, (%r12)
andq $0x0, 0x18(%r12)
movq %r15, 0x20(%r12)
movq %rbx, 0x28(%r12)
leaq 0x3f(%rax), %rcx
andq $-0x40, %rcx
movq %rcx, 0x8(%r12)
subq %rcx, %rax
addq %r14, %rax
movq %rax, 0x10(%r12)
andq $0x0, 0x30(%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/MemoryMappedFile.cpp
// Function: t2::MmapFileUnmap(t2::MemoryMappedFile*)
void MmapFileUnmap(MemoryMappedFile* self)
{
  if (self->m_Address)
  {
    TimingScope timing_scope(&g_Stats.m_MunmapCalls, &g_Stats.m_MunmapTimeCycles);

    if (0 != munmap(self->m_Address, self->m_Size))
      Croak("munmap(%p, %d) failed: %d", self->m_Address, (int) self->m_Size, errno);

    close((int) self->m_SysData[0]);
  }

  Clear(self);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0xd906
leaq 0xfcd5(%rip), %rax      # 0x1d5a0
leaq 0x40(%rax), %rcx
movq %rcx, (%rsp)
addq $0x48, %rax
movq %rax, 0x8(%rsp)
callq 0x5b35
movq %rax, 0x10(%rsp)
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x31d0
testl %eax, %eax
jne 0xd918
movl 0x10(%rbx), %edi
callq 0x3660
movq %rsp, %rdi
callq 0x55d6
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq (%rbx), %r14
movl 0x8(%rbx), %ebx
callq 0x3050
movl (%rax), %ecx
leaq 0x7493(%rip), %rdi      # 0x14dbf
movq %r14, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x56cd
movq %rax, %rbx
movq %rsp, %rdi
callq 0x55d6
movq %rbx, %rdi
callq 0x35e0
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/MemoryMappedFile.cpp
// Function: t2::MmapFileMap(t2::MemoryMappedFile*, char const*)
void MmapFileMap(MemoryMappedFile* self, const char *fn)
{
  TimingScope timing_scope(&g_Stats.m_MmapCalls, &g_Stats.m_MmapTimeCycles);

  MmapFileUnmap(self);

  int fd = open(fn, O_RDONLY);

  if (-1 == fd)
    goto error;

  struct stat stbuf;
  if (0 != fstat(fd, &stbuf))
    goto error;

  self->m_Address    = mmap(NULL, stbuf.st_size, PROT_READ, MAP_FILE|MAP_PRIVATE, fd, 0);
  self->m_Size       = stbuf.st_size;
  self->m_SysData[0] = fd;

  if (self->m_Address)
    return;

error:
  if (-1 != fd)
    close(fd);

  Clear(self);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xfc3d(%rip), %rax      # 0x1d5a0
leaq 0x30(%rax), %rcx
movq %rcx, 0x8(%rsp)
addq $0x38, %rax
movq %rax, 0x10(%rsp)
callq 0x5b35
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
callq 0xd8b4
movq %r14, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x3240
movl %eax, %ebp
cmpl $-0x1, %eax
je 0xd9b1
leaq 0x20(%rsp), %rsi
movl %ebp, %edi
callq 0x35d0
testl %eax, %eax
je 0xd9d1
movl %ebp, %edi
callq 0x3660
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
leaq 0x8(%rsp), %rdi
callq 0x55d6
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x50(%rsp), %r14
pushq $0x1
popq %rdx
pushq $0x2
popq %rcx
xorl %edi, %edi
movq %r14, %rsi
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x35f0
movq %rax, (%rbx)
movq %r14, 0x8(%rbx)
movslq %ebp, %rcx
movq %rcx, 0x10(%rbx)
testq %rax, %rax
jne 0xd9bb
jmp 0xd9aa
jmp 0xda03
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x55d6
movq %rbx, %rdi
callq 0x35e0
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/PathUtil.cpp
// Function: t2::PathConcat(t2::PathBuffer*, t2::PathBuffer const*)
void PathConcat(PathBuffer* buffer, const PathBuffer* other)
{
  if (PathIsAbsolute(other))
  {
    *buffer = *other;
  }
  else
  {
    PathConcatImpl(buffer, other);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testb $0x1, 0x4(%rsi)
jne 0xdcf2
movzwl 0x6(%r14), %r15d
movl 0x4(%r14), %eax
movl %eax, %ecx
shrl %ecx
andl $0x1, %ecx
movzwl 0x8(%rbx), %edx
pushq $0x1
popq %rsi
subl $0x1, %edx
jb 0xdd0c
cmpl %ecx, %r15d
jle 0xdce0
decl %r15d
jmp 0xdcd1
testl %r15d, %r15d
movl %esi, %r15d
jne 0xdcd1
incw 0x8(%r14)
xorl %r15d, %r15d
jmp 0xdcd1
movl $0x28c, %edx            # imm = 0x28C
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3290
testb $0x1, %al
je 0xdd16
andw $0x0, 0x8(%r14)
testl %r15d, %r15d
jle 0xdd27
leal -0x1(%r15), %eax
movzwl 0xa(%r14,%rax,2), %ebp
jmp 0xdd29
xorl %ebp, %ebp
movzwl 0x6(%rbx), %eax
testq %rax, %rax
je 0xdd3b
decl %eax
movzwl 0xa(%rbx,%rax,2), %edx
jmp 0xdd3d
xorl %edx, %edx
movl %ebp, %edi
movl $0x8a, %esi
addq %r14, %rdi
addq %rsi, %rdi
addq %rbx, %rsi
callq 0x3290
movzwl 0x6(%rbx), %eax
movslq %r15d, %rcx
leaq (%r14,%rcx,2), %rcx
addq $0xa, %rcx
xorl %edx, %edx
cmpq %rdx, %rax
je 0xdd79
movzwl 0xa(%rbx,%rdx,2), %esi
addw %bp, %si
movw %si, (%rcx,%rdx,2)
incq %rdx
jmp 0xdd63
addw 0x6(%rbx), %r15w
movw %r15w, 0x6(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/PathUtil.cpp
// Function: t2::PathFormatPartial(char (&) [512], t2::PathBuffer const*, int, int)
void PathFormatPartial(char (&output)[kMaxPathLength], const PathBuffer* buffer, int start_seg, int end_seg)
{
  char *cursor = &output[0];
  char pathsep = PathType::kWindows == buffer->m_Type ? '\\' : '/';

  if (start_seg == 0 &&
      PathBuffer::kFlagAbsolute ==
      (buffer->m_Flags & (PathBuffer::kFlagAbsolute|PathBuffer::kFlagWindowsDevicePath)))
  {
    *cursor++ = pathsep;
  }

  // Emit all leading ".." tokens we've got left
  for (int i = 0, count = buffer->m_LeadingDotDots; i < count; ++i)
  {
    *cursor++ = '.';
    *cursor++ = '.';
    *cursor++ = pathsep;
  }

  // Emit all remaining tokens.
  uint16_t off = 0;

  for (int i = 0; i < start_seg; ++i)
  {
    off += buffer->SegLength(i);
  }

  for (int i = start_seg; i <= end_seg; ++i)
  {
    uint16_t len = buffer->SegLength(i);

    if ((cursor - &output[0]) + len + 1 >= kMaxPathLength)
      Croak("Path too long");

    if (i > start_seg)
      *cursor++ = pathsep;

    memcpy(cursor, buffer->m_Data + off, len);
    cursor += len;
    off += len;
  }
  *cursor = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, 0xc(%rsp)
movq %rsi, %r14
cmpl $0x1, (%rsi)
pushq $0x5c
popq %rax
pushq $0x2f
popq %rsi
cmovel %eax, %esi
movq %rdi, %r12
movl %edx, 0x4(%rsp)
testl %edx, %edx
jne 0xdddf
movzwl 0x4(%r14), %eax
andl $0x3, %eax
movq %rdi, %r12
cmpw $0x1, %ax
jne 0xdddf
leaq 0x1(%rdi), %r12
movb %sil, (%rdi)
movzwl 0x8(%r14), %eax
subl $0x1, %eax
jb 0xddfb
movw $0x2e2e, (%r12)         # imm = 0x2E2E
movb %sil, 0x2(%r12)
addq $0x3, %r12
jmp 0xdde4
xorl %eax, %eax
movl 0x4(%rsp), %edx
testl %edx, %edx
movl $0x0, %ecx
cmovgl %edx, %ecx
xorl %r15d, %r15d
cmpq %rax, %rcx
je 0xde36
testq %rax, %rax
je 0xde26
movzwl 0xa(%r14,%rax,2), %edx
subw 0x8(%r14,%rax,2), %dx
jmp 0xde2b
movzwl 0xa(%r14), %edx
addl %r15d, %edx
incq %rax
movl %edx, %r15d
jmp 0xde0e
movl %esi, 0x8(%rsp)
leaq 0x8a(%r14), %rax
movq %rax, 0x10(%rsp)
movl 0x4(%rsp), %eax
movl %eax, %ebx
movq %rdi, %rbp
cmpl 0xc(%rsp), %ebx
jg 0xdeb9
testl %ebx, %ebx
jle 0xde6c
movl %ebx, %eax
movzwl 0xa(%r14,%rax,2), %eax
leal -0x1(%rbx), %ecx
subw 0xa(%r14,%rcx,2), %ax
jmp 0xde71
movzwl 0xa(%r14), %eax
movq %r12, %rcx
subq %rdi, %rcx
movzwl %ax, %r13d
addq %r13, %rcx
cmpq $0x1ff, %rcx            # imm = 0x1FF
jge 0xdecd
cmpl 0x4(%rsp), %ebx
jle 0xde98
movl 0x8(%rsp), %eax
movb %al, (%r12)
incq %r12
movzwl %r15w, %esi
addq 0x10(%rsp), %rsi
movq %r12, %rdi
movq %r13, %rdx
callq 0x3290
addq %r13, %r12
addl %r13d, %r15d
incl %ebx
movq %rbp, %rdi
jmp 0xde4f
movb $0x0, (%r12)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6f25(%rip), %rdi      # 0x14df9
xorl %eax, %eax
callq 0x56cd
nop
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/Profiler.cpp
// Function: t2::ProfilerInit(char const*, int)
void ProfilerInit(const char* fileName, int threadCount)
  {
    CHECK(!g_ProfilerEnabled);
    CHECK(threadCount > 0);

    g_ProfilerEnabled = true;

    s_ProfilerState.m_ThreadCount = threadCount;

    HeapInit(&s_ProfilerState.m_Heap);

    size_t fileNameLen = strlen(fileName);
    s_ProfilerState.m_FileName = (char*)HeapAllocate(&s_ProfilerState.m_Heap, fileNameLen + 1);
    memcpy(s_ProfilerState.m_FileName, fileName, fileNameLen + 1);

    s_ProfilerState.m_Threads = HeapAllocateArray<ProfilerThread>(&s_ProfilerState.m_Heap, s_ProfilerState.m_ThreadCount);
    for (int i = 0; i < s_ProfilerState.m_ThreadCount; ++i)
    {
      ProfilerThread& thread = s_ProfilerState.m_Threads[i];
      thread.m_Events = HeapAllocateArray<ProfilerEvent>(&s_ProfilerState.m_Heap, kProfilerThreadMaxEvents);
      thread.m_EventCount = 0;
      LinearAllocInit(&thread.m_ScratchStrings, &s_ProfilerState.m_Heap, kProfilerThreadStringsSize, "profilerStrings");
      thread.m_IsBegin = false;
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movb $0x1, 0xf78f(%rip)      # 0x1d680
movl %esi, 0xf7a9(%rip)      # 0x1d6a0
leaq 0xf78a(%rip), %rbx      # 0x1d688
movq %rbx, %rdi
callq 0xd798
movq %r14, %rdi
callq 0x3150
leaq 0x1(%rax), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0xd79a
movq %rax, 0xf76c(%rip)      # 0x1d690
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3290
movslq 0xf767(%rip), %rsi      # 0x1d6a0
movq %rbx, %rdi
callq 0xe421
movq %rax, 0xf750(%rip)      # 0x1d698
xorl %r12d, %r12d
leaq 0x6eee(%rip), %r14      # 0x14e40
xorl %r13d, %r13d
movslq 0xf744(%rip), %rax      # 0x1d6a0
cmpq %rax, %r13
jge 0xdfa6
movq 0xf730(%rip), %rbp      # 0x1d698
leaq (%r12,%rbp), %r15
movl $0x100000, %esi         # imm = 0x100000
movq %rbx, %rdi
callq 0xd79a
movq %rax, 0x38(%rbp,%r12)
andl $0x0, 0x40(%rbp,%r12)
movl $0x400000, %edx         # imm = 0x400000
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0xd7ec
movb $0x0, 0x44(%rbp,%r12)
incq %r13
addq $0x48, %r12
jmp 0xdf55
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/Profiler.cpp
// Function: t2::EscapeString(char const*, char*, int)
static void EscapeString(const char* src, char* dst, int dstSpace)
  {
    while (*src && dstSpace > 2) // some input chars might expand into 2 in the output
    {
      char c = *src;
      switch (c)
      {
      case '"':
      case '\\':
      case '\b':
      case '\f':
      case '\n':
      case '\r':
      case '\t':
        *dst++ = '\\'; *dst++ = c; dstSpace -= 2;
        break;
      default:
        if (c >= 32 && c < 126)
        {
          *dst++ = c; dstSpace -= 1;
        }
      }
      ++src;
    }
    *dst = 0;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movl $0x400, %eax            # imm = 0x400
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movabsq $0x1, %rdx
movl $0xfffffffe, %r8d       # imm = 0xFFFFFFFE
movabsq $0x2, %r9
movabsq $0x400003700, %r10      # imm = 0x400003700
movzbl (%rdi), %r11d
testl %r11d, %r11d
je 0xe1ec
cmpl $0x3, %eax
jl 0xe1ec
cmpl $0x22, %r11d
ja 0xe1d2
movl %r11d, %ebx
btq %rbx, %r10
jae 0xe1d2
leaq 0x1(%rsi), %rbx
movb $0x5c, (%rsi)
movq %r9, %r14
movl %r8d, %ebp
addq %r14, %rsi
movb %r11b, (%rbx)
addl %ebp, %eax
incq %rdi
jmp 0xe19b
cmpl $0x5c, %r11d
je 0xe1b8
leal -0x20(%r11), %r15d
movq %rdx, %r14
movq %rsi, %rbx
movl %ecx, %ebp
cmpb $0x5d, %r15b
jbe 0xe1c5
jmp 0xe1cd
movb $0x0, (%rsi)
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/Profiler.cpp
// Function: t2::ProfilerDestroy()
void ProfilerDestroy()
  {
    if (!g_ProfilerEnabled)
      return;

    for (int i = 0; i < s_ProfilerState.m_ThreadCount; ++i)
    {
      ProfilerThread& thread = s_ProfilerState.m_Threads[i];
      if (thread.m_IsBegin)
        ProfilerEndImpl(i);
    }

    ProfilerWriteOutput();

    for (int i = 0; i < s_ProfilerState.m_ThreadCount; ++i)
    {
      ProfilerThread& thread = s_ProfilerState.m_Threads[i];
      Log(kSpam, "profiler: thread %i had %d events, %.1f KB strings", i, thread.m_EventCount, double(thread.m_ScratchStrings.m_Offset)/1024.0);
      HeapFree(&s_ProfilerState.m_Heap, thread.m_Events);
      LinearAllocDestroy(&thread.m_ScratchStrings);
    }
    HeapFree(&s_ProfilerState.m_Heap, s_ProfilerState.m_Threads);
    HeapFree(&s_ProfilerState.m_Heap, s_ProfilerState.m_FileName);
    HeapDestroy(&s_ProfilerState.m_Heap);
  }

// Assembly:
cmpb $0x1, 0xf483(%rip)      # 0x1d680
jne 0xe308
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
pushq $0x44
popq %r14
movl 0xf488(%rip), %eax      # 0x1d6a0
xorl %ebx, %ebx
movslq %eax, %rcx
cmpq %rcx, %rbx
jge 0xe246
movq 0xf46f(%rip), %rcx      # 0x1d698
cmpb $0x1, (%rcx,%r14)
jne 0xe23d
movl %ebx, %edi
callq 0xe309
movl 0xf463(%rip), %eax      # 0x1d6a0
incq %rbx
addq $0x48, %r14
jmp 0xe21a
callq 0xdfb5
xorl %ebx, %ebx
pushq $0x10
popq %rbp
leaq 0xf431(%rip), %r14      # 0x1d688
xorl %r15d, %r15d
movslq 0xf43f(%rip), %rax      # 0x1d6a0
movq 0xf430(%rip), %r12      # 0x1d698
cmpq %rax, %r15
jge 0xe2d1
leaq (%r12,%rbx), %r13
movl 0x40(%r12,%rbx), %ecx
movsd 0x18(%r12,%rbx), %xmm1
unpcklps 0x5b4c(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x5b54(%rip), %xmm1     # 0x13de0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x6b98(%rip), %xmm0     # 0x14e38
movl %ebp, %edi
leaq 0x6d41(%rip), %rsi      # 0x14fea
movl %r15d, %edx
movb $0x1, %al
callq 0x5981
movq 0x38(%r12,%rbx), %rsi
movq %r14, %rdi
callq 0xd7a2
movq %r13, %rdi
callq 0xd84a
incq %r15
addq $0x48, %rbx
jmp 0xe25a
leaq 0xf3b0(%rip), %rbx      # 0x1d688
movq %rbx, %rdi
movq %r12, %rsi
callq 0xd7a2
movq 0xf3a6(%rip), %rsi      # 0x1d690
movq %rbx, %rdi
callq 0xd7a2
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd799
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/Profiler.cpp
// Function: t2::ProfilerEndImpl(int)
void ProfilerEndImpl(int threadIndex)
  {
    CHECK(g_ProfilerEnabled);
    CHECK(threadIndex >= 0 && threadIndex < s_ProfilerState.m_ThreadCount);
    ProfilerThread& thread = s_ProfilerState.m_Threads[threadIndex];
    CHECK(thread.m_IsBegin);
    CHECK(thread.m_EventCount > 0);
    thread.m_IsBegin = false;
    if (thread.m_EventCount > kProfilerThreadMaxEvents)
      return;
    ProfilerEvent& evt = thread.m_Events[thread.m_EventCount-1];
    evt.m_Duration = TimerGet() - evt.m_Time;
  }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0xf384(%rip), %rax      # 0x1d698
movslq %edi, %rcx
imulq $0x48, %rcx, %rcx
movb $0x0, 0x44(%rax,%rcx)
movl 0x40(%rax,%rcx), %ebx
cmpq $0x8000, %rbx           # imm = 0x8000
ja 0xe347
addq %rcx, %rax
movq 0x38(%rax), %r14
shlq $0x5, %rbx
callq 0x5b35
subq -0x20(%r14,%rbx), %rax
movq %rax, -0x18(%r14,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/Profiler.cpp
// Function: t2::ProfilerBeginImpl(char const*, int)
void ProfilerBeginImpl(const char* name, int threadIndex)
  {
    CHECK(g_ProfilerEnabled);
    CHECK(threadIndex >= 0 && threadIndex < s_ProfilerState.m_ThreadCount);
    ProfilerThread& thread = s_ProfilerState.m_Threads[threadIndex];
    CHECK(!thread.m_IsBegin);
    thread.m_IsBegin = true;
    if (thread.m_EventCount >= kProfilerThreadMaxEvents)
    {
      Log(kWarning, "profiler: max events (%d) reached on thread %i, '%s' and later won't be recorded", (int)kProfilerThreadMaxEvents, threadIndex, name);
      return;
    }
    ProfilerEvent& evt = thread.m_Events[thread.m_EventCount++];
    evt.m_Time = TimerGet();

    // split input name by first space
    const char* nextWord = strchr(name, ' ');
    if (nextWord == nullptr)
    {
      evt.m_Name = StrDup(&thread.m_ScratchStrings, name);
      evt.m_Info = "";
    }
    else
    {
      evt.m_Name = StrDupN(&thread.m_ScratchStrings, name, nextWord - name);
      evt.m_Info = StrDup(&thread.m_ScratchStrings, nextWord + 1);
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0xf336(%rip), %r14      # 0x1d698
movslq %esi, %rax
imulq $0x48, %rax, %rax
movb $0x1, 0x44(%r14,%rax)
movl 0x40(%r14,%rax), %r15d
cmpq $0x8000, %r15           # imm = 0x8000
jb 0xe3a1
movl %esi, %ecx
leaq 0x6c97(%rip), %rsi      # 0x1501d
pushq $0x2
popq %rdi
movl $0x8000, %edx           # imm = 0x8000
movq %rbx, %r8
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5981
addq %rax, %r14
movq 0x38(%r14), %r13
leal 0x1(%r15), %eax
movl %eax, 0x40(%r14)
shlq $0x5, %r15
leaq (%r15,%r13), %r12
callq 0x5b35
movq %rax, (%r13,%r15)
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x3130
testq %rax, %rax
je 0xe3fb
movq %rax, %r15
movq %rax, %rdx
subq %rbx, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc84b
movq %rax, 0x10(%r12)
incq %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xc824
jmp 0xe412
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc824
movq %rax, 0x10(%r12)
leaq 0x5f82(%rip), %rax      # 0x14394
movq %rax, 0x18(%r12)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/ScanCache.cpp
// Function: t2::ScanCacheSetCache(t2::ScanCache*, t2::ScanData const*)
void ScanCacheSetCache(ScanCache* self, const ScanData* frozen_data)
{
  self->m_FrozenData = frozen_data;

  if (frozen_data)
  {
    self->m_FrozenAccess = HeapAllocateArrayZeroed<uint8_t>(self->m_Heap, frozen_data->m_EntryCount);

    Log(kDebug, "Scan cache initialized from frozen data - %u entries", frozen_data->m_EntryCount);

#if ENABLED(CHECKED_BUILD)
    // Paranoia - make sure the cache is sorted.
    for (int i = 1, count = frozen_data->m_EntryCount; i < count; ++i)
    {
      if (frozen_data->m_Keys[i] < frozen_data->m_Keys[i - 1])
        Croak("Header scanning cache is not sorted");
    }
#endif
  }
}

// Assembly:
movq %rsi, (%rdi)
testq %rsi, %rsi
je 0xe4e1
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x40(%rdi), %rdi
movslq 0x4(%rsi), %rsi
callq 0xf07a
movq %rax, 0x60(%r14)
movl 0x4(%rbx), %edx
leaq 0x6b9e(%rip), %rsi      # 0x1506e
pushq $0x8
popq %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5981
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/ScanCache.cpp
// Function: t2::LookupDynamic(t2::ScanCache*, t2::HashDigest const&)
static ScanCache::Record* LookupDynamic(ScanCache* self, const HashDigest& key)
{
  uint32_t table_size = self->m_TableSize;

  if (table_size > 0)
  {
#if ENABLED(USE_SHA1_HASH)
    const uint32_t hash = key.m_Words.m_C;
#elif ENABLED(USE_FAST_HASH)
    const uint32_t hash = key.m_Words32[0];
#endif
    uint32_t index = hash & (table_size - 1);

    ScanCache::Record* chain = self->m_Table[index];
    while (chain)
    {
      if (key == chain->m_Key)
      {
        return chain;
      }

      chain = chain->m_Next;
    }
  }

  return nullptr;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x54(%rdi), %ebx
testl %ebx, %ebx
je 0xe69b
movq %rsi, %r14
decl %ebx
andl (%rsi), %ebx
shlq $0x3, %rbx
addq 0x58(%rdi), %rbx
movq (%rbx), %rbx
testq %rbx, %rbx
je 0xe69b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7d72
testb %al, %al
jne 0xe69d
addq $0x28, %rbx
jmp 0xe67e
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/ScanCache.cpp
// Function: t2::ScanCacheDirty(t2::ScanCache*)
bool ScanCacheDirty(ScanCache* self)
{
  bool result;

  ReadWriteLockRead(&self->m_Lock);

  result = self->m_RecordCount > 0;

  ReadWriteUnlockRead(&self->m_Lock);

  return result;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movq %r14, %rdi
callq 0xf09d
cmpl $0x0, 0x50(%rbx)
setne %bl
movq %r14, %rdi
callq 0xf0b7
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/ScanCache.cpp
// Function: t2::WriteUniqueStringPointer(t2::HashTable<t2::BinaryLocator, 0u>*, t2::BinarySegment*, t2::BinarySegment*, unsigned int, char const*)
static void WriteUniqueStringPointer(HashTable<BinaryLocator, kFlagPathStrings>* atoms, BinarySegment* out_segment, BinarySegment* string_segment, uint32_t hash, const char* filename)
{
  if (const BinaryLocator* l = HashTableLookup(atoms, hash, filename))
  {
    BinarySegmentWritePointer(out_segment, *l);
    return;
  }

  BinaryLocator pos = BinarySegmentPosition(string_segment);
  HashTableInsert(atoms, hash, filename, pos);

  BinarySegmentWritePointer(out_segment, pos);
  BinarySegmentWriteStringData(string_segment, filename);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl %ecx, %esi
movq %r8, %rdx
callq 0xf716
testq %rax, %rax
je 0xeff5
movl (%rax), %esi
movq 0x8(%rax), %rdx
movq %r15, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11b5e
movq %r14, %rdi
callq 0x11b99
leaq 0x8(%rsp), %r13
movl %eax, (%r13)
movq %rdx, 0x8(%r13)
movq %r12, %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq %r13, %rcx
callq 0xf734
movl (%r13), %esi
movq 0x8(%r13), %rdx
movq %r15, %rdi
callq 0x11b5e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7d4a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/SignalHandler.cpp
// Function: t2::SignalGetReason()
const char* SignalGetReason(void)
{
  MutexLock(&s_SignalMutex);
  const char* result = s_SignalInfo.m_Reason;
  MutexUnlock(&s_SignalMutex);
  return result;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0xd72d(%rip), %rbx      # 0x1d6a8
movq %rbx, %rdi
callq 0x549a
movq 0xd746(%rip), %r14      # 0x1d6d0
movq %rbx, %rdi
callq 0x54b4
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/SignalHandler.cpp
// Function: t2::SignalHandlerInit()
void SignalHandlerInit()
{
  MutexInit(&s_SignalMutex);

#if defined(TUNDRA_UNIX)
	{
		pthread_t sigthread;
		if (0 != pthread_create(&sigthread, NULL, PosixSignalHandlerThread, NULL))
			CroakErrno("couldn't start signal handler thread");
		pthread_detach(sigthread);
	}
#elif defined(TUNDRA_WIN32)
  s_SignalHandle = CreateEvent(NULL, TRUE, FALSE, NULL);
  SetConsoleCtrlHandler(WindowsSignalHandlerFunc, TRUE);
#else
#error Meh
#endif
}

// Assembly:
pushq %rax
leaq 0xd6ce(%rip), %rdi      # 0x1d6a8
callq 0x5404
leaq 0x29(%rip), %rdx        # 0x1000f
movq %rsp, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x3610
testl %eax, %eax
jne 0x10001
movq (%rsp), %rdi
callq 0x3230
popq %rax
retq
leaq 0x5147(%rip), %rdi      # 0x1514f
xorl %eax, %eax
callq 0x5771
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/SignalHandler.cpp
// Function: t2::PosixSignalHandlerThread(void*)
static void* PosixSignalHandlerThread(void *arg)
{
  (void)arg; // unused

  int sig, rc;
  sigset_t sigs;
  sigemptyset(&sigs);
  sigaddset(&sigs, SIGINT);
  sigaddset(&sigs, SIGTERM);
  sigaddset(&sigs, SIGQUIT);
  if (0 == (rc = sigwait(&sigs, &sig)))
  {
    const char *reason = "unknown";
    switch (sig)
    {
      case SIGINT:  reason = "SIGINT";  break;
      case SIGTERM: reason = "SIGTERM"; break;
      case SIGQUIT: reason = "SIGQUIT"; break;
    }
    SignalSet(reason);
  }
  else
    CroakErrno("sigwait() failed");

  return nullptr;
}

// Assembly:
pushq %rbx
subq $0x90, %rsp
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x3420
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x3530
pushq $0xf
popq %rsi
movq %rbx, %rdi
callq 0x3530
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x3530
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0x30e0
testl %eax, %eax
jne 0x1009b
movl 0xc(%rsp), %eax
cmpl $0xf, %eax
je 0x1007b
cmpl $0x3, %eax
je 0x10072
cmpl $0x2, %eax
jne 0x10084
leaq 0x5123(%rip), %rdi      # 0x15193
jmp 0x1008b
leaq 0x5129(%rip), %rdi      # 0x151a2
jmp 0x1008b
leaq 0x5118(%rip), %rdi      # 0x1519a
jmp 0x1008b
leaq 0x5100(%rip), %rdi      # 0x1518b
callq 0xff9d
xorl %eax, %eax
addq $0x90, %rsp
popq %rbx
retq
leaq 0x5108(%rip), %rdi      # 0x151aa
xorl %eax, %eax
callq 0x5771
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/SignalHandler.cpp
// Function: t2::SignalBlockThread(bool)
void SignalBlockThread(bool block)
{
	sigset_t sigs;
	sigemptyset(&sigs);
	sigaddset(&sigs, SIGINT);
	sigaddset(&sigs, SIGTERM);
	sigaddset(&sigs, SIGQUIT);
	if  (0 != pthread_sigmask(block ? SIG_BLOCK : SIG_UNBLOCK, &sigs, 0))
		CroakErrno("pthread_sigmask failed");
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %edi, %ebx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x3420
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x3530
pushq $0xf
popq %rsi
movq %r14, %rdi
callq 0x3530
pushq $0x3
popq %rsi
movq %r14, %rdi
callq 0x3530
xorb $0x1, %bl
movzbl %bl, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x30b0
testl %eax, %eax
jne 0x1013a
addq $0x88, %rsp
popq %rbx
popq %r14
retq
leaq 0x5033(%rip), %rdi      # 0x15174
xorl %eax, %eax
callq 0x5771
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/StatCache.cpp
// Function: t2::StatCacheInit(t2::StatCache*, t2::MemAllocLinear*, t2::MemAllocHeap*)
void StatCacheInit(StatCache* self, MemAllocLinear* allocator, MemAllocHeap* heap)
{
  self->m_Allocator      = allocator;
  self->m_Heap           = heap;
  HashTableInit(&self->m_Files, heap);
  ReadWriteLockInit(&self->m_HashLock);
}

// Assembly:
movq %rsi, (%rdi)
movq %rdx, 0x8(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rdi)
movups %xmm0, 0x54(%rdi)
movq %rdx, 0x68(%rdi)
andq $0x0, 0x70(%rdi)
addq $0x10, %rdi
jmp 0xf044
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/StatCache.cpp
// Function: t2::StatCacheMarkDirty(t2::StatCache*, char const*, unsigned int)
void StatCacheMarkDirty(StatCache* self, const char* path, uint32_t hash)
{
  ReadWriteLockWrite(&self->m_HashLock);

  if (FileInfo* fi = HashTableLookup(&self->m_Files, hash, path))
  {
    fi->m_Flags = FileInfo::kFlagDirty;
  }

  ReadWriteUnlockWrite(&self->m_HashLock);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x10(%rdi), %rbx
movq %rbx, %rdi
callq 0xf0d1
addq $0x48, %r15
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x102a8
testq %rax, %rax
je 0x101bd
movl $0x40000000, (%rax)     # imm = 0x40000000
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xf0f6
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/StatCache.cpp
// Function: t2::StatCacheStat(t2::StatCache*, char const*, unsigned int)
FileInfo StatCacheStat(StatCache* self, const char* path, uint32_t hash)
{
  ReadWriteLockRead(&self->m_HashLock);

  const FileInfo* fi = HashTableLookup(&self->m_Files, hash, path);

  if (fi != nullptr && 0 == (fi->m_Flags & FileInfo::kFlagDirty))
  {
    FileInfo result = *fi;
    ReadWriteUnlockRead(&self->m_HashLock);
    return result;
  }

  ReadWriteUnlockRead(&self->m_HashLock);

  AtomicIncrement(&g_Stats.m_StatCacheMisses);
  FileInfo file_info = GetFileInfo(path);

  // There's a natural race condition here. Some other thread might come in,
  // stat the file and insert it before us. We just let that happen. The DAG
  // guarantees that we won't be writing to files that are being stat'd here,
  // so the result of these races is benign.
  StatCacheInsert(self, hash, path, file_info);
  return file_info;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x10(%rsi), %r14
movq %r14, %rdi
callq 0xf09d
leaq 0x48(%r13), %r12
movq %r12, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x102a8
testq %rax, %rax
je 0x10225
testb $0x40, 0x3(%rax)
jne 0x10225
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rbx)
movups (%rax), %xmm0
movups %xmm0, (%rbx)
movq %r14, %rdi
callq 0xf0b7
jmp 0x1026f
movq %r14, %rdi
callq 0xf0b7
leaq 0xd36c(%rip), %rax      # 0x1d5a0
lock
incl 0x74(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc948
movq %r14, %rdi
callq 0xf0d1
movq (%r13), %rdi
movq %r15, %rsi
callq 0xc824
movq %r12, %rdi
movl %ebp, %esi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x102c6
movq %r14, %rdi
callq 0xf0f6
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/TargetSelect.cpp
// Function: t2::FindHash(int*, unsigned int const*, int, unsigned int)
static bool FindHash(int* index_out, const uint32_t* hashes, int count, uint32_t hash)
{
  for (int i = 0; i < count; ++i)
  {
    if (hashes[i] == hash)
    {
      *index_out = i;
      return true;
    }
  }

  return false;
}

// Assembly:
xorl %eax, %eax
testl %edx, %edx
movl $0x0, %r8d
cmovgl %edx, %r8d
cmpq %rax, %r8
je 0x10883
cmpl %ecx, (%rsi,%rax,4)
je 0x10881
incq %rax
jmp 0x10872
movl %eax, (%rdi)
movslq %edx, %rcx
cmpq %rcx, %rax
setl %al
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/ExecUnix.cpp
// Function: t2::SetFdNonBlocking(int)
static void SetFdNonBlocking(int fd)
{
	int flags;

	flags = fcntl(fd, F_GETFL);
	flags |= O_NONBLOCK;
	if (-1 == fcntl(fd, F_SETFL, flags))
		CroakErrno("couldn't unblock fd %d", fd);
}

// Assembly:
pushq %rbx
movl %edi, %ebx
pushq $0x3
popq %rsi
xorl %eax, %eax
callq 0x31e0
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %ebx, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x31e0
cmpl $-0x1, %eax
je 0x10dd4
popq %rbx
retq
leaq 0x44ec(%rip), %rdi      # 0x152c7
movl %ebx, %esi
xorl %eax, %eax
callq 0x5771
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/DigestCache.cpp
// Function: t2::DigestCacheInit(t2::DigestCache*, unsigned long)
void DigestCacheInit(DigestCache* self, size_t heap_size)
{
  ReadWriteLockInit(&self->m_Lock);

  self->m_State = nullptr;

  HeapInit(&self->m_Heap);
  LinearAllocInit(&self->m_Allocator, &self->m_Heap, heap_size / 2, "digest allocator");
  MmapFileInit(&self->m_StateFile);
  HashTableInit(&self->m_Table, &self->m_Heap);

  self->m_AccessTime = time(nullptr);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
callq 0xf044
andq $0x0, 0x38(%rbx)
leaq 0x40(%rbx), %r15
movq %r15, %rdi
callq 0xd798
leaq 0x48(%rbx), %rdi
shrq %r14
leaq 0x44cb(%rip), %rcx      # 0x152de
movq %r15, %rsi
movq %r14, %rdx
callq 0xd7ec
leaq 0x80(%rbx), %rdi
callq 0xd8a4
xorps %xmm0, %xmm0
movups %xmm0, 0xac(%rbx)
movups %xmm0, 0xa0(%rbx)
movq %r15, 0xc0(%rbx)
andq $0x0, 0xc8(%rbx)
xorl %edi, %edi
callq 0x3300
movq %rax, 0xd0(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/DigestCache.cpp
// Function: t2::DigestCacheOpen(t2::DigestCache*, char const*)
void DigestCacheOpen(DigestCache* self, const char* filename)
{
  MmapFileMap(&self->m_StateFile, filename);
  if (MmapFileValid(&self->m_StateFile))
  {
    const DigestCacheState* state = (const DigestCacheState*) self->m_StateFile.m_Address;
    if (DigestCacheState::MagicNumber == state->m_MagicNumber)
    {
      const uint64_t time_now = time(nullptr);

      // Throw out records that haven't been accessed in a week.
      const uint64_t cutoff_time = time_now - 7 * 24 * 60 * 60;

      self->m_State = state;

      //HashTablePrepareBulkInsert(&self->m_Table, state->m_Records.GetCount());

      for (const FrozenDigestRecord& record : state->m_Records)
      {
        if (record.m_AccessTime < cutoff_time)
          continue;

        DigestCacheRecord r;
        r.m_ContentDigest = record.m_ContentDigest;
        r.m_Timestamp     = record.m_Timestamp;
        r.m_AccessTime    = record.m_AccessTime;
        HashTableInsert(&self->m_Table, record.m_FilenameHash, record.m_Filename.Get(), r);
      }
      Log(kDebug, "digest cache initialized -- %d entries", state->m_Records.GetCount());
    }
    else
    {
      MmapFileUnmap(&self->m_StateFile);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
movq %r14, %rdi
callq 0xd94b
movq 0x80(%rbx), %r15
testq %r15, %r15
je 0x10f5e
cmpl $0x6a683db8, (%r15)     # imm = 0x6A683DB8
jne 0x10f2f
xorl %r13d, %r13d
xorl %edi, %edi
callq 0x3300
movq %rax, %r14
addq $-0x93a80, %r14         # imm = 0xFFF6C580
movq %r15, 0x38(%rbx)
movslq 0x8(%r15), %rax
testq %rax, %rax
leaq 0x8(%rax,%r15), %rbp
cmoveq %rax, %rbp
movq %r15, 0x8(%rsp)
movslq 0x4(%r15), %rax
addq $0xa0, %rbx
leaq 0x24(%rbp), %r15
imulq $0x30, %rax, %r12
cmpq %r13, %r12
je 0x10f45
movq 0x8(%rbp,%r13), %rax
cmpq %r14, %rax
jb 0x10f29
movups 0x14(%rbp,%r13), %xmm0
movaps %xmm0, 0x10(%rsp)
movq (%rbp,%r13), %rcx
movq %rcx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movl 0x10(%rbp,%r13), %esi
movslq 0x24(%rbp,%r13), %rax
leaq (%r15,%r13), %rdx
addq %rax, %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq %rbx, %rdi
leaq 0x10(%rsp), %rcx
callq 0x112c1
addq $0x30, %r13
jmp 0x10edb
movq %r14, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd8b4
movq 0x8(%rsp), %rax
movl 0x4(%rax), %edx
leaq 0x439b(%rip), %rsi      # 0x152ef
pushq $0x8
popq %rdi
xorl %eax, %eax
callq 0x5981
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/DigestCache.cpp
// Function: t2::DigestCacheDestroy(t2::DigestCache*)
void DigestCacheDestroy(DigestCache* self)
{
  HashTableDestroy(&self->m_Table);
  MmapFileDestroy(&self->m_StateFile);
  LinearAllocDestroy(&self->m_Allocator);
  HeapDestroy(&self->m_Heap);
  ReadWriteLockDestroy(&self->m_Lock);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0xa0, %rdi
callq 0x112f2
leaq 0x80(%rbx), %rdi
callq 0xd8af
leaq 0x48(%rbx), %rdi
callq 0xd84a
leaq 0x40(%rbx), %rdi
callq 0xd799
movq %rbx, %rdi
popq %rbx
jmp 0xf060
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/DigestCache.cpp
// Function: t2::DigestCacheGet(t2::DigestCache*, char const*, unsigned int, unsigned long, t2::HashDigest*)
bool DigestCacheGet(DigestCache* self, const char* filename, uint32_t hash, uint64_t timestamp, HashDigest* digest_out)
{
  bool result = false;

  ReadWriteLockRead(&self->m_Lock);

  if (DigestCacheRecord* r = (DigestCacheRecord*) HashTableLookup(&self->m_Table, hash, filename))
  {
    if (r->m_Timestamp == timestamp)
    {
      // Technically violates r/w lock - doesn't matter
      r->m_AccessTime = self->m_AccessTime;
      *digest_out     = r->m_ContentDigest;
      result          = true;
    }
  }

  ReadWriteUnlockRead(&self->m_Lock);

  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %r14
movq %rcx, %r15
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %rbx
callq 0xf09d
leaq 0xa0(%rbx), %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x11319
testq %rax, %rax
je 0x1120a
cmpq %r15, 0x10(%rax)
jne 0x1120a
movq 0xd0(%rbx), %rcx
movq %rcx, 0x18(%rax)
movups (%rax), %xmm0
movups %xmm0, (%r14)
movb $0x1, %bpl
jmp 0x1120c
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0xf0b7
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/DigestCache.cpp
// Function: t2::DigestCacheSet(t2::DigestCache*, char const*, unsigned int, unsigned long, t2::HashDigest const&)
void DigestCacheSet(DigestCache* self, const char* filename, uint32_t hash, uint64_t timestamp, const HashDigest& digest)
{
  ReadWriteLockWrite(&self->m_Lock);

  DigestCacheRecord* r;

  if (nullptr != (r = (DigestCacheRecord*) HashTableLookup(&self->m_Table, hash, filename)))
  {
    r->m_Timestamp     = timestamp;
    r->m_ContentDigest = digest;
    r->m_AccessTime    = self->m_AccessTime;
  }
  else
  {
    DigestCacheRecord r;
    r.m_ContentDigest = digest;
    r.m_Timestamp     = timestamp;
    r.m_AccessTime    = self->m_AccessTime;
    HashTableInsert(&self->m_Table, hash, StrDup(&self->m_Allocator, filename), r);
  }

  ReadWriteUnlockWrite(&self->m_Lock);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r13
movq %rcx, %r12
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
callq 0xf0d1
leaq 0xa0(%rbx), %r15
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x11319
testq %rax, %rax
je 0x11272
movq %r12, 0x10(%rax)
movups (%r13), %xmm0
movups %xmm0, (%rax)
movq 0xd0(%rbx), %rcx
movq %rcx, 0x18(%rax)
jmp 0x112aa
movups (%r13), %xmm0
movq %rsp, %r13
movaps %xmm0, (%r13)
movq %r12, 0x10(%r13)
movq 0xd0(%rbx), %rax
movq %rax, 0x18(%r13)
leaq 0x48(%rbx), %rdi
movq %r14, %rsi
callq 0xc824
movq %r15, %rdi
movl %ebp, %esi
movq %rax, %rdx
movq %r13, %rcx
callq 0x112c1
movq %rbx, %rdi
callq 0xf0f6
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/FileSign.cpp
// Function: t2::CalculateGlobSignatureFor(char const*, t2::MemAllocHeap*, t2::MemAllocLinear*)::IterContext::Callback(void*, t2::FileInfo const&, char const*)
static void Callback(void* user_data, const FileInfo& info, const char* path)
      {
        IterContext* self = (IterContext*) user_data;
        char* data = StrDup(self->m_Allocator, path);
        Buffer<const char*>* target = info.IsDirectory() ? &self->m_Dirs : &self->m_Files;
        BufferAppendOne(target, self->m_Heap, data);
      }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
movq %rdx, %rsi
callq 0xc824
leaq 0x10(%r14), %rdi
leaq 0x28(%r14), %rcx
testb $0x8, (%rbx)
cmoveq %rcx, %rdi
movq 0x8(%r14), %rsi
movq %rax, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xfef8
nop
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/HashFast.cpp
// Function: t2::HashInitImpl(t2::HashStateImpl*)
void HashInitImpl(HashStateImpl* self)
{
  uint32_t seeds[4] = { 0x89caf13a, 0x179fa534, 0x5199afcc, 0xef901315 };

  for (int i = 0; i < 4; ++i)
  {
    uint32_t seed = seeds[i];
    self->m_V[i][0] = seed + kPrime32_1 + kPrime32_2;
    self->m_V[i][1] = seed + kPrime32_2;
    self->m_V[i][2] = seed;
    self->m_V[i][3] = seed - kPrime32_1;
  }
}

// Assembly:
xorl %eax, %eax
leaq 0x3946(%rip), %rcx      # 0x15360
movq 0x391e(%rip), %xmm0     # 0x15340
cmpq $0x10, %rax
je 0x11a51
movl (%rax,%rcx), %edx
movd %edx, %xmm1
pshufd $0x50, %xmm1, %xmm1     # xmm1 = xmm1[0,0,1,1]
paddd %xmm0, %xmm1
movq %xmm1, (%rdi,%rax,4)
movl %edx, 0x8(%rdi,%rax,4)
addl $0x61c8864f, %edx       # imm = 0x61C8864F
movl %edx, 0xc(%rdi,%rax,4)
addq $0x4, %rax
jmp 0x11a22
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/HashFast.cpp
// Function: t2::HashFinalizeImpl(t2::HashStateImpl*, t2::HashDigest*)
void HashFinalizeImpl(HashStateImpl* state, HashDigest* digest)
{
  for (int v = 0; v < 4; ++v)
  {
    uint32_t v0 = state->m_V[v][0];
    uint32_t v1 = state->m_V[v][1];
    uint32_t v2 = state->m_V[v][2];
    uint32_t v3 = state->m_V[v][3];

    uint32_t h32 = RotateLeft(v0, 1) + RotateLeft(v1, 7) + RotateLeft(v2, 12) + RotateLeft(v3, 18);

    h32 ^= h32 >> 15;
    h32 *= kPrime32_2;
    h32 ^= h32 >> 13;
    h32 *= kPrime32_3;
    h32 ^= h32 >> 16;

    digest->m_Words32[v] = h32;
  }
}

// Assembly:
xorl %eax, %eax
movdqa 0x38f4(%rip), %xmm0     # 0x15350
pshufd $0xf5, %xmm0, %xmm1     # xmm1 = xmm0[1,1,3,3]
cmpq $0x10, %rax
je 0x11ad9
movdqa (%rdi,%rax,4), %xmm2
pshufd $0xf5, %xmm2, %xmm3     # xmm3 = xmm2[1,1,3,3]
pmuludq %xmm0, %xmm2
pshufd $0xed, %xmm2, %xmm4     # xmm4 = xmm2[1,3,2,3]
pmuludq %xmm1, %xmm3
pshufd $0xed, %xmm3, %xmm5     # xmm5 = xmm3[1,3,2,3]
punpckldq %xmm5, %xmm4    # xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
pshufd $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3]
pshufd $0xe8, %xmm3, %xmm3     # xmm3 = xmm3[0,2,2,3]
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
por %xmm4, %xmm2
pshufd $0xee, %xmm2, %xmm3     # xmm3 = xmm2[2,3,2,3]
paddd %xmm2, %xmm3
pshufd $0x55, %xmm3, %xmm2     # xmm2 = xmm3[1,1,1,1]
paddd %xmm3, %xmm2
movd %xmm2, %ecx
movl %ecx, %edx
shrl $0xf, %edx
xorl %ecx, %edx
imull $0x85ebca77, %edx, %ecx # imm = 0x85EBCA77
movl %ecx, %edx
shrl $0xd, %edx
xorl %ecx, %edx
imull $0xc2b2ae3d, %edx, %ecx # imm = 0xC2B2AE3D
movl %ecx, %edx
shrl $0x10, %edx
xorl %ecx, %edx
movl %edx, (%rsi,%rax)
addq $0x4, %rax
jmp 0x11a61
retq
nop
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/BinaryWriter.cpp
// Function: t2::BinarySegmentAlign(t2::BinarySegment*, unsigned long)
void BinarySegmentAlign(BinarySegment* self, size_t alignment)
{
  size_t offset  = self->m_Bytes.m_Size;
  size_t aligned = (offset + alignment - 1) & ~(alignment - 1);
  size_t delta   = aligned - offset;

  while (delta--)
  {
    BufferAppendOne(&self->m_Bytes, self->m_Heap, 0xfe);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
movq 0x20(%rdi), %r15
leaq (%rsi,%r15), %rax
decq %rax
negq %rsi
andq %rax, %rsi
subq %rsi, %r15
testq %r15, %r15
je 0x11b1c
movq 0x10(%rbx), %rsi
movq %r14, %rdi
movl $0xfe, %edx
callq 0x11dbc
incq %r15
jmp 0x11b01
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/BinaryWriter.cpp
// Function: t2::BinarySegmentWritePointer(t2::BinarySegment*, t2::BinaryLocator)
void BinarySegmentWritePointer(BinarySegment* seg, BinaryLocator locator)
{
  BinaryFixup* fixup = BufferAlloc(&seg->m_Fixups, seg->m_Heap, 1);
  fixup->m_PointerOffset = seg->m_Bytes.m_Size;
  fixup->m_Target        = locator;

  // Write dummy value to be fixed up later
  BinarySegmentWriteUint32(seg, 0x7eeeeeee);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
addq $0x30, %rdi
movq 0x10(%r14), %rsi
pushq $0x1
popq %rdx
callq 0x11e2a
movq 0x20(%r14), %rcx
movq %rcx, (%rax)
movl %ebp, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %r14, %rdi
movl $0x7eeeeeee, %esi       # imm = 0x7EEEEEEE
popq %rbx
popq %r14
popq %rbp
jmp 0x7df6
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/BinaryWriter.cpp
// Function: t2::BinaryWriterDestroy(t2::BinaryWriter*)
void BinaryWriterDestroy(BinaryWriter* self)
{
  for (BinarySegment* seg : self->m_Segments)
  {
    BinarySegmentDestroy(seg);
    HeapFree(self->m_Heap, seg);
  }

  BufferDestroy(&self->m_Segments, self->m_Heap);
  self->m_Heap = nullptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movq 0x8(%rdi), %r12
movq 0x10(%rdi), %r13
shlq $0x3, %r13
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x11c04
movq (%r12,%rbp), %r15
leaq 0x30(%r15), %rdi
movq 0x10(%r15), %rsi
callq 0x11ec6
leaq 0x18(%r15), %rdi
movq 0x10(%r15), %rsi
callq 0x11eea
movq (%rbx), %rdi
movq %r15, %rsi
callq 0xd7a2
addq $0x8, %rbp
jmp 0x11bd0
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x11e91
andq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/BinaryWriter.cpp
// Function: t2::BinaryWriterFlush(t2::BinaryWriter*, char const*)
bool BinaryWriterFlush(BinaryWriter* self, const char* out_fn)
{
  if (!BinaryWriterFinalize(self))
    return false;

  FILE* f = fopen(out_fn, "wb");
  if (!f)
    return false;
  
  bool success = true;

  const size_t seg_count = self->m_Segments.m_Size;
  BinarySegment** segs = self->m_Segments.m_Storage;

  // Align all segments to 16 bytes
  for (size_t i = 0; success && i < seg_count; ++i)
  {
    success = BinarySegmentWrite(segs[i], f);
  }

  fclose(f);
  return success;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %r12
movq 0x10(%rdi), %r13
xorl %ebp, %ebp
pushq $0x10
popq %r15
cmpq %rbp, %r13
je 0x11c57
movq (%r12,%rbp,8), %rdi
movq %r15, %rsi
callq 0x11ae1
incq %rbp
jmp 0x11c41
xorl %eax, %eax
xorl %ecx, %ecx
cmpq %rcx, %r13
je 0x11c71
movq (%r12,%rcx,8), %rdx
movq %rax, 0x8(%rdx)
addq 0x20(%rdx), %rax
incq %rcx
jmp 0x11c5b
xorl %eax, %eax
cmpq %r13, %rax
je 0x11cca
movq (%r12,%rax,8), %rcx
movq 0x8(%rcx), %rdx
movq 0x30(%rcx), %rsi
imulq $0x18, 0x38(%rcx), %rdi
testq %rdi, %rdi
je 0x11cc5
movslq 0x8(%rsi), %r8
movq (%r12,%r8,8), %r8
movq 0x8(%r8), %r8
movq (%rsi), %r9
subq %rdx, %r8
subq %r9, %r8
addq 0x10(%rsi), %r8
movslq %r8d, %r10
cmpq %r8, %r10
jne 0x11d40
movq 0x18(%rcx), %r10
movl %r8d, (%r10,%r9)
addq $0x18, %rsi
addq $-0x18, %rdi
jmp 0x11c89
incq %rax
jmp 0x11c73
leaq 0x36b4(%rip), %rsi      # 0x15385
movq %r14, %rdi
callq 0x33c0
testq %rax, %rax
je 0x11d2a
movq %rax, %r14
movq 0x8(%rbx), %r12
movq 0x10(%rbx), %r13
movb $0x1, %bl
xorl %ebp, %ebp
pushq $0x1
popq %r15
testb $0x1, %bl
je 0x11d20
cmpq %r13, %rbp
jae 0x11d20
movq (%r12,%rbp,8), %rax
movq 0x18(%rax), %rdi
movq 0x20(%rax), %rbx
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x3650
cmpq %rax, %rbx
sete %bl
incq %rbp
jmp 0x11cf1
movq %r14, %rdi
callq 0x3340
jmp 0x11d2c
xorl %ebx, %ebx
andb $0x1, %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3641(%rip), %rdi      # 0x15388
xorl %eax, %eax
callq 0x56cd
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/BinaryWriter.cpp
// Function: t2::BinaryWriterAddSegment(t2::BinaryWriter*)
BinarySegment* BinaryWriterAddSegment(BinaryWriter* self)
{
  BinarySegment* seg = (BinarySegment*) HeapAllocate(self->m_Heap, sizeof(BinarySegment));
  BinarySegmentInit(seg, (int) self->m_Segments.m_Size, self->m_Heap);
  BufferAppendOne(&self->m_Segments, self->m_Heap, seg);
  return seg;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
pushq $0x48
popq %rsi
callq 0xd79a
movq %rax, %r14
movl 0x10(%rbx), %eax
movq (%rbx), %r15
movl %eax, (%r14)
orq $-0x1, 0x8(%r14)
leaq 0x8(%rbx), %r12
movq %r15, 0x10(%r14)
leaq 0x18(%r14), %rdi
movl $0x20000, %edx          # imm = 0x20000
movq %r15, %rsi
callq 0x11f0e
leaq 0x30(%r14), %rdi
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rsi
callq 0x11f37
movq (%rbx), %rsi
movq %r12, %rdi
movq %r14, %rdx
callq 0x11eb5
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq