LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/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 0x7e64
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x4, %ecx
jne 0x7e5b
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_O1/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 $0x32, %r12d
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2090
movq %rax, %r15
testl %r15d, %r15d
jns 0x7ebf
callq 0x2060
movl (%rax), %edi
leal -0x5(%rdi), %eax
cmpl $0x2, %eax
jb 0x7ea3
cmpl $0x79, %edi
jne 0x7eb5
movl $0x7d0, %edi            # imm = 0x7D0
callq 0x22b0
subl $0x1, %r12d
jae 0x7e7a
jmp 0x7ebf
callq 0x2e9f
xorl %r12d, %r12d
jmp 0x7ead
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2560
movq %rax, 0x28(%r12)
leaq 0x4e(%rip), %rsi        # 0x1227
movq %r15, %rdi
movq %rax, %rdx
callq 0x2560
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_O1/vidarr[P]ringbuffer/test/../src/caching_ringbuffer.c
// Function: cache_free
static void cache_free(void* item, void* cache) {

    if(0 == cache) goto finish;
    if(0 == item) goto finish;

    Ringbuffer* ringbuffer_cache = cache;

    if(! ringbuffer_cache->add(ringbuffer_cache, item)) {

        fprintf(stderr, "Could not enqueue item into cache");

    }

finish:

    do{}while(0);

}

