LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movl %r8d, %eax
movl %edx, %ebx
movq %rdi, %r14
leaq 0x3(%rsp), %rdx
movb %cl, (%rdx)
movb %ah, 0x4(%rsp)
movb %al, 0x2(%rdx)
movb %bh, 0x6(%rsp)
movb %bl, 0x4(%rdx)
movl $0x11, %esi
movl $0x5, %ecx
callq 0x6893
testl %eax, %eax
js 0x6c55
leaq 0x2(%rsp), %r12
movb $0x0, (%r12)
movzwl %bx, %r8d
movq %r14, %rdi
movl $0x11, %esi
movq %r12, %rdx
movq %r15, %rcx
callq 0x69b1
movl %eax, %ecx
xorl %eax, %eax
cmpb $0x0, (%r12)
setne %al
testl %ecx, %ecx
cmovsl %ecx, %eax
jmp 0x6c5a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebx
movl %esi, %ebp
cmpl $-0x1, %esi
sete %al
testl %edx, %edx
setle %cl
orb %al, %cl
jne 0x7042
movq %rdi, %rsi
imull $0x32, %ebp, %eax
cltd
idivl %ebx
cltq
movdqa 0x243f(%rip), %xmm0     # 0x93e0
movl $0x1, %ecx
movdqa 0x2442(%rip), %xmm1     # 0x93f0
movdqa 0x244a(%rip), %xmm2     # 0x9400
pshufd $0xf5, %xmm2, %xmm3     # xmm3 = xmm2[1,1,3,3]
movl $0x2a, %edx
movdqa 0x2448(%rip), %xmm4     # 0x9410
movdqa %xmm0, %xmm5
pxor %xmm1, %xmm5
movdqa %xmm2, %xmm6
pcmpgtd %xmm5, %xmm6
pshufd $0xf5, %xmm5, %xmm5     # xmm5 = xmm5[1,1,3,3]
pcmpeqd %xmm3, %xmm5
pand %xmm6, %xmm5
movd %xmm5, %edi
testb $0x1, %dil
je 0x7003
leaq -0x1(%rcx), %rdi
cmpq %rax, %rdi
movl $0x20, %edi
cmovll %edx, %edi
movb %dil, -0x1(%rsp,%rcx)
pextrw $0x4, %xmm5, %edi
testb $0x1, %dil
je 0x701d
cmpq %rax, %rcx
movl $0x20, %edi
cmovll %edx, %edi
movb %dil, (%rsp,%rcx)
paddq %xmm4, %xmm0
addq $0x2, %rcx
cmpq $0x33, %rcx
jne 0x6fc8
movq %rsp, %rdx
movb $0x0, 0x32(%rdx)
leaq 0x24da(%rip), %rdi      # 0x9513
movl %ebp, %ecx
xorl %eax, %eax
callq 0x20f0
cmpl %ebx, %ebp
jne 0x7050
movl $0xa, %edi
callq 0x2040
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
addl $-0x6e, %edi
cmpl $0x9, %edi
ja 0x70ed
movq %rsi, %rax
leaq 0x23b2(%rip), %rcx      # 0x9420
movslq (%rcx,%rdi,4), %rsi
addq %rcx, %rsi
jmpq *%rsi
movl $0x0, 0x10(%rdx)
jmp 0x70ed
movq (%rdx), %rcx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpq $0x0, 0x38(%rcx)
je 0x70ef
movq %rdx, %rdi
movl $0x1, %esi
jmp 0x70cb
movzbl (%rax), %ecx
cmpl $0x32, %ecx
je 0x70d9
cmpl $0x31, %ecx
je 0x70e2
cmpl $0x30, %ecx
jne 0x70f3
leaq 0x1a1(%rip), %rax       # 0x7253
jmp 0x70e9
movq (%rdx), %rcx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpq $0x0, 0x48(%rcx)
je 0x70ef
movq %rdx, %rdi
movl $0x2, %esi
movq %rax, %rdx
callq 0x7115
testl %eax, %eax
jns 0x70ed
jmp 0x70ef
leaq 0x174(%rip), %rax       # 0x7254
jmp 0x70e9
leaq -0x178(%rip), %rax      # 0x6f71
movq %rax, 0x18(%rdx)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
movq 0x5efe(%rip), %rcx      # 0xcff8
movq (%rcx), %rdi
leaq 0x2444(%rip), %rsi      # 0x9548
movq %rax, %rdx
xorl %eax, %eax
callq 0x2180
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x70ef
// File: /workspace/github_c_makefile_star2_O3/orempel[P]multiboot_tool/multiboot.c
// Function: add_action
static int add_action(struct multiboot *mboot, int mode, const char *arg)
{
    struct mboot_action *action = malloc(sizeof(struct mboot_action));
    if (action == NULL)
    {
        perror("malloc()");
        return -1;
    }

    char *argcopy = strdup(arg);
    if (argcopy == NULL)
    {
        perror("strdup()");
        free(action);
        return -1;
    }

    char *tok = strtok(argcopy, ":");
    if (tok == NULL)
    {
        fprintf(stderr, "invalid argument: '%s'\n", arg);
        free(argcopy);
        free(action);
        return -1;
    }

    action->memtype = mboot->ops->get_memtype(mboot, tok);
    if (action->memtype == -1)
    {
        fprintf(stderr, "invalid memtype: '%s'\n", tok);
        free(argcopy);
        free(action);
        return -1;
    }

    tok = strtok(NULL, ":");
    if (tok == NULL)
    {
        fprintf(stderr, "invalid argument: '%s'\n", arg);
        free(argcopy);
        free(action);
        return -1;
    }

    action->filename = strdup(tok);
    if (action->filename == NULL)
    {
        perror("strdup()");
        free(argcopy);
        free(action);
        return -1;
    }

    action->mode = mode;

    list_add_tail(&action->list, &action_list);
    free(argcopy);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %r12
movl $0x20, %edi
callq 0x21d0
testq %rax, %rax
je 0x71ea
movq %rax, %rbx
movq %r15, %rdi
callq 0x2290
testq %rax, %rax
je 0x71f8
movq %rax, %r14
leaq 0x2410(%rip), %rsi      # 0x9569
movq %rax, %rdi
callq 0x2250
testq %rax, %rax
je 0x71d4
movq %rax, %r13
movq (%r12), %rax
movq %r12, %rdi
movq %r13, %rsi
callq *0x18(%rax)
movl %eax, 0x18(%rbx)
cmpl $-0x1, %eax
je 0x7206
leaq 0x23e0(%rip), %rsi      # 0x9569
xorl %edi, %edi
callq 0x2250
testq %rax, %rax
je 0x71d4
movq %rax, %rdi
callq 0x2290
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x7223
movl %ebp, 0x1c(%rbx)
movq 0x6438(%rip), %rax      # 0xd5e8
leaq 0x6429(%rip), %rcx      # 0xd5e0
movq %rbx, 0x642a(%rip)      # 0xd5e8
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
movq %rbx, (%rax)
movq %r14, %rdi
callq 0x2030
xorl %eax, %eax
jmp 0x7244
movq 0x5e1d(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x2386(%rip), %rsi      # 0x956b
movq %r15, %rdx
jmp 0x721a
leaq 0x1854(%rip), %rdi      # 0x8a45
callq 0x2240
jmp 0x723f
leaq 0xe7b(%rip), %rdi       # 0x807a
callq 0x2240
jmp 0x7237
movq 0x5deb(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x236c(%rip), %rsi      # 0x9583
movq %r13, %rdx
xorl %eax, %eax
callq 0x2180
jmp 0x722f
leaq 0xe50(%rip), %rdi       # 0x807a
callq 0x2240
movq %r14, %rdi
callq 0x2030
movq %rbx, %rdi
callq 0x2030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
cmpl $-0x1, %esi
sete %al
testl %edx, %edx
setle %cl
orb %al, %cl
jne 0x72bf
testl %ebx, %ebx
je 0x72ca
movl %edx, %ebp
cmpl %edx, %ebx
jg 0x72bf
imull $0x32, %ebx, %eax
cltd
idivl %ebp
movl %eax, %r14d
movl %eax, %r15d
subl 0x642b(%rip), %r15d     # 0xd6b4
jle 0x729a
movl $0x2a, %edi
callq 0x2040
decl %r15d
jne 0x728b
movl %r14d, 0x6413(%rip)     # 0xd6b4
cmpl %ebp, %ebx
jne 0x72bf
leaq 0x22f7(%rip), %rdi      # 0x95a3
movl %ebx, %esi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x20f0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rsi
movl $0x0, 0x63dd(%rip)      # 0xd6b4
leaq 0x22bc(%rip), %rdi      # 0x959a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x20f0
nop
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
movl $0x30, %edi
callq 0x21d0
testq %rax, %rax
je 0x7343
movq %r15, 0x10(%rax)
movl %ebp, 0x18(%rax)
movq %r14, 0x20(%rax)
movq %rbx, 0x28(%rax)
movq 0x62d1(%rip), %rcx      # 0xd5f8
leaq 0x62c2(%rip), %rdx      # 0xd5f0
movq %rax, 0x62c3(%rip)      # 0xd5f8
movq %rdx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, (%rcx)
xorl %eax, %eax
jmp 0x7348
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq 0x6292(%rip), %rdi      # 0xd5f0
leaq 0x628b(%rip), %rbx      # 0xd5f0
cmpq %rbx, %rdi
je 0x7385
movq (%rdi), %r14
movq 0x8(%rdi), %rax
movq %rax, 0x8(%r14)
movq %r14, (%rax)
callq 0x2030
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x736a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movl $0x1, %edi
movl $0x20, %esi
callq 0x2160
testq %rax, %rax
je 0x7609
movq %rax, %rbx
leaq 0x603a(%rip), %rax      # 0xd600
movq %rax, (%rbx)
movl $0x1, %edi
movl $0x20, %esi
callq 0x2160
testq %rax, %rax
je 0x7601
movq %rax, %r14
leaq 0x6069(%rip), %rdi      # 0xd650
leaq 0x787(%rip), %rdx       # 0x7d75
movl $0x3, %esi
movq %rax, %rcx
callq 0x72f0
movq %r14, 0x8(%rbx)
jmp 0x760b
movq %rbx, %rdi
callq 0x2030
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movq (%r14), %rdi
testq %rdi, %rdi
je 0x762e
callq 0x2030
movq %r14, %rdi
callq 0x2030
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
subq $0x10, %rsp
movq 0x8(%rdi), %rbx
cmpl $0x0, 0x10(%rbx)
je 0x7932
cmpl $0x0, 0x14(%rbx)
jne 0x792a
movl 0xc(%rbx), %edi
leaq 0xe(%rsp), %rsi
movw $0x8001, (%rsi)         # imm = 0x8001
movl $0x2, %edx
callq 0x7eb0
cmpl $0x0, 0x10(%rbx)
je 0x7932
movl 0xc(%rbx), %edi
callq 0x2140
movl $0x0, 0x10(%rbx)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movq 0x8(%rdi), %rsi
xorl %eax, %eax
cmpl $0x1, %edx
setne %al
leaq 0xaf8(%rip), %rcx       # 0x8464
leaq 0xaff(%rip), %r15       # 0x8472
cmoveq %rcx, %r15
movq %rsi, 0x20(%rsp)
movzwl 0x1a(%rsi,%rax,2), %r12d
movl $0x0, %r14d
testl %r12d, %r12d
je 0x79f7
movq 0x10(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
movzbl %dl, %ebp
xorl %ebx, %ebx
movq %r15, %rdi
movl %r14d, %esi
movl %r12d, %edx
movq 0x8(%rsp), %rax
callq *0x18(%rax)
movl %r12d, %r13d
subl %r14d, %r13d
movl $0x80, %eax
cmpl %eax, %r13d
cmovgel %eax, %r13d
movzwl %bx, %r8d
movq 0x18(%rsp), %rax
leaq (%rax,%r8), %rsi
movzbl %r13b, %edx
movq 0x20(%rsp), %rdi
movl %ebp, %ecx
callq 0x7e4b
testl %eax, %eax
jne 0x7a15
movzbl %r13b, %eax
addl %eax, %ebx
movzwl %bx, %r14d
cmpw %r12w, %r14w
jb 0x79a3
movq 0x10(%rsp), %rax
movl %r14d, 0x4(%rax)
movq %r15, %rdi
movl %r14d, %esi
movl %r12d, %edx
movq 0x8(%rsp), %rax
callq *0x18(%rax)
xorl %ebx, %ebx
jmp 0x7a2f
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %r15, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rax
callq *0x18(%rax)
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/orempel[P]multiboot_tool/twiboot.c
// Function: twi_verify
static int twi_verify(struct multiboot *mboot, struct databuf *dbuf, int memtype)
{
    struct twi_privdata *twi = (struct twi_privdata *)mboot->privdata;
    char *progress_msg = (memtype == MEMTYPE_FLASH) ? "verifing flash" : "verifing eeprom";

    uint16_t pos = 0;
    uint8_t comp[READ_BLOCK_SIZE];

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

        int len = MIN(READ_BLOCK_SIZE, dbuf->length - pos);
        if (twi_read_memory(twi, comp, len, memtype, pos))
        {
            mboot->progress_cb(progress_msg, -1, -1);
            return -1;
        }

        if (memcmp(comp, dbuf->data + pos, len) != 0x00)
        {
            mboot->progress_cb(progress_msg, -1, -1);
            fprintf(stderr, "verify failed at page 0x%04x!!\n", pos);
            return -1;
        }

        pos += len;
    }

    dbuf->length = pos;

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %edx, %eax
movq %rsi, %r12
movq %rdi, 0x18(%rsp)
cmpl $0x1, %edx
leaq 0xa35(%rip), %rcx       # 0x849a
leaq 0xa3d(%rip), %rdx       # 0x84a9
cmoveq %rcx, %rdx
movq %rdx, (%rsp)
movl 0x4(%rsi), %edx
movl $0x0, %ebp
testl %edx, %edx
je 0x7b18
movq 0x18(%rsp), %rcx
movq 0x8(%rcx), %rsi
movq %rsi, 0x28(%rsp)
addq $0x18, %rcx
movq %rcx, 0x8(%rsp)
leaq 0x8(%r12), %rcx
movq %rcx, 0x20(%rsp)
xorl %ebp, %ebp
movzbl %al, %eax
movl %eax, 0x14(%rsp)
xorl %r15d, %r15d
movq (%rsp), %rdi
movl %ebp, %esi
movq 0x8(%rsp), %rax
callq *(%rax)
movl 0x4(%r12), %ebx
subl %ebp, %ebx
movl $0x80, %eax
cmpl %eax, %ebx
cmovael %eax, %ebx
movzwl %r15w, %r13d
movq 0x28(%rsp), %rdi
leaq 0x30(%rsp), %r14
movq %r14, %rsi
movl %ebx, %edx
movl 0x14(%rsp), %ecx
movl %r13d, %r8d
callq 0x7e4b
testl %eax, %eax
jne 0x7b31
addq 0x20(%rsp), %r13
movl %ebx, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x21e0
testl %eax, %eax
jne 0x7b5f
addl %ebx, %r15d
movzwl %r15w, %ebp
movl 0x4(%r12), %edx
cmpl %ebp, %edx
ja 0x7ab1
movl %ebp, 0x4(%r12)
movq (%rsp), %rdi
movl %ebp, %esi
movl %ebp, %edx
movq 0x18(%rsp), %rax
callq *0x18(%rax)
xorl %ebx, %ebx
jmp 0x7b4b
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq (%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rax
callq *(%rax)
movl %ebx, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rdi
movq (%rsp), %rsi
movl %ebp, %edx
callq 0x2ded
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x7b4b
// File: /workspace/github_c_makefile_star2_O3/orempel[P]multiboot_tool/twiboot.c
// Function: twi_read_memory
static int twi_read_memory(struct twi_privdata *twi,
                           uint8_t *buffer, uint8_t size,
                           uint8_t memtype, uint16_t address)
{
    uint8_t cmd[] = { CMD_READ_MEMORY, memtype, (address >> 8) & 0xFF, (address & 0xFF) };

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

    return (read(twi->fd, buffer, size) != size);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movl %r8d, %eax
movq %rdi, %r14
leaq 0xc(%rsp), %rsi
movb $0x2, (%rsi)
movb %cl, 0x1(%rsi)
movb %ah, 0xe(%rsp)
movb %al, 0x3(%rsi)
movl 0xc(%rdi), %edi
movl $0x4, %edx
callq 0x7eb0
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x4, %ecx
jne 0x7ea7
movl 0xc(%r14), %edi
movzbl %bpl, %r14d
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2150
movq %rax, %rcx
xorl %eax, %eax
cmpq %r14, %rcx
setne %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/orempel[P]multiboot_tool/twiboot.c
// Function: twi_write_retries
static int twi_write_retries(int fd, const void *buf, size_t count)
{
    int result;
    int retries = WRITE_RETRY_COUNT;
    do {
        result = write(fd, buf, count);
        if (result >= 0)
        {
            break;
        }
        else
        {
            /*
             * slave device does not acknowledge (eg. not able to clockstretch)
             * actual error code may be driver specific
             */
            if ((errno == ENXIO) || (errno == EREMOTEIO) || (errno == EIO))
            {
                usleep(WRITE_RETRY_DELAY_US);
            }
            else
            {
                fprintf(stderr, "twi_write_retries(): %s\n",
                        strerror(errno));

                retries = 0;
            }
        }
    } while (retries--);

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movl $0xffffffcd, %r12d      # imm = 0xFFFFFFCD
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2090
movq %rax, %r15
testl %r15d, %r15d
jns 0x7efe
callq 0x2060
movl (%rax), %edi
leal -0x5(%rdi), %eax
cmpl $0x2, %eax
jb 0x7eef
cmpl $0x79, %edi
jne 0x7f0a
movl $0x7d0, %edi            # imm = 0x7D0
callq 0x22c0
incl %r12d
jne 0x7ec6
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x2e58
jmp 0x7efe
// File: /workspace/github_c_makefile_star2_O3/vidarr[P]ringbuffer/test/../src/caching_ringbuffer.c
// Function: caching_ringbuffer_create
Ringbuffer* caching_ringbuffer_create(
        size_t capacity,
        void (*free_item)(void* item, void* additional_arg),
        void* free_item_additional_arg) {

    InternalRingbuffer* internal = calloc(1, sizeof(InternalRingbuffer));
    internal->cache =
    ringbuffer_create(capacity, free_item, free_item_additional_arg);
    internal->buffer = ringbuffer_create(capacity, cache_free, internal->cache);

    internal->public = (Ringbuffer) {
        .capacity = capacity_func,
        .add = add_func,
        .pop = pop_func,
        .free = free_func,
    };

    return (Ringbuffer*) internal;

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x30, %esi
callq 0x1050
movq %rax, %r12
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x25ac
movq %rax, 0x28(%r12)
leaq 0x4e(%rip), %rsi        # 0x1227
movq %r15, %rdi
movq %rax, %rdx
callq 0x25ac
movq %rax, 0x20(%r12)
leaq 0x64(%rip), %rax        # 0x1254
movq %rax, (%r12)
leaq 0x67(%rip), %rax        # 0x1262
movq %rax, 0x8(%r12)
leaq 0x72(%rip), %rax        # 0x1279
movq %rax, 0x10(%r12)
leaq 0x7a(%rip), %rax        # 0x128d
movq %rax, 0x18(%r12)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/vidarr[P]ringbuffer/test/caching_ringbuffer_test.c
// Function: test_caching_ringbuffer_create
void test_caching_ringbuffer_create() {

    Ringbuffer* buffer = 0;

    buffer = caching_ringbuffer_create(1, 0, 0);
    assert(buffer);
    assert(capacity_func == buffer->capacity);
    assert(add_func == buffer->add);
    assert(pop_func == buffer->pop);
    assert(free_func == buffer->free);

    buffer = buffer->free(buffer);

    fprintf(stdout, "caching ringbuffer_create OK\n");

}

// Assembly:
pushq %rax
movl $0x1, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x119c
testq %rax, %rax
je 0x1359
leaq -0xa4(%rip), %rcx       # 0x1254
cmpq %rcx, (%rax)
jne 0x1378
leaq -0xa2(%rip), %rcx       # 0x1262
cmpq %rcx, 0x8(%rax)
jne 0x1397
leaq -0x9c(%rip), %rcx       # 0x1279
cmpq %rcx, 0x10(%rax)
jne 0x13b6
leaq -0x99(%rip), %rcx       # 0x128d
cmpq %rcx, 0x18(%rax)
jne 0x13d5
movq %rax, %rdi
callq 0x128d
movq 0x3c99(%rip), %rax      # 0x4fd8
movq (%rax), %rcx
leaq 0x1dbf(%rip), %rdi      # 0x3108
movl $0x1d, %esi
movl $0x1, %edx
popq %rax
jmp 0x1070
leaq 0x1cf0(%rip), %rdi      # 0x3050
leaq 0x1cf0(%rip), %rsi      # 0x3057
leaq 0x1d08(%rip), %rcx      # 0x3076
movl $0x43, %edx
callq 0x1040
leaq 0x1d1d(%rip), %rdi      # 0x309c
leaq 0x1cd1(%rip), %rsi      # 0x3057
leaq 0x1ce9(%rip), %rcx      # 0x3076
movl $0x44, %edx
callq 0x1040
leaq 0x1d20(%rip), %rdi      # 0x30be
leaq 0x1cb2(%rip), %rsi      # 0x3057
leaq 0x1cca(%rip), %rcx      # 0x3076
movl $0x45, %edx
callq 0x1040
leaq 0x1d19(%rip), %rdi      # 0x30d6
leaq 0x1c93(%rip), %rsi      # 0x3057
leaq 0x1cab(%rip), %rcx      # 0x3076
movl $0x46, %edx
callq 0x1040
leaq 0x1d12(%rip), %rdi      # 0x30ee
leaq 0x1c74(%rip), %rsi      # 0x3057
leaq 0x1c8c(%rip), %rcx      # 0x3076
movl $0x47, %edx
callq 0x1040
// File: /workspace/github_c_makefile_star2_O3/vidarr[P]ringbuffer/test/caching_ringbuffer_test.c
// Function: test_caching_ringbuffer_release
void test_caching_ringbuffer_release() {

    int a = 0;

    assert(! caching_ringbuffer_release(0, &a));

    Ringbuffer* buffer = caching_ringbuffer_create(1, 0, 0);
    assert(caching_ringbuffer_release(buffer, &a));
    assert(&a == caching_ringbuffer_get_cached(buffer));
    buffer = buffer->free(buffer);

    fprintf(stdout, "caching ringbuffer_release OK\n");

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl $0x0, 0xc(%rsp)
movl $0x1, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x119c
testq %rax, %rax
je 0x16c7
movq %rax, %rbx
movq 0x28(%rax), %r15
leaq 0xc(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq *0x8(%r15)
testb %al, %al
je 0x16c7
movq %r15, %rdi
callq *0x10(%r15)
cmpq %rax, %r14
jne 0x16e6
movq %rbx, %rdi
callq *0x18(%rbx)
movq 0x3934(%rip), %rax      # 0x4fd8
movq (%rax), %rcx
leaq 0x1be5(%rip), %rdi      # 0x3293
movl $0x1e, %esi
movl $0x1, %edx
callq 0x1070
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1b72(%rip), %rdi      # 0x3240
leaq 0x1982(%rip), %rsi      # 0x3057
leaq 0x1b3d(%rip), %rcx      # 0x3219
movl $0x75, %edx
callq 0x1040
leaq 0x1b7a(%rip), %rdi      # 0x3267
leaq 0x1963(%rip), %rsi      # 0x3057
leaq 0x1b1e(%rip), %rcx      # 0x3219
movl $0x76, %edx
callq 0x1040
// File: /workspace/github_c_makefile_star2_O3/vidarr[P]ringbuffer/test/caching_ringbuffer_test.c
// Function: main
int main(int argc, char** argv) {

    /* The interface tests */
    size_t free_count = 0;

    create = caching_ringbuffer_create;

    Ringbuffer* cache = ringbuffer_create(31, count_free, &free_count);
    free_item = cache_free;
    free_item_additional_arg = cache;

    test_ringbuffer_create();
    test_capacity();
    test_add();
    test_pop();
    cache->free(cache);
    cache = 0;

    /* Caching tests */
    test_caching_ringbuffer_create();
    test_caching_ringbuffer_get_cached();
    test_caching_ringbuffer_release();
    test_caching_free();

}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0x8(%rsp), %rdx
movq $0x0, (%rdx)
leaq -0x727(%rip), %rax      # 0x119c
leaq 0x3786(%rip), %rcx      # 0x5050
movq %rax, (%rcx)
leaq -0x32(%rip), %rsi       # 0x18a2
movl $0x1f, %edi
callq 0x25ac
movq %rax, %rbx
leaq -0x6c1(%rip), %rax      # 0x1227
leaq 0x3771(%rip), %rcx      # 0x5060
movq %rax, (%rcx)
leaq 0x376f(%rip), %rax      # 0x5068
movq %rbx, (%rax)
xorl %eax, %eax
callq 0x193c
xorl %eax, %eax
callq 0x19c5
xorl %eax, %eax
callq 0x1a5f
xorl %eax, %eax
callq 0x1cd0
movq %rbx, %rdi
callq *0x18(%rbx)
callq 0x12dd
callq 0x13f4
callq 0x164d
callq 0x1705
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/vidarr[P]ringbuffer/test/test_helper.c
// Function: test_ringbuffer_create
void test_ringbuffer_create() {

    Ringbuffer* buffer = 0;

    assert(0 == ringbuffer_create(0, 0, 0));

    buffer = ringbuffer_create(1, 0, 0);
    assert(buffer);

    buffer = buffer->free(buffer);

    fprintf(stdout, "ringbuffer_create OK\n");

}

// Assembly:
pushq %rax
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x25ac
testq %rax, %rax
jne 0x1987
movl $0x1, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x25ac
testq %rax, %rax
je 0x19a6
movq %rax, %rdi
callq *0x18(%rax)
movq 0x366b(%rip), %rax      # 0x4fd8
movq (%rax), %rcx
leaq 0x1799(%rip), %rdi      # 0x3110
movl $0x15, %esi
movl $0x1, %edx
popq %rax
jmp 0x1070
leaq 0x19ab(%rip), %rdi      # 0x3339
leaq 0x19c4(%rip), %rsi      # 0x3359
leaq 0x19d0(%rip), %rcx      # 0x336c
movl $0x36, %edx
callq 0x1040
leaq 0x16a3(%rip), %rdi      # 0x3050
leaq 0x19a5(%rip), %rsi      # 0x3359
leaq 0x19b1(%rip), %rcx      # 0x336c
movl $0x39, %edx
callq 0x1040
// File: /workspace/github_c_makefile_star2_O3/vidarr[P]ringbuffer/test/test_helper.c
// Function: test_capacity
void test_capacity() {

    Ringbuffer* b = create(1, free_item, free_item_additional_arg);
    assert(1 == b->capacity(b));
    b = b->free(b);

    b = create(124, free_item, free_item_additional_arg);
    assert(124 == b->capacity(b));
    b = b->free(b);
}

// Assembly:
pushq %rbx
movq 0x3693(%rip), %rsi      # 0x5060
movq 0x3694(%rip), %rdx      # 0x5068
movl $0x1, %edi
callq *0x3671(%rip)           # 0x5050
movq %rax, %rbx
movq %rax, %rdi
callq *(%rax)
cmpq $0x1, %rax
jne 0x1a21
movq %rbx, %rdi
callq *0x18(%rbx)
movq 0x3666(%rip), %rsi      # 0x5060
movq 0x3667(%rip), %rdx      # 0x5068
movl $0x7c, %edi
callq *0x3644(%rip)           # 0x5050
movq %rax, %rdi
movq %rax, %rbx
callq *(%rax)
cmpq $0x7c, %rax
jne 0x1a40
movq %rbx, %rdi
popq %rbx
jmpq *0x18(%rdi)
leaq 0x1962(%rip), %rdi      # 0x338a
leaq 0x192a(%rip), %rsi      # 0x3359
leaq 0x1968(%rip), %rcx      # 0x339e
movl $0x46, %edx
callq 0x1040
leaq 0x196c(%rip), %rdi      # 0x33b3
leaq 0x190b(%rip), %rsi      # 0x3359
leaq 0x1949(%rip), %rcx      # 0x339e
movl $0x4a, %edx
callq 0x1040
// File: /workspace/github_c_makefile_star2_O3/vidarr[P]ringbuffer/src/ringbuffer.c
// Function: ringbuffer_create
Ringbuffer* ringbuffer_create(
        size_t capacity,
        void (*free_item)(void* item, void* additional_arg),
        void* free_item_additional_arg) {

    if(0 >= capacity) {
        goto error;
    }

    Entry* list_start = calloc(1, sizeof(Entry));
    Entry* next = list_start;

    for(size_t i = 1; i < capacity; ++i) {

        next->next = calloc(1, sizeof(Entry));
        next = next->next;

    }

    next->next = list_start;

    InternalRingbuffer* buffer = calloc(1, sizeof(InternalRingbuffer));

    *buffer = (InternalRingbuffer) {
        .next_entry_to_write = list_start,
        .next_entry_to_read = list_start,
        .max_num_items = capacity,
        .free_item = free_item,
        .free_item_additional_arg = free_item_additional_arg,
    };

    buffer->public = (Ringbuffer) {
        .capacity = capacity_func,
        .add = add_func,
        .pop = pop_func,
        .free = free_func,
    };


    return (Ringbuffer*)buffer;

error:

    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x2664
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x10, %esi
callq 0x1050
movq %rax, %r12
cmpq $0x1, %r15
je 0x2603
leaq -0x1(%r15), %r13
movq %r12, %rbp
movl $0x1, %edi
movl $0x10, %esi
callq 0x1050
movq %rax, 0x8(%rbp)
movq %rax, %rbp
decq %r13
jne 0x25e8
movq %r12, 0x8(%rax)
movl $0x1, %edi
movl $0x48, %esi
callq 0x1050
movq %r12, 0x20(%rax)
movq %r12, 0x28(%rax)
movq %r15, 0x30(%rax)
movq %r14, 0x38(%rax)
movq %rbx, 0x40(%rax)
leaq 0x36(%rip), %rcx        # 0x2667
movq %rcx, (%rax)
leaq 0x39(%rip), %rcx        # 0x2674
movq %rcx, 0x8(%rax)
leaq 0x87(%rip), %rcx        # 0x26cd
movq %rcx, 0x10(%rax)
leaq 0xa0(%rip), %rcx        # 0x26f1
movq %rcx, 0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/vidarr[P]ringbuffer/src/ringbuffer.c
// Function: add_func
static bool add_func(Ringbuffer* self, void* item) {

    if(0 == self) goto error;

    InternalRingbuffer* internal = (InternalRingbuffer*) self;

    Entry* read = internal->next_entry_to_read;
    Entry* write = internal->next_entry_to_write;

    if((read == write) && (0 != read->next->item)) {
        internal->next_entry_to_read = read->next;
    }

    if((0 != write->item) && (0 != internal->free_item)) {
        internal->free_item(
                write->item,
                internal->free_item_additional_arg);
    }

    write->item = item;
    internal->next_entry_to_write = write->next;

    return true;

error:

    return false;

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rdi, %rdi
je 0x26c1
movq %rsi, %r14
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %r15
cmpq %r15, %rax
jne 0x269f
movq 0x8(%rax), %rax
cmpq $0x0, (%rax)
je 0x269f
movq %rax, 0x20(%rbx)
movq (%r15), %rdi
testq %rdi, %rdi
je 0x26b6
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x26b6
movq 0x40(%rbx), %rsi
callq *%rax
movq %r14, (%r15)
movq 0x8(%r15), %rax
movq %rax, 0x28(%rbx)
testq %rbx, %rbx
setne %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/vidarr[P]ringbuffer/src/ringbuffer.c
// Function: free_func
static Ringbuffer* free_func(Ringbuffer* self) {

    if(0 == self) goto error;

    InternalRingbuffer* internal = (InternalRingbuffer*) self;

    Entry* current = internal->next_entry_to_write;
    Entry* start = current;

    do {

        Entry* next = current->next;

        if((0 != current->item) && (internal->free_item)) {

            internal->free_item(
                    current->item,
                    internal->free_item_additional_arg);

        }

        free(current);
        current = next;

    } while(current != start);

    free(self);
    self = 0;

error:

    return self;

}

// Assembly:
testq %rdi, %rdi
je 0x2748
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x28(%rdi), %r15
movq %r15, %r12
movq %r12, %r14
movq (%r12), %rdi
movq 0x8(%r12), %r12
testq %rdi, %rdi
je 0x2728
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x2728
movq 0x40(%rbx), %rsi
callq *%rax
movq %r14, %rdi
callq 0x1030
cmpq %r15, %r12
jne 0x2708
movq %rbx, %rdi
callq 0x1030
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_create_with_filename
plm_t *plm_create_with_filename(const char *filename) {
	plm_buffer_t *buffer = plm_buffer_create_with_filename(filename);
	if (!buffer) {
		return NULL;
	}
	return plm_create_with_buffer(buffer, TRUE);
}

// Assembly:
pushq %rax
callq 0x23c9
testq %rax, %rax
je 0x23c5
movq %rax, %rdi
movl $0x1, %esi
popq %rax
jmp 0x23ed
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_create_with_filename
plm_buffer_t *plm_buffer_create_with_filename(const char *filename) {
	FILE *fh = fopen(filename, "rb");
	if (!fh) {
		return NULL;
	}
	return plm_buffer_create_with_file(fh, TRUE);
}

// Assembly:
pushq %rax
leaq 0x8307(%rip), %rsi      # 0xa6d8
callq 0x21b0
testq %rax, %rax
je 0x23e9
movq %rax, %rdi
movl $0x1, %esi
popq %rax
jmp 0x2479
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_create_with_buffer
plm_t *plm_create_with_buffer(plm_buffer_t *buffer, int destroy_when_done) {
	plm_t *self = (plm_t *)PLM_MALLOC(sizeof(plm_t));
	memset(self, 0, sizeof(plm_t));

	self->demux = plm_demux_create(buffer, destroy_when_done);
	self->video_enabled = TRUE;
	self->audio_enabled = TRUE;
	plm_init_decoders(self);

	return self;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl $0x1, %edi
movl $0x80, %esi
callq 0x2110
movq %rax, %r15
movl $0x1, %edi
movl $0x90, %esi
callq 0x2110
movq %rax, %r12
movq %r14, (%rax)
movl %ebx, 0x8(%rax)
movaps 0x6be5(%rip), %xmm0     # 0x9010
movups %xmm0, 0x28(%rax)
movl $0xffffffff, 0x38(%rax) # imm = 0xFFFFFFFF
movq %rax, %rdi
callq 0x27a8
movq %r12, (%r15)
movl $0x1, %eax
movl %eax, 0x1c(%r15)
movl %eax, 0x38(%r15)
movq %r15, %rdi
callq 0x25e1
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_create_with_file
plm_buffer_t *plm_buffer_create_with_file(FILE *fh, int close_when_done) {
	plm_buffer_t *self = plm_buffer_create_with_capacity(PLM_BUFFER_DEFAULT_SIZE);
	self->fh = fh;
	self->close_when_done = close_when_done;
	self->mode = PLM_BUFFER_MODE_FILE;
	self->discard_read_bytes = TRUE;
	
	fseek(self->fh, 0, SEEK_END);
	self->total_size = ftell(self->fh);
	fseek(self->fh, 0, SEEK_SET);

	self->load_callback = plm_buffer_load_file_callback;
	self->seek_callback = plm_buffer_seek_file_callback;
	self->tell_callback = plm_buffer_tell_file_callback;
	return self;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
movl $0x1, %edi
movl $0x68, %esi
callq 0x2110
movq %rax, %rbx
movq $0x20000, 0x8(%rax)     # imm = 0x20000
movl $0x1, %r15d
movl %r15d, 0x28(%rax)
movl $0x20000, %edi          # imm = 0x20000
callq 0x2210
movq %rax, 0x58(%rbx)
movq %r14, 0x30(%rbx)
movl %ebp, 0x2c(%rbx)
movl %r15d, 0x20(%rbx)
movq %r14, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x2190
movq %r14, %rdi
callq 0x2030
movq %rax, 0x18(%rbx)
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2190
leaq 0x1a7a(%rip), %rax      # 0x3f6a
movq %rax, 0x38(%rbx)
leaq 0x1ab0(%rip), %rax      # 0x3fab
movq %rax, 0x40(%rbx)
leaq 0x1ab0(%rip), %rax      # 0x3fb6
movq %rax, 0x48(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_create_with_memory
plm_buffer_t *plm_buffer_create_with_memory(uint8_t *bytes, size_t length, int free_when_done) {
	plm_buffer_t *self = (plm_buffer_t *)PLM_MALLOC(sizeof(plm_buffer_t));
	memset(self, 0, sizeof(plm_buffer_t));
	self->capacity = length;
	self->length = length;
	self->total_size = length;
	self->free_when_done = free_when_done;
	self->bytes = bytes;
	self->mode = PLM_BUFFER_MODE_FIXED_MEM;
	self->discard_read_bytes = FALSE;
	return self;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x68, %esi
callq 0x2110
movq %r14, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %r14, 0x18(%rax)
movl %ebx, 0x28(%rax)
movq %r15, 0x58(%rax)
movl $0x1, 0x60(%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_create
plm_demux_t *plm_demux_create(plm_buffer_t *buffer, int destroy_when_done) {
	plm_demux_t *self = (plm_demux_t *)PLM_MALLOC(sizeof(plm_demux_t));
	memset(self, 0, sizeof(plm_demux_t));

	self->buffer = buffer;
	self->destroy_buffer_when_done = destroy_when_done;

	self->start_time = PLM_PACKET_INVALID_TS;
	self->duration = PLM_PACKET_INVALID_TS;
	self->start_code = -1;

	plm_demux_has_headers(self);
	return self;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movl $0x1, %edi
movl $0x90, %esi
callq 0x2110
movq %rax, %r15
movq %r14, (%rax)
movl %ebx, 0x8(%rax)
movaps 0x6a4b(%rip), %xmm0     # 0x9010
movups %xmm0, 0x28(%rax)
movl $0xffffffff, 0x38(%rax) # imm = 0xFFFFFFFF
movq %rax, %rdi
callq 0x27a8
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_create_with_capacity
plm_buffer_t *plm_buffer_create_with_capacity(size_t capacity) {
	plm_buffer_t *self = (plm_buffer_t *)PLM_MALLOC(sizeof(plm_buffer_t));
	memset(self, 0, sizeof(plm_buffer_t));
	self->capacity = capacity;
	self->free_when_done = TRUE;
	self->bytes = (uint8_t *)PLM_MALLOC(capacity);
	self->mode = PLM_BUFFER_MODE_RING;
	self->discard_read_bytes = TRUE;
	return self;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x1, %edi
movl $0x68, %esi
callq 0x2110
movq %rax, %r14
movq %rbx, 0x8(%rax)
movl $0x1, %ebp
movl %ebp, 0x28(%rax)
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x58(%r14)
movl $0x2, 0x60(%r14)
movl %ebp, 0x20(%r14)
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_video_create_with_buffer
plm_video_t * plm_video_create_with_buffer(plm_buffer_t *buffer, int destroy_when_done) {
	plm_video_t *self = (plm_video_t *)PLM_MALLOC(sizeof(plm_video_t));
	memset(self, 0, sizeof(plm_video_t));
	
	self->buffer = buffer;
	self->destroy_buffer_when_done = destroy_when_done;

	// Attempt to decode the sequence header
	self->start_code = plm_buffer_find_start_code(self->buffer, PLM_START_SEQUENCE);
	if (self->start_code != -1) {
		plm_video_decode_sequence_header(self);
	}
	return self;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
movl $0x1, %edi
movl $0x300, %esi            # imm = 0x300
callq 0x2110
movq %rax, %rbx
movq %r14, 0xa0(%rax)
movl %ebp, 0xa8(%rax)
movq %r14, %rdi
callq 0x4320
cmpl $0xb3, %eax
je 0x2a03
cmpl $-0x1, %eax
jne 0x29ef
movl %eax, 0x40(%rbx)
cmpl $-0x1, %eax
je 0x2a13
movq %rbx, %rdi
callq 0x46ec
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_audio_create_with_buffer
plm_audio_t *plm_audio_create_with_buffer(plm_buffer_t *buffer, int destroy_when_done) {
	plm_audio_t *self = (plm_audio_t *)PLM_MALLOC(sizeof(plm_audio_t));
	memset(self, 0, sizeof(plm_audio_t));

	self->samples.count = PLM_AUDIO_SAMPLES_PER_FRAME;
	self->buffer = buffer;
	self->destroy_buffer_when_done = destroy_when_done;
	self->samplerate_index = 3; // Indicates 0

	memcpy(self->D, PLM_AUDIO_SYNTHESIS_WINDOW, 512 * sizeof(float));
	memcpy(self->D + 512, PLM_AUDIO_SYNTHESIS_WINDOW, 512 * sizeof(float));

	// Attempt to decode first header
	self->next_frame_data_size = plm_audio_decode_header(self);

	return self;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
movl $0x1, %edi
movl $0x5d10, %esi           # imm = 0x5D10
callq 0x2110
movq %rax, %rbx
movl $0x480, 0x888(%rax)     # imm = 0x480
movq %r14, 0x30(%rax)
movl %ebp, 0x38(%rax)
movl $0x3, 0xc(%rax)
leaq 0x2c90(%rax), %rdi
leaq 0x7173(%rip), %r14      # 0x9bf0
movl $0x800, %edx            # imm = 0x800
movq %r14, %rsi
callq 0x2140
leaq 0x3490(%rbx), %rdi
movl $0x800, %edx            # imm = 0x800
movq %r14, %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x708b
movl %eax, 0x28(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_destroy
void plm_destroy(plm_t *self) {
	if (self->video_decoder) {
		plm_video_destroy(self->video_decoder);
	}
	if (self->audio_decoder) {
		plm_audio_destroy(self->audio_decoder);
	}

	plm_demux_destroy(self->demux);
	PLM_FREE(self);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
testq %rdi, %rdi
je 0x2ac3
callq 0x2ae2
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x2ad1
callq 0x2b16
movq (%rbx), %rdi
callq 0x2b32
movq %rbx, %rdi
popq %rbx
jmp 0x21c0
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_video_destroy
void plm_video_destroy(plm_video_t *self) {
	if (self->destroy_buffer_when_done) {
		plm_buffer_destroy(self->buffer);
	}

	if (self->has_sequence_header) {
		PLM_FREE(self->frames_data);
	}

	PLM_FREE(self);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0xa8(%rdi)
je 0x2afb
movq 0xa0(%rbx), %rdi
callq 0x407a
cmpl $0x0, 0x70(%rbx)
je 0x2b0d
movq 0x170(%rbx), %rdi
callq 0x21c0
movq %rbx, %rdi
popq %rbx
jmp 0x21c0
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_has_headers
int plm_has_headers(plm_t *self) {
	if (!plm_demux_has_headers(self->demux)) {
		return FALSE;
	}
	
	if (!plm_init_decoders(self)) {
		return FALSE;
	}

	if (
		(self->video_decoder && !plm_video_has_header(self->video_decoder)) ||
		(self->audio_decoder && !plm_audio_has_header(self->audio_decoder))
	) {
		return FALSE;
	}

	return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x27a8
xorl %ebx, %ebx
testl %eax, %eax
je 0x2bac
movq %r14, %rdi
callq 0x25e1
testl %eax, %eax
je 0x2bac
movq 0x30(%r14), %rdi
testq %rdi, %rdi
je 0x2b84
callq 0x2bb6
testl %eax, %eax
je 0x2bac
movq 0x58(%r14), %r14
testq %r14, %r14
je 0x2ba7
cmpl $0x0, 0x2c(%r14)
jne 0x2ba7
movq %r14, %rdi
callq 0x708b
movl %eax, 0x28(%r14)
cmpl $0x0, 0x2c(%r14)
je 0x2bac
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_video_has_header
int plm_video_has_header(plm_video_t *self) {
	if (self->has_sequence_header) {
		return TRUE;
	}

	if (self->start_code != PLM_START_SEQUENCE) {
		self->start_code = plm_buffer_find_start_code(self->buffer, PLM_START_SEQUENCE);
	}
	if (self->start_code == -1) {
		return FALSE;
	}
	
	if (!plm_video_decode_sequence_header(self)) {
		return FALSE;
	}

	return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x1, %eax
cmpl $0x0, 0x70(%rdi)
je 0x2bcd
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rdi, %rbx
cmpl $0xb3, 0x40(%rdi)
je 0x2bfc
movq 0xa0(%rbx), %r14
movq %r14, %rdi
callq 0x4320
cmpl $0xb3, %eax
je 0x2bf4
cmpl $-0x1, %eax
jne 0x2be0
movl %eax, 0x40(%rbx)
cmpl $-0x1, %eax
je 0x2c0b
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x46ec
xorl %eax, %eax
jmp 0x2bc5
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_audio_has_header
int plm_audio_has_header(plm_audio_t *self) {
	if (self->has_header) {
		return TRUE;
	}
	
	self->next_frame_data_size = plm_audio_decode_header(self);
	return self->has_header;
}

// Assembly:
movl $0x1, %eax
cmpl $0x0, 0x2c(%rdi)
je 0x2c1b
retq
pushq %rbx
movq %rdi, %rbx
callq 0x708b
movl %eax, 0x28(%rbx)
movl 0x2c(%rbx), %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_probe
int plm_probe(plm_t *self, size_t probesize) {
	int found_streams = plm_demux_probe(self->demux, probesize);
	if (!found_streams) {
		return FALSE;
	}

	// Re-init decoders
	self->has_decoders = FALSE;
	self->video_packet_type = 0;
	self->audio_packet_type = 0;
	return plm_init_decoders(self);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x2c54
testl %eax, %eax
je 0x2c50
xorl %eax, %eax
movl %eax, 0x18(%rbx)
movl %eax, 0x20(%rbx)
movl %eax, 0x40(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x25e1
xorl %eax, %eax
popq %rbx
retq