LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_to_boolean
bool term_to_boolean(const struct term *rv)
{
    rv = term_resolve(rv);
    switch (rv->kind) {
    case term_string:
        // empty strings, "0", and "false" are false. Everything else is true.
        if (strlen(rv->string) == 0 ||
            strcasecmp(rv->string, "0") == 0 ||
            strcasecmp(rv->string, "false") == 0)
            return false;
        else
            return true;
    case term_number:
        return rv->number != 0;
    case term_boolean:
        return rv->boolean;
    default:
        return false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x70f0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
subl $0x1, %eax
je 0x729d
jmp 0x7289
movl -0x14(%rbp), %eax
subl $0x2, %eax
je 0x72ee
jmp 0x7293
movl -0x14(%rbp), %eax
subl $0x3, %eax
je 0x7300
jmp 0x730e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2170
cmpq $0x0, %rax
je 0x72e2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x5042(%rip), %rsi      # 0xc301
callq 0x2050
cmpl $0x0, %eax
je 0x72e2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x611a(%rip), %rsi      # 0xd3f2
callq 0x2050
cmpl $0x0, %eax
jne 0x72e8
movb $0x0, -0x1(%rbp)
jmp 0x7312
movb $0x1, -0x1(%rbp)
jmp 0x7312
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
setne %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x7312
movq -0x10(%rbp), %rax
movb 0x8(%rax), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x7312
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_to_number
int term_to_number(const struct term *rv)
{
    rv = term_resolve(rv);
    switch (rv->kind) {
    case term_string:
        return strtoull(rv->string, NULL, 0);
    case term_number:
        return rv->number;
    case term_boolean:
        return rv->boolean ? 1 : 0;
    default:
        return 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x70f0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
subl $0x1, %eax
je 0x735d
jmp 0x7349
movl -0x14(%rbp), %eax
subl $0x2, %eax
je 0x7375
jmp 0x7353
movl -0x14(%rbp), %eax
subl $0x3, %eax
je 0x7381
jmp 0x739a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x22b0
movl %eax, -0x4(%rbp)
jmp 0x73a1
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x73a1
movq -0x10(%rbp), %rax
movb 0x8(%rax), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x73a1
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_to_string
const struct term *term_to_string(const struct term *rv)
{
    rv = term_resolve(rv);
    switch (rv->kind) {
    case term_identifier:
        return term_to_string(get_variable(rv->identifier));
    case term_string:
        return rv;
    case term_number:
    {
        char buffer[32];
        sprintf(buffer, "%d", rv->number);
        return term_new_string(buffer);
    }
    case term_boolean:
        return term_new_string(rv->boolean ? "true" : "false");
    default:
        return term_new_string("");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x70f0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x38(%rbp)
subq $0x3, %rax
ja 0x7465
movq -0x38(%rbp), %rax
leaq 0x5ff0(%rip), %rcx      # 0xd3d8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7160
movq %rax, %rdi
callq 0x73b0
movq %rax, -0x8(%rbp)
jmp 0x7475
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x7475
leaq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0x6327(%rip), %rsi      # 0xd74f
movb $0x0, %al
callq 0x2440
leaq -0x30(%rbp), %rdi
callq 0x6ad0
movq %rax, -0x8(%rbp)
jmp 0x7475
movq -0x10(%rbp), %rax
movb 0x8(%rax), %cl
leaq 0x5fa6(%rip), %rdi      # 0xd3f2
leaq 0x5f9a(%rip), %rax      # 0xd3ed
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x6ad0
movq %rax, -0x8(%rbp)
jmp 0x7475
leaq 0x671e(%rip), %rdi      # 0xdb8a
callq 0x6ad0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: get_variable_impl
static struct term *get_variable_impl(const char *name)
{
    for (struct term *v = variables; v; v = v->next) {
        if (strcmp(v->var.name, name) == 0)
            return v;
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq 0xa1cd(%rip), %rax      # 0x11660
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x74ce
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x22c0
cmpl $0x0, %eax
jne 0x74be
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x74d6
jmp 0x74c0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x7497
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: get_variable_as_string
const char *get_variable_as_string(const char *name)
{
    struct term *var = get_variable_impl(name);
    if (var)
        return term_to_string(var->var.value)->string;
    else
        return "";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7480
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7517
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x73b0
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x7522
leaq 0x666c(%rip), %rax      # 0xdb8a
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: get_variable_as_boolean
bool get_variable_as_boolean(const char *name)
{
    struct term *var = get_variable_impl(name);
    if (var)
        return term_to_boolean(var->var.value);
    else
        return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7480
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7564
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x7260
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x7568
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: get_variable_as_number
int get_variable_as_number(const char *name)
{
    struct term *var = get_variable_impl(name);
    if (var)
        return term_to_number(var->var.value);
    else
        return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7480
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x75b2
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x7320
movl %eax, -0x4(%rbp)
jmp 0x75b9
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: eval_file
int eval_file(const char *path)
{
    term_gc_heap();
    if (lexer_set_file(path) < 0)
      return -1;

    return yyparse();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
callq 0x6820
movq -0x10(%rbp), %rdi
callq 0x3f20
cmpl $0x0, %eax
jge 0x76e8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x76f0
callq 0x5a20
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_assign
static const struct term *function_assign(const struct term *parameters)
{
    const struct term *var = parameters;
    const struct term *value = term_resolve(parameters->next);

    set_variable(var->identifier, value);

    return value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x70f0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x68f0
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_blkid
static const struct term *function_blkid(const struct term *parameters)
{
    (void)parameters;
    struct block_device_info *devices;

    probe_block_devices(&devices);

    for (struct block_device_info *device = devices; device; device = device->next) {
        fprintf(stderr, "%s: %sUUID=\"%s\"\n",
            device->path,
            device->type == BLOCK_DEVICE_DISK ? "DISK" : "PART",
            device->uuid);
    }

    free_block_devices(devices);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x10(%rbp), %rdi
callq 0xa720
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7875
movq 0x97cd(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
addq $0xc, %rdx
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
leaq 0x5e72(%rip), %rcx      # 0xd6b6
leaq 0x5e66(%rip), %rax      # 0xd6b1
cmpl $0x0, %esi
cmoveq %rax, %rcx
movq -0x18(%rbp), %r8
addq $0x2c, %r8
leaq 0x5e3f(%rip), %rsi      # 0xd6a0
movb $0x0, %al
callq 0x22d0
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x781d
movq -0x10(%rbp), %rdi
callq 0xa8c0
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_cmd
static const struct term *function_cmd(const struct term *parameters)
{
    const int max_args = 15;
    char *argv[max_args + 1];
    int index = 0;
    while (parameters && index < max_args) {
        const struct term *str = term_to_string(parameters);
        argv[index] = str->string;
        parameters = parameters->next;
        index++;
    }
    argv[index] = 0;

    char output_buffer[256];
    output_buffer[0] = '\0';
    if (system_cmd(argv, output_buffer, sizeof(output_buffer)) != 0)
        info("Ignoring non-zero exit from %s", argv[0]);

    // Trim the output before returning since that's what's expected
    // in practice. There's usually a newline to trim anyway.
    trim_string_in_place(output_buffer);

    return term_new_string(output_buffer);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x8(%rbp)
movl $0xf, -0xc(%rbp)
movq %rsp, %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x8(%rbp)
movb %al, -0x1b1(%rbp)
je 0x78d0
cmpl $0xf, -0x1c(%rbp)
setl %al
movb %al, -0x1b1(%rbp)
movb -0x1b1(%rbp), %al
testb $0x1, %al
jne 0x78dc
jmp 0x7914
movq -0x8(%rbp), %rdi
callq 0x73b0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movslq -0x1c(%rbp), %rax
movq %rcx, -0x1b0(%rbp,%rax,8)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x8(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x78b4
movslq -0x1c(%rbp), %rax
movq $0x0, -0x1b0(%rbp,%rax,8)
movb $0x0, -0x130(%rbp)
leaq -0x130(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
callq 0xb390
cmpl $0x0, %eax
je 0x795d
movq -0x1b0(%rbp), %rsi
leaq 0x5d65(%rip), %rdi      # 0xd6bb
movb $0x0, %al
callq 0x32a0
leaq -0x130(%rbp), %rdi
callq 0x34c0
leaq -0x130(%rbp), %rdi
callq 0x6ad0
movq -0x18(%rbp), %rcx
movq %rcx, %rsp
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_env
static const struct term *function_env(const struct term *parameters)
{
    (void)parameters;

    for (const struct uboot_name_value *var = working_uboot_env.vars; var; var = var->next) {
        fprintf(stderr, "%s=%s\n", var->name, var->value);
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x9c0d(%rip), %rax      # 0x115b0
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x79e7
movq 0x963f(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
leaq 0x5d08(%rip), %rsi      # 0xd6da
movb $0x0, %al
callq 0x22d0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x79ab
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_fwup_revert
static const struct term *function_fwup_revert(const struct term *parameters)
{
    (void)parameters;

    const char *devpathspec = get_variable_as_string("uboot_env.path");
    char devpath[BLOCK_DEVICE_PATH_LEN];
    if (resolve_block_device_spec(devpathspec, devpath) < 0) {
        info("Failure to revert due to invalid uboot_env.path");
        return term_new_boolean(false);
    }

    char *const argv[7] = {"/usr/bin/fwup", "revert.fw", "-d", devpath, "-t", "revert", 0};

    char output_buffer[256];
    output_buffer[0] = '\0';
    if (system_cmd(argv, output_buffer, sizeof(output_buffer)) != 0) {
        info("Failure from fwup revert: %s", output_buffer);
        return term_new_boolean(false);
    }


    reboot(LINUX_REBOOT_CMD_RESTART);
    exit(EXIT_FAILURE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x10(%rbp)
leaq 0x5cfc(%rip), %rdi      # 0xd702
callq 0x74e0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xa9f0
cmpl $0x0, %eax
jge 0x7a3f
leaq 0x5cb9(%rip), %rdi      # 0xd6e1
movb $0x0, %al
callq 0x32a0
xorl %edi, %edi
callq 0x6c20
movq %rax, -0x8(%rbp)
jmp 0x7add
leaq 0x5ccb(%rip), %rax      # 0xd711
movq %rax, -0x80(%rbp)
leaq 0x5cce(%rip), %rax      # 0xd71f
movq %rax, -0x78(%rbp)
leaq 0x5ccd(%rip), %rax      # 0xd729
movq %rax, -0x70(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq 0x5cbd(%rip), %rax      # 0xd72c
movq %rax, -0x60(%rbp)
leaq 0x5a21(%rip), %rax      # 0xd49b
movq %rax, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x180(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x180(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0xb390
cmpl $0x0, %eax
je 0x7ac9
leaq -0x180(%rbp), %rsi
leaq 0x5c7a(%rip), %rdi      # 0xd72f
movb $0x0, %al
callq 0x32a0
xorl %edi, %edi
callq 0x6c20
movq %rax, -0x8(%rbp)
jmp 0x7add
movl $0x1234567, %edi        # imm = 0x1234567
callq 0x2470
movl $0x1, %edi
callq 0x2450
movq -0x8(%rbp), %rax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_getenv
static const struct term *function_getenv(const struct term *parameters)
{
    const char *name = term_to_string(parameters)->string;

    char *value;
    if (uboot_env_getenv(&working_uboot_env, name, &value) < 0) {
        return term_new_string("");
    } else {
        struct term *ret = term_new_string(value);
        free(value);
        return ret;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x73b0
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rsi
leaq 0x9a98(%rip), %rdi      # 0x115b0
leaq -0x20(%rbp), %rdx
callq 0x3af0
cmpl $0x0, %eax
jge 0x7b38
leaq 0x605d(%rip), %rdi      # 0xdb8a
callq 0x6ad0
movq %rax, -0x8(%rbp)
jmp 0x7b56
movq -0x20(%rbp), %rdi
callq 0x6ad0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2040
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_help
const struct term *function_help(const struct term *parameters)
{
    (void)parameters;

    struct function_info *entry = function_table;
    while (entry->handler) {
        if (entry->description) {
            char buf[16];
            snprintf(buf, sizeof(buf), "%s/%d", entry->name, entry->arity);
            fprintf(stderr, "%-16s%s\n", buf, entry->description);
        }
        entry++;
    }

    fprintf(stderr, "\nType Ctrl-D to exit repl.\n");
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x977d(%rip), %rax      # 0x112f0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x7be5
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x7bd7
leaq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %r8d
movl $0x10, %esi
leaq 0x5ba0(%rip), %rdx      # 0xd74c
movb $0x0, %al
callq 0x21f0
movq 0x943e(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x5b82(%rip), %rsi      # 0xd752
movb $0x0, %al
callq 0x22d0
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x10(%rbp)
jmp 0x7b77
movq 0x940c(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x5b65(%rip), %rsi      # 0xd75b
movb $0x0, %al
callq 0x22d0
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_ls
static const struct term *function_ls(const struct term *parameters)
{
    const char *path = parameters ? term_to_string(parameters)->string : "/";

    struct dirent **namelist;
    int n = scandir(path,
                    &namelist,
                    NULL,
                    alphasort);
    int i;
    for (i = 0; i < n; i++) {
        fprintf(stderr, "%-32s%s\n",  namelist[i]->d_name, (namelist[i]->d_type == DT_DIR ? "<DIR>" : ""));
    }

    if (n >= 0) {
        for (i = 0; i < n; i++)
            free(namelist[i]);
        free(namelist);
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x7df6
movq -0x8(%rbp), %rdi
callq 0x73b0
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x7e03
leaq 0x4595(%rip), %rax      # 0xc392
movq %rax, -0x28(%rbp)
jmp 0x7e03
movq -0x28(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movq 0x91ba(%rip), %rcx      # 0x10fd8
callq 0x2230
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x7e8d
movq 0x91bc(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x13, %rdx
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movzbl 0x12(%rax), %esi
leaq 0x5d24(%rip), %rcx      # 0xdb8a
leaq 0x5989(%rip), %rax      # 0xd7f6
cmpl $0x4, %esi
cmoveq %rax, %rcx
leaq 0x5972(%rip), %rsi      # 0xd7ed
movb $0x0, %al
callq 0x22d0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7e2d
cmpl $0x0, -0x1c(%rbp)
jl 0x7ec7
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x7ebe
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7e9a
movq -0x18(%rbp), %rdi
callq 0x2040
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_print
static const struct term *function_print(const struct term *parameters)
{
    while (parameters) {
        const struct term *str = term_to_string(parameters);
        fprintf(stderr, "%s", str->string);
        parameters = parameters->next;
    }
    fprintf(stderr, "\n");
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x7f3e
movq -0x8(%rbp), %rdi
callq 0x73b0
movq %rax, -0x10(%rbp)
movq 0x90e1(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x4111(%rip), %rsi      # 0xc03a
movb $0x0, %al
callq 0x22d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x7efc
movq 0x90b3(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x448d(%rip), %rsi      # 0xc3dc
movb $0x0, %al
callq 0x22d0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_readfile
static const struct term *function_readfile(const struct term *parameters)
{
    const char *path = term_to_string(parameters)->string;

    FILE *fp = fopen(path, "rb");
    if (fp) {
        char buffer[HEAP_SIZE / 4];
        size_t len = fread(buffer, 1, sizeof(buffer) - 1, fp);
        buffer[len] = 0;
        fclose(fp);
        return term_new_string(buffer);
    } else {
        info("Error reading %s", path);
        return term_new_string("");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1060, %rsp           # imm = 0x1060
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x73b0
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x5871(%rip), %rsi      # 0xd7fc
callq 0x23e0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x7fe6
leaq -0x1050(%rbp), %rdi
movq -0x20(%rbp), %rcx
movl $0x1, %esi
movl $0x1025, %edx           # imm = 0x1025
callq 0x2100
movq %rax, -0x1058(%rbp)
movq -0x1058(%rbp), %rax
movb $0x0, -0x1050(%rbp,%rax)
movq -0x20(%rbp), %rdi
callq 0x2150
leaq -0x1050(%rbp), %rdi
callq 0x6ad0
movq %rax, -0x8(%rbp)
jmp 0x8008
movq -0x18(%rbp), %rsi
leaq 0x580e(%rip), %rdi      # 0xd7ff
movb $0x0, %al
callq 0x32a0
leaq 0x5b8b(%rip), %rdi      # 0xdb8a
callq 0x6ad0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1060, %rsp           # imm = 0x1060
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_setenv
static const struct term *function_setenv(const struct term *parameters)
{
    const char *name = term_to_string(parameters)->string;
    const char *value = term_to_string(parameters->next)->string;

    if (uboot_env_setenv(&working_uboot_env, name, value) < 0) {
        info("Error setting uboot environment variable '%s' to '%s'", name, value);
    } else {
        set_boolean_variable("uboot_env.modified", true);
    }

    return parameters->next;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x73b0
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x73b0
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq 0x939f(%rip), %rdi      # 0x115b0
callq 0x3960
cmpl $0x0, %eax
jge 0x8233
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq 0x5615(%rip), %rdi      # 0xd83f
movb $0x0, %al
callq 0x32a0
jmp 0x8244
leaq 0x3f75(%rip), %rdi      # 0xc1af
movl $0x1, %esi
callq 0x7610
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_vars
static const struct term *function_vars(const struct term *parameters)
{
    (void)parameters;

    for (const struct term *var = variables; var; var = var->next) {
        inspect(var);
        fprintf(stderr, "\n");
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq 0x93bd(%rip), %rax      # 0x11660
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x82dd
movq -0x10(%rbp), %rdi
callq 0x6e20
movq 0x8d3a(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x4114(%rip), %rsi      # 0xc3dc
movb $0x0, %al
callq 0x22d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x82a7
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/block_device.c
// Function: probe_block_devices
int probe_block_devices(struct block_device_info **devices)
{
    *devices = NULL;

    struct dirent **namelist;
    int n = scandir("/sys/block",
                    &namelist,
                    NULL,
                    reverse_alphasort);
    int i;
    for (i = 0; i < n; i++) {
        if (namelist[i]->d_name[0] == '.')
            continue;

        probe_partitions(namelist[i]->d_name, devices);
    }

    if (n >= 0) {
        for (i = 0; i < n; i++)
            free(namelist[i]);
        free(namelist);
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
leaq 0x344d(%rip), %rdi      # 0xdb8b
leaq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq 0xa3(%rip), %rcx        # 0xa7f0
callq 0x2230
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xa79f
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x13(%rax), %eax
cmpl $0x2e, %eax
jne 0xa77b
jmp 0xa794
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x13, %rdi
movq -0x8(%rbp), %rsi
callq 0xa820
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xa75c
cmpl $0x0, -0x14(%rbp)
jl 0xa7d9
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xa7d0
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xa7ac
movq -0x10(%rbp), %rdi
callq 0x2040
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/block_device.c
// Function: probe_partitions
static int probe_partitions(const char *devname, struct block_device_info **devices)
{
    char devpath[32];
    snprintf(devpath, sizeof(devpath), "/dev/%.16s", devname);

    int fd = open(devpath, O_RDONLY | O_CLOEXEC);
    if (fd < 0)
        return -1;

    int rc = 0;
    if (probe_mbr_devices(fd, devname, devices) < 0 &&
        probe_gpt_devices(fd, devname, devices) < 0)
        rc = -1;

    close(fd);

    return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x20, %esi
leaq 0x3387(%rip), %rdx      # 0xdbcb
movb $0x0, %al
callq 0x21f0
leaq -0x40(%rbp), %rdi
movl $0x80000, %esi          # imm = 0x80000
movb $0x0, %al
callq 0x23d0
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jge 0xa86d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa8b3
movl $0x0, -0x48(%rbp)
movl -0x44(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xaa40
cmpl $0x0, %eax
jge 0xa8a5
movl -0x44(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xac70
cmpl $0x0, %eax
jge 0xa8a5
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
movl -0x44(%rbp), %edi
callq 0x2250
movl -0x48(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/block_device.c
// Function: free_block_devices
void free_block_devices(struct block_device_info *devices)
{
    while (devices) {
        struct block_device_info *next = devices->next;
        free(devices);
        devices = next;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xa8f1
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2040
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xa8cc
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/block_device.c
// Function: open_block_device
int open_block_device(const char *spec, int flags, char *path)
{
    // If this is called multiple times and we've exhausted the wait time, then
    // don't wait any longer. We don't want a longer cumulative wait that depends on
    // the contents of the script.
    static int tries = 1000; // Wait 1000 * 1ms = 1 second total
    int fd = open_block_device_impl(spec, flags, path);
    while (fd < 0 && tries > 0) {
        usleep(1000);
        fd = open_block_device_impl(spec, flags, path);
        tries--;
    }

    if (fd < 0)
        info("Could not open block device '%s' even after waiting!", spec);

    return fd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0xa9a0
movl %eax, -0x1c(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x1c(%rbp)
movb %al, -0x1d(%rbp)
jge 0xa93e
cmpl $0x0, 0x6c68(%rip)      # 0x115a0
setg %al
movb %al, -0x1d(%rbp)
movb -0x1d(%rbp), %al
testb $0x1, %al
jne 0xa947
jmp 0xa975
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x24e0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0xa9a0
movl %eax, -0x1c(%rbp)
movl 0x6c36(%rip), %eax      # 0x115a0
addl $-0x1, %eax
movl %eax, 0x6c2d(%rip)      # 0x115a0
jmp 0xa926
cmpl $0x0, -0x1c(%rbp)
jge 0xa98d
movq -0x8(%rbp), %rsi
leaq 0x3210(%rip), %rdi      # 0xdb96
movb $0x0, %al
callq 0x32a0
movl -0x1c(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/block_device.c
// Function: resolve_block_device_spec
int resolve_block_device_spec(const char *spec, char *path)
{
    int fd = open_block_device(spec, O_RDONLY, path);
    if (fd >= 0) {
        close(fd);
        return 0;
    } else {
        return -1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
xorl %esi, %esi
callq 0xa900
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0xaa29
movl -0x1c(%rbp), %edi
callq 0x2250
movl $0x0, -0x4(%rbp)
jmp 0xaa30
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/block_device.c
// Function: p_or_np
static const char *p_or_np(const char *devname)
{
    // Return whether partitions are prefixed with p or not.
    //
    // Examples:
    //  sda -> sda1, sda2, ...
    //  mmcblk0 -> mmcblk0p1, mmcblk0p2, ...

    char last_char = devname[strlen(devname) - 1];
    if (last_char >= '0' && last_char <= '9')
        return "p";
    else
        return "";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2170
movq %rax, %rcx
movq -0x20(%rbp), %rax
subq $0x1, %rcx
movb (%rax,%rcx), %al
movb %al, -0x11(%rbp)
movsbl -0x11(%rbp), %eax
cmpl $0x30, %eax
jl 0xb07d
movsbl -0x11(%rbp), %eax
cmpl $0x39, %eax
jg 0xb07d
leaq 0x23c6(%rip), %rax      # 0xd43d
movq %rax, -0x8(%rbp)
jmp 0xb088
leaq 0x2b06(%rip), %rax      # 0xdb8a
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/block_device.c
// Function: is_zeros
static bool is_zeros(const uint8_t *buffer, size_t len)
{
    for (size_t i = 0; i < len; i++) {
        if (buffer[i])
            return false;
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0xb232
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0xb222
movb $0x0, -0x1(%rbp)
jmp 0xb236
jmp 0xb224
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xb204
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/block_device.c
// Function: find_block_device_by_spec
static int find_block_device_by_spec(const char *spec, char *path)
{
    if (strncmp("PARTUUID=", spec, 9) == 0) {
        return find_block_device_by_uuid(BLOCK_DEVICE_PARTITION, &spec[9], path);
    } else if (strncmp("DISKUUID=", spec, 9) == 0) {
        return find_block_device_by_uuid(BLOCK_DEVICE_DISK, &spec[9], path);
    } else {
        // Assume path
        strcpy(path, spec);
        return 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x29de(%rip), %rdi      # 0xdc39
movl $0x9, %edx
callq 0x2080
cmpl $0x0, %eax
jne 0xb285
movq -0x10(%rbp), %rsi
addq $0x9, %rsi
movq -0x18(%rbp), %rdx
movl $0x1, %edi
callq 0xb2e0
movl %eax, -0x4(%rbp)
jmp 0xb2cb
movq -0x10(%rbp), %rsi
leaq 0x29b3(%rip), %rdi      # 0xdc43
movl $0x9, %edx
callq 0x2080
cmpl $0x0, %eax
jne 0xb2b7
movq -0x10(%rbp), %rsi
addq $0x9, %rsi
movq -0x18(%rbp), %rdx
xorl %edi, %edi
callq 0xb2e0
movl %eax, -0x4(%rbp)
jmp 0xb2cb
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2090
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/block_device.c
// Function: find_block_device_by_uuid
static int find_block_device_by_uuid(enum block_device_type type, const char *uuid, char *path)
{
    struct block_device_info *devices;
    if (probe_block_devices(&devices) < 0)
        return -1;

    int rc = -1;
    for (struct block_device_info *device = devices; device; device = device->next) {
        // strcasecmp to avoid being picky on UUID hex digit capitalization
        if (type == device->type && strcasecmp(uuid, device->uuid) == 0) {
            strcpy(path, device->path);
            rc = 0;
            break;
        }
    }
    free_block_devices(devices);
    return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xa720
cmpl $0x0, %eax
jge 0xb30a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb37a
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xb36b
movl -0x8(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0xb35c
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x2c, %rsi
callq 0x2050
cmpl $0x0, %eax
jne 0xb35c
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0xc, %rsi
callq 0x2090
movl $0x0, -0x24(%rbp)
jmp 0xb36b
jmp 0xb35e
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0xb319
movq -0x20(%rbp), %rdi
callq 0xa8c0
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/rootdisk.c
// Function: create_rootdisk_symlinks
void create_rootdisk_symlinks(const char *rootfs_devname)
{
    struct block_device_info *infos = scan_for_block_devices();

    dev_t rootfs_dev = rootfs_device(rootfs_devname);
    if (rootfs_dev == 0)
        return;

    struct block_device_info *rootfs_info = NULL;
    for (struct block_device_info *i = infos; i != NULL; i = i->next) {
        if (i->dev == rootfs_dev) {
            rootfs_info = i;
            break;
        }
    }

    if (!rootfs_info || !rootfs_info->parent) {
        info("Root disk is supposed to be %s, but it wasn't found or wasn't a partition.", rootfs_devname);
        return;
    }

    struct block_device_info *rootdisk_info = rootfs_info->parent;

    // Create the main disk's symlink.
    create_dev_symlink("0", rootdisk_info->name);

    // Create all of the partition symlinks (of which one will be the rootfs).
    for (struct block_device_info *i = infos; i != NULL; i = i->next) {
        if (i->parent == rootdisk_info) {
            char partition_suffix[8];
            snprintf(partition_suffix, sizeof(partition_suffix), "0p%d", i->partition_number);
            create_dev_symlink(partition_suffix, i->name);
        }
    }

    free_block_device_info(infos);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
callq 0xb7f0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xb660
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xb56e
jmp 0xb659
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xb5ac
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0xb59d
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0xb5ac
jmp 0xb59f
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0xb57e
cmpq $0x0, -0x20(%rbp)
je 0xb5be
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xb5d5
movq -0x8(%rbp), %rsi
leaq 0x268e(%rip), %rdi      # 0xdc57
movb $0x0, %al
callq 0x32a0
jmp 0xb659
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0xd11(%rip), %rdi       # 0xc301
callq 0xb6e0
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xb650
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
cmpq -0x30(%rbp), %rax
jne 0xb641
leaq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x18(%rax), %ecx
movl $0x8, %esi
leaq 0x2679(%rip), %rdx      # 0xdca2
movb $0x0, %al
callq 0x21f0
leaq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xb6e0
jmp 0xb643
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0xb5fd
movq -0x10(%rbp), %rdi
callq 0xb7a0
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/rootdisk.c
// Function: rootfs_device
static dev_t rootfs_device(const char *rootfs_devname)
{
    struct stat st;
    if (stat(rootfs_devname, &st) >= 0) {
        return st.st_rdev;
    } else {
        info("Could not determine root device for %s: %s", rootfs_devname, strerror(errno));
        return 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x22f0
cmpl $0x0, %eax
jl 0xb68e
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xb6c5
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
callq 0x2060
movl (%rax), %edi
callq 0x2490
movq -0xa8(%rbp), %rsi
movq %rax, %rdx
leaq 0x266d(%rip), %rdi      # 0xdd23
movb $0x0, %al
callq 0x32a0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/rootdisk.c
// Function: create_dev_symlink
static void create_dev_symlink(const char *partition_suffix, const char *devname)
{
    char symlinkpath[SHORT_PATH_MAX];
    char devpath[SHORT_PATH_MAX];

    snprintf(symlinkpath, sizeof(symlinkpath), "/dev/rootdisk%s", partition_suffix);
    snprintf(devpath, sizeof(devpath), "/dev/%s", devname);
    if (symlink(devpath, symlinkpath) < 0)
        info("Could not create symlink '%s'->'%s': %s", symlinkpath, devpath, strerror(errno));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x110(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x2644(%rip), %rdx      # 0xdd4e
movb $0x0, %al
callq 0x21f0
leaq -0x210(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x2636(%rip), %rdx      # 0xdd5e
movb $0x0, %al
callq 0x21f0
leaq -0x210(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x21e0
cmpl $0x0, %eax
jge 0xb78e
leaq -0x110(%rbp), %rax
movq %rax, -0x220(%rbp)
leaq -0x210(%rbp), %rax
movq %rax, -0x218(%rbp)
callq 0x2060
movl (%rax), %edi
callq 0x2490
movq -0x220(%rbp), %rsi
movq -0x218(%rbp), %rdx
movq %rax, %rcx
leaq 0x25df(%rip), %rdi      # 0xdd66
movb $0x0, %al
callq 0x32a0
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/rootdisk.c
// Function: free_block_device_info
static void free_block_device_info(struct block_device_info *info)
{
    while (info) {
        struct block_device_info *next = info->next;
        free(info->name);
        free(info);
        info = next;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xb7de
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
movq -0x8(%rbp), %rdi
callq 0x2040
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xb7ac
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/rootdisk.c
// Function: scan_for_block_devices
static struct block_device_info *scan_for_block_devices()
{
    struct block_device_info *infos = NULL;
    const char *base_dir = "/sys/block";

    struct dirent **namelist;
    int n = scandir(base_dir,
                    &namelist,
                    not_special_filter,
                    alphasort);
    int i;
    for (i = 0; i < n; i++) {
        dev_t dev = read_dev_file(base_dir, namelist[i]->d_name);
        if (dev == 0)
            continue;

        struct block_device_info *info = malloc(sizeof(struct block_device_info));
        info->next = infos;
        info->name = strdup(namelist[i]->d_name);
        info->dev = dev;
        info->partition_number = 0;
        info->parent = NULL;
        infos = info;

        scan_for_partitions(info, &infos);
    }
    if (n <= 0)
        info("No directories found under /sys/block. Check that /sys is mounted");

    if (n >= 0) {
        for (i = 0; i < n; i++)
            free(namelist[i]);
        free(namelist);
    }

    return infos;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq $0x0, -0x8(%rbp)
leaq 0x2384(%rip), %rax      # 0xdb8b
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq 0x126(%rip), %rdx       # 0xb940
movq 0x57b7(%rip), %rcx      # 0x10fd8
callq 0x2230
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xb8e1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
addq $0x13, %rsi
callq 0xb960
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xb862
jmp 0xb8d3
movl $0x28, %edi
callq 0x2330
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x13, %rdi
callq 0x2480
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x8(%rbp), %rsi
callq 0xba40
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xb830
cmpl $0x0, -0x1c(%rbp)
jg 0xb8f5
leaq 0x23b9(%rip), %rdi      # 0xdca7
movb $0x0, %al
callq 0x32a0
cmpl $0x0, -0x1c(%rbp)
jl 0xb92f
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xb926
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xb902
movq -0x18(%rbp), %rdi
callq 0x2040
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/rootdisk.c
// Function: read_dev_file
static dev_t read_dev_file(const char *base, const char *name)
{
    char fname[SHORT_PATH_MAX];
    snprintf(fname, sizeof(fname), "%.64s/%.32s/dev", base, name);
    FILE *fp = fopen(fname, "r");
    if (!fp)
        return 0;

    unsigned int dev_major;
    unsigned int dev_minor;

    dev_t d = 0;
    if (fscanf(fp, "%u:%u", &dev_major, &dev_minor) == 2) {
#if defined(__APPLE__)
        d = (dev_major << 8) + dev_minor;
#else
        d = makedev(dev_major, dev_minor);
#endif
    }

    fclose(fp);
    return d;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x120(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
leaq 0x235b(%rip), %rdx      # 0xdce9
movb $0x0, %al
callq 0x21f0
leaq -0x120(%rbp), %rdi
leaq 0x743(%rip), %rsi       # 0xc0e6
callq 0x23e0
movq %rax, -0x128(%rbp)
cmpq $0x0, -0x128(%rbp)
jne 0xb9c3
movq $0x0, -0x8(%rbp)
jmp 0xba25
movq $0x0, -0x138(%rbp)
movq -0x128(%rbp), %rdi
leaq 0x231d(%rip), %rsi      # 0xdcf9
leaq -0x12c(%rbp), %rdx
leaq -0x130(%rbp), %rcx
movb $0x0, %al
callq 0x20b0
cmpl $0x2, %eax
jne 0xba0e
movl -0x12c(%rbp), %edi
movl -0x130(%rbp), %esi
callq 0x24a0
movq %rax, -0x138(%rbp)
movq -0x128(%rbp), %rdi
callq 0x2150
movq -0x138(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)