// File: /workspace/github_c_makefile_star2_O3/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), %r15
movq %r15, %rdi
callq 0x34b0
testl %eax, %eax
jne 0x5262
movl 0x40(%r12), %ebx
callq 0x113a8
testq %rax, %rax
je 0x4874
movq %r15, %rdi
callq 0x3250
testl %eax, %eax
jne 0x5234
movl 0x40(%r12), %edx
leaq 0x1129d(%rip), %rsi     # 0x15af3
movl $0x10, %edi
xorl %eax, %eax
callq 0x5d74
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x28(%r15), %rax
movq %rax, 0x20(%rsp)
leaq 0x8(%r12), %rax
movq %rax, 0x68(%rsp)
leaq 0x1107a(%rip), %r13     # 0x15908
leaq 0xd0(%rsp), %r14
movq %r15, 0x10(%rsp)
movq %r12, 0x60(%rsp)
cmpl $0x0, 0xec(%r15)
jle 0x48b1
testb $0x4, 0x70(%r15)
je 0x483a
cmpb $0x0, 0x118(%r15)
jne 0x483a
testl %ebx, %ebx
jne 0x48d1
cmpl $0x0, 0xe8(%r15)
jle 0x483a
movl 0x60(%r15), %eax
movl 0x64(%r15), %ecx
decl %eax
movl 0x68(%r15), %edx
subl %ecx, %edx
testl %eax, %edx
je 0x50e0
movq 0x58(%r15), %rdx
movq 0x90(%r15), %rsi
movslq (%rdx,%rcx,4), %rdx
incl %ecx
andl %eax, %ecx
movl %ecx, 0x64(%r15)
shlq $0x6, %rdx
leaq (%rsi,%rdx), %rbp
addq %rdx, %rsi
addq $0x30, %rsi
movl -0x30(%rsi), %eax
movl -0x2c(%rsi), %ecx
andl $-0x4, %eax
orl $0x2, %eax
movw %ax, -0x30(%rsi)
movl 0x40(%r12), %edx
movq %rsi, 0x48(%rsp)
movq -0x28(%rsi), %rax
movslq 0x8(%rax), %rsi
testq %rsi, %rsi
leaq 0x8(%rsi,%rax), %r8
cmoveq %rsi, %r8
movl $0x10, %edi
leaq 0x111c3(%rip), %rsi     # 0x15b0c
xorl %eax, %eax
callq 0x5d74
movq %rbp, 0x28(%rsp)
movl 0x4(%rbp), %eax
cmpl $0x63, %eax
jg 0x4a7f
cmpl $0x3, %eax
ja 0x5254
movl $0x2, %ebx
movl %eax, %eax
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x8(%rbp), %rcx
movslq 0x14(%rcx), %rdx
testq %rdx, %rdx
leaq 0x14(%rdx,%rcx), %rax
cmoveq %rdx, %rax
movslq 0x10(%rcx), %rcx
testq %rcx, %rcx
je 0x50d8
movq 0xa0(%r15), %rdx
shlq $0x2, %rcx
xorl %edi, %edi
xorl %ebx, %ebx
xorl %esi, %esi
movslq (%rax,%rdi), %r8
movslq (%rdx,%r8,4), %r8
cmpq $-0x1, %r8
je 0x49c8
shlq $0x6, %r8
addq 0x90(%r15), %r8
jmp 0x49cb
xorl %r8d, %r8d
movl 0x4(%r8), %r10d
cmpl $0xc8, %r10d
je 0x4a32
incl %ebx
movzwl (%r8), %r9d
testb $0x3, %r9b
setne %r11b
cmpl $0x1, %r10d
sete %r10b
orb %r11b, %r10b
jne 0x4a32
movl 0x68(%r15), %r10d
movl 0x60(%r15), %r11d
decl %r11d
movq 0x58(%r15), %r14
movq %r8, %r15
movq 0x10(%rsp), %r13
subq 0x90(%r13), %r15
shrq $0x6, %r15
movl %r15d, (%r14,%r10,4)
movq 0x10(%rsp), %r15
incl %r10d
andl %r11d, %r10d
movl %r10d, 0x68(%r15)
orl $0x1, %r9d
movw %r9w, (%r8)
incl %esi
addq $0x4, %rdi
cmpq %rdi, %rcx
jne 0x49ad
xorl %ebp, %ebp
testl %ebx, %ebx
setle %r14b
testl %esi, %esi
jle 0x4a53
movq %r15, %rdi
callq 0x588e
movb %r14b, %bpl
incl %ebp
movq 0x28(%rsp), %rax
movl %ebp, 0x4(%rax)
movq %rax, %rbp
testl %ebx, %ebx
leaq 0x10e9c(%rip), %r13     # 0x15908
leaq 0xd0(%rsp), %r14
jle 0x4955
jmp 0x5218
leal -0x64(%rax), %ecx
cmpl $0x2, %ecx
jae 0x4a90
movl $0x0, 0x1c(%rbp)
jmp 0x4ab9
cmpl $0x66, %eax
jne 0x50fa
incl 0xec(%r15)
movq 0x20(%rsp), %rdi
callq 0x3110
testl %eax, %eax
jne 0x523d
movl $0x1, 0x1c(%rbp)
movl $0xc8, %ebx
jmp 0x50d8
movq %r15, %rdi
callq 0x3250
testl %eax, %eax
jne 0x5234
movq 0xb0(%r15), %rax
movq %rax, 0x40(%rsp)
movq 0xb8(%r15), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%rbp), %r13
movq 0xd0(%r15), %rax
movq %rax, 0x50(%rsp)
testq %rax, %rax
leaq 0x70(%rsp), %rbx
je 0x4bf1
movq 0xd8(%r15), %rdi
callq 0x34b0
testl %eax, %eax
jne 0x5262
movslq 0x8(%r13), %rax
testq %rax, %rax
leaq 0x8(%rax,%r13), %rdx
cmoveq %rax, %rdx
movq 0x50(%rsp), %rbp
movq %rbp, %rdi
leaq 0x11022(%rip), %rsi     # 0x15b5e
xorl %eax, %eax
callq 0x3480
movq %r14, %rdi
movq %rbp, %rsi
callq 0xdde0
jmp 0x4bf9
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x52b9
movl %eax, 0x4(%rbp)
cmpl $0x3, %eax
je 0x521c
movq 0x8(%rbp), %rax
testb $0x4, 0x44(%rax)
je 0x4955
decl 0x108(%r15)
movl 0x10c(%r15), %eax
testl %eax, %eax
jle 0x4955
movq 0x110(%r15), %rcx
decl %eax
movl %eax, 0x10c(%r15)
movq (%rcx,%rax,8), %rax
movl (%rax), %ecx
andl $-0x4, %ecx
movl 0x68(%r15), %edx
movl 0x60(%r15), %esi
decl %esi
movq %rax, %rdi
subq 0x90(%r15), %rdi
movq 0x58(%r15), %r8
shrq $0x6, %rdi
movl %edi, (%r8,%rdx,4)
incl %edx
andl %esi, %edx
movl %edx, 0x68(%r15)
incl %ecx
movw %cx, (%rax)
movq 0x20(%rsp), %rdi
callq 0x3040
testl %eax, %eax
je 0x4955
jmp 0x5279
movq %r14, %rdi
callq 0xdc4a
movslq (%r13), %rax
leaq (%rax,%r13), %rbp
testq %rax, %rax
cmoveq %rax, %rbp
movq %rbp, %rdi
callq 0x3150
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xdb34
movq %r14, %rdi
callq 0xddcb
leaq 0x4(%r13), %rbp
movslq 0x4(%r13), %rax
testq %rax, %rax
sete %cl
addq %rax, %rbp
sete %al
orb %cl, %al
jne 0x4c5c
movq %rbp, %rdi
callq 0x3150
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xdb34
movq %r14, %rdi
callq 0xddcb
movslq 0x40(%r13), %rax
testq %rax, %rax
leaq 0x40(%rax,%r13), %rcx
cmoveq %rax, %rcx
movq %rcx, 0x30(%rsp)
movq 0x20(%r12), %rax
movq %rax, 0x8(%rsp)
movslq 0x24(%r13), %rax
testq %rax, %rax
movq %r13, %rcx
leaq 0x24(%rax,%r13), %r13
cmoveq %rax, %r13
movq %rcx, 0x18(%rsp)
movslq 0x20(%rcx), %rax
testq %rax, %rax
je 0x4e0f
leaq (,%rax,8), %rax
addq %r13, %rax
movq %rax, 0x58(%rsp)
movslq (%r13), %rax
leaq (%rax,%r13), %rbp
testq %rax, %rax
cmoveq %rax, %rbp
movq %rbp, %rdi
callq 0x3150
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xdb34
movslq (%r13), %rax
leaq (%rax,%r13), %rcx
testq %rax, %rax
cmoveq %rax, %rcx
movl 0x4(%r13), %r8d
movq 0xc8(%r15), %r9
movl 0xc0(%r15), %eax
movl %eax, (%rsp)
movq %r14, %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x12d88
cmpq $0x0, 0x30(%rsp)
je 0x4e00
movq 0x30(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x78(%rsp)
movq %r12, 0x80(%rsp)
movslq (%r13), %rax
leaq (%rax,%r13), %rcx
testq %rax, %rax
cmoveq %rax, %rcx
movq %rcx, 0x88(%rsp)
movq 0xa8(%r15), %rax
movq %rax, 0x90(%rsp)
movq 0x40(%rsp), %rdi
movq %rbx, %rsi
leaq 0xa0(%rsp), %rdx
callq 0x10b98
testb %al, %al
je 0x4de9
movslq 0xa0(%rsp), %r15
testq %r15, %r15
jle 0x4de9
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 0xdb34
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 0x12d88
addq $0x10, %r14
cmpq %r14, %r15
jne 0x4d86
movq 0x60(%rsp), %r12
movq 0x10(%rsp), %r15
leaq 0xd0(%rsp), %r14
leaq 0x70(%rsp), %rbx
addq $0x8, %r13
cmpq 0x58(%rsp), %r13
jne 0x4cb0
movq %r14, %rdi
movq 0x48(%rsp), %rsi
callq 0xdc61
cmpq $0x0, 0x50(%rsp)
leaq 0x10adf(%rip), %r13     # 0x15908
movq 0x28(%rsp), %rbp
je 0x4e67
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0xddf3
movq 0x50(%rsp), %rdi
leaq 0x10d27(%rip), %rsi     # 0x15b70
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3480
movq 0xd8(%r15), %rdi
callq 0x3250
testl %eax, %eax
jne 0x526b
movq 0x10(%rbp), %rsi
leaq 0x10d07(%rip), %rax     # 0x15b79
testq %rsi, %rsi
je 0x5090
movq 0x4(%rsi), %rax
cmpq 0x30(%rbp), %rax
jne 0x4f64
movq 0x38(%rbp), %rax
cmpq %rax, 0xc(%rsi)
jne 0x4f64
cmpl $0x0, (%rsi)
leaq 0x10d30(%rip), %rax     # 0x15bd1
jne 0x5090
movq 0x18(%rsp), %rax
movslq 0x28(%rax), %rcx
leaq 0x10d44(%rip), %rax     # 0x15bfb
cmpl 0x14(%rsi), %ecx
jne 0x5090
movq 0x18(%rsp), %rax
leaq 0x2c(%rax), %rdi
testl %ecx, %ecx
jle 0x4fc4
movslq (%rdi), %r13
addq %r13, %rdi
testq %r13, %r13
movq %r13, 0x30(%rsp)
movq %rdi, 0x58(%rsp)
cmovneq %rdi, %r13
movslq 0x18(%rsi), %rax
testq %rax, %rax
leaq 0x18(%rax,%rsi), %rbp
cmoveq %rax, %rbp
movq %rcx, 0x38(%rsp)
leaq (,%rcx,4), %r15
movq %r13, %r14
xorl %ebx, %ebx
movslq (%r13,%rbx,2), %rax
leaq (%r14,%rax), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
leaq (%rbx,%rbp), %rsi
movslq (%rbp,%rbx), %rax
addq %rax, %rsi
testq %rax, %rax
cmoveq %rax, %rsi
callq 0x3470
testl %eax, %eax
jne 0x505a
addq $0x4, %rbx
addq $0x8, %r14
cmpq %rbx, %r15
jne 0x4f0a
movq 0x58(%rsp), %rax
leaq 0x109b5(%rip), %r13     # 0x15908
movq 0x28(%rsp), %rbp
movq 0x38(%rsp), %rcx
movq 0x30(%rsp), %rdx
jmp 0x4fcd
addq $0x4, %rsi
movq %rbx, %rdi
callq 0xddf3
leaq 0xa0(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0xddf3
movl 0x40(%r12), %edx
movq 0x18(%rsp), %rcx
movslq 0x8(%rcx), %rax
testq %rax, %rax
leaq 0x8(%rax,%rcx), %rcx
cmoveq %rax, %rcx
movl $0x10, %edi
leaq 0x10bee(%rip), %rsi     # 0x15b96
movq %rbx, %r8
leaq 0xa0(%rsp), %r9
xorl %eax, %eax
callq 0x5d74
movl $0x3, %ebx
jmp 0x50be
movslq (%rdi), %rdx
movq %rdx, %rax
addq %rdi, %rax
testl %edx, %edx
movl $0x0, %r14d
cmovneq %rax, %r14
testl %ecx, %ecx
je 0x5019
leaq (%r14,%rcx,8), %rbx
movq %r14, %r15
movslq (%r14), %rax
leaq (%r15,%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movl 0x4(%r14), %ecx
leaq 0x70(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x116f1
testb $0x1, 0x70(%rsp)
je 0x507c
addq $0x8, %r14
addq $0x8, %r15
cmpq %rbx, %r14
jne 0x4fe4
movl 0x40(%r12), %edx
movq 0x18(%rsp), %rcx
movslq 0x8(%rcx), %rax
testq %rax, %rax
leaq 0x8(%rax,%rcx), %rcx
cmoveq %rax, %rcx
movl $0x65, %ebx
movl $0x10, %edi
leaq 0x10c12(%rip), %rsi     # 0x15c56
xorl %eax, %eax
callq 0x5d74
movq 0x10(%rsp), %r15
leaq 0xd0(%rsp), %r14
jmp 0x50be
leaq 0x10b9a(%rip), %rax     # 0x15bfb
movq 0x10(%rsp), %r15
leaq 0x1089b(%rip), %r13     # 0x15908
leaq 0xd0(%rsp), %r14
movq 0x28(%rsp), %rbp
jmp 0x5090
leaq 0x10ba6(%rip), %rax     # 0x15c29
movq 0x10(%rsp), %r15
leaq 0xd0(%rsp), %r14
movl 0x40(%r12), %edx
movq 0x18(%rsp), %rcx
movslq 0x8(%rcx), %rsi
testq %rsi, %rsi
leaq 0x8(%rsi,%rcx), %rcx
cmoveq %rsi, %rcx
movl $0x3, %ebx
movl $0x10, %edi
movq %rax, %rsi
xorl %eax, %eax
callq 0x5d74
movq %r15, %rdi
callq 0x34b0
testl %eax, %eax
jne 0x5246
movq 0x8(%rsp), %rax
movq %rax, 0x20(%r12)
movl %ebx, 0x4(%rbp)
jmp 0x4955
movq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x3520
testl %eax, %eax
je 0x521c
jmp 0x5287
cmpl $0xc8, %eax
jne 0x5254
decl 0xe8(%r15)
movq 0x8(%rbp), %rcx
movslq 0x1c(%rcx), %rdx
testq %rdx, %rdx
leaq 0x1c(%rdx,%rcx), %rax
cmoveq %rdx, %rax
movslq 0x18(%rcx), %rcx
testq %rcx, %rcx
je 0x5208
leaq (%rax,%rcx,4), %rcx
movq 0xa0(%r15), %rdx
xorl %esi, %esi
movslq (%rax), %rdi
movslq (%rdx,%rdi,4), %r8
cmpq $-0x1, %r8
je 0x51ef
movq 0x90(%r15), %r9
testq %r9, %r9
je 0x51ef
movq %r8, %rdi
shlq $0x6, %rdi
addq %r9, %rdi
movq 0x8(%rdi), %r11
movl 0xc(%r11), %r10d
cmpl 0xf0(%r15), %r10d
jne 0x51ef
movslq 0x14(%r11), %rbx
testq %rbx, %rbx
leaq 0x14(%rbx,%r11), %r10
cmoveq %rbx, %r10
movslq 0x10(%r11), %r11
testq %r11, %r11
je 0x51b5
shlq $0x2, %r11
xorl %ebx, %ebx
movslq (%r10,%rbx), %r14
movslq (%rdx,%r14,4), %r14
shlq $0x6, %r14
cmpl $0xc8, 0x4(%r9,%r14)
jne 0x51e7
addq $0x4, %rbx
cmpq %rbx, %r11
jne 0x5195
movzwl (%rdi), %r9d
testb $0x3, %r9b
jne 0x51e7
movl 0x68(%r15), %r10d
movl 0x60(%r15), %r11d
decl %r11d
movq 0x58(%r15), %rbx
movl %r8d, (%rbx,%r10,4)
leal 0x1(%r10), %r8d
andl %r11d, %r8d
movl %r8d, 0x68(%r15)
orl $0x1, %r9d
movw %r9w, (%rdi)
incl %esi
leaq 0xd0(%rsp), %r14
addq $0x4, %rax
cmpq %rcx, %rax
jne 0x513a
testl %esi, %esi
jle 0x5208
movq %r15, %rdi
callq 0x588e
movq 0x20(%rsp), %rdi
callq 0x3110
testl %eax, %eax
je 0x521c
jmp 0x523d
andb $-0x3, (%rbp)
movl 0x40(%r12), %ebx
callq 0x113a8
testq %rax, %rax
je 0x48a0
jmp 0x483a
leaq 0x1083d(%rip), %rdi     # 0x15a78
jmp 0x5280
leaq 0x10852(%rip), %rdi     # 0x15a96
jmp 0x5280
leaq 0x1080f(%rip), %rdi     # 0x15a5c
xorl %eax, %eax
callq 0x5b09
leaq 0x108ca(%rip), %rdi     # 0x15b25
xorl %eax, %eax
callq 0x5a61
leaq 0x107f3(%rip), %rdi     # 0x15a5c
jmp 0x5280
leaq 0x10806(%rip), %rdi     # 0x15a78
xorl %eax, %eax
callq 0x5b09
leaq 0x108c1(%rip), %rdi     # 0x15b41
xorl %eax, %eax
callq 0x5b09
leaq 0x10aef(%rip), %rdi     # 0x15d7d
jmp 0x5280
jmp 0x52a7
jmp 0x52a7
jmp 0x52a7
jmp 0x52a7
jmp 0x52a7
jmp 0x52a7
jmp 0x52a7
jmp 0x52a7
jmp 0x52a7
movq 0x60(%rsp), %r12
movq 0x8(%rsp), %rcx
movq %rcx, 0x20(%r12)
movq %rax, %rdi
callq 0x35e0