LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/midl.c
// Function: mdb_midl_xmerge
void mdb_midl_xmerge( MDB_IDL idl, MDB_IDL merge )
{
	MDB_ID old_id, merge_id, i = merge[0], j = idl[0], k = i+j, total = k;
	idl[0] = (MDB_ID)-1;		/* delimiter for idl scan below */
	old_id = idl[j];
	while (i) {
		merge_id = merge[i--];
		for (; old_id < merge_id; old_id = idl[--j])
			idl[k--] = old_id;
		idl[k--] = merge_id;
	}
	idl[0] = total;
}

// Assembly:
movq (%rsi), %rax
movq (%rdi), %rdx
leaq (%rdx,%rax), %rcx
movq $-0x1, (%rdi)
testq %rax, %rax
je 0xbd07
movq (%rdi,%rdx,8), %r9
movq %rcx, %r8
movq (%rsi,%rax,8), %r10
cmpq %r10, %r9
jae 0xbcf8
movq %r9, (%rdi,%r8,8)
decq %r8
movq -0x8(%rdi,%rdx,8), %r9
decq %rdx
jmp 0xbce2
decq %rax
movq %r10, (%rdi,%r8,8)
decq %r8
testq %rax, %rax
jne 0xbcde
movq %rcx, (%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/midl.c
// Function: mdb_mid2l_insert
int mdb_mid2l_insert( MDB_ID2L ids, MDB_ID2 *id )
{
	unsigned x, i;

	x = mdb_mid2l_search( ids, id->mid );

	if( x < 1 ) {
		/* internal error */
		return -2;
	}

	if ( x <= ids[0].mid && ids[x].mid == id->mid ) {
		/* duplicate */
		return -1;
	}

	if ( ids[0].mid >= MDB_IDL_UM_MAX ) {
		/* too big */
		return -2;

	} else {
		/* insert id */
		ids[0].mid++;
		for (i=(unsigned)ids[0].mid; i>x; i--)
			ids[i] = ids[i-1];
		ids[x] = *id;
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %r15
movq %r15, %rsi
callq 0xbea3
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
testl %eax, %eax
je 0xbf67
movl %eax, %edx
movq (%rbx), %rsi
cmpq %rdx, %rsi
jb 0xbf24
movq %rdx, %rdi
shlq $0x4, %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %r15, (%rbx,%rdi)
je 0xbf67
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmpq $0x1fffe, %rsi          # imm = 0x1FFFE
ja 0xbf67
leaq 0x1(%rsi), %rcx
movq %rcx, (%rbx)
cmpl %ecx, %eax
jae 0xbf59
shlq $0x4, %rsi
addq %rbx, %rsi
addq $0x10, %rsi
movups -0x10(%rsi), %xmm0
movups %xmm0, (%rsi)
addq $-0x10, %rsi
decl %ecx
cmpl %ecx, %eax
jb 0xbf48
shlq $0x4, %rdx
movups (%r14), %xmm0
movups %xmm0, (%rbx,%rdx)
xorl %ecx, %ecx
movl %ecx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_version
char * ESECT
mdb_version(int *major, int *minor, int *patch)
{
	if (major) *major = MDB_VERSION_MAJOR;
	if (minor) *minor = MDB_VERSION_MINOR;
	if (patch) *patch = MDB_VERSION_PATCH;
	return MDB_VERSION_STRING;
}

// Assembly:
testq %rdi, %rdi
je 0xbf9f
movl $0x0, (%rdi)
testq %rsi, %rsi
je 0xbfaa
movl $0x9, (%rsi)
testq %rdx, %rdx
je 0xbfb5
movl $0x10, (%rdx)
leaq 0x3051(%rip), %rax      # 0xf00d
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_assert_fail
static void ESECT
mdb_assert_fail(MDB_env *env, const char *expr_txt,
	const char *func, const char *file, int line)
{
	char buf[400];
	sprintf(buf, "%.100s:%d: Assertion '%.200s' failed in %.40s()",
		file, line, expr_txt, func);
	if (env->me_assert_func)
		env->me_assert_func(env, buf);
	fprintf(stderr, "%s\n", buf);
	abort();
}

// Assembly:
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movq %rdx, %r9
movq %rsi, %r8
movq %rdi, %rbx
leaq 0x3982(%rip), %rsi      # 0xf957
leaq 0x3457(%rip), %rdx      # 0xf433
movq %rsp, %rdi
xorl %eax, %eax
callq 0x2370
movq 0xf0(%rbx), %rax
testq %rax, %rax
je 0xbffa
movq %rsp, %rsi
movq %rbx, %rdi
callq *%rax
movq 0x6ff7(%rip), %rax      # 0x12ff8
movq (%rax), %rdi
leaq 0x3041(%rip), %rsi      # 0xf04c
movq %rsp, %rdx
xorl %eax, %eax
callq 0x2220
callq 0x2040
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_create
int ESECT
mdb_env_create(MDB_env **env)
{
	MDB_env *e;

	e = calloc(1, sizeof(MDB_env));
	if (!e)
		return ENOMEM;

	e->me_maxreaders = DEFAULT_READERS;
	e->me_maxdbs = e->me_numdbs = CORE_DBS;
	e->me_fd = INVALID_HANDLE_VALUE;
	e->me_lfd = INVALID_HANDLE_VALUE;
	e->me_mfd = INVALID_HANDLE_VALUE;
#ifdef MDB_USE_POSIX_SEM
	e->me_rmutex = SEM_FAILED;
	e->me_wmutex = SEM_FAILED;
#elif defined MDB_USE_SYSV_SEM
	e->me_rmutex->semid = -1;
	e->me_wmutex->semid = -1;
#endif
	e->me_pid = getpid();
	GET_PAGESIZE(e->me_os_psize);
	VGMEMP_CREATE(e,0,0);
	*env = e;
	return MDB_SUCCESS;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %edi
movl $0xf8, %esi
callq 0x2200
testq %rax, %rax
je 0xc07a
movq %rax, %r14
movl $0x7e, 0x18(%rax)
movabsq $0x200000002, %rax      # imm = 0x200000002
movq %rax, 0x20(%r14)
movq $-0x1, (%r14)
movl $0xffffffff, 0x8(%r14)  # imm = 0xFFFFFFFF
callq 0x20e0
movl %eax, 0x28(%r14)
movl $0x1e, %edi
callq 0x2320
movl %eax, 0x14(%r14)
movq %r14, (%rbx)
xorl %eax, %eax
jmp 0xc07f
movl $0xc, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_set_mapsize
int ESECT
mdb_env_set_mapsize(MDB_env *env, size_t size)
{
	/* If env is already open, caller is responsible for making
	 * sure there are no active txns.
	 */
	if (env->me_map) {
		int rc;
		MDB_meta *meta;
		void *old;
		if (env->me_txn)
			return EINVAL;
		meta = mdb_env_pick_meta(env);
		if (!size)
			size = meta->mm_mapsize;
		{
			/* Silently round up to minimum if the size is too small */
			size_t minsize = (meta->mm_last_pg + 1) * env->me_psize;
			if (size < minsize)
				size = minsize;
		}
		munmap(env->me_map, env->me_mapsize);
		env->me_mapsize = size;
		old = (env->me_flags & MDB_FIXEDMAP) ? env->me_map : NULL;
		rc = mdb_env_map(env, old);
		if (rc)
			return rc;
	}
	env->me_mapsize = size;
	if (env->me_psize)
		env->me_maxpg = env->me_mapsize / env->me_psize;
	return MDB_SUCCESS;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0xc115
movl $0x16, %ecx
cmpq $0x0, 0x60(%rbx)
jne 0xc132
movq 0x48(%rbx), %rax
movq 0x80(%rax), %rax
movq 0x50(%rbx), %rcx
xorl %edx, %edx
cmpq 0x80(%rcx), %rax
setb %dl
movq 0x48(%rbx,%rdx,8), %rax
testq %r14, %r14
jne 0xc0d3
movq 0x10(%rax), %r14
movq %r14, %rcx
movq 0x78(%rax), %rax
incq %rax
movl 0x10(%rbx), %r14d
imulq %rax, %r14
cmpq %r14, %rcx
cmovaq %rcx, %r14
movq 0x70(%rbx), %rsi
callq 0x2290
movq %r14, 0x70(%rbx)
testb $0x1, 0xc(%rbx)
jne 0xc103
xorl %esi, %esi
jmp 0xc107
movq 0x38(%rbx), %rsi
movq %rbx, %rdi
callq 0xc13c
movl %eax, %ecx
testl %eax, %eax
jne 0xc132
movq %r14, 0x70(%rbx)
movl 0x10(%rbx), %esi
xorl %ecx, %ecx
testq %rsi, %rsi
je 0xc132
movq %r14, %rax
xorl %edx, %edx
divq %rsi
movq %rax, 0x80(%rbx)
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_share_locks
static int ESECT
mdb_env_share_locks(MDB_env *env, int *excl)
{
	int rc = 0;
	MDB_meta *meta = mdb_env_pick_meta(env);

	env->me_txns->mti_txnid = meta->mm_txnid;

#ifdef _WIN32
	{
		OVERLAPPED ov;
		/* First acquire a shared lock. The Unlock will
		 * then release the existing exclusive lock.
		 */
		memset(&ov, 0, sizeof(ov));
		if (!LockFileEx(env->me_lfd, 0, 0, 1, 0, &ov)) {
			rc = ErrCode();
		} else {
			UnlockFile(env->me_lfd, 0, 0, 1, 0);
			*excl = 0;
		}
	}
#else
	{
		struct flock lock_info;
		/* The shared lock replaces the existing lock */
		memset((void *)&lock_info, 0, sizeof(lock_info));
		lock_info.l_type = F_RDLCK;
		lock_info.l_whence = SEEK_SET;
		lock_info.l_start = 0;
		lock_info.l_len = 1;
		while ((rc = fcntl(env->me_lfd, F_SETLK, &lock_info)) &&
				(rc = ErrCode()) == EINTR) ;
		*excl = rc ? -1 : 0;	/* error may mean we lost the lock */
	}
#endif

	return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x48(%rdi), %rax
movq 0x80(%rax), %rax
movq 0x50(%rdi), %rcx
xorl %edx, %edx
cmpq 0x80(%rcx), %rax
setb %dl
movq 0x48(%rdi,%rdx,8), %rax
movq 0x80(%rax), %rax
movq 0x40(%rdi), %rcx
movq %rax, 0x30(%rcx)
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq $0x1, 0x10(%r15)
xorl %ebp, %ebp
movl 0x4(%r14), %edi
movl $0x6, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x20c0
testl %eax, %eax
je 0xcbdc
callq 0x2050
movl (%rax), %eax
cmpl $0x4, %eax
je 0xcbb7
jmp 0xcbde
xorl %eax, %eax
movl %eax, %ecx
negl %ecx
sbbl %ebp, %ebp
movl %ebp, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_close
void ESECT
mdb_env_close(MDB_env *env)
{
	MDB_page *dp;

	if (env == NULL)
		return;

	VGMEMP_DESTROY(env);
	while ((dp = env->me_dpages) != NULL) {
		VGMEMP_DEFINED(&dp->mp_next, sizeof(dp->mp_next));
		env->me_dpages = dp->mp_next;
		free(dp);
	}

	mdb_env_close0(env, 0);
	free(env);
}

// Assembly:
testq %rdi, %rdi
je 0xcd8d
pushq %rbx
movq %rdi, %rbx
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0xcd7c
movq (%rdi), %rax
movq %rax, 0xc0(%rbx)
callq 0x2030
jmp 0xcd5f
movq %rbx, %rdi
callq 0xcbf1
movq %rbx, %rdi
popq %rbx
jmp 0x2030
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_copy2
int ESECT
mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags)
{
	int rc, len;
	char *lpath;
	HANDLE newfd = INVALID_HANDLE_VALUE;

	if (env->me_flags & MDB_NOSUBDIR) {
		lpath = (char *)path;
	} else {
		len = strlen(path);
		len += sizeof(DATANAME);
		lpath = malloc(len);
		if (!lpath)
			return ENOMEM;
		sprintf(lpath, "%s" DATANAME, path);
	}

	/* The destination path must exist, but the destination file must not.
	 * We don't want the OS to cache the writes, since the source data is
	 * already in the OS cache.
	 */
#ifdef _WIN32
	newfd = CreateFileA(lpath, GENERIC_WRITE, 0, NULL, CREATE_NEW,
				FILE_FLAG_NO_BUFFERING|FILE_FLAG_WRITE_THROUGH, NULL);
#else
	newfd = open(lpath, O_WRONLY|O_CREAT|O_EXCL, 0666);
#endif
	if (newfd == INVALID_HANDLE_VALUE) {
		rc = ErrCode();
		goto leave;
	}

	if (env->me_psize >= env->me_os_psize) {
#ifdef O_DIRECT
	/* Set O_DIRECT if the file system supports it */
	if ((rc = fcntl(newfd, F_GETFL)) != -1)
		(void) fcntl(newfd, F_SETFL, rc | O_DIRECT);
#endif
#ifdef F_NOCACHE	/* __APPLE__ */
	rc = fcntl(newfd, F_NOCACHE, 1);
	if (rc) {
		rc = ErrCode();
		goto leave;
	}
#endif
	}

	rc = mdb_env_copyfd2(env, newfd, flags);

leave:
	if (!(env->me_flags & MDB_NOSUBDIR))
		free(lpath);
	if (newfd != INVALID_HANDLE_VALUE)
		if (close(newfd) < 0 && rc == MDB_SUCCESS)
			rc = ErrCode();

	return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testb $0x40, 0xd(%rdi)
jne 0xd2fa
movq %rbx, %rdi
callq 0x2110
addl $0xa, %eax
movslq %eax, %rdi
callq 0x2270
testq %rax, %rax
je 0xd399
movq %rax, %r15
leaq 0x2163(%rip), %rsi      # 0xf44d
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2370
movq %r15, %rbx
movq %rbx, %rdi
movl $0xc1, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x2310
movl %eax, %r15d
cmpl $-0x1, %eax
je 0xd35b
movl 0x10(%r14), %eax
cmpl 0x14(%r14), %eax
jb 0xd34a
movl %r15d, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x20c0
cmpl $-0x1, %eax
je 0xd34a
orl $0x4000, %eax           # imm = 0x4000
movl %r15d, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x20c0
movq %r14, %rdi
movl %r15d, %esi
movl %ebp, %edx
callq 0xcd8e
movl %eax, %ebp
jmp 0xd362
callq 0x2050
movl (%rax), %ebp
testb $0x40, 0xd(%r14)
jne 0xd371
movq %rbx, %rdi
callq 0x2030
cmpl $-0x1, %r15d
je 0xd39e
movl %r15d, %edi
callq 0x21a0
testl %eax, %eax
sets %al
testl %ebp, %ebp
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xd39e
callq 0x2050
movl (%rax), %ebp
jmp 0xd39e
movl $0xc, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_set_flags
int ESECT
mdb_env_set_flags(MDB_env *env, unsigned int flag, int onoff)
{
	if (flag & ~CHANGEABLE)
		return EINVAL;
	if (onoff)
		env->me_flags |= flag;
	else
		env->me_flags &= ~flag;
	return MDB_SUCCESS;
}

// Assembly:
movl $0x16, %eax
testl $0xfeeaffff, %esi       # imm = 0xFEEAFFFF
je 0xd3c0
retq
testl %edx, %edx
je 0xd3c9
orl %esi, 0xc(%rdi)
jmp 0xd3ce
notl %esi
andl %esi, 0xc(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_stat
int ESECT
mdb_env_stat(MDB_env *env, MDB_stat *arg)
{
	MDB_meta *meta;

	if (env == NULL || arg == NULL)
		return EINVAL;

	meta = mdb_env_pick_meta(env);

	return mdb_stat0(env, &meta->mm_dbs[MAIN_DBI], arg);
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
movl $0x16, %eax
jne 0xd4bb
movq 0x48(%rdi), %rax
movq 0x80(%rax), %rax
movq 0x50(%rdi), %rcx
xorl %edx, %edx
cmpq 0x80(%rcx), %rax
setb %dl
movq 0x48(%rdi,%rdx,8), %rax
movl 0x10(%rdi), %ecx
movl %ecx, (%rsi)
movzwl 0x4e(%rax), %ecx
movl %ecx, 0x4(%rsi)
movups 0x50(%rax), %xmm0
movups %xmm0, 0x8(%rsi)
movups 0x60(%rax), %xmm0
movups %xmm0, 0x18(%rsi)
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_info
int ESECT
mdb_env_info(MDB_env *env, MDB_envinfo *arg)
{
	MDB_meta *meta;

	if (env == NULL || arg == NULL)
		return EINVAL;

	meta = mdb_env_pick_meta(env);
	arg->me_mapaddr = meta->mm_address;
	arg->me_last_pgno = meta->mm_last_pg;
	arg->me_last_txnid = meta->mm_txnid;

	arg->me_mapsize = env->me_mapsize;
	arg->me_maxreaders = env->me_maxreaders;
	arg->me_numreaders = env->me_txns ? env->me_txns->mti_numreaders : 0;
	return MDB_SUCCESS;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
movl $0x16, %eax
jne 0xd52f
movq 0x48(%rdi), %rax
movq 0x80(%rax), %rax
movq 0x50(%rdi), %rcx
xorl %edx, %edx
cmpq 0x80(%rcx), %rax
setb %dl
movq 0x48(%rdi,%rdx,8), %rax
movq 0x8(%rax), %rcx
movq %rcx, (%rsi)
movq 0x78(%rax), %rcx
movq %rcx, 0x10(%rsi)
movq 0x80(%rax), %rax
movq %rax, 0x18(%rsi)
movq 0x70(%rdi), %rax
movq %rax, 0x8(%rsi)
movl 0x18(%rdi), %eax
movl %eax, 0x20(%rsi)
movq 0x40(%rdi), %rcx
xorl %eax, %eax
movl $0x0, %edx
testq %rcx, %rcx
je 0xd52c
movl 0x38(%rcx), %edx
movl %edx, 0x24(%rsi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_stat
int ESECT
mdb_stat(MDB_txn *txn, MDB_dbi dbi, MDB_stat *arg)
{
	if (!arg || !TXN_DBI_EXIST(txn, dbi, DB_VALID))
		return EINVAL;

	if (txn->mt_flags & MDB_TXN_BLOCKED)
		return MDB_BAD_TXN;

	if (txn->mt_dbflags[dbi] & DB_STALE) {
		MDB_cursor mc;
		MDB_xcursor mx;
		/* Stale, must read the DB's root. cursor_init does it for us. */
		mdb_cursor_init(&mc, txn, dbi, &mx);
	}
	return mdb_stat0(txn->mt_env, &txn->mt_dbs[dbi], arg);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x380, %rsp            # imm = 0x380
movq %rdx, %rbx
movl %esi, %edx
testq %rbx, %rbx
sete %cl
testq %rdi, %rdi
sete %sil
movl $0x16, %eax
orb %cl, %sil
jne 0xd5c8
movq %rdi, %r14
cmpl %edx, 0x78(%rdi)
jbe 0xd5c8
movq 0x70(%r14), %rcx
movl %edx, %r15d
movzbl (%rcx,%r15), %ecx
testb $0x8, %cl
je 0xd5c8
movl $0xffff87c2, %eax       # imm = 0xFFFF87C2
testb $0x13, 0x7c(%r14)
jne 0xd5c8
testb $0x2, %cl
je 0xd597
leaq 0x8(%rsp), %rdi
leaq 0x190(%rsp), %rcx
movq %r14, %rsi
callq 0x40be
movq 0x20(%r14), %rax
movq 0x58(%r14), %rcx
leaq (%r15,%r15,2), %rdx
shlq $0x4, %rdx
movl 0x10(%rax), %eax
movl %eax, (%rbx)
movzwl 0x6(%rcx,%rdx), %eax
movl %eax, 0x4(%rbx)
movups 0x8(%rcx,%rdx), %xmm0
movups %xmm0, 0x8(%rbx)
movups 0x18(%rcx,%rdx), %xmm0
movups %xmm0, 0x18(%rbx)
xorl %eax, %eax
addq $0x380, %rsp            # imm = 0x380
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_reader_list
int ESECT
mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx)
{
	unsigned int i, rdrs;
	MDB_reader *mr;
	char buf[64];
	int rc = 0, first = 1;

	if (!env || !func)
		return -1;
	if (!env->me_txns) {
		return func("(no reader locks)\n", ctx);
	}
	rdrs = env->me_txns->mti_numreaders;
	mr = env->me_txns->mti_readers;
	for (i=0; i<rdrs; i++) {
		if (mr[i].mr_pid) {
			txnid_t	txnid = mr[i].mr_txnid;
			sprintf(buf, txnid == (txnid_t)-1 ?
				"%10d %"Z"x -\n" : "%10d %"Z"x %"Z"u\n",
				(int)mr[i].mr_pid, (size_t)mr[i].mr_tid, txnid);
			if (first) {
				first = 0;
				rc = func("    pid     thread     txnid\n", ctx);
				if (rc < 0)
					break;
			}
			rc = func(buf, ctx);
			if (rc < 0)
				break;
		}
	}
	if (first) {
		rc = func("(no active readers)\n", ctx);
	}
	return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %rbx
testq %rdi, %rdi
sete %cl
testq %rsi, %rsi
sete %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orb %cl, %dl
jne 0xd709
movq %rsi, %r8
movq 0x40(%rdi), %r12
testq %r12, %r12
je 0xd6db
movl 0x38(%r12), %r13d
testq %r13, %r13
je 0xd6fc
negq %r13
addq $0x90, %r12
xorl %r15d, %r15d
leaq 0x1e4d(%rip), %rdi      # 0xf484
leaq 0x1e52(%rip), %rsi      # 0xf490
xorl %ebp, %ebp
xorl %eax, %eax
leaq 0x1(%rbp), %rdx
shlq $0x6, %rbp
addq %r12, %rbp
movq %rbp, %rcx
movq %rdx, %rbp
cmpl $0x0, -0x8(%rcx)
jne 0xd676
addq $0x40, %rcx
leaq 0x1(,%rbp), %rdx
addq %r13, %rdx
incq %rbp
cmpq $0x1, %rdx
jne 0xd653
jmp 0xd6f6
movq %r8, %r14
movq -0x10(%rcx), %r8
cmpq $-0x1, %r8
cmoveq %rdi, %rsi
movl -0x8(%rcx), %edx
movq (%rcx), %rcx
movq %rsp, %rdi
xorl %eax, %eax
callq 0x2370
testb $0x1, %r15b
jne 0xd6ac
leaq 0x1dfc(%rip), %rdi      # 0xf49e
movq %rbx, %rsi
callq *%r14
testl %eax, %eax
js 0xd709
movq %rsp, %rdi
movq %rbx, %rsi
callq *%r14
testl %eax, %eax
js 0xd709
movq %r13, %rcx
movb $0x1, %r15b
addq %rbp, %rcx
movq %r14, %r8
leaq 0x1db8(%rip), %rdi      # 0xf484
leaq 0x1dbd(%rip), %rsi      # 0xf490
jne 0xd642
jmp 0xd709
leaq 0x1d8f(%rip), %rdi      # 0xf471
movq %rbx, %rsi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%r8
testb $0x1, %r15b
jne 0xd709
leaq 0x1db9(%rip), %rdi      # 0xf4bc
movq %rbx, %rsi
callq *%r8
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_reader_check
int ESECT
mdb_reader_check(MDB_env *env, int *dead)
{
	if (!env)
		return EINVAL;
	if (dead)
		*dead = 0;
	return env->me_txns ? mdb_reader_check0(env, 0, dead) : MDB_SUCCESS;
}

// Assembly:
testq %rdi, %rdi
je 0xd736
movq %rsi, %rdx
testq %rsi, %rsi
je 0xd72b
movl $0x0, (%rdx)
cmpq $0x0, 0x40(%rdi)
je 0xd73c
xorl %esi, %esi
jmp 0xd73f
movl $0x16, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_mutex_failed
static int ESECT
mdb_mutex_failed(MDB_env *env, mdb_mutexref_t mutex, int rc)
{
	int rlocked, rc2;
	MDB_meta *meta;

	if (rc == MDB_OWNERDEAD) {
		/* We own the mutex. Clean up after dead previous owner. */
		rc = MDB_SUCCESS;
		rlocked = (mutex == env->me_rmutex);
		if (!rlocked) {
			/* Keep mti_txnid updated, otherwise next writer can
			 * overwrite data which latest meta page refers to.
			 */
			meta = mdb_env_pick_meta(env);
			env->me_txns->mti_txnid = meta->mm_txnid;
			/* env is hosed if the dead thread was ours */
			if (env->me_txn) {
				env->me_flags |= MDB_FATAL_ERROR;
				env->me_txn = NULL;
				rc = MDB_PANIC;
			}
		}
		DPRINTF(("%cmutex owner died, %s", (rlocked ? 'r' : 'w'),
			(rc ? "this process' env is hosed" : "recovering")));
		rc2 = mdb_reader_check0(env, rlocked, NULL);
		if (rc2 == 0)
			rc2 = mdb_mutex_consistent(mutex);
		if (rc || (rc = rc2)) {
			DPRINTF(("LOCK_MUTEX recovery failed, %s", mdb_strerror(rc)));
			UNLOCK_MUTEX(mutex);
		}
	} else {
#ifdef _WIN32
		rc = ErrCode();
#endif
		DPRINTF(("LOCK_MUTEX failed, %s", mdb_strerror(rc)));
	}

	return rc;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
cmpl $0x82, %edx
jne 0xd9dc
movq %rsi, %r14
movq 0x40(%rdi), %rax
leaq 0x8(%rax), %rcx
xorl %ebx, %ebx
xorl %esi, %esi
movb $0x1, %bpl
cmpq %r14, %rcx
sete %sil
je 0xd9b6
movq 0x48(%rdi), %rcx
movq 0x80(%rcx), %rcx
movq 0x50(%rdi), %rdx
xorl %r8d, %r8d
cmpq 0x80(%rdx), %rcx
setb %r8b
movq 0x48(%rdi,%r8,8), %rcx
movq 0x80(%rcx), %rcx
movq %rcx, 0x30(%rax)
cmpq $0x0, 0x60(%rdi)
je 0xd9b6
orb $-0x80, 0xf(%rdi)
movq $0x0, 0x60(%rdi)
movl $0xffff87b5, %ebx       # imm = 0xFFFF87B5
xorl %ebp, %ebp
xorl %edx, %edx
callq 0xd73f
testl %eax, %eax
jne 0xd9c9
movq %r14, %rdi
callq 0x2210
testb %bpl, %bpl
je 0xd9d4
movl %eax, %ebx
testl %eax, %eax
je 0xd9e3
movq %r14, %rdi
callq 0x2260
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
xorl %ebx, %ebx
jmp 0xd9dc
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_init_meta
static int ESECT
mdb_env_init_meta(MDB_env *env, MDB_meta *meta)
{
	MDB_page *p, *q;
	int rc;
	unsigned int	 psize;
#ifdef _WIN32
	DWORD len;
	OVERLAPPED ov;
	memset(&ov, 0, sizeof(ov));
#define DO_PWRITE(rc, fd, ptr, size, len, pos)	do { \
	ov.Offset = pos;	\
	rc = WriteFile(fd, ptr, size, &len, &ov);	} while(0)
#else
	int len;
#define DO_PWRITE(rc, fd, ptr, size, len, pos)	do { \
	len = pwrite(fd, ptr, size, pos);	\
	if (len == -1 && ErrCode() == EINTR) continue; \
	rc = (len >= 0); break; } while(1)
#endif

	DPUTS("writing new meta page");

	psize = env->me_psize;

	p = calloc(NUM_METAS, psize);
	p->mp_pgno = 0;
	p->mp_flags = P_META;
	*(MDB_meta *)METADATA(p) = *meta;

	q = (MDB_page *)((char *)p + psize);
	q->mp_pgno = 1;
	q->mp_flags = P_META;
	*(MDB_meta *)METADATA(q) = *meta;

	DO_PWRITE(rc, env->me_fd, p, psize * NUM_METAS, len, 0);
	if (!rc)
		rc = ErrCode();
	else if ((unsigned) len == psize * NUM_METAS)
		rc = MDB_SUCCESS;
	else
		rc = ENOSPC;
	free(p);
	return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r12
movq %rdi, %r14
movl 0x10(%rdi), %r15d
movl $0x2, %edi
movq %r15, %rsi
callq 0x2200
movq %rax, %rbx
movw $0x8, %bp
movw %bp, 0xa(%rax)
leaq 0x10(%rax), %rdi
movl $0x88, %edx
movq %r12, %rsi
callq 0x2240
leaq (%rbx,%r15), %rdi
addq $0x10, %rdi
movq $0x1, -0x10(%rdi)
movw %bp, -0x6(%rdi)
movl $0x88, %edx
movq %r12, %rsi
callq 0x2240
addl %r15d, %r15d
movl (%r14), %edi
movq %rbx, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x22a0
cmpl $-0x1, %eax
jne 0xda67
callq 0x2050
cmpl $0x4, (%rax)
je 0xda46
jmp 0xda7f
testl %eax, %eax
js 0xda7a
xorl %ecx, %ecx
cmpl %eax, %r15d
movl $0x1c, %ebp
cmovel %ecx, %ebp
jmp 0xda81
callq 0x2050
movl (%rax), %ebp
movq %rbx, %rdi
callq 0x2030
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_copythr
static THREAD_RET ESECT
mdb_env_copythr(void *arg)
{
	mdb_copy *my = arg;
	char *ptr;
	int toggle = 0, wsize, rc;
#ifdef _WIN32
	DWORD len;
#define DO_WRITE(rc, fd, ptr, w2, len)	rc = WriteFile(fd, ptr, w2, &len, NULL)
#else
	int len;
#define DO_WRITE(rc, fd, ptr, w2, len)	len = write(fd, ptr, w2); rc = (len >= 0)
#endif

	pthread_mutex_lock(&my->mc_mutex);
	my->mc_new = 0;
	pthread_cond_signal(&my->mc_cond);
	for(;;) {
		while (!my->mc_new)
			pthread_cond_wait(&my->mc_cond, &my->mc_mutex);
		if (my->mc_new < 0) {
			my->mc_new = 0;
			break;
		}
		my->mc_new = 0;
		wsize = my->mc_wlen[toggle];
		ptr = my->mc_wbuf[toggle];
again:
		while (wsize > 0) {
			DO_WRITE(rc, my->mc_fd, ptr, wsize, len);
			if (!rc) {
				rc = ErrCode();
				break;
			} else if (len > 0) {
				rc = MDB_SUCCESS;
				ptr += len;
				wsize -= len;
				continue;
			} else {
				rc = EIO;
				break;
			}
		}
		if (rc) {
			my->mc_status = rc;
			break;
		}
		/* If there's an overflow page tail, write it too */
		if (my->mc_olen[toggle]) {
			wsize = my->mc_olen[toggle];
			ptr = my->mc_over[toggle];
			my->mc_olen[toggle] = 0;
			goto again;
		}
		my->mc_wlen[toggle] = 0;
		toggle ^= 1;
		pthread_cond_signal(&my->mc_cond);
	}
	pthread_cond_signal(&my->mc_cond);
	pthread_mutex_unlock(&my->mc_mutex);
	return (THREAD_RET)0;
#undef DO_WRITE
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x2410
movl $0x0, 0xa8(%rbx)
leaq 0x28(%rbx), %r14
movq %r14, %rdi
callq 0x21f0
xorl %ebp, %ebp
cmpl $0x0, 0xa8(%rbx)
jne 0xdad5
movq %r14, %rdi
movq %rbx, %rsi
callq 0x20f0
jmp 0xdabf
cmpl $0x0, 0xa8(%rbx)
movl $0x0, 0xa8(%rbx)
js 0xdb7c
movl %ebp, %r12d
movl 0x88(%rbx,%r12,4), %r13d
movq 0x58(%rbx,%r12,8), %r15
testl %r13d, %r13d
jle 0xdb35
movl 0xa0(%rbx), %edi
movl %r13d, %edx
movq %r15, %rsi
callq 0x20d0
testl %eax, %eax
js 0xdb2a
je 0xdb71
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r15
subl %eax, %r13d
jg 0xdb01
jmp 0xdb35
callq 0x2050
movl (%rax), %eax
testl %eax, %eax
jne 0xdb76
movl 0x90(%rbx,%r12,4), %r13d
testl %r13d, %r13d
je 0xdb55
movq 0x68(%rbx,%r12,8), %r15
movl $0x0, 0x90(%rbx,%r12,4)
jmp 0xdafc
movl $0x0, 0x88(%rbx,%r12,4)
xorl $0x1, %ebp
movq %r14, %rdi
callq 0x21f0
jmp 0xdabf
movl $0x5, %eax
movl %eax, 0xa4(%rbx)
movq %r14, %rdi
callq 0x21f0
movq %rbx, %rdi
callq 0x2260
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_cthr_toggle
static int ESECT
mdb_env_cthr_toggle(mdb_copy *my, int st)
{
	int toggle = my->mc_toggle ^ 1;
	pthread_mutex_lock(&my->mc_mutex);
	if (my->mc_status) {
		pthread_mutex_unlock(&my->mc_mutex);
		return my->mc_status;
	}
	while (my->mc_new == 1)
		pthread_cond_wait(&my->mc_cond, &my->mc_mutex);
	my->mc_new = st;
	my->mc_toggle = toggle;
	pthread_cond_signal(&my->mc_cond);
	pthread_mutex_unlock(&my->mc_mutex);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl 0xac(%rdi), %r15d
callq 0x2410
cmpl $0x0, 0xa4(%rbx)
je 0xe175
movq %rbx, %rdi
callq 0x2260
movl 0xa4(%rbx), %eax
jmp 0xe1be
xorl $0x1, %r15d
movl 0xa8(%rbx), %eax
cmpl $0x1, %eax
jne 0xe19e
leaq 0x28(%rbx), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x20f0
movl 0xa8(%rbx), %eax
cmpl $0x1, %eax
je 0xe188
movl %ebp, 0xa8(%rbx)
movl %r15d, 0xac(%rbx)
leaq 0x28(%rbx), %rdi
callq 0x21f0
movq %rbx, %rdi
callq 0x2260
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/hkbu-victor[P]SFastLDA/doc_uci_to_word_uci.cpp
// Function: parse_args(int, char**)
int parse_args(int argc, char **argv){
	char *arg;

	inputFile = NULL;
	outputFile = NULL;

	if (argc < 5){
		show_help();
		return -1;
	}

	int i = 0;
	while (i < argc){
		arg = argv[i];

		if (strcmp(arg,"-inputFile")==0){
			inputFile = argv[++i];
		} else if (strcmp(arg,"-outputFile")==0){
			outputFile = argv[++i];
		} else {
            // any more
		}
		i++;
	}
	if (strcmp(inputFile, outputFile) == 0){
		printf("\n***Input file and output file have the same path and name !!!\n");
		return -1;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %r14d, %r14d
movq %r14, 0x2e4e(%rip)      # 0x4088
movq %r14, 0x2e4f(%rip)      # 0x4090
cmpl $0x5, %edi
jge 0x1250
callq 0x11dc
jmp 0x12dd
movq %rsi, %rbx
movl %edi, %ebp
movq $0x0, (%rsp)
xorl %r13d, %r13d
movslq %r14d, %r12
movq (%rbx,%r12,8), %r15
movq %r15, %rdi
leaq 0xd93(%rip), %rsi       # 0x2004
callq 0x1090
testl %eax, %eax
je 0x12a4
movq %r15, %rdi
leaq 0xd8b(%rip), %rsi       # 0x200f
callq 0x1090
testl %eax, %eax
jne 0x12b5
leal 0x1(%r12), %r14d
movq 0x8(%rbx,%r12,8), %rcx
movq %rcx, (%rsp)
movq %rcx, 0x2dee(%rip)      # 0x4090
jmp 0x12b5
leal 0x1(%r12), %r14d
movq 0x8(%rbx,%r12,8), %r13
movq %r13, 0x2dd3(%rip)      # 0x4088
incl %r14d
cmpl %ebp, %r14d
jl 0x1260
movq %r13, %rdi
movq (%rsp), %rsi
callq 0x1090
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x12e2
leaq 0xf56(%rip), %rdi       # 0x222e
callq 0x10b0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::nodeStart(char*, short)
void MP1Node::nodeStart(char *servaddrstr, short servport) {
    Address joinaddr;
    joinaddr = getJoinAddress();

    // Self booting routines
    if( initThisNode(&joinaddr) == -1 ) {
#ifdef DEBUGLOG
        log->LOG(&memberNode->addr, "init_thisnode failed. Exit.");
#endif
        exit(1);
    }

    if( !introduceSelfToGroup(&joinaddr) ) {
        finishUpThisNode();
#ifdef DEBUGLOG
        log->LOG(&memberNode->addr, "Unable to join self to group. Exiting.");
#endif
        exit(1);
    }

    return;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rsi
movl $0x1, (%rsi)
movw $0x0, 0x4(%rsi)
leaq 0x2(%rsp), %rdi
callq 0x4d12
movq 0x20(%rbx), %rax
movb $0x0, 0x10(%rax)
movw $0x1, 0xe(%rax)
movl $0x0, 0x14(%rax)
movq $0x0, 0x18(%rax)
movabsq $-0xfffffffb, %rcx      # imm = 0xFFFFFFFF00000005
movq %rcx, 0x20(%rax)
movq 0x28(%rax), %rcx
cmpq %rcx, 0x30(%rax)
je 0x26e0
movq %rcx, 0x30(%rax)
leaq 0x2(%rsp), %rsi
movq %rbx, %rdi
callq 0x2740
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::introduceSelfToGroup(Address*)
int MP1Node::introduceSelfToGroup(Address *joinaddr) {
	MessageHdr *msg;
#ifdef DEBUGLOG
    static char s[1024];
#endif

    if ( 0 == memcmp((char *)&(memberNode->addr.addr), (char *)&(joinaddr->addr), sizeof(memberNode->addr.addr))) {
        // I am the group booter (first process to join the group). Boot up the group
#ifdef DEBUGLOG
        log->LOG(&memberNode->addr, "Starting up group...");
#endif
        memberNode->inGroup = true;
        addOrUpdateMember(memberNode->addr, memberNode->heartbeat);
    }
    else {
        size_t msgsize = sizeof(MessageHdr) + sizeof(joinaddr->addr) + sizeof(long) + 1;
        msg = (MessageHdr *) malloc(msgsize * sizeof(char));

        // create JOINREQ message: format of data is {struct Address myaddr}
        msg->msgType = JOINREQ;
        memcpy((char *)(msg+1), &memberNode->addr.addr, sizeof(memberNode->addr.addr));
        memcpy((char *)(msg+1) + 1 + sizeof(memberNode->addr.addr), &memberNode->heartbeat, sizeof(long));

#ifdef DEBUGLOG
        sprintf(s, "Trying to join...");
        log->LOG(&memberNode->addr, s);
#endif

        // send JOINREQ message to introducer member
        emulNet->ENsend(&memberNode->addr, joinaddr, (char *)msg, msgsize);

        free(msg);
    }

    return 1;

}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %r13
leaq 0x8(%r13), %r15
movl 0x8(%r13), %eax
xorl (%rsi), %eax
movzwl 0xc(%r13), %ecx
xorw 0x4(%rsi), %cx
movzwl %cx, %ecx
orl %eax, %ecx
je 0x27f7
movq %rsi, %r14
movl $0x13, %edi
callq 0x2240
movq %rax, %r12
movl $0x0, (%rax)
movl (%r15), %eax
movl %eax, 0x4(%r12)
movzwl 0x4(%r15), %eax
movw %ax, 0x8(%r12)
movq 0x18(%r13), %rax
movq %rax, 0xb(%r12)
movups 0x486e(%rip), %xmm0     # 0x7019
movaps %xmm0, 0x8a1e(%rip)     # 0xb1d0
movw $0x2e, 0x8a25(%rip)     # 0xb1e0
leaq 0x8a0e(%rip), %rdx      # 0xb1d0
movq 0x10(%rbx), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x47f0
movq 0x8(%rbx), %rdi
movq 0x20(%rbx), %rsi
addq $0x8, %rsi
movq %r14, %rdx
movq %r12, %rcx
movl $0x13, %r8d
callq 0x3564
movq %r12, %rdi
callq 0x2210
jmp 0x2838
movq 0x10(%rbx), %rdi
leaq 0x4802(%rip), %rdx      # 0x7004
movq %r15, %rsi
xorl %eax, %eax
callq 0x47f0
movq 0x20(%rbx), %rsi
movb $0x1, 0xf(%rsi)
addq $0x8, %rsi
leaq 0xa(%rsp), %r14
movq %r14, %rdi
callq 0x4d04
movq 0x20(%rbx), %rax
movq 0x18(%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2876
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::finishUpThisNode()
int MP1Node::finishUpThisNode(){
   /*
    * Your code goes here
    */
    initMemberListTable(memberNode);
    memberNode->inGroup = false;
    return 0;
}

// Assembly:
movq 0x20(%rdi), %rax
movq 0x28(%rax), %rcx
cmpq %rcx, 0x30(%rax)
je 0x285e
movq %rcx, 0x30(%rax)
movb $0x0, 0xf(%rax)
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::addOrUpdateMember(Address, long)
void MP1Node::addOrUpdateMember(Address memberAddr, long heartbeat)
{
	int id = *(int*)(&memberAddr.addr[0]);
	int port = *(short*)(&memberAddr.addr[4]);
    bool memberFound = false;

    for (vector<MemberListEntry>::iterator iter = memberNode->memberList.begin();
            iter != memberNode->memberList.end(); ++iter)
    {
        if (iter->id == id && iter->port == port)
        {
            memberFound = true;
            if (iter->heartbeat < heartbeat)
            {
                iter->heartbeat = heartbeat;
                iter->timestamp = par->getcurrtime();
            }
            break;
        }
    }

    if (!memberFound)
    {
        memberNode->memberList.push_back(
            MemberListEntry(id, port, heartbeat, par->getcurrtime()));
        memberNode->nnb += 1;
        log->logNodeAdd(&memberNode->addr, &memberAddr);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %ebp
movzwl 0x4(%rsi), %r13d
movq 0x20(%rdi), %r12
movq 0x28(%r12), %r15
movq 0x30(%r12), %rax
cmpq %rax, %r15
je 0x28b6
cmpl %ebp, (%r15)
jne 0x28b0
cmpw %r13w, 0x4(%r15)
je 0x290e
addq $0x18, %r15
jmp 0x289f
addq $0x28, %r12
movq 0x18(%r14), %rdi
movq %rdx, %r15
callq 0x4cf8
movslq %eax, %r8
movswl %r13w, %edx
movq %rsp, %r13
movq %r13, %rdi
movl %ebp, %esi
movq %r15, %rcx
callq 0x4d38
movq %r12, %rdi
movq %r13, %rsi
callq 0x30ca
movq 0x20(%r14), %rsi
incl 0x14(%rsi)
movq 0x10(%r14), %rdi
addq $0x8, %rsi
movq %rbx, %rdx
callq 0x4aa4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq %rdx, 0x8(%r15)
jge 0x28ff
movq %rdx, 0x8(%r15)
movq 0x18(%r14), %rdi
callq 0x4cf8
cltq
movq %rax, 0x10(%r15)
jmp 0x28ff
nop
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::nodeLoop()
void MP1Node::nodeLoop() {
    if (memberNode->bFailed) {
    	return;
    }

    // Check my messages
    checkMessages();

    // Wait until you're in the group...
    if( !memberNode->inGroup ) {
    	return;
    }

    // ...then jump in and share your responsibilites!
    nodeLoopOps();

    return;
}

// Assembly:
pushq %rbx
movq 0x20(%rdi), %rax
cmpb $0x0, 0x10(%rax)
jne 0x2960
movq %rdi, %rbx
callq 0x2962
movq 0x20(%rbx), %rax
cmpb $0x1, 0xf(%rax)
jne 0x2960
movq %rbx, %rdi
callq 0x2b02
movq %rbx, %rdi
callq 0x2b88
movq %rbx, %rdi
popq %rbx
jmp 0x2c32
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::checkMessages()
void MP1Node::checkMessages() {
    void *ptr;
    int size;

    // Pop waiting messages from memberNode's mp1q
    while ( !memberNode->mp1q.empty() ) {
    	ptr = memberNode->mp1q.front().elt;
    	size = memberNode->mp1q.front().size;
    	memberNode->mp1q.pop();
    	recvCallBack((void *)memberNode, (char *)ptr, size);
    }
    return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
movq 0x58(%rdi), %rax
cmpq %rax, 0x78(%rdi)
je 0x2994
addq $0x48, %rdi
movq (%rax), %r14
callq 0x307c
movq %rbx, %rdi
movq %r14, %rdx
callq 0x29b6
movq 0x20(%rbx), %rdi
jmp 0x296d
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::recvCallBack(void*, char*, int)
bool MP1Node::recvCallBack(void *env, char *data, int size ) {
	/*
	 * Your code goes here
	 */
    MessageHdr *msg = (MessageHdr *) data;
    char *msgBody = (char *)(msg+1);
    Address senderAddr;
    long senderHeartbeat;
    switch (msg->msgType) {
        case JOINREQ:
            // create JOINREP message
            memcpy(&senderAddr, (char *)(msg+1), sizeof(memberNode->addr.addr));
            memcpy(&senderHeartbeat, (char *)(msg+1) + 1 + sizeof(memberNode->addr.addr), sizeof(long));
            addOrUpdateMember(senderAddr, senderHeartbeat);
            sendJoinRepMsg(senderAddr);
            break;
        case JOINREP:
            memberNode->inGroup = true;
            updateMemberList(msgBody);
            break;
        case UPDATEMEMLIST:
            updateMemberList(msgBody);
            break;
        default:
            return false;
    }
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x4(%rdx), %rsi
movl (%rdx), %eax
cmpl $0x2, %eax
je 0x2a45
cmpl $0x1, %eax
je 0x2a3d
testl %eax, %eax
jne 0x2a51
movzwl 0x4(%rsi), %eax
movq %rsp, %r14
movw %ax, 0x4(%r14)
movl (%rsi), %eax
movl %eax, (%r14)
movq 0xb(%rdx), %r15
leaq 0xc(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x4d04
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x2876
leaq 0x6(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x4d04
leaq 0x12(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d04
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x2d28
jmp 0x2a4d
movq 0x20(%rbx), %rax
movb $0x1, 0xf(%rax)
movq %rbx, %rdi
callq 0x2a8c
movb $0x1, %al
jmp 0x2a53
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::updateMemberList(char*)
void MP1Node::updateMemberList(char *data)
{
    int numOfMembers;
    memcpy(&numOfMembers, (char *)data, sizeof(int));
    MemberListEntry* memberListEntries = (MemberListEntry*) (data + sizeof(int));
    for (int i = 0; i < numOfMembers; ++i)
    {
        Address address = getAddressFromIPAndPort(memberListEntries[i].id,
                                                  memberListEntries[i].port);
        addOrUpdateMember(address, memberListEntries[i].heartbeat);
    }
}

// Assembly:
movslq (%rsi), %rax
testq %rax, %rax
jle 0x2b00
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
shlq $0x3, %rax
leaq (%rax,%rax,2), %r13
xorl %ebp, %ebp
leaq 0x12(%rsp), %r15
leaq 0xc(%rsp), %r12
movl 0x4(%rbx,%rbp), %eax
movzwl 0x8(%rbx,%rbp), %ecx
movl %eax, 0xc(%rsp)
movw %cx, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x4d04
movq 0xc(%rbx,%rbp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2876
addq $0x18, %rbp
cmpq %rbp, %r13
jne 0x2abc
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::increaseSelfHeartbeat()
void MP1Node::increaseSelfHeartbeat()
{
    ++memberNode->heartbeat;
    for (vector<MemberListEntry>::iterator iter = memberNode->memberList.begin();
            iter != memberNode->memberList.end(); ++iter)
    {
        Address addr = getAddressFromIPAndPort(iter->id, iter->port);
        if (addr == memberNode->addr)
        {
            iter->heartbeat = memberNode->heartbeat;
            iter->timestamp = par->getcurrtime();
            break;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq 0x20(%rdi), %rsi
incq 0x18(%rsi)
movq 0x28(%rsi), %r15
cmpq 0x30(%rsi), %r15
je 0x2b7d
movq %rdi, %rbx
addq $0x10, %r15
leaq 0x8(%rsp), %r14
movl -0x10(%r15), %eax
movzwl -0xc(%r15), %ecx
movl %eax, 0x8(%rsp)
movw %cx, 0xc(%rsp)
addq $0x8, %rsi
movq %r14, %rdi
callq 0x4d22
testb %al, %al
jne 0x2b63
leaq -0x10(%r15), %rax
movq 0x20(%rbx), %rsi
addq $0x18, %r15
addq $0x18, %rax
cmpq 0x30(%rsi), %rax
jne 0x2b29
jmp 0x2b7d
movq 0x20(%rbx), %rax
movq 0x18(%rax), %rax
movq %rax, -0x8(%r15)
movq 0x18(%rbx), %rdi
callq 0x4cf8
cltq
movq %rax, (%r15)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::deleteFailedNodes()
void MP1Node::deleteFailedNodes()
{
    long currentTime = par->getcurrtime();
    for (int i = memberNode->memberList.size() - 1; i >= 0; i--)
    {
        if (currentTime - memberNode->memberList[i].timestamp >= TREMOVE)
        {
            Address addr = getAddressFromIPAndPort(memberNode->memberList[i].id,
				memberNode->memberList[i].port);
            log->logNodeRemove(&memberNode->addr, &addr);
            memberNode->memberList.erase(begin(memberNode->memberList) + i);
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x4cf8
movq 0x20(%rbx), %rcx
movq 0x30(%rcx), %rdx
subq 0x28(%rcx), %rdx
shrq $0x3, %rdx
imull $0xaaaaaaab, %edx, %ecx # imm = 0xAAAAAAAB
decl %ecx
js 0x2c24
movslq %eax, %r15
addq $-0x13, %r15
movl %ecx, %eax
leaq 0x1(%rax), %r12
shlq $0x3, %rax
leaq (%rax,%rax,2), %r13
leaq 0x8(%rsp), %r14
movq 0x20(%rbx), %rsi
movq 0x28(%rsi), %rax
cmpq %r15, 0x10(%rax,%r13)
jge 0x2c1b
movl (%rax,%r13), %ecx
movzwl 0x4(%rax,%r13), %eax
movl %ecx, 0x8(%rsp)
movw %ax, 0xc(%rsp)
movq 0x10(%rbx), %rdi
addq $0x8, %rsi
movq %r14, %rdx
callq 0x4b22
movq 0x20(%rbx), %rdi
movq 0x28(%rdi), %rsi
addq %r13, %rsi
addq $0x28, %rdi
callq 0x32f6
addq $-0x18, %r13
decq %r12
jg 0x2bd5
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::sendMemberListToGroup()
void MP1Node::sendMemberListToGroup()
{
    long currentTime = par->getcurrtime();

	for (int i = 0; i < TPROP; i++) {

		/* initialize random seed: */
		srand (currentTime);

		/* generate secret number between 1 and 10: */
		int idx = rand() % memberNode->memberList.size();

	    if (currentTime - memberNode->memberList[idx].timestamp >= TFAIL)
	    {
	        continue;
	    }
	    Address addr = getAddressFromIPAndPort(memberNode->memberList[idx].id,
			memberNode->memberList[idx].port);
	    sendMemberListToMember(addr, UPDATEMEMLIST);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x4cf8
movl %eax, %ebp
movslq %eax, %r12
addq $-0x4, %r12
movb $0x1, %r15b
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
leaq 0x12(%rsp), %r14
movl %ebp, %edi
callq 0x2170
callq 0x2060
cltq
movq 0x20(%rbx), %rdx
movq 0x28(%rdx), %rcx
movq 0x30(%rdx), %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
imulq %r13, %rsi
xorl %edx, %edx
divq %rsi
movslq %edx, %rax
leaq (%rax,%rax,2), %rax
cmpq %r12, 0x10(%rcx,%rax,8)
jl 0x2ccf
leaq (%rcx,%rax,8), %rax
movl (%rax), %ecx
movzwl 0x4(%rax), %eax
movl %ecx, 0xc(%rsp)
movw %ax, 0x10(%rsp)
movq %r14, %rdi
leaq 0xc(%rsp), %rsi
callq 0x4d04
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0x2d28
testb $0x1, %r15b
movl $0x0, %r15d
jne 0x2c67
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::sendMemberListToMember(Address, MsgTypes)
void MP1Node::sendMemberListToMember(Address toAddress, MsgTypes msgType)
{
    int numOfMembers = memberNode->memberList.size();
    size_t msgsize = sizeof(MessageHdr) + sizeof(long) + numOfMembers * sizeof(MemberListEntry);
    MessageHdr *msg = (MessageHdr *) malloc(msgsize * sizeof(char));

    // create JOINREP message: format of data is {struct MemberListEntry}
    msg->msgType = msgType;
    memcpy((char *)(msg+1), &numOfMembers, sizeof(int));
    char *p = (char *)(msg+1) + sizeof(int);
    for (vector<MemberListEntry>::const_iterator iter = memberNode->memberList.begin();
            iter != memberNode->memberList.end(); ++iter)
    {
        memcpy(p, &(*iter), sizeof(MemberListEntry));
        p += sizeof(MemberListEntry);
    }

    // send JOINREQ message to introducer member
    emulNet->ENsend(&memberNode->addr, &toAddress, (char *)msg, msgsize);

    free(msg);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, 0x4(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movq 0x20(%rdi), %r14
movq 0x28(%r14), %rbx
movq 0x30(%r14), %r15
movq %r15, %rax
subq %rbx, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
movslq %ecx, %rbp
leaq (,%rbp,2), %rax
addq %rbp, %rax
leaq 0xc(,%rax,8), %r12
movq %r12, %rdi
callq 0x2240
movq %rax, %r13
movl 0x4(%rsp), %eax
movl %eax, (%r13)
movl %ebp, 0x4(%r13)
cmpq %rbx, %r15
je 0x2dbc
movq %r13, %rax
addq $0x8, %rax
movq 0x10(%rbx), %rcx
movq %rcx, 0x10(%rax)
movups (%rbx), %xmm0
movups %xmm0, (%rax)
addq $0x18, %rax
addq $0x18, %rbx
cmpq %r15, %rbx
jne 0x2da1
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x8, %r14
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rcx
movl %r12d, %r8d
callq 0x3564
movq %r13, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2210
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/EmulNet.cpp
// Function: EmulNet::EmulNet(Params*)
EmulNet::EmulNet(Params *p)
{
	//trace.funcEntry("EmulNet::EmulNet");
	int i,j;
	par = p;
	emulnet.setNextId(1);
	emulnet.settCurrBuffSize(0);
	enInited=0;
	for ( i = 0; i < MAX_NODES; i++ ) {
		for ( j = 0; j < MAX_TIME; j++ ) {
			sent_msgs[i][j] = 0;
			recv_msgs[i][j] = 0;
		}
	}
	//trace.funcExit("EmulNet::EmulNet", SUCCESS);
}

// Assembly:
leaq 0x795d(%rip), %rax      # 0xacd0
movq %rax, (%rdi)
leaq 0x7983(%rip), %rax      # 0xad00
movq %rax, 0x1b7e498(%rdi)
movq %rsi, 0x8(%rdi)
movq $0x1, 0x1b7e4a0(%rdi)
movl $0x0, 0x1b7e490(%rdi)
addq $0xdbf250, %rdi         # imm = 0xDBF250
xorl %eax, %eax
xorps %xmm0, %xmm0
xorl %ecx, %ecx
movups %xmm0, -0xdbf240(%rdi,%rcx,4)
movups %xmm0, (%rdi,%rcx,4)
addq $0x4, %rcx
cmpq $0xe10, %rcx            # imm = 0xE10
jne 0x33ab
incq %rax
addq $0x3840, %rdi           # imm = 0x3840
cmpq $0x3e8, %rax            # imm = 0x3E8
jne 0x33a9
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/csMOOC[P]UIUC/EmulNet.cpp
// Function: EmulNet::EmulNet(EmulNet&)
EmulNet::EmulNet(EmulNet &anotherEmulNet) {
	int i, j;
	this->par = anotherEmulNet.par;
	this->enInited = anotherEmulNet.enInited;
	for ( i = 0; i < MAX_NODES; i++ ) {
		for ( j = 0; j < MAX_TIME; j++ ) {
			this->sent_msgs[i][j] = anotherEmulNet.sent_msgs[i][j];
			this->recv_msgs[i][j] = anotherEmulNet.recv_msgs[i][j];
		}
	}
	this->emulnet = anotherEmulNet.emulnet;
}

// Assembly:
leaq 0x78f1(%rip), %rax      # 0xacd0
movq %rax, (%rdi)
leaq 0x7917(%rip), %rax      # 0xad00
movq %rax, 0x1b7e498(%rdi)
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdi)
movl 0x1b7e490(%rsi), %eax
movl %eax, 0x1b7e490(%rdi)
movl $0xdbf250, %eax         # imm = 0xDBF250
leaq (%rsi,%rax), %rcx
addq %rdi, %rax
xorl %edx, %edx
movl $0x3840, %r8d           # imm = 0x3840
xorl %r9d, %r9d
movl -0xdbf240(%rcx,%r9,4), %r10d
movl %r10d, -0xdbf240(%rax,%r9,4)
movl (%rcx,%r9,4), %r10d
movl %r10d, (%rax,%r9,4)
incq %r9
cmpq $0xe10, %r9             # imm = 0xE10
jne 0x341b
incq %rdx
addq %r8, %rcx
addq %r8, %rax
cmpq $0x3e8, %rdx            # imm = 0x3E8
jne 0x3418
movl 0x1b7e4a0(%rsi), %eax
movl %eax, 0x1b7e4a0(%rdi)
movq 0x1b7e4a4(%rsi), %rax
movq %rax, 0x1b7e4a4(%rdi)
testl %eax, %eax
jle 0x3492
movl %eax, %eax
addq $0x36fc96, %rax         # imm = 0x36FC96
movq (%rsi,%rax,8), %rcx
movq %rcx, (%rdi,%rax,8)
leaq -0x1(%rax), %rcx
addq $-0x36fc96, %rax        # imm = 0xFFC9036A
cmpq $0x1, %rax
movq %rcx, %rax
ja 0x3477
retq
nop