// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/build/c/shell.c
// Function: main
int main(int argc, char **argv) {
    int i, status;
    JanetArray *args;
    JanetTable *env;

#ifdef _WIN32
    setup_console_output();
#endif

#if !defined(JANET_SIMPLE_GETLINE)
    atexit(clear_at_exit);
#endif

#if defined(JANET_PRF)
    uint8_t hash_key[JANET_HASH_KEY_SIZE + 1];
#ifdef JANET_REDUCED_OS
    char *envvar = NULL;
#else
    char *envvar = getenv("JANET_HASHSEED");
#endif
    if (NULL != envvar) {
        strncpy((char *) hash_key, envvar, sizeof(hash_key) - 1);
    } else if (janet_cryptorand(hash_key, JANET_HASH_KEY_SIZE) != 0) {
        fputs("unable to initialize janet PRF hash function.\n", stderr);
        return 1;
    }
    janet_init_hash_key(hash_key);
#endif

    /* Set up VM */
    janet_init();

    /* Replace original getline with new line getter */
    JanetTable *replacements = janet_table(0);
    janet_table_put(replacements, janet_csymbolv("getline"), janet_wrap_cfunction(janet_line_getter));
    janet_line_init();

    /* Get core env */
    env = janet_core_env(replacements);

    /* Create args tuple */
    args = janet_array(argc);
    for (i = 1; i < argc; i++)
        janet_array_push(args, janet_cstringv(argv[i]));

    /* Save current executable path to (dyn :executable) */
    janet_table_put(env, janet_ckeywordv("executable"), janet_cstringv(argv[0]));

    /* Run startup script */
    Janet mainfun;
    janet_resolve(env, janet_csymbol("cli-main"), &mainfun);
    Janet mainargs[1] = { janet_wrap_array(args) };
    JanetFiber *fiber = janet_fiber(janet_unwrap_function(mainfun), 64, 1, mainargs);
    janet_gcroot(janet_wrap_fiber(fiber));
    fiber->env = env;

    /* Run the fiber in an event loop */
    status = janet_loop_fiber(fiber);

    /* Deinitialize vm */
    janet_deinit();
    janet_line_deinit();

    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x200(%rip), %rdi       # 0x7edf0
callq 0x828c0
callq 0x65da0
xorl %edi, %edi
callq 0x1a480
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq 0x559bf(%rip), %rdi     # 0xd45d3
callq 0x19e00
movq %rax, %rdi
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
callq 0x19dd0
movq %rax, -0x38(%rbp)
leaq -0x676(%rip), %rdi      # 0x7e5c0
movabsq $-0x1800000000000, %rsi # imm = 0xFFFE800000000000
callq 0x163b0
movq -0x80(%rbp), %rdi
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x16120
callq 0x7e8d0
movq -0x30(%rbp), %rdi
callq 0x2afa0
movq %rax, -0x28(%rbp)
movl -0x8(%rbp), %edi
callq 0x166e0
movq %rax, -0x20(%rbp)
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x7ecd4
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1ae80
movq %rax, %rdi
movabsq $-0x6000000000000, %rsi # imm = 0xFFFA000000000000
callq 0x19dd0
movq -0x88(%rbp), %rdi
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rsi
callq 0x16ab0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x7ec7f
movq -0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq 0x532e4(%rip), %rdi     # 0xd1fca
callq 0x19e00
movq %rax, %rdi
movabsq $-0x5000000000000, %rsi # imm = 0xFFFB000000000000
callq 0x19dd0
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x1ae80
movq %rax, %rdi
movabsq $-0x6000000000000, %rsi # imm = 0xFFFA000000000000
callq 0x19dd0
movq -0x98(%rbp), %rdi
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdx
callq 0x16120
movq -0x28(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq 0x57b4f(%rip), %rdi     # 0xd6898
callq 0x19e00
movq -0x90(%rbp), %rdi
movq %rax, %rsi
leaq -0x60(%rbp), %rdx
callq 0x2b500
movq -0x20(%rbp), %rdi
movabsq $-0x4800000000000, %rsi # imm = 0xFFFB800000000000
callq 0x163b0
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x1f9e0
movq %rax, %rdi
leaq -0x68(%rbp), %rcx
movl $0x40, %esi
movl $0x1, %edx
callq 0x34e70
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movabsq $-0x6800000000000, %rsi # imm = 0xFFF9800000000000
callq 0x163b0
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
callq 0x2b360
movq -0x28(%rbp), %rcx
movq -0x70(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x70(%rbp), %rdi
callq 0x53010
movl %eax, -0x18(%rbp)
callq 0x47be0
callq 0x7e8e0
movl -0x18(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)