// File: /workspace/github_c_makefile_star2_O2/janet-lang[P]janet/src/core/os.c
// Function: os_execute_impl
static Janet os_execute_impl(int32_t argc, Janet *argv, JanetExecuteMode mode) {
    janet_sandbox_assert(JANET_SANDBOX_SUBPROCESS);
    janet_arity(argc, 1, 3);

    /* Get flags */
    int is_spawn = mode == JANET_EXECUTE_SPAWN;
    uint64_t flags = 0;
    if (argc > 1) {
        flags = janet_getflags(argv, 1, "epxd");
    }

    /* Get environment */
    int use_environ = !janet_flag_at(flags, 0);
    EnvBlock envp = os_execute_env(argc, argv);

    /* Get arguments */
    JanetView exargs = janet_getindexed(argv, 0);
    if (exargs.len < 1) {
        janet_panic("expected at least 1 command line argument");
    }

    /* Optional stdio redirections */
    JanetAbstract orig_in = NULL, orig_out = NULL, orig_err = NULL;
    JanetHandle new_in = JANET_HANDLE_NONE, new_out = JANET_HANDLE_NONE, new_err = JANET_HANDLE_NONE;
    JanetHandle pipe_in = JANET_HANDLE_NONE, pipe_out = JANET_HANDLE_NONE, pipe_err = JANET_HANDLE_NONE;
    int stderr_is_stdout = 0;
    int pipe_errflag = 0; /* Track errors setting up pipes */
    int pipe_owner_flags = (is_spawn && (flags & 0x8)) ? JANET_PROC_ALLOW_ZOMBIE : 0;

    /* Get optional redirections */
    if (argc > 2 && (mode != JANET_EXECUTE_EXEC)) {
        JanetDictView tab = janet_getdictionary(argv, 2);
        Janet maybe_stdin = janet_dictionary_get(tab.kvs, tab.cap, janet_ckeywordv("in"));
        Janet maybe_stdout = janet_dictionary_get(tab.kvs, tab.cap, janet_ckeywordv("out"));
        Janet maybe_stderr = janet_dictionary_get(tab.kvs, tab.cap, janet_ckeywordv("err"));
        if (is_spawn && janet_keyeq(maybe_stdin, "pipe")) {
            new_in = make_pipes(&pipe_in, 1, &pipe_errflag);
            pipe_owner_flags |= JANET_PROC_OWNS_STDIN;
        } else if (!janet_checktype(maybe_stdin, JANET_NIL)) {
            new_in = janet_getjstream(&maybe_stdin, 0, &orig_in);
        }
        if (is_spawn && janet_keyeq(maybe_stdout, "pipe")) {
            new_out = make_pipes(&pipe_out, 0, &pipe_errflag);
            pipe_owner_flags |= JANET_PROC_OWNS_STDOUT;
        } else if (!janet_checktype(maybe_stdout, JANET_NIL)) {
            new_out = janet_getjstream(&maybe_stdout, 0, &orig_out);
        }
        if (is_spawn && janet_keyeq(maybe_stderr, "pipe")) {
            new_err = make_pipes(&pipe_err, 0, &pipe_errflag);
            pipe_owner_flags |= JANET_PROC_OWNS_STDERR;
        } else if (is_spawn && janet_keyeq(maybe_stderr, "out")) {
            stderr_is_stdout = 1;
        } else if (!janet_checktype(maybe_stderr, JANET_NIL)) {
            new_err = janet_getjstream(&maybe_stderr, 0, &orig_err);
        }
    }

    /* Optional working directory. Available for both os/execute and os/spawn. */
    const char *chdir_path = NULL;
    if (argc > 2) {
        JanetDictView tab = janet_getdictionary(argv, 2);
        Janet workdir = janet_dictionary_get(tab.kvs, tab.cap, janet_ckeywordv("cd"));
        if (janet_checktype(workdir, JANET_STRING)) {
            chdir_path = (const char *) janet_unwrap_string(workdir);
#ifndef JANET_SPAWN_CHDIR
            janet_panicf(":cd argument not supported on this system - %s", chdir_path);
#endif
        } else if (!janet_checktype(workdir, JANET_NIL)) {
            janet_panicf("expected string for :cd argumnet, got %v", workdir);
        }
    }

    /* Clean up if any of the pipes have any issues */
    if (pipe_errflag) {
        if (pipe_in != JANET_HANDLE_NONE) close_handle(pipe_in);
        if (pipe_out != JANET_HANDLE_NONE) close_handle(pipe_out);
        if (pipe_err != JANET_HANDLE_NONE) close_handle(pipe_err);
        janet_panic("failed to create pipes");
    }

#ifdef JANET_WINDOWS

    HANDLE pHandle, tHandle;
    SECURITY_ATTRIBUTES saAttr;
    PROCESS_INFORMATION processInfo;
    STARTUPINFO startupInfo;
    LPCSTR lpCurrentDirectory = NULL;
    memset(&saAttr, 0, sizeof(saAttr));
    memset(&processInfo, 0, sizeof(processInfo));
    memset(&startupInfo, 0, sizeof(startupInfo));
    startupInfo.cb = sizeof(startupInfo);
    startupInfo.dwFlags |= STARTF_USESTDHANDLES;
    saAttr.nLength = sizeof(saAttr);

    JanetBuffer *buf = os_exec_escape(exargs);
    if (buf->count > 8191) {
        if (pipe_in != JANET_HANDLE_NONE) CloseHandle(pipe_in);
        if (pipe_out != JANET_HANDLE_NONE) CloseHandle(pipe_out);
        if (pipe_err != JANET_HANDLE_NONE) CloseHandle(pipe_err);
        janet_panic("command line string too long (max 8191 characters)");
    }
    const char *path = (const char *) janet_unwrap_string(exargs.items[0]);

    if (chdir_path != NULL) {
        lpCurrentDirectory = chdir_path;
    }

    /* Do IO redirection */

    if (pipe_in != JANET_HANDLE_NONE) {
        startupInfo.hStdInput = pipe_in;
    } else if (new_in != JANET_HANDLE_NONE) {
        startupInfo.hStdInput = new_in;
    } else {
        startupInfo.hStdInput = (HANDLE) _get_osfhandle(_fileno(stdin));
    }

    if (pipe_out != JANET_HANDLE_NONE) {
        startupInfo.hStdOutput = pipe_out;
    } else if (new_out != JANET_HANDLE_NONE) {
        startupInfo.hStdOutput = new_out;
    } else {
        startupInfo.hStdOutput = (HANDLE) _get_osfhandle(_fileno(stdout));
    }

    if (pipe_err != JANET_HANDLE_NONE) {
        startupInfo.hStdError = pipe_err;
    } else if (new_err != NULL) {
        startupInfo.hStdError = new_err;
    } else if (stderr_is_stdout) {
        startupInfo.hStdError = startupInfo.hStdOutput;
    } else {
        startupInfo.hStdError = (HANDLE) _get_osfhandle(_fileno(stderr));
    }

    int cp_failed = 0;
    if (!CreateProcess(janet_flag_at(flags, 1) ? NULL : path,
                       (char *) buf->data, /* Single CLI argument */
                       &saAttr, /* no proc inheritance */
                       &saAttr, /* no thread inheritance */
                       TRUE, /* handle inheritance */
                       0, /* flags */
                       use_environ ? NULL : envp, /* pass in environment */
                       lpCurrentDirectory,
                       &startupInfo,
                       &processInfo)) {
        cp_failed = 1;
    }

    if (pipe_in != JANET_HANDLE_NONE) CloseHandle(pipe_in);
    if (pipe_out != JANET_HANDLE_NONE) CloseHandle(pipe_out);
    if (pipe_err != JANET_HANDLE_NONE) CloseHandle(pipe_err);

    os_execute_cleanup(envp, NULL);

    if (cp_failed)  {
        janet_panic("failed to create process");
    }

    pHandle = processInfo.hProcess;
    tHandle = processInfo.hThread;

#else

    /* Result */
    int status = 0;

    const char **child_argv = janet_smalloc(sizeof(char *) * ((size_t) exargs.len + 1));
    for (int32_t i = 0; i < exargs.len; i++)
        child_argv[i] = janet_getcstring(exargs.items, i);
    child_argv[exargs.len] = NULL;
    /* Coerce to form that works for spawn. I'm fairly confident no implementation
     * of posix_spawn would modify the argv array passed in. */
    char *const *cargv = (char *const *)child_argv;

    if (use_environ) {
        janet_lock_environ();
    }

    /* exec mode */
    if (mode == JANET_EXECUTE_EXEC) {
        int status;
        if (!use_environ) {
            environ = envp;
        }
        do {
            if (janet_flag_at(flags, 1)) {
                status = execvp(cargv[0], cargv);
            } else {
                status = execv(cargv[0], cargv);
            }
        } while (status == -1 && errno == EINTR);
        janet_panicf("%p: %s", cargv[0], janet_strerror(errno ? errno : ENOENT));
    }

    /* Use posix_spawn to spawn new process */

    /* Posix spawn setup */
    posix_spawn_file_actions_t actions;
    posix_spawn_file_actions_init(&actions);
#ifdef JANET_SPAWN_CHDIR
    if (chdir_path != NULL) {
#ifdef JANET_SPAWN_CHDIR_NO_NP
        posix_spawn_file_actions_addchdir(&actions, chdir_path);
#else
        posix_spawn_file_actions_addchdir_np(&actions, chdir_path);
#endif
    }
#endif
    if (pipe_in != JANET_HANDLE_NONE) {
        posix_spawn_file_actions_adddup2(&actions, pipe_in, 0);
        posix_spawn_file_actions_addclose(&actions, pipe_in);
    } else if (new_in != JANET_HANDLE_NONE && new_in != 0) {
        posix_spawn_file_actions_adddup2(&actions, new_in, 0);
        if (new_in != new_out && new_in != new_err)
            posix_spawn_file_actions_addclose(&actions, new_in);
    }
    if (pipe_out != JANET_HANDLE_NONE) {
        posix_spawn_file_actions_adddup2(&actions, pipe_out, 1);
        posix_spawn_file_actions_addclose(&actions, pipe_out);
    } else if (new_out != JANET_HANDLE_NONE && new_out != 1) {
        posix_spawn_file_actions_adddup2(&actions, new_out, 1);
        if (new_out != new_err)
            posix_spawn_file_actions_addclose(&actions, new_out);
    }
    if (pipe_err != JANET_HANDLE_NONE) {
        posix_spawn_file_actions_adddup2(&actions, pipe_err, 2);
        posix_spawn_file_actions_addclose(&actions, pipe_err);
    } else if (new_err != JANET_HANDLE_NONE && new_err != 2) {
        posix_spawn_file_actions_adddup2(&actions, new_err, 2);
        posix_spawn_file_actions_addclose(&actions, new_err);
    } else if (stderr_is_stdout) {
        posix_spawn_file_actions_adddup2(&actions, 1, 2);
    }

    pid_t pid;
    if (janet_flag_at(flags, 1)) {
        status = posix_spawnp(&pid,
                              child_argv[0], &actions, NULL, cargv,
                              use_environ ? environ : envp);
    } else {
        status = posix_spawn(&pid,
                             child_argv[0], &actions, NULL, cargv,
                             use_environ ? environ : envp);
    }

    posix_spawn_file_actions_destroy(&actions);

    if (pipe_in != JANET_HANDLE_NONE) close(pipe_in);
    if (pipe_out != JANET_HANDLE_NONE) close(pipe_out);
    if (pipe_err != JANET_HANDLE_NONE) close(pipe_err);

    if (use_environ) {
        janet_unlock_environ();
    }

    os_execute_cleanup(envp, child_argv);
    if (status) {
        /* correct for macos bug where errno is not set */
        janet_panicf("%p: %s", argv[0], janet_strerror(errno ? errno : ENOENT));
    }

#endif
    JanetProc *proc = janet_abstract(&ProcAT, sizeof(JanetProc));
    proc->return_code = -1;
#ifdef JANET_WINDOWS
    proc->pHandle = pHandle;
    proc->tHandle = tHandle;
#else
    proc->pid = pid;
#endif
    proc->in = NULL;
    proc->out = NULL;
    proc->err = NULL;
    proc->flags = pipe_owner_flags;
    if (janet_flag_at(flags, 2)) {
        proc->flags |= JANET_PROC_ERROR_NONZERO;
    }
    if (is_spawn) {
        /* Only set up pointers to stdin, stdout, and stderr if os/spawn. */
        if (new_in != JANET_HANDLE_NONE) {
            proc->in = get_stdio_for_handle(new_in, orig_in, 1);
            if (NULL == proc->in) janet_panic("failed to construct proc");
        }
        if (new_out != JANET_HANDLE_NONE) {
            proc->out = get_stdio_for_handle(new_out, orig_out, 0);
            if (NULL == proc->out) janet_panic("failed to construct proc");
        }
        if (new_err != JANET_HANDLE_NONE) {
            proc->err = get_stdio_for_handle(new_err, orig_err, 0);
            if (NULL == proc->err) janet_panic("failed to construct proc");
        }
        return janet_wrap_abstract(proc);
    } else {
#ifdef JANET_EV
        os_proc_wait_impl(proc);
#else
        return os_proc_wait_impl(proc);
#endif
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %r15d
pushq $0x2
popq %rdi
callq 0x4af2d
pushq $0x1
popq %rsi
pushq $0x3
popq %rdx
movl %r15d, %edi
callq 0x1781a
movabsq $-0x6000000000000, %r12 # imm = 0xFFFA000000000000
cmpl $0x2, %r15d
movl %ebx, -0x3c(%rbp)
movq %r14, -0x78(%rbp)
movl %r15d, -0x30(%rbp)
jl 0x32e32
leaq 0x2f83e(%rip), %rdx     # 0x624ff
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x1855d
movq %rax, -0x80(%rbp)
testb $0x1, %al
sete -0x29(%rbp)
cmpl $0x2, %r15d
je 0x32e3e
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x1829b
movq %rax, %rbx
movq %rdx, %r14
movslq %r14d, %rax
leaq 0x8(,%rax,8), %rdi
callq 0x29673
xorl %esi, %esi
movq %r14, %rdx
movq %rax, -0x58(%rbp)
shrq $0x20, %rdx
testl %edx, %edx
cmovlel %esi, %edx
xorl %r13d, %r13d
movabsq $-0x800000000000, %rcx  # imm = 0xFFFF800000000000
movq %rdx, -0x50(%rbp)
movq %rbx, -0x38(%rbp)
movslq %esi, %r15
cmpq %rdx, %r13
je 0x32e48
movq %r13, %r14
shlq $0x4, %r14
movq (%rbx,%r14), %rdi
movq %rdi, %rax
andq %rcx, %rax
cmpq %r12, %rax
jne 0x32e2a
addq %rbx, %r14
movq 0x8(%r14), %rax
andq %rcx, %rax
cmpq %r12, %rax
jne 0x32e2a
movq %rsi, %rbx
callq 0x4b1f1
movq %rax, %r12
movq 0x8(%r14), %rdi
callq 0x4b1f1
movq %rbx, %rsi
movq -0x38(%rbp), %rbx
movslq -0x8(%r12), %r14
movslq -0x8(%rax), %rdi
testl %r14d, %r14d
movl $0x0, %r8d
cmovgl %r14d, %r8d
xorl %ecx, %ecx
cmpq %rcx, %r8
je 0x32dac
movzbl (%r12,%rcx), %edx
testl %edx, %edx
je 0x32e12
cmpl $0x3d, %edx
je 0x32e12
incq %rcx
jmp 0x32d94
movq %rdi, -0x70(%rbp)
addq %r14, %rdi
addq $0x2, %rdi
movq %rax, -0xa8(%rbp)
callq 0x29673
movq %rax, -0x48(%rbp)
movq %rax, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x12670
movq -0x48(%rbp), %rax
leaq (%rax,%r14), %rdi
incq %rdi
movb $0x3d, -0x1(%rdi)
movq -0xa8(%rbp), %rsi
movq -0x70(%rbp), %r12
movq %r12, %rdx
callq 0x12670
leal (%r14,%r12), %eax
cltq
movq -0x48(%rbp), %rcx
movb $0x0, 0x1(%rcx,%rax)
leal 0x1(%r15), %esi
movq -0x58(%rbp), %rax
movq %rcx, (%rax,%r15,8)
movabsq $-0x800000000000, %rcx  # imm = 0xFFFF800000000000
movabsq $-0x6000000000000, %r12 # imm = 0xFFFA000000000000
movq -0x50(%rbp), %rdx
incq %r13
jmp 0x32d28
movb $0x1, -0x29(%rbp)
movq $0x0, -0x80(%rbp)
movq $0x0, -0x58(%rbp)
jmp 0x32e58
movq -0x58(%rbp), %rax
andq $0x0, (%rax,%r15,8)
movl -0x3c(%rbp), %ebx
movq -0x78(%rbp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x18254
testl %edx, %edx
jle 0x33509
movq %rax, %r15
movl %edx, %r13d
cmpl $0x1, %ebx
sete %al
andq $0x0, -0xa0(%rbp)
andq $0x0, -0x98(%rbp)
andq $0x0, -0x90(%rbp)
orl $-0x1, -0x68(%rbp)
orl $-0x1, -0x64(%rbp)
orl $-0x1, -0x60(%rbp)
andl $0x0, -0x5c(%rbp)
movq -0x80(%rbp), %rcx
andl $0x8, %ecx
shrl $0x3, %ecx
andb %al, %cl
movzbl %cl, %eax
shll $0x7, %eax
movl %eax, -0x50(%rbp)
movl -0x30(%rbp), %esi
cmpl $0x3, %esi
setl %al
cmpl $0x2, %ebx
sete %cl
orb %al, %cl
jne 0x32fbd
movl %r13d, -0x48(%rbp)
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x1829b
movq %rax, %r13
movq %rdx, %r12
shrq $0x20, %r12
leaq 0x214c8(%rip), %rdi     # 0x543b2
callq 0x439c6
movq %rax, %rdi
movabsq $-0x5000000000000, %rsi # imm = 0xFFFB000000000000
callq 0x4b366
movq %r13, %rdi
movl %r12d, %esi
movq %rax, %rdx
callq 0x44c2a
movq %rax, %r14
movq %rax, -0x100(%rbp)
leaq 0x27641(%rip), %rdi     # 0x5a561
callq 0x439c6
movq %rax, %rdi
movabsq $-0x5000000000000, %rsi # imm = 0xFFFB000000000000
callq 0x4b366
movq %r13, %rdi
movl %r12d, %esi
movq %rax, %rdx
callq 0x44c2a
movq %rax, -0x38(%rbp)
movq %rax, -0x88(%rbp)
leaq 0x23ac7(%rip), %rdi     # 0x56a1e
callq 0x439c6
movq %rax, %rdi
movabsq $-0x5000000000000, %rsi # imm = 0xFFFB000000000000
callq 0x4b366
movq %r13, %rdi
movl %r12d, %esi
movq %rax, %rdx
callq 0x44c2a
movq %rax, %r13
movq %rax, -0xb0(%rbp)
cmpl $0x1, %ebx
jne 0x32fd8
leaq 0x23a14(%rip), %rsi     # 0x569a6
movq %r14, %rdi
callq 0x17922
testl %eax, %eax
je 0x32fd8
leaq -0x68(%rbp), %rdi
pushq $0x1
popq %rsi
leaq -0x5c(%rbp), %rdx
callq 0x3570f
movl %eax, %r12d
movl -0x50(%rbp), %ebx
orl $0x10, %ebx
movq -0x38(%rbp), %r14
jmp 0x33036
pushq $-0x1
popq %r12
movb $0x1, %al
movl %eax, -0x70(%rbp)
cmpl $0x3, %esi
jl 0x32ffa
movl %r12d, -0x38(%rbp)
movl %r12d, -0x30(%rbp)
jmp 0x33137
movabsq $-0x800000000000, %rcx  # imm = 0xFFFF800000000000
andq %rcx, %r14
movabsq $-0x7800000000000, %rax # imm = 0xFFF8800000000000
cmpq %rax, %r14
jne 0x33009
pushq $-0x1
popq %r12
jmp 0x33029
xorl %ebx, %ebx
movl %r12d, -0x38(%rbp)
movl %r12d, -0x30(%rbp)
jmp 0x331b6
leaq -0x100(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x35762
movabsq $-0x800000000000, %rcx  # imm = 0xFFFF800000000000
movl %eax, %r12d
movq -0x38(%rbp), %r14
cmpl $0x1, -0x3c(%rbp)
movl -0x50(%rbp), %ebx
jne 0x3306a
leaq 0x23969(%rip), %rsi     # 0x569a6
movq %r14, %rdi
callq 0x17922
testl %eax, %eax
je 0x33060
leaq -0x64(%rbp), %rdi
leaq -0x5c(%rbp), %rdx
xorl %esi, %esi
callq 0x3570f
movl %eax, -0x38(%rbp)
orl $0x20, %ebx
jmp 0x3309f
movabsq $-0x800000000000, %rcx  # imm = 0xFFFF800000000000
andq %rcx, %r14
movabsq $-0x7800000000000, %rax # imm = 0xFFF8800000000000
cmpq %rax, %r14
jne 0x33081
pushq $-0x1
popq %rax
jmp 0x33094
leaq -0x88(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x35762
movl %eax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
cmpl $0x1, %eax
jne 0x330f0
leaq 0x23900(%rip), %rsi     # 0x569a6
movq %r13, %rdi
callq 0x17922
testl %eax, %eax
je 0x330ce
leaq -0x60(%rbp), %rdi
leaq -0x5c(%rbp), %rdx
xorl %esi, %esi
callq 0x3570f
orl $0x40, %ebx
movl %ebx, -0x50(%rbp)
movb $0x1, %cl
movl %ecx, -0x70(%rbp)
jmp 0x3312c
leaq 0x2748c(%rip), %rsi     # 0x5a561
movq %r13, %rdi
callq 0x17922
testl %eax, %eax
je 0x330f0
movl %ebx, -0x50(%rbp)
pushq $-0x1
popq %rax
movl $0x0, -0x70(%rbp)
jmp 0x3312c
movl %ebx, -0x50(%rbp)
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq %rax, %r13
movb $0x1, %al
movl %eax, -0x70(%rbp)
movabsq $-0x7800000000000, %rax # imm = 0xFFF8800000000000
cmpq %rax, %r13
jne 0x33119
pushq $-0x1
popq %rax
jmp 0x3312c
leaq -0xb0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x35762
movq -0x78(%rbp), %r14
movl -0x48(%rbp), %r13d
movl %eax, -0x30(%rbp)
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x1829b
movq %rax, %rbx
movq %rdx, %r14
shrq $0x20, %r14
leaq 0x2f1b4(%rip), %rdi     # 0x62307
callq 0x439c6
movq %rax, %rdi
movabsq $-0x5000000000000, %rsi # imm = 0xFFFB000000000000
callq 0x4b366
movq %rbx, %rdi
movl %r14d, %esi
movq %rax, %rdx
callq 0x44c2a
movabsq $-0x800000000000, %rcx  # imm = 0xFFFF800000000000
andq %rax, %rcx
movabsq $-0x7800000000000, %rdx # imm = 0xFFF8800000000000
cmpq %rdx, %rcx
je 0x331b4
movabsq $-0x6000000000000, %rdx # imm = 0xFFFA000000000000
cmpq %rdx, %rcx
jne 0x335dc
movq %rax, %rdi
callq 0x4b1f1
movq %rax, %rbx
jmp 0x331b6
xorl %ebx, %ebx
movq %r12, -0x48(%rbp)
cmpl $0x0, -0x5c(%rbp)
jne 0x33515
movl %r13d, %r13d
leaq 0x8(,%r13,8), %rdi
callq 0x29673
movq %rax, %r12
xorl %r14d, %r14d
cmpq %r14, %r13
je 0x331f3
movq %r15, %rdi
movl %r14d, %esi
callq 0x17dae
movq %rax, (%r12,%r14,8)
incq %r14
jmp 0x331da
andq $0x0, (%r12,%r13,8)
cmpl $0x2, -0x3c(%rbp)
je 0x33548
leaq -0x100(%rbp), %rdi
callq 0x120f0
testq %rbx, %rbx
je 0x33222
leaq -0x100(%rbp), %rdi
movq %rbx, %rsi
callq 0x12b70
movl -0x68(%rbp), %r15d
cmpl $-0x1, %r15d
je 0x3324e
leaq -0x100(%rbp), %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x12af0
movl %r15d, %esi
leaq -0x100(%rbp), %rdi
callq 0x12aa0
jmp 0x3327d
movq -0x48(%rbp), %rax
decl %eax
cmpl $-0x3, %eax
ja 0x3327d
leaq -0x100(%rbp), %rdi
movq -0x48(%rbp), %rbx
movl %ebx, %esi
xorl %edx, %edx
callq 0x12af0
cmpl -0x38(%rbp), %ebx
je 0x3327d
movq -0x48(%rbp), %rax
movl %eax, %esi
cmpl -0x30(%rbp), %eax
jne 0x33240
movl -0x64(%rbp), %r13d
cmpl $-0x1, %r13d
je 0x33473
leaq -0x100(%rbp), %rdi
pushq $0x1
popq %rdx
movl %r13d, %esi
callq 0x12af0
movl %r13d, %esi
leaq -0x100(%rbp), %rdi
callq 0x12aa0
movl -0x60(%rbp), %ebx
cmpl $-0x1, %ebx
je 0x334ab
leaq -0x100(%rbp), %r14
pushq $0x2
popq %rdx
movq %r14, %rdi
movl %ebx, %esi
callq 0x12af0
movq %r14, %rdi
movl %ebx, %esi
callq 0x12aa0
movq -0x58(%rbp), %r9
cmpb $0x0, -0x29(%rbp)
je 0x332ea
movq 0x4ccd9(%rip), %rax     # 0x7ffc0
movq (%rax), %r9
movq (%r12), %rsi
testb $0x2, -0x80(%rbp)
jne 0x3330e
leaq -0x88(%rbp), %rdi
leaq -0x100(%rbp), %rdx
xorl %ecx, %ecx
movq %r12, %r8
callq 0x12980
jmp 0x33326
leaq -0x88(%rbp), %rdi
leaq -0x100(%rbp), %rdx
xorl %ecx, %ecx
movq %r12, %r8
callq 0x12800
movl %eax, %r14d
leaq -0x100(%rbp), %rdi
callq 0x122c0
cmpl $-0x1, %r15d
je 0x33343
movl %r15d, %edi
callq 0x12460
cmpl $-0x1, %r13d
je 0x33351
movl %r13d, %edi
callq 0x12460
cmpl $-0x1, %ebx
je 0x3335d
movl %ebx, %edi
callq 0x12460
movq %r12, %rdi
callq 0x298c1
cmpq $0x0, -0x58(%rbp)
movq -0x48(%rbp), %r15
je 0x33387
movq -0x58(%rbp), %rbx
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x33387
callq 0x298c1
addq $0x8, %rbx
jmp 0x33374
movq -0x58(%rbp), %rdi
callq 0x298c1
testl %r14d, %r14d
jne 0x335a8
leaq 0x4a3d0(%rip), %rdi     # 0x7d770
pushq $0x28
popq %rsi
callq 0x12d92
movq %rax, %rbx
orl $-0x1, 0x8(%rax)
movl -0x88(%rbp), %eax
movq -0x80(%rbp), %rcx
addl %ecx, %ecx
andl $0x8, %ecx
movl -0x50(%rbp), %edx
orl %ecx, %edx
andq $0x0, 0x20(%rbx)
movl %eax, 0x4(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movl %edx, (%rbx)
cmpl $0x1, -0x3c(%rbp)
jne 0x335d4
cmpl $-0x1, %r15d
je 0x33409
movq %rbx, %r14
addq $0x10, %r14
movq -0xa0(%rbp), %rsi
pushq $0x1
popq %rdx
movl %r15d, %edi
callq 0x357e5
movq %rax, (%r14)
testq %rax, %rax
je 0x334fd
movl -0x38(%rbp), %edi
cmpl $-0x1, %edi
je 0x3342c
movq -0x98(%rbp), %rsi
xorl %edx, %edx
callq 0x357e5
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x334fd
movl -0x30(%rbp), %edi
cmpl $-0x1, %edi
je 0x3344f
movq -0x90(%rbp), %rsi
xorl %edx, %edx
callq 0x357e5
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x334fd
movabsq $-0x1000000000000, %rsi # imm = 0xFFFF000000000000
movq %rbx, %rdi
callq 0x4b3ab
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $-0x1, -0x38(%rbp)
je 0x332ac
cmpl $0x1, -0x38(%rbp)
je 0x332ac
leaq -0x100(%rbp), %rdi
pushq $0x1
popq %rdx
movl -0x38(%rbp), %ebx
movl %ebx, %esi
callq 0x12af0
movl %ebx, %esi
cmpl -0x30(%rbp), %ebx
jne 0x332a0
jmp 0x332ac
movl -0x30(%rbp), %r14d
cmpl $-0x1, %r14d
je 0x334bb
cmpl $0x2, %r14d
jne 0x334dc
cmpb $0x0, -0x70(%rbp)
jne 0x332d6
leaq -0x100(%rbp), %rdi
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
callq 0x12af0
jmp 0x332d6
leaq -0x100(%rbp), %rdi
pushq $0x2
popq %rdx
movl %r14d, %esi
callq 0x12af0
leaq -0x100(%rbp), %rdi
movl %r14d, %esi
jmp 0x332d1
leaq 0x2f071(%rip), %rdi     # 0x62575
callq 0x177b1
leaq 0x2eff4(%rip), %rdi     # 0x62504
callq 0x177b1
movl -0x68(%rbp), %edi
cmpl $-0x1, %edi
je 0x33522
callq 0x12460
movl -0x64(%rbp), %edi
cmpl $-0x1, %edi
je 0x3352f
callq 0x12460
movl -0x60(%rbp), %edi
cmpl $-0x1, %edi
je 0x3353c
callq 0x12460
leaq 0x2f014(%rip), %rdi     # 0x62557
callq 0x177b1
cmpb $0x0, -0x29(%rbp)
jne 0x3355c
movq 0x4ca6b(%rip), %rax     # 0x7ffc0
movq -0x58(%rbp), %rcx
movq %rcx, (%rax)
movq (%r12), %rdi
testb $0x2, -0x80(%rbp)
jne 0x33570
movq %r12, %rsi
callq 0x12bd0
jmp 0x33578
movq %r12, %rsi
callq 0x12a10
movl %eax, %ebx
callq 0x12120
cmpl $-0x1, %ebx
jne 0x33589
cmpl $0x4, (%rax)
je 0x3355c
movq (%r12), %rbx
movl (%rax), %eax
testl %eax, %eax
pushq $0x2
popq %rdi
cmovnel %eax, %edi
callq 0x46283
leaq 0x2efcb(%rip), %rdi     # 0x6256e
movq %rbx, %rsi
jmp 0x335ca
callq 0x12120
movl (%rax), %eax
testl %eax, %eax
pushq $0x2
popq %rdi
cmovnel %eax, %edi
callq 0x46283
movq -0x78(%rbp), %rcx
movq (%rcx), %rsi
leaq 0x2efa4(%rip), %rdi     # 0x6256e
movq %rax, %rdx
xorl %eax, %eax
callq 0x176c9
movq %rbx, %rdi
callq 0x32766
leaq 0x2ef4b(%rip), %rdi     # 0x6252e
movq %rax, %rsi
xorl %eax, %eax
callq 0x176c9