LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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, %r14
callq 0x35e1
movl (%rbx), %ebp
leaq 0x4(%rbx), %r15
movq (%r14), %rsi
addq $-0x4, %rsi
movq %r15, %rdi
callq 0x3474
cmpl %eax, %ebp
jne 0x35a9
movq (%r14), %rax
xorl %ecx, %ecx
cmpq $0x4, %rax
je 0x35d0
addq %rax, %rbx
xorl %ecx, %ecx
cmpb $0x0, (%r15)
je 0x35d0
leaq 0x1(%r15), %r13
xorl %ebp, %ebp
cmpq %rbx, %r13
je 0x35bd
movzbl (%r13), %eax
incq %r13
decq %rbp
cmpl $0x3d, %eax
je 0x352b
testl %eax, %eax
jne 0x3509
jmp 0x35bd
movq %r15, 0x10(%rsp)
cmpq %rbx, %r13
je 0x35bd
xorl %r15d, %r15d
movq %r13, %r12
cmpb $0x0, (%r12)
je 0x3553
incq %r12
decq %r15
cmpq %rbx, %r12
jne 0x353f
jmp 0x35bd
movl $0x18, %edi
callq 0x2380
movq %rax, 0x8(%rsp)
negq %rbp
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x22d0
movq 0x8(%rsp), %rbp
movq %rax, (%rbp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x22d0
xorl %ecx, %ecx
movq %rax, 0x8(%rbp)
movq 0x8(%r14), %rax
movq %rax, 0x10(%rbp)
movq %rbp, 0x8(%r14)
incq %r12
movq %r12, %r15
cmpq %rbx, %r12
jne 0x34f9
jmp 0x35d0
leaq 0x6280(%rip), %rdi      # 0x9830
movl %ebp, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x3204
jmp 0x35cb
leaq 0x62ac(%rip), %rdi      # 0x9870
xorl %eax, %eax
callq 0x3204
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
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_O3/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 0x3617
movq (%r14), %rdi
callq 0x2040
movq 0x8(%r14), %rdi
callq 0x2040
movq 0x10(%r14), %r15
movq %r14, %rdi
callq 0x2040
movq %r15, %r14
testq %r15, %r15
jne 0x35f2
movq $0x0, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x8(%rdi), %r13
testq %r13, %r13
je 0x365d
movq %r13, %r12
movq (%r12), %rdi
movq %r15, %rsi
callq 0x2310
testl %eax, %eax
je 0x368e
movq 0x10(%r12), %r12
testq %r12, %r12
jne 0x3643
movl $0x18, %edi
callq 0x2380
movq %rax, %r12
movq %r15, %rdi
callq 0x24d0
movq %rax, (%r12)
movq %rbx, %rdi
callq 0x24d0
movq %rax, 0x8(%r12)
movq %r13, 0x10(%r12)
movq %r12, 0x8(%r14)
jmp 0x36a5
movq 0x8(%r12), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x24d0
movq %rax, 0x8(%r12)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8(%rdi), %rbx
testq %rbx, %rbx
je 0x372f
movq %rsi, %r12
movq %rdi, %r14
movq (%rbx), %r15
movq %r15, %rdi
callq 0x2310
testl %eax, %eax
je 0x36fe
movq %rbx, %r13
movq 0x10(%r13), %rbx
testq %rbx, %rbx
je 0x372f
movq (%rbx), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x2310
movq %r13, %rcx
movq %rbx, %r13
testl %eax, %eax
jne 0x36db
jmp 0x3700
xorl %ecx, %ecx
addq $0x8, %r14
leaq 0x10(%rcx), %rax
testq %rcx, %rcx
movq 0x10(%rbx), %rcx
cmoveq %r14, %rax
movq %rcx, (%rax)
movq %r15, %rdi
callq 0x2040
movq 0x8(%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8(%rdi), %r15
testq %r15, %r15
je 0x3764
movq (%r15), %rdi
movq %r14, %rsi
callq 0x2310
testl %eax, %eax
je 0x3783
movq 0x10(%r15), %r15
jmp 0x374a
movq $0x0, (%rbx)
leaq 0x6119(%rip), %rdi      # 0x988b
movq %r14, %rsi
xorl %eax, %eax
callq 0x3204
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3791
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_O3/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x9562(%rip), %rbx      # 0xe640
testq %rbx, %rbx
sete %bpl
movq 0x955c(%rip), %r15      # 0xe648
movl $0x1, %edi
movl $0x4098, %esi           # imm = 0x4098
callq 0x2300
movq %rax, 0x953e(%rip)      # 0xe640
movl $0x0, 0x9544(%rip)      # 0xe650
movq $0x0, 0x9531(%rip) # 0xe648
testq %r15, %r15
sete %al
orb %bpl, %al
jne 0x5143
movq 0x8(%r15), %r14
movq 0x10(%r15), %rdi
callq 0x5234
movq %r14, %rdi
movq %rax, %rsi
callq 0x5165
movq 0x18(%r15), %r15
testq %r15, %r15
jne 0x5122
testq %rbx, %rbx
je 0x515a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2040
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x58cf
testq %rax, %rax
je 0x5189
movq %rbx, 0x10(%rax)
jmp 0x5225
movl 0x94c1(%rip), %eax      # 0xe650
movslq %eax, %r13
leaq -0x4079(%r13), %rcx
cmpq $-0x409a, %rcx          # imm = 0xBF66
ja 0x51b9
leaq 0x51e5(%rip), %rdi      # 0xa38e
xorl %eax, %eax
callq 0x32e5
movl 0x949a(%rip), %eax      # 0xe650
movslq %eax, %r13
movq 0x9480(%rip), %rbp      # 0xe640
movq %rbp, %rcx
addq %r13, %rcx
movq %rcx, (%rsp)
addl $0x27, %eax
andl $-0x8, %eax
movl %eax, 0x947a(%rip)      # 0xe650
movl $0x5, (%rbp,%r13)
movq %r14, %rdi
callq 0x2190
leaq 0x1(%rax), %r15
movq %r15, %rdi
callq 0x52c8
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2350
movq %r12, 0x8(%rbp,%r13)
movq %rbx, 0x10(%rbp,%r13)
movq 0x9433(%rip), %rax      # 0xe648
movq %rax, 0x18(%rbp,%r13)
movq (%rsp), %rax
movq %rax, 0x9423(%rip)      # 0xe648
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x526f
leaq 0x50f1(%rip), %rcx      # 0xa334
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rdi), %rdi
jmp 0x54a6
movl 0x8(%rdi), %edi
jmp 0x5272
movzbl 0x8(%rdi), %edi
jmp 0x5450
movq 0x8(%rdi), %rdi
jmp 0x5310
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl 0x93d5(%rip), %edx      # 0xe650
movslq %edx, %rcx
leaq -0x4079(%rcx), %rax
cmpq $-0x409a, %rax          # imm = 0xBF66
ja 0x52a4
leaq 0x50fa(%rip), %rdi      # 0xa38e
xorl %eax, %eax
callq 0x32e5
movl 0x93af(%rip), %edx      # 0xe650
movslq %edx, %rcx
movq 0x9395(%rip), %rsi      # 0xe640
leaq (%rsi,%rcx), %rax
addl $0x27, %edx
andl $-0x8, %edx
movl %edx, 0x9395(%rip)      # 0xe650
movl $0x2, (%rsi,%rcx)
movl %ebx, 0x8(%rsi,%rcx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x937e(%rip), %ecx      # 0xe650
movslq %ecx, %rax
leaq (%rax,%rdi), %rdx
cmpq $0x4099, %rdx           # imm = 0x4099
jb 0x52f9
leaq 0x50a5(%rip), %rdi      # 0xa38e
xorl %eax, %eax
callq 0x32e5
movl 0x935a(%rip), %ecx      # 0xe650
movslq %ecx, %rax
addq 0x9340(%rip), %rax      # 0xe640
addl %ebx, %ecx
addl $0x7, %ecx
andl $-0x8, %ecx
movl %ecx, 0x9342(%rip)      # 0xe650
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x932c(%rip), %eax      # 0xe650
movslq %eax, %r13
leaq -0x4079(%r13), %rcx
cmpq $-0x409a, %rcx          # imm = 0xBF66
ja 0x534e
leaq 0x5050(%rip), %rdi      # 0xa38e
xorl %eax, %eax
callq 0x32e5
movl 0x9305(%rip), %eax      # 0xe650
movslq %eax, %r13
movq 0x92eb(%rip), %rbp      # 0xe640
movq %rbp, %r14
addq %r13, %r14
addl $0x27, %eax
andl $-0x8, %eax
movl %eax, 0x92e9(%rip)      # 0xe650
movl $0x1, (%rbp,%r13)
movq %rbx, %rdi
callq 0x2190
leaq 0x1(%rax), %r15
movq %r15, %rdi
callq 0x52c8
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2350
movq %r12, 0x8(%rbp,%r13)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x9290(%rip), %eax      # 0xe650
movslq %eax, %r13
leaq -0x4079(%r13), %rcx
cmpq $-0x409a, %rcx          # imm = 0xBF66
ja 0x53ea
leaq 0x4fb4(%rip), %rdi      # 0xa38e
xorl %eax, %eax
callq 0x32e5
movl 0x9269(%rip), %eax      # 0xe650
movslq %eax, %r13
movq 0x924f(%rip), %rbp      # 0xe640
movq %rbp, %r14
addq %r13, %r14
addl $0x27, %eax
andl $-0x8, %eax
movl %eax, 0x924d(%rip)      # 0xe650
movl $0x1, (%rbp,%r13)
incq %rbx
movq %rbx, %rdi
callq 0x2190
movq %rax, %r15
movq %rax, %rdi
callq 0x52c8
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2350
movb $0x0, -0x1(%r12,%r15)
movq %r12, 0x8(%rbp,%r13)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl 0x91f7(%rip), %edx      # 0xe650
movslq %edx, %rcx
leaq -0x4079(%rcx), %rax
cmpq $-0x409a, %rax          # imm = 0xBF66
ja 0x5482
leaq 0x4f1c(%rip), %rdi      # 0xa38e
xorl %eax, %eax
callq 0x32e5
movl 0x91d1(%rip), %edx      # 0xe650
movslq %edx, %rcx
movq 0x91b7(%rip), %rsi      # 0xe640
leaq (%rsi,%rcx), %rax
addl $0x27, %edx
andl $-0x8, %edx
movl %edx, 0x91b7(%rip)      # 0xe650
movl $0x3, (%rsi,%rcx)
movb %bl, 0x8(%rsi,%rcx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x9196(%rip), %eax      # 0xe650
movslq %eax, %r13
leaq -0x4079(%r13), %rcx
cmpq $-0x409a, %rcx          # imm = 0xBF66
ja 0x54e4
leaq 0x4eba(%rip), %rdi      # 0xa38e
xorl %eax, %eax
callq 0x32e5
movl 0x916f(%rip), %eax      # 0xe650
movslq %eax, %r13
movq 0x9155(%rip), %rbp      # 0xe640
movq %rbp, %r14
addq %r13, %r14
addl $0x27, %eax
andl $-0x8, %eax
movl %eax, 0x9153(%rip)      # 0xe650
movl $0x0, (%rbp,%r13)
movq %rbx, %rdi
callq 0x2190
leaq 0x1(%rax), %r15
movq %r15, %rdi
callq 0x52c8
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2350
movq %r12, 0x8(%rbp,%r13)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_reverse
struct term *term_reverse(struct term *rv)
{
    struct term *prev = NULL;
    while (rv) {
        struct term *next = rv->next;
        rv->next = prev;
        prev = rv;
        rv = next;
    }
    return prev;
}

// Assembly:
testq %rdi, %rdi
je 0x555d
xorl %ecx, %ecx
movq %rdi, %rax
movq 0x18(%rdi), %rdi
movq %rcx, 0x18(%rax)
movq %rax, %rcx
testq %rdi, %rdi
jne 0x5549
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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
testq %rsi, %rsi
je 0x557e
xorl %esi, %esi
movq %rbx, %rax
incl %esi
movq 0x18(%rax), %rax
testq %rax, %rax
jne 0x5571
jmp 0x5580
xorl %esi, %esi
callq 0x55f0
testq %rax, %rax
je 0x55e6
movq %rax, %r14
movl 0x90bd(%rip), %edx      # 0xe650
movslq %edx, %rcx
leaq -0x4079(%rcx), %rax
cmpq $-0x409a, %rax          # imm = 0xBF66
ja 0x55bc
leaq 0x4de2(%rip), %rdi      # 0xa38e
xorl %eax, %eax
callq 0x32e5
movl 0x9097(%rip), %edx      # 0xe650
movslq %edx, %rcx
movq 0x907d(%rip), %rsi      # 0xe640
leaq (%rsi,%rcx), %rax
addl $0x27, %edx
andl $-0x8, %edx
movl %edx, 0x907d(%rip)      # 0xe650
movl $0x4, (%rsi,%rcx)
movq %r14, 0x8(%rsi,%rcx)
movq %rbx, 0x10(%rsi,%rcx)
jmp 0x55e8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq %rdi, %r14
movq 0x8d0f(%rip), %rdi      # 0xe310
testq %rdi, %rdi
je 0x5631
movl %esi, %ebp
leaq 0x8d21(%rip), %r15      # 0xe330
xorl %ebx, %ebx
movq %r14, %rsi
callq 0x2310
testl %eax, %eax
jne 0x5623
cmpl %ebp, -0x18(%r15)
jle 0x5635
movq (%r15), %rdi
addq $0x20, %r15
testq %rdi, %rdi
jne 0x5611
jmp 0x5639
xorl %ebx, %ebx
jmp 0x5639
movq -0x10(%r15), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x899a(%rip), %r15      # 0xdff0
leaq 0x4d0f(%rip), %r14      # 0xa36c
movl (%rbx), %eax
cmpl $0x5, %eax
jne 0x567b
movq (%r15), %rdi
movq 0x8(%rbx), %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x2320
movq 0x10(%rbx), %rbx
jmp 0x565d
jae 0x56c1
movl %eax, %eax
leaq 0x4cbe(%rip), %rcx      # 0xa344
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
callq 0x271e
jmp 0x56c6
movq %rbx, %rdi
callq 0x2631
jmp 0x56c6
movq %rbx, %rdi
callq 0x26e1
jmp 0x56c6
movq %rbx, %rdi
callq 0x26b9
jmp 0x56c6
movq %rbx, %rdi
callq 0x26ff
jmp 0x56c6
callq 0x2731
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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:
testq %rdi, %rdi
je 0x5712
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x5700
movq 0x10(%rbx), %rdi
callq *%rax
jmp 0x5707
xorl %edi, %edi
callq 0x5450
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
jne 0x56ef
popq %rbx
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x572a
movq 0x8(%rax), %rdi
callq 0x5749
jmp 0x5719
cmpl $0x4, %ecx
jne 0x573f
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x5741
movq 0x10(%rax), %rdi
popq %rax
jmpq *%rcx
popq %rcx
retq
xorl %edi, %edi
popq %rax
jmp 0x5450
// File: /workspace/github_c_makefile_star2_O3/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 0x58cf
testq %rax, %rax
je 0x575a
movq 0x10(%rax), %rax
popq %rcx
retq
leaq 0x3ca8(%rip), %rdi      # 0x9409
popq %rax
jmp 0x5310
// File: /workspace/github_c_makefile_star2_O3/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 0x5715
movq %rax, %rbx
movq %r14, %rdi
callq 0x5715
movl (%rbx), %edx
cmpl $0x3, %edx
je 0x57b0
cmpl $0x2, %edx
je 0x57a8
movl $0x1, %ecx
cmpl $0x1, %edx
jne 0x57ba
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 0x57ba
movzbl 0x8(%rbx), %ecx
movzbl 0x8(%rax), %eax
subl %eax, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x5715
movl (%rax), %ecx
cmpl $0x3, %ecx
je 0x5817
cmpl $0x2, %ecx
je 0x580e
cmpl $0x1, %ecx
jne 0x580a
movq 0x8(%rax), %rbx
cmpb $0x0, (%rbx)
je 0x580a
leaq 0x3b42(%rip), %rsi      # 0x932d
movq %rbx, %rdi
callq 0x2060
testl %eax, %eax
je 0x580a
leaq 0x4b64(%rip), %rsi      # 0xa362
movq %rbx, %rdi
callq 0x2060
testl %eax, %eax
jmp 0x5812
xorl %eax, %eax
jmp 0x581a
cmpl $0x0, 0x8(%rax)
setne %al
jmp 0x581a
movb 0x8(%rax), %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x5715
movl (%rax), %edx
cmpl $0x3, %edx
je 0x584c
cmpl $0x2, %edx
je 0x5847
xorl %ecx, %ecx
cmpl $0x1, %edx
jne 0x5850
movq 0x8(%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22f0
movq %rax, %rcx
jmp 0x5850
movl 0x8(%rax), %ecx
jmp 0x5850
movzbl 0x8(%rax), %ecx
movl %ecx, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/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
callq 0x5715
movl (%rax), %ecx
testl %ecx, %ecx
jne 0x5872
movq 0x8(%rax), %rdi
callq 0x5749
movq %rax, %rdi
jmp 0x5859
cmpl $0x1, %ecx
je 0x58b8
cmpl $0x2, %ecx
je 0x5899
cmpl $0x3, %ecx
jne 0x58be
leaq 0x4ad5(%rip), %rcx      # 0xa35d
cmpb $0x0, 0x8(%rax)
leaq 0x4acf(%rip), %rdi      # 0xa362
cmovneq %rcx, %rdi
jmp 0x58c5
movl 0x8(%rax), %edx
leaq 0x4e1a(%rip), %rsi      # 0xa6bd
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2490
movq %rbx, %rdi
callq 0x5310
addq $0x20, %rsp
popq %rbx
retq
leaq 0x3b44(%rip), %rdi      # 0x9409
addq $0x20, %rsp
popq %rbx
jmp 0x5310
// File: /workspace/github_c_makefile_star2_O3/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 0x7ac8
movq (%rbx), %r14
testq %r14, %r14
je 0x5abe
movq 0x8577(%rip), %r15      # 0xdff0
leaq 0x4b9f(%rip), %r12      # 0xa61f
leaq 0x4b9d(%rip), %r13      # 0xa624
leaq 0x4b80(%rip), %rbx      # 0xa60e
movq (%r15), %rdi
leaq 0xc(%r14), %rdx
cmpl $0x0, 0x8(%r14)
movq %r13, %rcx
cmoveq %r12, %rcx
leaq 0x2c(%r14), %r8
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2320
movq (%r14), %r14
testq %r14, %r14
jne 0x5a8e
movq 0x8(%rsp), %rdi
jmp 0x5ac0
xorl %edi, %edi
callq 0x7f8e
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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
testq %rdi, %rdi
je 0x5b12
movq %rdi, %rbx
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x5854
movq 0x8(%rax), %rax
movq %rax, (%rsp,%r14,8)
movq 0x18(%rbx), %rbx
leaq 0x1(%r14), %rax
testq %rbx, %rbx
je 0x5b14
cmpq $0xe, %r14
movq %rax, %r14
jb 0x5aea
jmp 0x5b14
xorl %eax, %eax
movq $0x0, (%rsp,%rax,8)
leaq 0x80(%rsp), %rsi
movb $0x0, (%rsi)
movq %rsp, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x820c
testl %eax, %eax
je 0x5b4a
movq (%rsp), %rsi
leaq 0x4ae6(%rip), %rdi      # 0xa629
xorl %eax, %eax
callq 0x3204
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
callq 0x33e9
movq %rbx, %rdi
callq 0x5310
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x4ad5(%rip), %rdi      # 0xa670
callq 0x5908
movq %rsp, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x80a8
testl %eax, %eax
js 0x5c24
leaq 0x4ac6(%rip), %rax      # 0xa67f
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x4ac5(%rip), %rax      # 0xa68d
movq %rax, 0x8(%rdi)
leaq 0x4ac4(%rip), %rax      # 0xa697
movq %rax, 0x10(%rdi)
movq %rbx, 0x18(%rdi)
leaq 0x4ab8(%rip), %rax      # 0xa69a
movq %rax, 0x20(%rdi)
leaq 0x481c(%rip), %rax      # 0xa409
movq %rax, 0x28(%rdi)
movq $0x0, 0x30(%rdi)
leaq 0x60(%rsp), %rsi
movb $0x0, (%rsi)
movl $0x100, %edx            # imm = 0x100
callq 0x820c
testl %eax, %eax
je 0x5c42
leaq 0x4a87(%rip), %rdi      # 0xa69d
leaq 0x60(%rsp), %rsi
xorl %eax, %eax
callq 0x3204
jmp 0x5c32
leaq 0x4a24(%rip), %rdi      # 0xa64f
xorl %eax, %eax
callq 0x3204
xorl %edi, %edi
callq 0x5450
addq $0x160, %rsp            # imm = 0x160
popq %rbx
retq
movl $0x1234567, %edi        # imm = 0x1234567
callq 0x24c0
movl $0x1, %edi
callq 0x24a0
// File: /workspace/github_c_makefile_star2_O3/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 0x5854
movq 0x8(%rax), %rsi
leaq 0x8935(%rip), %rdi      # 0xe5a0
leaq 0x8(%rsp), %rdx
callq 0x373b
testl %eax, %eax
js 0x5c92
movq 0x8(%rsp), %rdi
callq 0x5310
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x2040
jmp 0x5ca1
leaq 0x3770(%rip), %rdi      # 0x9409
callq 0x5310
movq %rax, %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5e34
callq 0x5854
movq 0x8(%rax), %rdi
jmp 0x5e3b
leaq 0x3583(%rip), %rdi      # 0x93be
movq 0x818e(%rip), %rcx      # 0xdfd0
movq %rsp, %rsi
xorl %edx, %edx
callq 0x2260
movl %eax, %ebx
testl %eax, %eax
jg 0x5e85
testl %ebx, %ebx
js 0x5e7b
je 0x5e72
movl %ebx, %ebx
xorl %r14d, %r14d
movq (%rsp), %rax
movq (%rax,%r14,8), %rdi
callq 0x2040
incq %r14
cmpq %r14, %rbx
jne 0x5e5d
movq (%rsp), %rdi
callq 0x2040
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rsp, %rsi
movl %ebx, %edi
callq 0x2786
jmp 0x5e52
// File: /workspace/github_c_makefile_star2_O3/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 %rax
testq %rdi, %rdi
jne 0x5ec4
movq 0x813d(%rip), %rax      # 0xdff0
movq (%rax), %rsi
movl $0xa, %edi
callq 0x22b0
xorl %eax, %eax
popq %rcx
retq
callq 0x27ee
jmp 0x5eac
// File: /workspace/github_c_makefile_star2_O3/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 0x5854
movq 0x8(%rax), %r14
leaq 0x4885(%rip), %rsi      # 0xa76a
movq %r14, %rdi
callq 0x2430
testq %rax, %rax
je 0x5f2c
movq %rax, %rbx
movq %rsp, %r14
movl $0x1, %esi
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 0x5310
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r14
retq
leaq 0x483a(%rip), %rdi      # 0xa76d
movq %r14, %rsi
xorl %eax, %eax
callq 0x3204
leaq 0x34c5(%rip), %rdi      # 0x9409
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r14
jmp 0x5310
// File: /workspace/github_c_makefile_star2_O3/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 0x46f5(%rip), %rdi      # 0xa670
callq 0x5908
movq %rax, %r12
leaq 0x3264(%rip), %rdi      # 0x91ee
callq 0x5944
movl %eax, %r15d
leaq 0x3265(%rip), %rdi      # 0x91fe
callq 0x5944
movl %eax, %ebx
shll $0x9, %eax
cltq
leaq 0x85f4(%rip), %r14      # 0xe5a0
movq %rax, (%r14)
movq %rsp, %rdx
movq %r12, %rdi
movl $0x1, %esi
callq 0x7fa6
testl %eax, %eax
js 0x6036
movl %eax, %ebp
movl %r15d, %r12d
shll $0x9, %r12d
movslq %r12d, %rsi
movl %eax, %edi
xorl %edx, %edx
callq 0x2220
testq %rax, %rax
js 0x6049
movq (%r14), %rdi
callq 0x2380
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x3797
testl %eax, %eax
js 0x6069
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 0x6073
xorl %edi, %edi
callq 0x5450
leaq 0x31af(%rip), %rdi      # 0x91db
movq %rax, %rsi
callq 0x5165
jmp 0x6086
leaq 0x46a8(%rip), %rdi      # 0xa6e5
movq %r12, %rsi
xorl %eax, %eax
callq 0x3204
jmp 0x6086
leaq 0x46a9(%rip), %rdi      # 0xa6f9
movq %rsp, %rcx
movl %r15d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x3204
movl %ebp, %edi
callq 0x2280
jmp 0x6086
movq %r15, %rdi
callq 0x2040
jmp 0x6086
leaq 0x4704(%rip), %rdi      # 0xa77e
movq %rsp, %rcx
movl %ebx, %esi
xorl %eax, %eax
callq 0x3204
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x5854
movq 0x8(%rax), %r14
movq 0x18(%rbx), %rdi
callq 0x5854
movq 0x8(%rax), %r15
leaq 0x84e6(%rip), %rdi      # 0xe5a0
movq %r14, %rsi
movq %r15, %rdx
callq 0x3625
testl %eax, %eax
js 0x60e4
movl $0x1, %edi
callq 0x5450
leaq 0x3101(%rip), %rdi      # 0x91db
movq %rax, %rsi
callq 0x5165
jmp 0x60f8
leaq 0x46c2(%rip), %rdi      # 0xa7ad
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3204
movq 0x18(%rbx), %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq 0x8526(%rip), %rbx      # 0xe648
testq %rbx, %rbx
je 0x614c
movq 0x7ec2(%rip), %r14      # 0xdff0
movq %rbx, %rdi
callq 0x5647
movq (%r14), %rsi
movl $0xa, %edi
callq 0x22b0
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
jne 0x612e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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:
testq %rdi, %rdi
je 0x7fa5
pushq %rbx
movq (%rdi), %rbx
callq 0x2040
movq %rbx, %rdi
testq %rbx, %rbx
jne 0x7f94
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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, %r15d
movq %rdi, %rbx
callq 0x8026
movl %eax, %ebp
shrl $0x1f, %eax
testl %ebp, %ebp
jns 0x8004
cmpl $0x0, 0x65c9(%rip)      # 0xe594
jle 0x8004
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x2530
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x8026
movl %eax, %ebp
movl 0x65a7(%rip), %ecx      # 0xe594
leal -0x1(%rcx), %eax
movl %eax, 0x659e(%rip)      # 0xe594
movl %ebp, %eax
shrl $0x1f, %eax
testl %ebp, %ebp
jns 0x8004
cmpl $0x1, %ecx
jg 0x7fcd
testb %al, %al
je 0x8019
leaq 0x2995(%rip), %rdi      # 0xa9a4
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3204
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rsi, %r15
movl %edi, %ebp
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x7ac8
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x81cc
movq %rbx, %r12
cmpl %ebp, 0x8(%r12)
jne 0x81bc
leaq 0x2c(%r12), %rsi
movq %r15, %rdi
callq 0x2060
testl %eax, %eax
je 0x81d3
movq (%r12), %r12
testq %r12, %r12
jne 0x81a4
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x81e4
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x81fc
addq $0xc, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x20a0
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x81fc
movq (%rbx), %r14
movq %rbx, %rdi
callq 0x2040
movq %r14, %rbx
testq %r14, %r14
jne 0x81e9
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x247d(%rip), %rdx      # 0xab5c
leaq 0x100(%rsp), %r14
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
xorl %eax, %eax
callq 0x2210
leaq 0x246f(%rip), %rdx      # 0xab6c
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 0x8749
callq 0x2070
movl (%rax), %edi
callq 0x24e0
leaq 0x2440(%rip), %rdi      # 0xab74
leaq 0x100(%rsp), %rsi
movq %rsp, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3204
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x2380(%rip), %rdx      # 0xaaf7
xorl %ebx, %ebx
leaq 0x10(%rsp), %r14
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
xorl %eax, %eax
callq 0x2210
leaq 0x97e(%rip), %rsi       # 0x9112
movq %r14, %rdi
callq 0x2430
testq %rax, %rax
je 0x87de
movq %rax, %r14
leaq 0x235c(%rip), %rsi      # 0xab07
xorl %ebx, %ebx
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rax, %rdi
xorl %eax, %eax
callq 0x20c0
cmpl $0x2, %eax
jne 0x87d6
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_O3/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
movq %rdi, %rax
movq 0x8(%rdi), %rdi
movl $0x5, (%rdi)
testb $0x1, 0x18(%rdi)
je 0x72f5
popq %rbp
retq
testl %esi, %esi
jne 0x7303
movq %rax, %rdi
callq 0x719c
jmp 0x72f3
addq $0x8, %rax
movq %rax, %rsi
callq 0x7160
jmp 0x72f3