// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq 0x48(%rdi), %r14
movq %r14, %rdi
callq 0x34b0
testl %eax, %eax
jne 0x53a8
movl 0x40(%r12), %ebx
callq 0x11a74
testq %rax, %rax
je 0x4924
movq %r14, %rdi
callq 0x3250
testl %eax, %eax
jne 0x537a
movl 0x40(%r12), %edx
leaq 0x11205(%rip), %rsi     # 0x15b0b
movl $0x10, %edi
xorl %eax, %eax
callq 0x5ef0
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x28(%r14), %rax
movq %rax, 0x30(%rsp)
leaq 0x8(%r12), %rax
movq %rax, 0x90(%rsp)
leaq 0x10fdf(%rip), %rbp     # 0x15920
leaq 0xd0(%rsp), %r15
movq %r14, 0x10(%rsp)
movq %r12, 0x58(%rsp)
cmpl $0x0, 0xec(%r14)
jle 0x4964
testb $0x4, 0x70(%r14)
je 0x48ea
cmpb $0x0, 0x118(%r14)
jne 0x48ea
testl %ebx, %ebx
jne 0x4984
cmpl $0x0, 0xe8(%r14)
jle 0x48ea
movl 0x60(%r14), %eax
movl 0x64(%r14), %ecx
decl %eax
movl 0x68(%r14), %edx
subl %ecx, %edx
testl %eax, %edx
je 0x49c6
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), %r13
movl (%rsi,%rdx), %eax
andl $-0x4, %eax
orl $0x2, %eax
movw %ax, (%rsi,%rdx)
jmp 0x49c9
xorl %r13d, %r13d
testq %r13, %r13
je 0x51f1
movl 0x40(%r12), %edx
movl 0x4(%r13), %ecx
movq 0x8(%r13), %rax
movslq 0x8(%rax), %rsi
testq %rsi, %rsi
leaq 0x8(%rsi,%rax), %r8
cmoveq %rsi, %r8
movl $0x10, %edi
leaq 0x11129(%rip), %rsi     # 0x15b24
xorl %eax, %eax
callq 0x5ef0
leaq 0x30(%r13), %rax
movq %rax, 0x48(%rsp)
movq %r13, 0x18(%rsp)
movl 0x4(%r13), %eax
cmpl $0x63, %eax
jg 0x4b17
cmpl $0x3, %eax
ja 0x539a
movl %eax, %eax
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
movq 0x8(%r13), %rcx
movslq 0x14(%rcx), %rdx
testq %rdx, %rdx
leaq 0x14(%rdx,%rcx), %rax
cmoveq %rdx, %rax
movslq 0x10(%rcx), %rcx
testq %rcx, %rcx
je 0x4c8b
movq 0xa0(%r14), %rdx
shlq $0x2, %rcx
xorl %edi, %edi
xorl %r8d, %r8d
xorl %esi, %esi
movslq (%rax,%rdi), %r9
movslq (%rdx,%r9,4), %r9
cmpq $-0x1, %r9
je 0x4a80
shlq $0x6, %r9
addq 0x90(%r14), %r9
jmp 0x4a83
xorl %r9d, %r9d
movl 0x4(%r9), %r11d
cmpl $0xc8, %r11d
je 0x4afb
incl %r8d
movzwl (%r9), %r10d
testb $0x3, %r10b
setne %bl
cmpl $0x1, %r11d
sete %r11b
orb %bl, %r11b
jne 0x4afb
movl 0x68(%r14), %r11d
movl 0x60(%r14), %ebx
decl %ebx
movq 0x10(%rsp), %r14
movq 0x58(%r14), %r14
movq %r9, %r15
movq 0x10(%rsp), %r13
subq 0x90(%r13), %r15
movq 0x18(%rsp), %r13
shrq $0x6, %r15
movl %r15d, (%r14,%r11,4)
leaq 0xd0(%rsp), %r15
movq 0x10(%rsp), %r14
incl %r11d
andl %ebx, %r11d
movl %r11d, 0x68(%r14)
orl $0x1, %r10d
movw %r10w, (%r9)
incl %esi
addq $0x4, %rdi
cmpq %rdi, %rcx
jne 0x4a65
xorl %ebx, %ebx
testl %r8d, %r8d
setle %bl
incl %ebx
jmp 0x4c92
leal -0x64(%rax), %ecx
cmpl $0x2, %ecx
jae 0x4b29
movl $0x0, 0x1c(%r13)
jmp 0x4b53
cmpl $0x66, %eax
jne 0x520b
incl 0xec(%r14)
movq 0x30(%rsp), %rdi
callq 0x3110
testl %eax, %eax
jne 0x5383
movl $0x1, 0x1c(%r13)
movl $0xc8, %ebx
jmp 0x512a
movq %r14, %rdi
callq 0x3250
testl %eax, %eax
jne 0x537a
movq 0xb0(%r14), %rax
movq %rax, 0x40(%rsp)
movq 0xb8(%r14), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%r13), %rbx
movq 0xd0(%r14), %r13
testq %r13, %r13
je 0x4cb0
movq 0xd8(%r14), %rdi
callq 0x34b0
testl %eax, %eax
jne 0x53a8
movslq 0x8(%rbx), %rax
testq %rax, %rax
leaq 0x8(%rax,%rbx), %rdx
cmoveq %rax, %rdx
movq %r13, %rdi
leaq 0x10faf(%rip), %rsi     # 0x15b76
xorl %eax, %eax
callq 0x3480
movq %r15, %rdi
movq %r13, %rsi
callq 0xe2bc
jmp 0x4cb8
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x53ff
movl %eax, 0x4(%r13)
cmpl $0x3, %eax
je 0x5362
movq 0x8(%r13), %rax
testb $0x4, 0x44(%rax)
je 0x4a10
decl 0x108(%r14)
movl 0x10c(%r14), %eax
testl %eax, %eax
jle 0x4a10
movq 0x110(%r14), %rcx
decl %eax
movl %eax, 0x10c(%r14)
movq (%rcx,%rax,8), %rax
movzwl (%rax), %ecx
andl $-0x4, %ecx
movw %cx, (%rax)
movl 0x68(%r14), %edx
movl 0x60(%r14), %esi
decl %esi
movq %rax, %rdi
subq 0x90(%r14), %rdi
movq 0x58(%r14), %r8
shrq $0x6, %rdi
movl %edi, (%r8,%rdx,4)
incl %edx
andl %esi, %edx
movl %edx, 0x68(%r14)
incl %ecx
movw %cx, (%rax)
movq 0x30(%rsp), %rdi
callq 0x3040
testl %eax, %eax
je 0x4a10
jmp 0x53bf
movl $0x2, %ebx
jmp 0x512a
xorl %esi, %esi
movl $0x2, %ebx
testl %esi, %esi
jle 0x4c9e
movq %r14, %rdi
callq 0x5a09
movl %ebx, 0x4(%r13)
cmpl $0x1, %ebx
jne 0x4a10
jmp 0x533f
movq %r15, %rdi
callq 0xe17e
movq %r13, 0x88(%rsp)
movslq (%rbx), %rax
leaq (%rax,%rbx), %rbp
testq %rax, %rax
cmoveq %rax, %rbp
movq %rbp, %rdi
callq 0x3150
movq %r15, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xe068
movq %r15, %rdi
callq 0xe2a7
leaq 0x4(%rbx), %rbp
movslq 0x4(%rbx), %rax
testq %rax, %rax
sete %cl
addq %rax, %rbp
sete %al
orb %cl, %al
jne 0x4d22
movq %rbp, %rdi
callq 0x3150
movq %r15, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xe068
movq %r15, %rdi
callq 0xe2a7
movslq 0x40(%rbx), %rax
testq %rax, %rax
leaq 0x40(%rax,%rbx), %rcx
cmoveq %rax, %rcx
movq %rcx, 0x28(%rsp)
movq 0x20(%r12), %rax
movq %rax, 0x50(%rsp)
movslq 0x24(%rbx), %rax
testq %rax, %rax
leaq 0x24(%rax,%rbx), %r13
cmoveq %rax, %r13
movq %rbx, 0x20(%rsp)
movslq 0x20(%rbx), %rax
testq %rax, %rax
je 0x4ed2
leaq (,%rax,8), %rax
addq %r13, %rax
movq %rax, 0x98(%rsp)
movslq (%r13), %rax
leaq (%rax,%r13), %rbp
testq %rax, %rax
cmoveq %rax, %rbp
movq %rbp, %rdi
callq 0x3150
movq %r15, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xe068
movslq (%r13), %rax
leaq (%rax,%r13), %rcx
testq %rax, %rax
cmoveq %rax, %rcx
movl 0x4(%r13), %r8d
movq 0xc8(%r14), %r9
movl 0xc0(%r14), %eax
movl %eax, (%rsp)
movq %r15, %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x1349c
cmpq $0x0, 0x28(%rsp)
je 0x4ec0
movq 0x28(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x68(%rsp)
movq %r12, 0x70(%rsp)
movslq (%r13), %rax
leaq (%rax,%r13), %rcx
testq %rax, %rax
cmoveq %rax, %rcx
movq %rcx, 0x78(%rsp)
movq 0xa8(%r14), %rax
movq %rax, 0x80(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x112b0
testb %al, %al
je 0x4eae
movslq 0xa0(%rsp), %r15
testq %r15, %r15
jle 0x4eae
shlq $0x4, %r15
xorl %r14d, %r14d
movq 0xa8(%rsp), %r12
movq (%r12,%r14), %rbp
movq %rbp, %rdi
callq 0x3150
leaq 0xd0(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xe068
movq (%r12,%r14), %rcx
movl 0x8(%r12,%r14), %r8d
movq 0x10(%rsp), %rax
movq 0xc8(%rax), %r9
movl 0xc0(%rax), %eax
movl %eax, (%rsp)
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x1349c
addq $0x10, %r14
cmpq %r14, %r15
jne 0x4e4b
movq 0x58(%rsp), %r12
movq 0x10(%rsp), %r14
leaq 0xd0(%rsp), %r15
addq $0x8, %r13
cmpq 0x98(%rsp), %r13
jne 0x4d76
movq %r15, %rdi
movq 0x48(%rsp), %rsi
callq 0xe195
movq 0x88(%rsp), %r13
testq %r13, %r13
leaq 0x10a2f(%rip), %rbp     # 0x15920
movq 0x18(%rsp), %r15
je 0x4f32
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0xe2cf
movq %r13, %rdi
leaq 0x10c74(%rip), %rsi     # 0x15b88
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3480
movq 0xd8(%r14), %rdi
callq 0x3250
testl %eax, %eax
jne 0x53b1
movq 0x10(%r15), %rsi
leaq 0x10c54(%rip), %r8      # 0x15b91
testq %rsi, %rsi
je 0x50d5
movq 0x4(%rsi), %rax
movq 0x18(%rsp), %r13
cmpq 0x30(%r13), %rax
jne 0x504a
movq 0x38(%r13), %rax
cmpq %rax, 0xc(%rsi)
jne 0x504a
cmpl $0x0, (%rsi)
leaq 0x10c78(%rip), %r8      # 0x15be9
jne 0x50d5
movq 0x20(%rsp), %rax
movslq 0x28(%rax), %rbx
leaq 0x10c8c(%rip), %r8      # 0x15c13
cmpl 0x14(%rsi), %ebx
jne 0x50d5
testl %ebx, %ebx
setg %al
jle 0x50ca
movq 0x20(%rsp), %rcx
movslq 0x2c(%rcx), %rax
testq %rax, %rax
leaq 0x2c(%rax,%rcx), %r15
cmoveq %rax, %r15
movslq 0x18(%rsi), %rax
testq %rax, %rax
leaq 0x18(%rax,%rsi), %r13
cmoveq %rax, %r13
movslq (%r15), %rax
leaq (%r15,%rax), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
movslq (%r13), %rax
leaq (%rax,%r13), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
callq 0x3470
leaq 0x10c2a(%rip), %r8      # 0x15c13
testl %eax, %eax
jne 0x50d5
leaq 0x4(%r13), %r14
leaq 0x8(%r15), %rbp
movq %rbx, 0x28(%rsp)
leaq -0x1(%rbx), %rax
movq %rax, 0x38(%rsp)
xorl %ebx, %ebx
cmpq %rbx, 0x38(%rsp)
je 0x50ab
movslq 0x8(%r15,%rbx,8), %rax
leaq (%rax,%rbp), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
movslq 0x4(%r13,%rbx,4), %rax
leaq (%r14,%rax), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
callq 0x3470
addq $0x4, %r14
addq $0x8, %rbp
incq %rbx
testl %eax, %eax
je 0x5009
jmp 0x50b0
addq $0x4, %rsi
leaq 0x60(%rsp), %rdi
callq 0xe2cf
leaq 0xa0(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0xe2cf
movl 0x40(%r12), %edx
movq 0x20(%rsp), %rcx
movslq 0x8(%rcx), %rax
testq %rax, %rax
leaq 0x8(%rax,%rcx), %rcx
cmoveq %rax, %rcx
movl $0x10, %edi
leaq 0x10b1e(%rip), %rsi     # 0x15bae
leaq 0x60(%rsp), %r8
leaq 0xa0(%rsp), %r9
xorl %eax, %eax
callq 0x5ef0
movl $0x3, %ebx
jmp 0x5108
movq 0x28(%rsp), %rbx
movq 0x28(%rsp), %rax
cmpq %rax, %rbx
movq %rax, %rbx
setb %al
movq 0x10(%rsp), %r14
leaq 0x10856(%rip), %rbp     # 0x15920
leaq 0x10b42(%rip), %r8      # 0x15c13
testb %al, %al
je 0x5133
movl 0x40(%r12), %edx
movq 0x20(%rsp), %rcx
movslq 0x8(%rcx), %rax
testq %rax, %rax
leaq 0x8(%rax,%rcx), %rcx
cmoveq %rax, %rcx
movq 0x18(%rsp), %r13
movl $0x3, %ebx
movl $0x10, %edi
movq %r8, %rsi
xorl %eax, %eax
callq 0x5ef0
movq %r14, %rdi
callq 0x34b0
testl %eax, %eax
jne 0x538c
movq 0x50(%rsp), %rax
movq %rax, 0x20(%r12)
leaq 0xd0(%rsp), %r15
movl %ebx, 0x4(%r13)
jmp 0x4a10
movq 0x20(%rsp), %r13
movslq 0x2c(%r13), %rax
testq %rax, %rax
leaq 0x2c(%rax,%r13), %r15
cmoveq %rax, %r15
testl %ebx, %ebx
setne %bpl
je 0x5190
leaq (%r15,%rbx,8), %rbx
movq %r15, %r14
movslq (%r15), %rax
leaq (%r14,%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movl 0x4(%r15), %ecx
leaq 0x60(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x11dc4
testb $0x1, 0x60(%rsp)
je 0x5190
addq $0x8, %r15
addq $0x8, %r14
cmpq %rbx, %r15
setne %bpl
jne 0x5157
movl 0x40(%r12), %edx
movslq 0x8(%r13), %rax
testq %rax, %rax
leaq 0x8(%rax,%r13), %rcx
cmoveq %rax, %rcx
testb $0x1, %bpl
je 0x51c3
leaq 0x10a8f(%rip), %r8      # 0x15c41
movq 0x10(%rsp), %r14
leaq 0x10762(%rip), %rbp     # 0x15920
jmp 0x50ef
movl $0x65, %ebx
movl $0x10, %edi
leaq 0x10a9a(%rip), %rsi     # 0x15c6e
xorl %eax, %eax
callq 0x5ef0
movq 0x10(%rsp), %r14
leaq 0x10739(%rip), %rbp     # 0x15920
movq 0x18(%rsp), %r13
jmp 0x5108
movq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x3520
testl %eax, %eax
je 0x5362
jmp 0x53cd
cmpl $0xc8, %eax
jne 0x539a
decl 0xe8(%r14)
movq 0x8(%r13), %rcx
movslq 0x1c(%rcx), %rdx
testq %rdx, %rdx
leaq 0x1c(%rdx,%rcx), %rax
cmoveq %rdx, %rax
movslq 0x18(%rcx), %rcx
testq %rcx, %rcx
je 0x5346
leaq (%rax,%rcx,4), %rcx
movq 0xa0(%r14), %rdx
xorl %esi, %esi
movslq (%rax), %rdi
movslq (%rdx,%rdi,4), %rdi
cmpq $-0x1, %rdi
je 0x5265
shlq $0x6, %rdi
addq 0x90(%r14), %rdi
jmp 0x5267
xorl %edi, %edi
testq %rdi, %rdi
je 0x5330
movq 0x8(%rdi), %r9
movl 0xc(%r9), %r8d
cmpl 0xf0(%r14), %r8d
jne 0x5330
movslq 0x14(%r9), %r10
testq %r10, %r10
leaq 0x14(%r10,%r9), %r8
cmoveq %r10, %r8
movslq 0x10(%r9), %r9
testq %r9, %r9
sete %bl
je 0x52ed
movq 0x90(%r14), %r10
movslq (%r8), %r11
movslq (%rdx,%r11,4), %r11
shlq $0x6, %r11
cmpl $0xc8, 0x4(%r10,%r11)
jne 0x5330
shlq $0x2, %r9
movl $0x4, %r11d
cmpq %r11, %r9
sete %bl
je 0x52ed
movslq (%r8,%r11), %rbx
movslq (%rdx,%rbx,4), %rbx
shlq $0x6, %rbx
addq $0x4, %r11
cmpl $0xc8, 0x4(%r10,%rbx)
je 0x52c8
jmp 0x5330
testb %bl, %bl
je 0x5330
movzwl (%rdi), %r8d
testb $0x3, %r8b
jne 0x5330
movl 0x68(%r14), %r9d
movl 0x60(%r14), %r10d
decl %r10d
movq 0x58(%r14), %r11
movq %rdi, %rbx
subq 0x90(%r14), %rbx
shrq $0x6, %rbx
movl %ebx, (%r11,%r9,4)
incl %r9d
andl %r10d, %r9d
movl %r9d, 0x68(%r14)
orl $0x1, %r8d
movw %r8w, (%rdi)
incl %esi
addq $0x4, %rax
cmpq %rcx, %rax
jne 0x524b
jmp 0x5348
andb $-0x3, (%r13)
jmp 0x5362
xorl %esi, %esi
testl %esi, %esi
jle 0x5354
movq %r14, %rdi
callq 0x5a09
movq 0x30(%rsp), %rdi
callq 0x3110
testl %eax, %eax
jne 0x5383
movl 0x40(%r12), %ebx
callq 0x11a74
testq %rax, %rax
je 0x4953
jmp 0x48ea
leaq 0x1070f(%rip), %rdi     # 0x15a90
jmp 0x53c6
leaq 0x10724(%rip), %rdi     # 0x15aae
jmp 0x53c6
leaq 0x106e1(%rip), %rdi     # 0x15a74
xorl %eax, %eax
callq 0x5c85
leaq 0x1079c(%rip), %rdi     # 0x15b3d
xorl %eax, %eax
callq 0x5bdd
leaq 0x106c5(%rip), %rdi     # 0x15a74
jmp 0x53c6
leaq 0x106d8(%rip), %rdi     # 0x15a90
xorl %eax, %eax
callq 0x5c85
leaq 0x10793(%rip), %rdi     # 0x15b59
xorl %eax, %eax
callq 0x5c85
leaq 0x109c1(%rip), %rdi     # 0x15d95
jmp 0x53c6
jmp 0x53ed
jmp 0x53ed
jmp 0x53ed
jmp 0x53ed
jmp 0x53ed
jmp 0x53ed
jmp 0x53ed
jmp 0x53ed
jmp 0x53ed
movq 0x58(%rsp), %r12
movq 0x50(%rsp), %rcx
movq %rcx, 0x20(%r12)
movq %rax, %rdi
callq 0x35e0