LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7850
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x80(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq %rcx, 0x30(%rax)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2180
movw $0x0, -0x40(%rbp)
movw $0x0, -0x3e(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x1, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
movl $0x6, %esi
leaq -0x40(%rbp), %rdx
movb $0x0, %al
callq 0x20b0
movl %eax, %ecx
movl %ecx, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x41(%rbp)
je 0x144f0
callq 0x2050
movl (%rax), %eax
movl %eax, -0x14(%rbp)
cmpl $0x4, %eax
sete %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x144f9
jmp 0x144fb
jmp 0x144b7
movl -0x14(%rbp), %edx
xorl %ecx, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x14755
jmp 0x1479b
jmp 0x14757
movq -0x8(%rbp), %rax
movq 0xc0(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x14789
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc0(%rax)
movq -0x10(%rbp), %rdi
callq 0x2030
jmp 0x14757
movq -0x8(%rbp), %rdi
callq 0x14520
movq -0x8(%rbp), %rdi
callq 0x2030
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl -0x14(%rbp), %eax
andl $0xfeeaffff, %eax       # imm = 0xFEEAFFFF
cmpl $0x0, %eax
je 0x15094
movl $0x16, -0x4(%rbp)
jmp 0x150c0
cmpl $0x0, -0x18(%rbp)
je 0x150a9
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
jmp 0x150b9
movl -0x14(%rbp), %ecx
xorl $-0x1, %ecx
movq -0x10(%rbp), %rax
andl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_get_flags
int ESECT
mdb_env_get_flags(MDB_env *env, unsigned int *arg)
{
	if (!env || !arg)
		return EINVAL;

	*arg = env->me_flags & (CHANGEABLE|CHANGELESS);
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x150ea
cmpq $0x0, -0x18(%rbp)
jne 0x150f3
movl $0x16, -0x4(%rbp)
jmp 0x1510d
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x1ff4001, %ecx        # imm = 0x1FF4001
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_set_userctx
int ESECT
mdb_env_set_userctx(MDB_env *env, void *ctx)
{
	if (!env)
		return EINVAL;
	env->me_userctx = ctx;
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x1513c
movl $0x16, -0x4(%rbp)
jmp 0x15152
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xe8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_set_assert
int ESECT
mdb_env_set_assert(MDB_env *env, MDB_assert_func *func)
{
	if (!env)
		return EINVAL;
#ifndef NDEBUG
	env->me_assert_func = func;
#endif
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x151ac
movl $0x16, -0x4(%rbp)
jmp 0x151c2
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xf0(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_get_path
int ESECT
mdb_env_get_path(MDB_env *env, const char **arg)
{
	if (!env || !arg)
		return EINVAL;

	*arg = env->me_path;
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x151ea
cmpq $0x0, -0x18(%rbp)
jne 0x151f3
movl $0x16, -0x4(%rbp)
jmp 0x15209
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nop
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_get_fd
int ESECT
mdb_env_get_fd(MDB_env *env, mdb_filehandle_t *arg)
{
	if (!env || !arg)
		return EINVAL;

	*arg = env->me_fd;
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1522a
cmpq $0x0, -0x18(%rbp)
jne 0x15233
movl $0x16, -0x4(%rbp)
jmp 0x15246
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1526e
cmpq $0x0, -0x18(%rbp)
jne 0x15277
movl $0x16, -0x4(%rbp)
jmp 0x152a0
movq -0x10(%rbp), %rdi
callq 0x7850
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x18, %rsi
addq $0x30, %rsi
movq -0x18(%rbp), %rdx
callq 0x152b0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_stat0
static int ESECT
mdb_stat0(MDB_env *env, MDB_db *db, MDB_stat *arg)
{
	arg->ms_psize = env->me_psize;
	arg->ms_depth = db->md_depth;
	arg->ms_branch_pages = db->md_branch_pages;
	arg->ms_leaf_pages = db->md_leaf_pages;
	arg->ms_overflow_pages = db->md_overflow_pages;
	arg->ms_entries = db->md_entries;

	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movzwl 0x6(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
xorl %eax, %eax
popq %rbp
retq
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1533e
cmpq $0x0, -0x18(%rbp)
jne 0x1534a
movl $0x16, -0x4(%rbp)
jmp 0x153da
movq -0x10(%rbp), %rdi
callq 0x7850
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq 0x78(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x80(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x153c2
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movl 0x38(%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0x153c9
xorl %eax, %eax
movl %eax, -0x24(%rbp)
jmp 0x153c9
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x15437
cmpq $0x0, -0x10(%rbp)
je 0x15437
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0x15437
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x15440
movl $0x16, -0x4(%rbp)
jmp 0x154af
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x13, %eax
cmpl $0x0, %eax
je 0x15458
movl $0xffff87c2, -0x4(%rbp) # imm = 0xFFFF87C2
jmp 0x154af
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x15489
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq -0x1a8(%rbp), %rdi
leaq -0x398(%rbp), %rcx
callq 0x4d40
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
movl -0x14(%rbp), %eax
imulq $0x30, %rax, %rax
addq %rax, %rsi
movq -0x20(%rbp), %rdx
callq 0x152b0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x74(%rbp)
movl $0x1, -0x78(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x15503
cmpq $0x0, -0x18(%rbp)
jne 0x1550f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x15657
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jne 0x15533
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rsi
leaq 0x1f24(%rip), %rdi      # 0x1744d
callq *%rax
movl %eax, -0x4(%rbp)
jmp 0x15657
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movl 0x38(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
addq $0x80, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x15637
movq -0x30(%rbp), %rax
movl -0x24(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl $0x0, %eax
je 0x15627
movq -0x30(%rbp), %rax
movl -0x24(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x80(%rbp)
leaq -0x70(%rbp), %rdi
movq -0x80(%rbp), %rcx
leaq 0x1ec8(%rip), %rsi      # 0x1746c
leaq 0x1eb5(%rip), %rax      # 0x17460
cmpq $-0x1, %rcx
cmoveq %rax, %rsi
movq -0x30(%rbp), %rax
movl -0x24(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movq -0x30(%rbp), %rax
movl -0x24(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rcx
movq -0x80(%rbp), %r8
movb $0x0, %al
callq 0x2360
cmpl $0x0, -0x78(%rbp)
je 0x1560c
movl $0x0, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rsi
leaq 0x1e7d(%rip), %rdi      # 0x1747a
callq *%rax
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jge 0x1560a
jmp 0x15637
jmp 0x1560c
movq -0x18(%rbp), %rax
leaq -0x70(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq *%rax
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jge 0x15625
jmp 0x15637
jmp 0x15627
jmp 0x15629
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1555a
cmpl $0x0, -0x78(%rbp)
je 0x15651
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rsi
leaq 0x1e4c(%rip), %rdi      # 0x17498
callq *%rax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x15690
movl $0x16, -0x4(%rbp)
jmp 0x156cd
cmpq $0x0, -0x18(%rbp)
je 0x156a1
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x156c0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
xorl %esi, %esi
callq 0x156e0
movl %eax, -0x1c(%rbp)
jmp 0x156c7
xorl %eax, %eax
movl %eax, -0x1c(%rbp)
jmp 0x156c7
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpl $0x82, -0x14(%rbp)
jne 0x159d0
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x40(%rcx), %rcx
addq $0x8, %rcx
cmpq %rcx, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x1598f
movq -0x8(%rbp), %rdi
callq 0x7850
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x80(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq %rcx, 0x30(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x1598d
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x60(%rax)
movl $0xffff87b5, -0x14(%rbp) # imm = 0xFFFF87B5
jmp 0x1598f
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x156e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x159b4
movq -0x10(%rbp), %rdi
callq 0x2200
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x159c5
movl -0x1c(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x159ce
movq -0x10(%rbp), %rdi
callq 0x2250
jmp 0x159d2
jmp 0x159d2
movl -0x14(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_excl_lock
static int ESECT
mdb_env_excl_lock(MDB_env *env, int *excl)
{
	int rc = 0;
#ifdef _WIN32
	if (LockFile(env->me_lfd, 0, 0, 1, 0)) {
		*excl = 1;
	} else {
		OVERLAPPED ov;
		memset(&ov, 0, sizeof(ov));
		if (LockFileEx(env->me_lfd, 0, 0, 1, 0, &ov)) {
			*excl = 0;
		} else {
			rc = ErrCode();
		}
	}
#else
	struct flock lock_info;
	memset((void *)&lock_info, 0, sizeof(lock_info));
	lock_info.l_type = F_WRLCK;
	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) ;
	if (!rc) {
		*excl = 1;
	} else
# ifndef MDB_USE_POSIX_MUTEX
	if (*excl < 0) /* always true when MDB_USE_POSIX_MUTEX */
# endif
	{
		lock_info.l_type = F_RDLCK;
		while ((rc = fcntl(env->me_lfd, F_SETLKW, &lock_info)) &&
				(rc = ErrCode()) == EINTR) ;
		if (rc == 0)
			*excl = 0;
	}
#endif
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2180
movw $0x1, -0x38(%rbp)
movw $0x0, -0x36(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x1, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
movl $0x6, %esi
leaq -0x38(%rbp), %rdx
movb $0x0, %al
callq 0x20b0
movl %eax, %ecx
movl %ecx, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
je 0x15a5c
callq 0x2050
movl (%rax), %eax
movl %eax, -0x14(%rbp)
cmpl $0x4, %eax
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x15a65
jmp 0x15a67
jmp 0x15a23
cmpl $0x0, -0x14(%rbp)
jne 0x15a79
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
jmp 0x15ad5
movw $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
movl $0x7, %esi
leaq -0x38(%rbp), %rdx
movb $0x0, %al
callq 0x20b0
movl %eax, %ecx
movl %ecx, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3a(%rbp)
je 0x15ab8
callq 0x2050
movl (%rax), %eax
movl %eax, -0x14(%rbp)
cmpl $0x4, %eax
sete %al
movb %al, -0x3a(%rbp)
movb -0x3a(%rbp), %al
testb $0x1, %al
jne 0x15ac1
jmp 0x15ac3
jmp 0x15a7f
cmpl $0x0, -0x14(%rbp)
jne 0x15ad3
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
jmp 0x15ad5
movl -0x14(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_read_header
static int ESECT
mdb_env_read_header(MDB_env *env, MDB_meta *meta)
{
	MDB_metabuf	pbuf;
	MDB_page	*p;
	MDB_meta	*m;
	int			i, rc, off;
	enum { Size = sizeof(pbuf) };

	/* We don't know the page size yet, so use a minimum value.
	 * Read both meta pages so we can use the latest one.
	 */

	for (i=off=0; i<NUM_METAS; i++, off += meta->mm_psize) {
#ifdef _WIN32
		DWORD len;
		OVERLAPPED ov;
		memset(&ov, 0, sizeof(ov));
		ov.Offset = off;
		rc = ReadFile(env->me_fd, &pbuf, Size, &len, &ov) ? (int)len : -1;
		if (rc == -1 && ErrCode() == ERROR_HANDLE_EOF)
			rc = 0;
#else
		rc = pread(env->me_fd, &pbuf, Size, off);
#endif
		if (rc != Size) {
			if (rc == 0 && off == 0)
				return ENOENT;
			rc = rc < 0 ? (int) ErrCode() : MDB_INVALID;
			DPRINTF(("read: %s", mdb_strerror(rc)));
			return rc;
		}

		p = (MDB_page *)&pbuf;

		if (!F_ISSET(p->mp_flags, P_META)) {
			DPRINTF(("page %"Z"u not a meta page", p->mp_pgno));
			return MDB_INVALID;
		}

		m = METADATA(p);
		if (m->mm_magic != MDB_MAGIC) {
			DPUTS("meta has invalid magic");
			return MDB_INVALID;
		}

		if (m->mm_version != MDB_DATA_VERSION) {
			DPRINTF(("database is version %u, expected version %u",
				m->mm_version, MDB_DATA_VERSION));
			return MDB_VERSION_MISMATCH;
		}

		if (off == 0 || m->mm_txnid > meta->mm_txnid)
			*meta = *m;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0xcc(%rbp)
movl $0x0, -0xc4(%rbp)
cmpl $0x2, -0xc4(%rbp)
jge 0x15c76
movq -0x10(%rbp), %rax
movl (%rax), %edi
movslq -0xcc(%rbp), %rcx
leaq -0xb0(%rbp), %rsi
movl $0x98, %edx
callq 0x2350
movl %eax, -0xc8(%rbp)
cmpl $0x98, -0xc8(%rbp)
je 0x15ba1
cmpl $0x0, -0xc8(%rbp)
jne 0x15b62
cmpl $0x0, -0xcc(%rbp)
jne 0x15b62
movl $0x2, -0x4(%rbp)
jmp 0x15c7d
cmpl $0x0, -0xc8(%rbp)
jge 0x15b7a
callq 0x2050
movl (%rax), %eax
movl %eax, -0xd0(%rbp)
jmp 0x15b87
movl $0xffff87b7, %eax       # imm = 0xFFFF87B7
movl %eax, -0xd0(%rbp)
jmp 0x15b87
movl -0xd0(%rbp), %eax
movl %eax, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15c7d
leaq -0xb0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movzwl 0xa(%rax), %eax
andl $0x8, %eax
cmpl $0x8, %eax
je 0x15bce
movl $0xffff87b7, -0x4(%rbp) # imm = 0xFFFF87B7
jmp 0x15c7d
movq -0xb8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
cmpl $0xbeefc0de, (%rax)     # imm = 0xBEEFC0DE
je 0x15bfb
movl $0xffff87b7, -0x4(%rbp) # imm = 0xFFFF87B7
jmp 0x15c7d
movq -0xc0(%rbp), %rax
cmpl $0x1, 0x4(%rax)
je 0x15c11
movl $0xffff87b6, -0x4(%rbp) # imm = 0xFFFF87B6
jmp 0x15c7d
cmpl $0x0, -0xcc(%rbp)
je 0x15c38
movq -0xc0(%rbp), %rax
movq 0x80(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x80(%rcx), %rcx
cmpq %rcx, %rax
jbe 0x15c4d
movq -0x18(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movl $0x88, %edx
callq 0x2230
jmp 0x15c4f
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
movq -0x18(%rbp), %rax
movl 0x18(%rax), %eax
addl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
jmp 0x15b07
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_env_init_meta0
static void ESECT
mdb_env_init_meta0(MDB_env *env, MDB_meta *meta)
{
	meta->mm_magic = MDB_MAGIC;
	meta->mm_version = MDB_DATA_VERSION;
	meta->mm_mapsize = env->me_mapsize;
	meta->mm_psize = env->me_psize;
	meta->mm_last_pg = NUM_METAS-1;
	meta->mm_flags = env->me_flags & 0xffff;
	meta->mm_flags |= MDB_INTEGERKEY; /* this is mm_dbs[FREE_DBI].md_flags */
	meta->mm_dbs[FREE_DBI].md_root = P_INVALID;
	meta->mm_dbs[MAIN_DBI].md_root = P_INVALID;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0xbeefc0de, (%rax)     # imm = 0xBEEFC0DE
movq -0x10(%rbp), %rax
movl $0x1, 0x4(%rax)
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq $0x1, 0x78(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x1c(%rax)
movq -0x10(%rbp), %rax
movzwl 0x1c(%rax), %ecx
orl $0x8, %ecx
movw %cx, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq $-0x1, 0x40(%rax)
movq -0x10(%rbp), %rax
movq $-0x1, 0x70(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, %esi
movl $0x2, %edi
callq 0x21f0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movw $0x8, 0xa(%rax)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rsi
movl $0x88, %edx
callq 0x2230
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq $0x1, (%rax)
movq -0x20(%rbp), %rax
movw $0x8, 0xa(%rax)
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rsi
movl $0x88, %edx
callq 0x2230
movq -0x8(%rbp), %rax
movl (%rax), %edi
movq -0x18(%rbp), %rsi
movl -0x28(%rbp), %eax
shll %eax
movl %eax, %eax
movl %eax, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2290
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x15de2
callq 0x2050
cmpl $0x4, (%rax)
jne 0x15de2
jmp 0x15df3
cmpl $0x0, -0x2c(%rbp)
setge %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x24(%rbp)
jmp 0x15dfb
movb $0x1, %al
testb $0x1, %al
jne 0x15db1
jmp 0x15dfb
cmpl $0x0, -0x24(%rbp)
jne 0x15e0d
callq 0x2050
movl (%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0x15e2b
movl -0x2c(%rbp), %eax
movl -0x28(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jne 0x15e22
movl $0x0, -0x24(%rbp)
jmp 0x15e29
movl $0x1c, -0x24(%rbp)
jmp 0x15e2b
movq -0x18(%rbp), %rdi
callq 0x2030
movl -0x24(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl 0xac(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2400
movq -0x10(%rbp), %rax
cmpl $0x0, 0xa4(%rax)
je 0x169fd
movq -0x10(%rbp), %rdi
callq 0x2250
movq -0x10(%rbp), %rax
movl 0xa4(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x16a58
jmp 0x169ff
movq -0x10(%rbp), %rax
movl 0xa8(%rax), %eax
cmpl $0x1, %eax
jne 0x16a21
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movq -0x10(%rbp), %rsi
callq 0x20e0
jmp 0x169ff
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xa8(%rax)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xac(%rax)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
callq 0x21e0
movq -0x10(%rbp), %rdi
callq 0x2250
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_fsize
static int ESECT
mdb_fsize(HANDLE fd, size_t *size)
{
#ifdef _WIN32
	LARGE_INTEGER fsize;

	if (!GetFileSizeEx(fd, &fsize))
		return ErrCode();

	*size = fsize.QuadPart;
#else
	struct stat st;

	if (fstat(fd, &st))
		return ErrCode();

	*size = st.st_size;
#endif
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %edi
leaq -0xa0(%rbp), %rsi
callq 0x23e0
cmpl $0x0, %eax
je 0x16aa2
callq 0x2050
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x16ab4
movq -0x70(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_pid_insert
static int ESECT
mdb_pid_insert(MDB_PID_T *ids, MDB_PID_T pid)
{
	/* binary search of pid in list */
	unsigned base = 0;
	unsigned cursor = 1;
	int val = 0;
	unsigned n = ids[0];

	while( 0 < n ) {
		unsigned pivot = n >> 1;
		cursor = base + pivot + 1;
		val = pid - ids[cursor];

		if( val < 0 ) {
			n = pivot;

		} else if ( val > 0 ) {
			base = cursor;
			n -= pivot + 1;

		} else {
			/* found, so it's a duplicate */
			return -1;
		}
	}

	if( val > 0 ) {
		++cursor;
	}
	ids[0]++;
	for (n = ids[0]; n > cursor; n--)
		ids[n] = ids[n-1];
	ids[n] = pid;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x1, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
xorl %eax, %eax
cmpl -0x24(%rbp), %eax
jae 0x16b4b
movl -0x24(%rbp), %eax
shrl %eax
movl %eax, -0x28(%rbp)
movl -0x18(%rbp), %eax
addl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movl -0x1c(%rbp), %edx
subl (%rcx,%rdx,4), %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x16b22
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x16b49
cmpl $0x0, -0x20(%rbp)
jle 0x16b3e
movl -0x1c(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
movl -0x24(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x24(%rbp)
jmp 0x16b47
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x16bae
jmp 0x16b49
jmp 0x16ae9
cmpl $0x0, -0x20(%rbp)
jle 0x16b5a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x16b9a
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x16b6e
movl -0x14(%rbp), %edx
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
// File: hkbu-victor[P]SFastLDA/doc_uci_to_word_uci.cpp
// Function: show_help()
void show_help(){
	printf("\nUCI data set conversion tool:\n");
	printf("\n doc-by-doc UCI data set ---> word-by-word data set\n");
	printf("=====================================\n");
	printf("Command line usage:\n");
	printf("doc_uci_to_w_uci -inputFile <string> -outputFile <string>\n");
	printf("=====================================\n");
}

// Assembly:
pushq %rax
leaq 0x1e2c(%rip), %rdi      # 0x3004
movb $0x0, %al
callq 0x1040
leaq 0x1e3e(%rip), %rdi      # 0x3024
movb $0x0, %al
callq 0x1040
leaq 0x1e66(%rip), %rdi      # 0x305a
movb $0x0, %al
callq 0x1040
leaq 0x1e7f(%rip), %rdi      # 0x3081
movb $0x0, %al
callq 0x1040
leaq 0x1e86(%rip), %rdi      # 0x3096
movb $0x0, %al
callq 0x1040
leaq 0x1e3c(%rip), %rdi      # 0x305a
movb $0x0, %al
callq 0x1040
popq %rax
retq
nopw (%rax,%rax)
// File: 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:
subq $0x28, %rsp
movl %edi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq $0x0, 0x3e38(%rip) # 0x5080
movq $0x0, 0x3e35(%rip) # 0x5088
cmpl $0x5, 0x20(%rsp)
jge 0x126c
callq 0x11d0
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x134d
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x20(%rsp), %eax
jge 0x1315
movq 0x18(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x1e30(%rip), %rsi      # 0x30d1
callq 0x1090
cmpl $0x0, %eax
jne 0x12cb
movq 0x18(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rsp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x3db7(%rip)      # 0x5080
jmp 0x1305
movq 0x10(%rsp), %rdi
leaq 0x1e05(%rip), %rsi      # 0x30dc
callq 0x1090
cmpl $0x0, %eax
jne 0x1301
movq 0x18(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rsp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x3d89(%rip)      # 0x5088
jmp 0x1303
jmp 0x1303
jmp 0x1305
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x1274
movq 0x3d64(%rip), %rdi      # 0x5080
movq 0x3d65(%rip), %rsi      # 0x5088
callq 0x1090
cmpl $0x0, %eax
jne 0x1345
leaq 0x1db4(%rip), %rdi      # 0x30e8
movb $0x0, %al
callq 0x1040
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x134d
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: csMOOC[P]UIUC/MP1Node.cpp
// Function: getAddressFromIPAndPort(int, short)
Address getAddressFromIPAndPort(int ip, short port)
{
    Address address;
    address.init();
    memcpy(&address.addr[0], &ip, sizeof(int));
    memcpy(&address.addr[sizeof(int)], &port, sizeof(short));
    return address;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x20(%rbp)
movw %dx, %ax
movq %rdi, %rcx
movq %rcx, -0x18(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movw %ax, -0xe(%rbp)
callq 0x4620
movq -0x20(%rbp), %rdi
callq 0x4630
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movl -0xc(%rbp), %ecx
movl %ecx, (%rdi)
movw -0xe(%rbp), %cx
movw %cx, 0x4(%rdi)
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::MP1Node(Member*, Params*, EmulNet*, Log*, Address*)
MP1Node::MP1Node(Member *member, Params *params, EmulNet *emul, Log *log, Address *address) {
	for( int i = 0; i < 6; i++ ) {
		NULLADDR[i] = 0;
	}
	this->memberNode = member;
	this->emulNet = emul;
	this->log = log;
	this->par = params;
	this->memberNode->addr = *address;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq 0x11509(%rip), %rcx     # 0x14c58
addq $0x10, %rcx
movq %rcx, (%rax)
movl $0x0, -0x34(%rbp)
cmpl $0x6, -0x34(%rbp)
jge 0x377b
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb $0x0, 0x28(%rax,%rcx)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x375d
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rsi
movq 0x20(%rax), %rdi
addq $0x8, %rdi
callq 0x9a70
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::recvLoop()
int MP1Node::recvLoop() {
    if ( memberNode->bFailed ) {
    	return false;
    }
    else {
    	return emulNet->ENrecv(&(memberNode->addr), enqueueWrapper, NULL, 1, &(memberNode->mp1q));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x20(%rax), %rax
testb $0x1, 0x10(%rax)
je 0x3827
movl $0x0, -0x4(%rbp)
jmp 0x3858
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq 0x20(%rax), %rsi
addq $0x8, %rsi
movq 0x20(%rax), %r9
addq $0x48, %r9
leaq 0x2a(%rip), %rdx        # 0x3870
xorl %eax, %eax
movl %eax, %ecx
movl $0x1, %r8d
callq 0x7120
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %dx, %ax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x4620
movq -0x28(%rbp), %rsi
leaq -0x1e(%rbp), %rdi
callq 0x39b0
leaq -0x18(%rbp), %rdi
leaq -0x1e(%rbp), %rsi
callq 0x9a70
movq -0x28(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3a00
cmpl $-0x1, %eax
jne 0x395c
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x20(%rax), %rsi
addq $0x8, %rsi
leaq 0xb6b9(%rip), %rdx      # 0xf004
movb $0x0, %al
callq 0x9090
movl $0x1, %edi
callq 0x32d0
movq -0x28(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3a70
cmpl $0x0, %eax
jne 0x399f
movq -0x28(%rbp), %rdi
callq 0x3bc0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x20(%rax), %rsi
addq $0x8, %rsi
leaq 0xb692(%rip), %rdx      # 0xf020
movb $0x0, %al
callq 0x9090
movl $0x1, %edi
callq 0x32d0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::getJoinAddress()
Address MP1Node::getJoinAddress() {
    Address joinaddr;

    memset(&joinaddr, 0, sizeof(Address));
    *(int *)(&joinaddr.addr) = 1;
    *(short *)(&joinaddr.addr[4]) = 0;

    return joinaddr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x20(%rbp)
movq %rdi, %rax
movq %rax, -0x18(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x4620
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x6, %edx
callq 0x3100
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movl $0x1, (%rdi)
movw $0x0, 0x4(%rdi)
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::initThisNode(Address*)
int MP1Node::initThisNode(Address *joinaddr) {
	/*
	 * This function is partially implemented and may require changes
	 */
	memberNode->bFailed = false;
	memberNode->inited = true;
	memberNode->inGroup = false;
    // node is up!
	memberNode->nnb = 0;
	memberNode->heartbeat = 0;
	memberNode->pingCounter = TFAIL;
	memberNode->timeOutCounter = -1;
    initMemberListTable(memberNode);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq 0x20(%rdi), %rax
movb $0x0, 0x10(%rax)
movq 0x20(%rdi), %rax
movb $0x1, 0xe(%rax)
movq 0x20(%rdi), %rax
movb $0x0, 0xf(%rax)
movq 0x20(%rdi), %rax
movl $0x0, 0x14(%rax)
movq 0x20(%rdi), %rax
movq $0x0, 0x18(%rax)
movq 0x20(%rdi), %rax
movl $0x5, 0x20(%rax)
movq 0x20(%rdi), %rax
movl $0xffffffff, 0x24(%rax) # imm = 0xFFFFFFFF
movq 0x20(%rdi), %rsi
callq 0x3c00
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq 0x20(%rax), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
movl $0x6, %edx
callq 0x30d0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3afb
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x20(%rax), %rsi
addq $0x8, %rsi
leaq 0xb58a(%rip), %rdx      # 0xf047
movb $0x0, %al
callq 0x9090
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rcx
movb $0x1, 0xf(%rcx)
movq 0x20(%rax), %rsi
addq $0x8, %rsi
leaq -0x1e(%rbp), %rdi
callq 0x9a40
movq -0x30(%rbp), %rdi
movq 0x20(%rdi), %rax
movq 0x18(%rax), %rdx
leaq -0x1e(%rbp), %rsi
callq 0x3c30
jmp 0x3ba8
movq $0x13, -0x28(%rbp)
movq -0x28(%rbp), %rdi
shlq $0x0, %rdi
callq 0x32f0
movq -0x30(%rbp), %rcx
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
movq 0x20(%rcx), %rdx
movl 0x8(%rdx), %esi
movl %esi, 0x4(%rax)
movw 0xc(%rdx), %dx
movw %dx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x20(%rcx), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, 0xb(%rax)
leaq 0x11711(%rip), %rdi     # 0x15260
leaq 0xb506(%rip), %rsi      # 0xf05c
movb $0x0, %al
callq 0x3060
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x20(%rax), %rsi
addq $0x8, %rsi
leaq 0x116ec(%rip), %rdx     # 0x15260
movb $0x0, %al
callq 0x9090
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movq 0x20(%rax), %rsi
addq $0x8, %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movl %eax, %r8d
callq 0x6e40
movq -0x18(%rbp), %rdi
callq 0x32c0
movl $0x1, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: csMOOC[P]UIUC/MP1Node.cpp
// Function: MP1Node::finishUpThisNode()
int MP1Node::finishUpThisNode(){
   /*
    * Your code goes here
    */
    initMemberListTable(memberNode);
    memberNode->inGroup = false;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
movq 0x20(%rdi), %rsi
callq 0x3c00
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movb $0x0, 0xf(%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rsi, -0x60(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl (%rsi), %ecx
movl %ecx, -0x1c(%rbp)
movswl 0x4(%rsi), %ecx
movl %ecx, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
movq 0x20(%rax), %rdi
addq $0x28, %rdi
callq 0x47a0
movq %rax, -0x30(%rbp)
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rdi
addq $0x28, %rdi
callq 0x4810
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x47d0
testb $0x1, %al
jne 0x3c9f
jmp 0x3d2a
leaq -0x30(%rbp), %rdi
callq 0x4840
movl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x3d1a
leaq -0x30(%rbp), %rdi
callq 0x4840
movswl 0x4(%rax), %eax
cmpl -0x20(%rbp), %eax
jne 0x3d1a
movb $0x1, -0x21(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4840
movq 0x8(%rax), %rax
cmpq -0x18(%rbp), %rax
jge 0x3d18
movq -0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4840
movq -0x70(%rbp), %rdx
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rdx, 0x8(%rcx)
movq 0x18(%rax), %rdi
callq 0x99f0
cltq
movq %rax, -0x68(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4840
movq -0x68(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x3d2a
jmp 0x3d1c
leaq -0x30(%rbp), %rdi
callq 0x4860
jmp 0x3c74
testb $0x1, -0x21(%rbp)
jne 0x3dbd
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x28, %rcx
movq %rcx, -0x78(%rbp)
movl -0x1c(%rbp), %ecx
movl %ecx, -0x8c(%rbp)
movl -0x20(%rbp), %ecx
movw %cx, -0x7a(%rbp)
movq -0x18(%rbp), %rcx
movq %rcx, -0x88(%rbp)
movq 0x18(%rax), %rdi
callq 0x99f0
movl -0x8c(%rbp), %esi
movq -0x88(%rbp), %rcx
movl %eax, %edx
movw -0x7a(%rbp), %ax
movslq %edx, %r8
leaq -0x50(%rbp), %rdi
movswl %ax, %edx
callq 0x9ae0
movq -0x78(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x4880
movq -0x58(%rbp), %rax
movq -0x60(%rbp), %rdx
movq 0x20(%rax), %rcx
movl 0x14(%rcx), %esi
addl $0x1, %esi
movl %esi, 0x14(%rcx)
movq 0x10(%rax), %rdi
movq 0x20(%rax), %rsi
addq $0x8, %rsi
callq 0x9450
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq 0x20(%rax), %rax
testb $0x1, 0x10(%rax)
je 0x3df0
jmp 0x3e12
movq -0x10(%rbp), %rdi
callq 0x3e20
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
testb $0x1, 0xf(%rax)
jne 0x3e09
jmp 0x3e12
movq -0x10(%rbp), %rdi
callq 0x3eb0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)