// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/nerves_initramfs.c
// Function: main
int main(int argc, char *argv[])
{
    info("version " PROGRAM_VERSION_STR
#ifdef DEBUG
         " [DEBUG]"
#endif
            );

    if (getpid() != 1)
       fatal("Must be pid 1");

    setup_initramfs();

    // Initialize scripting environment
    initialize_script_defaults(argc, argv);

    eval_file("/nerves_initramfs.conf");

    if (get_variable_as_boolean("run_repl"))
        repl();

    // Mount the root filesystem
    const char *rootfs_spec = get_variable_as_string("rootfs.path");
    char resolved_rootfs_path[BLOCK_DEVICE_PATH_LEN];
    if (resolve_block_device_spec(rootfs_spec, resolved_rootfs_path) < 0)
        fatal("Can't continue since '%s' does not exist.", rootfs_spec);

    const char *rootfs_fstype = get_variable_as_string("rootfs.fstype");
    if (get_variable_as_boolean("rootfs.encrypted"))
        mount_encrypted_fs(resolved_rootfs_path,
                           rootfs_fstype,
                           get_variable_as_string("rootfs.cipher"),
                           get_variable_as_string("rootfs.secret"));
    else
        mount_fs(resolved_rootfs_path, rootfs_fstype);

    // Finalize our setup of the root filesystem
    create_rootdisk_symlinks(resolved_rootfs_path);

    // Switch over to the new root filesystem
    switch_root();

    // Launch the real init. It's always /sbin/init with Buildroot.
    execv("/sbin/init", argv);

    fatal("Couldn't run /sbin/init: %s", strerror(errno));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x989c(%rip), %rdi      # 0xc049
movb $0x0, %al
callq 0x32a0
callq 0x2130
cmpl $0x1, %eax
je 0x27cc
leaq 0x9892(%rip), %rdi      # 0xc057
movb $0x0, %al
callq 0x3390
callq 0x2c00
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x28f0
leaq 0x9881(%rip), %rdi      # 0xc065
callq 0x76c0
leaq 0x988c(%rip), %rdi      # 0xc07c
callq 0x7530
testb $0x1, %al
jne 0x27fb
jmp 0x2800
callq 0x2cf0
leaq 0x987e(%rip), %rdi      # 0xc085
callq 0x74e0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xa9f0
cmpl $0x0, %eax
jge 0x2834
movq -0x18(%rbp), %rsi
leaq 0x9864(%rip), %rdi      # 0xc091
movb $0x0, %al
callq 0x3390
leaq 0x9880(%rip), %rdi      # 0xc0bb
callq 0x74e0
movq %rax, -0x48(%rbp)
leaq 0x987e(%rip), %rdi      # 0xc0c9
callq 0x7530
testb $0x1, %al
jne 0x2856
jmp 0x2898
leaq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq 0x986d(%rip), %rdi      # 0xc0da
callq 0x74e0
movq %rax, -0x50(%rbp)
leaq 0x986b(%rip), %rdi      # 0xc0e8
callq 0x74e0
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq %rax, %rcx
callq 0x2a60
jmp 0x28a5
leaq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x2b70
leaq -0x40(%rbp), %rdi
callq 0xb540
callq 0x3160
movq -0x10(%rbp), %rsi
leaq 0x9838(%rip), %rdi      # 0xc0f6
callq 0x24b0
callq 0x2060
movl (%rax), %edi
callq 0x2490
movq %rax, %rsi
leaq 0x9828(%rip), %rdi      # 0xc101
movb $0x0, %al
callq 0x3390
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)