LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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 0x2570
testq %rax, %rax
je 0x2aaf
movq %rax, %rbx
movq %rax, %rdi
callq 0x2330
movq %rax, %r12
movq %r15, %rdi
callq 0x2570
testq %rax, %rax
je 0x2ab3
movq %rax, %r15
movq %rax, %rdi
callq 0x21e0
leaq 0x2976(%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
pushq $0x1
popq %rbp
movq %r15, %rbx
jmp 0x2ab5
xorl %ebp, %ebp
jmp 0x2abd
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_O2/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
pushq $0x50
popq %rdi
callq 0x2390
movq %rax, %rbx
testq %rax, %rax
je 0x2b8d
movq %r14, (%rbx)
andl $0x0, 0x8(%rbx)
orl 0x28(%r14), %ebp
movl %ebp, 0xc(%rbx)
andq $0x0, 0x48(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x2550
movq %r14, %rdi
xorl %esi, %esi
callq 0x21c0
movq %rbx, %rdi
addq $0x20, %rdi
movq %r14, %rsi
callq 0x2580
movq %r14, %rdi
callq 0x2590
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, (%rdi)
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x2be4
movq 0x18(%rax), %rdi
movq 0x40(%rax), %r14
testq %rdi, %rdi
je 0x2bc9
cmpl $0x2, 0x20(%rax)
jne 0x2bc9
callq 0x2040
movq 0x48(%rbx), %rax
movq 0x30(%rax), %rdi
callq 0x2040
movq 0x48(%rbx), %rdi
callq 0x2040
movq %r14, 0x48(%rbx)
movq %r14, %rax
jmp 0x2ba8
leaq 0x20(%rbx), %rdi
callq 0x21a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O2/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 0x31b4
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
movq 0x48(%rdi), %r13
xorl %ebx, %ebx
xorl %eax, %eax
movl 0x14(%r14), %ecx
addl 0x10(%r14), %ecx
cmpl %ecx, %ebx
jae 0x31b5
movq %r13, %r12
testq %r13, %r13
je 0x3199
movq 0x8(%r13), %r15
cmpq %r15, %rax
jl 0x3193
movq 0x40(%r13), %r12
cmpl $0x10000, %ebp          # imm = 0x10000
je 0x3167
cmpl $0x110, %ebp            # imm = 0x110
jne 0x3190
movq (%r14), %rax
movl (%rax), %edi
movq 0x10(%r13), %rcx
movl $0x110, %esi            # imm = 0x110
movq %r15, %rdx
callq 0x2480
pushq $0x1
popq %rcx
jmp 0x3186
cmpl $0x0, (%r13)
je 0x3190
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 0x31a3
movl %ecx, (%r13)
movq %r15, %rax
movq 0x40(%r13), %r13
jmp 0x312a
incl %ebx
movq %r12, %r13
jmp 0x3117
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x31a6
// File: /workspace/github_c_makefile_star2_O2/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 0x35d1
movq %rbx, %rdi
callq 0x22f0
movl 0x1c(%rbx), %edi
testl %edi, %edi
js 0x35a4
xorl %r14d, %r14d
negl %eax
sbbl %r14d, %r14d
callq 0x2220
testl %eax, %eax
je 0x35a9
pushq $-0x1
popq %rbp
jmp 0x35ac
orl %r14d, %ebp
movl 0x18(%rbx), %edi
testl %edi, %edi
js 0x35bc
callq 0x2220
testl %eax, %eax
je 0x35bf
pushq $-0x1
popq %rbp
movq 0x20(%rbx), %rdi
cmpq $-0x1, %rdi
je 0x35d1
pushq $0x4
popq %rsi
callq 0x23e0
movl (%rbx), %edi
testl %edi, %edi
js 0x35e0
callq 0x2220
testl %eax, %eax
je 0x35e3
pushq $-0x1
popq %rbp
movq 0x8(%rbx), %rdi
callq 0x2040
movq 0x10(%rbx), %rdi
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_O2/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 %r12
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
testl %edi, %edi
js 0x3671
callq 0x2080
movl %eax, %ebp
testl %eax, %eax
jne 0x3685
leaq 0x40(%rbx), %r14
movq %r14, %rdi
callq 0x25a0
movq 0x30(%rbx), %r12
pushq $0x1
popq %r15
pushq $-0x1
popq %rbp
testq %r12, %r12
je 0x3676
movq (%r12), %rdi
movl %r15d, %esi
callq 0x23c0
testl %eax, %eax
jne 0x367d
movq 0x30(%rbx), %rdi
movq 0x8(%rdi), %r12
callq 0x2040
movq %r12, 0x30(%rbx)
jmp 0x3649
pushq $-0x1
popq %rbp
jmp 0x3685
andq $0x0, 0x38(%rbx)
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x2370
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1d7d(%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 0x3706
movq %rax, %rdi
movq %r14, %rsi
callq 0x20a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x24e0
cmpl $-0x1, %eax
je 0x3719
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2040
jmp 0x3709
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x2008, %rsp           # imm = 0x2008
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x2070
movl (%rax), %eax
pushq $-0x1
popq %rbp
cmpl $0x27, %eax
je 0x372d
cmpl $0x11, %eax
jne 0x36fc
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 0x36fc
leaq 0x1cdf(%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 0x36fa
movq %rsp, %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2130
xorl %ebp, %ebp
cmpl $-0x1, %eax
sete %bpl
negl %ebp
jmp 0x36fc
nop
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
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 0x3f87
decl %ebp
movq %rsp, %r14
pushq $0x6
popq %r15
movl %ebp, %r12d
subl $0x1, %ebp
jb 0x3f80
movq %rbx, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x22c0
movq %r14, %rdi
movl %r15d, %esi
callq 0x24c0
testl %eax, %eax
je 0x3f80
callq 0x2070
cmpl $0xd, (%rax)
je 0x3f51
movq 0x20(%rbx), %rax
movl %r12d, (%rax)
movl 0x1c(%rbx), %edi
movl $0x10000, %esi          # imm = 0x10000
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2480
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
leaq 0x4(%rsp), %r12
movl %r14d, (%r12)
movq %rcx, 0x4(%r12)
movq %r12, %rdi
callq 0x403d
leaq 0x10(%rsp), %r13
movq %r12, (%r13)
movq $0xc, 0x8(%r13)
movl 0x18(%rbx), %edi
pushq $0xc
popq %rdx
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
pushq $0x2
popq %rdx
movq %r13, %rsi
callq 0x2420
addq $0xc, %r14
cmpq %r14, %rax
jne 0x402c
incl 0x8(%rbx)
xorl %eax, %eax
jmp 0x402f
pushq $-0x1
popq %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
leaq 0x14(%rsp), %r14
andl $0x0, (%r14)
movq %rdi, %rbx
andq $0x0, 0x4(%r14)
movq %r14, %rdi
callq 0x403d
leaq 0x20(%rsp), %r15
movq %r14, (%r15)
movq $0xc, 0x8(%r15)
movl 0x18(%rbx), %edi
pushq $0xc
popq %rdx
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
pushq $0x2
popq %rdx
movq %r15, %rsi
callq 0x2420
cmpq $0x14, %rax
jne 0x40f2
movl 0x4(%rbx), %edi
callq 0x2430
testl %eax, %eax
jne 0x40f2
movq 0x20(%rbx), %rax
movl 0x18(%rax), %edi
callq 0x4103
testl %eax, %eax
je 0x40ff
pushq $-0x1
popq %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
xorl %eax, %eax
jmp 0x40f5
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
callq 0x2430
testl %eax, %eax
je 0x412e
movl %eax, %ebx
callq 0x2070
movl (%rax), %eax
cmpl $0x16, %eax
je 0x4120
cmpl $0x9, %eax
jne 0x4130
callq 0x2360
cmpb $0x0, 0x41c8(%rip)      # 0x82f4
je 0x4134
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
movq 0x3ebd(%rip), %rax      # 0x7ff8
movq (%rax), %rcx
leaq 0x1303(%rip), %rdi      # 0x5448
pushq $0x3d
popq %rsi
pushq $0x1
popq %rdx
callq 0x2540
movb $0x1, 0x419d(%rip)      # 0x82f4
jmp 0x412e
// File: /workspace/github_c_makefile_star2_O2/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 0x41f3
movq 0x10(%rbx), %rdi
callq 0x2090
testl %eax, %eax
je 0x41ce
movl 0x4(%rbx), %edi
xorl %esi, %esi
callq 0x21d0
testl %eax, %eax
je 0x41ce
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, (%rsp)
movl 0x4(%rbx), %edi
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x21f0
cmpq $-0x1, %rax
je 0x41c8
movl 0x4(%rbx), %edi
movq %rsp, %rsi
pushq $0x8
popq %rdx
movq %rax, %rcx
callq 0x23f0
cmpq $0x8, %rax
jne 0x41c8
movl 0x4(%rbx), %edi
callq 0x2080
testl %eax, %eax
je 0x41ce
movq 0x20(%rbx), %rdi
jmp 0x41e2
movq 0x20(%rbx), %rax
movl 0x18(%rax), %edi
callq 0x4103
movq 0x20(%rbx), %rdi
testl %eax, %eax
je 0x41ec
callq 0x4215
pushq $-0x1
popq %rbp
jmp 0x41f3
movl (%rbx), %esi
callq 0x3f1b
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_O2/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 0x10(%rdi), %rcx
leaq 0x1216(%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_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
leaq 0x68(%rdi), %rbx
movq %rbx, %rdi
callq 0x25a0
movl (%r14), %edi
pushq $0x1
popq %rdx
xorl %esi, %esi
callq 0x21f0
movq %rax, %r13
movl (%r14), %edi
movl $0x101, %esi            # imm = 0x101
movq %rax, %rdx
movq %r15, %rcx
callq 0x2480
movl (%r14), %edi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x22d0
movq %rax, %r12
movl (%r14), %edi
movl $0x10000, %esi          # imm = 0x10000
movq %r13, %rdx
movq %r15, %rcx
callq 0x2480
testq %r12, %r12
jle 0x443f
movl (%r14), %edi
pushq $0x1
popq %rdx
movq %r12, %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2370
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x68(%rdi), %rbx
movq %rbx, %rdi
callq 0x25a0
movl (%r14), %edi
pushq $0x1
popq %rdx
xorl %esi, %esi
callq 0x21f0
testq %rax, %rax
js 0x452d
movq %rax, %r12
movl (%r14), %edi
movslq %ebp, %r13
movl $0x101, %esi            # imm = 0x101
movq %rax, %rdx
movq %r13, %rcx
callq 0x2480
movl (%r14), %edi
movq %r15, %rsi
movl %r13d, %edx
callq 0x2400
movq %rax, %r15
movl (%r14), %edi
movl $0x10000, %esi          # imm = 0x10000
movq %r12, %rdx
movq %r13, %rcx
callq 0x2480
movq %rbx, %rdi
callq 0x2370
movq %r15, %rax
jmp 0x4530
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x45be
movq %rax, %r14
leaq 0x68(%r12), %r15
movq %r15, %rdi
callq 0x25a0
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 0x45c3
movq %r14, %rdi
callq 0x24d0
movq %rax, %r13
testq %rax, %rax
js 0x45c6
movl (%r12), %edi
pushq $0x1
popq %rdx
movq %rbx, %rsi
callq 0x21f0
jmp 0x45c6
pushq $-0x1
popq %rbx
jmp 0x45dd
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_O2/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 0x4631
movq %rax, %r14
movq %rax, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x2300
testl %eax, %eax
js 0x4636
movq %r14, %rdi
callq 0x24d0
movq %rax, %r15
jmp 0x4639
pushq $-0x1
popq %rbx
jmp 0x4648
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_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r12d
movq %rsi, %r13
movq %rdi, %r15
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x20d0
testq %rax, %rax
je 0x46f1
movq %rax, %rbx
leaq 0x68(%r15), %rdi
movq %rdi, 0x10(%rsp)
callq 0x25a0
btl $0xa, 0x2c(%r15)
movq %r15, 0x8(%rsp)
movl (%r15), %edi
movl $0x0, %edx
adcl $0x1, %edx
xorl %esi, %esi
callq 0x21f0
movq %rax, %rbp
testl %r12d, %r12d
movl $0x0, %r15d
cmovgl %r12d, %r15d
shlq $0x4, %r15
xorl %r12d, %r12d
cmpq %r14, %r15
je 0x46f7
movq (%r13,%r14), %rsi
movq 0x8(%r13,%r14), %rdx
movq %rbx, %rdi
movq %rbp, %rcx
callq 0x2300
testl %eax, %eax
js 0x471b
movq 0x8(%r13,%r14), %rax
addq %rax, %r12
addq %rax, %rbp
addq $0x10, %r14
jmp 0x46c2
pushq $-0x1
popq %r12
jmp 0x4737
movq %rbx, %rdi
callq 0x24d0
movq %rax, %r13
testq %rax, %rax
js 0x471e
movq 0x8(%rsp), %rax
movl (%rax), %edi
pushq $0x1
popq %rdx
movq %r12, %rsi
callq 0x21f0
jmp 0x471e
movslq %eax, %r13
movq 0x10(%rsp), %rdi
callq 0x2370
movq %rbx, %rdi
callq 0x2170
testq %r13, %r13
cmovsq %r13, %r12
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/albertito[P]libjio/libjio/unix.c
// Function: jlseek
off_t jlseek(struct jfs *fs, off_t offset, int whence)
{
	off_t rv;

	pthread_mutex_lock(&(fs->lock));
	rv = lseek(fs->fd, offset, whence);
	pthread_mutex_unlock(&(fs->lock));

	return rv;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x68(%rdi), %r12
movq %r12, %rdi
callq 0x25a0
movl (%r15), %edi
movq %r14, %rsi
movl %ebx, %edx
callq 0x21f0
movq %rax, %rbx
movq %r12, %rdi
callq 0x2370
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x2140
xorl %ebx, %ebx
testq %rax, %rax
je 0x4875
movzbl (%r15), %ecx
cmpl $0x61, %ecx
je 0x4823
cmpl $0x77, %ecx
je 0x481c
cmpl $0x72, %ecx
jne 0x4875
cmpq $0x1, %rax
je 0x4848
pushq $0x2b
popq %rsi
movq %r15, %rdi
callq 0x2180
testq %rax, %rax
je 0x4848
pushq $0x2
popq %rsi
jmp 0x484c
movl $0x242, %esi            # imm = 0x242
jmp 0x484c
cmpq $0x1, %rax
je 0x483e
pushq $0x2b
popq %rsi
movq %r15, %rdi
callq 0x2180
movl $0x442, %esi            # imm = 0x442
testq %rax, %rax
jne 0x484c
pushq $0x2
popq %rbx
movl $0x442, %esi            # imm = 0x442
jmp 0x484c
xorl %esi, %esi
xorl %ebx, %ebx
movq %r14, %rdi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %ecx, %ecx
callq 0x22b0
testq %rax, %rax
je 0x4873
movq %rax, %r14
movl (%rax), %edi
xorl %esi, %esi
movl %ebx, %edx
callq 0x21f0
movq %r14, %rbx
jmp 0x4875
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/albertito[P]libjio/libjio/ansi.c
// Function: jfeof
int jfeof(struct jfs *stream)
{
	/* ANSI expects that when an EOF is reached in any operation (like
	 * fread() or fwrite()) some internal flag is set, and this function
	 * can be used to check if it is set or unset.
	 * As we don't do that (it's pointless for this kind of I/O), this
	 * just checks if the file pointer is at the end of the file */

	off_t curpos, endpos;

	pthread_mutex_lock(&(stream->lock));

	curpos = lseek(jfileno(stream), 0, SEEK_CUR);
	endpos = lseek(jfileno(stream), 0, SEEK_END);

	lseek(jfileno(stream), curpos, SEEK_SET);

	pthread_mutex_unlock(&(stream->lock));

	if (curpos >= endpos)
		return 1;
	else
		return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x68(%rdi), %rbx
movq %rbx, %rdi
callq 0x25a0
movl (%r14), %edi
pushq $0x1
popq %rdx
xorl %esi, %esi
callq 0x21f0
movq %rax, %r15
movl (%r14), %edi
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x21f0
movq %rax, %r12
movl (%r14), %edi
movq %r15, %rsi
xorl %edx, %edx
callq 0x21f0
movq %rbx, %rdi
callq 0x2370
xorl %eax, %eax
cmpq %r12, %r15
setge %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/albertito[P]libjio/libjio/ansi.c
// Function: jfseek
int jfseek(struct jfs *stream, long offset, int whence)
{
	off_t pos;

	pthread_mutex_lock(&(stream->lock));
	pos = lseek(stream->fd, offset, whence);
	pthread_mutex_unlock(&(stream->lock));

	/* fseek returns 0 on success, -1 on error */
	if (pos == -1)
		return 1;

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x68(%rdi), %r12
movq %r12, %rdi
callq 0x25a0
movl (%r15), %edi
movq %r14, %rsi
movl %ebx, %edx
callq 0x21f0
movq %rax, %rbx
movq %r12, %rdi
callq 0x2370
xorl %eax, %eax
cmpq $-0x1, %rbx
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/openshmem-org[P]openshmem-examples/c/generic-rotput.c
// Function: main
int
main(void)
{
    int nextpe;
    int me, npes;
    int src;
    int *dest;

    shmem_init();
    me = shmem_my_pe();
    npes = shmem_n_pes();

    nextpe = (me + 1) % npes;

    src = nextpe;

    dest = (int *) shmem_malloc(sizeof(*dest));
    assert(dest != NULL);

    *dest = -1;
    shmem_barrier_all();

    shmem_put(dest, &src, 1, nextpe);

    shmem_barrier_all();

    printf("%4d: got %4d: ", me, *dest);
    if (*dest == me) {
        printf("CORRECT");
    }
    else {
        printf("WRONG, expected %d", me);
    }
    printf("\n");

    shmem_barrier_all();
    shmem_free(dest);
    shmem_finalize();

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
callq 0x10c0
callq 0x1090
movl %eax, %r14d
callq 0x1070
movl %eax, %ecx
leal 0x1(%r14), %eax
cltd
idivl %ecx
movl %edx, %ebp
movl %edx, 0xc(%rsp)
pushq $0x4
popq %rdi
callq 0x10a0
testq %rax, %rax
je 0x1296
movq %rax, %rbx
orl $-0x1, (%rax)
callq 0x10b0
leaq 0xc(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
movl %ebp, %ecx
callq 0x1030
callq 0x10b0
movl (%rbx), %edx
leaq 0xdf0(%rip), %rdi       # 0x2031
movl %r14d, %esi
xorl %eax, %eax
callq 0x1040
cmpl %r14d, (%rbx)
jne 0x1260
leaq 0xde9(%rip), %rdi       # 0x2040
xorl %eax, %eax
callq 0x1040
jmp 0x1271
leaq 0xde1(%rip), %rdi       # 0x2048
movl %r14d, %esi
xorl %eax, %eax
callq 0x1040
pushq $0xa
popq %rdi
callq 0x1060
callq 0x10b0
movq %rbx, %rdi
callq 0x10d0
callq 0x1080
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xd67(%rip), %rdi       # 0x2004
leaq 0xd6d(%rip), %rsi       # 0x2011
leaq 0xd77(%rip), %rcx       # 0x2022
pushq $0x4d
popq %rdx
callq 0x1050
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/tests/child_exit_nonzero_status.c
// Function: main
int main() {
  libforks_ServerConn conn;

  check(libforks_start(&conn) == libforks_OK);

  int exit_fd;
  pid_t child_pid;

  libforks_Result r = libforks_fork(
    conn,
    &child_pid, // pid_ptr
    NULL, // socket_fd_ptr
    &exit_fd, // exit_fd_ptr
    child_main
  );
  check(r == libforks_OK);

  libforks_ExitEvent event;
  check(read(exit_fd, &event, sizeof event) == sizeof event);
  check(event.pid == child_pid);
  check(WIFEXITED(event.wait_status));
  check(WEXITSTATUS(event.wait_status) == 23);

  check(libforks_stop(conn) == libforks_OK);

  return 0;
}

// Assembly:
subq $0x18, %rsp
leaq 0x8(%rsp), %rdi
callq 0x1742
testl %eax, %eax
jne 0x1366
movq 0x8(%rsp), %rdi
leaq 0xd8(%rip), %r8         # 0x13e2
movq %rsp, %rsi
leaq 0x4(%rsp), %rcx
xorl %edx, %edx
callq 0x203e
testl %eax, %eax
jne 0x1371
movl 0x4(%rsp), %edi
leaq 0x10(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x10f0
cmpq $0x8, %rax
jne 0x137c
movl 0x10(%rsp), %eax
cmpl (%rsp), %eax
jne 0x1387
movl 0x14(%rsp), %eax
testb $0x7f, %al
jne 0x1392
andl $0xff00, %eax           # imm = 0xFF00
cmpl $0x1700, %eax           # imm = 0x1700
jne 0x139d
movq 0x8(%rsp), %rdi
callq 0x21e2
testl %eax, %eax
jne 0x13a8
xorl %eax, %eax
addq $0x18, %rsp
retq
leaq 0x1c97(%rip), %rdi      # 0x3004
pushq $0xe
jmp 0x13b1
leaq 0x1cd3(%rip), %rdi      # 0x304b
pushq $0x1a
jmp 0x13b1
leaq 0x1cd9(%rip), %rdi      # 0x305c
pushq $0x1d
jmp 0x13b1
leaq 0x1d02(%rip), %rdi      # 0x3090
pushq $0x1e
jmp 0x13b1
leaq 0x1d0e(%rip), %rdi      # 0x30a7
pushq $0x1f
jmp 0x13b1
leaq 0x1d20(%rip), %rdi      # 0x30c4
pushq $0x20
jmp 0x13b1
leaq 0x1d3a(%rip), %rdi      # 0x30e9
pushq $0x22
popq %rsi
callq 0x13b7
// File: /workspace/github_c_makefile_star2_O2/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:
movl %edi, %edx
leal -0x30(%rdx), %eax
cmpb $0xa, %al
jae 0x47d5
pushq $-0x30
jmp 0x47e9
leal -0x61(%rdx), %eax
cmpb $0x6, %al
jae 0x47e0
pushq $-0x57
jmp 0x47e9
leal -0x41(%rdx), %eax
cmpb $0x6, %al
jae 0x47ed
pushq $-0x37
popq %rax
addl %edx, %eax
retq
pushq %rax
movq 0x67fb(%rip), %rax      # 0xaff0
movq (%rax), %rdi
leaq 0x2bda(%rip), %rsi      # 0x73d9
xorl %eax, %eax
callq 0x2170
pushq $-0x1
popq %rdi
callq 0x21e0
nop
// File: /workspace/github_c_makefile_star2_O2/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 0x36d0
movb $0xa, 0xb(%rbx)
leaq 0x8916(%rip), %r14      # 0xdd80
movq %r14, %rdi
callq 0x36d9
pushq $0x1c
popq %r12
subq $0x1, %r12
jb 0x5493
leaq 0xc(%r14), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x376d
movq %r15, %r14
jmp 0x5476
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x36e6
pushq $0x1
popq %r12
pushq $0x1c
popq %rbp
testl %ebp, %ebp
js 0x556c
movl %ebp, %eax
imulq $0xc, %rax, %r15
leaq 0x88a3(%rip), %rax      # 0xdd80
addq %rax, %r15
pushq $0x30
popq %r13
movq %r14, %rdi
movq %r15, %rsi
callq 0x3752
testl %eax, %eax
js 0x5506
movq %r14, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3727
incl %r13d
jmp 0x54e4
xorl %r15d, %r15d
cmpl $0x30, %r13d
jne 0x552d
xorl %r13d, %r13d
testl %r12d, %r12d
sete %r13b
shll $0x4, %r13d
orl $0x20, %r13d
testl %ebp, %ebp
pushq $0x30
popq %rax
cmovel %eax, %r13d
movl %r12d, %r15d
movsbl %r13b, %edi
movq %rbx, %rsi
callq 0x2150
movl %ebp, %eax
xorl %edx, %edx
pushq $0x3
popq %rcx
divl %ecx
testl %edx, %edx
jne 0x5562
testl %r15d, %r15d
pushq $0x20
popq %rdi
pushq $0x2c
popq %rax
cmovel %eax, %edi
testl %ebp, %ebp
pushq $0xa
popq %rax
cmovel %eax, %edi
movq %rbx, %rsi
callq 0x2150
decl %ebp
movl %r15d, %r12d
jmp 0x54c8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hansvanstaveren[P]BigDeal/output.c
// Function: compute_stat
static void
compute_stat(FILE *out, int boardno, hr_p hrp)
/*
 * Compute statistics on this hand
 */
{
	dl_byh *dbhp = hrp->hr_value.hv_dbhp;
	int i, compass, card;
	int length, maxlength, suitlength[NCOMPASS][NSUIT];
	int hcp;

	for (compass=0; compass<NCOMPASS; compass++) {
		for (i=0; i<NSUIT; i++)
			suitlength[compass][i] = 0;
		hcp = 0;
		for (i=0; i<NCARDSPERHAND; i++) {
			/*
			 * Note the -1 to convert from 1..52 to 0..51
			 */
			card = dbhp->dh_hand[compass][i]-1;
			/*
			 * card/13 should be suit
			 */
			suitlength[compass][card/13]++;
			/*
			 * card%13 should be pip
			 */
			hcp += high_card_points[card%13];
		}
		stats.st_hcp[compass] += hcp;
		stats.st_hcpfreq[hcp]++;
		maxlength = 0;
		for (i=0; i<NSUIT; i++) {
			length = suitlength[compass][i];
			if (length > maxlength)
				maxlength = length;
			stats.st_sumsquare += length*length;
		}
		if (maxlength > stats.st_longestsuit)
			stats.st_longestsuit = maxlength;
		stats.st_lsuitfreq[compass][maxlength]++;
	}
	/*
	 * Now suitlength[][] contains all suit lengths for all hands
	 * 16 numbers in all.
	 * Statistics about distribution to be added here.
	 */
}

// Assembly:
pushq %r14
pushq %rbx
movq 0x8(%rdx), %rcx
leaq -0x48(%rsp), %rsi
xorl %edi, %edi
leaq 0x890e(%rip), %r8       # 0xdedc
movw $0xd, %r9w
leaq 0x21d6(%rip), %r10      # 0x77b0
cmpq $0x4, %rdi
je 0x5695
xorl %eax, %eax
cmpq $0x4, %rax
je 0x55f5
andl $0x0, (%rsi,%rax,4)
incq %rax
jmp 0x55e6
xorl %r11d, %r11d
xorl %ebx, %ebx
cmpq $0xd, %r11
je 0x562f
movzbl (%rcx,%r11), %eax
decl %eax
cwtd
idivw %r9w
movzwl %ax, %eax
movq %rdi, %r14
shlq $0x4, %r14
addq %rsp, %r14
addq $-0x48, %r14
incl (%r14,%rax,4)
movswq %dx, %rax
addl (%r10,%rax,4), %ebx
incq %r11
jmp 0x55fa
addl %ebx, 0x4(%r8,%rdi,4)
movslq %ebx, %rax
incl 0x14(%r8,%rax,4)
xorl %edx, %edx
movl 0x8897(%rip), %r11d     # 0xdedc
xorl %eax, %eax
cmpq $0x4, %rdx
je 0x5660
movl (%rsi,%rdx,4), %ebx
cmpl %eax, %ebx
cmovgl %ebx, %eax
imull %ebx, %ebx
addl %ebx, %r11d
incq %rdx
jmp 0x5647
movl %r11d, 0x8875(%rip)     # 0xdedc
cmpl 0x89fb(%rip), %eax      # 0xe068
jle 0x5675
movl %eax, 0x89f3(%rip)      # 0xe068
movl %eax, %eax
imulq $0x38, %rdi, %rdx
addq %r8, %rdx
incl 0xac(%rdx,%rax,4)
incq %rdi
addq $0x10, %rsi
addq $0xd, %rcx
jmp 0x55da
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/hansvanstaveren[P]BigDeal/output.c
// Function: print_avg
static void
print_avg(FILE *out, int sum, int divisor, int decimals, char *termstr)
/*
 * Prevent use of floating point
 */
{
	int power_of_ten;
	int i;
	int result;

	power_of_ten = 1;
	for (i=0; i<decimals; i++)
		power_of_ten *= 10;

	sum *= power_of_ten;
	/*
	 * Make sure of proper rounding
	 */
	sum += divisor/2;
	result = sum/divisor;

	fprintf(out, "%d", result/power_of_ten);
	if (decimals) {
		fprintf(out, ".");
		for (i=0; i<decimals; i++) {
			result -= result/power_of_ten*power_of_ten;
			power_of_ten /= 10;
			fprintf(out, "%d", result/power_of_ten);
		}
	}
	fprintf(out, "%s", termstr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, (%rsp)
movl %ecx, %r12d
movl %edx, %ecx
movq %rdi, %r14
xorl %r13d, %r13d
testl %r12d, %r12d
cmovgl %r12d, %r13d
pushq $0x1
popq %rbp
movl %r13d, %eax
subl $0x1, %eax
jb 0x5d4a
imull $0xa, %ebp, %ebp
jmp 0x5d40
imull %ebp, %esi
pushq $0x2
popq %rdi
movl %ecx, %eax
cltd
idivl %edi
addl %esi, %eax
cltd
idivl %ecx
movl %eax, %r15d
cltd
idivl %ebp
leaq 0x1fb8(%rip), %rsi      # 0x7d1f
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2170
testl %r12d, %r12d
je 0x5dba
pushq $0x2e
popq %rdi
movq %r14, %rsi
callq 0x2110
pushq $0xa
popq %rbx
leaq 0x1f92(%rip), %r12      # 0x7d1f
subl $0x1, %r13d
jb 0x5dba
movl %r15d, %eax
cltd
idivl %ebp
movl %edx, %r15d
movl %ebp, %eax
cltd
idivl %ebx
movl %eax, %ebp
movl %r15d, %eax
cltd
idivl %ebp
movq %r14, %rdi
movq %r12, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x2170
jmp 0x5d8d
movq (%rsp), %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20e0
// File: /workspace/github_c_makefile_star2_O2/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_5/exercise_5_16/sort.c
// Function: estrcmp
int estrcmp(const char *s1, const char *s2)
{
  while (*s1 != '\0' && *s2 != '\0')
  {
    if (directory)
    {
      while (*s1 != '\0' && !isalnum(*s1) && !isspace(*s1))
      {
        ++s1;
      }
      while (*s2 != '\0' && !isalnum(*s2) && !isspace(*s2))
      {
        ++s2;
      }
    }

    int result = fold ? tolower(*s1) - tolower(*s2) : *s1 - *s2;
    if (result == 0)
    {
      ++s1;
      ++s2;
    }
    else
    {
      return order * result;
    }
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x2ee1(%rip), %ebp      # 0x4094
movl 0x2ed6(%rip), %r15d     # 0x4090
movb (%r14), %r12b
xorl %eax, %eax
testb %r12b, %r12b
je 0x125f
movb (%rbx), %r13b
testb %r13b, %r13b
je 0x125f
testl %ebp, %ebp
je 0x1223
testb %r12b, %r12b
je 0x1203
callq 0x1090
movq (%rax), %rax
movsbq %r12b, %rcx
movzwl (%rax,%rcx,2), %eax
testw $0x2008, %ax            # imm = 0x2008
jne 0x1203
movb 0x1(%r14), %r12b
incq %r14
jmp 0x11d8
movb 0x1(%rbx), %r13b
incq %rbx
testb %r13b, %r13b
je 0x1220
callq 0x1090
movq (%rax), %rax
movsbq %r13b, %rcx
movzwl (%rax,%rcx,2), %eax
testw $0x2008, %ax            # imm = 0x2008
je 0x11fc
jmp 0x1223
xorl %r13d, %r13d
testl %r15d, %r15d
je 0x1240
callq 0x1080
movq (%rax), %rcx
movsbq %r12b, %rax
movl (%rcx,%rax,4), %eax
movsbq %r13b, %rdx
subl (%rcx,%rdx,4), %eax
jmp 0x124a
movsbl %r12b, %eax
movsbl %r13b, %ecx
subl %ecx, %eax
incq %r14
incq %rbx
testl %eax, %eax
je 0x11ba
imull 0x2e01(%rip), %eax      # 0x4060
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/soso7885[P]OPCUA_example/demo_src/server_method.c
// Function: helloWorldMethod
static UA_StatusCode
helloWorldMethod(void *handle, const UA_NodeId objectId, size_t inputSize, const UA_Variant *input,
                 size_t outputSize, UA_Variant *output) {
        UA_String *inputStr = (UA_String*)input->data;
        UA_String tmp = UA_STRING_ALLOC("Hello ");
        if(inputStr->length > 0) {
            tmp.data = realloc(tmp.data, tmp.length + inputStr->length);
            memcpy(&tmp.data[tmp.length], inputStr->data, inputStr->length);
            tmp.length += inputStr->length;
        }
        UA_Variant_setScalarCopy(output, &tmp, &UA_TYPES[UA_TYPES_STRING]);
        UA_String_deleteMembers(&tmp);
        UA_LOG_INFO(logger, UA_LOGCATEGORY_SERVER, "Hello World was called");
        return UA_STATUSCODE_GOOD;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %r8, %rbx
movq 0x18(%rdx), %r12
leaq 0x8c4(%rip), %rdi       # 0x2109
callq 0x10e0
movq %rax, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
movq (%r12), %rsi
testq %rsi, %rsi
je 0x1889
movq %rax, %r14
addq %rax, %rsi
movq %rdx, %rdi
callq 0x10f0
movq %rax, -0x28(%rbp)
leaq (%rax,%r14), %rdi
movq (%r12), %r15
movq 0x8(%r12), %rsi
movq %r15, %rdx
callq 0x10b0
addq %r14, %r15
movq %r15, -0x30(%rbp)
movl $0x1b8, %edx            # imm = 0x1B8
addq 0x2743(%rip), %rdx      # 0x3fd8
leaq -0x30(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a0
movq %r14, %rdi
callq 0x1a03
movq 0x27fd(%rip), %rcx      # 0x40b0
testq %rcx, %rcx
je 0x18c9
leaq 0x851(%rip), %rdx       # 0x2110
pushq $0x2
popq %rdi
pushq $0x3
popq %rsi
xorl %eax, %eax
callq *%rcx
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/soso7885[P]OPCUA_example/demo_src/server_method.c
// Function: IncInt32ArrayValuesMethod
static UA_StatusCode
IncInt32ArrayValuesMethod(void *handle, const UA_NodeId objectId, size_t inputSize,
                          const UA_Variant *input, size_t outputSize, UA_Variant *output) {
	UA_Variant_setArrayCopy(output, input->data, 5, &UA_TYPES[UA_TYPES_INT32]);
	for(size_t i = 0; i< input->arrayLength; i++)
		((UA_Int32*)output->data)[i] = ((UA_Int32*)input->data)[i] + 1;
	return UA_STATUSCODE_GOOD;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %r8, %rbx
movq %rdx, %r14
movq 0x18(%rdx), %rsi
movl $0xc8, %ecx
addq 0x26cd(%rip), %rcx      # 0x3fd8
pushq $0x5
popq %rdx
movq %r8, %rdi
callq 0x1050
movq 0x10(%r14), %rax
xorl %ecx, %ecx
cmpq %rax, %rcx
jae 0x1936
movq 0x18(%r14), %rdx
movl (%rdx,%rcx,4), %edx
incl %edx
movq 0x18(%rbx), %rsi
movl %edx, (%rsi,%rcx,4)
incq %rcx
jmp 0x191c
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq