LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x2b6f
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
addq -0x38(%rbp), %rsi
movq -0x20(%rbp), %rdx
subq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq -0x38(%rbp), %rcx
callq 0x2550
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x2b4e
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2b77
cmpq $0x0, -0x30(%rbp)
jne 0x2b5f
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2b77
jmp 0x2b61
movq -0x30(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x2b0f
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x2bfc
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
addq -0x38(%rbp), %rsi
movq -0x20(%rbp), %rdx
subq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq -0x38(%rbp), %rcx
callq 0x2420
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x2bee
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2c04
movq -0x30(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x2baf
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2c5f
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2c31
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x2d92
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x20c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jge 0x2c9c
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2d9a
movq -0x28(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x40(%rbp), %rax
jne 0x2cb7
jmp 0x2d92
movq $0x0, -0x38(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2d6f
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq -0x20(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
addq 0x8(%rcx), %rax
cmpq -0x28(%rbp), %rax
jbe 0x2d44
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
addq -0x28(%rbp), %rcx
xorl %eax, %eax
subq -0x38(%rbp), %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rdx
subq -0x38(%rbp), %rdx
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x8(%rax)
jmp 0x2d6f
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x2d61
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2cc6
movl -0x20(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x2c67
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x25c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x2ddd
movl $0x0, -0x4(%rbp)
jmp 0x2e55
movq -0x28(%rbp), %rdi
callq 0x2360
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x25c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x2e10
movq -0x28(%rbp), %rdi
callq 0x2040
movl $0x0, -0x4(%rbp)
jmp 0x2e55
movq -0x38(%rbp), %rdi
callq 0x21f0
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %r8
movl $0x1000, %esi           # imm = 0x1000
leaq 0x41cb(%rip), %rdx      # 0x7000
movb $0x0, %al
callq 0x21c0
movq -0x28(%rbp), %rdi
callq 0x2040
movq -0x38(%rbp), %rdi
callq 0x2040
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/common.c
// Function: ntohll
uint64_t ntohll(uint64_t x)
{
	static int endianness = 0;

	/* determine the endianness by checking how htonl() behaves; use -1
	 * for little endian and 1 for big endian */
	if (endianness == 0) {
		if (htonl(1) == 1)
			endianness = 1;
		else
			endianness = -1;
	}

	if (endianness == 1) {
		/* big endian */
		return x;
	}

	/* little endian */
	return ( ntohl( (x >> 32) & 0xFFFFFFFF ) | \
			( (uint64_t) ntohl(x & 0xFFFFFFFF) ) << 32 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpl $0x0, 0x6871(%rip)      # 0x9724
jne 0x2edc
movl $0x1, %edi
callq 0x2210
cmpl $0x1, %eax
jne 0x2ed0
movl $0x1, 0x6856(%rip)      # 0x9724
jmp 0x2eda
movl $0xffffffff, 0x684a(%rip) # imm = 0xFFFFFFFF
jmp 0x2edc
cmpl $0x1, 0x6841(%rip)      # 0x9724
jne 0x2eef
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2f39
movq -0x10(%rbp), %rax
shrq $0x20, %rax
movabsq $0xffffffff, %rcx       # imm = 0xFFFFFFFF
andq %rcx, %rax
movl %eax, %edi
callq 0x25b0
movl %eax, %eax
movq %rax, -0x18(%rbp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0x10(%rbp), %rax
movl %eax, %edi
callq 0x25b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, %ecx
shlq $0x20, %rcx
orq %rcx, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/common.c
// Function: htonll
uint64_t htonll(uint64_t x)
{
	static int endianness = 0;

	/* determine the endianness by checking how htonl() behaves; use -1
	 * for little endian and 1 for big endian */
	if (endianness == 0) {
		if (htonl(1) == 1)
			endianness = 1;
		else
			endianness = -1;
	}

	if (endianness == 1) {
		/* big endian */
		return x;
	}

	/* little endian */
	return ( htonl( (x >> 32) & 0xFFFFFFFF ) | \
			( (uint64_t) htonl(x & 0xFFFFFFFF) ) << 32 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpl $0x0, 0x67c5(%rip)      # 0x9728
jne 0x2f8c
movl $0x1, %edi
callq 0x2210
cmpl $0x1, %eax
jne 0x2f80
movl $0x1, 0x67aa(%rip)      # 0x9728
jmp 0x2f8a
movl $0xffffffff, 0x679e(%rip) # imm = 0xFFFFFFFF
jmp 0x2f8c
cmpl $0x1, 0x6795(%rip)      # 0x9728
jne 0x2f9f
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2fe9
movq -0x10(%rbp), %rax
shrq $0x20, %rax
movabsq $0xffffffff, %rcx       # imm = 0xFFFFFFFF
andq %rcx, %rax
movl %eax, %edi
callq 0x2210
movl %eax, %eax
movq %rax, -0x18(%rbp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0x10(%rbp), %rax
movl %eax, %edi
callq 0x2210
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, %ecx
shlq $0x20, %rcx
orq %rcx, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x50, %edi
callq 0x23c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x3091
movq $0x0, -0x8(%rbp)
jmp 0x311c
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %ecx
orl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
leaq -0x18(%rbp), %rdi
callq 0x2590
leaq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x21d0
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
leaq -0x18(%rbp), %rsi
callq 0x25d0
leaq -0x18(%rbp), %rdi
callq 0x25e0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x31ce
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x40(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0x3190
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x2, 0x20(%rax)
jne 0x3190
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x2040
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, 0x30(%rax)
je 0x31b0
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x30(%rax), %rdi
callq 0x2040
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x2040
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
jmp 0x3147
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
callq 0x21b0
movq -0x8(%rbp), %rdi
callq 0x2040
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x3aaa
movl $0x0, -0x4(%rbp)
jmp 0x3be3
movl $0x0, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
movq -0x10(%rbp), %rdx
addl 0x14(%rdx), %ecx
cmpl %ecx, %eax
jae 0x3bd3
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x3bc5
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x3b04
jmp 0x3bb4
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x110, -0x14(%rbp)     # imm = 0x110
jne 0x3b64
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl (%rax), %edi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
movl $0x110, %esi            # imm = 0x110
callq 0x24d0
movq %rax, -0x20(%rbp)
cmpq $-0x1, -0x20(%rbp)
jne 0x3b58
jmp 0x3bdc
movq -0x30(%rbp), %rax
movl $0x1, (%rax)
jmp 0x3bb2
cmpl $0x10000, -0x14(%rbp)   # imm = 0x10000
jne 0x3bb0
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3bb0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl (%rax), %edi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
movl $0x10000, %esi          # imm = 0x10000
callq 0x24d0
movq %rax, -0x20(%rbp)
cmpq $-0x1, -0x20(%rbp)
jne 0x3ba6
jmp 0x3bdc
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
jmp 0x3bb2
jmp 0x3bb4
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x3ae6
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x3ac5
movl $0x0, -0x4(%rbp)
jmp 0x3be3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/trans.c
// Function: operation_read_prev
static int operation_read_prev(struct jtrans *ts, struct operation *op)
{
	ssize_t rv;

	op->pdata = malloc(op->len);
	if (op->pdata == NULL)
		return -1;

	rv = spread(ts->fs->fd, op->pdata, op->len,
			op->offset);
	if (rv < 0) {
		free(op->pdata);
		op->pdata = NULL;
		return -1;
	}

	op->plen = op->len;
	if (rv < op->len) {
		/* we are extending the file! */
		/* ftruncate(ts->fs->fd, op->offset + op->len); */
		op->plen = rv;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x23c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x3c2f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3cb3
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl (%rax), %edi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
callq 0x2300
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jge 0x3c82
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x2040
movq -0x18(%rbp), %rax
movq $0x0, 0x30(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3cb3
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x3cac
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2230
cmpl $0x0, %eax
je 0x4368
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movl 0x28(%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
jne 0x43f7
movq -0x8(%rbp), %rdi
callq 0x2320
cmpl $0x0, %eax
je 0x438e
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jl 0x43a9
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %edi
callq 0x2240
cmpl $0x0, %eax
je 0x43b0
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jl 0x43cb
movq -0x8(%rbp), %rax
movl 0x18(%rax), %edi
callq 0x2240
cmpl $0x0, %eax
je 0x43d2
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movq $-0x1, %rcx
cmpq %rcx, 0x20(%rax)
je 0x43f5
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movl $0x4, %esi
callq 0x2410
jmp 0x43f7
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
jl 0x4410
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x2240
cmpl $0x0, %eax
je 0x4417
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x442f
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x4447
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2040
movq -0x8(%rbp), %rdi
addq $0x68, %rdi
callq 0x21b0
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
callq 0x21b0
movq -0x8(%rbp), %rdi
callq 0x2040
movl -0xc(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jge 0x44a1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4553
movq -0x10(%rbp), %rax
movl (%rax), %edi
callq 0x2080
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x44c0
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4553
movq -0x10(%rbp), %rdi
addq $0x40, %rdi
callq 0x25f0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x4533
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq (%rax), %rdi
movl $0x1, %esi
callq 0x23f0
cmpl $0x0, %eax
je 0x4508
movq -0x10(%rbp), %rdi
addq $0x40, %rdi
callq 0x23a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4553
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x2040
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
jmp 0x44cd
movq -0x10(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x10(%rbp), %rdi
addq $0x40, %rdi
callq 0x23a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x3030, %rsp           # imm = 0x3030
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2120
movq %rax, -0x3028(%rbp)
cmpq $0x0, -0x3028(%rbp)
jne 0x4f43
callq 0x2070
cmpl $0x2, (%rax)
jne 0x4f43
movl $0x0, -0x4(%rbp)
jmp 0x50c3
cmpq $0x0, -0x3028(%rbp)
jne 0x4f59
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x50c3
jmp 0x4f5b
callq 0x2070
movl $0x0, (%rax)
movq -0x3028(%rbp), %rdi
callq 0x2380
movq %rax, -0x3030(%rbp)
cmpq $0x0, -0x3030(%rbp)
je 0x506c
movq -0x3030(%rbp), %rdi
addq $0x13, %rdi
leaq 0x2082(%rip), %rsi      # 0x701b
callq 0x22b0
cmpl $0x0, %eax
je 0x4fa8
jmp 0x5049
leaq -0x3020(%rbp), %rdi
xorl %esi, %esi
movl $0x3000, %edx           # imm = 0x3000
callq 0x2220
leaq -0x3020(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2560
leaq -0x3020(%rbp), %rdi
leaq 0x2057(%rip), %rsi      # 0x7030
callq 0x2560
leaq -0x3020(%rbp), %rdi
movq -0x3030(%rbp), %rsi
addq $0x13, %rsi
callq 0x2560
leaq -0x3020(%rbp), %rdi
callq 0x2140
cmpq $0x1000, %rax           # imm = 0x1000
jbe 0x5021
movq -0x3028(%rbp), %rdi
callq 0x2260
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x50c3
leaq -0x3020(%rbp), %rdi
callq 0x2090
cmpl $0x0, %eax
je 0x5047
movq -0x3028(%rbp), %rdi
callq 0x2260
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x50c3
jmp 0x5049
callq 0x2070
movl $0x0, (%rax)
movq -0x3028(%rbp), %rdi
callq 0x2380
movq %rax, -0x3030(%rbp)
jmp 0x4f79
callq 0x2070
cmpl $0x0, (%rax)
je 0x508b
movq -0x3028(%rbp), %rdi
callq 0x2260
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x50c3
movq -0x3028(%rbp), %rdi
callq 0x2260
cmpl $0x0, %eax
je 0x50a5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x50c3
movq -0x18(%rbp), %rdi
callq 0x2130
cmpl $0x0, %eax
je 0x50bc
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x50c3
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x3030, %rsp           # imm = 0x3030
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/journal.c
// Function: get_tid
static unsigned int get_tid(struct jfs *fs)
{
	unsigned int curid, rv;

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

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

	fiu_do_on("jio/get_tid/overflow", curid = -1);

	/* increment it and handle overflows */
	rv = curid + 1;
	if (rv == 0)
		goto exit;

	/* write to the file descriptor */
	*(fs->jmap) = rv;

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %edi
movl $0x110, %esi            # imm = 0x110
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x24d0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl (%rax), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0x5342
jmp 0x534f
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %edi
movl $0x10000, %esi          # imm = 0x10000
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x24d0
movl -0x10(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1020, %rsp           # imm = 0x1020
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %edi
movl $0x110, %esi            # imm = 0x110
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x24d0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jne 0x5471
movl -0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jbe 0x5464
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
leaq -0x1020(%rbp), %rdx
callq 0x22e0
leaq -0x1020(%rbp), %rdi
movl $0x6, %esi
callq 0x2510
cmpl $0x0, %eax
jne 0x5449
jmp 0x5464
callq 0x2070
cmpl $0xd, (%rax)
je 0x5455
jmp 0x5464
jmp 0x5457
jmp 0x5459
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5418
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %edi
movl $0x10000, %esi          # imm = 0x10000
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x24d0
addq $0x1020, %rsp           # imm = 0x1020
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x3c(%rbp), %rdi
callq 0x5580
leaq -0x3c(%rbp), %rax
movq %rax, -0x60(%rbp)
movq $0xc, -0x58(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
leaq -0x3c(%rbp), %rsi
movl $0xc, %edx
callq 0x2250
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x2250
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
leaq -0x60(%rbp), %rsi
movl $0x2, %edx
callq 0x2460
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $0xc, %rcx
cmpq %rcx, %rax
je 0x5557
jmp 0x556d
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x5574
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x24(%rbp)
movq $0x0, -0x20(%rbp)
leaq -0x24(%rbp), %rdi
callq 0x5580
leaq -0x24(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0xc, -0x48(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
leaq -0x24(%rbp), %rsi
movl $0xc, %edx
callq 0x2250
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
leaq -0x2c(%rbp), %rdi
callq 0x56e0
leaq -0x2c(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x8, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
leaq -0x50(%rbp), %rsi
movl $0x2, %edx
callq 0x2460
movq %rax, -0x18(%rbp)
cmpq $0x14, -0x18(%rbp)
je 0x5691
jmp 0x56c4
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x2470
cmpl $0x0, %eax
je 0x56a4
jmp 0x56c4
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x18(%rax), %edi
callq 0x5720
cmpl $0x0, %eax
je 0x56bb
jmp 0x56c4
movl $0x0, -0x4(%rbp)
jmp 0x56cb
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/journal.c
// Function: fsync_dir
static int fsync_dir(int fd)
{
	int rv;

	rv = fsync(fd);

	if (rv != 0 && (errno == EINVAL || errno == EBADF)) {
		/* it seems to be legal that fsync() on directories is not
		 * implemented, so if this fails with EINVAL or EBADF, just
		 * call a global sync(); which is awful (and might still
		 * return before metadata is done) but it seems to be the
		 * saner choice; otherwise we just fail */
		sync();
		rv = 0;

		if (!already_warned_about_sync) {
			fprintf(stderr, "libjio warning: falling back on " \
					"sync() for directory syncing\n");
			already_warned_about_sync = 1;
		}
	}

	return rv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %edi
callq 0x2470
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x5789
callq 0x2070
cmpl $0x16, (%rax)
je 0x5750
callq 0x2070
cmpl $0x9, (%rax)
jne 0x5789
callq 0x2390
movl $0x0, -0x8(%rbp)
cmpl $0x0, 0x3fc9(%rip)      # 0x972c
jne 0x5787
movq 0x388c(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x18bc(%rip), %rsi      # 0x7032
movb $0x0, %al
callq 0x22f0
movl $0x1, 0x3fa5(%rip)      # 0x972c
jmp 0x5789
movl -0x8(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x57c1
movl $0x0, -0x10(%rbp)
jmp 0x584e
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2090
cmpl $0x0, %eax
je 0x5810
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x21e0
cmpl $0x0, %eax
je 0x580e
movq -0x8(%rbp), %rdi
callq 0x5880
cmpl $0x0, %eax
je 0x580c
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x5920
jmp 0x584e
jmp 0x580e
jmp 0x5810
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x18(%rax), %edi
callq 0x5720
cmpl $0x0, %eax
je 0x5834
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x5920
jmp 0x584e
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %esi
callq 0x53d0
movl $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x2240
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2040
movq -0x8(%rbp), %rdi
callq 0x2040
movl -0x10(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/journal.c
// Function: corrupt_journal_file
static int corrupt_journal_file(struct journal_op *jop)
{
	off_t pos;
	struct on_disk_trailer trailer;

	/* We set the number of operations to 0, and the checksum to
	 * 0xffffffff, so there is no chance it's considered valid after a new
	 * transaction overwrites this one */
	trailer.numops = 0;
	trailer.checksum = 0xffffffff;

	pos = lseek(jop->fd, 0, SEEK_END);
	if (pos == (off_t) -1)
		return -1;

	if (pwrite(jop->fd, (void *) &trailer, sizeof(trailer), pos)
			!= sizeof(trailer))
		return -1;

	if (fdatasync(jop->fd) != 0)
		return -1;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x20(%rbp)
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x2200
movq %rax, -0x18(%rbp)
cmpq $-0x1, -0x18(%rbp)
jne 0x58c3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x590c
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x18(%rbp), %rcx
leaq -0x20(%rbp), %rsi
movl $0x8, %edx
callq 0x2420
cmpq $0x8, %rax
je 0x58eb
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x590c
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x2080
cmpl $0x0, %eax
je 0x5905
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x590c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x1020, %rsp           # imm = 0x1020
movq %rdi, -0x8(%rbp)
leaq -0x1010(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x16dc(%rip), %rdx      # 0x7026
movb $0x0, %al
callq 0x21c0
leaq -0x1010(%rbp), %rdi
movl $0x180, %esi            # imm = 0x180
callq 0x2570
movl %eax, -0x1014(%rbp)
movl -0x1014(%rbp), %edi
callq 0x2240
cmpl $0x0, -0x1014(%rbp)
setge %al
andb $0x1, %al
movzbl %al, %eax
addq $0x1020, %rsp           # imm = 0x1020
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/unix.c
// Function: jread
ssize_t jread(struct jfs *fs, void *buf, size_t count)
{
	ssize_t rv;
	off_t pos;

	pthread_mutex_lock(&(fs->lock));

	pos = lseek(fs->fd, 0, SEEK_CUR);

	plockf(fs->fd, F_LOCKR, pos, count);
	rv = spread(fs->fd, buf, count, pos);
	plockf(fs->fd, F_UNLOCK, pos, count);

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

	pthread_mutex_unlock(&(fs->lock));

	return rv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
addq $0x68, %rdi
callq 0x25f0
movq -0x8(%rbp), %rax
movl (%rax), %edi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x2200
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x101, %esi            # imm = 0x101
callq 0x24d0
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x2300
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x10000, %esi          # imm = 0x10000
callq 0x24d0
cmpq $0x0, -0x20(%rbp)
jle 0x5ddf
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x20(%rbp), %rsi
movl $0x1, %edx
callq 0x2200
movq -0x8(%rbp), %rdi
addq $0x68, %rdi
callq 0x23a0
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/unix.c
// Function: jpread
ssize_t jpread(struct jfs *fs, void *buf, size_t count, off_t offset)
{
	ssize_t rv;

	plockf(fs->fd, F_LOCKR, offset, count);
	rv = spread(fs->fd, buf, count, offset);
	plockf(fs->fd, F_UNLOCK, offset, count);

	return rv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x101, %esi            # imm = 0x101
callq 0x24d0
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x2300
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x10000, %esi          # imm = 0x10000
callq 0x24d0
movq -0x28(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/unix.c
// Function: jreadv
ssize_t jreadv(struct jfs *fs, const struct iovec *vector, int count)
{
	ssize_t rv;
	off_t pos;

	pthread_mutex_lock(&(fs->lock));
	pos = lseek(fs->fd, 0, SEEK_CUR);
	if (pos < 0)
		return -1;

	plockf(fs->fd, F_LOCKR, pos, count);
	rv = readv(fs->fd, vector, count);
	plockf(fs->fd, F_UNLOCK, pos, count);

	pthread_mutex_unlock(&(fs->lock));

	return rv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
callq 0x25f0
movq -0x10(%rbp), %rax
movl (%rax), %edi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x2200
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x5eb9
movq $-0x1, -0x8(%rbp)
jmp 0x5f14
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x30(%rbp), %rdx
movslq -0x1c(%rbp), %rcx
movl $0x101, %esi            # imm = 0x101
callq 0x24d0
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x2440
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x30(%rbp), %rdx
movslq -0x1c(%rbp), %rcx
movl $0x10000, %esi          # imm = 0x10000
callq 0x24d0
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
callq 0x23a0
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x20d0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x5f57
movq $-0x1, -0x8(%rbp)
jmp 0x602c
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
callq 0x25f0
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x5f8f
movq -0x10(%rbp), %rax
movl (%rax), %edi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x2200
movq %rax, -0x30(%rbp)
jmp 0x5fa7
movq -0x10(%rbp), %rax
movl (%rax), %edi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x2200
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x2330
cltq
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jge 0x5fcb
jmp 0x5ff5
movq -0x38(%rbp), %rdi
callq 0x2520
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jl 0x5ff3
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x20(%rbp), %rsi
movl $0x1, %edx
callq 0x2200
jmp 0x5ff5
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
callq 0x23a0
movq -0x38(%rbp), %rdi
callq 0x2170
cmpq $0x0, -0x28(%rbp)
jl 0x601c
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x6024
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x20d0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x6078
movq $-0x1, -0x8(%rbp)
jmp 0x60d3
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x2330
cltq
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x609c
jmp 0x60a9
movq -0x38(%rbp), %rdi
callq 0x2520
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2170
cmpq $0x0, -0x30(%rbp)
jl 0x60c3
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x60cb
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/unix.c
// Function: jwritev
ssize_t jwritev(struct jfs *fs, const struct iovec *vector, int count)
{
	int i;
	size_t sum;
	ssize_t rv;
	off_t ipos, t;
	struct jtrans *ts;

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

	pthread_mutex_lock(&(fs->lock));

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

	t = ipos;

	sum = 0;
	for (i = 0; i < count; i++) {
		rv = jtrans_add_w(ts, vector[i].iov_base,
				vector[i].iov_len, t);
		if (rv < 0)
			goto exit;

		sum += vector[i].iov_len;
		t += vector[i].iov_len;
	}

	rv = jtrans_commit(ts);

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

exit:
	pthread_mutex_unlock(&(fs->lock));

	jtrans_free(ts);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x20d0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x6116
movq $-0x1, -0x8(%rbp)
jmp 0x626f
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
callq 0x25f0
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x614e
movq -0x10(%rbp), %rax
movl (%rax), %edi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x2200
movq %rax, -0x38(%rbp)
jmp 0x6166
movq -0x10(%rbp), %rax
movl (%rax), %edi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x2200
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x620e
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
movq -0x40(%rbp), %rcx
callq 0x2330
cltq
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x61ca
jmp 0x6238
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x617d
movq -0x48(%rbp), %rdi
callq 0x2520
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jl 0x6236
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x28(%rbp), %rsi
movl $0x1, %edx
callq 0x2200
jmp 0x6238
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
callq 0x23a0
movq -0x48(%rbp), %rdi
callq 0x2170
cmpq $0x0, -0x30(%rbp)
jl 0x625f
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x6267
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/albertito[P]libjio/libjio/unix.c
// Function: jtruncate
int jtruncate(struct jfs *fs, off_t length)
{
	int rv;

	/* lock from length to the end of file */
	plockf(fs->fd, F_LOCKW, length, 0);
	rv = ftruncate(fs->fd, length);
	plockf(fs->fd, F_UNLOCK, length, 0);

	return rv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rdx
movl $0x110, %esi            # imm = 0x110
xorl %eax, %eax
movl %eax, %ecx
callq 0x24d0
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rsi
callq 0x21e0
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rdx
movl $0x10000, %esi          # imm = 0x10000
xorl %eax, %eax
movl %eax, %ecx
callq 0x24d0
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)