// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movq %rdi, %r15
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
addq %r14, %rsi
sete %cl
orb %al, %cl
movl $0x64, %r13d
jne 0x59b0
cmpb $0x0, (%rsi)
je 0x59b0
movq %rsi, -0x70(%rbp)
testb $0x4, 0x44(%r14)
je 0x54a4
movl 0x108(%r15), %eax
cmpl 0xe0(%r15), %eax
jne 0x549b
orb $0x1, (%rdx)
movq 0x110(%r15), %rax
movslq 0x10c(%r15), %rcx
leal 0x1(%rcx), %esi
movl %esi, 0x10c(%r15)
movq %rdx, (%rax,%rcx,8)
movl $0x3, %r13d
jmp 0x59b0
incl %eax
movl %eax, 0x108(%r15)
movq %rdi, -0x38(%rbp)
movq %r12, %rdi
callq 0x3250
testl %eax, %eax
jne 0x59c2
movq %r12, -0x60(%rbp)
movslq 0x8(%r14), %rax
testq %rax, %rax
leaq 0x8(%rax,%r14), %rcx
cmoveq %rax, %rcx
movq %rcx, -0x58(%rbp)
movslq 0x38(%r14), %r9
movq %r9, %rax
shlq $0x4, %rax
movq %rsp, %r10
subq %rax, %r10
movq %r10, %rsp
testq %r9, %r9
jle 0x553e
movslq 0x3c(%r14), %rcx
testq %rcx, %rcx
leaq 0x3c(%rcx,%r14), %rax
cmoveq %rcx, %rax
leaq 0x4(%rax), %rcx
leaq (,%r9,8), %rdx
xorl %esi, %esi
leaq (%rax,%rsi), %rdi
movslq (%rax,%rsi), %r8
addq %r8, %rdi
testq %r8, %r8
cmoveq %r8, %rdi
movq %rdi, (%r10,%rsi,2)
movslq 0x4(%rax,%rsi), %rdi
leaq (%rcx,%rsi), %r8
addq %rdi, %r8
testq %rdi, %rdi
cmoveq %rdi, %r8
movq %r8, 0x8(%r10,%rsi,2)
addq $0x8, %rsi
cmpq %rsi, %rdx
jne 0x5507
movq %r10, -0x78(%rbp)
movq %r9, -0x68(%rbp)
movl 0x70(%r15), %eax
movl %eax, -0x2c(%rbp)
movq 0xb0(%r15), %rax
movq %rax, -0x48(%rbp)
movl 0x40(%rbx), %eax
movl %eax, -0x4c(%rbp)
movslq 0x2c(%r14), %rax
testq %rax, %rax
leaq 0x2c(%rax,%r14), %r15
cmoveq %rax, %r15
movq %r14, -0x40(%rbp)
movslq 0x28(%r14), %r14
testq %r14, %r14
je 0x55e2
shlq $0x3, %r14
leaq -0x594(%rbp), %r13
leaq -0x308(%rbp), %r12
movq %r15, %rbx
movslq (%r15), %rax
leaq (%rbx,%rax), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0xf1ec
movl $0x28c, %edx            # imm = 0x28C
movq %r12, %rdi
movq %r13, %rsi
callq 0x3290
movq %r12, %rdi
callq 0xf42c
movq -0x48(%rbp), %rdi
movq %r12, %rsi
callq 0x5a3e
testb %al, %al
je 0x5773
addq $0x8, %r15
addq $0x8, %rbx
addq $-0x8, %r14
jne 0x5590
movq -0x40(%rbp), %rax
leaq 0x2c(%rax), %r12
testb $0x1, 0x44(%rax)
movq -0x48(%rbp), %rbx
jne 0x5672
movq -0x40(%rbp), %rcx
movslq 0x2c(%rcx), %rax
leaq (%rax,%r12), %r14
testq %rax, %rax
cmoveq %rax, %r14
movslq 0x28(%rcx), %rax
testq %rax, %rax
je 0x5672
leaq (%r14,%rax,8), %r15
movq %r14, %r13
movslq (%r14), %rax
leaq (%rax,%r13), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movl $0x8, %edi
leaq 0x1067e(%rip), %rsi     # 0x15caf
xorl %eax, %eax
callq 0x5ef0
movslq (%r14), %rax
leaq (%rax,%r13), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
callq 0x3600
movslq (%r14), %rax
leaq (%rax,%r13), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movl 0x4(%r14), %edx
movq %rbx, %rdi
callq 0x11d47
addq $0x8, %r14
addq $0x8, %r13
cmpq %r15, %r14
jne 0x5617
movl -0x2c(%rbp), %ebx
andl $0x1, %ebx
cmpq $0x0, -0x38(%rbp)
movq -0x68(%rbp), %r14
movq -0x78(%rbp), %r15
movl -0x4c(%rbp), %r13d
je 0x57b2
leaq 0x10647(%rip), %rsi     # 0x15cdd
movl $0x10, %edi
xorl %eax, %eax
callq 0x5ef0
leaq 0x17ef7(%rip), %rax     # 0x1d5a0
leaq 0x88(%rax), %rcx
movq %rcx, -0x308(%rbp)
addq $0x90, %rax
movq %rax, -0x300(%rbp)
callq 0x60a6
movq %rax, -0x2f8(%rbp)
movl %r13d, -0x594(%rbp)
leaq 0x17fa2(%rip), %rax     # 0x1d680
cmpb $0x1, (%rax)
jne 0x56f2
leaq 0x10610(%rip), %rdi     # 0x15cfa
movl %r13d, %esi
callq 0xfb72
xorl %r9d, %r9d
testb $0x2, -0x2c(%rbp)
leaq 0x10604(%rip), %rax     # 0x15d04
cmovneq %rax, %r9
movq -0x38(%rbp), %rdi
movl %r14d, %esi
movq %r15, %r14
movq %r15, %rdx
movl %r13d, %ecx
movl %ebx, %r15d
movl %ebx, %r8d
callq 0x1272d
movq %rax, %rbx
leaq 0x105ef(%rip), %rsi     # 0x15d18
movl $0x10, %edi
movl %ebx, %edx
xorl %eax, %eax
callq 0x5ef0
movabsq $0x100000000, %rax      # imm = 0x100000000
testq %rax, %rbx
setne %al
movl %eax, -0x38(%rbp)
leaq -0x594(%rbp), %rdi
callq 0x5b82
leaq -0x308(%rbp), %rdi
callq 0x5bac
testl %ebx, %ebx
sete %al
movl %r15d, %ebx
movq %r14, %r15
movq -0x68(%rbp), %r14
jmp 0x57bb
movslq (%r15), %rax
addq %rax, %rbx
testq %rax, %rax
cmoveq %rax, %rbx
leaq 0x104fd(%rip), %rsi     # 0x15c84
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5ef0
movq -0x60(%rbp), %rdi
callq 0x34b0
testl %eax, %eax
jne 0x59cb
movl $0x66, %r13d
jmp 0x59b0
movb $0x1, %al
movl $0x0, -0x38(%rbp)
testb %al, %al
je 0x5893
leaq 0x10565(%rip), %rsi     # 0x15d2f
movl $0x10, %edi
xorl %eax, %eax
callq 0x5ef0
leaq 0x17dc3(%rip), %rax     # 0x1d5a0
leaq 0x88(%rax), %rcx
movq %rcx, -0x308(%rbp)
addq $0x90, %rax
movq %rax, -0x300(%rbp)
callq 0x60a6
movq %rax, -0x2f8(%rbp)
movl %r13d, -0x594(%rbp)
leaq 0x17e6e(%rip), %rax     # 0x1d680
cmpb $0x1, (%rax)
jne 0x5823
movq -0x58(%rbp), %rdi
movl %r13d, %esi
callq 0xfb72
xorl %eax, %eax
testb $0x2, -0x2c(%rbp)
movq -0x58(%rbp), %r9
cmoveq %rax, %r9
movq -0x70(%rbp), %rdi
movl %r14d, %esi
movq %r15, %rdx
movl %r13d, %ecx
movl %ebx, %r8d
callq 0x1272d
movq %rax, %rbx
leaq 0x104c8(%rip), %rsi     # 0x15d18
movl $0x10, %edi
movl %ebx, %edx
xorl %eax, %eax
callq 0x5ef0
movabsq $0x100000000, %rax      # imm = 0x100000000
testq %rax, %rbx
setne %al
movl %eax, -0x38(%rbp)
leaq -0x594(%rbp), %rdi
callq 0x5b82
leaq -0x308(%rbp), %rdi
callq 0x5bac
testl %ebx, %ebx
sete %al
movl %eax, -0x2c(%rbp)
jmp 0x589a
movl $0x0, -0x2c(%rbp)
movq -0x40(%rbp), %rcx
movslq 0x2c(%rcx), %rax
leaq (%rax,%r12), %r14
testq %rax, %rax
cmoveq %rax, %r14
movslq 0x28(%rcx), %rax
testq %rax, %rax
movq -0x48(%rbp), %rbx
je 0x58e8
leaq (%r14,%rax,8), %r15
movq %r14, %r13
movslq (%r14), %rax
leaq (%rax,%r13), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movl 0x4(%r14), %edx
movq %rbx, %rdi
callq 0x11d47
addq $0x8, %r14
addq $0x8, %r13
cmpq %r15, %r14
jne 0x58c1
movq -0x60(%rbp), %rdi
callq 0x34b0
testl %eax, %eax
jne 0x59cb
cmpb $0x0, -0x38(%rbp)
movl $0x64, %r13d
je 0x5911
leaq 0x10435(%rip), %rdi     # 0x15d41
callq 0x11ab8
cmpb $0x0, -0x2c(%rbp)
jne 0x59b0
movl $0x66, %r13d
movq -0x40(%rbp), %rcx
testb $0x2, 0x44(%rcx)
jne 0x59b0
movslq 0x2c(%rcx), %rax
addq %rax, %r12
testq %rax, %rax
cmoveq %rax, %r12
movslq 0x28(%rcx), %rax
testq %rax, %rax
je 0x59b0
leaq (%r12,%rax,8), %r14
movq %r12, %r15
movq -0x48(%rbp), %rbx
movslq (%r12), %rax
leaq (%r15,%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movl $0x8, %edi
leaq 0x103ef(%rip), %rsi     # 0x15d5b
xorl %eax, %eax
callq 0x5ef0
movslq (%r12), %rax
leaq (%r15,%rax), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
callq 0x3600
movslq (%r12), %rax
leaq (%r15,%rax), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movl 0x4(%r12), %edx
movq %rbx, %rdi
callq 0x11d47
addq $0x8, %r12
addq $0x8, %r15
cmpq %r14, %r12
jne 0x5951
movl %r13d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x100c7(%rip), %rdi     # 0x15a90
jmp 0x59d2
leaq 0x100a2(%rip), %rdi     # 0x15a74
xorl %eax, %eax
callq 0x5c85
jmp 0x59db
movq %rax, %rbx
jmp 0x59f5
jmp 0x59e6
jmp 0x59e6
jmp 0x59e6
movq %rax, %rbx
leaq -0x594(%rbp), %rdi
callq 0x5b82
leaq -0x308(%rbp), %rdi
callq 0x5bac
movq %rbx, %rdi
callq 0x35e0