LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_txn_renew
int
mdb_txn_renew(MDB_txn *txn)
{
	int rc;

	if (!txn || !F_ISSET(txn->mt_flags, MDB_TXN_RDONLY|MDB_TXN_FINISHED))
		return EINVAL;

	rc = mdb_txn_renew0(txn);
	if (rc == MDB_SUCCESS) {
		DPRINTF(("renew txn %"Z"u%c %p on mdbenv %p, root page %"Z"u",
			txn->mt_txnid, (txn->mt_flags & MDB_TXN_RDONLY) ? 'r' : 'w',
			(void *)txn, (void *)txn->mt_env, txn->mt_dbs[MAIN_DBI].md_root));
	}
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3486
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x20001, %eax          # imm = 0x20001
cmpl $0x20001, %eax          # imm = 0x20001
je 0x348f
movl $0x16, -0x4(%rbp)
jmp 0x34a9
movq -0x10(%rbp), %rdi
callq 0x34c0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x34a3
jmp 0x34a3
movl -0x14(%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_cursor_shadow
static int
mdb_cursor_shadow(MDB_txn *src, MDB_txn *dst)
{
	MDB_cursor *mc, *bk;
	MDB_xcursor *mx;
	size_t size;
	int i;

	for (i = src->mt_numdbs; --i >= 0; ) {
		if ((mc = src->mt_cursors[i]) != NULL) {
			size = sizeof(MDB_cursor);
			if (mc->mc_xcursor)
				size += sizeof(MDB_xcursor);
			for (; mc; mc = bk->mc_next) {
				bk = malloc(size);
				if (!bk)
					return ENOMEM;
				*bk = *mc;
				mc->mc_backup = bk;
				mc->mc_db = &dst->mt_dbs[i];
				/* Kill pointers into src - and dst to reduce abuse: The
				 * user may not use mc until dst ends. Otherwise we'd...
				 */
				mc->mc_txn    = NULL;	/* ...set this to dst */
				mc->mc_dbflag = NULL;	/* ...and &dst->mt_dbflags[i] */
				if ((mx = mc->mc_xcursor) != NULL) {
					*(MDB_xcursor *)(bk+1) = *mx;
					mx->mx_cursor.mc_txn = NULL; /* ...and dst. */
				}
				mc->mc_next = dst->mt_cursors[i];
				dst->mt_cursors[i] = mc;
			}
		}
	}
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x78(%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
jl 0x4012
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x400d
movq $0x188, -0x38(%rbp)     # imm = 0x188
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x3f1b
movq -0x38(%rbp), %rax
addq $0x1f0, %rax            # imm = 0x1F0
movq %rax, -0x38(%rbp)
jmp 0x3f1d
cmpq $0x0, -0x20(%rbp)
je 0x400b
movq -0x38(%rbp), %rdi
callq 0x2260
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x3f48
movl $0xc, -0x4(%rbp)
jmp 0x4019
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x188, %edx            # imm = 0x188
callq 0x2230
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movslq -0x3c(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x3fd0
movq -0x28(%rbp), %rdi
addq $0x188, %rdi            # imm = 0x188
movq -0x30(%rbp), %rsi
movl $0x1f0, %edx            # imm = 0x1F0
callq 0x2230
movq -0x30(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x3c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x3f1d
jmp 0x400d
jmp 0x3eca
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_txn_reset
void
mdb_txn_reset(MDB_txn *txn)
{
	if (txn == NULL)
		return;

	/* This call is only valid for read-only txns */
	if (!(txn->mt_flags & MDB_TXN_RDONLY))
		return;

	mdb_txn_end(txn, MDB_END_RESET);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x42e5
jmp 0x4306
movq -0x8(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
jne 0x42f8
jmp 0x4306
movq -0x8(%rbp), %rdi
movl $0x3, %esi
callq 0x4030
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_txn_abort
void
mdb_txn_abort(MDB_txn *txn)
{
	if (txn == NULL)
		return;

	if (txn->mt_child)
		mdb_txn_abort(txn->mt_child);

	mdb_txn_end(txn, MDB_END_ABORT|MDB_END_SLOT|MDB_END_FREE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x4325
jmp 0x434b
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x433d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4310
movq -0x8(%rbp), %rdi
movl $0x200022, %esi         # imm = 0x200022
callq 0x4030
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_cursors_close
static void
mdb_cursors_close(MDB_txn *txn, unsigned merge)
{
	MDB_cursor **cursors = txn->mt_cursors, *mc, *next, *bk;
	MDB_xcursor *mx;
	int i;

	for (i = txn->mt_numdbs; --i >= 0; ) {
		for (mc = cursors[i]; mc; mc = next) {
			next = mc->mc_next;
			if ((bk = mc->mc_backup) != NULL) {
				if (merge) {
					/* Commit changes to parent txn */
					mc->mc_next = bk->mc_next;
					mc->mc_backup = bk->mc_backup;
					mc->mc_txn = bk->mc_txn;
					mc->mc_db = bk->mc_db;
					mc->mc_dbflag = bk->mc_dbflag;
					if ((mx = mc->mc_xcursor) != NULL)
						mx->mx_cursor.mc_txn = bk->mc_txn;
				} else {
					/* Abort nested txn */
					*mc = *bk;
					if ((mx = mc->mc_xcursor) != NULL)
						*mx = *(MDB_xcursor *)(bk+1);
				}
				mc = bk;
			}
			/* Only malloced cursors are permanently tracked. */
			free(mc);
		}
		cursors[i] = NULL;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x78(%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
jl 0x4d2d
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x4d18
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x4d02
cmpl $0x0, -0xc(%rbp)
je 0x4cbb
movq -0x30(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x4cb9
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x4cfa
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x188, %edx            # imm = 0x188
callq 0x2230
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x4cf8
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x188, %rsi            # imm = 0x188
movl $0x1f0, %edx            # imm = 0x1F0
callq 0x2230
jmp 0x4cfa
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2030
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x4c17
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0x4bf5
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_cursor_init
static void
mdb_cursor_init(MDB_cursor *mc, MDB_txn *txn, MDB_dbi dbi, MDB_xcursor *mx)
{
	mc->mc_next = NULL;
	mc->mc_backup = NULL;
	mc->mc_dbi = dbi;
	mc->mc_txn = txn;
	mc->mc_db = &txn->mt_dbs[dbi];
	mc->mc_dbx = &txn->mt_dbxs[dbi];
	mc->mc_dbflag = &txn->mt_dbflags[dbi];
	mc->mc_snum = 0;
	mc->mc_top = 0;
	mc->mc_pg[0] = 0;
	mc->mc_ki[0] = 0;
	mc->mc_flags = 0;
	if (txn->mt_dbs[dbi].md_flags & MDB_DUPSORT) {
		mdb_tassert(txn, mx != NULL);
		mc->mc_xcursor = mx;
		mdb_xcursor_init0(mc);
	} else {
		mc->mc_xcursor = NULL;
	}
	if (*mc->mc_dbflag & DB_STALE) {
		mdb_page_search(mc, NULL, MDB_PS_ROOTONLY);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
movl -0x14(%rbp), %eax
imulq $0x30, %rax, %rax
addq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rcx
movl -0x14(%rbp), %eax
imulq $0x30, %rax, %rax
addq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rcx
movl -0x14(%rbp), %eax
addq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x40(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x42(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x148(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x44(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x4e6c
cmpq $0x0, -0x20(%rbp)
je 0x4e2d
jmp 0x4e55
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x12d85(%rip), %rsi     # 0x17bc1
leaq 0x12d89(%rip), %rdx     # 0x17bcc
leaq 0x125c5(%rip), %rcx     # 0x1740f
movl $0x1caf, %r8d           # imm = 0x1CAF
callq 0x133a0
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
callq 0x10490
jmp 0x4e78
movq -0x8(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movzbl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x4e9d
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0xeec0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_get
int
mdb_get(MDB_txn *txn, MDB_dbi dbi,
    MDB_val *key, MDB_val *data)
{
	MDB_cursor	mc;
	MDB_xcursor	mx;
	int exact = 0;
	DKBUF;

	DPRINTF(("===> get db %u key [%s]", dbi, DKEY(key)));

	if (!key || !data || !TXN_DBI_EXIST(txn, dbi, DB_USRVALID))
		return EINVAL;

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

	mdb_cursor_init(&mc, txn, dbi, &mx);
	return mdb_cursor_set(&mc, key, data, MDB_SET, &exact);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3b0, %rsp            # imm = 0x3B0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x3a4(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x78fc
cmpq $0x0, -0x28(%rbp)
je 0x78fc
cmpq $0x0, -0x10(%rbp)
je 0x78fc
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0x78fc
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x7905
movl $0x16, -0x4(%rbp)
jmp 0x795a
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x13, %eax
cmpl $0x0, %eax
je 0x791d
movl $0xffff87c2, -0x4(%rbp) # imm = 0xFFFF87C2
jmp 0x795a
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq -0x1b0(%rbp), %rdi
leaq -0x3a0(%rbp), %rcx
callq 0x4d40
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq -0x1b0(%rbp), %rdi
movl $0xf, %ecx
leaq -0x3a4(%rbp), %r8
callq 0x7970
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x3b0, %rsp            # imm = 0x3B0
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_node_read
static int
mdb_node_read(MDB_txn *txn, MDB_node *leaf, MDB_val *data)
{
	MDB_page	*omp;		/* overflow page */
	pgno_t		 pgno;
	int rc;

	if (!F_ISSET(leaf->mn_flags, F_BIGDATA)) {
		data->mv_size = NODEDSZ(leaf);
		data->mv_data = NODEDATA(leaf);
		return MDB_SUCCESS;
	}

	/* Read overflow data.
	 */
	data->mv_size = NODEDSZ(leaf);
	memcpy(&pgno, NODEDATA(leaf), sizeof(pgno));
	if ((rc = mdb_page_get(txn, pgno, &omp, NULL)) != 0) {
		DPRINTF(("read overflow page %"Z"u failed", pgno));
		return rc;
	}
	data->mv_data = METADATA(omp);

	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x8a79
movq -0x18(%rbp), %rax
movzwl (%rax), %eax
movq -0x18(%rbp), %rcx
movzwl 0x2(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
addq $0x8, %rcx
movq -0x18(%rbp), %rax
movzwl 0x6(%rax), %eax
cltq
addq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x8aec
movq -0x18(%rbp), %rax
movzwl (%rax), %eax
movq -0x18(%rbp), %rcx
movzwl 0x2(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movzwl 0x6(%rcx), %ecx
movslq %ecx, %rcx
movq 0x8(%rax,%rcx), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x28(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0xa740
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
je 0x8ad5
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8aec
movq -0x28(%rbp), %rcx
addq $0x10, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_page_new
static int
mdb_page_new(MDB_cursor *mc, uint32_t flags, int num, MDB_page **mp)
{
	MDB_page	*np;
	int rc;

	if ((rc = mdb_page_alloc(mc, num, &np)))
		return rc;
	DPRINTF(("allocated new mpage %"Z"u, page size %u",
	    np->mp_pgno, mc->mc_txn->mt_env->me_psize));
	np->mp_flags = flags | P_DIRTY;
	np->mp_lower = (PAGEHDRSZ-PAGEBASE);
	np->mp_upper = mc->mc_txn->mt_env->me_psize - PAGEBASE;

	if (IS_BRANCH(np))
		mc->mc_db->md_branch_pages++;
	else if (IS_LEAF(np))
		mc->mc_db->md_leaf_pages++;
	else if (IS_OVERFLOW(np)) {
		mc->mc_db->md_overflow_pages += num;
		np->mp_pages = num;
	}
	*mp = np;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
leaq -0x28(%rbp), %rdx
callq 0x9fa0
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
je 0x9a79
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x9b41
movl -0x14(%rbp), %eax
orl $0x10, %eax
movw %ax, %cx
movq -0x28(%rbp), %rax
movw %cx, 0xa(%rax)
movq -0x28(%rbp), %rax
movw $0x10, 0xc(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movl 0x10(%rax), %eax
subl $0x0, %eax
movw %ax, %cx
movq -0x28(%rbp), %rax
movw %cx, 0xe(%rax)
movq -0x28(%rbp), %rax
movzwl 0xa(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x9ad7
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x9b2f
movq -0x28(%rbp), %rax
movzwl 0xa(%rax), %eax
andl $0x2, %eax
cmpl $0x2, %eax
jne 0x9afd
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0x9b2d
movq -0x28(%rbp), %rax
movzwl 0xa(%rax), %eax
andl $0x4, %eax
cmpl $0x4, %eax
jne 0x9b2b
movslq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
addq 0x18(%rax), %rcx
movq %rcx, 0x18(%rax)
movl -0x18(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0xc(%rax)
jmp 0x9b2d
jmp 0x9b2f
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_cursor_push
static int
mdb_cursor_push(MDB_cursor *mc, MDB_page *mp)
{
	DPRINTF(("pushing page %"Z"u on db %d cursor %p", mp->mp_pgno,
		DDBI(mc), (void *) mc));

	if (mc->mc_snum >= CURSOR_STACK) {
		mc->mc_txn->mt_flags |= MDB_TXN_ERROR;
		return MDB_CURSOR_FULL;
	}

	mc->mc_top = mc->mc_snum++;
	mc->mc_pg[mc->mc_top] = mp;
	mc->mc_ki[mc->mc_top] = 0;

	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x40(%rax), %eax
cmpl $0x20, %eax
jl 0x9b83
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x7c(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x7c(%rax)
movl $0xffff87bd, -0x4(%rbp) # imm = 0xFFFF87BD
jmp 0x9bd0
movq -0x10(%rbp), %rax
movw 0x40(%rax), %cx
movw %cx, %dx
addw $0x1, %dx
movw %dx, 0x40(%rax)
movq -0x10(%rbp), %rax
movw %cx, 0x42(%rax)
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movzwl 0x42(%rcx), %ecx
movq %rdx, 0x48(%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movzwl 0x42(%rcx), %ecx
movw $0x0, 0x148(%rax,%rcx,2)
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_cursor_touch
static int
mdb_cursor_touch(MDB_cursor *mc)
{
	int rc = MDB_SUCCESS;

	if (mc->mc_dbi >= CORE_DBS && !(*mc->mc_dbflag & DB_DIRTY)) {
		MDB_cursor mc2;
		MDB_xcursor mcx;
		if (TXN_DBI_CHANGED(mc->mc_txn, mc->mc_dbi))
			return MDB_BAD_DBI;
		mdb_cursor_init(&mc2, mc->mc_txn, MAIN_DBI, &mcx);
		rc = mdb_page_search(&mc2, &mc->mc_dbx->md_name, MDB_PS_MODIFY);
		if (rc)
			 return rc;
		*mc->mc_dbflag |= DB_DIRTY;
	}
	mc->mc_top = 0;
	if (mc->mc_snum) {
		do {
			rc = mdb_page_touch(mc);
		} while (!rc && ++(mc->mc_top) < mc->mc_snum);
		mc->mc_top = mc->mc_snum-1;
	}
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x2, 0x20(%rax)
jb 0x9cb9
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movzbl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x9cb9
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x20(%rcx), %ecx
movl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq 0x20(%rcx), %rcx
movq 0x98(%rcx), %rcx
movq -0x10(%rbp), %rdx
movl 0x20(%rdx), %edx
cmpl (%rcx,%rdx,4), %eax
je 0x9c5c
movl $0xffff87c4, -0x4(%rbp) # imm = 0xFFFF87C4
jmp 0x9d36
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x1a0(%rbp), %rdi
movl $0x1, %edx
leaq -0x390(%rbp), %rcx
callq 0x4d40
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
leaq -0x1a0(%rbp), %rdi
movl $0x1, %edx
callq 0xeec0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x9ca9
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x9d36
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movzbl (%rax), %ecx
orl $0x1, %ecx
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movw $0x0, 0x42(%rax)
movq -0x10(%rbp), %rax
cmpw $0x0, 0x40(%rax)
je 0x9d30
jmp 0x9cd0
movq -0x10(%rbp), %rdi
callq 0xf430
movl %eax, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x14(%rbp)
movb %al, -0x391(%rbp)
jne 0x9d10
movq -0x10(%rbp), %rcx
movw 0x42(%rcx), %ax
addw $0x1, %ax
movw %ax, 0x42(%rcx)
movzwl %ax, %eax
movq -0x10(%rbp), %rcx
movzwl 0x40(%rcx), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0x391(%rbp)
movb -0x391(%rbp), %al
testb $0x1, %al
jne 0x9cd0
movq -0x10(%rbp), %rax
movzwl 0x40(%rax), %eax
subl $0x1, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x42(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_page_malloc
static MDB_page *
mdb_page_malloc(MDB_txn *txn, unsigned num)
{
	MDB_env *env = txn->mt_env;
	MDB_page *ret = env->me_dpages;
	size_t psize = env->me_psize, sz = psize, off;
	/* For ! #MDB_NOMEMINIT, psize counts how much to init.
	 * For a single page alloc, we init everything after the page header.
	 * For multi-page, we init the final page; if the caller needed that
	 * many pages they will be filling in at least up to the last page.
	 */
	if (num == 1) {
		if (ret) {
			VGMEMP_ALLOC(env, ret, sz);
			VGMEMP_DEFINED(ret, sizeof(ret->mp_next));
			env->me_dpages = ret->mp_next;
			return ret;
		}
		psize -= off = PAGEHDRSZ;
	} else {
		sz *= num;
		off = sz - psize;
	}
	if ((ret = malloc(sz)) != NULL) {
		VGMEMP_ALLOC(env, ret, sz);
		if (!(env->me_flags & MDB_NOMEMINIT)) {
			memset((char *)ret + off, 0, psize);
			ret->mp_pad = 0;
		}
	} else {
		txn->mt_flags |= MDB_TXN_ERROR;
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0xc0(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpl $0x1, -0x14(%rbp)
jne 0xab5f
cmpq $0x0, -0x28(%rbp)
je 0xab49
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0xc0(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xabcf
movq $0x10, -0x40(%rbp)
movq -0x30(%rbp), %rax
subq $0x10, %rax
movq %rax, -0x30(%rbp)
jmp 0xab77
movl -0x14(%rbp), %eax
imulq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
subq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2260
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xabba
movq -0x20(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
jne 0xabb8
movq -0x28(%rbp), %rdi
addq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rdx
xorl %esi, %esi
callq 0x2180
movq -0x28(%rbp), %rax
movw $0x0, 0x8(%rax)
jmp 0xabc7
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x7c(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_leaf_size
static size_t
mdb_leaf_size(MDB_env *env, MDB_val *key, MDB_val *data)
{
	size_t		 sz;

	sz = LEAFSIZE(key, data);
	if (sz > env->me_nodemax) {
		/* put on overflow page */
		sz -= data->mv_size - sizeof(pgno_t);
	}

	return EVEN(sz + sizeof(indx_t));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq -0x18(%rbp), %rcx
addq (%rcx), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0xdc(%rcx), %ecx
cmpq %rcx, %rax
jbe 0xafcf
movq -0x18(%rbp), %rax
movq (%rax), %rcx
subq $0x8, %rcx
movq -0x20(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x2, %rax
addq $0x1, %rax
andq $-0x2, %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_cursor_open
int
mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **ret)
{
	MDB_cursor	*mc;
	size_t size = sizeof(MDB_cursor);

	if (!ret || !TXN_DBI_EXIST(txn, dbi, DB_VALID))
		return EINVAL;

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

	if (dbi == FREE_DBI && !F_ISSET(txn->mt_flags, MDB_TXN_RDONLY))
		return EINVAL;

	if (txn->mt_dbs[dbi].md_flags & MDB_DUPSORT)
		size += sizeof(MDB_xcursor);

	if ((mc = malloc(size)) != NULL) {
		mdb_cursor_init(mc, txn, dbi, (MDB_xcursor *)(mc + 1));
		if (txn->mt_cursors) {
			mc->mc_next = txn->mt_cursors[dbi];
			txn->mt_cursors[dbi] = mc;
			mc->mc_flags |= C_UNTRACK;
		}
	} else {
		return ENOMEM;
	}

	*ret = mc;

	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x188, -0x30(%rbp)     # imm = 0x188
cmpq $0x0, -0x20(%rbp)
je 0xd94c
cmpq $0x0, -0x10(%rbp)
je 0xd94c
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0xd94c
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0xd958
movl $0x16, -0x4(%rbp)
jmp 0xda50
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x13, %eax
cmpl $0x0, %eax
je 0xd973
movl $0xffff87c2, -0x4(%rbp) # imm = 0xFFFF87C2
jmp 0xda50
cmpl $0x0, -0x14(%rbp)
jne 0xd998
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x20000, %eax          # imm = 0x20000
je 0xd998
movl $0x16, -0x4(%rbp)
jmp 0xda50
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xd9c4
movq -0x30(%rbp), %rax
addq $0x1f0, %rax            # imm = 0x1F0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2260
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xda35
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq -0x28(%rbp), %rcx
addq $0x188, %rcx            # imm = 0x188
callq 0x4d40
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0xda33
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movl -0x14(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
movl 0x44(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0x44(%rax)
jmp 0xda3e
movl $0xc, -0x4(%rbp)
jmp 0xda50
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_cursor_renew
int
mdb_cursor_renew(MDB_txn *txn, MDB_cursor *mc)
{
	if (!mc || !TXN_DBI_EXIST(txn, mc->mc_dbi, DB_VALID))
		return EINVAL;

	if ((mc->mc_flags & C_UNTRACK) || txn->mt_cursors)
		return EINVAL;

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

	mdb_cursor_init(mc, txn, mc->mc_dbi, mc->mc_xcursor);
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xdaa9
cmpq $0x0, -0x10(%rbp)
je 0xdaa9
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0xdaa9
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x20(%rcx), %ecx
movzbl (%rax,%rcx), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0xdab2
movl $0x16, -0x4(%rbp)
jmp 0xdb10
movq -0x18(%rbp), %rax
movl 0x44(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0xdacc
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0xdad5
movl $0x16, -0x4(%rbp)
jmp 0xdb10
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x13, %eax
cmpl $0x0, %eax
je 0xdaed
movl $0xffff87c2, -0x4(%rbp) # imm = 0xFFFF87C2
jmp 0xdb10
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movl 0x20(%rax), %edx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0x4d40
movl $0x0, -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_cursor_count
int
mdb_cursor_count(MDB_cursor *mc, size_t *countp)
{
	MDB_node	*leaf;

	if (mc == NULL || countp == NULL)
		return EINVAL;

	if (mc->mc_xcursor == NULL)
		return MDB_INCOMPATIBLE;

	if (mc->mc_txn->mt_flags & MDB_TXN_BLOCKED)
		return MDB_BAD_TXN;

	if (!(mc->mc_flags & C_INITIALIZED))
		return EINVAL;

	if (!mc->mc_snum || (mc->mc_flags & C_EOF))
		return MDB_NOTFOUND;

	leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]);
	if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) {
		*countp = 1;
	} else {
		if (!(mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED))
			return EINVAL;

		*countp = mc->mc_xcursor->mx_db.md_entries;
	}
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xdb3a
cmpq $0x0, -0x18(%rbp)
jne 0xdb46
movl $0x16, -0x4(%rbp)
jmp 0xdc58
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xdb5d
movl $0xffff87c0, -0x4(%rbp) # imm = 0xFFFF87C0
jmp 0xdc58
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x7c(%rax), %eax
andl $0x13, %eax
cmpl $0x0, %eax
je 0xdb7c
movl $0xffff87c2, -0x4(%rbp) # imm = 0xFFFF87C2
jmp 0xdc58
movq -0x10(%rbp), %rax
movl 0x44(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xdb97
movl $0x16, -0x4(%rbp)
jmp 0xdc58
movq -0x10(%rbp), %rax
cmpw $0x0, 0x40(%rax)
je 0xdbb1
movq -0x10(%rbp), %rax
movl 0x44(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xdbbd
movl $0xffff87b2, -0x4(%rbp) # imm = 0xFFFF87B2
jmp 0xdc58
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movzwl 0x42(%rcx), %ecx
movq 0x48(%rax,%rcx,8), %rax
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rdx
movzwl 0x42(%rdx), %edx
movq 0x48(%rcx,%rdx,8), %rcx
movq -0x10(%rbp), %rdx
movq -0x10(%rbp), %rsi
movzwl 0x42(%rsi), %esi
movzwl 0x148(%rdx,%rsi,2), %edx
movzwl 0x10(%rcx,%rdx,2), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzwl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x4, %eax
je 0xdc1f
movq -0x18(%rbp), %rax
movq $0x1, (%rax)
jmp 0xdc51
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x44(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xdc3b
movl $0x16, -0x4(%rbp)
jmp 0xdc58
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x1a8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_cursor_close
void
mdb_cursor_close(MDB_cursor *mc)
{
	if (mc && !mc->mc_backup) {
		/* remove from txn, if tracked */
		if ((mc->mc_flags & C_UNTRACK) && mc->mc_txn->mt_cursors) {
			MDB_cursor **prev = &mc->mc_txn->mt_cursors[mc->mc_dbi];
			while (*prev && *prev != mc) prev = &(*prev)->mc_next;
			if (*prev == mc)
				*prev = mc->mc_next;
		}
		free(mc);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xdd22
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xdd22
movq -0x8(%rbp), %rax
movl 0x44(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0xdd19
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x0, 0x68(%rax)
je 0xdd19
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x68(%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x20(%rcx), %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, (%rcx)
movb %al, -0x11(%rbp)
je 0xdce6
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq -0x8(%rbp), %rax
setne %al
movb %al, -0x11(%rbp)
movb -0x11(%rbp), %al
testb $0x1, %al
jne 0xdcef
jmp 0xdcfc
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0xdcc6
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0xdd17
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0xdd19
movq -0x8(%rbp), %rdi
callq 0x2030
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_del
int
mdb_del(MDB_txn *txn, MDB_dbi dbi,
    MDB_val *key, MDB_val *data)
{
	if (!key || !TXN_DBI_EXIST(txn, dbi, DB_USRVALID))
		return EINVAL;

	if (txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED))
		return (txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN;

	if (!F_ISSET(txn->mt_dbs[dbi].md_flags, MDB_DUPSORT)) {
		/* must ignore any data */
		data = NULL;
	}

	return mdb_del0(txn, dbi, key, data, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xddc8
cmpq $0x0, -0x10(%rbp)
je 0xddc8
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0xddc8
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0xddd1
movl $0x16, -0x4(%rbp)
jmp 0xde44
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x20013, %eax          # imm = 0x20013
cmpl $0x0, %eax
je 0xde04
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %edx
andl $0x20000, %edx          # imm = 0x20000
movl $0xffff87c2, %eax       # imm = 0xFFFF87C2
movl $0xd, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0xde44
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x4, %eax
je 0xde2a
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
xorl %r8d, %r8d
callq 0xde50
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_del0
static int
mdb_del0(MDB_txn *txn, MDB_dbi dbi,
	MDB_val *key, MDB_val *data, unsigned flags)
{
	MDB_cursor mc;
	MDB_xcursor mx;
	MDB_cursor_op op;
	MDB_val rdata, *xdata;
	int		 rc, exact = 0;
	DKBUF;

	DPRINTF(("====> delete db %u key [%s]", dbi, DKEY(key)));

	mdb_cursor_init(&mc, txn, dbi, &mx);

	if (data) {
		op = MDB_GET_BOTH;
		rdata = *data;
		xdata = &rdata;
	} else {
		op = MDB_SET;
		xdata = NULL;
		flags |= MDB_NODUPDATA;
	}
	rc = mdb_cursor_set(&mc, key, xdata, op, &exact);
	if (rc == 0) {
		/* let mdb_page_split know about this cursor if needed:
		 * delete will trigger a rebalance; if it needs to move
		 * a node from one page to another, it will have to
		 * update the parent's separator key(s). If the new sepkey
		 * is larger than the current one, the parent page may
		 * run out of space, triggering a split. We need this
		 * cursor to be consistent until the end of the rebalance.
		 */
		mc.mc_flags |= C_UNTRACK;
		mc.mc_next = txn->mt_cursors[dbi];
		txn->mt_cursors[dbi] = &mc;
		rc = mdb_cursor_del(&mc, flags);
		txn->mt_cursors[dbi] = mc.mc_next;
	}
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3d0, %rsp            # imm = 0x3D0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl $0x0, -0x3c8(%rbp)
movq -0x8(%rbp), %rsi
movl -0xc(%rbp), %edx
leaq -0x1b0(%rbp), %rdi
leaq -0x3a0(%rbp), %rcx
callq 0x4d40
cmpq $0x0, -0x20(%rbp)
je 0xdecc
movl $0x2, -0x3a4(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x3b8(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x3b0(%rbp)
leaq -0x3b8(%rbp), %rax
movq %rax, -0x3c0(%rbp)
jmp 0xdeea
movl $0xf, -0x3a4(%rbp)
movq $0x0, -0x3c0(%rbp)
movl -0x24(%rbp), %eax
orl $0x20, %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rsi
movq -0x3c0(%rbp), %rdx
movl -0x3a4(%rbp), %ecx
leaq -0x1b0(%rbp), %rdi
leaq -0x3c8(%rbp), %r8
callq 0x7970
movl %eax, -0x3c4(%rbp)
cmpl $0x0, -0x3c4(%rbp)
jne 0xdf83
movl -0x16c(%rbp), %eax
orl $0x40, %eax
movl %eax, -0x16c(%rbp)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movl -0xc(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x1b0(%rbp)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movl -0xc(%rbp), %ecx
leaq -0x1b0(%rbp), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x24(%rbp), %esi
leaq -0x1b0(%rbp), %rdi
callq 0xcb70
movl %eax, -0x3c4(%rbp)
movq -0x1b0(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movl -0xc(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0x3c4(%rbp), %eax
addq $0x3d0, %rsp            # imm = 0x3D0
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_put
int
mdb_put(MDB_txn *txn, MDB_dbi dbi,
    MDB_val *key, MDB_val *data, unsigned int flags)
{
	MDB_cursor mc;
	MDB_xcursor mx;

	if (!key || !data || !TXN_DBI_EXIST(txn, dbi, DB_USRVALID))
		return EINVAL;

	if (flags & ~(MDB_NOOVERWRITE|MDB_NODUPDATA|MDB_RESERVE|MDB_APPEND|MDB_APPENDDUP))
		return EINVAL;

	if (txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED))
		return (txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN;

	mdb_cursor_init(&mc, txn, dbi, &mx);
	return mdb_cursor_put(&mc, key, data, flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3b0, %rsp            # imm = 0x3B0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xdff6
cmpq $0x0, -0x28(%rbp)
je 0xdff6
cmpq $0x0, -0x10(%rbp)
je 0xdff6
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0xdff6
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0xdfff
movl $0x16, -0x4(%rbp)
jmp 0xe07c
movl -0x2c(%rbp), %eax
andl $0xfff8ffcf, %eax       # imm = 0xFFF8FFCF
cmpl $0x0, %eax
je 0xe015
movl $0x16, -0x4(%rbp)
jmp 0xe07c
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x20013, %eax          # imm = 0x20013
cmpl $0x0, %eax
je 0xe048
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %edx
andl $0x20000, %edx          # imm = 0x20000
movl $0xffff87c2, %eax       # imm = 0xFFFF87C2
movl $0xd, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0xe07c
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq -0x1b8(%rbp), %rdi
leaq -0x3a8(%rbp), %rcx
callq 0x4d40
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl -0x2c(%rbp), %ecx
leaq -0x1b8(%rbp), %rdi
callq 0x4eb0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x3b0, %rsp            # imm = 0x3B0
popq %rbp
retq
nopl (%rax,%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_default_cmp
static void
mdb_default_cmp(MDB_txn *txn, MDB_dbi dbi)
{
	uint16_t f = txn->mt_dbs[dbi].md_flags;

	txn->mt_dbxs[dbi].md_cmp =
		(f & MDB_REVERSEKEY) ? mdb_cmp_memnr :
		(f & MDB_INTEGERKEY) ? mdb_cmp_cint  : mdb_cmp_memn;

	txn->mt_dbxs[dbi].md_dcmp =
		!(f & MDB_DUPSORT) ? 0 :
		((f & MDB_INTEGERDUP)
		 ? ((f & MDB_DUPFIXED)   ? mdb_cmp_int   : mdb_cmp_cint)
		 : ((f & MDB_REVERSEDUP) ? mdb_cmp_memnr : mdb_cmp_memn));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movw 0x4(%rax), %ax
movw %ax, -0xe(%rbp)
movzwl -0xe(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xe5be
leaq 0x3e98(%rip), %rax      # 0x12450
movq %rax, -0x18(%rbp)
jmp 0xe5de
movzwl -0xe(%rbp), %edx
andl $0x8, %edx
leaq 0x3f64(%rip), %rax      # 0x12530
leaq 0x16cd(%rip), %rcx      # 0xfca0
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movl -0xc(%rbp), %edx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movzwl -0xe(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0xe60c
xorl %eax, %eax
movq %rax, -0x20(%rbp)
jmp 0xe662
movzwl -0xe(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0xe63a
movzwl -0xe(%rbp), %edx
andl $0x10, %edx
leaq 0x167a(%rip), %rax      # 0xfca0
leaq -0xb39d(%rip), %rcx     # 0x3290
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0xe65a
movzwl -0xe(%rbp), %edx
andl $0x40, %edx
leaq 0x3ee8(%rip), %rax      # 0x12530
leaq 0x3e01(%rip), %rcx      # 0x12450
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movl -0xc(%rbp), %edx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
popq %rbp
retq
nop
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_dbi_close
void mdb_dbi_close(MDB_env *env, MDB_dbi dbi)
{
	char *ptr;
	if (dbi < CORE_DBS || dbi >= env->me_maxdbs)
		return;
	ptr = env->me_dbxs[dbi].md_name.mv_data;
	/* If there was no name, this was already closed */
	if (ptr) {
		env->me_dbxs[dbi].md_name.mv_data = NULL;
		env->me_dbxs[dbi].md_name.mv_size = 0;
		env->me_dbflags[dbi] = 0;
		env->me_dbiseqs[dbi]++;
		free(ptr);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $0x2, -0xc(%rbp)
jb 0xe6a1
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x24(%rcx), %eax
jb 0xe6a6
jmp 0xe737
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xe737
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movl -0xc(%rbp), %ecx
movw $0x0, (%rax,%rcx,2)
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rax
movl -0xc(%rbp), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x18(%rbp), %rdi
callq 0x2030
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_dbi_flags
int mdb_dbi_flags(MDB_txn *txn, MDB_dbi dbi, unsigned int *flags)
{
	/* We could return the flags for the FREE_DBI too but what's the point? */
	if (!TXN_DBI_EXIST(txn, dbi, DB_USRVALID))
		return EINVAL;
	*flags = txn->mt_dbs[dbi].md_flags & PERSISTENT_FLAGS;
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xe779
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0xe779
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0xe782
movl $0x16, -0x4(%rbp)
jmp 0xe7ab
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_set_compare
int mdb_set_compare(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp)
{
	if (!TXN_DBI_EXIST(txn, dbi, DB_USRVALID))
		return EINVAL;

	txn->mt_dbxs[dbi].md_cmp = cmp;
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xea49
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0xea49
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0xea52
movl $0x16, -0x4(%rbp)
jmp 0xea73
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movl -0x14(%rbp), %edx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%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_set_dupsort
int mdb_set_dupsort(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp)
{
	if (!TXN_DBI_EXIST(txn, dbi, DB_USRVALID))
		return EINVAL;

	txn->mt_dbxs[dbi].md_dcmp = cmp;
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xeab9
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0xeab9
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0xeac2
movl $0x16, -0x4(%rbp)
jmp 0xeae3
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movl -0x14(%rbp), %edx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%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_set_relfunc
int mdb_set_relfunc(MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel)
{
	if (!TXN_DBI_EXIST(txn, dbi, DB_USRVALID))
		return EINVAL;

	txn->mt_dbxs[dbi].md_rel = rel;
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xeb29
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0xeb29
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0xeb32
movl $0x16, -0x4(%rbp)
jmp 0xeb53
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movl -0x14(%rbp), %edx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x20(%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_set_relctx
int mdb_set_relctx(MDB_txn *txn, MDB_dbi dbi, void *ctx)
{
	if (!TXN_DBI_EXIST(txn, dbi, DB_USRVALID))
		return EINVAL;

	txn->mt_dbxs[dbi].md_relctx = ctx;
	return MDB_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xeb99
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0xeb99
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0xeba2
movl $0x16, -0x4(%rbp)
jmp 0xebc3
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movl -0x14(%rbp), %edx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x28(%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_reader_pid
static int
mdb_reader_pid(MDB_env *env, enum Pidlock_op op, MDB_PID_T pid)
{
#if !(MDB_PIDLOCK)		/* Currently the same as defined(_WIN32) */
	int ret = 0;
	HANDLE h;
	if (op == Pidcheck) {
		h = OpenProcess(env->me_pidquery, FALSE, pid);
		/* No documented "no such process" code, but other program use this: */
		if (!h)
			return ErrCode() != ERROR_INVALID_PARAMETER;
		/* A process exists until all handles to it close. Has it exited? */
		ret = WaitForSingleObject(h, 0) != 0;
		CloseHandle(h);
	}
	return ret;
#else
	for (;;) {
		int rc;
		struct flock lock_info;
		memset(&lock_info, 0, sizeof(lock_info));
		lock_info.l_type = F_WRLCK;
		lock_info.l_whence = SEEK_SET;
		lock_info.l_start = pid;
		lock_info.l_len = 1;
		if ((rc = fcntl(env->me_lfd, op, &lock_info)) == 0) {
			if (op == F_GETLK && lock_info.l_type != F_UNLCK)
				rc = -1;
		} else if ((rc = ErrCode()) == EINTR) {
			continue;
		}
		return rc;
	}
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2180
movw $0x1, -0x38(%rbp)
movw $0x0, -0x36(%rbp)
movslq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x1, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
movl -0xc(%rbp), %esi
leaq -0x38(%rbp), %rdx
movb $0x0, %al
callq 0x20b0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jne 0xec43
cmpl $0x5, -0xc(%rbp)
jne 0xec41
movswl -0x38(%rbp), %eax
cmpl $0x2, %eax
je 0xec41
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
jmp 0xec56
callq 0x2050
movl (%rax), %eax
movl %eax, -0x14(%rbp)
cmpl $0x4, %eax
jne 0xec54
jmp 0xebe2
jmp 0xec56
movl -0x14(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop