LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movb $0x1, %bl
cmpq $0x0, 0x8(%rdi)
je 0xadb3
movq %rdi, %r14
callq 0x5790
testq %rax, %rax
je 0xadb1
movq %rax, %r15
cmpq $0x0, 0x18(%r14)
je 0xad48
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 0xada9
incq %r13
addq $0x10, %r12
cmpq 0x18(%r14), %r13
jb 0xad22
movq (%r14), %rdi
movq %r15, %rsi
callq 0x5290
testb %al, %al
je 0xada9
movq %r15, %rdi
callq 0x5860
cmpq $0x0, 0x18(%r14)
je 0xad94
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 0xad6c
movq 0x8(%r14), %rdi
callq 0x5080
xorl %eax, %eax
movq %rax, 0x8(%r14)
movq %rax, 0x20(%r14)
jmp 0xadb3
movq %r15, %rdi
callq 0x5860
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xb20b
movq %rdi, %rbx
movups 0x26a9(%rip), %xmm0     # 0xd890
movq %rsp, %rsi
movaps %xmm0, (%rsi)
movl $0x10, %edx
callq 0xb337
movl %eax, %ebp
testb %al, %al
je 0xb203
movb $0x1, 0x58(%rbx)
jmp 0xb20b
movq (%rbx), %rdi
callq 0x5310
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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, %ebx
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbp
leaq 0x20(%rsp), %r13
movq %rsi, %rdi
movq %r13, %rsi
callq 0x5140
movq %rax, 0x10(%rsp)
movq (%r13), %rax
movq %rax, 0x10(%r14)
movq (%rbp), %rdi
callq 0x5410
addq $0x7, %rax
andq $-0x8, %rax
movq %rax, (%r14)
movq %r15, %rdi
movl %ebx, %r15d
callq 0x50c0
movl %eax, 0x1c(%r14)
movq 0x10(%r12), %rax
movq %rax, 0x30(%r14)
movups (%r12), %xmm0
movups %xmm0, 0x20(%r14)
movq $0x0, 0x18(%rsp)
testl %ebx, %ebx
setne %al
movq (%r13), %rcx
testq %rcx, %rcx
setne %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0xb2e9
leaq 0x18(%rsp), %r8
movl %r15d, %edi
movl 0xc(%rsp), %esi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x5840
testq %rax, %rax
je 0xb301
movq %rax, %r12
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rdx
cmpq %rdx, %rax
jae 0xb305
movl %r15d, 0x18(%r14)
movq %rax, 0x20(%rsp)
movq %rax, %rdx
movq %r12, %rbx
jmp 0xb30d
movq %rcx, 0x8(%r14)
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
movq %rcx, %rdx
callq 0xb337
movl %eax, %ebx
jmp 0xb326
xorl %ebx, %ebx
jmp 0xb326
movl $0x0, 0x18(%r14)
movq %rdx, 0x8(%r14)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xb337
movl %eax, %ebx
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_O3/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 0xb38e
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 0xb371
movq (%r15), %rdi
xorl %ebp, %ebp
xorl %edx, %edx
callq 0x5660
testl %eax, %eax
jne 0xb391
movq (%r15), %rcx
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x58c0
cmpq $0x1, %rax
sete %bpl
jmp 0xb391
movb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x2a60
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 0x1e99
xorl %eax, %eax
cmpl $0x0, 0x7692(%rip)      # 0x8988
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x27ba
cmpl $0x0, 0x20(%r14)
jne 0x27ba
movq (%r14), %rdi
cmpl $0x6e, %eax
je 0x27ad
movq 0x38(%rdi), %rax
cmpq 0x18(%r14), %rax
jb 0x276a
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_O3/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 0x284c
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 0x284f
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x28b1
notl %eax
xorl %ecx, %ecx
leaq 0x276e(%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 0x2892
notl %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x28d4
testb $0x10, %sil
je 0x28db
movw $0x1, 0x8(%rsp)
jmp 0x28db
movw $0x0, 0x8(%rsp)
movl $0x7, %eax
btl $0x8, %esi
jb 0x2908
movl $0x6, %eax
btl $0xc, %esi
jb 0x2908
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
btl $0x10, %esi
jae 0x2908
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_O3/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
testq %rdx, %rdx
je 0x2972
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r12
movl %edi, %ebp
xorl %ebx, %ebx
leaq (%r12,%rbx), %rsi
movq %r14, %rdx
subq %rbx, %rdx
leaq (%rbx,%r15), %rcx
movl %ebp, %edi
callq 0x2500
testq %rax, %rax
js 0x2976
je 0x2979
addq %rax, %rbx
cmpq %r14, %rbx
jb 0x2949
movq %r14, %rbx
jmp 0x2979
xorl %ebx, %ebx
jmp 0x2979
movq %rax, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
testq %rdx, %rdx
je 0x29c4
movq %rcx, %r14
movq %rdx, %rbx
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 0x29c8
addq %rax, %r12
cmpq %rbx, %r12
jb 0x29a0
jmp 0x29cb
xorl %ebx, %ebx
jmp 0x29cb
movq %rax, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
testl %edx, %edx
jle 0x2a82
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %ebp
movl %edx, %eax
shlq $0x4, %rax
xorl %ecx, %ecx
xorl %r12d, %r12d
addq 0x8(%r14,%rcx), %r12
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x29f9
testq %r12, %r12
je 0x2a82
xorl %r15d, %r15d
movl %ebp, %edi
movq %r14, %rsi
movl %ebx, %edx
callq 0x20c0
testq %rax, %rax
js 0x2a91
addq %rax, %r15
cmpq %r12, %r15
je 0x2a96
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
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x2a85
movq %r12, %r15
jmp 0x2a85
// File: /workspace/github_c_makefile_star2_O3/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 0x2b07
movq %rax, %rbx
movq %rax, %rdi
callq 0x2330
movq %rax, %r12
movq %r15, %rdi
callq 0x2560
testq %rax, %rax
je 0x2b0b
movq %rax, %r15
movq %rax, %rdi
callq 0x21e0
leaq 0x2920(%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 0x2b0d
xorl %ebp, %ebp
jmp 0x2b15
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_O3/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
movq %rax, %rbx
testq %rax, %rax
je 0x2bf1
movq %r14, (%rbx)
movl $0x0, 0x8(%rbx)
orl 0x28(%r14), %ebp
movl %ebp, 0xc(%rbx)
movq $0x0, 0x48(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
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
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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), %rdi
testq %rdi, %rdi
je 0x2c59
movq 0x18(%rdi), %rax
movq 0x40(%rdi), %r14
testq %rax, %rax
je 0x2c33
cmpl $0x2, 0x20(%rdi)
jne 0x2c33
movq %rax, %rdi
callq 0x2040
movq 0x48(%rbx), %rdi
movq 0x30(%rdi), %rax
testq %rax, %rax
je 0x2c48
movq %rax, %rdi
callq 0x2040
movq 0x48(%rbx), %rdi
callq 0x2040
movq %r14, 0x48(%rbx)
movq %r14, %rdi
testq %r14, %r14
jne 0x2c14
leaq 0x20(%rbx), %rdi
callq 0x21a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O3/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 0x3247
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl 0x10(%rdi), %ecx
movl 0x14(%rdi), %edx
movl %edx, %esi
addl %ecx, %esi
je 0x3239
movq 0x48(%r14), %r12
xorl %eax, %eax
xorl %ebp, %ebp
testq %r12, %r12
je 0x3220
movq %r12, %r13
movq 0x8(%r13), %r15
cmpq %r15, %rax
jl 0x320d
movq 0x40(%r13), %r12
cmpl $0x10000, %ebx          # imm = 0x10000
je 0x31e1
cmpl $0x110, %ebx            # imm = 0x110
jne 0x320a
movq (%r14), %rax
movl (%rax), %edi
movq 0x10(%r13), %rcx
movl $0x110, %esi            # imm = 0x110
movq %r15, %rdx
callq 0x2480
movl $0x1, %ecx
jmp 0x3200
cmpl $0x0, (%r13)
je 0x320a
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 0x3234
movl %ecx, (%r13)
movq %r15, %rax
movq 0x40(%r13), %r13
testq %r13, %r13
jne 0x31a7
movl 0x10(%r14), %ecx
movl 0x14(%r14), %edx
jmp 0x3223
xorl %r12d, %r12d
incl %ebp
leal (%rdx,%rcx), %esi
cmpl %esi, %ebp
jb 0x319f
xorl %eax, %eax
jmp 0x3239
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x368f
movq %rbx, %rdi
callq 0x22f0
movl 0x1c(%rbx), %edi
testl %edi, %edi
js 0x365c
xorl %r14d, %r14d
negl %eax
sbbl %r14d, %r14d
callq 0x2220
testl %eax, %eax
je 0x3663
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x3666
orl %r14d, %ebp
movl 0x18(%rbx), %edi
testl %edi, %edi
js 0x3676
callq 0x2220
testl %eax, %eax
je 0x367b
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x20(%rbx), %rdi
cmpq $-0x1, %rdi
je 0x368f
movl $0x4, %esi
callq 0x23e0
movl (%rbx), %edi
testl %edi, %edi
js 0x369e
callq 0x2220
testl %eax, %eax
je 0x36a3
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x36b1
callq 0x2040
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x36bf
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_O3/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 0x3734
callq 0x2080
movl %eax, %ebp
testl %eax, %eax
jne 0x3754
leaq 0x40(%rbx), %r14
movq %r14, %rdi
callq 0x2590
movq 0x30(%rbx), %r15
testq %r15, %r15
je 0x373b
movq (%r15), %rdi
movl $0x1, %esi
callq 0x23c0
testl %eax, %eax
jne 0x3747
movq 0x30(%rbx), %rdi
movq 0x8(%rdi), %r15
callq 0x2040
movq %r15, 0x30(%rbx)
jmp 0x370b
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x3754
movq $0x0, 0x38(%rbx)
xorl %ebp, %ebp
jmp 0x374c
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_O3/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 0x1cac(%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 0x37d7
movq %rax, %rdi
movq %r14, %rsi
callq 0x20a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x24e0
cmpl $-0x1, %eax
je 0x37ec
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2040
jmp 0x37dc
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 0x3802
cmpl $0x11, %eax
jne 0x37cd
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 0x37cd
leaq 0x1c0a(%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 0x37cb
movq %rsp, %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2130
xorl %ebp, %ebp
cmpl $-0x1, %eax
sete %bpl
negl %ebp
jmp 0x37cd
nop
// File: /workspace/github_c_makefile_star2_O3/albertito[P]libjio/libjio/check.c
// Function: jfsck_cleanup
static int jfsck_cleanup(const char *name, const char *jdir)
{
	char tfile[PATH_MAX*3];
	DIR *dir;
	struct dirent *dent;

	dir = opendir(jdir);
	if (dir == NULL && errno == ENOENT)
		/* it doesn't exist, so it's clean */
		return 0;
	else if (dir == NULL)
		return -1;

	for (errno = 0, dent = readdir(dir); dent != NULL;
			errno = 0, dent = readdir(dir)) {
		/* We only care about files we know, and ignore everything
		 * else. Note that transactions should have been removed by
		 * jfsck(), we will not do it to prevent accidental misuse */
		if (strcmp(dent->d_name, "lock"))
			continue;

		/* build the full path to the transaction file */
		memset(tfile, 0, PATH_MAX * 3);
		strcat(tfile, jdir);
		strcat(tfile, "/");
		strcat(tfile, dent->d_name);

		if (strlen(tfile) > PATH_MAX) {
			closedir(dir);
			return -1;
		}

		if (unlink(tfile) != 0) {
			closedir(dir);
			return -1;
		}
	}

	if (errno) {
		closedir(dir);
		return -1;
	}

	if (closedir(dir) != 0)
		return -1;

	if (rmdir(jdir) != 0)
		return -1;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3008, %rsp           # imm = 0x3008
movq %rdi, %rbx
callq 0x2120
movq %rax, %r14
callq 0x2070
movq %rax, %r15
testq %r14, %r14
je 0x3ed6
movl $0x0, (%r15)
movq %r14, %rdi
callq 0x2350
testq %rax, %rax
je 0x3eae
movq %rax, %rbp
leaq 0x1601(%rip), %r12      # 0x5433
movq %rsp, %r13
addq $0x13, %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x2290
testl %eax, %eax
jne 0x3e97
movl $0x3000, %edx           # imm = 0x3000
movq %r13, %rdi
xorl %esi, %esi
callq 0x2200
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2510
movq %r13, %rdi
callq 0x2140
movw $0x2f, (%rsp,%rax)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2510
movq %r13, %rdi
callq 0x2140
cmpq $0x1001, %rax           # imm = 0x1001
jae 0x3ee3
movq %r13, %rdi
callq 0x2090
testl %eax, %eax
jne 0x3ee3
movl $0x0, (%r15)
movq %r14, %rdi
callq 0x2350
movq %rax, %rbp
testq %rax, %rax
jne 0x3e35
movl (%r15), %ebp
movq %r14, %rdi
callq 0x2240
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orl %ebp, %ecx
jne 0x3ef0
movq %rbx, %rdi
callq 0x2130
movl %eax, %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
jmp 0x3ef0
xorl %eax, %eax
cmpl $0x2, (%r15)
setne %al
negl %eax
jmp 0x3ef0
movq %r14, %rdi
callq 0x2240
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x3008, %rsp           # imm = 0x3008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/albertito[P]libjio/libjio/journal.c
// Function: free_tid
static void free_tid(struct jfs *fs, unsigned int tid)
{
	unsigned int curid, i;
	char name[PATH_MAX];

	/* lock the whole file */
	plockf(fs->jfd, F_LOCKW, 0, 0);

	/* read the current max. curid */
	curid = *(fs->jmap);

	/* if we're the max tid, scan the directory looking up for the new
	 * max; the detailed description can be found in the "doc/" dir */
	if (tid == curid) {
		/* look up the new max. */
		for (i = curid - 1; i > 0; i--) {
			get_jtfile(fs, i, name);
			if (access(name, R_OK | W_OK) == 0) {
				break;
			} else if (errno != EACCES) {
				/* Real error, stop looking for a new max. It
				 * doesn't hurt us because it's ok if the max
				 * is higher than it could be */
				break;
			}
		}

		/* and save it */
		*(fs->jmap) = i;
	}

	plockf(fs->jfd, F_UNLOCK, 0, 0);
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movl %esi, %ebp
movq %rdi, %rbx
movl 0x1c(%rdi), %edi
movl $0x110, %esi            # imm = 0x110
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2480
movq 0x20(%rbx), %rax
cmpl %ebp, (%rax)
jne 0x4119
decl %ebp
movq %rsp, %r14
movl %ebp, %r15d
subl $0x1, %ebp
jb 0x4112
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x22c0
movq %r14, %rdi
movl $0x6, %esi
callq 0x24c0
testl %eax, %eax
je 0x4112
callq 0x2070
cmpl $0xd, (%rax)
je 0x40e1
movq 0x20(%rbx), %rax
movl %r15d, (%rax)
movl 0x1c(%rbx), %edi
movl $0x10000, %esi          # imm = 0x10000
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2480
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/albertito[P]libjio/libjio/journal.c
// Function: journal_add_op
int journal_add_op(struct journal_op *jop, unsigned char *buf, size_t len,
		off_t offset)
{
	ssize_t rv;
	struct on_disk_ophdr ophdr;
	struct iovec iov[2];

	ophdr.len = len;
	ophdr.offset = offset;
	ophdr_hton(&ophdr);

	iov[0].iov_base = (void *) &ophdr;
	iov[0].iov_len = sizeof(ophdr);
	jop->csum = checksum_buf(jop->csum, (unsigned char *) &ophdr,
			sizeof(ophdr));

	iov[1].iov_base = (void *) buf;
	iov[1].iov_len = len;
	jop->csum = checksum_buf(jop->csum, buf, len);

	fiu_exit_on("jio/commit/tf_pre_addop");

	rv = swritev(jop->fd, iov, 2);
	if (rv != sizeof(ophdr) + len)
		goto error;

	fiu_exit_on("jio/commit/tf_addop");

	jop->numops++;

	return 0;

error:
	return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl %r14d, %eax
bswapl %eax
leaq 0x4(%rsp), %r12
movl %eax, (%r12)
movq %rcx, %rdi
callq 0x25a0
movq %rax, 0x4(%r12)
leaq 0x10(%rsp), %r13
movq %r12, (%r13)
movq $0xc, 0x8(%r13)
movl 0x18(%rbx), %edi
movl $0xc, %edx
movq %r12, %rsi
callq 0x2230
movl %eax, 0x18(%rbx)
movq %r15, 0x10(%r13)
movq %r14, 0x18(%r13)
movl %eax, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2230
movl %eax, 0x18(%rbx)
movl 0x4(%rbx), %edi
movq %r13, %rsi
movl $0x2, %edx
callq 0x2420
movq %rax, %rcx
addq $0xc, %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %r14, %rcx
jne 0x41cb
incl 0x8(%rbx)
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/albertito[P]libjio/libjio/journal.c
// Function: journal_commit
int journal_commit(struct journal_op *jop)
{
	ssize_t rv;
	struct on_disk_ophdr ophdr;
	struct on_disk_trailer trailer;
	struct iovec iov[2];

	/* write the empty ophdr to mark there are no more operations, and
	 * then the trailer */
	ophdr.len = 0;
	ophdr.offset = 0;
	ophdr_hton(&ophdr);
	iov[0].iov_base = (void *) &ophdr;
	iov[0].iov_len = sizeof(ophdr);
	jop->csum = checksum_buf(jop->csum, (unsigned char *) &ophdr,
			sizeof(ophdr));

	trailer.checksum = jop->csum;
	trailer.numops = jop->numops;
	trailer_hton(&trailer);
	iov[1].iov_base = (void *) &trailer;
	iov[1].iov_len = sizeof(trailer);

	rv = swritev(jop->fd, iov, 2);
	if (rv != sizeof(ophdr) + sizeof(trailer))
		goto error;

	/* this is a simple but efficient optimization: instead of doing
	 * everything O_SYNC, we sync at this point only, this way we avoid
	 * doing a lot of very small writes; in case of a crash the
	 * transaction file is only useful if it's complete (ie. after this
	 * point) so we only flush here (both data and metadata) */
	if (fsync(jop->fd) != 0)
		goto error;
	if (fsync_dir(jop->fs->jdirfd) != 0)
		goto error;

	fiu_exit_on("jio/commit/tf_sync");

	return 0;

error:
	return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x14(%rsp), %r14
movl $0x0, (%r14)
xorl %edi, %edi
callq 0x25a0
movq %rax, 0x4(%r14)
leaq 0x20(%rsp), %r15
movq %r14, (%r15)
movq $0xc, 0x8(%r15)
movl 0x18(%rbx), %edi
movl $0xc, %edx
movq %r14, %rsi
callq 0x2230
movl %eax, 0x18(%rbx)
movl 0x8(%rbx), %ecx
bswapl %ecx
leaq 0xc(%rsp), %rdx
movl %ecx, (%rdx)
bswapl %eax
movl %eax, 0x4(%rdx)
movq %rdx, 0x10(%r15)
movq $0x8, 0x18(%r15)
movl 0x4(%rbx), %edi
movq %r15, %rsi
movl $0x2, %edx
callq 0x2420
cmpq $0x14, %rax
jne 0x427a
movl 0x4(%rbx), %edi
callq 0x2430
testl %eax, %eax
jne 0x427a
movq 0x20(%rbx), %rax
movl 0x18(%rax), %edi
callq 0x428d
testl %eax, %eax
je 0x4289
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
xorl %eax, %eax
jmp 0x427f
// File: /workspace/github_c_makefile_star2_O3/albertito[P]libjio/libjio/journal.c
// Function: journal_free
int journal_free(struct journal_op *jop, int do_unlink)
{
	int rv;

	if (!do_unlink) {
		rv = 0;
		goto exit;
	}

	rv = -1;

	if (unlink(jop->name)) {
		/* we do not want to leave a possibly complete transaction
		 * file around when the transaction was not commited and the
		 * unlink failed, so we attempt to truncate it, and if that
		 * fails we corrupt it as a last resort. */
		if (ftruncate(jop->fd, 0) != 0) {
			if (corrupt_journal_file(jop) != 0) {
				mark_broken(jop->fs);
				goto exit;
			}
		}
	}

	if (fsync_dir(jop->fs->jdirfd) != 0) {
		mark_broken(jop->fs);
		goto exit;
	}

	fiu_exit_on("jio/commit/pre_ok_free_tid");
	free_tid(jop->fs, jop->id);

	rv = 0;

exit:
	close(jop->fd);

	free(jop->name);
	free(jop);

	return rv;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %ebp, %ebp
testl %esi, %esi
je 0x436d
movq 0x10(%rbx), %rdi
callq 0x2090
testl %eax, %eax
je 0x4342
movl 0x4(%rbx), %edi
xorl %esi, %esi
callq 0x21d0
testl %eax, %eax
je 0x4342
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, (%rsp)
movl 0x4(%rbx), %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0x21f0
cmpq $-0x1, %rax
je 0x4338
movl 0x4(%rbx), %edi
movq %rsp, %rsi
movl $0x8, %edx
movq %rax, %rcx
callq 0x23f0
cmpq $0x8, %rax
jne 0x4338
movl 0x4(%rbx), %edi
callq 0x2080
testl %eax, %eax
je 0x4342
movq 0x20(%rbx), %rax
movq 0x10(%rax), %rdi
jmp 0x435a
movq 0x20(%rbx), %rax
movl 0x18(%rax), %edi
callq 0x428d
movq 0x20(%rbx), %rdi
testl %eax, %eax
je 0x4366
movq 0x10(%rdi), %rdi
callq 0x438f
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x436d
movl (%rbx), %esi
callq 0x40b1
movl 0x4(%rbx), %edi
callq 0x2220
movq 0x10(%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/albertito[P]libjio/libjio/journal.c
// Function: mark_broken
static int mark_broken(struct jfs *fs)
{
	char broken_path[PATH_MAX];
	int fd;

	snprintf(broken_path, PATH_MAX, "%s/broken", fs->jdir);
	fd = creat(broken_path, 0600);
	close(fd);

	return fd >= 0;
}

// Assembly:
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rdi, %rcx
leaq 0x109d(%rip), %rdx      # 0x543e
movq %rsp, %rbx
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21b0
movq %rbx, %rdi
movl $0x180, %esi            # imm = 0x180
callq 0x2520
movl %eax, %edi
callq 0x2220
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/albertito[P]libjio/libjio/unix.c
// Function: jwrite
ssize_t jwrite(struct jfs *fs, const void *buf, size_t count)
{
	ssize_t rv;
	off_t pos;
	struct jtrans *ts;

	ts = jtrans_new(fs, 0);
	if (ts == NULL)
		return -1;

	pthread_mutex_lock(&(fs->lock));

	if (fs->open_flags & O_APPEND)
		pos = lseek(fs->fd, 0, SEEK_END);
	else
		pos = lseek(fs->fd, 0, SEEK_CUR);

	rv = jtrans_add_w(ts, buf, count, pos);
	if (rv < 0)
		goto exit;

	rv = jtrans_commit(ts);

	if (rv >= 0)
		lseek(fs->fd, count, SEEK_CUR);

exit:

	pthread_mutex_unlock(&(fs->lock));

	jtrans_free(ts);

	return (rv >= 0) ? count : rv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r12
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x20d0
testq %rax, %rax
je 0x476e
movq %rax, %r14
leaq 0x68(%r12), %r15
movq %r15, %rdi
callq 0x2590
btl $0xa, 0x2c(%r12)
movl (%r12), %edi
adcl $0x1, %ebp
xorl %esi, %esi
movl %ebp, %edx
callq 0x21f0
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x2300
testl %eax, %eax
js 0x4777
movq %r14, %rdi
callq 0x24d0
movq %rax, %r13
testq %rax, %rax
js 0x477a
movl (%r12), %edi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x21f0
jmp 0x477a
movq $-0x1, %rbx
jmp 0x4791
movslq %eax, %r13
movq %r15, %rdi
callq 0x2370
movq %r14, %rdi
callq 0x2170
testq %r13, %r13
cmovsq %r13, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/albertito[P]libjio/libjio/unix.c
// Function: jpwrite
ssize_t jpwrite(struct jfs *fs, const void *buf, size_t count, off_t offset)
{
	ssize_t rv;
	struct jtrans *ts;

	ts = jtrans_new(fs, 0);
	if (ts == NULL)
		return -1;

	rv = jtrans_add_w(ts, buf, count, offset);
	if (rv < 0)
		goto exit;

	rv = jtrans_commit(ts);

exit:
	jtrans_free(ts);

	return (rv >= 0) ? count : rv;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r12
xorl %esi, %esi
callq 0x20d0
testq %rax, %rax
je 0x47e5
movq %rax, %r14
movq %rax, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x2300
testl %eax, %eax
js 0x47ee
movq %r14, %rdi
callq 0x24d0
movq %rax, %r15
jmp 0x47f1
movq $-0x1, %rbx
jmp 0x4800
movslq %eax, %r15
movq %r14, %rdi
callq 0x2170
testq %r15, %r15
cmovsq %r15, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/albertito[P]libjio/libjio/ansi.c
// Function: jfopen
struct jfs *jfopen(const char *path, const char *mode)
{
	int flags;
	int pos_at_the_beginning;
	struct jfs *fs;

	if (strlen(mode) < 1)
		return NULL;

	if (mode[0] == 'r') {
		pos_at_the_beginning = 1;
		if (strlen(mode) > 1 && strchr(mode, '+'))
			flags = O_RDWR;
		else
			flags = O_RDONLY;
	} else if (mode[0] == 'a') {
		if (strlen(mode) > 1 && strchr(mode, '+'))
			pos_at_the_beginning = 1;
		else
			pos_at_the_beginning = 0;
		flags = O_RDWR | O_CREAT | O_APPEND;
	} else if (mode[0] == 'w') {
		pos_at_the_beginning = 1;
		flags = O_RDWR | O_CREAT | O_TRUNC;
	} else {
		return NULL;
	}

	fs = jopen(path, flags, 0666, 0);
	if (fs == NULL)
		return NULL;

	if (pos_at_the_beginning)
		lseek(fs->fd, 0, SEEK_SET);
	else
		lseek(fs->fd, 0, SEEK_END);

	return fs;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2140
testq %rax, %rax
je 0x4a4f
movzbl (%r14), %ecx
cmpl $0x61, %ecx
je 0x49e6
cmpl $0x77, %ecx
je 0x49df
cmpl $0x72, %ecx
jne 0x4a4f
cmpq $0x1, %rax
je 0x49db
movq %r14, %rdi
movl $0x2b, %esi
callq 0x2180
movl $0x2, %esi
testq %rax, %rax
jne 0x4a03
xorl %esi, %esi
jmp 0x4a03
movl $0x242, %esi            # imm = 0x242
jmp 0x4a03
cmpq $0x1, %rax
je 0x4a1f
movq %r14, %rdi
movl $0x2b, %esi
callq 0x2180
movl $0x442, %esi            # imm = 0x442
testq %rax, %rax
je 0x4a1f
xorl %r14d, %r14d
movq %rbx, %rdi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %ecx, %ecx
callq 0x22b0
testq %rax, %rax
je 0x4a4f
movq %rax, %rbx
jmp 0x4a41
movq %rbx, %rdi
movl $0x442, %esi            # imm = 0x442
movl $0x1b6, %edx            # imm = 0x1B6
xorl %ecx, %ecx
callq 0x22b0
testq %rax, %rax
je 0x4a4f
movq %rax, %rbx
movl $0x2, %r14d
movl (%rbx), %edi
xorl %esi, %esi
movl %r14d, %edx
callq 0x21f0
jmp 0x4a51
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/albertito[P]libjio/libjio/ansi.c
// Function: jfreopen
struct jfs *jfreopen(const char *path, const char *mode, struct jfs *stream)
{
	if (stream)
		jfclose(stream);

	stream = jfopen(path, mode);
	return stream;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x4aa1
movq %rdx, %r15
movq %rdx, %rdi
callq 0x2490
movq %r15, %rdi
callq 0x2040
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2310
// File: /workspace/github_c_makefile_star2_O3/hansvanstaveren[P]BigDeal/main.c
// Function: hexval
static int
hexval(char c)
/*
 * Convert characters '0'..'9', 'A'..'F' and 'a'..'f' to 0..15
 */
{

	if (c >= '0' && c <= '9')
		return c - '0';
	if (c >= 'a' && c <= 'f')
		return c - 'a' + 10;
	if (c >= 'A' && c <= 'F')
		return c - 'A' + 10;
	fprintf(stderr, "Character %c is not a hexchar\n", c);
	exit(-1);
}

// Assembly:
leal -0x30(%rdi), %ecx
movl $0xffffffd0, %eax       # imm = 0xFFFFFFD0
cmpb $0xa, %cl
jb 0x4a05
leal -0x61(%rdi), %ecx
movl $0xffffffa9, %eax       # imm = 0xFFFFFFA9
cmpb $0x6, %cl
jb 0x4a05
leal -0x41(%rdi), %ecx
movl $0xffffffc9, %eax       # imm = 0xFFFFFFC9
cmpb $0x6, %cl
jae 0x4a08
addl %edi, %eax
retq
pushq %rax
callq 0x2339
nop
// File: /workspace/github_c_makefile_star2_O3/hansvanstaveren[P]BigDeal/output.c
// Function: init_goedel
static void
init_goedel(FILE *out)
{
	int i;
	byte ten[L];

	/*
	 * Initialize the array with powers of ten
	 * We need them in the next function
	 */
	mp96_zero(ten);
	ten[L-1] = 10;
	mp96_one(powers_of_ten[0]);
	for (i=1; i<MAXDECIMALS; i++) {
		mp96_mul(powers_of_ten[i], powers_of_ten[i-1], ten);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0xc(%rsp), %rbx
movq %rbx, %rdi
callq 0x3860
movb $0xa, 0xb(%rbx)
leaq 0x855e(%rip), %r14      # 0xdd80
movq %r14, %rdi
callq 0x386f
movl $0x1c, %r12d
leaq 0xc(%r14), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3906
movq %r15, %r14
decq %r12
jne 0x5830
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/hansvanstaveren[P]BigDeal/output.c
// Function: print_goedel
static void
print_goedel(FILE *out, int boardno, hr_p hrp)
/*
 * Write out the internal 96 bit numbers as a decimal number
 *
 * Unlikely that anyone would ever want this in real life
 */
{
	dl_num *dnp = hrp->hr_value.hv_dnp;
	byte value[L];
	int i;
	int decimal;
	int zero_suppress;
	char outchar;

	mp96_assign(value, dnp->dn_num);
	zero_suppress = 1;
	for (i=MAXDECIMALS-1; i>=0; i--) {
		/*
		 * Since we do not have division we do repeated subtraction
		 */
		decimal = 0;
		while (mp96_cmp(value, powers_of_ten[i])>=0) {
			mp96_sub(value, value, powers_of_ten[i]);
			decimal++;
		}
		if (decimal) {
			outchar = decimal + '0';
			zero_suppress = 0;
		} else {
			/*
			 * Suppress leading zeroes
			 * Special case all zeroes also handled
			 * That will be the day....
			 */
			outchar = zero_suppress && i ? ' ' : '0';
		}
		putc(outchar, out);
		/*
		 * Intersperse with commas for readability
		 */
		if (i%3 == 0) {
			putc(i==0 ? '\n' : zero_suppress ? ' ' : ',', out);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x8(%rdx), %rsi
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x3882
movl $0x1, %ebp
movl $0x1c, %r12d
leaq (%r12,%r12,2), %rax
leaq 0x84f2(%rip), %rcx      # 0xdd80
leaq (%rcx,%rax,4), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x38e8
testl %eax, %eax
js 0x58cb
movl $0x30, %r13d
movq %r14, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x38bd
movq %r14, %rdi
movq %r15, %rsi
callq 0x38e8
incl %r13d
testl %eax, %eax
jns 0x58a7
xorl %ebp, %ebp
jmp 0x58e8
xorl %r13d, %r13d
testl %ebp, %ebp
sete %r13b
shll $0x4, %r13d
orl $0x20, %r13d
testq %r12, %r12
movl $0x30, %eax
cmovel %eax, %r13d
movsbl %r13b, %edi
movq %rbx, %rsi
callq 0x2160
imull $0xaaaaaaab, %r12d, %eax # imm = 0xAAAAAAAB
cmpl $0x55555555, %eax       # imm = 0x55555555
ja 0x5924
testl %ebp, %ebp
movl $0x20, %edi
movl $0x2c, %eax
cmovel %eax, %edi
testq %r12, %r12
movl $0xa, %eax
cmovel %eax, %edi
movq %rbx, %rsi
callq 0x2160
subq $0x1, %r12
jae 0x5883
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq