// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]tundra/src/BuildQueue.cpp
// Function: t2::BuildQueueDestroy(t2::BuildQueue*)
void BuildQueueDestroy(BuildQueue* queue)
  {
    ProfilerScope prof_scope("Tundra BuildQueueDestroy", 0);
    Log(kDebug, "destroying build queue");
    const BuildQueueConfig* config = &queue->m_Config;

    MutexLock(&queue->m_Lock);
    queue->m_QuitSignalled = true;
    MutexUnlock(&queue->m_Lock);

    CondBroadcast(&queue->m_WorkAvailable);

    for (int i = 0, thread_count = config->m_ThreadCount; i < thread_count; ++i)
    {
      if (i > 0)
      {
        Log(kDebug, "joining with build thread %d", i);
        ThreadJoin(queue->m_Threads[i]);
      }

      ThreadStateDestroy(&queue->m_ThreadState[i]);
    }

    // Deallocate storage.
    MemAllocHeap* heap = queue->m_Config.m_Heap;
    HeapFree(heap, queue->m_ExpensiveWaitList);
    HeapFree(heap, queue->m_Queue);

    CondDestroy(&queue->m_WorkAvailable);
    MutexDestroy(&queue->m_Lock);

    HeapFree(config->m_Heap, queue->m_ThreadState);
    HeapFree(config->m_Heap, queue->m_Threads);

    // Unblock all signals on the main thread.
    SignalHandlerSetCondition(nullptr);
    SignalBlockThread(false);
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x1f041(%rip), %rsi     # 0x239d4
leaq -0xc(%rbp), %rdi
xorl %edx, %edx
movl %edx, -0x3c(%rbp)
callq 0x67e0
movl -0x3c(%rbp), %eax
leaq 0x1f042(%rip), %rsi     # 0x239ed
movl $0x8, %edi
callq 0x7a60
jmp 0x49b7
movq -0x8(%rbp), %rax
addq $0x70, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x69b0
jmp 0x49ce
movq -0x8(%rbp), %rax
movb $0x1, 0x118(%rax)
movq -0x8(%rbp), %rdi
callq 0x69f0
jmp 0x49e4
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0x6a30
jmp 0x49f3
movl $0x0, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x4a95
cmpl $0x0, -0x2c(%rbp)
jle 0x4a64
movl -0x2c(%rbp), %edx
leaq 0x1efe4(%rip), %rsi     # 0x23a04
xorl %eax, %eax
movl $0x8, %edi
callq 0x7a60
jmp 0x4a2e
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1eb80
jmp 0x4a48
jmp 0x4a64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xc(%rbp), %rdi
callq 0x6980
jmp 0x4b3b
movq -0x8(%rbp), %rax
movq 0x100(%rax), %rdi
movslq -0x2c(%rbp), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x4b50
jmp 0x4a85
jmp 0x4a87
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4a04
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rsi
callq 0x18960
jmp 0x4ab7
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rsi
callq 0x18960
jmp 0x4aca
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0x6a70
jmp 0x4ad9
movq -0x8(%rbp), %rdi
callq 0x6ab0
jmp 0x4ae4
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x100(%rax), %rsi
callq 0x18960
jmp 0x4afe
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rsi
callq 0x18960
jmp 0x4b18
xorl %eax, %eax
movl %eax, %edi
callq 0x1db50
jmp 0x4b23
xorl %edi, %edi
callq 0x1db90
jmp 0x4b2c
leaq -0xc(%rbp), %rdi
callq 0x6980
addq $0x40, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x35c0
nopw %cs:(%rax,%rax)