// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/BuildQueue.cpp
// Function: t2::RunAction(t2::BuildQueue*, t2::ThreadState*, t2::NodeState*, t2::Mutex*)
static BuildProgress::Enum RunAction(BuildQueue* queue, ThreadState* thread_state, NodeState* node, Mutex* queue_lock)
  {
    const NodeData    *node_data    = node->m_MmapData;
    const char        *cmd_line     = node_data->m_Action;
    const char        *pre_cmd_line = node_data->m_PreAction;

    if (!cmd_line || cmd_line[0] == '\0')
      return BuildProgress::kSucceeded;

    if (node->m_MmapData->m_Flags & NodeData::kFlagExpensive)
    {
      if (queue->m_ExpensiveRunning == queue->m_Config.m_MaxExpensiveCount)
      {
        ParkExpensiveNode(queue, node);
        return BuildProgress::kRunAction;
      }
      else
      {
        ++queue->m_ExpensiveRunning;
      }
    }

    MutexUnlock(queue_lock);

    StatCache         *stat_cache   = queue->m_Config.m_StatCache;
    const char        *annotation   = node_data->m_Annotation;
    int                job_id       = thread_state->m_ThreadIndex;
    int                echo_annotations = 0 != (queue->m_Config.m_Flags & BuildQueueConfig::kFlagEchoAnnotations);
    int                echo_cmdline = 0 != (queue->m_Config.m_Flags & BuildQueueConfig::kFlagEchoCommandLines);

    // Repack frozen env to pointers on the stack.
    int                env_count    = node_data->m_EnvVars.GetCount();
    EnvVariable*       env_vars     = (EnvVariable*) alloca(env_count * sizeof(EnvVariable));
    for (int i = 0; i < env_count; ++i)
    {
      env_vars[i].m_Name  = node_data->m_EnvVars[i].m_Name;
      env_vars[i].m_Value = node_data->m_EnvVars[i].m_Value;
    }

    for (const FrozenFileAndHash& output_file : node_data->m_OutputFiles)
    {
      PathBuffer output;
      PathInit(&output, output_file.m_Filename);

      if (!MakeDirectoriesForFile(stat_cache, output))
      {
        Log(kError, "failed to create output directories for %s", output_file.m_Filename.Get());
        MutexLock(queue_lock);
        return BuildProgress::kFailed;
      }
    }

    ExecResult result = { 0, false };

    // See if we need to remove the output files before running anything.
    if (0 == (node_data->m_Flags & NodeData::kFlagOverwriteOutputs))
    {
      for (const FrozenFileAndHash& output : node_data->m_OutputFiles)
      {
        Log(kDebug, "Removing output file %s before running action", output.m_Filename.Get());
        remove(output.m_Filename);
        StatCacheMarkDirty(stat_cache, output.m_Filename, output.m_FilenameHash);
      }
    }

    if (pre_cmd_line)
    {
      Log(kSpam, "Launching pre-action process");
      TimingScope timing_scope(&g_Stats.m_ExecCount, &g_Stats.m_ExecTimeCycles);
      ProfilerScope prof_scope("Pre-build", job_id);
      result = ExecuteProcess(pre_cmd_line, env_count, env_vars, job_id, echo_cmdline, echo_annotations ? "(pre-build command)" : nullptr);
      Log(kSpam, "Process return code %d", result.m_ReturnCode);
    }

    if (0 == result.m_ReturnCode)
    {
      Log(kSpam, "Launching process");
      TimingScope timing_scope(&g_Stats.m_ExecCount, &g_Stats.m_ExecTimeCycles);
      ProfilerScope prof_scope(annotation, job_id);
      result = ExecuteProcess(cmd_line, env_count, env_vars, job_id, echo_cmdline, echo_annotations ? annotation : nullptr);
      Log(kSpam, "Process return code %d", result.m_ReturnCode);
    }

    for (const FrozenFileAndHash& output : node_data->m_OutputFiles)
    {
      StatCacheMarkDirty(stat_cache, output.m_Filename, output.m_FilenameHash);
    }

    MutexLock(queue_lock);

    if (result.m_WasSignalled)
    {
      SignalSet("child processes signalled");
    }

    if (0 == result.m_ReturnCode)
    {
      return BuildProgress::kSucceeded;
    }
    else
    {
      // Clean up output files after a failed build unless they are precious.
      if (0 == (NodeData::kFlagPreciousOutputs & node_data->m_Flags))
      {
        for (const FrozenFileAndHash& output : node_data->m_OutputFiles)
        {
          Log(kDebug, "Removing output file %s from failed build", output.m_Filename.Get());
          remove(output.m_Filename);
          StatCacheMarkDirty(stat_cache, output.m_Filename, output.m_FilenameHash);
        }
      }

      return BuildProgress::kFailed;
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x578, %rsp            # imm = 0x578
movq %rcx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rdx), %r14
movslq (%r14), %rsi
testq %rsi, %rsi
sete %al
movslq 0x4(%r14), %rcx
testq %rcx, %rcx
leaq 0x4(%rcx,%r14), %rdi
cmoveq %rcx, %rdi
movq %rdi, -0x80(%rbp)
addq %r14, %rsi
sete %cl
orb %al, %cl
pushq $0x64
popq %r13
jne 0x52b9
cmpb $0x0, (%rsi)
je 0x52b9
testb $0x4, 0x44(%r14)
je 0x4dfb
movl 0x108(%rbx), %eax
cmpl 0xe0(%rbx), %eax
jne 0x4df3
orb $0x1, (%rdx)
movq 0x110(%rbx), %rax
movslq 0x10c(%rbx), %rcx
leal 0x1(%rcx), %esi
movl %esi, 0x10c(%rbx)
movq %rdx, (%rax,%rcx,8)
pushq $0x3
jmp 0x50f4
incl %eax
movl %eax, 0x108(%rbx)
movq %rsi, -0x68(%rbp)
movq %r12, %rdi
callq 0x54b4
movq 0xb0(%rbx), %rax
movq %rax, -0x40(%rbp)
movslq 0x8(%r14), %rax
leaq (%rax,%r14), %r9
addq $0x8, %r9
movl 0x40(%r15), %ecx
movl %ecx, -0x50(%rbp)
movl 0x70(%rbx), %ebx
movslq 0x38(%r14), %r10
movq %r10, %rcx
shlq $0x4, %rcx
movq %rsp, %r11
subq %rcx, %r11
movq %r11, %rsp
leaq 0x3c(%r14), %rcx
xorl %edx, %edx
testl %r10d, %r10d
movl $0x0, %esi
cmovgl %r10d, %esi
shlq $0x3, %rsi
pxor %xmm0, %xmm0
cmpq %rdx, %rsi
je 0x4eb0
movslq (%rcx), %rdi
leaq (%rdi,%rcx), %r8
testq %rdi, %rdi
cmoveq %rdi, %r8
leaq (%r8,%rdx), %rdi
addq $0x4, %rdi
addq %rdx, %r8
movq %rdi, %xmm1
movq %r8, %xmm2
punpcklqdq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0]
movq -0x4(%rdi), %xmm1
pxor %xmm3, %xmm3
pcmpgtd %xmm1, %xmm3
pshufd $0x50, %xmm1, %xmm4     # xmm4 = xmm1[0,0,1,1]
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
paddq %xmm2, %xmm1
pcmpeqd %xmm0, %xmm4
pandn %xmm1, %xmm4
movdqa %xmm4, (%r11,%rdx,2)
addq $0x8, %rdx
jmp 0x4e56
movq %r11, -0x58(%rbp)
movq %r10, -0x78(%rbp)
movq %r12, -0x60(%rbp)
xorl %ecx, %ecx
testl %eax, %eax
cmoveq %rcx, %r9
movq %r9, -0x70(%rbp)
movl %ebx, -0x34(%rbp)
andl $0x1, %ebx
movl %ebx, -0x4c(%rbp)
leaq 0x2c(%r14), %rax
movq %rax, -0x48(%rbp)
movslq 0x2c(%r14), %rax
testq %rax, %rax
leaq 0x2c(%rax,%r14), %r15
cmoveq %rax, %r15
movq %r14, -0x30(%rbp)
movslq 0x28(%r14), %r14
shlq $0x3, %r14
leaq -0x59c(%rbp), %r13
leaq -0x310(%rbp), %r12
movq %r15, %rbx
testq %r14, %r14
je 0x4f5d
movslq (%rbx), %rax
leaq (%r15,%rax), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0xda18
movl $0x28c, %edx            # imm = 0x28C
movq %r12, %rdi
movq %r13, %rsi
callq 0x3290
movq %r12, %rdi
callq 0xdc55
movq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0x5336
testb %al, %al
je 0x50c8
addq $0x8, %rbx
addq $0x8, %r15
addq $-0x8, %r14
jmp 0x4f06
movq -0x30(%rbp), %rax
testb $0x1, 0x44(%rax)
jne 0x4ff4
movq -0x30(%rbp), %rcx
movslq 0x2c(%rcx), %rax
movq -0x48(%rbp), %rdx
leaq (%rax,%rdx), %r13
testq %rax, %rax
cmoveq %rax, %r13
movslq 0x28(%rcx), %r14
shlq $0x3, %r14
leaq 0xed1e(%rip), %rbx      # 0x13caf
pushq $0x8
popq %r12
movq %r13, %r15
testq %r14, %r14
je 0x4ff4
movslq (%r15), %rax
leaq (%rax,%r13), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movl %r12d, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5981
movslq (%r15), %rax
leaq (%rax,%r13), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
callq 0x3600
movslq (%r15), %rax
leaq (%rax,%r13), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movl 0x4(%r15), %edx
movq -0x40(%rbp), %rdi
callq 0x10186
addq $0x8, %r15
addq $0x8, %r13
addq $-0x8, %r14
jmp 0x4f98
movq -0x80(%rbp), %rbx
testq %rbx, %rbx
movl -0x50(%rbp), %r14d
movq -0x78(%rbp), %r15
movl -0x4c(%rbp), %r12d
je 0x50fb
leaq 0xecc9(%rip), %rsi      # 0x13cdd
pushq $0x10
popq %rdi
xorl %eax, %eax
callq 0x5981
leaq 0x1857b(%rip), %rax     # 0x1d5a0
leaq 0x88(%rax), %rcx
movq %rcx, -0x310(%rbp)
addq $0x90, %rax
movq %rax, -0x308(%rbp)
callq 0x5b35
movq %rax, -0x300(%rbp)
movl %r14d, -0x59c(%rbp)
leaq 0xeca0(%rip), %rdi      # 0x13cfa
movl %r14d, %esi
callq 0x551c
xorl %r9d, %r9d
testb $0x2, -0x34(%rbp)
leaq 0xec94(%rip), %rax      # 0x13d04
cmovneq %rax, %r9
movq %rbx, %rdi
movl %r15d, %esi
movq -0x58(%rbp), %rdx
movl %r14d, %ecx
movl %r12d, %r8d
callq 0x10965
movq %rax, %r13
leaq 0xec85(%rip), %rsi      # 0x13d18
pushq $0x10
popq %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x5981
leaq -0x59c(%rbp), %rdi
callq 0x5488
leaq -0x310(%rbp), %rdi
callq 0x55d6
testl %r13d, %r13d
je 0x50fb
xorl %ebx, %ebx
movq -0x30(%rbp), %r15
jmp 0x51ac
movslq (%rbx), %rax
addq %rax, %r15
testq %rax, %rax
cmoveq %rax, %r15
leaq 0xeba8(%rip), %rsi      # 0x13c84
pushq $0x1
popq %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x5981
movq -0x60(%rbp), %rdi
callq 0x549a
pushq $0x66
popq %r13
jmp 0x52b9
leaq 0xec2d(%rip), %rsi      # 0x13d2f
pushq $0x10
popq %rdi
xorl %eax, %eax
callq 0x5981
leaq 0x1848d(%rip), %rax     # 0x1d5a0
leaq 0x88(%rax), %rcx
movq %rcx, -0x310(%rbp)
addq $0x90, %rax
movq %rax, -0x308(%rbp)
callq 0x5b35
movq %rax, -0x300(%rbp)
movl %r14d, -0x59c(%rbp)
movq -0x70(%rbp), %rbx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x551c
xorl %eax, %eax
testb $0x2, -0x34(%rbp)
cmoveq %rax, %rbx
movq -0x68(%rbp), %rdi
movl %r15d, %esi
movq -0x58(%rbp), %rdx
movl %r14d, %ecx
movl %r12d, %r8d
movq %rbx, %r9
callq 0x10965
movq %rax, %r13
leaq 0xeb9b(%rip), %rsi      # 0x13d18
pushq $0x10
popq %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x5981
movq -0x30(%rbp), %r15
leaq -0x59c(%rbp), %rdi
callq 0x5488
leaq -0x310(%rbp), %rdi
callq 0x55d6
testl %r13d, %r13d
sete %bl
movslq 0x2c(%r15), %rax
movq -0x48(%rbp), %rcx
leaq (%rax,%rcx), %r14
testq %rax, %rax
cmoveq %rax, %r14
movslq 0x28(%r15), %r15
shlq $0x3, %r15
movq %r14, %r12
testq %r15, %r15
je 0x51fa
movslq (%r12), %rax
leaq (%r14,%rax), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movl 0x4(%r12), %edx
movq -0x40(%rbp), %rdi
callq 0x10186
addq $0x8, %r12
addq $0x8, %r14
addq $-0x8, %r15
jmp 0x51ca
movq -0x60(%rbp), %rdi
callq 0x549a
btq $0x20, %r13
jae 0x5216
leaq 0xeb30(%rip), %rdi      # 0x13d41
callq 0xff9d
testb %bl, %bl
pushq $0x64
popq %r13
movq -0x30(%rbp), %rcx
jne 0x52b9
pushq $0x66
popq %r13
testb $0x2, 0x44(%rcx)
jne 0x52b9
movslq 0x2c(%rcx), %rax
movq -0x48(%rbp), %r12
addq %rax, %r12
testq %rax, %rax
cmoveq %rax, %r12
movslq 0x28(%rcx), %r14
shlq $0x3, %r14
pushq $0x8
popq %r15
movq %r12, %rbx
testq %r14, %r14
je 0x52b9
movslq (%r12), %rax
leaq (%rbx,%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movl %r15d, %edi
leaq 0xeae8(%rip), %rsi      # 0x13d5b
xorl %eax, %eax
callq 0x5981
movslq (%r12), %rax
leaq (%rbx,%rax), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
callq 0x3600
movslq (%r12), %rax
leaq (%rbx,%rax), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movl 0x4(%r12), %edx
movq -0x40(%rbp), %rdi
callq 0x10186
addq $0x8, %r12
addq $0x8, %rbx
addq $-0x8, %r14
jmp 0x5255
movl %r13d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x52d3
jmp 0x52d3
jmp 0x52e4
jmp 0x52d3
movq %rax, %rbx
leaq -0x59c(%rbp), %rdi
callq 0x5488
jmp 0x52e7
movq %rax, %rbx
leaq -0x310(%rbp), %rdi
callq 0x55d6
movq %rbx, %rdi
callq 0x35e0