// Assembly:
movq %rsi, %rax
testq %rsi, %rsi
sete %cl
testq %rdi, %rdi
sete %dl
orb %cl, %dl
jne 0x124c
pushq %rax
movq %rdi, %rsi
movq %rax, %rdi
callq *0x8(%rax)
testb %al, %al
je 0x124d
addq $0x8, %rsp
retq
callq 0x1090
jmp 0x1248
// File: /workspace/github_c_makefile_star2_O1/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 0x135d
leaq -0xa8(%rip), %rcx       # 0x1254
cmpq %rcx, (%rax)
jne 0x137c
leaq -0xa6(%rip), %rcx       # 0x1262
cmpq %rcx, 0x8(%rax)
jne 0x139b
leaq -0xa0(%rip), %rcx       # 0x1279
cmpq %rcx, 0x10(%rax)
jne 0x13ba
leaq -0x9d(%rip), %rcx       # 0x128d
cmpq %rcx, 0x18(%rax)
jne 0x13d9
movq %rax, %rdi
callq 0x128d
movq 0x3c95(%rip), %rax      # 0x4fd8
movq (%rax), %rcx
leaq 0x1d6f(%rip), %rdi      # 0x30bc
movl $0x1d, %esi
movl $0x1, %edx
popq %rax
jmp 0x1070
leaq 0x1ca0(%rip), %rdi      # 0x3004
leaq 0x1ca0(%rip), %rsi      # 0x300b
leaq 0x1cb8(%rip), %rcx      # 0x302a
movl $0x43, %edx
callq 0x1040
leaq 0x1ccd(%rip), %rdi      # 0x3050
leaq 0x1c81(%rip), %rsi      # 0x300b
leaq 0x1c99(%rip), %rcx      # 0x302a
movl $0x44, %edx
callq 0x1040
leaq 0x1cd0(%rip), %rdi      # 0x3072
leaq 0x1c62(%rip), %rsi      # 0x300b
leaq 0x1c7a(%rip), %rcx      # 0x302a
movl $0x45, %edx
callq 0x1040
leaq 0x1cc9(%rip), %rdi      # 0x308a
leaq 0x1c43(%rip), %rsi      # 0x300b
leaq 0x1c5b(%rip), %rcx      # 0x302a
movl $0x46, %edx
callq 0x1040
leaq 0x1cc2(%rip), %rdi      # 0x30a2
leaq 0x1c24(%rip), %rsi      # 0x300b
leaq 0x1c3c(%rip), %rcx      # 0x302a
movl $0x47, %edx
callq 0x1040
// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
pushq %rax
movl $0x0, 0x4(%rsp)
movl $0x1, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x119c
testq %rax, %rax
je 0x16db
movq %rax, %rbx
movq 0x28(%rax), %rdi
leaq 0x4(%rsp), %r14
movq %r14, %rsi
callq *0x8(%rdi)
testb %al, %al
je 0x16db
testq %rbx, %rbx
je 0x16a6
movq 0x28(%rbx), %rdi
callq *0x10(%rdi)
jmp 0x16a8
xorl %eax, %eax
cmpq %rax, %r14
jne 0x16fa
movq %rbx, %rdi
callq *0x18(%rbx)
movq 0x391e(%rip), %rax      # 0x4fd8
movq (%rax), %rcx
leaq 0x1b83(%rip), %rdi      # 0x3247
movl $0x1e, %esi
movl $0x1, %edx
callq 0x1070
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1b12(%rip), %rdi      # 0x31f4
leaq 0x1922(%rip), %rsi      # 0x300b
leaq 0x1add(%rip), %rcx      # 0x31cd
movl $0x75, %edx
callq 0x1040
leaq 0x1b1a(%rip), %rdi      # 0x321b
leaq 0x1903(%rip), %rsi      # 0x300b
leaq 0x1abe(%rip), %rcx      # 0x31cd
movl $0x76, %edx
callq 0x1040
// File: /workspace/github_c_makefile_star2_O1/vidarr[P]ringbuffer/test/caching_ringbuffer_test.c
// Function: test_caching_free
void test_caching_free() {

    const size_t NUM_ELEMENTS = 114;
    size_t frees_count = 0;

    int test_data[NUM_ELEMENTS];

    for(size_t i = 0; i < NUM_ELEMENTS; ++i) {

        test_data[i] = i;

    }

    Ringbuffer* buffer =
        caching_ringbuffer_create(NUM_ELEMENTS / 2, count_free, &frees_count);

    size_t i = 0;

    while(10 > frees_count) {
        /* just some abritrary data that has been allocated dynamically */
        ++i;
        /* We want to create really new data buffers, thus cache == 0 ... */
        buffer->add(buffer, test_data + i);
    };

    const size_t initial_count = frees_count;

    /* Shift some elements out of cache into ringbuffer */
    for(i = 0; i < 3 * buffer->capacity(buffer); ++i) {
        void* item = caching_ringbuffer_get_cached(buffer);
        assert(item);
        buffer->add(buffer, item);
    }

    assert(initial_count == frees_count);
    assert(0 == buffer->free(buffer));

    fprintf(stdout, "free() OK: %zu\n", frees_count);

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rsp, %r15
movq $0x0, 0x8(%rsp)
xorl %eax, %eax
movl %eax, 0x10(%rsp,%rax,4)
incq %rax
cmpq $0x72, %rax
jne 0x1735
leaq 0x10c(%rip), %rsi       # 0x1855
leaq 0x8(%rsp), %r14
movl $0x39, %edi
movq %r14, %rdx
callq 0x119c
movq %rax, %rbx
movq (%r14), %r12
cmpq $0x9, %r12
ja 0x1784
leaq 0x14(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
movq 0x8(%rsp), %r12
addq $0x4, %r14
cmpq $0xa, %r12
jb 0x176c
movq %rbx, %rdi
callq *(%rbx)
testq %rax, %rax
je 0x17b7
xorl %r14d, %r14d
movq 0x28(%rbx), %rdi
callq *0x10(%rdi)
testq %rax, %rax
je 0x17f8
movq %rbx, %rdi
movq %rax, %rsi
callq *0x8(%rbx)
incq %r14
movq %rbx, %rdi
callq *(%rbx)
leaq (%rax,%rax,2), %rax
cmpq %rax, %r14
jb 0x1791
cmpq 0x8(%rsp), %r12
jne 0x1817
movq %rbx, %rdi
callq *0x18(%rbx)
testq %rax, %rax
jne 0x1836
movq 0x3808(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
movq 0x8(%rsp), %rdx
leaq 0x1adc(%rip), %rsi      # 0x32bb
xorl %eax, %eax
callq 0x1060
movq %r15, %rsp
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1a67(%rip), %rdi      # 0x3266
leaq 0x1805(%rip), %rsi      # 0x300b
leaq 0x1a5e(%rip), %rcx      # 0x326b
movl $0x9c, %edx
callq 0x1040
leaq 0x1a66(%rip), %rdi      # 0x3284
leaq 0x17e6(%rip), %rsi      # 0x300b
leaq 0x1a3f(%rip), %rcx      # 0x326b
movl $0xa0, %edx
callq 0x1040
leaq 0x1a64(%rip), %rdi      # 0x32a1
leaq 0x17c7(%rip), %rsi      # 0x300b
leaq 0x1a20(%rip), %rcx      # 0x326b
movl $0xa1, %edx
callq 0x1040
// File: /workspace/github_c_makefile_star2_O1/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 -0x6da(%rip), %rax      # 0x119c
leaq 0x37d3(%rip), %rcx      # 0x5050
movq %rax, (%rcx)
leaq -0x32(%rip), %rsi       # 0x1855
movl $0x1f, %edi
callq 0x2560
movq %rax, %rbx
leaq -0x674(%rip), %rax      # 0x1227
leaq 0x37be(%rip), %rcx      # 0x5060
movq %rax, (%rcx)
leaq 0x37bc(%rip), %rax      # 0x5068
movq %rbx, (%rax)
xorl %eax, %eax
callq 0x18f0
xorl %eax, %eax
callq 0x1979
xorl %eax, %eax
callq 0x1a13
xorl %eax, %eax
callq 0x1c84
movq %rbx, %rdi
callq *0x18(%rbx)
callq 0x12e1
callq 0x13f8
callq 0x1663
callq 0x1719
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/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 0x2560
testq %rax, %rax
jne 0x193b
movl $0x1, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2560
testq %rax, %rax
je 0x195a
movq %rax, %rdi
callq *0x18(%rax)
movq 0x36b7(%rip), %rax      # 0x4fd8
movq (%rax), %rcx
leaq 0x1799(%rip), %rdi      # 0x30c4
movl $0x15, %esi
movl $0x1, %edx
popq %rax
jmp 0x1070
leaq 0x19ab(%rip), %rdi      # 0x32ed
leaq 0x19c4(%rip), %rsi      # 0x330d
leaq 0x19d0(%rip), %rcx      # 0x3320
movl $0x36, %edx
callq 0x1040
leaq 0x16a3(%rip), %rdi      # 0x3004
leaq 0x19a5(%rip), %rsi      # 0x330d
leaq 0x19b1(%rip), %rcx      # 0x3320
movl $0x39, %edx
callq 0x1040
// File: /workspace/github_c_makefile_star2_O1/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 0x36df(%rip), %rsi      # 0x5060
movq 0x36e0(%rip), %rdx      # 0x5068
movl $0x1, %edi
callq *0x36bd(%rip)           # 0x5050
movq %rax, %rbx
movq %rax, %rdi
callq *(%rax)
cmpq $0x1, %rax
jne 0x19d5
movq %rbx, %rdi
callq *0x18(%rbx)
movq 0x36b2(%rip), %rsi      # 0x5060
movq 0x36b3(%rip), %rdx      # 0x5068
movl $0x7c, %edi
callq *0x3690(%rip)           # 0x5050
movq %rax, %rdi
movq %rax, %rbx
callq *(%rax)
cmpq $0x7c, %rax
jne 0x19f4
movq %rbx, %rdi
popq %rbx
jmpq *0x18(%rdi)
leaq 0x1962(%rip), %rdi      # 0x333e
leaq 0x192a(%rip), %rsi      # 0x330d
leaq 0x1968(%rip), %rcx      # 0x3352
movl $0x46, %edx
callq 0x1040
leaq 0x196c(%rip), %rdi      # 0x3367
leaq 0x190b(%rip), %rsi      # 0x330d
leaq 0x1949(%rip), %rcx      # 0x3352
movl $0x4a, %edx
callq 0x1040
// File: /workspace/github_c_makefile_star2_O1/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 0x2622
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 0x25b7
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 0x259c
movq %r12, 0x8(%rax)
movl $0x1, %edi
movl $0x48, %esi
callq 0x1050
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movq %r12, 0x20(%rax)
movq %r12, 0x28(%rax)
movq %r15, 0x30(%rax)
movq %r14, 0x38(%rax)
movq %rbx, 0x40(%rax)
leaq 0x36(%rip), %rcx        # 0x2625
movq %rcx, (%rax)
leaq 0x39(%rip), %rcx        # 0x2632
movq %rcx, 0x8(%rax)
leaq 0x87(%rip), %rcx        # 0x268b
movq %rcx, 0x10(%rax)
leaq 0xa0(%rip), %rcx        # 0x26af
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_O1/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 0x267f
movq %rsi, %r14
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %r15
cmpq %r15, %rax
jne 0x265d
movq 0x8(%rax), %rax
cmpq $0x0, (%rax)
je 0x265d
movq %rax, 0x20(%rbx)
movq (%r15), %rdi
testq %rdi, %rdi
je 0x2674
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x2674
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_O1/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 0x2706
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 0x26e6
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x26e6
movq 0x40(%rbx), %rsi
callq *%rax
movq %r14, %rdi
callq 0x1030
cmpq %r15, %r12
jne 0x26c6
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_O1/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 0x23b9
testq %rax, %rax
je 0x23b5
movq %rax, %rdi
movl $0x1, %esi
popq %rax
jmp 0x23dd
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x815f(%rip), %rsi      # 0xa520
callq 0x21a0
testq %rax, %rax
je 0x23d9
movq %rax, %rdi
movl $0x1, %esi
popq %rax
jmp 0x2495
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
movl $0x80, %edi
callq 0x2200
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x60(%rax)
movups %xmm0, 0x70(%rax)
movl $0x90, %edi
callq 0x2200
movq %rax, %r15
movl $0x90, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x20e0
movq %r14, (%r15)
movl %ebp, 0x8(%r15)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x28(%r15)
movq %rax, 0x30(%r15)
movl $0xffffffff, 0x38(%r15) # imm = 0xFFFFFFFF
movq %r15, %rdi
callq 0x2894
movq %r15, (%rbx)
movl $0x1, %eax
movl %eax, 0x1c(%rbx)
movl %eax, 0x38(%rbx)
movq %rbx, %rdi
callq 0x267c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %edi
callq 0x2200
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movq $0x0, 0x60(%rax)
movq $0x20000, 0x8(%rax)     # imm = 0x20000
movl $0x1, %r15d
movl %r15d, 0x28(%rax)
movl $0x20000, %edi          # imm = 0x20000
callq 0x2200
movq %rax, 0x58(%rbx)
movl %r15d, 0x20(%rbx)
movq %r14, 0x30(%rbx)
movl %ebp, 0x2c(%rbx)
movl $0x0, 0x60(%rbx)
movq %r14, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x2180
movq %r14, %rdi
callq 0x2030
movq %rax, 0x18(%rbx)
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2180
leaq 0x1bdb(%rip), %rax      # 0x410b
movq %rax, 0x38(%rbx)
leaq 0x1c11(%rip), %rax      # 0x414c
movq %rax, 0x40(%rbx)
leaq 0x1c11(%rip), %rax      # 0x4157
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_O1/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 $0x68, %edi
callq 0x2200
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movq $0x0, 0x60(%rax)
movq %r14, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %r14, 0x18(%rax)
movl %ebx, 0x28(%rax)
movq %r15, 0x58(%rax)
movl $0x1, 0x60(%rax)
movl $0x0, 0x20(%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 $0x90, %edi
callq 0x2200
movq %rax, %r15
movl $0x90, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x20e0
movq %r14, (%r15)
movl %ebx, 0x8(%r15)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x28(%r15)
movq %rax, 0x30(%r15)
movl $0xffffffff, 0x38(%r15) # imm = 0xFFFFFFFF
movq %r15, %rdi
callq 0x2894
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %edi
callq 0x2200
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movq $0x0, 0x60(%rax)
movq %rbx, 0x8(%rax)
movl $0x1, %ebp
movl %ebp, 0x28(%rax)
movq %rbx, %rdi
callq 0x2200
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_O1/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 $0x300, %edi            # imm = 0x300
callq 0x2200
movq %rax, %rbx
movl $0x300, %edx            # imm = 0x300
movq %rax, %rdi
xorl %esi, %esi
callq 0x20e0
movq %r14, 0xa0(%rbx)
movl %ebp, 0xa8(%rbx)
movq %r14, %rdi
callq 0x4500
cmpl $0xb3, %eax
je 0x2b16
cmpl $-0x1, %eax
jne 0x2b02
movl %eax, 0x40(%rbx)
cmpl $-0x1, %eax
je 0x2b26
movq %rbx, %rdi
callq 0x48cc
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 $0x5d10, %edi           # imm = 0x5D10
callq 0x2200
movq %rax, %rbx
movl $0x5d10, %edx           # imm = 0x5D10
movq %rax, %rdi
xorl %esi, %esi
callq 0x20e0
movl $0x480, 0x888(%rbx)     # imm = 0x480
movq %r14, 0x30(%rbx)
movl %ebp, 0x38(%rbx)
movl $0x3, 0xc(%rbx)
leaq 0x2c90(%rbx), %rdi
leaq 0x6e56(%rip), %r14      # 0x99f0
movl $0x800, %edx            # imm = 0x800
movq %r14, %rsi
callq 0x2130
leaq 0x3490(%rbx), %rdi
movl $0x800, %edx            # imm = 0x800
movq %r14, %rsi
callq 0x2130
movq %rbx, %rdi
callq 0x70e8
movl %eax, 0x28(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2be0
callq 0x2bff
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x2bee
callq 0x2c33
movq (%rbx), %rdi
callq 0x2c4f
movq %rbx, %rdi
popq %rbx
jmp 0x21b0
// File: /workspace/github_c_makefile_star2_O1/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 0x2c18
movq 0xa0(%rbx), %rdi
callq 0x4264
cmpl $0x0, 0x70(%rbx)
je 0x2c2a
movq 0x170(%rbx), %rdi
callq 0x21b0
movq %rbx, %rdi
popq %rbx
jmp 0x21b0
// File: /workspace/github_c_makefile_star2_O1/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 0x2894
xorl %ebx, %ebx
testl %eax, %eax
je 0x2cc9
movq %r14, %rdi
callq 0x267c
testl %eax, %eax
je 0x2cc9
movq 0x30(%r14), %rdi
testq %rdi, %rdi
je 0x2ca1
callq 0x2cd3
testl %eax, %eax
je 0x2cc9
movq 0x58(%r14), %r14
testq %r14, %r14
je 0x2cc4
cmpl $0x0, 0x2c(%r14)
jne 0x2cc4
movq %r14, %rdi
callq 0x70e8
movl %eax, 0x28(%r14)
cmpl $0x0, 0x2c(%r14)
je 0x2cc9
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2cea
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rdi, %rbx
cmpl $0xb3, 0x40(%rdi)
je 0x2d14
movq 0xa0(%rbx), %r14
movq %r14, %rdi
callq 0x4500
cmpl $0xb3, %eax
je 0x2d11
cmpl $-0x1, %eax
jne 0x2cfd
movl %eax, 0x40(%rbx)
cmpl $-0x1, 0x40(%rbx)
je 0x2d29
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x48cc
xorl %eax, %eax
jmp 0x2ce2
// File: /workspace/github_c_makefile_star2_O1/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 0x2d39
retq
pushq %rbx
movq %rdi, %rbx
callq 0x70e8
movl %eax, 0x28(%rbx)
movl 0x2c(%rbx), %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2d72
testl %eax, %eax
je 0x2d6e
xorl %eax, %eax
movl %eax, 0x18(%rbx)
movl %eax, 0x20(%rbx)
movl %eax, 0x40(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x267c
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_probe
int plm_demux_probe(plm_demux_t *self, size_t probesize) {
	int previous_pos = plm_buffer_tell(self->buffer);

	int video_stream = FALSE;
	int audio_streams[4] = {FALSE, FALSE, FALSE, FALSE};
	do {
		self->start_code = plm_buffer_next_start_code(self->buffer);
		if (self->start_code == PLM_DEMUX_PACKET_VIDEO_1) {
			video_stream = TRUE;
		}
		else if (
			self->start_code >= PLM_DEMUX_PACKET_AUDIO_1 && 
			self->start_code <= PLM_DEMUX_PACKET_AUDIO_4
		) {
			audio_streams[self->start_code - PLM_DEMUX_PACKET_AUDIO_1] = TRUE;
		}
	} while (
		self->start_code != -1 && 
		plm_buffer_tell(self->buffer) - previous_pos < probesize
	);

	self->num_video_streams = video_stream ? 1 : 0;
	self->num_audio_streams = 0;
	for (int i = 0; i < 4; i++) {
		if (audio_streams[i]) {
			self->num_audio_streams++;
		}
	}

	plm_demux_buffer_seek(self, previous_pos);
	return (self->num_video_streams || self->num_audio_streams);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r15
movq 0x48(%r15), %rax
testq %rax, %rax
je 0x2dab
movq 0x50(%r15), %rsi
movq %r15, %rdi
callq *%rax
movq (%r15), %r12
shrq $0x3, %r12
addq %rax, %r12
subq 0x10(%r15), %r12
jmp 0x2db2
movq (%r15), %r12
shrq $0x3, %r12
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movslq %r12d, %r13
xorl %r15d, %r15d
movq (%rbx), %rdi
callq 0x4500
movl %eax, 0x38(%rbx)
movl $0x1, %ebp
cmpl $0xe0, %eax
je 0x2df3
movl %eax, %ecx
andl $-0x4, %ecx
cmpl $0xc0, %ecx
jne 0x2df0
leal -0xc0(%rax), %ecx
movl $0x1, (%rsp,%rcx,4)
movl %r15d, %ebp
cmpl $-0x1, %eax
je 0x2e2f
movq (%rbx), %r15
movq 0x48(%r15), %rax
testq %rax, %rax
je 0x2e1d
movq 0x50(%r15), %rsi
movq %r15, %rdi
callq *%rax
movq (%r15), %rcx
shrq $0x3, %rcx
addq %rax, %rcx
subq 0x10(%r15), %rcx
jmp 0x2e24
movq (%r15), %rcx
shrq $0x3, %rcx
subq %r13, %rcx
movl %ebp, %r15d
cmpq %r14, %rcx
jb 0x2dbf
xorl %eax, %eax
testl %ebp, %ebp
setne %al
movl %eax, 0x4c(%rbx)
movl $0x0, 0x48(%rbx)
xorl %eax, %eax
cmpl $0x0, (%rsp,%rax,4)
je 0x2e4b
incl 0x48(%rbx)
incq %rax
cmpq $0x4, %rax
jne 0x2e42
movslq %r12d, %rsi
movq (%rbx), %rdi
callq 0x430a
xorl %eax, %eax
movq %rax, 0x60(%rbx)
movq %rax, 0x80(%rbx)
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
movl $0x1, %eax
cmpl $0x0, 0x4c(%rbx)
jne 0x2e87
xorl %eax, %eax
cmpl $0x0, 0x48(%rbx)
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_set_audio_enabled
void plm_set_audio_enabled(plm_t *self, int enabled) {
	self->audio_enabled = enabled;

	if (!enabled) {
		self->audio_packet_type = 0;
		return;
	}

	self->audio_packet_type = (plm_init_decoders(self) && self->audio_decoder)
		? PLM_DEMUX_PACKET_AUDIO_1 + self->audio_stream_index
		: 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, 0x38(%rdi)
xorl %ebp, %ebp
testl %esi, %esi
je 0x2ec0
movq %rbx, %rdi
callq 0x267c
testl %eax, %eax
je 0x2ec0
cmpq $0x0, 0x58(%rbx)
je 0x2ec0
movl $0xc0, %ebp
addl 0x3c(%rbx), %ebp
movl %ebp, 0x40(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_set_video_enabled
void plm_set_video_enabled(plm_t *self, int enabled) {
	self->video_enabled = enabled;

	if (!enabled) {
		self->video_packet_type = 0;
		return;
	}

	self->video_packet_type = (plm_init_decoders(self) && self->video_decoder)
		? PLM_DEMUX_PACKET_VIDEO_1
		: 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, 0x1c(%rdi)
xorl %ebp, %ebp
testl %esi, %esi
je 0x2f09
movq %rbx, %rdi
callq 0x267c
testl %eax, %eax
je 0x2f09
xorl %eax, %eax
cmpq $0x0, 0x30(%rbx)
movl $0xe0, %ebp
cmovel %eax, %ebp
movl %ebp, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_rewind
void plm_rewind(plm_t *self) {
	if (self->video_decoder) {
		plm_video_rewind(self->video_decoder);
	}

	if (self->audio_decoder) {
		plm_audio_rewind(self->audio_decoder);
	}

	plm_demux_rewind(self->demux);
	self->time = 0;
	self->has_ended = FALSE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %r14
testq %r14, %r14
je 0x3297
movq 0xa0(%r14), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x430a
movq $0x0, 0x10(%r14)
movl %r15d, 0x18(%r14)
movl %r15d, 0x2f8(%r14)
movl $0xffffffff, 0x40(%r14) # imm = 0xFFFFFFFF
movq 0x58(%rbx), %r14
testq %r14, %r14
je 0x32bd
movq 0x30(%r14), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x430a
movq $0x0, (%r14)
movl %r15d, 0x8(%r14)
movl %r15d, 0x28(%r14)
movq (%rbx), %r14
movq (%r14), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x430a
movq %r15, 0x60(%r14)
movq %r15, 0x80(%r14)
movl $0xffffffff, 0x38(%r14) # imm = 0xFFFFFFFF
movq %r15, 0x8(%rbx)
movl $0x0, 0x10(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_video_rewind
void plm_video_rewind(plm_video_t *self) {
	plm_buffer_rewind(self->buffer);
	self->time = 0;
	self->frames_decoded = 0;
	self->has_reference_frame = FALSE;
	self->start_code = -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xa0(%rdi), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x430a
movq $0x0, 0x10(%rbx)
movl %r14d, 0x18(%rbx)
movl %r14d, 0x2f8(%rbx)
movl $0xffffffff, 0x40(%rbx) # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_audio_rewind
void plm_audio_rewind(plm_audio_t *self) {
	plm_buffer_rewind(self->buffer);
	self->time = 0;
	self->samples_decoded = 0;
	self->next_frame_data_size = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x430a
movq $0x0, (%rbx)
movl %r14d, 0x8(%rbx)
movl %r14d, 0x28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_rewind
void plm_demux_rewind(plm_demux_t *self) {
	plm_buffer_rewind(self->buffer);
	self->current_packet.length = 0;
	self->next_packet.length = 0;
	self->start_code = -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x430a
movq %r14, 0x60(%rbx)
movq %r14, 0x80(%rbx)
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_audio_decode
plm_samples_t *plm_audio_decode(plm_audio_t *self) {
	// Do we have at least enough information to decode the frame header?
	if (!self->next_frame_data_size) {
		if (!plm_buffer_has(self->buffer, 48)) {
			return NULL;
		}
		self->next_frame_data_size = plm_audio_decode_header(self);
	}

	if (
		self->next_frame_data_size == 0 ||
		!plm_buffer_has(self->buffer, self->next_frame_data_size << 3)
	) {
		return NULL;
	}

	plm_audio_decode_frame(self);
	self->next_frame_data_size = 0;
	
	self->samples.time = self->time;

	self->samples_decoded += PLM_AUDIO_SAMPLES_PER_FRAME;
	self->time = (double)self->samples_decoded / 
		(double)PLM_AUDIO_SAMPLE_RATE[self->samplerate_index];
	
	return &self->samples;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x28(%rdi)
jne 0x36a1
movq 0x30(%rbx), %rdi
movl $0x30, %esi
callq 0x4392
testl %eax, %eax
je 0x370c
movq %rbx, %rdi
callq 0x70e8
movl %eax, 0x28(%rbx)
movl 0x28(%rbx), %eax
testl %eax, %eax
je 0x370c
movq 0x30(%rbx), %rdi
shll $0x3, %eax
movslq %eax, %rsi
callq 0x4392
testl %eax, %eax
je 0x370c
movq %rbx, %rdi
callq 0x72f5
movl $0x0, 0x28(%rbx)
movsd (%rbx), %xmm0
leaq 0x880(%rbx), %rax
movsd %xmm0, 0x880(%rbx)
movl $0x480, %ecx            # imm = 0x480
addl 0x8(%rbx), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movl %ecx, 0x8(%rbx)
movslq 0xc(%rbx), %rcx
leaq 0x5966(%rip), %rdx      # 0x9060
movzwl (%rdx,%rcx,2), %ecx
cvtsi2sd %ecx, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, (%rbx)
jmp 0x370e
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_decode_video
plm_frame_t *plm_decode_video(plm_t *self) {
	if (!plm_init_decoders(self)) {
		return NULL;
	}

	if (!self->video_packet_type) {
		return NULL;
	}

	plm_frame_t *frame = plm_video_decode(self->video_decoder);
	if (frame) {
		self->time = frame->time;
	}
	else if (plm_demux_has_ended(self->demux)) {
		plm_handle_end(self);
	}
	return frame;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x267c
testl %eax, %eax
je 0x375d
cmpl $0x0, 0x20(%r14)
je 0x375d
movq 0x30(%r14), %rdi
callq 0x3508
movq %rax, %rbx
testq %rax, %rax
je 0x376a
movsd (%rbx), %xmm0
movsd %xmm0, 0x8(%r14)
jmp 0x375f
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq (%r14), %rax
movq (%rax), %rax
cmpl $0x0, 0x24(%rax)
je 0x375f
cmpl $0x0, 0x14(%r14)
je 0x3787
movq %r14, %rdi
callq 0x325a
jmp 0x375f
movl $0x1, 0x10(%r14)
jmp 0x375f
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_decode_audio
plm_samples_t *plm_decode_audio(plm_t *self) {
	if (!plm_init_decoders(self)) {
		return NULL;
	}

	if (!self->audio_packet_type) {
		return NULL;
	}

	plm_samples_t *samples = plm_audio_decode(self->audio_decoder);
	if (samples) {
		self->time = samples->time;
	}
	else if (plm_demux_has_ended(self->demux)) {
		plm_handle_end(self);
	}
	return samples;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x267c
testl %eax, %eax
je 0x37c5
cmpl $0x0, 0x40(%r14)
je 0x37c5
movq 0x58(%r14), %rdi
callq 0x367a
movq %rax, %rbx
testq %rax, %rax
je 0x37d2
movsd (%rbx), %xmm0
movsd %xmm0, 0x8(%r14)
jmp 0x37c7
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq (%r14), %rax
movq (%rax), %rax
cmpl $0x0, 0x24(%rax)
je 0x37c7
cmpl $0x0, 0x14(%r14)
je 0x37ef
movq %r14, %rdi
callq 0x325a
jmp 0x37c7
movl $0x1, 0x10(%r14)
jmp 0x37c7
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_read_packets
void plm_read_packets(plm_t *self, int requested_type) {
	plm_packet_t *packet;
	while ((packet = plm_demux_decode(self->demux))) {
		if (packet->type == self->video_packet_type) {
			plm_buffer_write(self->video_buffer, packet->data, packet->length);
		}
		else if (packet->type == self->audio_packet_type) {
			plm_buffer_write(self->audio_buffer, packet->data, packet->length);
		}

		if (packet->type == requested_type) {
			return;
		}
	}

	if (plm_demux_has_ended(self->demux)) {
		if (self->video_buffer) {
			plm_buffer_signal_end(self->video_buffer);
		}
		if (self->audio_buffer) {
			plm_buffer_signal_end(self->audio_buffer);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x50(%rdi), %r15
leaq 0x28(%rdi), %r12
movq (%rbx), %rdi
callq 0x387e
testq %rax, %rax
je 0x3847
movq %rax, %r14
movl (%rax), %ecx
movq %r12, %rax
cmpl 0x20(%rbx), %ecx
je 0x3830
movq %r15, %rax
cmpl 0x40(%rbx), %ecx
jne 0x3840
movq (%rax), %rdi
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rsi
callq 0x394d
cmpl %ebp, (%r14)
jne 0x380e
jmp 0x3875
movq (%rbx), %rax
movq (%rax), %rax
cmpl $0x0, 0x24(%rax)
je 0x3875
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0x3864
movq 0x10(%rax), %rcx
movq %rcx, 0x18(%rax)
movq 0x50(%rbx), %rax
testq %rax, %rax
je 0x3875
movq 0x10(%rax), %rcx
movq %rcx, 0x18(%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_decode
plm_packet_t *plm_demux_decode(plm_demux_t *self) {
	if (!plm_demux_has_headers(self)) {
		return NULL;
	}

	if (self->current_packet.length) {
		size_t bits_till_next_packet = self->current_packet.length << 3;
		if (!plm_buffer_has(self->buffer, bits_till_next_packet)) {
			return NULL;
		}
		plm_buffer_skip(self->buffer, bits_till_next_packet);
		self->current_packet.length = 0;
	}

	// Pending packet waiting for data?
	if (self->next_packet.length) {
		return plm_demux_get_packet(self);
	}

	// Pending packet waiting for header?
	if (self->start_code != -1) {
		return plm_demux_decode_packet(self, self->start_code);
	}

	do {
		self->start_code = plm_buffer_next_start_code(self->buffer);
		if (
			self->start_code == PLM_DEMUX_PACKET_VIDEO_1 || 
			self->start_code == PLM_DEMUX_PACKET_PRIVATE || (
				self->start_code >= PLM_DEMUX_PACKET_AUDIO_1 && 
				self->start_code <= PLM_DEMUX_PACKET_AUDIO_4
			)
		) {
			return plm_demux_decode_packet(self, self->start_code);
		}
	} while (self->start_code != -1);

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x2894
testl %eax, %eax
je 0x3940
movq 0x60(%rbx), %r14
testq %r14, %r14
je 0x38d8
shlq $0x3, %r14
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x4392
testl %eax, %eax
je 0x3940
movl %eax, %ebp
movq (%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x4392
testl %eax, %eax
je 0x38cc
addq %r14, (%r15)
movq $0x0, 0x60(%rbx)
testl %ebp, %ebp
je 0x3940
cmpq $0x0, 0x80(%rbx)
je 0x38f4
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x486f
movl 0x38(%rbx), %esi
cmpl $-0x1, %esi
je 0x3913
movq %rbx, %rdi
jmp 0x3931
movl %eax, %ecx
andl $-0x4, %ecx
cmpl $0xc0, %ecx
je 0x392c
cmpl $-0x1, %eax
je 0x3940
movq (%rbx), %rdi
callq 0x4500
movl %eax, 0x38(%rbx)
cmpl $0xbd, %eax
je 0x392c
cmpl $0xe0, %eax
jne 0x3901
movq %rbx, %rdi
movl %eax, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4739
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_write
size_t plm_buffer_write(plm_buffer_t *self, uint8_t *bytes, size_t length) {
	if (self->mode == PLM_BUFFER_MODE_FIXED_MEM) {
		return 0;
	}

	if (self->discard_read_bytes) {
		// This should be a ring buffer, but instead it just shifts all unread 
		// data to the beginning of the buffer and appends new data at the end. 
		// Seems to be good enough.

		plm_buffer_discard_read_bytes(self);
		if (self->mode == PLM_BUFFER_MODE_RING) {
			self->total_size = 0;
		}
	}

	// Do we have to resize to fit the new data?
	size_t bytes_available = self->capacity - self->length;
	if (bytes_available < length) {
		size_t new_size = self->capacity;
		do {
			new_size *= 2;
		} while (new_size - self->length < length);
		self->bytes = (uint8_t *)PLM_REALLOC(self->bytes, new_size);
		self->capacity = new_size;
	}

	memcpy(self->bytes + self->length, bytes, length);
	self->length += length;
	self->has_ended = FALSE;
	return length;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x1, 0x60(%rdi)
jne 0x395f
xorl %ebx, %ebx
jmp 0x39d9
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpl $0x0, 0x20(%rdi)
je 0x3985
movq %r14, %rdi
callq 0x42b2
cmpl $0x2, 0x60(%r14)
jne 0x3985
movq $0x0, 0x18(%r14)
movq 0x8(%r14), %r12
movq 0x10(%r14), %rax
movq %r12, %rcx
subq %rax, %rcx
cmpq %rbx, %rcx
jae 0x39ba
addq %r12, %r12
movq %r12, %rcx
subq %rax, %rcx
cmpq %rbx, %rcx
jb 0x3998
movq 0x58(%r14), %rdi
movq %r12, %rsi
callq 0x2250
movq %rax, 0x58(%r14)
movq %r12, 0x8(%r14)
movq 0x58(%r14), %rdi
addq 0x10(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2130
addq %rbx, 0x10(%r14)
movl $0x0, 0x24(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq