LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/examples/sketch_constructed.c
// Function: main
int main(int argc, char *argv[])
{
  GtArray *features; /* stores the created example features */

  if (argc != 3) {
    fprintf(stderr, "Usage: %s style_file output_file\n", argv[0]);
    return EXIT_FAILURE;
  }

  gt_lib_init();

  features = create_example_features();

  draw_example_features(features, argv[1], argv[2]);

  delete_example_features(features);

  gt_lib_clean();
  return EXIT_SUCCESS;
}

// Assembly:
subq $0x18, %rsp
movl $0x0, 0x14(%rsp)
movl %edi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
cmpl $0x3, 0x10(%rsp)
je 0xbdf6
movq 0x1a8205(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movq (%rax), %rdx
leaq 0x15221f(%rip), %rsi    # 0x15e004
movb $0x0, %al
callq 0xb890
movl $0x1, 0x14(%rsp)
jmp 0xbe35
callq 0xf560
callq 0xbe40
movq %rax, (%rsp)
movq (%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdx
callq 0xbfb0
movq (%rsp), %rdi
callq 0xc140
callq 0xf7c0
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/examples/sketch_constructed.c
// Function: delete_example_features
static void delete_example_features(GtArray *features)
{
  GtUword i;
  for (i = 0; i < gt_array_size(features); i++)
    gt_genome_node_delete(*(GtGenomeNode**) gt_array_get(features, i));
  gt_array_delete(features);
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
callq 0xcbe0
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jae 0xc198
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xc3d0
movq (%rax), %rdi
callq 0x2d140
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0xc152
movq 0x10(%rsp), %rdi
callq 0xd7f0
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/nerves_initramfs.c
// Function: cleanup_dir
void cleanup_dir(int dirfd, const char **skip_list)
{
    DIR *dir = fdopendir(dirfd);
    if (dir == NULL) {
        info("fdopendir failed");
        return;
    }

    for (struct dirent *dt = readdir(dir); dt != NULL; dt = readdir(dir)) {
        // Skip . and ..
        const char *name = dt->d_name;
        if (in_skip_list(name, skip_list))
            continue;

        if (dt->d_type & DT_DIR) {
            int fd = openat(dirfd, name, O_RDONLY);
            if (fd >= 0) {
                cleanup_dir(fd, nonroot_skip_list);
            } else {
                info("openat %s failed", name);
            }
            OK_OR_WARN(unlinkat(dirfd, name, AT_REMOVEDIR), "unlinkat directory  %s", name);
        } else {
            OK_OR_WARN(unlinkat(dirfd, name, 0), "unlinkat %s", name);
        }
    }

    closedir(dir);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %edi
callq 0x23f0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x2625
leaq 0x99eb(%rip), %rdi      # 0xc004
movb $0x0, %al
callq 0x32a0
jmp 0x2723
movq -0x18(%rbp), %rdi
callq 0x2320
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x271a
movq -0x20(%rbp), %rax
addq $0x13, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2730
testb $0x1, %al
jne 0x265c
jmp 0x2661
jmp 0x2708
movq -0x20(%rbp), %rax
movzbl 0x12(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x26db
movl -0x4(%rbp), %edi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
movb $0x0, %al
callq 0x2190
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x269b
movl -0x2c(%rbp), %edi
leaq 0xebfc(%rip), %rsi      # 0x11290
callq 0x25f0
jmp 0x26ad
movq -0x28(%rbp), %rsi
leaq 0x996f(%rip), %rdi      # 0xc015
movb $0x0, %al
callq 0x32a0
jmp 0x26af
movl -0x4(%rbp), %edi
movq -0x28(%rbp), %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x20d0
cmpl $0x0, %eax
jge 0x26d7
movq -0x28(%rbp), %rsi
leaq 0x9956(%rip), %rdi      # 0xc026
movb $0x0, %al
callq 0x32a0
jmp 0x26d9
jmp 0x2706
jmp 0x26dd
movl -0x4(%rbp), %edi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x20d0
cmpl $0x0, %eax
jge 0x2702
movq -0x28(%rbp), %rsi
leaq 0x9942(%rip), %rdi      # 0xc03d
movb $0x0, %al
callq 0x32a0
jmp 0x2704
jmp 0x2706
jmp 0x2708
movq -0x18(%rbp), %rdi
callq 0x2320
movq %rax, -0x20(%rbp)
jmp 0x2632
movq -0x18(%rbp), %rdi
callq 0x2270
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/nerves_initramfs.c
// Function: in_skip_list
static bool in_skip_list(const char *what, const char **list)
{
    while (*list) {
        if (strcmp(*list, what) == 0)
            return true;
        list++;
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2773
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x22c0
cmpl $0x0, %eax
jne 0x2765
movb $0x1, -0x1(%rbp)
jmp 0x2777
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
jmp 0x2740
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/nerves_initramfs.c
// Function: mount_encrypted_fs
static void mount_encrypted_fs(const char *rootfs_path, const char *rootfs_type, const char *cipher, const char *secret)
{
    // Wait for the rootfs to appear
    int rootfs_fd = open(rootfs_path, O_RDONLY);
    if (rootfs_fd < 0)
        fatal("Can't continue since '%s' does not exist.", rootfs_path);
    off_t rootfs_size = lseek(rootfs_fd, 0, SEEK_END);
    (void) lseek(rootfs_fd, 0, SEEK_SET);

    int block_size;
    if (ioctl(rootfs_fd, BLKSSZGET, &block_size) < 0)
        block_size = 512;;

    off_t rootfs_blocks = rootfs_size / block_size;

    int loop_fd = losetup(rootfs_fd);
    close(rootfs_fd);

    dm_create(rootfs_blocks, cipher, secret);

    OK_OR_FATAL(mount("/dev/dm-0", "/mnt", rootfs_type, MS_RDONLY, NULL), "Expecting %s filesystem on %s", rootfs_type, rootfs_path);

    // It's ok to close loop_fd now that the mount happened.
    close(loop_fd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x23d0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jge 0x2aa0
movq -0x8(%rbp), %rsi
leaq 0x95f8(%rip), %rdi      # 0xc091
movb $0x0, %al
callq 0x3390
movl -0x24(%rbp), %edi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x2200
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %edi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x2200
movl -0x24(%rbp), %edi
movl $0x1268, %esi           # imm = 0x1268
leaq -0x34(%rbp), %rdx
movb $0x0, %al
callq 0x2220
cmpl $0x0, %eax
jge 0x2ae2
movl $0x200, -0x34(%rbp)     # imm = 0x200
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
cqto
idivq %rcx
movq %rax, -0x40(%rbp)
movl -0x24(%rbp), %edi
callq 0x2d70
movl %eax, -0x44(%rbp)
movl -0x24(%rbp), %edi
callq 0x2250
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x2de0
movq -0x10(%rbp), %rdx
leaq 0x96d8(%rip), %rdi      # 0xc1fa
leaq 0x95f7(%rip), %rsi      # 0xc120
movl $0x1, %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0x2180
cmpl $0x0, %eax
jge 0x2b53
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rdx
leaq 0x96b8(%rip), %rdi      # 0xc204
movb $0x0, %al
callq 0x3390
jmp 0x2b55
movl -0x44(%rbp), %edi
callq 0x2250
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/nerves_initramfs.c
// Function: mount_fs
static void mount_fs(const char *rootfs_path, const char *rootfs_type)
{
    // Wait for the rootfs to appear
    int rootfs_fd = open(rootfs_path, O_RDONLY);
    if (rootfs_fd < 0)
        fatal("Can't continue since '%s' does not exist.", rootfs_path);
    close(rootfs_fd);

    OK_OR_FATAL(mount(rootfs_path, "/mnt", rootfs_type, MS_RDONLY, NULL), "Expecting %s filesystem on %s", rootfs_type, rootfs_path);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x23d0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x2ba8
movq -0x8(%rbp), %rsi
leaq 0x94f0(%rip), %rdi      # 0xc091
movb $0x0, %al
callq 0x3390
movl -0x14(%rbp), %edi
callq 0x2250
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x9561(%rip), %rsi      # 0xc120
movl $0x1, %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0x2180
cmpl $0x0, %eax
jge 0x2be9
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rdx
leaq 0x9622(%rip), %rdi      # 0xc204
movb $0x0, %al
callq 0x3390
jmp 0x2beb
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/nerves_initramfs.c
// Function: setup_initramfs
static void setup_initramfs()
{
    // Create necessary directories in case they're not around.
    (void) mkdir("/mnt", 0755);
    (void) mkdir("/dev", 0755);
    (void) mkdir("/sys", 0555);
    (void) mkdir("/proc", 0555);

    // devtmpfs must be enabled in the kernel. It must be manually mounted for the initramfs.
    OK_OR_WARN(mount("devtmpfs", "/dev", "devtmpfs", MS_NOSUID | MS_NOEXEC, "mode=755,size=5%"), "Can't mount /dev");

    // Mount /sys and /proc since so many things depend on them
    OK_OR_WARN(mount("sysfs", "/sys", "sysfs", MS_NOSUID | MS_NODEV | MS_NOEXEC, NULL), "Can't mount /sys");
    OK_OR_WARN(mount("proc", "/proc", "proc", MS_NOSUID | MS_NODEV | MS_NOEXEC, NULL), "Can't mount /proc");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x9515(%rip), %rdi      # 0xc120
movl $0x1ed, %esi            # imm = 0x1ED
callq 0x20c0
leaq 0x952f(%rip), %rdi      # 0xc14b
movl $0x1ed, %esi            # imm = 0x1ED
callq 0x20c0
leaq 0x9535(%rip), %rdi      # 0xc162
movl $0x16d, %esi            # imm = 0x16D
callq 0x20c0
leaq 0x9535(%rip), %rdi      # 0xc173
movl $0x16d, %esi            # imm = 0x16D
callq 0x20c0
leaq 0x94d6(%rip), %rdx      # 0xc125
leaq 0x94f5(%rip), %rsi      # 0xc14b
movl $0xa, %ecx
leaq 0x94cc(%rip), %r8       # 0xc12e
movq %rdx, %rdi
callq 0x2180
cmpl $0x0, %eax
jge 0x2c7d
leaq 0x94c9(%rip), %rdi      # 0xc13f
movb $0x0, %al
callq 0x32a0
jmp 0x2c7f
jmp 0x2c81
leaq 0x94c8(%rip), %rdx      # 0xc150
leaq 0x94d3(%rip), %rsi      # 0xc162
movl $0xe, %ecx
xorl %eax, %eax
movl %eax, %r8d
movq %rdx, %rdi
callq 0x2180
cmpl $0x0, %eax
jge 0x2cb4
leaq 0x94a9(%rip), %rdi      # 0xc156
movb $0x0, %al
callq 0x32a0
jmp 0x2cb6
jmp 0x2cb8
leaq 0x94b5(%rip), %rdx      # 0xc174
leaq 0x94ad(%rip), %rsi      # 0xc173
movl $0xe, %ecx
xorl %eax, %eax
movl %eax, %r8d
movq %rdx, %rdi
callq 0x2180
cmpl $0x0, %eax
jge 0x2ceb
leaq 0x9483(%rip), %rdi      # 0xc167
movb $0x0, %al
callq 0x32a0
jmp 0x2ced
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/nerves_initramfs.c
// Function: repl
static void repl()
{
    // Reset the terminal colors
    printf("\033[0m");

    extern const struct term *parser_result;
    char *line;
    while((line = linenoise("nerves_initramfs> ")) != NULL) {
        linenoiseHistoryAdd(line);
        eval_string(line); // eval_string owns memory and calls free on "line".
        if (parser_result)
            printf("%s\n", term_to_string(parser_result)->string);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x94e3(%rip), %rdi      # 0xc1e2
movb $0x0, %al
callq 0x21d0
leaq 0x94da(%rip), %rdi      # 0xc1e7
callq 0x8f00
movq %rax, -0x8(%rbp)
cmpq $0x0, %rax
je 0x2d5e
movq -0x8(%rbp), %rdi
callq 0x92d0
movq -0x8(%rbp), %rdi
callq 0x7690
leaq 0xe913(%rip), %rax      # 0x11648
cmpq $0x0, (%rax)
je 0x2d5c
leaq 0xe906(%rip), %rax      # 0x11648
movq (%rax), %rdi
callq 0x73b0
movq 0x8(%rax), %rsi
leaq 0xa6c7(%rip), %rdi      # 0xd41c
movb $0x0, %al
callq 0x21d0
jmp 0x2d06
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/nerves_initramfs.c
// Function: losetup
static int losetup(int rootfs_fd)
{
    // Assume loop0 is available since who else would be able to take it?
    int loop_fd = open("/dev/loop0", O_RDONLY);
    if (loop_fd < 0)
        fatal("Enable CONFIG_BLK_DEV_LOOP in kernel");

    OK_OR_FATAL(ioctl(loop_fd, LOOP_SET_FD, rootfs_fd), "LOOP_SET_FD failed");

    return loop_fd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
leaq 0x94a0(%rip), %rdi      # 0xc222
xorl %esi, %esi
movb $0x0, %al
callq 0x23d0
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jge 0x2da2
leaq 0x9492(%rip), %rdi      # 0xc22d
movb $0x0, %al
callq 0x3390
jmp 0x2da4
movl -0x8(%rbp), %edi
movl -0x4(%rbp), %edx
movl $0x4c00, %esi           # imm = 0x4C00
movb $0x0, %al
callq 0x2220
cmpl $0x0, %eax
jge 0x2dc9
leaq 0x9490(%rip), %rdi      # 0xc252
movb $0x0, %al
callq 0x3390
jmp 0x2dcb
movl -0x8(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/nerves_initramfs.c
// Function: switch_root
static void switch_root()
{
    // Thank you busybox for all of the comments on how this is supposed to work.

    // Move /dev to its new home
    OK_OR_WARN(mount("/dev", "/mnt/dev", NULL, MS_MOVE, NULL), "moving /dev failed");

    // Unmount /sys and /proc so that the next init can mount them
    OK_OR_WARN(umount("/sys"), "unmounting /sys failed");
    OK_OR_WARN(umount("/proc"), "unmounting /proc failed");

    // Clean up the "old" rootfs.
    cleanup_old_rootfs();

    // Change to the new mount
    OK_OR_DEBUG(chdir("/mnt"), "chdir /mnt failed");

    // Make this directory the root one now.
    OK_OR_WARN(mount(".", "/", NULL, MS_MOVE, NULL), "moving / failed");

    // Fix ".."
    OK_OR_DEBUG(chroot("."), "chroot failed");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
jmp 0x3166
leaq 0x8fde(%rip), %rdi      # 0xc14b
leaq 0x91d3(%rip), %rsi      # 0xc347
xorl %eax, %eax
movl %eax, %r8d
movl $0x2000, %ecx           # imm = 0x2000
movq %r8, %rdx
callq 0x2180
cmpl $0x0, %eax
jge 0x3199
leaq 0x91be(%rip), %rdi      # 0xc350
movb $0x0, %al
callq 0x32a0
jmp 0x319b
jmp 0x319d
leaq 0x8fbe(%rip), %rdi      # 0xc162
callq 0x2110
cmpl $0x0, %eax
jge 0x31bc
leaq 0x91ae(%rip), %rdi      # 0xc363
movb $0x0, %al
callq 0x32a0
jmp 0x31be
jmp 0x31c0
leaq 0x8fac(%rip), %rdi      # 0xc173
callq 0x2110
cmpl $0x0, %eax
jge 0x31df
leaq 0x91a2(%rip), %rdi      # 0xc37a
movb $0x0, %al
callq 0x32a0
jmp 0x31e1
callq 0x3240
leaq 0x8f33(%rip), %rdi      # 0xc120
callq 0x21a0
jmp 0x31f4
leaq 0x8f23(%rip), %rdi      # 0xc11e
leaq 0x9190(%rip), %rsi      # 0xc392
xorl %eax, %eax
movl %eax, %r8d
movl $0x2000, %ecx           # imm = 0x2000
movq %r8, %rdx
callq 0x2180
cmpl $0x0, %eax
jge 0x3227
leaq 0x9174(%rip), %rdi      # 0xc394
movb $0x0, %al
callq 0x32a0
jmp 0x3229
jmp 0x322b
leaq 0x8eec(%rip), %rdi      # 0xc11e
callq 0x20a0
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/nerves_initramfs.c
// Function: cleanup_old_rootfs
static void cleanup_old_rootfs()
{
    int fd = open("/", O_RDONLY);
    if (fd < 0) {
        info("Can't open '/'?");
        return;
    }

    cleanup_dir(fd, root_skip_list);

    rmdir("/sys");
    rmdir("/proc");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x9143(%rip), %rdi      # 0xc392
xorl %esi, %esi
movb $0x0, %al
callq 0x23d0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jge 0x3271
leaq 0x913c(%rip), %rdi      # 0xc3a4
movb $0x0, %al
callq 0x32a0
jmp 0x3298
movl -0x4(%rbp), %edi
leaq 0xe035(%rip), %rsi      # 0x112b0
callq 0x25f0
leaq 0x8edb(%rip), %rdi      # 0xc162
callq 0x2160
leaq 0x8ee0(%rip), %rdi      # 0xc173
callq 0x2160
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/util.c
// Function: log_format
static void log_format(const char *fmt, va_list ap)
{
    char *line;
    int len = format_message(&line, fmt, ap);

    if (len >= 0) {
        log_write(line, len);
        free(line);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x18(%rbp), %rdi
callq 0x35d0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x3380
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x3450
movq -0x18(%rbp), %rdi
callq 0x2040
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/util.c
// Function: fatal
void fatal(const char *fmt, ...)
{
    log_write("\r\n\r\nFATAL ERROR:\r\n", 18);

    va_list ap;
    va_start(ap, fmt);
    log_format(fmt, ap);
    va_end(ap);

    log_write("\r\n\r\nCANNOT CONTINUE.\r\n", 22);

    // This will cause the kernel to panic.
    exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
testb %al, %al
je 0x33c5
movaps %xmm0, -0xa0(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm2, -0x80(%rbp)
movaps %xmm3, -0x70(%rbp)
movaps %xmm4, -0x60(%rbp)
movaps %xmm5, -0x50(%rbp)
movaps %xmm6, -0x40(%rbp)
movaps %xmm7, -0x30(%rbp)
movq %r9, -0xa8(%rbp)
movq %r8, -0xb0(%rbp)
movq %rcx, -0xb8(%rbp)
movq %rdx, -0xc0(%rbp)
movq %rsi, -0xc8(%rbp)
movq %rdi, -0x8(%rbp)
leaq 0x8fc1(%rip), %rdi      # 0xc3b4
movl $0x12, %esi
callq 0x3450
leaq -0x20(%rbp), %rax
leaq -0xd0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x3340
leaq -0x20(%rbp), %rax
leaq 0x8f8e(%rip), %rdi      # 0xc3c7
movl $0x16, %esi
callq 0x3450
movl $0x1, %edi
callq 0x2450
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/util.c
// Function: log_write
static void log_write(const char *str, size_t len)
{
    size_t ignore;
    int log_fd = open("/dev/kmsg", O_WRONLY | O_CLOEXEC);
    if (log_fd >= 0) {
        ignore = write(log_fd, str, len);
        close(log_fd);
    } else {
        ignore = write(STDERR_FILENO, str, len);
    }
    (void) ignore;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x8f8e(%rip), %rdi      # 0xc3f5
movl $0x80001, %esi          # imm = 0x80001
movb $0x0, %al
callq 0x23d0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x349a
movl -0x1c(%rbp), %edi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x2120
movq %rax, -0x18(%rbp)
movl -0x1c(%rbp), %edi
callq 0x2250
jmp 0x34b0
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
movl $0x2, %edi
callq 0x2120
movq %rax, -0x18(%rbp)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/util.c
// Function: trim_string_in_place
void trim_string_in_place(char *str)
{
    char *first = str;
    while (*first && isspace(*first))
        first++;

    char *last = first + strlen(first) - 1;
    while (last != first && isspace(*last))
        last--;

    size_t len = last - first + 1;
    memmove(str, first, len);
    str[len] = '\0';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x21(%rbp)
je 0x3509
callq 0x24d0
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x3512
jmp 0x3520
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x34d4
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2170
movq %rax, %rcx
movq -0x30(%rbp), %rax
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq -0x10(%rbp), %rcx
movb %al, -0x31(%rbp)
je 0x3576
callq 0x24d0
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x357f
jmp 0x358d
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x3543
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x2390
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
movb $0x0, (%rax,%rcx)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/util.c
// Function: format_message
static int format_message(char **strp, const char *fmt, va_list ap)
{
    char *msg;
    if (vasprintf(&msg, fmt, ap) < 0) {
        return -1;
    }

    int rc = asprintf(strp, PROGRAM_NAME ": %s\r\n", msg);
    free(msg);

    return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x28(%rbp), %rdi
callq 0x2140
cmpl $0x0, %eax
jge 0x3603
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x362b
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x8dcc(%rip), %rsi      # 0xc3de
movb $0x0, %al
callq 0x2370
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2040
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/crc32.c
// Function: crc32buf
uint32_t crc32buf(const char *buf, size_t len)
{
      uint32_t crc32 = 0xFFFFFFFF;
      for ( ; len; --len, ++buf)
      {
            crc32 = UPDC32(*buf, crc32);
      }

      return ~crc32;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, -0x10(%rbp)
je 0x369e
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
movzbl (%rcx), %ecx
xorl %ecx, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x8d8a(%rip), %rax      # 0xc400
movl (%rax,%rcx,4), %eax
movl -0x14(%rbp), %ecx
shrl $0x8, %ecx
xorl %ecx, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x3653
movl -0x14(%rbp), %eax
xorl $-0x1, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3947
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2040
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2040
movq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x3908
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x39d6
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x22c0
cmpl $0x0, %eax
jne 0x39c6
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
movq -0x20(%rbp), %rdi
callq 0x2480
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x3a2e
jmp 0x39c8
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x3980
movl $0x18, %edi
callq 0x2330
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2480
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rdi
callq 0x2480
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x3ae8
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x22c0
cmpl $0x0, %eax
jne 0x3acd
cmpq $0x0, -0x18(%rbp)
je 0x3a99
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x3aa9
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x2040
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
movq -0x20(%rbp), %rdi
callq 0x2040
jmp 0x3ae8
jmp 0x3acf
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x3a64
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3b5c
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x22c0
cmpl $0x0, %eax
jne 0x3b4c
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2480
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x3b80
jmp 0x3b4e
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x3b10
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rsi
leaq 0x8ce9(%rip), %rdi      # 0xc85b
movb $0x0, %al
callq 0x32a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/uboot_env.c
// Function: uboot_env_sort
static void uboot_env_sort(struct uboot_env *env)
{
    int count = 0;
    struct uboot_name_value *pair;
    for (pair = env->vars; pair != NULL; pair = pair->next)
        count++;

    if (count == 0)
        return;

    struct uboot_name_value **pairarray =
        (struct uboot_name_value **) malloc(count * sizeof(struct uboot_name_value *));
    int i;
    for (pair = env->vars, i = 0; pair != NULL; pair = pair->next, i++)
        pairarray[i] = pair;

    qsort(pairarray, count, sizeof(struct uboot_name_value *), env_name_compare);

    for (i = 0; i < count - 1; i++)
        pairarray[i]->next = pairarray[i + 1];
    pairarray[count - 1]->next = NULL;
    env->vars = pairarray[0];

    free(pairarray);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x3d9d
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x3d7f
cmpl $0x0, -0xc(%rbp)
jne 0x3da8
jmp 0x3e84
movslq -0xc(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2330
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x3dfa
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3dcc
movq -0x20(%rbp), %rdi
movslq -0xc(%rbp), %rsi
movl $0x8, %edx
leaq 0x82(%rip), %rcx        # 0x3e90
callq 0x20e0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x3e53
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x10(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3e1a
movq -0x20(%rbp), %rax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rdi
callq 0x2040
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
cmpq $0x0, 0xae28(%rip)      # 0x11658
jne 0x6844
movq $0x0, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
jmp 0x685a
movq 0xae0d(%rip), %rax      # 0x11658
movq %rax, -0x10(%rbp)
movq 0xae0a(%rip), %rax      # 0x11660
movq %rax, -0x8(%rbp)
movl $0x4098, %edi           # imm = 0x4098
callq 0x2330
movq %rax, 0xaded(%rip)      # 0x11658
movq 0xade6(%rip), %rdi      # 0x11658
xorl %esi, %esi
movl $0x4098, %edx           # imm = 0x4098
callq 0x2210
movl $0x0, 0xade0(%rip)      # 0x11668
movq $0x0, 0xadcd(%rip) # 0x11660
cmpq $0x0, -0x8(%rbp)
je 0x68cd
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x6980
movq -0x18(%rbp), %rdi
movq %rax, %rsi
callq 0x68f0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x6893
cmpq $0x0, -0x10(%rbp)
je 0x68dd
movq -0x10(%rbp), %rdi
callq 0x2040
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: 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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7480
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x6922
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x6974
movl $0x20, %edi
callq 0x6a60
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x5, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6b20
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0xacff(%rip), %rcx      # 0x11660
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq %rax, 0xacec(%rip)      # 0x11660
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: term_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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x18(%rbp)
subq $0x3, %rax
ja 0x69ff
movq -0x18(%rbp), %rax
leaq 0x6a09(%rip), %rcx      # 0xd3b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6c60
movq %rax, -0x8(%rbp)
jmp 0x6a07
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6ad0
movq %rax, -0x8(%rbp)
jmp 0x6a07
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x6a20
movq %rax, -0x8(%rbp)
jmp 0x6a07
movq -0x10(%rbp), %rax
movb 0x8(%rax), %al
andb $0x1, %al
movzbl %al, %edi
callq 0x6c20
movq %rax, -0x8(%rbp)
jmp 0x6a07
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl $0x20, %edi
callq 0x6a60
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0x2, (%rax)
movl -0x4(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movslq 0xabf5(%rip), %rax      # 0x11668
addq -0x8(%rbp), %rax
cmpq $0x4098, %rax           # imm = 0x4098
jbe 0x6a8d
leaq 0x699a(%rip), %rdi      # 0xd420
movb $0x0, %al
callq 0x3390
movq 0xabc4(%rip), %rax      # 0x11658
movslq 0xabcd(%rip), %rcx      # 0x11668
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movslq 0xabbf(%rip), %rax      # 0x11668
addq -0x8(%rbp), %rax
addq $0x7, %rax
andq $-0x8, %rax
movl %eax, 0xabad(%rip)      # 0x11668
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x20, %edi
callq 0x6a60
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6b20
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: alloc_string
static char *alloc_string(const char *str)
{
    size_t len = strlen(str) + 1;
    char *result = alloc_heap(len);
    memcpy(result, str, len);
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2170
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6a60
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x2300
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x20, %edi
callq 0x6a60
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6bc0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: alloc_qstring
static char *alloc_qstring(const char *str)
{
    // Skip first and last quote
    str++;
    size_t len = strlen(str);
    char *result = alloc_heap(len);
    memcpy(result, str, len);
    result[len - 1] = '\0';
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2170
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6a60
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x2300
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq $0x1, %rcx
movb $0x0, (%rax,%rcx)
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: 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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %dil, %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movl $0x20, %edi
callq 0x6a60
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0x3, (%rax)
movb -0x1(%rbp), %cl
movq -0x10(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x8(%rax)
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x20, %edi
callq 0x6a60
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6b20
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x6cf1
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6cc0
movq -0x10(%rbp), %rax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x6d3d
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x6d1f
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x6da0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x6d5e
movq $0x0, -0x8(%rbp)
jmp 0x6d96
movl $0x20, %edi
callq 0x6a60
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl $0x4, (%rax)
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
leaq 0xa53a(%rip), %rax      # 0x112f0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x6e01
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x22c0
cmpl $0x0, %eax
jne 0x6df3
movl -0x14(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jl 0x6df3
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x6e09
movq -0x20(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x20(%rbp)
jmp 0x6dba
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/script.c
// Function: function_info_by_fun
const struct function_info *function_info_by_fun(fun_handler fun)
{
    struct function_info *entry = function_table;
    while (entry->handler && entry->handler != fun)
        entry++;

    return entry;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
leaq 0xa2e1(%rip), %rax      # 0x112f0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x10(%rcx)
movb %al, -0x11(%rbp)
je 0x7035
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x8(%rbp), %rax
setne %al
movb %al, -0x11(%rbp)
movb -0x11(%rbp), %al
testb $0x1, %al
jne 0x703e
jmp 0x704c
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x10(%rbp)
jmp 0x7013
movq -0x10(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x7096
movq -0x8(%rbp), %rdi
callq 0x70a0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x7074
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
testl %eax, %eax
je 0x7115
jmp 0x710b
movl -0x14(%rbp), %eax
subl $0x4, %eax
je 0x7130
jmp 0x713f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7160
movq %rax, %rdi
callq 0x70f0
movq %rax, -0x8(%rbp)
jmp 0x7147
movq -0x10(%rbp), %rdi
callq 0x70a0
movq %rax, -0x8(%rbp)
jmp 0x7147
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nerves-project[P]nerves_initramfs/src/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7480
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x718e
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x719e
leaq 0x69f5(%rip), %rdi      # 0xdb8a
callq 0x6ad0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x70f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x70f0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
subl $0x1, %eax
je 0x71fe
jmp 0x71ea
movl -0x2c(%rbp), %eax
subl $0x2, %eax
je 0x7218
jmp 0x71f4
movl -0x2c(%rbp), %eax
subl $0x3, %eax
je 0x722b
jmp 0x724b
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x22c0
movl %eax, -0x4(%rbp)
jmp 0x7252
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x28(%rbp), %rcx
subl 0x8(%rcx), %eax
movl %eax, -0x4(%rbp)
jmp 0x7252
movq -0x20(%rbp), %rax
movb 0x8(%rax), %al
andb $0x1, %al
movzbl %al, %eax
movq -0x28(%rbp), %rcx
movb 0x8(%rcx), %cl
andb $0x1, %cl
movzbl %cl, %ecx
subl %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x7252
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)