// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb.c
// Function: mdb_txn_commit
int
mdb_txn_commit(MDB_txn *txn)
{
	int		rc;
	unsigned int i, end_mode;
	MDB_env	*env;

	if (txn == NULL)
		return EINVAL;

	/* mdb_txn_end() mode for a commit which writes nothing */
	end_mode = MDB_END_EMPTY_COMMIT|MDB_END_UPDATE|MDB_END_SLOT|MDB_END_FREE;

	if (txn->mt_child) {
		rc = mdb_txn_commit(txn->mt_child);
		if (rc)
			goto fail;
	}

	env = txn->mt_env;

	if (F_ISSET(txn->mt_flags, MDB_TXN_RDONLY)) {
		goto done;
	}

	if (txn->mt_flags & (MDB_TXN_FINISHED|MDB_TXN_ERROR)) {
		DPUTS("txn has failed/finished, can't commit");
		if (txn->mt_parent)
			txn->mt_parent->mt_flags |= MDB_TXN_ERROR;
		rc = MDB_BAD_TXN;
		goto fail;
	}

	if (txn->mt_parent) {
		MDB_txn *parent = txn->mt_parent;
		MDB_page **lp;
		MDB_ID2L dst, src;
		MDB_IDL pspill;
		unsigned x, y, len, ps_len;

		/* Append our free list to parent's */
		rc = mdb_midl_append_list(&parent->mt_free_pgs, txn->mt_free_pgs);
		if (rc)
			goto fail;
		mdb_midl_free(txn->mt_free_pgs);
		/* Failures after this must either undo the changes
		 * to the parent or set MDB_TXN_ERROR in the parent.
		 */

		parent->mt_next_pgno = txn->mt_next_pgno;
		parent->mt_flags = txn->mt_flags;

		/* Merge our cursors into parent's and close them */
		mdb_cursors_close(txn, 1);

		/* Update parent's DB table. */
		memcpy(parent->mt_dbs, txn->mt_dbs, txn->mt_numdbs * sizeof(MDB_db));
		parent->mt_numdbs = txn->mt_numdbs;
		parent->mt_dbflags[FREE_DBI] = txn->mt_dbflags[FREE_DBI];
		parent->mt_dbflags[MAIN_DBI] = txn->mt_dbflags[MAIN_DBI];
		for (i=CORE_DBS; i<txn->mt_numdbs; i++) {
			/* preserve parent's DB_NEW status */
			x = parent->mt_dbflags[i] & DB_NEW;
			parent->mt_dbflags[i] = txn->mt_dbflags[i] | x;
		}

		dst = parent->mt_u.dirty_list;
		src = txn->mt_u.dirty_list;
		/* Remove anything in our dirty list from parent's spill list */
		if ((pspill = parent->mt_spill_pgs) && (ps_len = pspill[0])) {
			x = y = ps_len;
			pspill[0] = (pgno_t)-1;
			/* Mark our dirty pages as deleted in parent spill list */
			for (i=0, len=src[0].mid; ++i <= len; ) {
				MDB_ID pn = src[i].mid << 1;
				while (pn > pspill[x])
					x--;
				if (pn == pspill[x]) {
					pspill[x] = 1;
					y = --x;
				}
			}
			/* Squash deleted pagenums if we deleted any */
			for (x=y; ++x <= ps_len; )
				if (!(pspill[x] & 1))
					pspill[++y] = pspill[x];
			pspill[0] = y;
		}

		/* Find len = length of merging our dirty list with parent's */
		x = dst[0].mid;
		dst[0].mid = 0;		/* simplify loops */
		if (parent->mt_parent) {
			len = x + src[0].mid;
			y = mdb_mid2l_search(src, dst[x].mid + 1) - 1;
			for (i = x; y && i; y--) {
				pgno_t yp = src[y].mid;
				while (yp < dst[i].mid)
					i--;
				if (yp == dst[i].mid) {
					i--;
					len--;
				}
			}
		} else { /* Simplify the above for single-ancestor case */
			len = MDB_IDL_UM_MAX - txn->mt_dirty_room;
		}
		/* Merge our dirty list with parent's */
		y = src[0].mid;
		for (i = len; y; dst[i--] = src[y--]) {
			pgno_t yp = src[y].mid;
			while (yp < dst[x].mid)
				dst[i--] = dst[x--];
			if (yp == dst[x].mid)
				free(dst[x--].mptr);
		}
		mdb_tassert(txn, i == x);
		dst[0].mid = len;
		free(txn->mt_u.dirty_list);
		parent->mt_dirty_room = txn->mt_dirty_room;
		if (txn->mt_spill_pgs) {
			if (parent->mt_spill_pgs) {
				/* TODO: Prevent failure here, so parent does not fail */
				rc = mdb_midl_append_list(&parent->mt_spill_pgs, txn->mt_spill_pgs);
				if (rc)
					parent->mt_flags |= MDB_TXN_ERROR;
				mdb_midl_free(txn->mt_spill_pgs);
				mdb_midl_sort(parent->mt_spill_pgs);
			} else {
				parent->mt_spill_pgs = txn->mt_spill_pgs;
			}
		}

		/* Append our loose page list to parent's */
		for (lp = &parent->mt_loose_pgs; *lp; lp = &NEXT_LOOSE_PAGE(lp))
			;
		*lp = txn->mt_loose_pgs;
		parent->mt_loose_count += txn->mt_loose_count;

		parent->mt_child = NULL;
		mdb_midl_free(((MDB_ntxn *)txn)->mnt_pgstate.mf_pghead);
		free(txn);
		return rc;
	}

	if (txn != env->me_txn) {
		DPUTS("attempt to commit unknown transaction");
		rc = EINVAL;
		goto fail;
	}

	mdb_cursors_close(txn, 0);

	if (!txn->mt_u.dirty_list[0].mid &&
		!(txn->mt_flags & (MDB_TXN_DIRTY|MDB_TXN_SPILLS)))
		goto done;

	DPRINTF(("committing txn %"Z"u %p on mdbenv %p, root page %"Z"u",
	    txn->mt_txnid, (void*)txn, (void*)env, txn->mt_dbs[MAIN_DBI].md_root));

	/* Update DB root pointers */
	if (txn->mt_numdbs > CORE_DBS) {
		MDB_cursor mc;
		MDB_dbi i;
		MDB_val data;
		data.mv_size = sizeof(MDB_db);

		mdb_cursor_init(&mc, txn, MAIN_DBI, NULL);
		for (i = CORE_DBS; i < txn->mt_numdbs; i++) {
			if (txn->mt_dbflags[i] & DB_DIRTY) {
				if (TXN_DBI_CHANGED(txn, i)) {
					rc = MDB_BAD_DBI;
					goto fail;
				}
				data.mv_data = &txn->mt_dbs[i];
				rc = mdb_cursor_put(&mc, &txn->mt_dbxs[i].md_name, &data,
					F_SUBDATA);
				if (rc)
					goto fail;
			}
		}
	}

	rc = mdb_freelist_save(txn);
	if (rc)
		goto fail;

	mdb_midl_free(env->me_pghead);
	env->me_pghead = NULL;
	mdb_midl_shrink(&txn->mt_free_pgs);

#if (MDB_DEBUG) > 2
	mdb_audit(txn);
#endif

	if ((rc = mdb_page_flush(txn, 0)))
		goto fail;
	if (!F_ISSET(txn->mt_flags, MDB_TXN_NOSYNC) &&
		(rc = mdb_env_sync(env, 0)))
		goto fail;
	if ((rc = mdb_env_write_meta(txn)))
		goto fail;
	end_mode = MDB_END_COMMITTED|MDB_END_UPDATE;

done:
	mdb_txn_end(txn, end_mode);
	return MDB_SUCCESS;

fail:
	mdb_txn_abort(txn);
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x4382
movl $0x16, -0x4(%rbp)
jmp 0x4bbd
movl $0x200031, -0x1c(%rbp)  # imm = 0x200031
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x43b1
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4360
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x43af
jmp 0x4bae
jmp 0x43b1
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x20000, %eax          # imm = 0x20000
jne 0x43d5
jmp 0x4b99
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x440a
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x43fe
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x7c(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x7c(%rax)
movl $0xffff87c2, -0x14(%rbp) # imm = 0xFFFF87C2
jmp 0x4bae
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x49a3
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
addq $0x28, %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x12980
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x4446
jmp 0x4bae
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x12710
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x7c(%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x4bd0
movq -0x30(%rbp), %rax
movq 0x58(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x78(%rax), %eax
imulq $0x30, %rax, %rdx
callq 0x2230
movq -0x10(%rbp), %rax
movl 0x78(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x78(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movb 0x1(%rax), %cl
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
movb %cl, 0x1(%rax)
movl $0x2, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0x452c
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x18(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x4, %eax
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x18(%rbp), %ecx
movzbl (%rax,%rcx), %eax
orl -0x54(%rbp), %eax
movb %al, %dl
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x18(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x44de
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x4657
movq -0x50(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x60(%rbp)
cmpl $0x0, %eax
je 0x4657
movl -0x60(%rbp), %eax
movl %eax, -0x58(%rbp)
movl %eax, -0x54(%rbp)
movq -0x50(%rbp), %rax
movq $-0x1, (%rax)
movl $0x0, -0x18(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x5c(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
cmpl -0x5c(%rbp), %eax
ja 0x4602
movq -0x48(%rbp), %rax
movl -0x18(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
shlq %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq -0x50(%rbp), %rcx
movl -0x54(%rbp), %edx
cmpq (%rcx,%rdx,8), %rax
jbe 0x45d4
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x45b8
movq -0x68(%rbp), %rax
movq -0x50(%rbp), %rcx
movl -0x54(%rbp), %edx
cmpq (%rcx,%rdx,8), %rax
jne 0x4600
movq -0x50(%rbp), %rax
movl -0x54(%rbp), %ecx
movq $0x1, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
movl %eax, -0x58(%rbp)
jmp 0x4592
movl -0x58(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
cmpl -0x60(%rbp), %eax
ja 0x464b
movq -0x50(%rbp), %rax
movl -0x54(%rbp), %ecx
movq (%rax,%rcx,8), %rax
andq $0x1, %rax
cmpq $0x0, %rax
jne 0x4649
movq -0x50(%rbp), %rax
movl -0x54(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
movq -0x50(%rbp), %rax
movl -0x58(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x58(%rbp)
movl %ecx, %ecx
movq %rdx, (%rax,%rcx,8)
jmp 0x4608
movl -0x58(%rbp), %eax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x54(%rbp)
movq -0x40(%rbp), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, (%rax)
je 0x474a
movl -0x54(%rbp), %eax
movq -0x48(%rbp), %rcx
addq (%rcx), %rax
movl %eax, -0x5c(%rbp)
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rax
movl -0x54(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
addq $0x1, %rsi
callq 0x130f0
subl $0x1, %eax
movl %eax, -0x58(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x18(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x58(%rbp)
movb %al, -0x219(%rbp)
je 0x46cc
cmpl $0x0, -0x18(%rbp)
setne %al
movb %al, -0x219(%rbp)
movb -0x219(%rbp), %al
testb $0x1, %al
jne 0x46d8
jmp 0x4748
movq -0x48(%rbp), %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x40(%rbp), %rcx
movl -0x18(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
jae 0x470f
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x46ed
movq -0x70(%rbp), %rax
movq -0x40(%rbp), %rcx
movl -0x18(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
jne 0x4738
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x5c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x473a
movl -0x58(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x46b1
jmp 0x475c
movq -0x10(%rbp), %rcx
movl $0x1ffff, %eax          # imm = 0x1FFFF
subl 0x80(%rcx), %eax
movl %eax, -0x5c(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x58(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x58(%rbp)
je 0x485f
movq -0x48(%rbp), %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq -0x40(%rbp), %rcx
movl -0x54(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
jae 0x47e2
movq -0x40(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, %edx
addl $-0x1, %edx
movl %edx, -0x18(%rbp)
movl %ecx, %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x40(%rbp), %rcx
movl -0x54(%rbp), %edx
movl %edx, %esi
addl $-0x1, %esi
movl %esi, -0x54(%rbp)
movl %edx, %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x478b
movq -0x78(%rbp), %rax
movq -0x40(%rbp), %rcx
movl -0x54(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
jne 0x481a
movq -0x40(%rbp), %rax
movl -0x54(%rbp), %ecx
movl %ecx, %edx
addl $-0x1, %edx
movl %edx, -0x54(%rbp)
movl %ecx, %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x2030
jmp 0x481c
movq -0x40(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, %edx
addl $-0x1, %edx
movl %edx, -0x18(%rbp)
movl %ecx, %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x48(%rbp), %rcx
movl -0x58(%rbp), %edx
movl %edx, %esi
addl $-0x1, %esi
movl %esi, -0x58(%rbp)
movl %edx, %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x476c
movl -0x18(%rbp), %eax
cmpl -0x54(%rbp), %eax
jne 0x4869
jmp 0x4891
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x12b81(%rip), %rsi     # 0x173f9
leaq 0x12b81(%rip), %rdx     # 0x17400
leaq 0x12b89(%rip), %rcx     # 0x1740f
movl $0xda3, %r8d            # imm = 0xDA3
callq 0x133a0
movl -0x5c(%rbp), %eax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x2030
movq -0x10(%rbp), %rax
movl 0x80(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x80(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x492d
movq -0x30(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x491b
movq -0x30(%rbp), %rdi
addq $0x40, %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0x12980
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x48ff
movq -0x30(%rbp), %rax
movl 0x7c(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x7c(%rax)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x12710
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x12bf0
jmp 0x492b
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x40(%rax)
jmp 0x492d
movq -0x30(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0x4953
jmp 0x4945
movq -0x38(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
jmp 0x4939
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movl 0x38(%rax), %ecx
movq -0x30(%rbp), %rax
addl 0x38(%rax), %ecx
movl %ecx, 0x38(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x12710
movq -0x10(%rbp), %rdi
callq 0x2030
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4bbd
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x60(%rcx), %rax
je 0x49bd
movl $0x16, -0x14(%rbp)
jmp 0x4bae
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x4bd0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, (%rax)
jne 0x49ea
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0xc, %eax
cmpl $0x0, %eax
jne 0x49ea
jmp 0x4b99
movq -0x10(%rbp), %rax
cmpl $0x2, 0x78(%rax)
jbe 0x4aff
movq $0x30, -0x218(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x200(%rbp), %rdi
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x4d40
movl $0x2, -0x204(%rbp)
movl -0x204(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jae 0x4afd
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x204(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4ae7
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movl -0x204(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq 0x98(%rcx), %rcx
movl -0x204(%rbp), %edx
cmpl (%rcx,%rdx,4), %eax
je 0x4a8e
movl $0xffff87c4, -0x14(%rbp) # imm = 0xFFFF87C4
jmp 0x4bae
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x204(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x210(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rsi
movl -0x204(%rbp), %eax
imulq $0x30, %rax, %rax
addq %rax, %rsi
leaq -0x200(%rbp), %rdi
leaq -0x218(%rbp), %rdx
movl $0x2, %ecx
callq 0x4eb0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x4ae5
jmp 0x4bae
jmp 0x4ae7
jmp 0x4ae9
movl -0x204(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x204(%rbp)
jmp 0x4a26
jmp 0x4aff
movq -0x10(%rbp), %rdi
callq 0x6570
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x4b16
jmp 0x4bae
movq -0x28(%rbp), %rax
movq 0xb0(%rax), %rdi
callq 0x12710
movq -0x28(%rbp), %rax
movq $0x0, 0xb0(%rax)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
callq 0x12740
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x6f80
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x4b57
jmp 0x4bae
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %eax
andl $0x10000, %eax          # imm = 0x10000
cmpl $0x10000, %eax          # imm = 0x10000
je 0x4b7f
movq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0x3340
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x4b7f
jmp 0x4bae
movq -0x10(%rbp), %rdi
callq 0x7420
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x4b92
jmp 0x4bae
movl $0x10, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x4030
movl $0x0, -0x4(%rbp)
jmp 0x4bbd
movq -0x10(%rbp), %rdi
callq 0x4310
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopl (%rax)