LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/funkboot.c
// Function: funk_send_packet
static int funk_send_packet(struct funk_privdata *funk,
                            struct rfm12_pkt *pkt,
                            int length)
{
    uint8_t request[] = { BRIDGE_CMD_TRANSMIT, length };

    int ret = funk_bridge_send(funk, request, sizeof(request), (uint8_t *)pkt, length);
    if (ret < 0)
    {
        return ret;
    }

    uint8_t cause = BRIDGE_CAUSE_SUCCESS;
    ret = funk_bridge_recv(funk, request[0], &cause, NULL, 0);
    if (ret != 0)
    {
        return -1;
    }

#if (FUNK_PACKET_DEBUG == 1)
    char *dump = funk_print_data((uint8_t *)pkt, length);
    printf("funk_send_packet() cause=0x%02x length=0x%02x\n%s\n",
           cause, length, dump);

    free(dump);
#endif

    return (cause != BRIDGE_CAUSE_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movb $0x54, -0x1e(%rbp)
movl -0x1c(%rbp), %eax
movb %al, -0x1d(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x1e(%rbp), %rsi
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %eax
movl $0x2, %edx
movzbl %al, %r8d
callq 0x6ba0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jge 0x707b
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x70bb
movb $0x0, -0x25(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x25(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
movzbl -0x1e(%rbp), %esi
callq 0x6c40
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x70a9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x70bb
movzbl -0x25(%rbp), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/funkboot.c
// Function: funk_recv_packet
static int funk_recv_packet(struct funk_privdata *funk,
                            struct rfm12_pkt *pkt,
                            int *length)
{
    uint8_t request[] = { BRIDGE_CMD_RECEIVE, 0 };

    int ret = funk_bridge_send(funk, request, sizeof(request), NULL, 0);
    if (ret < 0)
    {
        return ret;
    }

    uint8_t cause = BRIDGE_CAUSE_SUCCESS;
    ret = funk_bridge_recv(funk, request[0], &cause, (uint8_t *)pkt, *length);
    if (ret < 0)
    {
        return -1;
    }

    *length = ret;

#if (FUNK_PACKET_DEBUG == 1)
    char *dump = funk_print_data((uint8_t *)pkt, *length);
    printf("funk_recv_packet() cause=0x%02x length=0x%02x\n%s\n", cause, *length, dump);
    free(dump);
#endif

    return (cause != BRIDGE_CAUSE_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movw 0x4ed9(%rip), %ax       # 0xbfc4
movw %ax, -0x22(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x22(%rbp), %rsi
movl $0x2, %edx
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x6ba0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0x7119
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7168
movb $0x0, -0x29(%rbp)
movq -0x10(%rbp), %rdi
movb -0x22(%rbp), %al
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rdx
movl (%rdx), %r8d
leaq -0x29(%rbp), %rdx
movzbl %al, %esi
callq 0x6c40
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0x714d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7168
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movzbl -0x29(%rbp), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/funkboot.c
// Function: funk_close_device
static void funk_close_device(struct funk_privdata *funk)
{
    /* delay close() / tcsetattr() */
    usleep(100000);

    tcsetattr(funk->fd, TCSANOW, &funk->oldtio);
    close(funk->fd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x186a0, %edi          # imm = 0x186A0
callq 0x2280
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x8(%rbp), %rdx
addq $0x28, %rdx
xorl %esi, %esi
callq 0x21d0
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x2120
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/mpmboot.c
// Function: mpm_alloc
static struct multiboot * mpm_alloc(void)
{
    struct multiboot * mboot = malloc(sizeof(struct multiboot));
    if (mboot == NULL)
    {
        return NULL;
    }

    memset(mboot, 0x00, sizeof(struct multiboot));
    mboot->ops  = &mpm_ops;

    struct mpm_privdata *mpm = malloc(sizeof(struct mpm_privdata));
    if (mpm == NULL)
    {
        free(mboot);
        return NULL;
    }

    memset(mpm, 0x00, sizeof(struct mpm_privdata));
    mpm->device  = NULL;
    mpm->address = 0;

    optarg_register(mpm_optargs, ARRAY_SIZE(mpm_optargs),
                    mpm_optarg_cb, (void *)mpm);

    mboot->privdata = mpm;
    return mboot;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x20, %edi
callq 0x21b0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x760a
movq $0x0, -0x8(%rbp)
jmp 0x76a3
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2100
movq -0x10(%rbp), %rax
leaq 0x8e4b(%rip), %rcx      # 0x10470
movq %rcx, (%rax)
movl $0x58, %edi
callq 0x21b0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x7650
movq -0x10(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
jmp 0x76a3
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x58, %edx
callq 0x2100
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x18(%rbp), %rcx
leaq 0x8e42(%rip), %rdi      # 0x104c0
movl $0x2, %esi
leaq 0x826(%rip), %rdx       # 0x7eb0
callq 0x9670
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/mpmboot.c
// Function: mpm_get_memsize
static uint32_t mpm_get_memsize(struct multiboot *mboot, int memtype)
{
    struct mpm_privdata *mpm = (struct mpm_privdata *)mboot->privdata;

    if (!mpm->connected)
    {
        return 0;
    }

    switch (memtype)
    {
        case MEMTYPE_FLASH:
            return mpm->flashsize;

        case MEMTYPE_EEPROM:
            return mpm->eepromsize;

        default:
            return 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x778a
movl $0x0, -0x4(%rbp)
jmp 0x77c2
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
subl $0x1, %eax
je 0x77a1
jmp 0x7797
movl -0x24(%rbp), %eax
subl $0x2, %eax
je 0x77ae
jmp 0x77bb
movq -0x20(%rbp), %rax
movzwl 0x12(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x77c2
movq -0x20(%rbp), %rax
movzwl 0x16(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x77c2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/mpmboot.c
// Function: mpm_close
static int mpm_close(struct multiboot *mboot)
{
    struct mpm_privdata *mpm = (struct mpm_privdata *)mboot->privdata;

    if (mpm->connected)
    {
        mpm_switch_application(mpm, BOOTTYPE_APPLICATION);
    }

    mpm_close_device(mpm);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x7a40
movq -0x10(%rbp), %rdi
movl $0x80, %esi
callq 0x8130
movq -0x10(%rbp), %rdi
callq 0x88e0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/mpmboot.c
// Function: mpm_read
static int mpm_read(struct multiboot *mboot,
                    struct databuf *dbuf, int memtype)
{
    struct mpm_privdata *mpm = (struct mpm_privdata *)mboot->privdata;
    char *progress_msg = (memtype == MEMTYPE_FLASH) ? "reading flash" : "reading eeprom";

    uint16_t pos = 0;
    uint16_t size = (memtype == MEMTYPE_FLASH) ? mpm->flashsize : mpm->eepromsize;

    while (pos < size)
    {
        mboot->progress_cb(progress_msg, pos, size);

        uint16_t len = MIN(READ_BLOCK_SIZE, size - pos);
        if (mpm_read_memory(mpm, dbuf->data + pos, len, memtype, pos))
        {
            mboot->progress_cb(progress_msg, -1, -1);
            return -1;
        }

        pos += len;
    }

    dbuf->length = pos;

    mboot->progress_cb(progress_msg, pos, size);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %edx
leaq 0x3ab2(%rip), %rax      # 0xb53b
leaq 0x3a9d(%rip), %rcx      # 0xb52d
cmpl $0x1, %edx
cmoveq %rcx, %rax
movq %rax, -0x30(%rbp)
movw $0x0, -0x32(%rbp)
cmpl $0x1, -0x1c(%rbp)
jne 0x7ab4
movq -0x28(%rbp), %rax
movzwl 0x12(%rax), %eax
movl %eax, -0x3c(%rbp)
jmp 0x7abf
movq -0x28(%rbp), %rax
movzwl 0x16(%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movw %ax, -0x34(%rbp)
movzwl -0x32(%rbp), %eax
movzwl -0x34(%rbp), %ecx
cmpl %ecx, %eax
jge 0x7b7f
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movzwl -0x32(%rbp), %esi
movzwl -0x34(%rbp), %edx
callq *%rax
movzwl -0x34(%rbp), %ecx
movzwl -0x32(%rbp), %eax
subl %eax, %ecx
movl $0x100, %eax            # imm = 0x100
cmpl %ecx, %eax
jge 0x7b09
movl $0x100, %eax            # imm = 0x100
movl %eax, -0x40(%rbp)
jmp 0x7b16
movzwl -0x34(%rbp), %eax
movzwl -0x32(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movw %ax, -0x36(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movzwl -0x32(%rbp), %eax
cltq
addq %rax, %rsi
movw -0x36(%rbp), %cx
movl -0x1c(%rbp), %eax
movzwl %cx, %edx
movzbl %al, %ecx
movzwl -0x32(%rbp), %r8d
callq 0x8920
cmpl $0x0, %eax
je 0x7b6c
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %edx, %esi
callq *%rax
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ba7
movzwl -0x36(%rbp), %ecx
movzwl -0x32(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x32(%rbp)
jmp 0x7ac6
movzwl -0x32(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movzwl -0x32(%rbp), %esi
movzwl -0x34(%rbp), %edx
callq *%rax
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/mpmboot.c
// Function: mpm_write
static int mpm_write(struct multiboot *mboot,
                     struct databuf *dbuf, int memtype)
{
    struct mpm_privdata *mpm = (struct mpm_privdata *)mboot->privdata;
    char *progress_msg = (memtype == MEMTYPE_FLASH) ? "writing flash" : "writing eeprom";

    uint16_t pos = 0;
    while (pos < dbuf->length)
    {
        mboot->progress_cb(progress_msg, pos, dbuf->length);

        uint16_t len = (memtype == MEMTYPE_FLASH) ? mpm->flashpage : WRITE_BLOCK_SIZE;

        len = MIN(len, dbuf->length - pos);
        if (mpm_write_memory(mpm, dbuf->data + pos, len, memtype, pos))
        {
            mboot->progress_cb(progress_msg, -1, -1);
            return -1;
        }

        pos += len;
    }

    mboot->progress_cb(progress_msg, pos, dbuf->length);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %edx
leaq 0x3826(%rip), %rax      # 0xb5af
leaq 0x3811(%rip), %rcx      # 0xb5a1
cmpl $0x1, %edx
cmoveq %rcx, %rax
movq %rax, -0x30(%rbp)
movw $0x0, -0x32(%rbp)
movzwl -0x32(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x7e86
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movzwl -0x32(%rbp), %esi
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %edx
callq *%rax
cmpl $0x1, -0x1c(%rbp)
jne 0x7dde
movq -0x28(%rbp), %rax
movzbl 0x14(%rax), %eax
movl %eax, -0x38(%rbp)
jmp 0x7de8
movl $0x10, %eax
movl %eax, -0x38(%rbp)
jmp 0x7de8
movl -0x38(%rbp), %eax
movw %ax, -0x34(%rbp)
movzwl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %ecx
movzwl -0x32(%rbp), %edx
subl %edx, %ecx
cmpl %ecx, %eax
jae 0x7e0d
movzwl -0x34(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x7e1d
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movzwl -0x32(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movw %ax, -0x34(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movzwl -0x32(%rbp), %eax
cltq
addq %rax, %rsi
movw -0x34(%rbp), %cx
movl -0x1c(%rbp), %eax
movzwl %cx, %edx
movzbl %al, %ecx
movzwl -0x32(%rbp), %r8d
callq 0x89f0
cmpl $0x0, %eax
je 0x7e73
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %edx, %esi
callq *%rax
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ea6
movzwl -0x34(%rbp), %ecx
movzwl -0x32(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x32(%rbp)
jmp 0x7da1
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movzwl -0x32(%rbp), %esi
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %edx
callq *%rax
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/mpmboot.c
// Function: mpm_open_device
static int mpm_open_device(struct mpm_privdata *mpm)
{
    mpm->fd = open(mpm->device, O_RDWR | O_NOCTTY | O_CLOEXEC);
    if (mpm->fd < 0)
    {
        perror("open()");
        return -1;
    }

    if (tcgetattr(mpm->fd, &mpm->oldtio) < 0)
    {
        perror("tcgetattr(oldtio)");
        close(mpm->fd);
        return -1;
    }

    struct termios newtio;
    memset(&newtio, 0, sizeof(newtio));

    newtio.c_iflag |= IGNBRK;
    newtio.c_cflag |= B115200 | CS8 | CLOCAL | CREAD | PARENB | CMSPAR;

    newtio.c_cc[VMIN] = 1;
    newtio.c_cc[VTIME] = 0;

    int err = tcsetattr(mpm->fd, TCSANOW, &newtio);
    if (err < 0)
    {
        perror("tcsetattr(newtio)");
        close(mpm->fd);
        return -1;
    }

    mpm->connected = 1;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x80102, %esi          # imm = 0x80102
movb $0x0, %al
callq 0x21e0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jge 0x806a
leaq 0x39d6(%rip), %rdi      # 0xba2f
callq 0x2210
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x811e
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
callq 0x21c0
cmpl $0x0, %eax
jge 0x80a4
leaq 0x3470(%rip), %rdi      # 0xb4fa
callq 0x2210
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x2120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x811e
leaq -0x4c(%rbp), %rdi
xorl %esi, %esi
movl $0x3c, %edx
callq 0x2100
movl -0x4c(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x44(%rbp), %eax
orl $0x400019b2, %eax       # imm = 0x400019B2
movl %eax, -0x44(%rbp)
movb $0x1, -0x35(%rbp)
movb $0x0, -0x36(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edi
xorl %esi, %esi
leaq -0x4c(%rbp), %rdx
callq 0x21d0
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
jge 0x810c
leaq 0x341a(%rip), %rdi      # 0xb50c
callq 0x2210
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x2120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x811e
movq -0x10(%rbp), %rax
movl $0x1, 0xc(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/mpmboot.c
// Function: mpm_switch_application
static int mpm_switch_application(struct mpm_privdata *mpm,
                                  uint8_t application)
{
    uint8_t data[] = { application };

    int ret = mpm_send(mpm, CMD_SWITCH_APPLICATION, data, sizeof(data));
    if (ret < 0)
    {
        return ret;
    }

    uint8_t cause = CAUSE_SUCCESS;
    ret = mpm_recv(mpm, CMD_SWITCH_APPLICATION, &cause, NULL, 0);
    if (ret < 0)
    {
        return ret;
    }

    return (cause != CAUSE_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movb -0x11(%rbp), %al
movb %al, -0x12(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x12(%rbp), %rdx
movl $0x1, %ecx
movl %ecx, %esi
callq 0x8320
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0x816d
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x81ad
movb $0x0, -0x19(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
leaq -0x19(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x84e0
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0x819b
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x81ad
movzbl -0x19(%rbp), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/mpmboot.c
// Function: mpm_read_version
static int mpm_read_version(struct mpm_privdata *mpm,
                            uint8_t *version, uint16_t length)
{
    memset(version, 0, length);

    int ret = mpm_send(mpm, CMD_GET_BOOTLOADER_VERSION, NULL, 0);
    if (ret < 0)
    {
        return ret;
    }

    uint8_t cause = CAUSE_SUCCESS;
    ret = mpm_recv(mpm, CMD_GET_BOOTLOADER_VERSION, &cause, version, length);
    if (ret < 0)
    {
        return ret;
    }

    int i;
    for (i = 0; i < length; i++)
    {
        version[i] &= ~0x80;
    }

    return (cause != CAUSE_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %dx, %ax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movw %ax, -0x1a(%rbp)
movq -0x18(%rbp), %rdi
movzwl -0x1a(%rbp), %eax
movl %eax, %edx
xorl %esi, %esi
callq 0x2100
movq -0x10(%rbp), %rdi
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x8320
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x820d
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8281
movb $0x0, -0x21(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x2, %esi
leaq -0x21(%rbp), %rdx
movzwl -0x1a(%rbp), %r8d
callq 0x84e0
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x823d
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8281
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movzwl -0x1a(%rbp), %ecx
cmpl %ecx, %eax
jge 0x826f
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %edx
andl $0xffffff7f, %edx       # imm = 0xFFFFFF7F
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x8244
movzbl -0x21(%rbp), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/mpmboot.c
// Function: mpm_read_chipinfo
static int mpm_read_chipinfo(struct mpm_privdata *mpm,
                             uint8_t *chipinfo, uint16_t length)
{
    int ret = mpm_send(mpm, CMD_GET_CHIP_INFO, NULL, 0);
    if (ret < 0)
    {
        return ret;
    }

    uint8_t cause = CAUSE_SUCCESS;
    ret = mpm_recv(mpm, CMD_GET_CHIP_INFO, &cause, chipinfo, length);
    if (ret < 0)
    {
        return ret;
    }

    return (cause != CAUSE_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %dx, %ax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movw %ax, -0x1a(%rbp)
movq -0x10(%rbp), %rdi
movl $0x3, %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x8320
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x82cc
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x830e
movb $0x0, -0x21(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x3, %esi
leaq -0x21(%rbp), %rdx
movzwl -0x1a(%rbp), %r8d
callq 0x84e0
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x82fc
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x830e
movzbl -0x21(%rbp), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/mpmboot.c
// Function: mpm_read_memory
static int mpm_read_memory(struct mpm_privdata *mpm,
                           uint8_t *buffer, uint16_t size,
                           uint8_t memtype, uint16_t address)
{
    uint8_t param[5] = {
        memtype,
        (address >> 8) & 0xFF,
        (address & 0xFF),
        (size >> 8) & 0xFF,
        (size & 0xFF)
    };

    int ret = mpm_send(mpm, CMD_READ_MEMORY, param, sizeof(param));
    if (ret < 0)
    {
        return ret;
    }

    uint8_t cause = CAUSE_SUCCESS;
    ret = mpm_recv(mpm, CMD_READ_MEMORY, &cause, buffer, size);
    if (ret < 0)
    {
        return ret;
    }

    return (cause != CAUSE_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %r8w, %ax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movw %dx, -0x1a(%rbp)
movb %cl, -0x1b(%rbp)
movw %ax, -0x1e(%rbp)
movb -0x1b(%rbp), %al
movb %al, -0x23(%rbp)
movzwl -0x1e(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, -0x22(%rbp)
movzwl -0x1e(%rbp), %eax
andl $0xff, %eax
movb %al, -0x21(%rbp)
movzwl -0x1a(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, -0x20(%rbp)
movzwl -0x1a(%rbp), %eax
andl $0xff, %eax
movb %al, -0x1f(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x23(%rbp), %rdx
movl $0x11, %esi
movl $0x5, %ecx
callq 0x8320
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0x89a3
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x89e5
movb $0x0, -0x29(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x11, %esi
leaq -0x29(%rbp), %rdx
movzwl -0x1a(%rbp), %r8d
callq 0x84e0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0x89d3
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x89e5
movzbl -0x29(%rbp), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/multiboot.c
// Function: progress_mode1_cb
static void progress_mode1_cb(const char *msg, int pos, int size)
{
    if (pos != -1 && size > 0)
    {
        char stars[51];
        int i;
        int count = (pos * 50 / size);

        for (i = 0; i < 50; i++)
        {
            stars[i] = (i < count) ? '*' : ' ';
        }

        stars[50] = '\0';
        printf("%-15s: [%s] (%d)\r", msg, stars, pos);
    }

    if (pos == size)
    {
        printf("\n");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
cmpl $-0x1, -0xc(%rbp)
je 0x91bd
cmpl $0x0, -0x10(%rbp)
jle 0x91bd
imull $0x32, -0xc(%rbp), %eax
cltd
idivl -0x10(%rbp)
movl %eax, -0x58(%rbp)
movl $0x0, -0x54(%rbp)
cmpl $0x32, -0x54(%rbp)
jge 0x91a0
movl -0x54(%rbp), %edx
movl -0x58(%rbp), %esi
movl $0x20, %eax
movl $0x2a, %ecx
cmpl %esi, %edx
cmovll %ecx, %eax
movb %al, %cl
movslq -0x54(%rbp), %rax
movb %cl, -0x50(%rbp,%rax)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x9170
movb $0x0, -0x1e(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl -0xc(%rbp), %ecx
leaq 0x33a1(%rip), %rdi      # 0xc557
movb $0x0, %al
callq 0x20d0
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jne 0x91d3
leaq 0x2635(%rip), %rdi      # 0xb801
movb $0x0, %al
callq 0x20d0
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/multiboot.c
// Function: main_optarg_cb
static int main_optarg_cb(int val, const char *arg, void *privdata)
{
    struct multiboot *mboot = (struct multiboot *)privdata;

    switch (val)
    {
        case 'r': /* read */
            if ((mboot->ops->read == NULL) ||
                (add_action(mboot, ACTION_READ, arg) < 0)
               )
            {
                return -1;
            }
            break;

        case 'w': /* write */
            if ((mboot->ops->write == NULL) ||
                (add_action(mboot, ACTION_WRITE, arg) < 0)
               )
            {
                return -1;
            }
            break;

        case 'n': /* no verify after write */
            mboot->verify = 0;
            break;

        case 'p':
            switch (*arg)
            {
                case '0':
                    mboot->progress_cb = progress_mode0_cb;
                    break;

                case '1':
                    mboot->progress_cb = progress_mode1_cb;
                    break;

                case '2':
                    mboot->progress_cb = progress_mode2_cb;
                    break;

                default:
                    fprintf(stderr, "invalid progress bar mode: '%s'\n", arg);
                    return -1;
            }
            break;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movl -0x8(%rbp), %eax
addl $-0x6e, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x9, %eax
ja 0x931c
movq -0x28(%rbp), %rax
leaq 0x3249(%rip), %rcx      # 0xc464
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x38(%rax)
je 0x9249
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x1, %esi
callq 0x9330
cmpl $0x0, %eax
jge 0x9255
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9323
jmp 0x931c
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x48(%rax)
je 0x927f
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x2, %esi
callq 0x9330
cmpl $0x0, %eax
jge 0x928b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9323
jmp 0x931c
movq -0x20(%rbp), %rax
movl $0x0, 0x10(%rax)
jmp 0x931c
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x2c(%rbp)
subl $0x30, %eax
je 0x92c2
jmp 0x92ae
movl -0x2c(%rbp), %eax
subl $0x31, %eax
je 0x92d3
jmp 0x92b8
movl -0x2c(%rbp), %eax
subl $0x32, %eax
je 0x92e4
jmp 0x92f5
movq -0x20(%rbp), %rax
leaq 0x263(%rip), %rcx       # 0x9530
movq %rcx, 0x18(%rax)
jmp 0x931a
movq -0x20(%rbp), %rax
leaq -0x19e(%rip), %rcx      # 0x9140
movq %rcx, 0x18(%rax)
jmp 0x931a
movq -0x20(%rbp), %rax
leaq 0x251(%rip), %rcx       # 0x9540
movq %rcx, 0x18(%rax)
jmp 0x931a
movq 0x6cfc(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x3282(%rip), %rsi      # 0xc58c
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9323
jmp 0x931c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/multiboot.c
// Function: progress_mode2_cb
static void progress_mode2_cb(const char *msg, int pos, int size)
{
    static int old_count;

    if (pos != -1 && size > 0)
    {
        if (pos == 0)
        {
            old_count = 0;
            printf("%-15s: [", msg);

        }
        else if (pos <=size)
        {
            int i;
            int count = (pos * 50 / size);

            for (i = old_count; i < count; i++)
            {
                printf("*");
            }

            old_count = count;

            if (pos == size)
            {
                printf("] (%d)\n", pos);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
cmpl $-0x1, -0xc(%rbp)
je 0x95ef
cmpl $0x0, -0x10(%rbp)
jle 0x95ef
cmpl $0x0, -0xc(%rbp)
jne 0x958a
movl $0x0, 0x714e(%rip)      # 0x106c4
movq -0x8(%rbp), %rsi
leaq 0x305d(%rip), %rdi      # 0xc5de
movb $0x0, %al
callq 0x20d0
jmp 0x95ed
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jg 0x95eb
imull $0x32, -0xc(%rbp), %eax
cltd
idivl -0x10(%rbp)
movl %eax, -0x18(%rbp)
movl 0x7121(%rip), %eax      # 0x106c4
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x95c7
leaq 0x3032(%rip), %rdi      # 0xc5e7
movb $0x0, %al
callq 0x20d0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x95a6
movl -0x18(%rbp), %eax
movl %eax, 0x70f4(%rip)      # 0x106c4
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jne 0x95e9
movl -0xc(%rbp), %esi
leaq 0x3007(%rip), %rdi      # 0xc5e9
movb $0x0, %al
callq 0x20d0
jmp 0x95eb
jmp 0x95ed
jmp 0x95ef
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/./list.h
// Function: _list_add
static inline void __list_add(struct list_head *new,
			      struct list_head *prev,
			      struct list_head *next)
{
	next->prev = new;
	new->next = next;
	new->prev = prev;
	prev->next = new;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/optarg.c
// Function: optarg_register
int optarg_register(const struct option *opts, int count,
                    int (* parser_cb)(int val, const char *arg, void *privdata),
                    void *privdata)
{
    struct optarg_entry *entry;

    entry = malloc(sizeof(struct optarg_entry));
    if (entry == NULL)
    {
        return -1;
    }

    entry->opts         = opts;     /* TODO: copy? */
    entry->count        = count;
    entry->parser_cb    = parser_cb;
    entry->privdata     = privdata;

    list_add_tail(&entry->list, &option_list);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x30, %edi
callq 0x21b0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x96a5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x96ea
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x14(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x30(%rbp), %rdi
leaq 0x6f22(%rip), %rsi      # 0x10600
callq 0x9700
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/optarg.c
// Function: optarg_free
void optarg_free(void)
{
    struct optarg_entry *entry, *entry_tmp;

    list_for_each_entry_safe(entry, entry_tmp, &option_list, list)
    {
        list_del(&entry->list);
        free(entry);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x6ec1(%rip), %rax      # 0x10600
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
leaq 0x6e87(%rip), %rcx      # 0x10600
cmpq %rcx, %rax
je 0x97b5
movq -0x8(%rbp), %rdi
callq 0x97c0
movq -0x8(%rbp), %rdi
callq 0x2030
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x976e
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/optarg.c
// Function: optarg_getsize
static void optarg_getsize(int *opt_count, int *optstring_len)
{
    int count  = 0;
    int length = 0;

    struct optarg_entry *entry;

    list_for_each_entry(entry, &option_list, list)
    {
        count += entry->count;

        int i;
        for (i = 0; i < entry->count; i++)
        {
            switch (entry->opts[i].has_arg)
            {
                case 0: /* no arguments */
                case 1: /* has argument */
                case 2: /* optional argument */
                    length += entry->opts[i].has_arg +1;
                    break;

                default:
                    break;
            }
        }
    }

    *opt_count     = count  +1;
    *optstring_len = length +1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq 0x6c3f(%rip), %rax      # 0x10600
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
leaq 0x6c20(%rip), %rcx      # 0x10600
cmpq %rcx, %rax
je 0x9a76
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x9a54
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
movl 0x8(%rax,%rcx), %eax
subl $0x2, %eax
ja 0x9a45
jmp 0x9a24
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x9a47
jmp 0x9a47
jmp 0x9a49
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x99fd
jmp 0x9a56
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x99d5
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/twiboot.c
// Function: twi_alloc
static struct multiboot * twi_alloc(void)
{
    struct multiboot * mboot = malloc(sizeof(struct multiboot));
    if (mboot == NULL)
    {
        return NULL;
    }

    memset(mboot, 0x00, sizeof(struct multiboot));
    mboot->ops  = &twi_ops;

    struct twi_privdata *twi = malloc(sizeof(struct twi_privdata));
    if (twi == NULL)
    {
        free(mboot);
        return NULL;
    }

    memset(twi, 0x00, sizeof(struct twi_privdata));
    twi->device  = NULL;
    twi->address = 0;

    optarg_register(twi_optargs, ARRAY_SIZE(twi_optargs), twi_optarg_cb, (void *)twi);

    mboot->privdata = twi;
    return mboot;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x20, %edi
callq 0x21b0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x9d1a
movq $0x0, -0x8(%rbp)
jmp 0x9db3
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2100
movq -0x10(%rbp), %rax
leaq 0x68db(%rip), %rcx      # 0x10610
movq %rcx, (%rax)
movl $0x20, %edi
callq 0x21b0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x9d60
movq -0x10(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
jmp 0x9db3
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2100
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x8(%rax)
movq -0x18(%rbp), %rcx
leaq 0x68d2(%rip), %rdi      # 0x10660
movl $0x3, %esi
leaq 0x886(%rip), %rdx       # 0xa620
callq 0x9670
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/twiboot.c
// Function: twi_free
static void twi_free(struct multiboot *mboot)
{
    struct twi_privdata *twi = (struct twi_privdata *)mboot->privdata;

    if (twi->device != NULL)
    {
        free(twi->device);
    }

    free(twi);
    free(mboot);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x9dee
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2030
movq -0x10(%rbp), %rdi
callq 0x2030
movq -0x8(%rbp), %rdi
callq 0x2030
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/twiboot.c
// Function: twi_get_memsize
static uint32_t twi_get_memsize(struct multiboot *mboot,
                                int memtype)
{
    struct twi_privdata *twi = (struct twi_privdata *)mboot->privdata;

    if (!twi->connected)
    {
        return 0;
    }

    switch (memtype)
    {
        case MEMTYPE_FLASH:
            return twi->flashsize;

        case MEMTYPE_EEPROM:
            return twi->eepromsize;

        default:
            return 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x9e9a
movl $0x0, -0x4(%rbp)
jmp 0x9ed2
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
subl $0x1, %eax
je 0x9eb1
jmp 0x9ea7
movl -0x24(%rbp), %eax
subl $0x2, %eax
je 0x9ebe
jmp 0x9ecb
movq -0x20(%rbp), %rax
movzwl 0x1a(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x9ed2
movq -0x20(%rbp), %rax
movzwl 0x1c(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x9ed2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/twiboot.c
// Function: twi_close
static int twi_close(struct multiboot *mboot)
{
    struct twi_privdata *twi = (struct twi_privdata *)mboot->privdata;

    if (twi->connected && !twi->stay_in_bootloader)
    {
        twi_switch_application(twi, BOOTTYPE_APPLICATION);
    }

    twi_close_device(twi);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0xa1ba
movq -0x10(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0xa1ba
movq -0x10(%rbp), %rdi
movl $0x80, %esi
callq 0xa940
movq -0x10(%rbp), %rdi
callq 0xabb0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/twiboot.c
// Function: twi_read
static int twi_read(struct multiboot *mboot,
                    struct databuf *dbuf,
                    int memtype)
{
    struct twi_privdata *twi = (struct twi_privdata *)mboot->privdata;
    char *progress_msg = (memtype == MEMTYPE_FLASH) ? "reading flash" : "reading eeprom";

    uint16_t pos = 0;
    uint16_t size = (memtype == MEMTYPE_FLASH) ? twi->flashsize : twi->eepromsize;

    while (pos < size)
    {
        mboot->progress_cb(progress_msg, pos, size);

        uint8_t len = MIN(READ_BLOCK_SIZE, size - pos);

        if (twi_read_memory(twi, dbuf->data + pos, len, memtype, pos))
        {
            mboot->progress_cb(progress_msg, -1, -1);
            return -1;
        }

        pos += len;
    }

    dbuf->length = pos;

    mboot->progress_cb(progress_msg, pos, size);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %edx
leaq 0x1342(%rip), %rax      # 0xb53b
leaq 0x132d(%rip), %rcx      # 0xb52d
cmpl $0x1, %edx
cmoveq %rcx, %rax
movq %rax, -0x30(%rbp)
movw $0x0, -0x32(%rbp)
cmpl $0x1, -0x1c(%rbp)
jne 0xa224
movq -0x28(%rbp), %rax
movzwl 0x1a(%rax), %eax
movl %eax, -0x3c(%rbp)
jmp 0xa22f
movq -0x28(%rbp), %rax
movzwl 0x1c(%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movw %ax, -0x34(%rbp)
movzwl -0x32(%rbp), %eax
movzwl -0x34(%rbp), %ecx
cmpl %ecx, %eax
jge 0xa2ed
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movzwl -0x32(%rbp), %esi
movzwl -0x34(%rbp), %edx
callq *%rax
movzwl -0x34(%rbp), %ecx
movzwl -0x32(%rbp), %eax
subl %eax, %ecx
movl $0x80, %eax
cmpl %ecx, %eax
jge 0xa279
movl $0x80, %eax
movl %eax, -0x40(%rbp)
jmp 0xa286
movzwl -0x34(%rbp), %eax
movzwl -0x32(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movb %al, -0x35(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movzwl -0x32(%rbp), %eax
cltq
addq %rax, %rsi
movb -0x35(%rbp), %cl
movl -0x1c(%rbp), %eax
movzbl %cl, %edx
movzbl %al, %ecx
movzwl -0x32(%rbp), %r8d
callq 0xaa50
cmpl $0x0, %eax
je 0xa2da
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %edx, %esi
callq *%rax
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa315
movzbl -0x35(%rbp), %ecx
movzwl -0x32(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x32(%rbp)
jmp 0xa236
movzwl -0x32(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movzwl -0x32(%rbp), %esi
movzwl -0x34(%rbp), %edx
callq *%rax
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/twiboot.c
// Function: twi_write
static int twi_write(struct multiboot *mboot,
                     struct databuf *dbuf,
                     int memtype)
{
    struct twi_privdata *twi = (struct twi_privdata *)mboot->privdata;
    char *progress_msg = (memtype == MEMTYPE_FLASH) ? "writing flash" : "writing eeprom";

    uint16_t pos = 0;
    while (pos < dbuf->length)
    {
        mboot->progress_cb(progress_msg, pos, dbuf->length);

        uint8_t len = (memtype == MEMTYPE_FLASH) ? twi->pagesize : WRITE_BLOCK_SIZE;

        len = MIN(len, dbuf->length - pos);

        if (twi_write_memory(twi, dbuf->data + pos, len, memtype, pos))
        {
            mboot->progress_cb(progress_msg, -1, -1);
            return -1;
        }

        pos += len;
    }

    mboot->progress_cb(progress_msg, pos, dbuf->length);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %edx
leaq 0x10b6(%rip), %rax      # 0xb5af
leaq 0x10a1(%rip), %rcx      # 0xb5a1
cmpl $0x1, %edx
cmoveq %rcx, %rax
movq %rax, -0x30(%rbp)
movw $0x0, -0x32(%rbp)
movzwl -0x32(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0xa5f3
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movzwl -0x32(%rbp), %esi
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %edx
callq *%rax
cmpl $0x1, -0x1c(%rbp)
jne 0xa54e
movq -0x28(%rbp), %rax
movzbl 0x18(%rax), %eax
movl %eax, -0x38(%rbp)
jmp 0xa558
movl $0x10, %eax
movl %eax, -0x38(%rbp)
jmp 0xa558
movl -0x38(%rbp), %eax
movb %al, -0x33(%rbp)
movzbl -0x33(%rbp), %eax
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %ecx
movzwl -0x32(%rbp), %edx
subl %edx, %ecx
cmpl %ecx, %eax
jae 0xa57c
movzbl -0x33(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0xa58c
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movzwl -0x32(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movb %al, -0x33(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movzwl -0x32(%rbp), %eax
cltq
addq %rax, %rsi
movb -0x33(%rbp), %cl
movl -0x1c(%rbp), %eax
movzbl %cl, %edx
movzbl %al, %ecx
movzwl -0x32(%rbp), %r8d
callq 0xabf0
cmpl $0x0, %eax
je 0xa5e0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %edx, %esi
callq *%rax
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa613
movzbl -0x33(%rbp), %ecx
movzwl -0x32(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x32(%rbp)
jmp 0xa511
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdi
movzwl -0x32(%rbp), %esi
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %edx
callq *%rax
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/twiboot.c
// Function: twi_open_device
static int twi_open_device(struct twi_privdata *twi)
{
    twi->fd = open(twi->device, O_RDWR);
    if (twi->fd < 0)
    {
        fprintf(stderr, "failed to open '%s': %s\n",
                twi->device, strerror(errno));

        return -1;
    }

    unsigned long funcs;
    if (ioctl(twi->fd, I2C_FUNCS, &funcs))
    {
        perror("ioctl(I2C_FUNCS)");
        close(twi->fd);
        return -1;
    }

    if (!(funcs & I2C_FUNC_I2C))
    {
        fprintf(stderr, "I2C_FUNC_I2C not supported on '%s'!\n",
                twi->device);

        close(twi->fd);
        return -1;
    }

    if (ioctl(twi->fd, I2C_SLAVE, twi->address) < 0)
    {
        fprintf(stderr, "failed to select slave address '%d': %s\n",
                twi->address, strerror(errno));

        close(twi->fd);
        return -1;
    }

    twi->connected = 1;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x2, %esi
movb $0x0, %al
callq 0x21e0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jge 0xa82c
movq 0x580f(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
callq 0x2050
movl (%rax), %edi
callq 0x2260
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq %rax, %rcx
leaq 0x209d(%rip), %rsi      # 0xc8b6
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa935
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edi
movl $0x705, %esi            # imm = 0x705
leaq -0x18(%rbp), %rdx
movb $0x0, %al
callq 0x2110
cmpl $0x0, %eax
je 0xa86c
leaq 0x2080(%rip), %rdi      # 0xc8cf
callq 0x2210
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x2120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa935
movq -0x18(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
jne 0xa8b1
movq 0x5777(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x204e(%rip), %rsi      # 0xc8e0
movb $0x0, %al
callq 0x2160
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x2120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa935
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edi
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %edx
movl $0x703, %esi            # imm = 0x703
movb $0x0, %al
callq 0x2110
cmpl $0x0, %eax
jge 0xa923
movq 0x5720(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
callq 0x2050
movl (%rax), %edi
callq 0x2260
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq %rax, %rcx
leaq 0x1ffe(%rip), %rsi      # 0xc905
movb $0x0, %al
callq 0x2160
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x2120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa935
movq -0x10(%rbp), %rax
movl $0x1, 0x10(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/orempel[P]multiboot_tool/twiboot.c
// Function: twi_read_version
static int twi_read_version(struct twi_privdata *twi,
                            char *version, int length)
{
    uint8_t cmd[] = { CMD_READ_VERSION };

    if (twi_write_retries(twi->fd, cmd, sizeof(cmd)) != sizeof(cmd))
    {
        return -1;
    }

    memset(version, 0, length);
    if (read(twi->fd, version, length) != length)
    {
        return -1;
    }

    int i;
    for (i = 0; i < length; i++)
    {
        version[i] &= ~0x80;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movb 0x1fe1(%rip), %al       # 0xc98a
movb %al, -0x1d(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edi
leaq -0x1d(%rbp), %rsi
movl $0x1, %edx
callq 0xaaf0
cltq
cmpq $0x1, %rax
je 0xa9d2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xaa3d
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rdx
xorl %esi, %esi
callq 0x2100
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x2130
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
je 0xaa07
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xaa3d
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xaa36
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %edx
andl $0xffffff7f, %edx       # imm = 0xFFFFFF7F
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xaa0e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)