// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/BuildQueue.cpp
// Function: t2::BuildLoop(t2::ThreadState*)
static void BuildLoop(ThreadState* thread_state)
  {
    BuildQueue        *queue = thread_state->m_Queue;
    ConditionVariable *cv    = &queue->m_WorkAvailable;
    Mutex             *mutex = &queue->m_Lock;

    MutexLock(mutex);

    while (ShouldKeepBuilding(queue, thread_state->m_ThreadIndex))
    {
      if (NodeState* node = NextNode(queue))
      {
        AdvanceNode(queue, thread_state, node, mutex);
      }
      else
      {
        CondWait(cv, mutex);
      }
    }

    MutexUnlock(mutex);

    Log(kSpam, "build thread %d exiting\n", thread_state->m_ThreadIndex);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rdi, %rbx
movq 0x48(%rdi), %r14
leaq 0x28(%r14), %rax
movq %rax, 0x28(%rsp)
movq %r14, %rdi
callq 0x549a
movq %rbx, 0x10(%rsp)
leaq 0x8(%rbx), %rax
movq %rax, 0x88(%rsp)
leaq 0xd0(%rsp), %r13
movq %r14, 0x38(%rsp)
movq 0x10(%rsp), %rax
movl 0x40(%rax), %ebx
callq 0xff70
testq %rax, %rax
jne 0x4cfb
cmpl $0x0, 0xec(%r14)
jle 0x4506
testb $0x4, 0x70(%r14)
je 0x4cfb
cmpb $0x0, 0x118(%r14)
jne 0x4cfb
testl %ebx, %ebx
jne 0x4526
cmpl $0x0, 0xe8(%r14)
jle 0x4cfb
movl 0x60(%r14), %eax
movl 0x64(%r14), %ecx
decl %eax
movl 0x68(%r14), %edx
subl %ecx, %edx
testl %eax, %edx
je 0x4bfe
movq 0x58(%r14), %rdx
movq 0x90(%r14), %rsi
movslq (%rdx,%rcx,4), %rdx
incl %ecx
andl %eax, %ecx
movl %ecx, 0x64(%r14)
shlq $0x6, %rdx
leaq (%rsi,%rdx), %r15
addq %rdx, %rsi
addq $0x30, %rsi
movl -0x30(%rsi), %eax
movl -0x2c(%rsi), %ecx
andl $-0x4, %eax
orl $0x2, %eax
movw %ax, -0x30(%rsi)
movq 0x10(%rsp), %rax
movl 0x40(%rax), %edx
movq %rsi, 0x30(%rsp)
movq -0x28(%rsi), %rax
movslq 0x8(%rax), %rsi
testq %rsi, %rsi
leaq 0x8(%rsi,%rax), %r8
cmoveq %rsi, %r8
pushq $0x10
popq %rdi
leaq 0xf585(%rip), %rsi      # 0x13b24
xorl %eax, %eax
callq 0x5981
movq %r15, 0x48(%rsp)
movl 0x4(%r15), %eax
cmpq $0x3, %rax
ja 0x4643
leaq 0xf360(%rip), %rcx      # 0x13920
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%r15), %rax
movslq 0x14(%rax), %rcx
testq %rcx, %rcx
leaq 0x14(%rcx,%rax), %r15
cmoveq %rcx, %r15
movslq 0x10(%rax), %r12
shlq $0x2, %r12
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %ebx, %ebx
cmpq %rbp, %r12
je 0x4780
movslq (%r15,%rbp), %rax
movq 0xa0(%r14), %rcx
movslq (%rcx,%rax,4), %rsi
cmpq $-0x1, %rsi
je 0x4617
shlq $0x6, %rsi
addq 0x90(%r14), %rsi
jmp 0x4619
xorl %esi, %esi
movl 0x4(%rsi), %eax
cmpl $0xc8, %eax
je 0x463d
incl %ebx
cmpl $0x1, %eax
je 0x463d
movzwl (%rsi), %eax
andl $0x3, %eax
jne 0x463d
movq %r14, %rdi
callq 0x52fb
incl %r13d
addq $0x4, %rbp
jmp 0x45ec
leal -0x64(%rax), %ecx
cmpl $0x2, %ecx
jae 0x465d
andl $0x0, 0x1c(%r15)
movl $0xc8, 0x4(%r15)
jmp 0x45ab
cmpl $0x66, %eax
jne 0x4c10
incl 0xec(%r14)
movq 0x28(%rsp), %rdi
callq 0x54ce
movl $0x1, 0x1c(%r15)
movl $0xc8, 0x4(%r15)
jmp 0x45ab
movq %r14, %rdi
callq 0x54b4
movq 0xb0(%r14), %rax
movq %rax, 0x40(%rsp)
movq 0xb8(%r14), %r12
movq 0x8(%r15), %rbx
movq 0xd0(%r14), %r15
testq %r15, %r15
movq %r15, 0x80(%rsp)
je 0x47b7
movq 0xd8(%r14), %rdi
callq 0x549a
movslq 0x8(%rbx), %rax
testq %rax, %rax
leaq 0x8(%rax,%rbx), %rdx
cmoveq %rax, %rdx
movq %r15, %rdi
leaq 0xf48d(%rip), %rsi      # 0x13b76
xorl %eax, %eax
callq 0x3480
movq %r13, %rdi
movq %r15, %rsi
callq 0xce1e
jmp 0x47bf
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x4d60
movl %eax, 0x4(%r15)
cmpl $0x3, %eax
je 0x44db
movq 0x8(%r15), %rax
testb $0x4, 0x44(%rax)
je 0x45ab
decl 0x108(%r14)
movl 0x10c(%r14), %eax
testl %eax, %eax
jle 0x45ab
movq 0x110(%r14), %rcx
decl %eax
movl %eax, 0x10c(%r14)
movq (%rcx,%rax,8), %rsi
andw $-0x4, (%rsi)
movq %r14, %rdi
callq 0x52fb
movq 0x28(%rsp), %rdi
callq 0x5563
jmp 0x45ab
movl $0x2, 0x4(%r15)
jmp 0x45ab
testl %r13d, %r13d
jle 0x4790
movq %r14, %rdi
movl %r13d, %esi
callq 0x5324
xorl %eax, %eax
testl %ebx, %ebx
setle %al
incl %eax
movq 0x48(%rsp), %r15
movl %eax, 0x4(%r15)
testl %ebx, %ebx
leaq 0xd0(%rsp), %r13
jle 0x45ab
jmp 0x4cf2
movq %r13, %rdi
callq 0xcd00
movslq (%rbx), %rax
leaq (%rax,%rbx), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movq %r13, %rdi
callq 0x557d
movq %r13, %rdi
callq 0xce0b
leaq 0x4(%rbx), %rsi
movslq 0x4(%rbx), %rax
testq %rax, %rax
sete %cl
addq %rax, %rsi
sete %al
orb %cl, %al
jne 0x4805
movq %r13, %rdi
callq 0x557d
movq %r13, %rdi
callq 0xce0b
movslq 0x40(%rbx), %rax
testq %rax, %rax
leaq 0x40(%rax,%rbx), %rcx
cmoveq %rax, %rcx
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x18(%rsp)
movslq 0x24(%rbx), %rax
testq %rax, %rax
leaq 0x24(%rax,%rbx), %r15
cmoveq %rax, %r15
movq %rbx, 0x20(%rsp)
movslq 0x20(%rbx), %rax
movq %rcx, %rbx
leaq (%r15,%rax,8), %rax
movq %rax, 0x98(%rsp)
movq %rcx, 0x90(%rsp)
cmpq 0x98(%rsp), %r15
je 0x4994
movslq (%r15), %rax
leaq (%rax,%r15), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movq %r13, %rdi
callq 0x557d
movslq (%r15), %rax
leaq (%rax,%r15), %rcx
testq %rax, %rax
cmoveq %rax, %rcx
movl 0x4(%r15), %r8d
movq 0xc8(%r14), %r9
movl 0xc0(%r14), %eax
movl %eax, (%rsp)
movq %r13, %rdi
movq 0x40(%rsp), %rsi
movq %r12, %rdx
callq 0x114f4
testq %rbx, %rbx
je 0x498b
movq %rbx, 0x50(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x60(%rsp)
movslq (%r15), %rax
leaq (%rax,%r15), %rcx
testq %rax, %rax
cmoveq %rax, %rcx
movq %rcx, 0x68(%rsp)
movq 0xa8(%r14), %rax
movq %rax, 0x70(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0xf910
testb %al, %al
je 0x4976
movl 0xa0(%rsp), %ebx
testl %ebx, %ebx
movl $0x0, %eax
cmovlel %eax, %ebx
shlq $0x4, %rbx
xorl %r13d, %r13d
cmpq %r13, %rbx
je 0x4976
movq 0xa8(%rsp), %r14
movq (%r14,%r13), %rsi
leaq 0xd0(%rsp), %rbp
movq %rbp, %rdi
callq 0x557d
movq (%r14,%r13), %rcx
movl 0x8(%r14,%r13), %r8d
movq 0x38(%rsp), %rax
movq 0xc8(%rax), %r9
movl 0xc0(%rax), %eax
movl %eax, (%rsp)
movq %rbp, %rdi
movq 0x40(%rsp), %rsi
movq %r12, %rdx
callq 0x114f4
addq $0x10, %r13
jmp 0x4921
movq 0x38(%rsp), %r14
leaq 0xd0(%rsp), %r13
movq 0x90(%rsp), %rbx
addq $0x8, %r15
jmp 0x4853
movq %r13, %rdi
movq 0x30(%rsp), %rsi
callq 0xcd14
movq 0x80(%rsp), %r12
testq %r12, %r12
movq 0x48(%rsp), %r15
je 0x49e5
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0xce31
movq %r12, %rdi
leaq 0xf1b9(%rip), %rsi      # 0x13b88
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3480
movq 0xd8(%r14), %rdi
callq 0x54b4
movq 0x10(%r15), %r15
leaq 0xf1a1(%rip), %rsi      # 0x13b91
testq %r15, %r15
je 0x4b82
leaq 0x4(%r15), %r12
movq %r12, %rdi
movq 0x30(%rsp), %rsi
callq 0x55a4
testb %al, %al
je 0x4a70
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0xce31
leaq 0xa0(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0xce31
movq 0x10(%rsp), %rax
movl 0x40(%rax), %edx
movq 0x20(%rsp), %rcx
movslq 0x8(%rcx), %rax
testq %rax, %rax
leaq 0x8(%rax,%rcx), %rcx
cmoveq %rax, %rcx
pushq $0x10
popq %rdi
leaq 0xf15a(%rip), %rsi      # 0x13bae
leaq 0x50(%rsp), %r8
leaq 0xa0(%rsp), %r9
xorl %eax, %eax
callq 0x5981
pushq $0x3
popq %rbx
jmp 0x4bac
cmpl $0x0, (%r15)
leaq 0xf16e(%rip), %rsi      # 0x13be9
jne 0x4b82
movq 0x20(%rsp), %rax
movslq 0x28(%rax), %rbp
leaq 0xf182(%rip), %rsi      # 0x13c13
cmpl 0x14(%r15), %ebp
jne 0x4b82
addq $0x18, %r15
testl %ebp, %ebp
movl $0x0, %r14d
cmovgl %ebp, %r14d
movq 0x20(%rsp), %rcx
movslq 0x2c(%rcx), %rax
testq %rax, %rax
leaq 0x2c(%rax,%rcx), %r12
cmoveq %rax, %r12
shlq $0x2, %r14
movq %r12, %r13
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0x4b23
movslq (%r12,%rbx,2), %rax
leaq (%rax,%r13), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
movslq (%r15), %rax
leaq (%rax,%r15), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movslq (%rsi,%rbx), %rax
addq %rbx, %rsi
addq %rax, %rsi
testq %rax, %rax
cmoveq %rax, %rsi
callq 0x3470
addq $0x4, %rbx
addq $0x8, %r13
testl %eax, %eax
je 0x4ac9
leaq 0xf0ff(%rip), %rsi      # 0x13c13
movq 0x38(%rsp), %r14
leaq 0xd0(%rsp), %r13
jmp 0x4b82
shlq $0x3, %rbp
movq %r12, %rbx
movq 0x38(%rsp), %r14
leaq 0xd0(%rsp), %r13
movq 0x20(%rsp), %r15
testq %rbp, %rbp
je 0x4bd0
movslq (%r12), %rax
leaq (%rbx,%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movl 0x4(%r12), %ecx
leaq 0x50(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x101cf
addq $0x8, %r12
addq $0x8, %rbx
addq $-0x8, %rbp
testb $0x1, 0x50(%rsp)
jne 0x4b3c
leaq 0xf0bf(%rip), %rsi      # 0x13c41
movq 0x10(%rsp), %rax
movl 0x40(%rax), %edx
movq 0x20(%rsp), %rcx
movslq 0x8(%rcx), %rax
testq %rax, %rax
leaq 0x8(%rax,%rcx), %rcx
cmoveq %rax, %rcx
pushq $0x10
popq %rdi
xorl %eax, %eax
callq 0x5981
pushq $0x3
popq %rbx
movq %r14, %rdi
callq 0x549a
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, 0x20(%rax)
movq 0x48(%rsp), %r15
movl %ebx, 0x4(%r15)
jmp 0x45ab
movq 0x10(%rsp), %rax
movl 0x40(%rax), %edx
movslq 0x8(%r15), %rax
testq %rax, %rax
leaq 0x8(%rax,%r15), %rcx
cmoveq %rax, %rcx
pushq $0x10
popq %rdi
leaq 0xf07c(%rip), %rsi      # 0x13c6e
xorl %eax, %eax
callq 0x5981
pushq $0x65
popq %rbx
jmp 0x4bac
movq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x5549
jmp 0x44db
cmpl $0xc8, %eax
jne 0x4d2e
decl 0xe8(%r14)
movq 0x8(%r15), %rax
movslq 0x1c(%rax), %rcx
testq %rcx, %rcx
leaq 0x1c(%rcx,%rax), %rbx
cmoveq %rcx, %rbx
movslq 0x18(%rax), %rax
leaq (%rbx,%rax,4), %r15
xorl %ebp, %ebp
cmpq %r15, %rbx
je 0x4cd5
movslq (%rbx), %rcx
movq 0xa0(%r14), %rax
movslq (%rax,%rcx,4), %rsi
cmpq $-0x1, %rsi
je 0x4ccc
movq 0x90(%r14), %rcx
testq %rcx, %rcx
je 0x4ccc
shlq $0x6, %rsi
addq %rcx, %rsi
movq 0x8(%rsi), %rdi
movl 0xc(%rdi), %edx
cmpl 0xf0(%r14), %edx
jne 0x4ccc
movslq 0x14(%rdi), %r8
testq %r8, %r8
leaq 0x14(%r8,%rdi), %rdx
cmoveq %r8, %rdx
movslq 0x10(%rdi), %rdi
shlq $0x2, %rdi
xorl %r8d, %r8d
cmpq %r8, %rdi
je 0x4cbd
movslq (%rdx,%r8), %r9
movslq (%rax,%r9,4), %r9
shlq $0x6, %r9
addq $0x4, %r8
cmpl $0xc8, 0x4(%rcx,%r9)
je 0x4c9b
jmp 0x4ccc
testb $0x3, (%rsi)
jne 0x4ccc
movq %r14, %rdi
callq 0x52fb
incl %ebp
addq $0x4, %rbx
jmp 0x4c40
testl %ebp, %ebp
jle 0x4ce3
movq %r14, %rdi
movl %ebp, %esi
callq 0x5324
movq 0x28(%rsp), %rdi
callq 0x54ce
jmp 0x44db
andb $-0x3, (%r15)
jmp 0x44db
movq %r14, %rdi
callq 0x54b4
movq 0x10(%rsp), %rax
movl 0x40(%rax), %edx
leaq 0xedf9(%rip), %rsi      # 0x13b0b
pushq $0x10
popq %rdi
xorl %eax, %eax
callq 0x5981
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xee08(%rip), %rdi      # 0x13b3d
xorl %eax, %eax
callq 0x56cd
jmp 0x4d4a
jmp 0x4d4a
jmp 0x4d4a
jmp 0x4d4a
jmp 0x4d4a
jmp 0x4d4a
jmp 0x4d4a
movq %rax, %rdi
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x20(%rax)
callq 0x35e0