LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_row_group_writer_free
void cx_row_group_writer_free(struct cx_row_group_writer *writer)
{
    if (writer->strings.metadata)
        free(writer->strings.metadata);
    cx_column_free(writer->strings.column);
    if (writer->columns.descriptors)
        free(writer->columns.descriptors);
    if (writer->row_groups.headers)
        free(writer->row_groups.headers);
    fclose(writer->file);
    free(writer);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x48(%rdi), %rdi
testq %rdi, %rdi
je 0xa7e9
callq 0x5080
movq 0x38(%rbx), %rdi
callq 0x58f0
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0xa800
callq 0x5080
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0xa80e
callq 0x5080
movq (%rbx), %rdi
callq 0x51f0
movq %rbx, %rdi
popq %rbx
jmp 0x5080
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_row_group_writer_metadata
bool cx_row_group_writer_metadata(struct cx_row_group_writer *writer,
                                  const char *metadata)
{
    size_t size = strlen(metadata) + 1;
    char *buf;
    if (writer->strings.metadata)
        buf = realloc(writer->strings.metadata, size);
    else
        buf = malloc(size);
    if (!buf)
        return false;
    memcpy(buf, metadata, size);
    writer->strings.metadata = buf;
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x5250
movq %rax, %r15
incq %r15
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0xa856
movq %r15, %rsi
callq 0x56d0
jmp 0xa85e
movq %r15, %rdi
callq 0x5590
movq %rax, %r12
testq %rax, %rax
je 0xa878
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x54e0
movq %r12, 0x48(%rbx)
testq %r12, %r12
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_row_group_writer_add_column
bool cx_row_group_writer_add_column(struct cx_row_group_writer *writer,
                                    const char *name, enum cx_column_type type,
                                    enum cx_encoding_type encoding,
                                    enum cx_compression_type compression,
                                    int level)
{
    if (writer->header_written)
        return false;

    if (!writer->columns.count) {
        writer->columns.descriptors =
            malloc(sizeof(*writer->columns.descriptors) * 8);
        if (!writer->columns.descriptors)
            return false;
        writer->columns.size = 8;
    } else if (writer->columns.count == writer->columns.size) {
        size_t new_size = writer->columns.size * 2;
        assert(new_size && new_size > writer->columns.size);
        struct cx_column_descriptor *descriptors = realloc(
            writer->columns.descriptors, new_size * sizeof(*descriptors));
        if (!descriptors)
            return false;
        writer->columns.descriptors = descriptors;
        writer->columns.size = new_size;
    }

    struct cx_column_descriptor *descriptor =
        &writer->columns.descriptors[writer->columns.count++];
    memset(descriptor, 0, sizeof(*descriptor));
    descriptor->type = type;
    descriptor->encoding = encoding;
    descriptor->compression = compression;
    descriptor->compression_level = level;

    return cx_row_group_writer_add_string(writer, name, &descriptor->name);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x0, 0x58(%rdi)
je 0xa8b8
xorl %eax, %eax
jmp 0xa99d
movl %r8d, %r15d
movl %ecx, %r12d
movl %edx, %r13d
movq %rdi, %rbx
movq 0x10(%rdi), %rcx
testq %rcx, %rcx
je 0xa91b
movq 0x18(%rbx), %rax
cmpq %rax, %rcx
jne 0xa946
movl %r9d, 0x4(%rsp)
testq %rax, %rax
jle 0xa9ac
movq %rax, %r14
addq %rax, %r14
je 0xa9ac
movq %rsi, %rbp
movq 0x8(%rbx), %rdi
shlq $0x4, %rax
leaq (%rax,%rax,2), %rsi
callq 0x56d0
testq %rax, %rax
je 0xa8b1
movq %rax, 0x8(%rbx)
movq %r14, 0x18(%rbx)
movq %rbp, %rsi
movl 0x4(%rsp), %r9d
jmp 0xa946
movl %r9d, %ebp
movq %rsi, %r14
movl $0xc0, %edi
callq 0x5590
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0xa8b1
movq $0x8, 0x18(%rbx)
movq %r14, %rsi
movl %ebp, %r9d
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x10(%rbx)
leaq (%rax,%rax,2), %rbp
xorps %xmm0, %xmm0
movups %xmm0, (%r14,%rbp,8)
movq $0x0, 0x10(%r14,%rbp,8)
movl %r13d, 0x4(%r14,%rbp,8)
movl %r12d, 0x8(%r14,%rbp,8)
movl %r15d, 0xc(%r14,%rbp,8)
movl %r9d, 0x10(%r14,%rbp,8)
movq 0x38(%rbx), %rdi
callq 0x5210
testb %al, %al
je 0xa99d
leaq (%r14,%rbp,8), %rcx
movq 0x40(%rbx), %rdx
movl %edx, (%rcx)
incq %rdx
movq %rdx, 0x40(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2d0e(%rip), %rdi      # 0xd6c1
leaq 0x2d33(%rip), %rsi      # 0xd6ed
leaq 0x2d35(%rip), %rcx      # 0xd6f6
movl $0x149, %edx            # imm = 0x149
callq 0x5350
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_writer_put_bit
bool cx_writer_put_bit(struct cx_writer *writer, size_t column_index,
                       bool value)
{
    if (!cx_writer_put_check(writer, column_index))
        return false;
    if (!cx_column_put_bit(writer->columns[column_index].values, value))
        return false;
    if (!cx_column_put_bit(writer->columns[column_index].nulls, false))
        return false;
    writer->position += (column_index == 0);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
callq 0xaa32
testb %al, %al
je 0xaa23
movq 0x8(%rbx), %rax
movq %r14, %r15
shlq $0x4, %r15
movq (%rax,%r15), %rdi
movzbl %bpl, %esi
callq 0x54a0
testb %al, %al
je 0xaa23
movq 0x8(%rbx), %rax
movq 0x8(%rax,%r15), %rdi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x54a0
testb %al, %al
je 0xaa25
cmpq $0x1, %r14
adcq $0x0, 0x20(%rbx)
movb $0x1, %bpl
jmp 0xaa25
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_writer_put_check
static bool cx_writer_put_check(struct cx_writer *writer, size_t column_index)
{
    if (column_index >= writer->column_count)
        return false;
    if (column_index == 0 && writer->position == writer->row_group_size)
        if (!cx_writer_flush_row_group(writer))
            return false;
    if (!writer->columns)
        if (!cx_writer_ensure_columns(writer))
            return false;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq %rsi, 0x18(%rdi)
jbe 0xab87
movq %rdi, %rbx
testq %rsi, %rsi
jne 0xaa69
movq 0x20(%rbx), %rax
cmpq 0x10(%rbx), %rax
jne 0xaa69
movq %rbx, %rdi
callq 0xae4a
testb %al, %al
je 0xab87
movb $0x1, %al
cmpq $0x0, 0x8(%rbx)
jne 0xab89
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xab9c
movl $0x10, %esi
callq 0x5450
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0xab87
movq (%rbx), %rax
movq 0x8(%rax), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
callq 0x57f0
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0xab37
xorl %edi, %edi
xorl %esi, %esi
callq 0x57f0
movq 0x8(%rbx), %rcx
movq %rax, 0x8(%rcx)
testq %rax, %rax
je 0xab37
movl $0x20, %r14d
xorl %r12d, %r12d
xorl %r15d, %r15d
incq %r15
movq 0x18(%rbx), %r13
cmpq %r13, %r15
jae 0xab98
movq (%rbx), %rax
movq 0x8(%rax), %rax
movl -0x4(%rax,%r14), %edi
movl (%rax,%r14), %esi
callq 0x57f0
movq 0x8(%rbx), %rcx
movq %rax, 0x10(%rcx,%r12)
testq %rax, %rax
je 0xab30
leaq 0x10(%r12), %rbp
addq $0x18, %r14
xorl %edi, %edi
xorl %esi, %esi
callq 0x57f0
movq 0x8(%rbx), %rcx
movq %rax, 0x18(%rcx,%r12)
movq %rbp, %r12
testq %rax, %rax
jne 0xaada
cmpq %r13, %r15
movb $0x1, %al
jae 0xab89
cmpq $0x0, 0x18(%rbx)
je 0xab76
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r14), %rdi
testq %rdi, %rdi
je 0xab56
callq 0x58f0
movq 0x8(%rbx), %rax
movq 0x8(%rax,%r14), %rdi
testq %rdi, %rdi
je 0xab69
callq 0x58f0
incq %r15
addq $0x10, %r14
cmpq 0x18(%rbx), %r15
jb 0xab44
movq 0x8(%rbx), %rdi
callq 0x5080
movq $0x0, 0x8(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0xab89
leaq 0x2c71(%rip), %rdi      # 0xd814
leaq 0x2b43(%rip), %rsi      # 0xd6ed
leaq 0x2c8c(%rip), %rcx      # 0xd83d
movl $0x80, %edx
callq 0x5350
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_writer_put_i32
bool cx_writer_put_i32(struct cx_writer *writer, size_t column_index,
                       int32_t value)
{
    if (!cx_writer_put_check(writer, column_index))
        return false;
    if (!cx_column_put_i32(writer->columns[column_index].values, value))
        return false;
    if (!cx_column_put_bit(writer->columns[column_index].nulls, false))
        return false;
    writer->position += (column_index == 0);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
callq 0xaa32
testb %al, %al
je 0xac11
movq 0x8(%rbx), %rax
movq %r14, %r15
shlq $0x4, %r15
movq (%rax,%r15), %rdi
movl %ebp, %esi
callq 0x5520
testb %al, %al
je 0xac11
movq 0x8(%rbx), %rax
movq 0x8(%rax,%r15), %rdi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x54a0
testb %al, %al
je 0xac13
cmpq $0x1, %r14
adcq $0x0, 0x20(%rbx)
movb $0x1, %bpl
jmp 0xac13
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_writer_put_i64
bool cx_writer_put_i64(struct cx_writer *writer, size_t column_index,
                       int64_t value)
{
    if (!cx_writer_put_check(writer, column_index))
        return false;
    if (!cx_column_put_i64(writer->columns[column_index].values, value))
        return false;
    if (!cx_column_put_bit(writer->columns[column_index].nulls, false))
        return false;
    writer->position += (column_index == 0);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
callq 0xaa32
testb %al, %al
je 0xac79
movq 0x8(%rbx), %rax
movq %r14, %r12
shlq $0x4, %r12
movq (%rax,%r12), %rdi
movq %r15, %rsi
callq 0x56b0
testb %al, %al
je 0xac79
movq 0x8(%rbx), %rax
movq 0x8(%rax,%r12), %rdi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x54a0
testb %al, %al
je 0xac7b
cmpq $0x1, %r14
adcq $0x0, 0x20(%rbx)
movb $0x1, %bpl
jmp 0xac7b
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_writer_put_flt
bool cx_writer_put_flt(struct cx_writer *writer, size_t column_index,
                       float value)
{
    if (!cx_writer_put_check(writer, column_index))
        return false;
    if (!cx_column_put_flt(writer->columns[column_index].values, value))
        return false;
    if (!cx_column_put_bit(writer->columns[column_index].nulls, false))
        return false;
    writer->position += (column_index == 0);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movss %xmm0, 0x4(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
callq 0xaa32
testb %al, %al
je 0xace4
movq 0x8(%rbx), %rax
movq %r14, %r15
shlq $0x4, %r15
movq (%rax,%r15), %rdi
movss 0x4(%rsp), %xmm0
callq 0x5780
testb %al, %al
je 0xace4
movq 0x8(%rbx), %rax
movq 0x8(%rax,%r15), %rdi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x54a0
testb %al, %al
je 0xace6
cmpq $0x1, %r14
adcq $0x0, 0x20(%rbx)
movb $0x1, %bpl
jmp 0xace6
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_writer_put_dbl
bool cx_writer_put_dbl(struct cx_writer *writer, size_t column_index,
                       double value)
{
    if (!cx_writer_put_check(writer, column_index))
        return false;
    if (!cx_column_put_dbl(writer->columns[column_index].values, value))
        return false;
    if (!cx_column_put_bit(writer->columns[column_index].nulls, false))
        return false;
    writer->position += (column_index == 0);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movsd %xmm0, (%rsp)
movq %rsi, %r14
movq %rdi, %rbx
callq 0xaa32
testb %al, %al
je 0xad4f
movq 0x8(%rbx), %rax
movq %r14, %r15
shlq $0x4, %r15
movq (%rax,%r15), %rdi
movsd (%rsp), %xmm0
callq 0x5460
testb %al, %al
je 0xad4f
movq 0x8(%rbx), %rax
movq 0x8(%rax,%r15), %rdi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x54a0
testb %al, %al
je 0xad51
cmpq $0x1, %r14
adcq $0x0, 0x20(%rbx)
movb $0x1, %bpl
jmp 0xad51
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_writer_put_str
bool cx_writer_put_str(struct cx_writer *writer, size_t column_index,
                       const char *value)
{
    if (!cx_writer_put_check(writer, column_index))
        return false;
    if (!cx_column_put_str(writer->columns[column_index].values, value))
        return false;
    if (!cx_column_put_bit(writer->columns[column_index].nulls, false))
        return false;
    writer->position += (column_index == 0);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
callq 0xaa32
testb %al, %al
je 0xadb7
movq 0x8(%rbx), %rax
movq %r14, %r12
shlq $0x4, %r12
movq (%rax,%r12), %rdi
movq %r15, %rsi
callq 0x5210
testb %al, %al
je 0xadb7
movq 0x8(%rbx), %rax
movq 0x8(%rax,%r12), %rdi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x54a0
testb %al, %al
je 0xadb9
cmpq $0x1, %r14
adcq $0x0, 0x20(%rbx)
movb $0x1, %bpl
jmp 0xadb9
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_writer_put_null
bool cx_writer_put_null(struct cx_writer *writer, size_t column_index)
{
    if (!cx_writer_put_check(writer, column_index))
        return false;
    if (!cx_column_put_unit(writer->columns[column_index].values))
        return false;
    if (!cx_column_put_bit(writer->columns[column_index].nulls, true))
        return false;
    writer->position += (column_index == 0);
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
callq 0xaa32
testb %al, %al
je 0xae14
movq 0x8(%rbx), %rax
movq %r14, %r15
shlq $0x4, %r15
movq (%rax,%r15), %rdi
callq 0x51d0
testb %al, %al
je 0xae14
movq 0x8(%rbx), %rax
movq 0x8(%rax,%r15), %rdi
movl $0x1, %esi
callq 0x54a0
testb %al, %al
je 0xae14
cmpq $0x1, %r14
adcq $0x0, 0x20(%rbx)
movb $0x1, %al
jmp 0xae16
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_writer_flush_row_group
static bool cx_writer_flush_row_group(struct cx_writer *writer)
{
    if (!writer->columns)
        return true;
    struct cx_row_group *row_group = cx_row_group_new();
    if (!row_group)
        return false;
    for (size_t i = 0; i < writer->column_count; i++)
        if (!cx_row_group_add_column(row_group, writer->columns[i].values,
                                     writer->columns[i].nulls))
            goto error;
    if (!cx_row_group_writer_put(writer->writer, row_group))
        goto error;
    cx_row_group_free(row_group);
    for (size_t i = 0; i < writer->column_count; i++) {
        cx_column_free(writer->columns[i].values);
        cx_column_free(writer->columns[i].nulls);
    }
    free(writer->columns);
    writer->columns = NULL;
    writer->position = 0;
    return true;
error:
    cx_row_group_free(row_group);
    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movb $0x1, %bl
cmpq $0x0, 0x8(%rdi)
je 0xaf2d
movq %rdi, %r14
callq 0x5790
testq %rax, %rax
je 0xaf2b
movq %rax, %r15
movl $0x2, %ebp
cmpq $0x0, 0x18(%r14)
je 0xaeb8
movl $0x8, %r12d
xorl %r13d, %r13d
movq 0x8(%r14), %rax
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
movq %r15, %rdi
callq 0x55c0
testb %al, %al
je 0xaeb3
incq %r13
addq $0x10, %r12
cmpq 0x18(%r14), %r13
jb 0xae8b
jmp 0xaeb8
movl $0x5, %ebp
cmpl $0x5, %ebp
je 0xaf23
cmpl $0x2, %ebp
jne 0xaf2d
movq (%r14), %rdi
movq %r15, %rsi
callq 0x5290
testb %al, %al
je 0xaf23
movq %r15, %rdi
callq 0x5860
cmpq $0x0, 0x18(%r14)
je 0xaf0e
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x8(%r14), %rax
movq (%rax,%r15), %rdi
callq 0x58f0
movq 0x8(%r14), %rax
movq 0x8(%rax,%r15), %rdi
callq 0x58f0
incq %r12
addq $0x10, %r15
cmpq 0x18(%r14), %r12
jb 0xaee6
movq 0x8(%r14), %rdi
callq 0x5080
xorl %eax, %eax
movq %rax, 0x8(%r14)
movq %rax, 0x20(%r14)
jmp 0xaf2d
movq %r15, %rdi
callq 0x5860
xorl %ebx, %ebx
andb $0x1, %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_row_group_writer_ensure_header
static bool cx_row_group_writer_ensure_header(
    struct cx_row_group_writer *writer)
{
    if (writer->header_written)
        return true;
    struct cx_header header = {CX_FILE_MAGIC, CX_FILE_VERSION, 0};
    if (!cx_row_group_writer_write(writer, &header, sizeof(header)))
        goto error;
    writer->header_written = true;
    return true;
error:
    rewind(writer->file);
    return false;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movb $0x1, %bpl
cmpb $0x0, 0x58(%rdi)
jne 0xb3c8
movq %rdi, %rbx
movups 0x24cc(%rip), %xmm0     # 0xd870
movq %rsp, %rsi
movaps %xmm0, (%rsi)
movl $0x10, %edx
callq 0xb4f8
movl %eax, %ebp
testb %al, %al
je 0xb3c0
movb $0x1, 0x58(%rbx)
jmp 0xb3c8
movq (%rbx), %rdi
callq 0x5310
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/chriso[P]columnix/lib/writer.c
// Function: cx_row_group_writer_put_column
static bool cx_row_group_writer_put_column(struct cx_row_group_writer *writer,
                                           const struct cx_column *column,
                                           const struct cx_index *index,
                                           struct cx_column_header *header,
                                           enum cx_compression_type compression,
                                           int compression_level)
{
    size_t column_size;
    const void *buffer = cx_column_export(column, &column_size);
    header->decompressed_size = column_size;
    header->offset = cx_write_align(cx_row_group_writer_offset(writer));
    header->encoding = cx_column_encoding(column);
    memcpy(&header->index, index, sizeof(*index));
    size_t compressed_size = 0;
    void *compressed = NULL;
    if (compression && column_size) {
        compressed = cx_compress(compression, compression_level, buffer,
                                 column_size, &compressed_size);
        if (!compressed)
            goto error;
        // fallback if the compression leads to an increase in size
        if (compressed_size >= column_size) {
            header->compression = CX_COMPRESSION_NONE;
        } else {
            header->compression = compression;
            buffer = compressed;
            column_size = compressed_size;
        }
    }
    header->size = column_size;
    if (!cx_row_group_writer_write(writer, buffer, column_size))
        goto error;
    if (compressed)
        free(compressed);
    return true;
error:
    if (compressed)
        free(compressed);
    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, 0xc(%rsp)
movl %r8d, %r14d
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbp
movq %rsp, %r13
movq %rsi, %rdi
movq %r13, %rsi
callq 0x5140
movq %rax, 0x10(%rsp)
movq (%r13), %rax
movq %rax, 0x10(%rbx)
movq %rbp, 0x20(%rsp)
movq (%rbp), %rdi
movl %r14d, %ebp
callq 0x5410
addq $0x7, %rax
andq $-0x8, %rax
movq %rax, (%rbx)
movq %r15, %rdi
callq 0x50c0
movl %eax, 0x1c(%rbx)
movq 0x10(%r12), %rax
movq %rax, 0x30(%rbx)
movups (%r12), %xmm0
movups %xmm0, 0x20(%rbx)
movq $0x0, 0x18(%rsp)
testl %r14d, %r14d
setne %al
movq (%r13), %rcx
testq %rcx, %rcx
setne %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0xb49e
leaq 0x18(%rsp), %r8
movl %ebp, %edi
movl 0xc(%rsp), %esi
movq 0x10(%rsp), %r14
movq %r14, %rdx
callq 0x5840
testq %rax, %rax
je 0xb4a8
movq %rax, %r12
movq 0x18(%rsp), %rax
cmpq (%rsp), %rax
jae 0xb4ad
movl %ebp, 0x18(%rbx)
movq %rax, (%rsp)
movq %r12, %rsi
jmp 0xb4b7
xorl %r12d, %r12d
movq 0x10(%rsp), %rsi
jmp 0xb4b7
xorl %r12d, %r12d
jmp 0xb4d3
movq %r14, %rsi
movl $0x0, 0x18(%rbx)
movq (%rsp), %rdx
movq %rdx, 0x8(%rbx)
movq 0x20(%rsp), %rdi
callq 0xb4f8
testb %al, %al
je 0xb4d3
movb $0x1, %bl
movb $0x1, %al
jmp 0xb4da
xorl %ebx, %ebx
movl $0x0, %eax
testq %r12, %r12
je 0xb4e9
movq %r12, %rdi
callq 0x5080
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_O1/chriso[P]columnix/lib/writer.c
// Function: cx_row_group_writer_write
static bool cx_row_group_writer_write(const struct cx_row_group_writer *writer,
                                      const void *buf, size_t size)
{
    if (!size)
        return true;
    size_t offset = cx_row_group_writer_offset(writer);
    size_t aligned_offset = cx_write_align(offset);
    if (offset != aligned_offset &&
        !cx_row_group_writer_seek(writer, aligned_offset))
        return false;
    return fwrite(buf, size, 1, writer->file) == 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0xb54f
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rdi
callq 0x5410
leaq 0x7(%rax), %rsi
andq $-0x8, %rsi
cmpq %rsi, %rax
je 0xb532
movq (%r15), %rdi
xorl %ebp, %ebp
xorl %edx, %edx
callq 0x5660
testl %eax, %eax
jne 0xb552
movq (%r15), %rcx
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x58c0
cmpq $0x1, %rax
sete %bpl
jmp 0xb552
movb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/dxwc[P]sfeed/sfeed_web.c
// Function: main
int
main(int argc, char *argv[])
{
	if (pledge("stdio", NULL) == -1)
		err(1, "pledge");

	if (argc > 1)
		strlcpy(basehref, argv[1], sizeof(basehref));

	parser.xmlattr = xmlattr;
	parser.xmltagstart = xmltagstart;
	parser.xmltagstartparsed = xmltagstartparsed;

	/* NOTE: getnext is defined in xml.h for inline optimization */
	xml_parse(&parser);

	return found > 0 ? 0 : 1;
}

// Assembly:
pushq %rax
cmpl $0x2, %edi
jl 0x12b7
movq 0x8(%rsi), %rsi
leaq 0x3e43(%rip), %rdi      # 0x50f0
movl $0x1000, %edx           # imm = 0x1000
callq 0x29f0
leaq 0x3d(%rip), %rax        # 0x12fb
movq %rax, 0x4e2b(%rip)      # 0x60f0
leaq 0x4e24(%rip), %rdi      # 0x60f0
leaq 0x10f(%rip), %rax       # 0x13e2
movq %rax, 0x4e8e(%rip)      # 0x6168
leaq 0x15a(%rip), %rax       # 0x143b
movq %rax, 0x4e88(%rip)      # 0x6170
callq 0x1e59
xorl %eax, %eax
cmpl $0x0, 0x7692(%rip)      # 0x8988
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/dxwc[P]sfeed/sfeed_web.c
// Function: xmlattr
static void
xmlattr(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl,
	const char *v, size_t vl)
{
	if (nl != 4) /* optimization */
		return;

	if (isbase) {
		if (!strcasecmp(n, "href"))
			strlcpy(basehref, v, sizeof(basehref));
	} else if (islink) {
		if (!strcasecmp(n, "type")) {
			if (!strncasecmp(v, STRP("application/atom")) ||
			    !strncasecmp(v, STRP("application/xml"))  ||
			    !strncasecmp(v, STRP("application/rss"))) {
				isfeedlink = 1;
				strlcpy(feedtype, v, sizeof(feedtype));
			}
		} else if (!strcasecmp(n, "href")) {
			strlcpy(feedlink, v, sizeof(feedlink));
		}
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x4, %r8
jne 0x1362
movq %r9, %rbx
movq %rcx, %r14
cmpb $0x1, 0x767a(%rip)      # 0x898c
jne 0x1333
leaq 0x1ce9(%rip), %rsi      # 0x3004
movq %r14, %rdi
callq 0x1040
testl %eax, %eax
jne 0x1362
leaq 0x3dc2(%rip), %rdi      # 0x50f0
jmp 0x13ce
cmpb $0x1, 0x7656(%rip)      # 0x8990
jne 0x1362
leaq 0x1cc6(%rip), %rsi      # 0x3009
movq %r14, %rdi
callq 0x1040
testl %eax, %eax
je 0x136a
leaq 0x1cae(%rip), %rsi      # 0x3004
movq %r14, %rdi
callq 0x1040
testl %eax, %eax
je 0x13c7
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1c9d(%rip), %rsi      # 0x300e
movl $0x10, %edx
movq %rbx, %rdi
callq 0x1160
testl %eax, %eax
je 0x13b2
leaq 0x1c96(%rip), %rsi      # 0x301f
movl $0xf, %edx
movq %rbx, %rdi
callq 0x1160
testl %eax, %eax
je 0x13b2
leaq 0x1c8e(%rip), %rsi      # 0x302f
movl $0xf, %edx
movq %rbx, %rdi
callq 0x1160
testl %eax, %eax
jne 0x1362
movb $0x1, 0x75db(%rip)      # 0x8994
leaq 0x75e0(%rip), %rdi      # 0x89a0
movl $0x100, %edx            # imm = 0x100
jmp 0x13d3
leaq 0x76d2(%rip), %rdi      # 0x8aa0
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x29f0
// File: /workspace/github_c_makefile_star2_O1/dxwc[P]sfeed/sfeed_web.c
// Function: xmltagstart
static void
xmltagstart(XMLParser *p, const char *t, size_t tl)
{
	isbase = islink = isfeedlink = 0;
	if (tl != 4) /* optimization */
		return;

	if (!strcasecmp(t, "base"))
		isbase = 1;
	else if (!strcasecmp(t, "link"))
		islink = 1;
}

// Assembly:
xorl %eax, %eax
movb %al, 0x75aa(%rip)       # 0x8994
movb %al, 0x75a0(%rip)       # 0x8990
movb %al, 0x7596(%rip)       # 0x898c
cmpq $0x4, %rdx
jne 0x143a
pushq %rbx
movq %rsi, %rbx
leaq 0x1c38(%rip), %rsi      # 0x303f
movq %rbx, %rdi
callq 0x1040
testl %eax, %eax
je 0x142f
leaq 0x1c2a(%rip), %rsi      # 0x3044
movq %rbx, %rdi
callq 0x1040
testl %eax, %eax
jne 0x1439
leaq 0x7563(%rip), %rax      # 0x8990
jmp 0x1436
leaq 0x7556(%rip), %rax      # 0x898c
movb $0x1, (%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/dxwc[P]sfeed/sfeed_web.c
// Function: xmltagstartparsed
static void
xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort)
{
	if (!isfeedlink)
		return;

	if (absuri(abslink, sizeof(abslink), feedlink, basehref) != -1)
		fputs(abslink, stdout);
	else
		fputs(feedlink, stdout);
	putchar('\t');
	printfeedtype(feedtype, stdout);
	putchar('\n');
	found++;
}

// Assembly:
cmpb $0x1, 0x7552(%rip)      # 0x8994
jne 0x14f4
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x864a(%rip), %rbx      # 0x9aa0
leaq 0x7643(%rip), %r14      # 0x8aa0
leaq 0x3c8c(%rip), %rcx      # 0x50f0
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movq %r14, %rdx
callq 0x1796
cmpl $-0x1, %eax
movq 0x3b62(%rip), %r15      # 0x4fe0
movq (%r15), %rsi
cmoveq %r14, %rbx
movq %rbx, %rdi
callq 0x10b0
movl $0x9, %edi
callq 0x1030
movb 0x7502(%rip), %bpl      # 0x89a0
testb %bpl, %bpl
je 0x14da
movq (%r15), %rbx
leaq 0x74f4(%rip), %r15      # 0x89a1
callq 0x1190
movq %rax, %r14
movq (%r14), %rax
movzbl %bpl, %ecx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x14cf
movsbl %bpl, %edi
movq %rbx, %rsi
callq 0x10d0
movb (%r15), %bpl
incq %r15
testb %bpl, %bpl
jne 0x14b5
movl $0xa, %edi
callq 0x1030
incl 0x749e(%rip)            # 0x8988
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/autosync.c
// Function: jfs_autosync_start
int jfs_autosync_start(struct jfs *fs, time_t max_sec, size_t max_bytes)
{
	struct autosync_cfg *cfg;

	if (fs->as_cfg != NULL)
		return -1;

	cfg = malloc(sizeof(struct autosync_cfg));
	if (cfg == NULL)
		return -1;

	cfg->fs = fs;
	cfg->max_sec = max_sec;
	cfg->max_bytes = max_bytes;
	cfg->must_die = 0;
	pthread_cond_init(&cfg->cond, NULL);
	pthread_mutex_init(&cfg->mutex, NULL);

	fs->as_cfg = cfg;

	return pthread_create(&cfg->tid, NULL, &autosync_thread, cfg);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0x90(%rdi)
je 0x26cf
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movl $0x80, %edi
callq 0x2390
testq %rax, %rax
je 0x26be
movq %rax, %r14
movq %rbx, (%rax)
movq %r12, 0x10(%rax)
movq %r15, 0x18(%rax)
movl $0x0, 0x20(%rax)
leaq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x2340
leaq 0x58(%r14), %rdi
xorl %esi, %esi
callq 0x2570
movq %r14, 0x90(%rbx)
movq %r14, %rdi
addq $0x8, %rdi
leaq 0x15(%rip), %rdx        # 0x273c
xorl %esi, %esi
movq %r14, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2410
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/autosync.c
// Function: autosync_thread
static void *autosync_thread(void *arg)
{
	int rv;
	void *had_errors;
	struct timespec ts;
	struct autosync_cfg *cfg;

	cfg = (struct autosync_cfg *) arg;

	/* had_errors is a void * just to avoid weird casts, since we want to
	 * return it, but it's used as a boolean */
	had_errors = (void *) 0;

	pthread_mutex_lock(&cfg->mutex);
	for (;;) {
		clock_gettime(CLOCK_REALTIME, &ts);
		ts.tv_sec += cfg->max_sec;

		rv = pthread_cond_timedwait(&cfg->cond, &cfg->mutex, &ts);
		if (rv != 0 && rv != ETIMEDOUT)
			break;

		if (cfg->must_die)
			break;

		/* cover from spurious wakeups */
		if (rv != ETIMEDOUT && cfg->fs->ltrans_len < cfg->max_bytes)
			continue;

		rv = jsync(cfg->fs);
		if (rv != 0)
			had_errors = (void *) 1;

	}
	pthread_mutex_unlock(&cfg->mutex);

	pthread_exit(had_errors);
	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x58(%rdi), %rbx
movq %rbx, %rdi
callq 0x2590
leaq 0x28(%r14), %r12
xorl %r15d, %r15d
leaq 0x8(%rsp), %r13
movl $0x1, %ebp
xorl %edi, %edi
movq %r13, %rsi
callq 0x2110
movq 0x10(%r14), %rax
addq %rax, 0x8(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x2460
cmpl $0x6e, %eax
je 0x2794
testl %eax, %eax
jne 0x27bd
cmpl $0x0, 0x20(%r14)
jne 0x27bd
cmpl $0x6e, %eax
je 0x27ad
movq (%r14), %rax
movq 0x38(%rax), %rax
cmpq 0x18(%r14), %rax
jb 0x276a
movq (%r14), %rdi
callq 0x22f0
testl %eax, %eax
cmovneq %rbp, %r15
jmp 0x276a
movq %rbx, %rdi
callq 0x2370
movq %r15, %rdi
callq 0x2380
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/autosync.c
// Function: jfs_autosync_stop
int jfs_autosync_stop(struct jfs *fs)
{
	int rv = 0;
	void *had_errors;

	if (fs->as_cfg == NULL)
		return 0;

	fs->as_cfg->must_die = 1;
	pthread_cond_signal(&fs->as_cfg->cond);
	pthread_join(fs->as_cfg->tid, &had_errors);

	if (had_errors)
		rv = -1;

	pthread_cond_destroy(&fs->as_cfg->cond);
	pthread_mutex_destroy(&fs->as_cfg->mutex);
	free(fs->as_cfg);
	fs->as_cfg = NULL;

	return rv;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x90(%rdi), %rdi
testq %rdi, %rdi
je 0x284f
movl $0x1, 0x20(%rdi)
addq $0x28, %rdi
callq 0x2270
movq 0x90(%rbx), %rax
movq 0x8(%rax), %rdi
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x2550
xorl %r14d, %r14d
cmpq (%r15), %r14
sbbl %r14d, %r14d
movq 0x90(%rbx), %rdi
addq $0x28, %rdi
callq 0x24a0
movq 0x90(%rbx), %rdi
addq $0x58, %rdi
callq 0x21a0
movq 0x90(%rbx), %rdi
callq 0x2040
movq $0x0, 0x90(%rbx)
jmp 0x2852
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/checksum.c
// Function: checksum_buf
uint32_t checksum_buf(uint32_t crc32, const unsigned char *buf, size_t count)
{
	crc32 = ~crc32;

	while (count--) {
		crc32 = (crc32 >> 8) ^ table[(crc32 ^ *buf) & 0xFFL];
		buf++;
	}

	return ~crc32;
}

// Assembly:
movl %edi, %eax
testq %rdx, %rdx
je 0x28b5
notl %eax
xorl %ecx, %ecx
leaq 0x276a(%rip), %rdi      # 0x5000
movl %eax, %r8d
shrl $0x8, %r8d
xorb (%rsi,%rcx), %al
movzbl %al, %r9d
movl %r8d, %eax
xorl (%rdi,%r9,4), %eax
incq %rcx
cmpq %rcx, %rdx
jne 0x2896
notl %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/common.c
// Function: plockf
off_t plockf(int fd, int cmd, off_t offset, off_t len)
{
	struct flock fl;
	int op;

	op = -1;
	fl.l_type = -1;

	if (cmd & _F_READ) {
		fl.l_type = F_RDLCK;
	} else if (cmd & _F_WRITE) {
		fl.l_type = F_WRLCK;
	}

	if (cmd & _F_LOCK) {
		op = F_SETLKW;
	} else if (cmd & _F_TLOCK) {
		op = F_SETLK;
	} else if (cmd & F_UNLOCK) {
		fl.l_type = F_UNLCK;
		op = F_SETLKW; /* not very relevant */
	}

	fl.l_whence = SEEK_SET;
	fl.l_start = offset;
	fl.l_len = len;

	return fcntl(fd, op, &fl);
}

// Assembly:
subq $0x28, %rsp
movw $0xffff, 0x8(%rsp)      # imm = 0xFFFF
testb $0x1, %sil
jne 0x28d8
testb $0x10, %sil
je 0x28df
movw $0x1, 0x8(%rsp)
jmp 0x28df
movw $0x0, 0x8(%rsp)
movl $0x7, %eax
btl $0x8, %esi
jb 0x290c
movl $0x6, %eax
btl $0xc, %esi
jb 0x290c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
btl $0x10, %esi
jae 0x290c
movw $0x2, 0x8(%rsp)
movl $0x7, %eax
leaq 0x8(%rsp), %r8
movw $0x0, 0x2(%r8)
movq %rdx, 0x8(%r8)
movq %rcx, 0x10(%r8)
movl %eax, %esi
movq %r8, %rdx
xorl %eax, %eax
callq 0x2100
cltq
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/common.c
// Function: spread
ssize_t spread(int fd, void *buf, size_t count, off_t offset)
{
	ssize_t rv;
	size_t c;

	c = 0;

	while (c < count) {
		rv = pread(fd, (char *) buf + c, count - c, offset + c);

		if (rv < 0)
			/* error */
			return rv;
		else if (rv == 0)
			/* got EOF */
			return c;

		/* incomplete read, keep on reading */
		c += rv;
	}

	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
testq %rdx, %rdx
je 0x297c
movq %rcx, %r14
movq %rsi, %r15
movl %edi, %ebp
xorl %r12d, %r12d
leaq (%r15,%r12), %rsi
movq %rbx, %rdx
subq %r12, %rdx
leaq (%r12,%r14), %rcx
movl %ebp, %edi
callq 0x2500
testq %rax, %rax
js 0x2974
je 0x2979
addq %rax, %r12
cmpq %rbx, %r12
jb 0x294e
jmp 0x297c
movq %rax, %rbx
jmp 0x297c
movq %r12, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/common.c
// Function: spwrite
ssize_t spwrite(int fd, const void *buf, size_t count, off_t offset)
{
	ssize_t rv;
	size_t c;

	c = 0;

	while (c < count) {
		rv = pwrite(fd, (char *) buf + c, count - c, offset + c);

		if (rv < 0)
			return rv;

		/* incomplete write, keep on writing */
		c += rv;
	}

	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
testq %rdx, %rdx
je 0x29ca
movq %rcx, %r14
movq %rsi, %r15
movl %edi, %ebp
xorl %r12d, %r12d
leaq (%r15,%r12), %rsi
movq %rbx, %rdx
subq %r12, %rdx
leaq (%r12,%r14), %rcx
movl %ebp, %edi
callq 0x23f0
testq %rax, %rax
js 0x29c7
addq %rax, %r12
cmpq %rbx, %r12
jb 0x29a3
jmp 0x29ca
movq %rax, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/common.c
// Function: swritev
ssize_t swritev(int fd, struct iovec *iov, int iovcnt)
{
	int i;
	ssize_t rv;
	size_t c, t, total;

	total = 0;
	for (i = 0; i < iovcnt; i++)
		total += iov[i].iov_len;

	c = 0;
	while (c < total) {
		rv = writev(fd, iov, iovcnt);

		if (rv < 0)
			return rv;

		c += rv;

		/* avoid going into the complex calculations for the common
		 * case of writev() doing a complete write */
		if (c == total)
			break;

		/* incomplete write, advance iov and try again */
		t = 0;
		for (i = 0; i < iovcnt; i++) {
			if (t + iov[i].iov_len > rv) {
				iov[i].iov_base = (char *)
					iov[i].iov_base + rv - t;
				iov[i].iov_len -= rv - t;
				break;
			} else {
				t += iov[i].iov_len;
			}
		}

		iovcnt -= i;
		iov = iov + i;
	}

	return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %ebp
testl %edx, %edx
jle 0x2a04
movl %ebx, %eax
shlq $0x4, %rax
xorl %ecx, %ecx
xorl %r12d, %r12d
addq 0x8(%r14,%rcx), %r12
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x29f4
jmp 0x2a07
xorl %r12d, %r12d
xorl %r15d, %r15d
testq %r12, %r12
je 0x2a85
movl %ebp, %edi
movq %r14, %rsi
movl %ebx, %edx
callq 0x20c0
testq %rax, %rax
js 0x2a82
addq %rax, %r15
cmpq %r12, %r15
je 0x2a85
movl %ebx, %ebx
testl %ebx, %ebx
jle 0x2a55
leaq 0x8(%r14), %rdx
xorl %ecx, %ecx
xorl %esi, %esi
movq (%rdx), %rdi
leaq (%rdi,%rsi), %r8
cmpq %rax, %r8
ja 0x2a59
incq %rcx
addq $0x10, %rdx
movq %r8, %rsi
cmpq %rcx, %rbx
jne 0x2a36
movl %ebx, %ecx
jmp 0x2a70
xorl %ecx, %ecx
jmp 0x2a70
movq -0x8(%rdx), %r8
addq %rax, %r8
subq %rsi, %r8
movq %r8, -0x8(%rdx)
subq %rax, %rsi
addq %rdi, %rsi
movq %rsi, (%rdx)
subl %ecx, %ebx
movl %ecx, %eax
shlq $0x4, %rax
addq %rax, %r14
cmpq %r12, %r15
jb 0x2a0f
jmp 0x2a85
movq %rax, %r15
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/common.c
// Function: get_jdir
int get_jdir(const char *filename, char *jdir)
{
	char *base, *baset;
	char *dir, *dirt;

	baset = strdup(filename);
	if (baset == NULL)
		return 0;
	base = basename(baset);

	dirt = strdup(filename);
	if (dirt == NULL) {
		free(baset);
		return 0;
	}
	dir = dirname(dirt);

	snprintf(jdir, PATH_MAX, "%s/.%s.jio", dir, base);

	free(baset);
	free(dirt);

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x2560
testq %rax, %rax
je 0x2afd
movq %rax, %rbx
movq %rax, %rdi
callq 0x2330
movq %rax, %r12
movq %r15, %rdi
callq 0x2560
testq %rax, %rax
je 0x2b01
movq %rax, %r15
movq %rax, %rdi
callq 0x21e0
leaq 0x292a(%rip), %rdx      # 0x5400
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
movq %rax, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x21b0
movq %rbx, %rdi
callq 0x2040
movl $0x1, %ebp
movq %r15, %rbx
jmp 0x2b03
xorl %ebp, %ebp
jmp 0x2b0b
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/trans.c
// Function: jtrans_new
struct jtrans *jtrans_new(struct jfs *fs, unsigned int flags)
{
	pthread_mutexattr_t attr;
	struct jtrans *ts;

	ts = malloc(sizeof(struct jtrans));
	if (ts == NULL)
		return NULL;

	ts->fs = fs;
	ts->id = 0;
	ts->flags = fs->flags | flags;
	ts->op = NULL;
	ts->numops_r = 0;
	ts->numops_w = 0;
	ts->len_w = 0;

	pthread_mutexattr_init(&attr);
	pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
	pthread_mutex_init(&(ts->lock), &attr);
	pthread_mutexattr_destroy(&attr);

	return ts;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %r14
movl $0x50, %edi
callq 0x2390
testq %rax, %rax
je 0x2be7
movq %rax, %rbx
movq %r14, (%rax)
movl $0x0, 0x8(%rax)
orl 0x28(%r14), %ebp
movl %ebp, 0xc(%rax)
movq $0x0, 0x48(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x2540
movq %r14, %rdi
xorl %esi, %esi
callq 0x21c0
movq %rbx, %rdi
addq $0x20, %rdi
movq %r14, %rsi
callq 0x2570
movq %r14, %rdi
callq 0x2580
jmp 0x2be9
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/trans.c
// Function: jtrans_free
void jtrans_free(struct jtrans *ts)
{
	struct operation *tmpop;

	ts->fs = NULL;

	while (ts->op != NULL) {
		tmpop = ts->op->next;

		if (ts->op->buf && ts->op->direction == D_WRITE)
			free(ts->op->buf);
		if (ts->op->pdata)
			free(ts->op->pdata);
		free(ts->op);

		ts->op = tmpop;
	}
	pthread_mutex_destroy(&(ts->lock));

	free(ts);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq $0x0, (%rdi)
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x2c4b
movq 0x18(%rax), %rdi
movq 0x40(%rax), %r14
testq %rdi, %rdi
je 0x2c24
cmpl $0x2, 0x20(%rax)
jne 0x2c24
callq 0x2040
movq 0x48(%rbx), %rax
movq 0x30(%rax), %rdi
testq %rdi, %rdi
je 0x2c36
callq 0x2040
movq 0x48(%rbx), %rdi
callq 0x2040
movq %r14, 0x48(%rbx)
movq %r14, %rax
testq %r14, %r14
jne 0x2c0c
leaq 0x20(%rbx), %rdi
callq 0x21a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/trans.c
// Function: lock_file_ranges
static int lock_file_ranges(struct jtrans *ts, int mode)
{
	unsigned int nops;
	off_t lr, min_offset;
	struct operation *op, *start_op;

	if (ts->flags & J_NOLOCK)
		return 0;

	/* Lock/unlock always in the same order to avoid deadlocks. We will
	 * begin with the operation that has the smallest start offset, and go
	 * from there.
	 * Note that this is O(n^2), but n is usually (very) small, and we're
	 * about to do synchronous I/O, so it's not really worrying. It has a
	 * small optimization to help when the operations tend to be in the
	 * right order. */
	nops = 0;
	min_offset = 0;
	start_op = ts->op;
	while (nops < ts->numops_r + ts->numops_w) {
		for (op = start_op; op != NULL; op = op->next) {
			if (min_offset < op->offset)
				continue;
			min_offset = op->offset;
			start_op = op->next;

			if (mode == F_LOCKW) {
				lr = plockf(ts->fs->fd, F_LOCKW, op->offset, op->len);
				if (lr == -1)
					goto error;
				op->locked = 1;
			} else if (mode == F_UNLOCK && op->locked) {
				lr = plockf(ts->fs->fd, F_UNLOCK, op->offset,
						op->len);
				if (lr == -1)
					goto error;
				op->locked = 0;
			}
		}

		nops++;
	}

	return 0;

error:
	return -1;
}

// Assembly:
xorl %eax, %eax
testb $0x1, 0xc(%rdi)
jne 0x3265
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movl 0x14(%rdi), %ecx
addl 0x10(%rdi), %ecx
je 0x3257
movl %esi, %ebx
movq 0x48(%r14), %r12
xorl %eax, %eax
xorl %ebp, %ebp
testq %r12, %r12
je 0x323c
movq %r12, %r13
movq 0x8(%r13), %r15
cmpq %r15, %rax
jl 0x3233
movq 0x40(%r13), %r12
cmpl $0x10000, %ebx          # imm = 0x10000
je 0x3207
cmpl $0x110, %ebx            # imm = 0x110
jne 0x3230
movq (%r14), %rax
movl (%rax), %edi
movq 0x10(%r13), %rcx
movl $0x110, %esi            # imm = 0x110
movq %r15, %rdx
callq 0x2480
movl $0x1, %ecx
jmp 0x3226
cmpl $0x0, (%r13)
je 0x3230
movq (%r14), %rax
movl (%rax), %edi
movq 0x10(%r13), %rcx
movl $0x10000, %esi          # imm = 0x10000
movq %r15, %rdx
callq 0x2480
xorl %ecx, %ecx
cmpq $-0x1, %rax
je 0x3252
movl %ecx, (%r13)
movq %r15, %rax
movq 0x40(%r13), %r13
testq %r13, %r13
jne 0x31cd
incl %ebp
movl 0x14(%r14), %ecx
addl 0x10(%r14), %ecx
cmpl %ecx, %ebp
jb 0x31c5
xorl %eax, %eax
jmp 0x3257
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_O1/albertito[P]libjio/libjio/trans.c
// Function: jclose
int jclose(struct jfs *fs)
{
	int ret;

	ret = 0;

	if (jfs_autosync_stop(fs))
		ret = -1;

	if (! (fs->flags & J_RDONLY)) {
		if (jsync(fs))
			ret = -1;
		if (fs->jfd < 0 || close(fs->jfd))
			ret = -1;
		if (fs->jdirfd < 0 || close(fs->jdirfd))
			ret = -1;
		if (fs->jmap != MAP_FAILED)
			munmap(fs->jmap, sizeof(unsigned int));
	}

	if (fs->fd < 0 || close(fs->fd))
		ret = -1;
	if (fs->name)
		/* allocated by strdup() in jopen() */
		free(fs->name);
	if (fs->jdir)
		free(fs->jdir);

	pthread_mutex_destroy(&(fs->lock));
	pthread_mutex_destroy(&(fs->ltlock));

	free(fs);

	return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x2210
xorl %ebp, %ebp
negl %eax
sbbl %ebp, %ebp
testb $0x2, 0x29(%rbx)
jne 0x36aa
movq %rbx, %rdi
callq 0x22f0
movl 0x1c(%rbx), %edi
testl %edi, %edi
js 0x3677
xorl %r14d, %r14d
negl %eax
sbbl %r14d, %r14d
callq 0x2220
testl %eax, %eax
je 0x367e
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x3681
orl %r14d, %ebp
movl 0x18(%rbx), %edi
testl %edi, %edi
js 0x3691
callq 0x2220
testl %eax, %eax
je 0x3696
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x20(%rbx), %rdi
cmpq $-0x1, %rdi
je 0x36aa
movl $0x4, %esi
callq 0x23e0
movl (%rbx), %edi
testl %edi, %edi
js 0x36b9
callq 0x2220
testl %eax, %eax
je 0x36be
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x36cc
callq 0x2040
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x36da
callq 0x2040
leaq 0x68(%rbx), %rdi
callq 0x21a0
leaq 0x40(%rbx), %rdi
callq 0x21a0
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/trans.c
// Function: jsync
int jsync(struct jfs *fs)
{
	int rv;
	struct jlinger *ltmp;

	if (fs->fd < 0)
		return -1;

	rv = fdatasync(fs->fd);
	if (rv != 0)
		return rv;

	/* note the jops will be in order, so if we crash or fail in the
	 * middle of this, there will be no problem applying the remaining
	 * transactions */
	pthread_mutex_lock(&(fs->ltlock));
	while (fs->ltrans != NULL) {
		fiu_exit_on("jio/jsync/pre_unlink");
		if (journal_free(fs->ltrans->jop, 1) != 0) {
			pthread_mutex_unlock(&(fs->ltlock));
			return -1;
		}

		ltmp = fs->ltrans->next;
		free(fs->ltrans);
		fs->ltrans = ltmp;
	}

	fs->ltrans_len = 0;
	pthread_mutex_unlock(&(fs->ltlock));
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rdi), %edi
testl %edi, %edi
js 0x374f
callq 0x2080
movl %eax, %ebp
testl %eax, %eax
jne 0x376f
leaq 0x40(%rbx), %r14
movq %r14, %rdi
callq 0x2590
movq 0x30(%rbx), %r15
testq %r15, %r15
je 0x3756
movq (%r15), %rdi
movl $0x1, %esi
callq 0x23c0
testl %eax, %eax
jne 0x3762
movq 0x30(%rbx), %rdi
movq 0x8(%rdi), %r15
callq 0x2040
movq %r15, 0x30(%rbx)
jmp 0x3726
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x376f
movq $0x0, 0x38(%rbx)
xorl %ebp, %ebp
jmp 0x3767
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x2370
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/albertito[P]libjio/libjio/trans.c
// Function: jmove_journal
int jmove_journal(struct jfs *fs, const char *newpath)
{
	int ret;
	char *oldpath, jlockfile[PATH_MAX], oldjlockfile[PATH_MAX];

	/* we try to be sure that all lingering transactions have been
	 * applied, so when we try to remove the journal directory, only the
	 * lockfile is there; however, we do this just to be nice, the caller
	 * must be sure there are no in-flight transactions or any other kind
	 * of operation around when he calls this function */
	jsync(fs);

	oldpath = fs->jdir;
	snprintf(oldjlockfile, PATH_MAX, "%s/lock", fs->jdir);

	fs->jdir = malloc(strlen(newpath) + 1);
	if (fs->jdir == NULL)
		return -1;
	strcpy(fs->jdir, newpath);

	ret = rename(oldpath, newpath);
	if (ret == -1 && (errno == ENOTEMPTY || errno == EEXIST) ) {
		/* rename() failed, the dest. directory is not empty, so we
		 * have to reload everything */

		close(fs->jdirfd);
		fs->jdirfd = open(newpath, O_RDONLY);
		if (fs->jdirfd < 0)
			goto exit;

		snprintf(jlockfile, PATH_MAX, "%s/lock", newpath);
		ret = rename(oldjlockfile, jlockfile);
		if (ret < 0)
			goto exit;

		/* remove the journal directory, if possible */
		unlink(oldjlockfile);
		ret = rmdir(oldpath);
		if (ret == -1) {
			/* we couldn't remove it, something went wrong
			 * (possibly it had some files left) */
			goto exit;
		}

		ret = 0;
	}

exit:
	free(oldpath);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x2008, %rsp           # imm = 0x2008
movq %rsi, %r14
movq %rdi, %r15
callq 0x22f0
movq 0x10(%r15), %rbx
leaq 0x1c91(%rip), %rdx      # 0x5430
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rcx
xorl %eax, %eax
callq 0x21b0
movq %r14, %rdi
callq 0x2140
leaq 0x1(%rax), %rdi
callq 0x2390
movq %rax, 0x10(%r15)
testq %rax, %rax
je 0x37f2
movq %rax, %rdi
movq %r14, %rsi
callq 0x20a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x24e0
cmpl $-0x1, %eax
je 0x3807
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2040
jmp 0x37f7
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x2008, %rsp           # imm = 0x2008
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x2070
movl (%rax), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x27, %eax
je 0x381d
cmpl $0x11, %eax
jne 0x37e8
movl 0x18(%r15), %edi
callq 0x2220
movq %r14, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x24b0
movl %eax, 0x18(%r15)
testl %eax, %eax
js 0x37e8
leaq 0x1bef(%rip), %rdx      # 0x5430
leaq 0x1000(%rsp), %r15
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x21b0
movq %rsp, %rdi
movq %r15, %rsi
callq 0x24e0
testl %eax, %eax
js 0x37e6
movq %rsp, %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2130
xorl %ebp, %ebp
cmpl $-0x1, %eax
sete %bpl
negl %ebp
jmp 0x37e8
nop