// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, %rbx
movq 0x8(%rdx), %r15
movslq (%r15), %r12
testq %r12, %r12
sete %al
movslq 0x4(%r15), %rcx
testq %rcx, %rcx
leaq 0x4(%rcx,%r15), %rdi
cmoveq %rcx, %rdi
addq %r15, %r12
sete %cl
orb %al, %cl
movl $0x64, %r13d
jne 0x5835
cmpb $0x0, (%r12)
je 0x5835
testb $0x4, 0x44(%r15)
je 0x5355
movl 0x108(%rbx), %eax
cmpl 0xe0(%rbx), %eax
jne 0x534d
orb $0x1, (%rdx)
movq 0x110(%rbx), %rax
movslq 0x10c(%rbx), %rcx
leal 0x1(%rcx), %esi
movl %esi, 0x10c(%rbx)
movq %rdx, (%rax,%rcx,8)
movl $0x3, %r13d
jmp 0x5835
incl %eax
movl %eax, 0x108(%rbx)
movq %rsi, %r13
movq %rdi, -0x38(%rbp)
movq %r14, %rdi
callq 0x3250
testl %eax, %eax
jne 0x5847
movq %r12, -0x70(%rbp)
movq %r14, -0x68(%rbp)
movslq 0x8(%r15), %rax
testq %rax, %rax
leaq 0x8(%rax,%r15), %rcx
cmoveq %rax, %rcx
movq %rcx, -0x58(%rbp)
movslq 0x38(%r15), %rcx
movq %rcx, %rax
shlq $0x4, %rax
movq %rsp, %rdi
subq %rax, %rdi
movq %rdi, %rsp
movq %rcx, -0x78(%rbp)
testq %rcx, %rcx
movq %r13, %r8
jle 0x5403
movslq 0x3c(%r15), %rdx
testq %rdx, %rdx
leaq 0x3c(%rdx,%r15), %rcx
cmoveq %rdx, %rcx
xorl %edx, %edx
pxor %xmm0, %xmm0
leaq 0x4(%rcx), %rsi
movq %rcx, %xmm1
movq %rsi, %xmm2
punpcklqdq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0]
movq (%rcx), %xmm2
pxor %xmm3, %xmm3
pcmpgtd %xmm2, %xmm3
pshufd $0x50, %xmm2, %xmm4     # xmm4 = xmm2[0,0,1,1]
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
paddq %xmm1, %xmm2
pcmpeqd %xmm0, %xmm4
pandn %xmm2, %xmm4
movdqa %xmm4, (%rdi,%rdx)
addq $0x10, %rdx
addq $0x8, %rcx
cmpq %rdx, %rax
jne 0x53be
movq %rdi, -0x60(%rbp)
movl 0x70(%rbx), %eax
movl %eax, -0x30(%rbp)
movq 0xb0(%rbx), %rax
movq %rax, -0x48(%rbp)
movl 0x40(%r8), %eax
movl %eax, -0x4c(%rbp)
movslq 0x2c(%r15), %rax
testq %rax, %rax
leaq 0x2c(%rax,%r15), %r14
cmoveq %rax, %r14
movq %r15, -0x40(%rbp)
movslq 0x28(%r15), %r15
testq %r15, %r15
je 0x54a3
shlq $0x3, %r15
leaq -0x594(%rbp), %r13
leaq -0x308(%rbp), %r12
movq %r14, %rbx
movslq (%r14), %rax
leaq (%rbx,%rax), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0xeb0c
movl $0x28c, %edx            # imm = 0x28C
movq %r12, %rdi
movq %r13, %rsi
callq 0x3290
movq %r12, %rdi
callq 0xed49
movq -0x48(%rbp), %rdi
movq %r12, %rsi
callq 0x58c3
testb %al, %al
je 0x57ff
addq $0x8, %r14
addq $0x8, %rbx
addq $-0x8, %r15
jne 0x5451
movq -0x40(%rbp), %rax
leaq 0x2c(%rax), %r12
testb $0x1, 0x44(%rax)
movq -0x48(%rbp), %rbx
jne 0x5533
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 0x5533
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 0x107a5(%rip), %rsi     # 0x15c97
xorl %eax, %eax
callq 0x5d74
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 0x1167b
addq $0x8, %r14
addq $0x8, %r13
cmpq %r15, %r14
jne 0x54d8
movl -0x30(%rbp), %ebx
andl $0x1, %ebx
cmpq $0x0, -0x38(%rbp)
movq -0x78(%rbp), %r14
movl -0x4c(%rbp), %r13d
je 0x5620
leaq 0x10772(%rip), %rsi     # 0x15cc5
movl $0x10, %edi
xorl %eax, %eax
callq 0x5d74
leaq 0x1803a(%rip), %rax     # 0x1d5a0
leaq 0x88(%rax), %rcx
movq %rcx, -0x308(%rbp)
addq $0x90, %rax
movq %rax, -0x300(%rbp)
callq 0x5f2a
movq %rax, -0x2f8(%rbp)
movl %r13d, -0x594(%rbp)
leaq 0x180e5(%rip), %rax     # 0x1d680
cmpb $0x1, (%rax)
jne 0x55af
leaq 0x1073b(%rip), %rdi     # 0x15ce2
movl %r13d, %esi
callq 0xf4a3
xorl %r9d, %r9d
testb $0x2, -0x30(%rbp)
leaq 0x1072f(%rip), %rax     # 0x15cec
cmovneq %rax, %r9
movq -0x38(%rbp), %rdi
movl %r14d, %esi
movq -0x60(%rbp), %rdx
movl %r13d, %ecx
movl %ebx, %r8d
callq 0x11ff1
leaq 0x10722(%rip), %rsi     # 0x15d00
movl $0x10, %edi
movl %eax, %edx
movq %rax, %r15
xorl %eax, %eax
callq 0x5d74
leaq -0x594(%rbp), %rdi
callq 0x5a06
leaq -0x308(%rbp), %rdi
callq 0x5a30
testl %r15d, %r15d
je 0x5620
movq %r15, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x40(%rbp), %rbx
jmp 0x56e5
leaq 0x106f0(%rip), %rsi     # 0x15d17
movl $0x10, %edi
xorl %eax, %eax
callq 0x5d74
leaq 0x17f66(%rip), %rax     # 0x1d5a0
leaq 0x88(%rax), %rcx
movq %rcx, -0x308(%rbp)
addq $0x90, %rax
movq %rax, -0x300(%rbp)
callq 0x5f2a
movq %rax, -0x2f8(%rbp)
movl %r13d, -0x594(%rbp)
leaq 0x18011(%rip), %rax     # 0x1d680
cmpb $0x1, (%rax)
jne 0x5680
movq -0x58(%rbp), %rdi
movl %r13d, %esi
callq 0xf4a3
xorl %eax, %eax
testb $0x2, -0x30(%rbp)
movq -0x58(%rbp), %r9
cmoveq %rax, %r9
movq -0x70(%rbp), %rdi
movl %r14d, %esi
movq -0x60(%rbp), %rdx
movl %r13d, %ecx
movl %ebx, %r8d
callq 0x11ff1
leaq 0x10655(%rip), %rsi     # 0x15d00
movl $0x10, %edi
movl %eax, %edx
movq %rax, %r14
xorl %eax, %eax
callq 0x5d74
movq -0x40(%rbp), %rbx
leaq -0x594(%rbp), %rdi
callq 0x5a06
leaq -0x308(%rbp), %rdi
callq 0x5a30
movq %r14, -0x30(%rbp)
testl %r14d, %r14d
sete %al
movl %eax, -0x38(%rbp)
movslq 0x2c(%rbx), %rax
leaq (%rax,%r12), %r14
testq %rax, %rax
cmoveq %rax, %r14
movslq 0x28(%rbx), %rax
testq %rax, %rax
movq -0x48(%rbp), %r13
je 0x572f
leaq (%r14,%rax,8), %r15
movq %r14, %rbx
movslq (%r14), %rax
leaq (%rbx,%rax), %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movl 0x4(%r14), %edx
movq %r13, %rdi
callq 0x1167b
addq $0x8, %r14
addq $0x8, %rbx
cmpq %r15, %r14
jne 0x5708
movq -0x68(%rbp), %rdi
callq 0x34b0
testl %eax, %eax
jne 0x5850
btq $0x20, -0x30(%rbp)
jae 0x5754
leaq 0x105da(%rip), %rdi     # 0x15d29
callq 0x113ec
cmpb $0x0, -0x38(%rbp)
movl $0x64, %r13d
movq -0x40(%rbp), %rcx
jne 0x5835
movl $0x66, %r13d
testb $0x2, 0x44(%rcx)
jne 0x5835
movslq 0x2c(%rcx), %rax
addq %rax, %r12
testq %rax, %rax
cmoveq %rax, %r12
movslq 0x28(%rcx), %rax
testq %rax, %rax
je 0x5835
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 0x1058a(%rip), %rsi     # 0x15d43
xorl %eax, %eax
callq 0x5d74
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 0x1167b
addq $0x8, %r12
addq $0x8, %r15
cmpq %r14, %r12
jne 0x579e
jmp 0x5835
movslq (%r14), %rax
addq %rax, %rbx
testq %rax, %rax
cmoveq %rax, %rbx
leaq 0x10459(%rip), %rsi     # 0x15c6c
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5d74
movq -0x68(%rbp), %rdi
callq 0x34b0
testl %eax, %eax
jne 0x5850
movl $0x66, %r13d
movl %r13d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1022a(%rip), %rdi     # 0x15a78
jmp 0x5857
leaq 0x10205(%rip), %rdi     # 0x15a5c
xorl %eax, %eax
callq 0x5b09
jmp 0x5860
movq %rax, %rbx
jmp 0x587a
jmp 0x586b
jmp 0x586b
jmp 0x586b
movq %rax, %rbx
leaq -0x594(%rbp), %rdi
callq 0x5a06
leaq -0x308(%rbp), %rdi
callq 0x5a30
movq %rbx, %rdi
callq 0x35e0