// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]tundra/src/Main.cpp
// Function: main
int main(int argc, char* argv[])
{
  using namespace t2;

  InitCommon();

  Driver driver;
  DriverOptions options;

  // Set default options
  DriverOptionsInit(&options);

  // Scan options from command line, update argc/argv
  if (!InitOptions(&options, &argc, &argv))
  {
    ShowHelp();
    return 1;
  }

  DriverInitializeTundraFilePaths(&options);
#if defined(TUNDRA_WIN32)
  if (!options.m_RunUnprotected && nullptr == getenv("_TUNDRA2_PARENT_PROCESS_HANDLE"))
  {
    // Re-launch Tundra2 as a child in a new process group. The child will be passed a handle to our process so it can
    // watch for us dying, but not be affected by sudden termination itself.
    // This ridiculous tapdance is there to prevent hard termination by things like visual studio and the mingw shell.
    // Because Tundra needs to save build state when shutting down, we need this.

    HANDLE myproc = GetCurrentProcess();
    HANDLE self_copy = NULL;
    if (!DuplicateHandle(myproc, myproc, myproc, &self_copy, 0, TRUE, DUPLICATE_SAME_ACCESS))
    {
      CroakErrno("DuplicateHandle() failed");
    }

    // Expose handle in the environment for the child process.
    {
      char handle_value[128];
      _snprintf(handle_value, sizeof handle_value, "_TUNDRA2_PARENT_PROCESS_HANDLE=%016I64x", uint64_t(self_copy));
      _putenv(handle_value);
    }

    STARTUPINFOA startup_info;
    PROCESS_INFORMATION proc_info;
    ZeroMemory(&startup_info, sizeof startup_info);
    ZeroMemory(&proc_info, sizeof proc_info);
    startup_info.cb = sizeof startup_info;

    HANDLE job_handle = CreateJobObject(NULL,  NULL);

    // Set job object limits so children can break out.
    JOBOBJECT_EXTENDED_LIMIT_INFORMATION limits;
    ZeroMemory(&limits, sizeof(limits));
    limits.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_BREAKAWAY_OK | JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK;

    if (!SetInformationJobObject(job_handle, JobObjectExtendedLimitInformation, &limits, sizeof limits) )
      CroakErrno("couldn't set job info");

    if (!CreateProcessA(NULL, GetCommandLineA(), NULL, NULL, TRUE, CREATE_BREAKAWAY_FROM_JOB|CREATE_NEW_PROCESS_GROUP|CREATE_SUSPENDED, NULL, NULL, &startup_info, &proc_info))
      CroakErrno("CreateProcess() failed");

    AssignProcessToJobObject(job_handle, proc_info.hProcess);
    ResumeThread(proc_info.hThread);

    WaitForSingleObject(proc_info.hProcess, INFINITE);

    DWORD exit_code = 1;
    GetExitCodeProcess(proc_info.hProcess, &exit_code);

    CloseHandle(proc_info.hThread);
    CloseHandle(proc_info.hProcess);
    ExitProcess(exit_code);
  }
  else if (const char* handle_str = getenv("_TUNDRA2_PARENT_PROCESS_HANDLE"))
  {
    HANDLE h = (HANDLE) _strtoi64(handle_str, NULL, 16);
    SignalHandlerInitWithParentProcess(h);
  }
  else
  {
    SignalHandlerInit();
  }
#else
  SignalHandlerInit();
#endif

  uint64_t start_time = TimerGet();

  ExecInit(options.m_ThreadCount);

  if (options.m_WorkingDir)
  {
    if (!SetCwd(options.m_WorkingDir))
      Croak("couldn't change directory to %s", options.m_WorkingDir);
  }

  if (options.m_ShowHelp)
  {
    ShowHelp();
    return 0;
  }

  // Initialize logging
  int log_flags = kWarning | kError;

  if (options.m_DebugMessages)
    log_flags |= kInfo | kDebug;

  if (options.m_SpammyVerbose)
    log_flags |= kSpam | kInfo | kDebug;

  SetLogFlags(log_flags);

  if (options.m_IdeGen)
  {
    // FIXME: How to detect build file for other type of generators?
    GenerateIdeIntegrationFiles("tundra.lua", argc, (const char**) argv);
    return 0;
  }

  if (options.m_QuickstartGen)
  {
    GenerateTemplateFiles(argc, (const char**) argv);
    return 0;
  }

  // Protect against running two or more instances simultaneously in the same directory.
  // This can happen if Visual Studio is trying to launch more than one copy of tundra.
#if defined(TUNDRA_WIN32)
  {
    char mutex_name[MAX_PATH];
    char cwd[MAX_PATH];
    char cwd_nerfed[MAX_PATH];
    GetCwd(cwd, sizeof cwd);
    const char *i = cwd;
    char *o = cwd_nerfed;
    char ch;
    do
    {
      ch = *i++;
      switch (ch)
      {
      case '\\':
      case ':':
        ch = '^';
        break;
      }
      *o++ = ch;
    } while(ch);

    _snprintf(mutex_name, sizeof mutex_name, "Global\\Tundra--%s-%s", cwd_nerfed, options.m_DAGFileName);
    mutex_name[sizeof(mutex_name)-1] = '\0';
    bool warning_printed = false;
    HANDLE mutex = CreateMutexA(nullptr, false, mutex_name);

    while (WAIT_TIMEOUT == WaitForSingleObject(mutex, 100))
    {
      if (!warning_printed)
      {
        Log(kWarning, "More than one copy of Tundra running in %s -- PID %u waiting", cwd, GetCurrentProcessId());
        warning_printed = true;
      }
      Sleep(100);
    }

    Log(kDebug, "PID %u successfully locked %s", GetCurrentProcessId(), cwd);
  }
#endif

  // Initialize driver
  if (!DriverInit(&driver, &options))
    return 1;

  // Initialize profiler if needed
  if (driver.m_Options.m_ProfileOutput)
    ProfilerInit(driver.m_Options.m_ProfileOutput, driver.m_Options.m_ThreadCount);


  BuildResult::Enum build_result = BuildResult::kSetupError;

  if (!DriverInitData(&driver))
    goto leave;

  if (driver.m_Options.m_GenDagOnly)
  {
    Log(kDebug, "Only generating DAG - quitting");
    build_result = BuildResult::kOk;
    goto leave;
  }

  if (driver.m_Options.m_ShowTargets)
  {
    DriverShowTargets(&driver);
    Log(kDebug, "Only showing targets - quitting");
    build_result = BuildResult::kOk;
    goto leave;
  }

  DriverRemoveStaleOutputs(&driver);

  // Prepare list of nodes to build/clean/rebuild
  if (!DriverPrepareNodes(&driver, (const char**) argv, argc))
  {
    Log(kError, "couldn't set up list of targets to build");
    goto leave;
  }

  if (driver.m_Options.m_Clean || driver.m_Options.m_Rebuild)
  {
    DriverCleanOutputs(&driver);

    if (!driver.m_Options.m_Rebuild)
    {
      build_result = BuildResult::kOk;
      goto leave;
    }
  }

  build_result = DriverBuild(&driver);

  if (!DriverSaveBuildState(&driver))
    Log(kError, "Couldn't save build state");

  if (!DriverSaveScanCache(&driver))
    Log(kWarning, "Couldn't save header scanning cache");

  if (!DriverSaveDigestCache(&driver))
    Log(kWarning, "Couldn't save SHA1 digest cache");

leave:
  DriverDestroy(&driver);

  // Dump/close profiler
  if (driver.m_Options.m_ProfileOutput)
    ProfilerDestroy();

  // Dump stats
  if (options.m_DisplayStats)
  {
    printf("output cleanup:    %10.2f ms\n", TimerToSeconds(g_Stats.m_StaleCheckTimeCycles) * 1000.0);
    printf("json parse time:   %10.2f ms\n", TimerToSeconds(g_Stats.m_JsonParseTimeCycles) * 1000.0);
    printf("scan cache:\n");
    printf("  hits (new):      %10u\n", g_Stats.m_NewScanCacheHits);
    printf("  hits (frozen):   %10u\n", g_Stats.m_OldScanCacheHits);
    printf("  misses:          %10u\n", g_Stats.m_ScanCacheMisses);
    printf("  inserts:         %10u\n", g_Stats.m_ScanCacheInserts);
    printf("  save time:       %10.2f ms\n", TimerToSeconds(g_Stats.m_ScanCacheSaveTime) * 1000.0);
    printf("  entries dropped: %10u\n", g_Stats.m_ScanCacheEntriesDropped);
    printf("file signing:\n");
    printf("  cache hits:      %10u\n", g_Stats.m_DigestCacheHits);
    printf("  cache get time:  %10.2f ms\n", TimerToSeconds(g_Stats.m_DigestCacheGetTimeCycles) * 1000.0);
    printf("  cache save time: %10.2f ms\n", TimerToSeconds(g_Stats.m_DigestCacheSaveTimeCycles) * 1000.0);
    printf("  digests:         %10u\n", g_Stats.m_FileDigestCount);
    printf("  digest time:     %10.2f ms\n", TimerToSeconds(g_Stats.m_FileDigestTimeCycles) * 1000.0);
    printf("stat cache:\n");
    printf("  hits:            %10u\n", g_Stats.m_StatCacheHits);
    printf("  misses:          %10u\n", g_Stats.m_StatCacheMisses);
    printf("  dirty:           %10u\n", g_Stats.m_StatCacheDirty);
    printf("building:\n");
    printf("  old records:     %10u\n", g_Stats.m_StateSaveOld);
    printf("  new records:     %10u\n", g_Stats.m_StateSaveNew);
    printf("  dropped records: %10u\n", g_Stats.m_StateSaveDropped);
    printf("  state save time: %10.2f ms\n", TimerToSeconds(g_Stats.m_StateSaveTimeCycles) * 1000.0);
    printf("  exec() count:    %10u\n", g_Stats.m_ExecCount);
    printf("  exec() time:     %10.2f s\n", TimerToSeconds(g_Stats.m_ExecTimeCycles));
    printf("low-level syscalls:\n");
    printf("  mmap() calls:    %10u\n", g_Stats.m_MmapCalls);
    printf("  mmap() time:     %10.2f ms\n", TimerToSeconds(g_Stats.m_MmapTimeCycles) * 1000.0);
    printf("  munmap() calls:  %10u\n", g_Stats.m_MunmapCalls);
    printf("  munmap() time:   %10.2f ms\n", TimerToSeconds(g_Stats.m_MunmapTimeCycles) * 1000.0);
    printf("  stat() calls:    %10u\n", g_Stats.m_StatCount);
    printf("  stat() time:     %10.2f ms\n", TimerToSeconds(g_Stats.m_StatTimeCycles) * 1000.0);
  }

  if (!options.m_Quiet)
  {
    double total_time = TimerDiffSeconds(start_time, TimerGet());
    if (total_time < 60.0)
    {
      printf("*** %s (%.2f seconds)\n", BuildResult::Names[build_result], total_time);
    }
    else
    {
      int t = (int)total_time;
      int h = t / 3600; t -= h * 3600;
      int m = t / 60; t -= m * 60;
      int s = t;
      printf("*** %s (%.2f seconds - %d:%02d:%02d)\n", BuildResult::Names[build_result], total_time, h, m, s);
    }
  }

  return build_result == BuildResult::kOk ? 0 : 1;

  // Match up nodes to nodes in the build state
  //   Walk DAG node array in parallel with build state node array
  //   If a node is not present in the DAG but is in the old build state:
  //     Loop over its outputs and delete them
  // For all DAG nodes:
  //   Loop over their aux output references and flag them as in use
  //
  // Loop over aux outputs in union of (build state | dag)
  //   Delete file if it is not flagged as in use
  //
  // Clean up empty output directories:
  //   If any file was deleted due to cleanup:
  //     Walk all directories known to be created and rmdir() them
  //      (If any valid files are left in there we'll get an error and move on)
  //
  // Find out what nodes we want to build this time (match command line args against DAG info)
  //
  //   Construct config set:
  //     If config list on cmdline is empty, use default config
  //     Otherwise, look up each config and add to set
  //
  //   For each alias on the command line:
  //      Add the set of nodes referenced by the alias to the build queue
  //        Filtered by config set
  //
  //   If set of nodes to build is empty:
  //     Add all default sets (filter by config set) to the build queue
  //
  // Set up node state for each node to build
  //
  // Set up nodes for pass barriers
  //
  // Build
  //
  // Generate build state data
  //
  // Save header scanning state
  // Report stats
  // Exit
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x488, %rsp            # imm = 0x488
movq %rsi, %r12
movl %edi, %r13d
callq 0x5a60
leaq 0x10(%rsp), %rdi
callq 0x921a
movl $0x1, %r14d
cmpl $0x2, %r13d
jl 0x3b32
movl $0x1, %r14d
leaq 0x19081(%rip), %rbp     # 0x1ca90
movl %r13d, 0xc(%rsp)
movq %r12, (%rsp)
movl %r14d, %eax
movq (%r12,%rax,8), %r12
cmpb $0x2d, (%r12)
jne 0x3b2e
movb 0x1(%r12), %al
cmpb $0x2d, %al
jne 0x3a54
movq %r12, %rdi
movl $0x3d, %esi
callq 0x3130
movq %rax, %rbx
testq %rax, %rax
je 0x3a9f
movq %rbx, %r13
subq %r12, %r13
addq $-0x2, %r13
jmp 0x3aac
leal 0x1(%r14), %ecx
cmpl %r13d, %ecx
jge 0x3a69
movl %ecx, %ecx
movq (%rsp), %rdx
movq (%rdx,%rcx,8), %rdx
jmp 0x3a6b
xorl %edx, %edx
cmpb $0x0, 0x2(%r12)
jne 0x40f1
xorl %esi, %esi
cmpb (%rsi,%rbp), %al
je 0x3a90
addq $0x28, %rsi
cmpq $0x320, %rsi            # imm = 0x320
jne 0x3a79
jmp 0x410c
addq %rbp, %rsi
leaq 0x10(%rsp), %rdi
movl $0x1, %ecx
jmp 0x3b0a
leaq 0x2(%r12), %rdi
callq 0x3150
movq %rax, %r13
leaq 0x1(%rbx), %rax
testq %rbx, %rbx
cmoveq %rbx, %rax
movq %rax, 0x40(%rsp)
addq $0x2, %r12
xorl %ebx, %ebx
movq 0x8(%rbx,%rbp), %r15
movq %r15, %rdi
callq 0x3150
cmpq %r13, %rax
jne 0x3ae6
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x3360
testl %eax, %eax
je 0x3af8
addq $0x28, %rbx
cmpq $0x320, %rbx            # imm = 0x320
jne 0x3ac2
jmp 0x410c
addq %rbp, %rbx
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq 0x40(%rsp), %rdx
xorl %ecx, %ecx
callq 0x4272
testl %eax, %eax
je 0x410c
addl %eax, %r14d
movl 0xc(%rsp), %r13d
cmpl %r13d, %r14d
movq (%rsp), %r12
jl 0x3a18
jmp 0x3b32
movq (%rsp), %r12
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x9200
callq 0x1144e
callq 0x5f2a
movq %rax, %rbx
movl 0x10(%r15), %edi
callq 0x11fec
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x3b6b
callq 0x5ea7
testb %al, %al
je 0x4128
cmpb $0x1, 0x10(%rsp)
jne 0x3b79
callq 0x413b
jmp 0x3bd4
subl %r14d, %r13d
cmpb $0x0, 0x14(%rsp)
movl $0xf, %eax
movl $0x3, %ecx
cmovnel %eax, %ecx
movslq %r14d, %rax
cmpb $0x0, 0x16(%rsp)
leaq (%r12,%rax,8), %r15
movl $0x1f, %edi
cmovel %ecx, %edi
callq 0x5d6d
cmpb $0x1, 0x1a(%rsp)
jne 0x3bc2
leaq 0x114bb(%rip), %rdi     # 0x15070
movl %r13d, %esi
movq %r15, %rdx
callq 0x6921
jmp 0x3bd4
cmpb $0x1, 0x1f(%rsp)
jne 0x3bdb
movl %r13d, %edi
movq %r15, %rsi
callq 0x6aae
xorl %eax, %eax
jmp 0x4116
leaq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xa277
movl %eax, %ecx
movl $0x1, %eax
testb %cl, %cl
je 0x4116
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x3c12
movl 0x110(%rsp), %esi
callq 0xefe4
leaq 0x48(%rsp), %rdi
callq 0x945e
movl $0x3, %ebp
testb %al, %al
je 0x3c65
cmpb $0x1, 0x108(%rsp)
jne 0x3c38
leaq 0x11445(%rip), %rsi     # 0x1507b
jmp 0x3c57
cmpb $0x1, 0x103(%rsp)
jne 0x401a
leaq 0x48(%rsp), %rdi
callq 0x9243
leaq 0x11443(%rip), %rsi     # 0x1509a
xorl %ebp, %ebp
movl $0x8, %edi
xorl %eax, %eax
callq 0x5d74
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0xa39b
cmpq $0x0, 0xe0(%r14)
je 0x3c81
callq 0xf329
cmpb $0x1, 0x17(%rsp)
jne 0x3f67
leaq 0x1990d(%rip), %r15     # 0x1d5a0
movq 0x80(%r15), %rdi
callq 0x5f5f
mulsd 0x11399(%rip), %xmm0    # 0x15040
leaq 0x11493(%rip), %rdi     # 0x15141
movb $0x1, %al
callq 0x3060
movq 0x98(%r15), %rdi
callq 0x5f5f
mulsd 0x11377(%rip), %xmm0    # 0x15040
leaq 0x1148f(%rip), %rdi     # 0x1515f
movb $0x1, %al
callq 0x3060
leaq 0x11b38(%rip), %rdi     # 0x15816
callq 0x3540
movl (%r15), %esi
leaq 0x11490(%rip), %rdi     # 0x1517d
xorl %eax, %eax
callq 0x3060
movl 0x4(%r15), %esi
leaq 0x11497(%rip), %rdi     # 0x15196
xorl %eax, %eax
callq 0x3060
movl 0x8(%r15), %esi
leaq 0x1149e(%rip), %r14     # 0x151af
movq %r14, %rdi
xorl %eax, %eax
callq 0x3060
movl 0xc(%r15), %esi
leaq 0x114a2(%rip), %rdi     # 0x151c8
xorl %eax, %eax
callq 0x3060
movq 0x10(%r15), %rdi
callq 0x5f5f
mulsd 0x11302(%rip), %xmm0    # 0x15040
leaq 0x1149c(%rip), %rdi     # 0x151e1
movb $0x1, %al
callq 0x3060
movl 0x18(%r15), %esi
leaq 0x114a8(%rip), %rdi     # 0x151ff
xorl %eax, %eax
callq 0x3060
leaq 0x11abd(%rip), %rdi     # 0x15822
callq 0x3540
movl 0xb0(%r15), %esi
leaq 0x114a0(%rip), %rdi     # 0x15218
xorl %eax, %eax
callq 0x3060
movq 0xa8(%r15), %rdi
callq 0x5f5f
mulsd 0x112ad(%rip), %xmm0    # 0x15040
leaq 0x11497(%rip), %rdi     # 0x15231
movb $0x1, %al
callq 0x3060
movq 0xa0(%r15), %rdi
callq 0x5f5f
mulsd 0x1128b(%rip), %xmm0    # 0x15040
leaq 0x11493(%rip), %rdi     # 0x1524f
movb $0x1, %al
callq 0x3060
movl 0xb4(%r15), %esi
leaq 0x1149c(%rip), %rdi     # 0x1526d
xorl %eax, %eax
callq 0x3060
movq 0xb8(%r15), %rdi
callq 0x5f5f
mulsd 0x11254(%rip), %xmm0    # 0x15040
leaq 0x11493(%rip), %rdi     # 0x15286
movb $0x1, %al
callq 0x3060
leaq 0x11a2f(%rip), %rdi     # 0x15830
callq 0x3540
movl 0x70(%r15), %esi
leaq 0x11493(%rip), %rdi     # 0x152a4
xorl %eax, %eax
callq 0x3060
movl 0x74(%r15), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x3060
movl 0x78(%r15), %esi
leaq 0x1148c(%rip), %rdi     # 0x152bd
xorl %eax, %eax
callq 0x3060
leaq 0x119fd(%rip), %rdi     # 0x1583c
callq 0x3540
movl 0x20(%r15), %esi
leaq 0x11487(%rip), %rdi     # 0x152d6
xorl %eax, %eax
callq 0x3060
movl 0x1c(%r15), %esi
leaq 0x1148e(%rip), %rdi     # 0x152ef
xorl %eax, %eax
callq 0x3060
movl 0x24(%r15), %esi
leaq 0x11495(%rip), %rdi     # 0x15308
xorl %eax, %eax
callq 0x3060
movq 0x28(%r15), %rdi
callq 0x5f5f
mulsd 0x111b5(%rip), %xmm0    # 0x15040
leaq 0x1148f(%rip), %rdi     # 0x15321
movb $0x1, %al
callq 0x3060
movl 0x88(%r15), %esi
leaq 0x11498(%rip), %rdi     # 0x1533f
xorl %eax, %eax
callq 0x3060
movq 0x90(%r15), %rdi
callq 0x5f5f
leaq 0x11497(%rip), %rdi     # 0x15358
movb $0x1, %al
callq 0x3060
leaq 0x11977(%rip), %rdi     # 0x15846
callq 0x3540
movl 0x30(%r15), %esi
leaq 0x11496(%rip), %rdi     # 0x15375
xorl %eax, %eax
callq 0x3060
movq 0x38(%r15), %rdi
callq 0x5f5f
mulsd 0x11149(%rip), %xmm0    # 0x15040
leaq 0x11490(%rip), %rdi     # 0x1538e
movb $0x1, %al
callq 0x3060
movl 0x40(%r15), %esi
leaq 0x1149c(%rip), %rdi     # 0x153ac
xorl %eax, %eax
callq 0x3060
movq 0x48(%r15), %rdi
callq 0x5f5f
mulsd 0x11118(%rip), %xmm0    # 0x15040
leaq 0x11496(%rip), %rdi     # 0x153c5
movb $0x1, %al
callq 0x3060
movl 0x60(%r15), %esi
leaq 0x114a2(%rip), %rdi     # 0x153e3
xorl %eax, %eax
callq 0x3060
movq 0x68(%r15), %rdi
callq 0x5f5f
mulsd 0x110e7(%rip), %xmm0    # 0x15040
leaq 0x1149c(%rip), %rdi     # 0x153fc
movb $0x1, %al
callq 0x3060
cmpb $0x0, 0x19(%rsp)
jne 0x400e
callq 0x5f2a
movq %rbx, %rdi
movq %rax, %rsi
callq 0x5f89
movsd 0x110be(%rip), %xmm1    # 0x15048
ucomisd %xmm0, %xmm1
jbe 0x3fad
movl %ebp, %eax
leaq 0x193b7(%rip), %rcx     # 0x1d350
movq (%rcx,%rax,8), %rsi
leaq 0x11476(%rip), %rdi     # 0x1541a
movb $0x1, %al
callq 0x3060
jmp 0x400e
cvttsd2si %xmm0, %eax
cltq
imulq $-0x6e5d4c3b, %rax, %rdx # imm = 0x91A2B3C5
shrq $0x20, %rdx
addl %eax, %edx
movl %edx, %ecx
shrl $0x1f, %ecx
sarl $0xb, %edx
addl %ecx, %edx
imull $0xfffff1f0, %edx, %ecx # imm = 0xFFFFF1F0
addl %eax, %ecx
movslq %ecx, %rax
imulq $-0x77777777, %rax, %rcx # imm = 0x88888889
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %esi
shrl $0x1f, %esi
sarl $0x5, %ecx
addl %esi, %ecx
imull $-0x3c, %ecx, %r8d
addl %eax, %r8d
movl %ebp, %eax
leaq 0x19354(%rip), %rsi     # 0x1d350
movq (%rsi,%rax,8), %rsi
leaq 0x1142a(%rip), %rdi     # 0x15431
movb $0x1, %al
callq 0x3060
xorl %eax, %eax
testl %ebp, %ebp
setne %al
jmp 0x4116
leaq 0x48(%rsp), %r12
movq %r12, %rdi
callq 0xae93
movq %r12, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x9928
testb %al, %al
je 0x40e0
cmpb $0x0, 0x10b(%rsp)
jne 0x4051
cmpb $0x1, 0x10c(%rsp)
jne 0x406e
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0xb485
xorl %ebp, %ebp
cmpb $0x1, 0xc4(%r14)
jne 0x3c65
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0xa468
movl %eax, %ebp
movq %r14, %rdi
callq 0xa808
testb %al, %al
jne 0x409c
leaq 0x11053(%rip), %rsi     # 0x150e3
movl $0x1, %edi
xorl %eax, %eax
callq 0x5d74
leaq 0x48(%rsp), %rdi
callq 0xa732
testb %al, %al
jne 0x40bd
leaq 0x1104c(%rip), %rsi     # 0x150fd
movl $0x2, %edi
xorl %eax, %eax
callq 0x5d74
leaq 0x48(%rsp), %rdi
callq 0xa7cc
testb %al, %al
jne 0x3c65
leaq 0x1104b(%rip), %rsi     # 0x15121
movl $0x2, %edi
jmp 0x3c5e
leaq 0x10fd3(%rip), %rsi     # 0x150ba
movl $0x1, %edi
jmp 0x3c5e
movq 0x18ee0(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x11355(%rip), %rsi     # 0x15457
movq %r12, %rdx
xorl %eax, %eax
callq 0x3480
callq 0x413b
movl $0x1, %eax
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rsp), %rsi
leaq 0x10f1c(%rip), %rdi     # 0x15050
xorl %eax, %eax
callq 0x5a61