// File: /workspace/github_c_makefile_star2_O0/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
subq $0x440, %rsp            # imm = 0x440
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6e20
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
addq $0x4, %rdi
callq 0x6e20
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x59b8
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x59c4
movl $0x64, -0x4(%rbp)
jmp 0x6115
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x44(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x5a1b
movq -0x10(%rbp), %rax
movl 0x108(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0xe0(%rcx), %eax
jne 0x5a06
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x6570
movl $0x3, -0x4(%rbp)
jmp 0x6115
movq -0x10(%rbp), %rax
movl 0x108(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x108(%rax)
jmp 0x5a1b
movq -0x28(%rbp), %rdi
callq 0x69f0
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
callq 0x6e20
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rax
movl 0x70(%rax), %eax
andl $0x2, %eax
shrl %eax
movl %eax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movl 0x70(%rax), %eax
andl $0x1, %eax
movl %eax, -0x5c(%rbp)
movq -0x30(%rbp), %rdi
addq $0x38, %rdi
callq 0x71d0
movl %eax, -0x60(%rbp)
movslq -0x60(%rbp), %rcx
shlq $0x4, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jge 0x5b08
movq -0x30(%rbp), %rdi
addq $0x38, %rdi
movl -0x6c(%rbp), %esi
callq 0x71e0
movq %rax, %rdi
callq 0x6e20
movq %rax, %rcx
movq -0x68(%rbp), %rax
movslq -0x6c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rdi
addq $0x38, %rdi
movl -0x6c(%rbp), %esi
callq 0x71e0
movq %rax, %rdi
addq $0x4, %rdi
callq 0x6e20
movq %rax, %rcx
movq -0x68(%rbp), %rax
movslq -0x6c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x5a96
movq -0x30(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
callq 0x6e90
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rdi
callq 0x6eb0
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x88(%rbp), %rax
je 0x5bc8
movq -0x80(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
callq 0x6e20
movq %rax, %rsi
leaq -0x31c(%rbp), %rdi
xorl %edx, %edx
callq 0x18e70
movq -0x48(%rbp), %rdi
leaq -0x31c(%rbp), %rsi
callq 0x65c0
testb $0x1, %al
jne 0x5bb5
movq -0x90(%rbp), %rdi
callq 0x6c00
movq %rax, %rdx
movl $0x1, %edi
leaq 0x1e0e4(%rip), %rsi     # 0x23c7d
movb $0x0, %al
callq 0x7a60
movq -0x28(%rbp), %rdi
callq 0x69b0
movl $0x66, -0x4(%rbp)
jmp 0x6115
jmp 0x5bb7
movq -0x80(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x80(%rbp)
jmp 0x5b31
leaq -0x328(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x31c0
movq -0x30(%rbp), %rax
movl 0x44(%rax), %ecx
andl $0x1, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x5cc5
movq -0x30(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x330(%rbp)
movq -0x330(%rbp), %rdi
callq 0x6e90
movq %rax, -0x338(%rbp)
movq -0x330(%rbp), %rdi
callq 0x6eb0
movq %rax, -0x340(%rbp)
movq -0x338(%rbp), %rax
cmpq -0x340(%rbp), %rax
je 0x5cc3
movq -0x338(%rbp), %rax
movq %rax, -0x348(%rbp)
movq -0x348(%rbp), %rdi
callq 0x6c00
movq %rax, %rdx
movl $0x8, %edi
leaq 0x1e047(%rip), %rsi     # 0x23ca8
movb $0x0, %al
callq 0x7a60
movq -0x348(%rbp), %rdi
callq 0x6e20
movq %rax, %rdi
callq 0x35e0
movq -0x48(%rbp), %rax
movq %rax, -0x3f0(%rbp)
movq -0x348(%rbp), %rdi
callq 0x6e20
movq -0x3f0(%rbp), %rdi
movq %rax, %rsi
movq -0x348(%rbp), %rax
movl 0x4(%rax), %edx
callq 0x1dcb0
movq -0x338(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x338(%rbp)
jmp 0x5c24
jmp 0x5cc5
cmpq $0x0, -0x40(%rbp)
je 0x5de6
leaq 0x1dfff(%rip), %rsi     # 0x23cd6
xorl %eax, %eax
movl $0x10, %edi
callq 0x7a60
leaq 0x298a6(%rip), %rdx     # 0x2f590
movq %rdx, %rsi
addq $0x88, %rsi
addq $0x90, %rdx
leaq -0x360(%rbp), %rdi
callq 0x7220
movl -0x54(%rbp), %edx
leaq 0x1dfe2(%rip), %rsi     # 0x23cf3
leaq -0x364(%rbp), %rdi
callq 0x67e0
jmp 0x5d1f
movq -0x40(%rbp), %rdi
movl -0x60(%rbp), %esi
movq -0x68(%rbp), %rdx
movl -0x54(%rbp), %ecx
movl -0x5c(%rbp), %r8d
movl -0x58(%rbp), %eax
xorl %r9d, %r9d
testl %eax, %eax
leaq 0x1dfbd(%rip), %rax     # 0x23cfd
cmovneq %rax, %r9
callq 0x1ebe0
movq %rax, -0x3f8(%rbp)
jmp 0x5d52
movq -0x3f8(%rbp), %rax
movq %rax, -0x37c(%rbp)
movq -0x37c(%rbp), %rax
movq %rax, -0x328(%rbp)
movl -0x328(%rbp), %edx
leaq 0x1df96(%rip), %rsi     # 0x23d11
xorl %eax, %eax
movl $0x10, %edi
callq 0x7a60
jmp 0x5d89
leaq -0x364(%rbp), %rdi
callq 0x6980
leaq -0x360(%rbp), %rdi
callq 0x7270
jmp 0x5de6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x370(%rbp)
movl %eax, -0x374(%rbp)
jmp 0x5dd5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x370(%rbp)
movl %eax, -0x374(%rbp)
leaq -0x364(%rbp), %rdi
callq 0x6980
leaq -0x360(%rbp), %rdi
callq 0x7270
jmp 0x611d
xorl %eax, %eax
cmpl -0x328(%rbp), %eax
jne 0x5f59
leaq 0x1df2d(%rip), %rsi     # 0x23d28
xorl %eax, %eax
movl $0x10, %edi
callq 0x7a60
leaq 0x29782(%rip), %rdx     # 0x2f590
movq %rdx, %rsi
addq $0x88, %rsi
addq $0x90, %rdx
leaq -0x398(%rbp), %rdi
callq 0x7220
movq -0x50(%rbp), %rsi
movl -0x54(%rbp), %edx
leaq -0x39c(%rbp), %rdi
callq 0x67e0
jmp 0x5e40
movq -0x38(%rbp), %rax
movq %rax, -0x418(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x40c(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x408(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x400(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x3fc(%rbp)
cmpl $0x0, -0x58(%rbp)
je 0x5e84
movq -0x50(%rbp), %rax
movq %rax, -0x420(%rbp)
jmp 0x5e8f
xorl %eax, %eax
movq %rax, -0x420(%rbp)
jmp 0x5e8f
movl -0x3fc(%rbp), %r8d
movl -0x400(%rbp), %ecx
movq -0x408(%rbp), %rdx
movl -0x40c(%rbp), %esi
movq -0x418(%rbp), %rdi
movq -0x420(%rbp), %r9
callq 0x1ebe0
movq %rax, -0x428(%rbp)
jmp 0x5ec5
movq -0x428(%rbp), %rax
movq %rax, -0x3a4(%rbp)
movq -0x3a4(%rbp), %rax
movq %rax, -0x328(%rbp)
movl -0x328(%rbp), %edx
leaq 0x1de23(%rip), %rsi     # 0x23d11
xorl %eax, %eax
movl $0x10, %edi
callq 0x7a60
jmp 0x5efc
leaq -0x39c(%rbp), %rdi
callq 0x6980
leaq -0x398(%rbp), %rdi
callq 0x7270
jmp 0x5f59
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x370(%rbp)
movl %eax, -0x374(%rbp)
jmp 0x5f48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x370(%rbp)
movl %eax, -0x374(%rbp)
leaq -0x39c(%rbp), %rdi
callq 0x6980
leaq -0x398(%rbp), %rdi
callq 0x7270
jmp 0x611d
movq -0x30(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x3b0(%rbp)
movq -0x3b0(%rbp), %rdi
callq 0x6e90
movq %rax, -0x3b8(%rbp)
movq -0x3b0(%rbp), %rdi
callq 0x6eb0
movq %rax, -0x3c0(%rbp)
movq -0x3b8(%rbp), %rax
cmpq -0x3c0(%rbp), %rax
je 0x5ff0
movq -0x3b8(%rbp), %rax
movq %rax, -0x3c8(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x430(%rbp)
movq -0x3c8(%rbp), %rdi
callq 0x6e20
movq -0x430(%rbp), %rdi
movq %rax, %rsi
movq -0x3c8(%rbp), %rax
movl 0x4(%rax), %edx
callq 0x1dcb0
movq -0x3b8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x3b8(%rbp)
jmp 0x5f8e
movq -0x28(%rbp), %rdi
callq 0x69b0
testb $0x1, -0x324(%rbp)
je 0x600e
leaq 0x1dd31(%rip), %rdi     # 0x23d3a
callq 0x1d980
xorl %eax, %eax
cmpl -0x328(%rbp), %eax
jne 0x6024
movl $0x64, -0x4(%rbp)
jmp 0x6115
movq -0x30(%rbp), %rax
movl 0x44(%rax), %ecx
andl $0x2, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x610e
movq -0x30(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x3d0(%rbp)
movq -0x3d0(%rbp), %rdi
callq 0x6e90
movq %rax, -0x3d8(%rbp)
movq -0x3d0(%rbp), %rdi
callq 0x6eb0
movq %rax, -0x3e0(%rbp)
movq -0x3d8(%rbp), %rax
cmpq -0x3e0(%rbp), %rax
je 0x610c
movq -0x3d8(%rbp), %rax
movq %rax, -0x3e8(%rbp)
movq -0x3e8(%rbp), %rdi
callq 0x6c00
movq %rax, %rdx
movl $0x8, %edi
leaq 0x1dcaa(%rip), %rsi     # 0x23d54
movb $0x0, %al
callq 0x7a60
movq -0x3e8(%rbp), %rdi
callq 0x6e20
movq %rax, %rdi
callq 0x35e0
movq -0x48(%rbp), %rax
movq %rax, -0x438(%rbp)
movq -0x3e8(%rbp), %rdi
callq 0x6e20
movq -0x438(%rbp), %rdi
movq %rax, %rsi
movq -0x3e8(%rbp), %rax
movl 0x4(%rax), %edx
callq 0x1dcb0
movq -0x3d8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x3d8(%rbp)
jmp 0x606d
jmp 0x610e
movl $0x66, -0x4(%rbp)
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
movq -0x370(%rbp), %rdi
callq 0x35c0
nopl (%rax)