LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/uboot_env.c
// Function: uboot_env_read
int uboot_env_read(struct uboot_env *env, const char *buffer)
{
    uboot_env_free(env);

    uint32_t expected_crc32 = ((uint8_t) buffer[0] | ((uint8_t) buffer[1] << 8) | ((uint8_t) buffer[2] << 16) | ((uint8_t) buffer[3] << 24));
    uint32_t actual_crc32 = crc32buf(buffer + 4, env->env_size - 4);
    if (expected_crc32 != actual_crc32)
        ERR_RETURN("U-boot environment CRC32 mismatch (expected 0x%08x; got 0x%08x)", expected_crc32, actual_crc32);

    const char *end = buffer + env->env_size;
    const char *name = buffer + 4;
    while (name != end && *name != '\0') {
        const char *endname = name + 1;
        for (;;) {
            if (endname == end || *endname == '\0')
                ERR_RETURN("Invalid U-boot environment");

            if (*endname == '=')
                break;

            endname++;
        }

        const char *value = endname + 1;
        const char *endvalue = value;
        for (;;) {
            if (endvalue == end)
                ERR_RETURN("Invalid U-boot environment");

            if (*endvalue == '\0')
                break;

            endvalue++;
        }

        struct uboot_name_value *pair = malloc(sizeof(struct uboot_name_value));
        pair->name = strndup(name, endname - name);
        pair->value = strndup(value, value - endvalue);
        pair->next = env->vars;
        env->vars = pair;

        name = endvalue + 1;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r15
callq 0x329e
movl (%rbx), %ebp
leaq 0x4(%rbx), %r14
movq (%r15), %rsi
addq $-0x4, %rsi
movq %r14, %rdi
callq 0x3150
cmpl %eax, %ebp
jne 0x3268
addq (%r15), %rbx
xorl %ecx, %ecx
cmpq %rbx, %r14
je 0x328d
cmpb $0x0, (%r14)
je 0x328d
leaq 0x1(%r14), %rbp
xorl %r12d, %r12d
cmpq %rbx, %rbp
je 0x327c
movzbl (%rbp), %eax
decq %r12
incq %rbp
cmpl $0x3d, %eax
je 0x31f9
testl %eax, %eax
jne 0x31d8
jmp 0x327c
movq %r15, 0x10(%rsp)
xorl %r15d, %r15d
movq %rbp, %r13
cmpq %rbx, %r13
je 0x327c
cmpb $0x0, (%r13)
je 0x3218
incq %r13
decq %r15
jmp 0x3204
pushq $0x18
popq %rdi
callq 0x2380
movq %rax, 0x8(%rsp)
negq %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x22d0
movq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x22d0
xorl %ecx, %ecx
movq %rax, 0x8(%r14)
movq 0x10(%rsp), %r15
movq 0x8(%r15), %rax
movq %rax, 0x10(%r14)
movq %r14, 0x8(%r15)
incq %r13
movq %r13, %r14
jmp 0x31be
leaq 0x55c1(%rip), %rdi      # 0x8830
movl %ebp, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x2ee4
jmp 0x328a
leaq 0x55ed(%rip), %rdi      # 0x8870
xorl %eax, %eax
callq 0x2ee4
pushq $-0x1
popq %rcx
movl %ecx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/uboot_env.c
// Function: uboot_env_free
void uboot_env_free(struct uboot_env *env)
{
    struct uboot_name_value *pair = env->vars;
    while (pair != NULL) {
        free(pair->name);
        free(pair->value);

        struct uboot_name_value *next = pair->next;
        free(pair);
        pair = next;
    }

    env->vars = NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x32d1
movq (%r14), %rdi
callq 0x2040
movq 0x8(%r14), %rdi
callq 0x2040
movq 0x10(%r14), %r15
movq %r14, %rdi
callq 0x2040
movq %r15, %r14
jmp 0x32aa
andq $0x0, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/uboot_env.c
// Function: uboot_env_setenv
int uboot_env_setenv(struct uboot_env *env, const char *name, const char *value)
{
    struct uboot_name_value *pair;
    for (pair = env->vars; pair != NULL; pair = pair->next) {
        if (strcmp(pair->name, name) == 0) {
            free(pair->value);
            pair->value = strdup(value);
            return 0;
        }
    }
    pair = malloc(sizeof(*pair));
    pair->name = strdup(name);
    pair->value = strdup(value);
    pair->next = env->vars;
    env->vars = pair;
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
addq $0x8, %r14
movq %r14, %r12
movq (%r12), %r12
testq %r12, %r12
je 0x3313
movq (%r12), %rdi
movq %r15, %rsi
callq 0x2310
testl %eax, %eax
je 0x3344
addq $0x10, %r12
jmp 0x32f4
pushq $0x18
popq %rdi
callq 0x2380
movq %rax, %r12
movq %r15, %rdi
callq 0x24d0
movq %rax, (%r12)
movq %rbx, %rdi
callq 0x24d0
movq %rax, 0x8(%r12)
movq (%r14), %rax
movq %rax, 0x10(%r12)
movq %r12, (%r14)
jmp 0x335b
movq 0x8(%r12), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x24d0
movq %rax, 0x8(%r12)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/uboot_env.c
// Function: uboot_env_unsetenv
int uboot_env_unsetenv(struct uboot_env *env, const char *name)
{
    struct uboot_name_value *prev = NULL;
    struct uboot_name_value *pair;
    for (pair = env->vars;
         pair != NULL;
         prev = pair, pair = pair->next) {
        if (strcmp(pair->name, name) == 0) {
            if (prev)
                prev->next = pair->next;
            else
                env->vars = pair->next;
            free(pair->name);
            free(pair->value);
            free(pair);
            break;
        }
    }
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
addq $0x8, %rbx
xorl %r13d, %r13d
movq %rbx, %rax
movq (%rax), %r14
testq %r14, %r14
je 0x33d0
movq (%r14), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x2310
testl %eax, %eax
je 0x33a5
leaq 0x10(%r14), %rax
movq %r14, %r13
jmp 0x3382
leaq 0x10(%r13), %rax
testq %r13, %r13
movq 0x10(%r14), %rcx
cmoveq %rbx, %rax
movq %rcx, (%rax)
movq %r12, %rdi
callq 0x2040
movq 0x8(%r14), %rdi
callq 0x2040
movq %r14, %rdi
callq 0x2040
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/uboot_env.c
// Function: uboot_env_getenv
int uboot_env_getenv(struct uboot_env *env, const char *name, char **value)
{
    struct uboot_name_value *pair;
    for (pair = env->vars; pair != NULL; pair = pair->next) {
        if (strcmp(pair->name, name) == 0) {
            *value = strdup(pair->value);
            return 0;
        }
    }

    *value = NULL;
    ERR_RETURN("variable '%s' not found", name);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
addq $0x8, %r15
movq (%r15), %r15
testq %r15, %r15
je 0x340b
movq (%r15), %rdi
movq %r14, %rsi
callq 0x2310
testl %eax, %eax
je 0x3425
addq $0x10, %r15
jmp 0x33ee
andq $0x0, (%rbx)
leaq 0x5475(%rip), %rdi      # 0x888b
movq %r14, %rsi
xorl %eax, %eax
callq 0x2ee4
pushq $-0x1
popq %rax
jmp 0x3433
movq 0x8(%r15), %rdi
callq 0x24d0
movq %rax, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_gc_heap
void term_gc_heap()
{
    struct term *old_variables;
    char *old_heap;

    if (!heap) {
        old_variables = NULL;
        old_heap = NULL;
    } else {
        old_heap = heap;
        old_variables = variables;
    }

    heap = malloc(HEAP_SIZE);
    memset(heap, 0, HEAP_SIZE);

    heap_index = 0;
    variables = NULL;

    while (old_variables) {
        set_variable(old_variables->var.name, term_dupe(old_variables->var.value));
        old_variables = old_variables->next;
    }

    if (old_heap)
        free(old_heap);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x8ae8(%rip), %rbx      # 0xd640
movq %rbx, %r15
testq %rbx, %rbx
je 0x4b67
movq 0x8ae1(%rip), %r15      # 0xd648
pushq $0x1
popq %rdi
movl $0x4098, %esi           # imm = 0x4098
callq 0x2300
andl $0x0, 0x8ad5(%rip)      # 0xd650
movq %rax, 0x8abe(%rip)      # 0xd640
andq $0x0, 0x8abe(%rip)      # 0xd648
testq %r15, %r15
je 0x4bad
movq 0x8(%r15), %r14
movq 0x10(%r15), %rdi
callq 0x4c0e
movq %r14, %rdi
movq %rax, %rsi
callq 0x4bba
movq 0x18(%r15), %r15
jmp 0x4b8a
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: set_variable
void set_variable(const char *name, const struct term *value)
{
    struct term *var = get_variable_impl(name);
    if (var) {
        var->var.value = value;
    } else {
        struct term *rv = alloc_heap(sizeof(struct term));
        rv->kind = term_variable;
        rv->var.name = alloc_string(name);
        rv->var.value = value;
        rv->next = variables;
        variables = rv;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x5178
testq %rax, %rax
je 0x4bd5
movq %rbx, 0x10(%rax)
jmp 0x4c08
pushq $0x20
popq %rdi
callq 0x4c62
movq %rax, %r15
movl $0x5, (%rax)
movq %r14, %rdi
callq 0x4cd9
movq %rax, 0x8(%r15)
movq %rbx, 0x10(%r15)
movq 0x8a4b(%rip), %rax      # 0xd648
movq %rax, 0x18(%r15)
movq %r15, 0x8a40(%rip)      # 0xd648
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_dupe
struct term *term_dupe(const struct term *rv)
{
    switch (rv->kind) {
    case term_identifier:
        return term_new_identifier(rv->identifier);
    case term_string:
        return term_new_string(rv->string);
    case term_number:
        return term_new_number(rv->number);
    case term_boolean:
        return term_new_boolean(rv->boolean);
    default:
        // Not supported
        return NULL;
    }
}

// Assembly:
movl (%rdi), %eax
cmpq $0x3, %rax
ja 0x4c49
leaq 0x4717(%rip), %rcx      # 0x9334
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rdi), %rdi
jmp 0x4d78
movl 0x8(%rdi), %edi
jmp 0x4c4c
movzbl 0x8(%rdi), %edi
jmp 0x4d62
movq 0x8(%rdi), %rdi
jmp 0x4caa
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_new_number
struct term *term_new_number(int value)
{
    struct term *rv = alloc_heap(sizeof(struct term));
    rv->kind = term_number;
    rv->number = value;
    return rv;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
pushq $0x20
popq %rdi
callq 0x4c62
movl $0x2, (%rax)
movl %ebx, 0x8(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: alloc_heap
static void *alloc_heap(size_t num_bytes)
{
    if (heap_index + num_bytes > HEAP_SIZE)
        fatal("Program too large. Out of heap");

    void *addr = &heap[heap_index];
    heap_index = (heap_index + num_bytes + 7) & ~7;
    return addr;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x89e4(%rip), %ecx      # 0xd650
movslq %ecx, %rax
leaq (%rax,%rdi), %rdx
cmpq $0x4099, %rdx           # imm = 0x4099
jb 0x4c93
leaq 0x471f(%rip), %rdi      # 0x93a2
xorl %eax, %eax
callq 0x2fc5
movl 0x89c0(%rip), %ecx      # 0xd650
movslq %ecx, %rax
addq 0x89a6(%rip), %rax      # 0xd640
addl %ebx, %ecx
addl $0x7, %ecx
andl $-0x8, %ecx
movl %ecx, 0x89a8(%rip)      # 0xd650
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_new_string
struct term *term_new_string(const char *value)
{
    struct term *rv = alloc_heap(sizeof(struct term));
    rv->kind = term_string;
    rv->string = alloc_string(value);
    return rv;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x20
popq %rdi
callq 0x4c62
movq %rax, %r14
movl $0x1, (%rax)
movq %rbx, %rdi
callq 0x4cd9
movq %rax, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_new_qstring
struct term *term_new_qstring(const char *value)
{
    struct term *rv = alloc_heap(sizeof(struct term));
    rv->kind = term_string;
    rv->string = alloc_qstring(value);
    return rv;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x20
popq %rdi
callq 0x4c62
movq %rax, %r14
movl $0x1, (%rax)
incq %rbx
movq %rbx, %rdi
callq 0x2190
movq %rax, %r15
movq %rax, %rdi
callq 0x4c62
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2350
movb $0x0, -0x1(%r12,%r15)
movq %r12, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_new_boolean
struct term *term_new_boolean(bool value)
{
    struct term *rv = alloc_heap(sizeof(struct term));
    rv->kind = term_boolean;
    rv->boolean = value;
    return rv;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
pushq $0x20
popq %rdi
callq 0x4c62
movl $0x3, (%rax)
movb %bl, 0x8(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_new_identifier
struct term *term_new_identifier(const char *value)
{
    struct term *rv = alloc_heap(sizeof(struct term));
    rv->kind = term_identifier;
    rv->identifier = alloc_string(value);
    return rv;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x20
popq %rdi
callq 0x4c62
movq %rax, %r14
andl $0x0, (%rax)
movq %rbx, %rdi
callq 0x4cd9
movq %rax, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_new_fun
struct term *term_new_fun(const char *name, struct term *parameters)
{
    int arity = 0;
    struct term *p = parameters;
    while (p) {
        arity++;
        p = p->next;
    }

    fun_handler fun = lookup_function(name, arity);
    if (!fun)
        return NULL;

    struct term *rv = alloc_heap(sizeof(struct term));
    rv->kind = term_fun;
    rv->fun.fun = fun;
    rv->fun.parameters = parameters;
    return rv;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
xorl %esi, %esi
movq %rbx, %rax
testq %rax, %rax
je 0x4dd5
incl %esi
movq 0x18(%rax), %rax
jmp 0x4dc8
callq 0x4e04
testq %rax, %rax
je 0x4dfa
movq %rax, %r14
pushq $0x20
popq %rdi
callq 0x4c62
movl $0x4, (%rax)
movq %r14, 0x8(%rax)
movq %rbx, 0x10(%rax)
jmp 0x4dfc
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: lookup_function
fun_handler lookup_function(const char *name, int arity)
{
    struct function_info *entry = function_table;
    while (entry->name) {
        if (strcmp(entry->name, name) == 0 && arity >= entry->arity)
            return entry->handler;
        entry++;
    }
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
leaq 0x8509(%rip), %r15      # 0xd320
xorl %ebx, %ebx
movq -0x10(%r15), %rdi
testq %rdi, %rdi
je 0x4e3d
movq %r14, %rsi
callq 0x2310
testl %eax, %eax
jne 0x4e34
cmpl %ebp, -0x8(%r15)
jle 0x4e3a
addq $0x20, %r15
jmp 0x4e19
movq (%r15), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: inspect
void inspect(const struct term *rv)
{
    switch (rv->kind) {
    case term_identifier:
        fprintf(stderr, "%s", rv->identifier);
        break;
    case term_string:
        fprintf(stderr, "\"%s\"", rv->string);
        break;
    case term_number:
        fprintf(stderr, "%d", rv->number);
        break;
    case term_boolean:
        fprintf(stderr, "%s", rv->boolean ? "true" : "false");
        break;
    case term_fun: {
        const struct term *p = rv->fun.parameters;
        const struct function_info *fun_info = function_info_by_fun(rv->fun.fun);
        fprintf(stderr, "%s(", fun_info->name);
        for (int i = 0; i < fun_info->arity; i++) {
            inspect(p);
            p = p->next;
            if (p)
                fprintf(stderr, ",");
        }
        fprintf(stderr, ")");
        break;
    }
    case term_variable:
        fprintf(stderr, "%s=", rv->var.name);
        inspect(rv->var.value);
        break;
    default:
        fprintf(stderr, "Unknown");
        break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x44e7(%rip), %r12      # 0x9344
movq 0x818c(%rip), %r15      # 0xcff0
leaq 0x4515(%rip), %r14      # 0x9380
movl (%rbx), %eax
cmpq $0x5, %rax
ja 0x4f65
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movq (%r15), %rdi
movq 0x8(%rbx), %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x2320
movq 0x10(%rbx), %rbx
jmp 0x4e6b
movq (%r15), %rsi
leaq 0x44d0(%rip), %rax      # 0x9371
leaq 0x44ce(%rip), %rdi      # 0x9376
cmpb $0x0, 0x8(%rbx)
cmovneq %rax, %rdi
jmp 0x4f58
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rbx
callq 0x4f82
movq %rax, %r14
movq (%r15), %rdi
movq (%rax), %rdx
leaq 0x44aa(%rip), %rsi      # 0x937c
xorl %r12d, %r12d
xorl %eax, %eax
callq 0x2320
pushq $0x2c
popq %rbp
cmpl 0x8(%r14), %r12d
jge 0x4f05
movq %rbx, %rdi
callq 0x4e4b
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
je 0x4f00
movq (%r15), %rsi
movl %ebp, %edi
callq 0x22b0
incl %r12d
jmp 0x4edf
movq (%r15), %rsi
pushq $0x29
popq %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x22b0
movq (%r15), %rdi
movl 0x8(%rbx), %edx
leaq 0x47ac(%rip), %rsi      # 0x96d1
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2320
movq (%r15), %rdi
movq 0x8(%rbx), %rdx
leaq 0x442a(%rip), %rsi      # 0x936c
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2320
movq (%r15), %rsi
movq 0x8(%rbx), %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2230
movq (%r15), %rcx
leaq 0x4415(%rip), %rdi      # 0x9384
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x24b0
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: run_functions
const struct term *run_functions(const struct term *rv)
{
    const struct term *last_result = NULL;
    while (rv) {
        last_result = run_function(rv);
        rv = rv->next;
    }
    return last_result;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
xorl %eax, %eax
testq %rbx, %rbx
je 0x4fb5
movq %rbx, %rdi
callq 0x4fb7
movq 0x18(%rbx), %rbx
jmp 0x4fa2
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_resolve
const struct term *term_resolve(const struct term *rv)
{
    switch (rv->kind) {
    case term_identifier:
        return term_resolve(get_variable(rv->identifier));
    case term_fun:
        return run_function(rv);
    default:
        return rv;
    }
}

// Assembly:
pushq %rax
movq %rdi, %rax
movl (%rax), %ecx
testl %ecx, %ecx
jne 0x4fe2
movq 0x8(%rax), %rdi
callq 0x4fef
jmp 0x4fd1
cmpl $0x4, %ecx
jne 0x4fed
movq %rax, %rdi
popq %rax
jmp 0x4fb7
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: get_variable
const struct term *get_variable(const char *name)
{
    struct term *var = get_variable_impl(name);
    if (var)
        return var->var.value;
    else
        return term_new_string("");
}

// Assembly:
pushq %rax
callq 0x5178
testq %rax, %rax
je 0x5000
movq 0x10(%rax), %rax
popq %rcx
retq
leaq 0x3402(%rip), %rdi      # 0x8409
popq %rax
jmp 0x4caa
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_compare
int term_compare(const struct term *left, const struct term *right)
{
    const struct term *rleft = term_resolve(left);
    const struct term *rright = term_resolve(right);

    // Make them the same...


    // Left and right are the same now.
    switch (rleft->kind) {
    case term_string:
        return strcmp(rleft->string, rright->string);
    case term_number:
        return rleft->number - rright->number;
    case term_boolean:
        // true > false
        return rleft->boolean - rright->boolean;
    default:
        return 1; // never happens
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
callq 0x4fcd
movq %rax, %rbx
movq %r14, %rdi
callq 0x4fcd
movl (%rbx), %ecx
cmpl $0x3, %ecx
je 0x5051
cmpl $0x2, %ecx
je 0x5049
cmpl $0x1, %ecx
jne 0x505d
movq 0x8(%rbx), %rdi
movq 0x8(%rax), %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2310
movl 0x8(%rbx), %ecx
subl 0x8(%rax), %ecx
jmp 0x5060
movzbl 0x8(%rbx), %ecx
movzbl 0x8(%rax), %eax
subl %eax, %ecx
jmp 0x5060
pushq $0x1
popq %rcx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
callq 0x4fcd
movl (%rax), %ecx
cmpl $0x3, %ecx
je 0x50bd
cmpl $0x2, %ecx
je 0x50b4
cmpl $0x1, %ecx
jne 0x50b0
movq 0x8(%rax), %rbx
cmpb $0x0, (%rbx)
je 0x50b0
leaq 0x329c(%rip), %rsi      # 0x832d
movq %rbx, %rdi
callq 0x2060
testl %eax, %eax
je 0x50b0
leaq 0x42d2(%rip), %rsi      # 0x9376
movq %rbx, %rdi
callq 0x2060
testl %eax, %eax
jmp 0x50b8
xorl %eax, %eax
jmp 0x50c0
cmpl $0x0, 0x8(%rax)
setne %al
jmp 0x50c0
movb 0x8(%rax), %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rax
callq 0x4fcd
movl (%rax), %edx
cmpl $0x3, %edx
je 0x50f2
cmpl $0x2, %edx
je 0x50ed
xorl %ecx, %ecx
cmpl $0x1, %edx
jne 0x50f6
movq 0x8(%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22f0
movq %rax, %rcx
jmp 0x50f6
movl 0x8(%rax), %ecx
jmp 0x50f6
movzbl 0x8(%rax), %ecx
movl %ecx, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0x20, %rsp
leaq 0x4256(%rip), %rbx      # 0x935c
callq 0x4fcd
movl (%rax), %ecx
cmpq $0x3, %rcx
ja 0x5167
movslq (%rbx,%rcx,4), %rcx
addq %rbx, %rcx
jmpq *%rcx
movq 0x8(%rax), %rdi
callq 0x4fef
movq %rax, %rdi
jmp 0x5106
leaq 0x4240(%rip), %rcx      # 0x9371
cmpb $0x0, 0x8(%rax)
leaq 0x423a(%rip), %rdi      # 0x9376
cmovneq %rcx, %rdi
jmp 0x516e
movl 0x8(%rax), %edx
leaq 0x4585(%rip), %rsi      # 0x96d1
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2490
movq %rbx, %rdi
callq 0x4caa
addq $0x20, %rsp
popq %rbx
retq
leaq 0x329b(%rip), %rdi      # 0x8409
addq $0x20, %rsp
popq %rbx
jmp 0x4caa
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x7120
movq 0x7ca4(%rip), %r15      # 0xcff0
leaq 0x42e0(%rip), %r12      # 0x9633
leaq 0x42de(%rip), %r13      # 0x9638
leaq 0x42c1(%rip), %r14      # 0x9622
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x538c
cmpl $0x0, 0x8(%rbx)
movq %r12, %rcx
je 0x5375
movq %r13, %rcx
movq (%r15), %rdi
leaq 0xc(%rbx), %rdx
leaq 0x2c(%rbx), %r8
movq %r14, %rsi
xorl %eax, %eax
callq 0x2320
jmp 0x5361
movq 0x8(%rsp), %rdi
callq 0x7546
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdi, %rbx
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x53da
cmpq $0xe, %r14
ja 0x53da
movq %rbx, %rdi
callq 0x50fa
movq 0x8(%rax), %rax
movq %rax, (%rsp,%r14,8)
movq 0x18(%rbx), %rbx
incq %r14
jmp 0x53b6
andq $0x0, (%rsp,%r14,8)
leaq 0x80(%rsp), %rsi
movb $0x0, (%rsi)
movq %rsp, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x77b4
testl %eax, %eax
je 0x540d
movq (%rsp), %rsi
leaq 0x4237(%rip), %rdi      # 0x963d
xorl %eax, %eax
callq 0x2ee4
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
callq 0x30c1
movq %rbx, %rdi
callq 0x4caa
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
leaq 0x8164(%rip), %r14      # 0xd5a0
addq $0x8, %r14
movq 0x7ba9(%rip), %r15      # 0xcff0
leaq 0x420e(%rip), %rbx      # 0x965c
movq (%r14), %r14
testq %r14, %r14
je 0x5470
movq (%r15), %rdi
movq (%r14), %rdx
movq 0x8(%r14), %rcx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2320
addq $0x10, %r14
jmp 0x544e
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0x160, %rsp            # imm = 0x160
leaq 0x41fd(%rip), %rdi      # 0x9684
callq 0x51af
movq %rsp, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x7649
testl %eax, %eax
js 0x550d
leaq 0x41ee(%rip), %rax      # 0x9693
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x41ed(%rip), %rax      # 0x96a1
movq %rax, 0x8(%rdi)
leaq 0x41ec(%rip), %rax      # 0x96ab
movq %rax, 0x10(%rdi)
movq %rbx, 0x18(%rdi)
leaq 0x41e0(%rip), %rax      # 0x96ae
movq %rax, 0x20(%rdi)
leaq 0x3f44(%rip), %rax      # 0x941d
movq %rax, 0x28(%rdi)
andq $0x0, 0x30(%rdi)
leaq 0x60(%rsp), %rsi
movb $0x0, (%rsi)
movl $0x100, %edx            # imm = 0x100
callq 0x77b4
testl %eax, %eax
je 0x552b
leaq 0x41b2(%rip), %rdi      # 0x96b1
leaq 0x60(%rsp), %rsi
xorl %eax, %eax
callq 0x2ee4
jmp 0x551b
leaq 0x414f(%rip), %rdi      # 0x9663
xorl %eax, %eax
callq 0x2ee4
xorl %edi, %edi
callq 0x4d62
addq $0x160, %rsp            # imm = 0x160
popq %rbx
retq
movl $0x1234567, %edi        # imm = 0x1234567
callq 0x24c0
pushq $0x1
popq %rdi
callq 0x24a0
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0x10, %rsp
callq 0x50fa
movq 0x8(%rax), %rsi
leaq 0x804e(%rip), %rdi      # 0xd5a0
leaq 0x8(%rsp), %rdx
callq 0x33dc
testl %eax, %eax
js 0x5579
movq 0x8(%rsp), %rdi
callq 0x4caa
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x2040
jmp 0x5588
leaq 0x2e89(%rip), %rdi      # 0x8409
callq 0x4caa
movq %rax, %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x7d82(%rip), %r13      # 0xd328
leaq 0x4121(%rip), %rbx      # 0x96ce
movq %rsp, %r14
pushq $0x10
popq %r15
movq 0x7a35(%rip), %rbp      # 0xcff0
leaq 0x4112(%rip), %r12      # 0x96d4
cmpq $0x0, -0x8(%r13)
je 0x5605
cmpq $0x0, (%r13)
jne 0x55d6
addq $0x20, %r13
jmp 0x55c2
movq -0x18(%r13), %rcx
movl -0x10(%r13), %r8d
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2210
movq (%rbp), %rdi
movq (%r13), %rcx
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2320
jmp 0x55d0
movq (%rbp), %rcx
leaq 0x40cd(%rip), %rdi      # 0x96dd
pushq $0x1b
popq %rsi
pushq $0x1
popq %rdx
callq 0x24b0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x579f
callq 0x50fa
movq 0x8(%rax), %rdi
jmp 0x57a6
leaq 0x2c18(%rip), %rdi      # 0x83be
movq 0x7823(%rip), %rcx      # 0xcfd0
movq %rsp, %rsi
xorl %edx, %edx
callq 0x2260
movl %eax, %ebx
testl %eax, %eax
movl $0x0, %r15d
cmovgl %eax, %r15d
movq 0x7824(%rip), %r12      # 0xcff0
leaq 0x3fa5(%rip), %r13      # 0x9778
leaq 0x3f95(%rip), %r14      # 0x976f
xorl %ebp, %ebp
cmpq %rbp, %r15
je 0x5810
movq (%rsp), %rax
movq (%rax,%rbp,8), %rdx
cmpb $0x4, 0x12(%rdx)
movq %r13, %rcx
je 0x57f9
leaq 0x2c10(%rip), %rcx      # 0x8409
movq (%r12), %rdi
addq $0x13, %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x2320
incq %rbp
jmp 0x57dc
testl %ebx, %ebx
js 0x5835
movl %ebx, %ebx
xorl %r14d, %r14d
movq (%rsp), %rdi
cmpq %r14, %rbx
je 0x5830
movq (%rdi,%r14,8), %rdi
callq 0x2040
incq %r14
jmp 0x5819
callq 0x2040
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x7789(%rip), %r14      # 0xcff0
testq %rbx, %rbx
je 0x5886
movq %rbx, %rdi
callq 0x50fa
movq (%r14), %rsi
movq 0x8(%rax), %rdi
callq 0x2230
movq 0x18(%rbx), %rbx
jmp 0x5867
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x22b0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x1028, %rsp           # imm = 0x1028
callq 0x50fa
movq 0x8(%rax), %r14
leaq 0x3ec9(%rip), %rsi      # 0x977e
movq %r14, %rdi
callq 0x2430
testq %rax, %rax
je 0x58fa
movq %rax, %rbx
movq %rsp, %r14
pushq $0x1
popq %rsi
movl $0x1025, %edx           # imm = 0x1025
movq %r14, %rdi
movq %rax, %rcx
callq 0x2120
movb $0x0, (%rsp,%rax)
movq %rbx, %rdi
callq 0x2170
movq %r14, %rdi
callq 0x4caa
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r14
retq
leaq 0x3e80(%rip), %rdi      # 0x9781
movq %r14, %rsi
xorl %eax, %eax
callq 0x2ee4
leaq 0x2af7(%rip), %rdi      # 0x8409
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r14
jmp 0x4caa
// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_saveenv
static const struct term *function_saveenv(const struct term *parameters)
{
    (void)parameters;

    const char *devpathspec = get_variable_as_string("uboot_env.path");
    char devpath[BLOCK_DEVICE_PATH_LEN];

    int block = get_variable_as_number("uboot_env.start");
    int block_count = get_variable_as_number("uboot_env.count");

    working_uboot_env.env_size = block_count * 512;
    int fd = open_block_device(devpathspec, O_WRONLY, devpath);
    if (fd < 0) {
        info("Could not open '%s'", devpathspec);
        return NULL;
    }
    if (lseek(fd, block * 512, SEEK_SET) < 0) {
        info("Could not seek to block %d (byte offset %d) in '%s'", block, block * 512, devpath);
        close(fd);
        return NULL;
    }
    char *buffer = malloc(working_uboot_env.env_size);
    if (uboot_env_write(&working_uboot_env, buffer) < 0) {
        free(buffer);
        return NULL;
    }

    ssize_t amount_written = write(fd, buffer, working_uboot_env.env_size);
    close(fd);
    free(buffer);

    if (amount_written != (ssize_t) working_uboot_env.env_size) {
        info("Could not write %d blocks (%d bytes) from '%s'", block_count, working_uboot_env.env_size, devpath);
        return NULL;
    }

    set_boolean_variable("uboot_env.modified", false);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
leaq 0x3d3d(%rip), %rdi      # 0x9684
callq 0x51af
movq %rax, %r12
leaq 0x2898(%rip), %rdi      # 0x81ee
callq 0x51eb
movl %eax, %r15d
leaq 0x2899(%rip), %rdi      # 0x81fe
callq 0x51eb
movl %eax, %ebx
shll $0x9, %eax
cltq
leaq 0x7c28(%rip), %r14      # 0xd5a0
movq %rax, (%r14)
pushq $0x1
popq %rsi
movq %rsp, %rdx
movq %r12, %rdi
callq 0x755b
testl %eax, %eax
js 0x59f8
movl %eax, %ebp
movl %r15d, %r12d
shll $0x9, %r12d
movslq %r12d, %rsi
movl %eax, %edi
xorl %edx, %edx
callq 0x2220
testq %rax, %rax
js 0x5a0b
movq (%r14), %rdi
callq 0x2380
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x3439
testl %eax, %eax
js 0x5a2b
movq (%r14), %rdx
movl %ebp, %edi
movq %r15, %rsi
callq 0x2140
movq %rax, %r12
movl %ebp, %edi
callq 0x2280
movq %r15, %rdi
callq 0x2040
movq (%r14), %rdx
cmpq %rdx, %r12
jne 0x5a35
leaq 0x27ec(%rip), %rdi      # 0x81db
xorl %esi, %esi
callq 0x521c
jmp 0x5a48
leaq 0x3cfa(%rip), %rdi      # 0x96f9
movq %r12, %rsi
xorl %eax, %eax
callq 0x2ee4
jmp 0x5a48
leaq 0x3cfb(%rip), %rdi      # 0x970d
movq %rsp, %rcx
movl %r15d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x2ee4
movl %ebp, %edi
callq 0x2280
jmp 0x5a48
movq %r15, %rdi
callq 0x2040
jmp 0x5a48
leaq 0x3d56(%rip), %rdi      # 0x9792
movq %rsp, %rcx
movl %ebx, %esi
xorl %eax, %eax
callq 0x2ee4
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x50fa
movq 0x8(%rax), %r14
movq 0x18(%rbx), %rdi
callq 0x50fa
movq 0x8(%rax), %r15
leaq 0x7b24(%rip), %rdi      # 0xd5a0
movq %r14, %rsi
movq %r15, %rdx
callq 0x32dc
testl %eax, %eax
js 0x5a9c
leaq 0x2749(%rip), %rdi      # 0x81db
pushq $0x1
popq %rsi
callq 0x521c
jmp 0x5ab0
leaq 0x3d1e(%rip), %rdi      # 0x97c1
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2ee4
movq 0x18(%rbx), %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r14
pushq %rbx
leaq 0x7b6e(%rip), %rbx      # 0xd648
movq 0x750f(%rip), %r14      # 0xcff0
pushq $0xa
popq %rbp
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x5b04
movq %rbx, %rdi
callq 0x4e4b
movq (%r14), %rsi
movl %ebp, %edi
callq 0x22b0
addq $0x18, %rbx
jmp 0x5ae4
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
testq %rdi, %rdi
je 0x7559
movq (%rdi), %rbx
callq 0x2040
movq %rbx, %rdi
jmp 0x7547
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
callq 0x75cf
movl %eax, %r15d
movl 0x601c(%rip), %eax      # 0xd594
testl %r15d, %r15d
jns 0x75ab
testl %eax, %eax
jle 0x75ab
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x2530
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x75cf
movl %eax, %r15d
movl 0x5ff3(%rip), %eax      # 0xd594
decl %eax
movl %eax, 0x5feb(%rip)      # 0xd594
jmp 0x7578
testl %r15d, %r15d
jns 0x75c1
leaq 0x23fd(%rip), %rdi      # 0x99b4
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2ee4
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movl %edi, %r12d
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x7120
pushq $-0x1
popq %rbp
movq (%r14), %r14
testq %r14, %r14
je 0x779b
cmpl %r12d, 0x8(%r14)
jne 0x776c
leaq 0x2c(%r14), %rsi
movq %r15, %rdi
callq 0x2060
testl %eax, %eax
jne 0x776c
addq $0xc, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x20a0
xorl %ebp, %ebp
movq 0x8(%rsp), %rdi
callq 0x7546
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %rbx
movq %rdi, %rcx
leaq 0x1efb(%rip), %rdx      # 0x9b6c
leaq 0x100(%rsp), %r14
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
xorl %eax, %eax
callq 0x2210
leaq 0x1eed(%rip), %rdx      # 0x9b7c
movq %rsp, %r15
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2210
movq %r15, %rdi
movq %r14, %rsi
callq 0x2200
testl %eax, %eax
jns 0x7cdb
callq 0x2070
movl (%rax), %edi
callq 0x24e0
leaq 0x1ebe(%rip), %rdi      # 0x9b84
leaq 0x100(%rsp), %rsi
movq %rsp, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2ee4
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %r8
movq %rdi, %rcx
leaq 0x1dfe(%rip), %rdx      # 0x9b07
xorl %ebx, %ebx
leaq 0x10(%rsp), %r14
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
xorl %eax, %eax
callq 0x2210
leaq 0x3ec(%rip), %rsi       # 0x8112
movq %r14, %rdi
callq 0x2430
testq %rax, %rax
je 0x7d70
movq %rax, %r14
leaq 0x1dda(%rip), %rsi      # 0x9b17
xorl %ebx, %ebx
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rax, %rdi
xorl %eax, %eax
callq 0x20c0
cmpl $0x2, %eax
jne 0x7d68
movl 0xc(%rsp), %edi
movl 0x8(%rsp), %esi
callq 0x24f0
movq %rax, %rbx
movq %r14, %rdi
callq 0x2170
movq %rbx, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jaroslov[P]docoptc/./docopt.h
// Function: docopt_print_help
void docopt_print_help(struct docopt_parse_state* dS, int moreInfo)
{
    dS->entries->error  = DOCOPT_PRINTED_HELP;
    if (dS->entries->flags & DOCOPT_NO_HELP) return;
    if (moreInfo)
    {
        docopt_strip(&dS->entries->docstr, "\n");
        fprintf(stderr, "%.*s\n", DOCOPT_PR((&dS->entries->docstr)));
    }
    else
    {
        fprintf(stderr, "%s", "Usage:\n");
        docopt_strip(&dS->usage_section, "\n");
        fprintf(stderr, "%.*s\n", DOCOPT_PR((&dS->usage_section)));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
movl $0x5, (%rdi)
testb $0x1, 0x18(%rdi)
je 0x726b
popq %rbx
popq %r14
popq %rbp
retq
testl %esi, %esi
jne 0x7297
movq 0x29d82(%rip), %rax     # 0x30ff8
movq (%rax), %rsi
leaq 0x2df2(%rip), %rdi      # 0xa072
callq 0x7090
leaq 0x28(%rbx), %r14
movq %r14, %rdi
callq 0x72cf
addq $0x30, %rbx
jmp 0x72ac
addq $0x8, %rdi
callq 0x72cf
movq 0x8(%rbx), %rbx
leaq 0x8(%rbx), %r14
addq $0x10, %rbx
movq 0x29d45(%rip), %rax     # 0x30ff8
movq (%rax), %rdi
movl (%rbx), %edx
movq (%r14), %rcx
subl %ecx, %edx
leaq 0x2da8(%rip), %rsi      # 0xa06c
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x70e0