// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
testq %rdi, %rdi
je 0x3829
movq %rdi, %r15
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x37f2
callq 0x37c2
testl %eax, %eax
je 0x37f2
movl %eax, %r12d
jmp 0x381c
movl 0x7c(%r15), %eax
movl $0x200031, %ebp         # imm = 0x200031
btl $0x11, %eax
jb 0x4311
movq (%r15), %r14
testb $0x3, %al
je 0x3832
movl $0xffff87c2, %r12d      # imm = 0xFFFF87C2
testq %r14, %r14
je 0x381c
orb $0x2, 0x7c(%r14)
movq %r15, %rdi
callq 0x379c
jmp 0x431e
pushq $0x16
popq %r12
jmp 0x431e
testq %r14, %r14
movq %r15, (%rsp)
je 0x38d0
leaq 0x28(%r14), %rdi
movq 0x28(%r15), %rsi
callq 0xb2d3
testl %eax, %eax
jne 0x37ed
pushq $0x2
popq %rbx
movq 0x28(%r15), %rdi
callq 0xb1a5
movq 0x10(%r15), %rax
movq %rax, 0x10(%r14)
movl 0x7c(%r15), %eax
movl %eax, 0x7c(%r14)
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0x438f
movq 0x58(%r14), %rdi
movq 0x58(%r15), %rsi
movl 0x78(%r15), %eax
imulq $0x30, %rax, %rdx
callq 0x2240
movl 0x78(%r15), %eax
movl %eax, 0x78(%r14)
movq 0x70(%r15), %rax
movb (%rax), %al
movq 0x70(%r14), %rcx
movb %al, (%rcx)
movq 0x70(%r15), %rax
movb 0x1(%rax), %al
movq 0x70(%r14), %rcx
movb %al, 0x1(%rcx)
movl 0x78(%r15), %eax
cmpq %rax, %rbx
jae 0x38e3
movq 0x70(%r14), %rax
movb (%rax,%rbx), %cl
andb $0x4, %cl
movq 0x70(%r15), %rdx
orb (%rdx,%rbx), %cl
movb %cl, (%rax,%rbx)
incq %rbx
jmp 0x38ae
movq 0x20(%r15), %rbx
cmpq %r15, 0x60(%rbx)
je 0x3957
pushq $0x16
popq %r12
jmp 0x381c
movq 0x40(%r14), %rax
movq %r14, 0x8(%rsp)
movq 0x48(%r14), %r12
movq 0x48(%r15), %r14
testq %rax, %rax
je 0x3a3b
movl (%rax), %ecx
testl %ecx, %ecx
je 0x3a3b
orq $-0x1, (%rax)
movl (%r14), %esi
xorl %edi, %edi
movl %ecx, %edx
movl %edx, %r9d
cmpq %rsi, %rdi
jae 0x3a1a
incq %rdi
movq %rdi, %r8
shlq $0x4, %r8
movq (%r14,%r8), %r10
addq %r10, %r10
movl %r9d, %r8d
movl %r8d, %r11d
movq (%rax,%r11,8), %rbx
decl %r8d
cmpq %rbx, %r10
ja 0x3932
leal 0x1(%r8), %r9d
cmpq %rbx, %r10
jne 0x3915
movq $0x1, (%rax,%r11,8)
movl %r8d, %edx
jmp 0x3912
movq %r15, %rdi
xorl %esi, %esi
callq 0x438f
movq 0x48(%r15), %rax
cmpq $0x0, (%rax)
jne 0x3976
testb $0xc, 0x7c(%r15)
je 0x4311
movq %rbx, 0x48(%rsp)
cmpl $0x3, 0x78(%r15)
jb 0x3bd4
movq %r15, %rsi
leaq 0x18(%rsp), %r15
movq $0x30, (%r15)
leaq 0x80(%rsp), %r13
pushq $0x1
popq %rdx
movq %r13, %rdi
xorl %ecx, %ecx
callq 0x4451
pushq $0x2
popq %rbx
pushq $0x60
popq %r14
pushq $0x2
popq %rbp
movq (%rsp), %rdx
movl 0x78(%rdx), %eax
cmpq %rax, %rbx
jae 0x3bd1
movq 0x70(%rdx), %rax
testb $0x1, (%rax,%rbx)
je 0x3a11
movq 0x20(%rdx), %rax
movq 0x60(%rdx), %rcx
movl (%rcx,%rbx,4), %ecx
movq 0x98(%rax), %rax
cmpl (%rax,%rbx,4), %ecx
jne 0x3c5d
movq 0x58(%rdx), %rax
addq %r14, %rax
movq %rax, 0x20(%rsp)
movq 0x50(%rdx), %rsi
addq %r14, %rsi
movq %r13, %rdi
movq %r15, %rdx
movl %ebp, %ecx
callq 0x453f
testl %eax, %eax
jne 0x3c58
incq %rbx
addq $0x30, %r14
jmp 0x39b4
movl %edx, %esi
incl %edx
cmpl %ecx, %edx
ja 0x3a36
movl %edx, %edi
movq (%rax,%rdi,8), %rdi
testb $0x1, %dil
jne 0x3a1c
incl %esi
movq %rdi, (%rax,%rsi,8)
jmp 0x3a1c
movl %esi, %ecx
movq %rcx, (%rax)
movq (%r12), %rbp
andq $0x0, (%r12)
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax)
je 0x3a99
movl %ebp, %ebx
addl (%r14), %ebx
movl %ebp, %eax
shlq $0x4, %rax
movq (%r12,%rax), %rsi
incq %rsi
movq %r14, %rdi
callq 0xb54e
movl %ebp, %ecx
decl %eax
je 0x3aa5
testl %ecx, %ecx
je 0x3aa5
movl %eax, %edx
shlq $0x4, %rdx
movq (%r14,%rdx), %rdx
movl %ecx, %esi
shlq $0x4, %rsi
decl %ecx
cmpq (%r12,%rsi), %rdx
jb 0x3a7d
sete %dl
movzbl %dl, %edx
subl %edx, %ebx
subl %edx, %ecx
incl %ecx
jmp 0x3a6b
movl $0x1ffff, %ebx          # imm = 0x1FFFF
subl 0x80(%r15), %ebx
movq 0x8(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x28(%rsp)
movl (%r14), %eax
movl %ebx, 0x48(%rsp)
movl %ebx, %r15d
movq %rax, %rbx
movq %r14, 0x10(%rsp)
subq $0x1, %rbx
jb 0x3b25
shlq $0x4, %rax
leaq (%r14,%rax), %r13
movq (%r14,%rax), %rax
movl %ebp, %edx
shlq $0x4, %rdx
leaq (%r12,%rdx), %rcx
movl %r15d, %r14d
cmpq (%r12,%rdx), %rax
jae 0x3afd
decl %r15d
shlq $0x4, %r14
decl %ebp
movups (%rcx), %xmm0
movups %xmm0, (%r12,%r14)
jmp 0x3ad7
jne 0x3b0a
decl %ebp
movq 0x8(%rcx), %rdi
callq 0x2030
decl %r15d
shlq $0x4, %r14
movups (%r13), %xmm0
movups %xmm0, (%r12,%r14)
movq %rbx, %rax
movq 0x10(%rsp), %r14
jmp 0x3ac5
cmpl %ebp, %r15d
jne 0x434f
movl 0x48(%rsp), %eax
movq %rax, (%r12)
movq (%rsp), %rbx
movq 0x48(%rbx), %rdi
callq 0x2030
movl 0x80(%rbx), %eax
movq 0x8(%rsp), %r14
movl %eax, 0x80(%r14)
movq 0x40(%rbx), %rsi
xorl %r12d, %r12d
testq %rsi, %rsi
movq 0x28(%rsp), %r15
je 0x3b96
cmpq $0x0, (%r15)
je 0x3b93
movq %r15, %rdi
callq 0xb2d3
movl %eax, %r12d
testl %eax, %eax
je 0x3b80
orb $0x2, 0x7c(%r14)
movq 0x40(%rbx), %rdi
callq 0xb1a5
movq (%r15), %rdi
callq 0xb3d7
jmp 0x3b96
movq %rsi, (%r15)
leaq 0x30(%r14), %rax
cmpq $0x0, (%rax)
leaq 0x10(%rax), %rax
jne 0x3b9a
movq 0x30(%rbx), %rcx
movq %rcx, -0x10(%rax)
movl 0x38(%rbx), %eax
addl %eax, 0x38(%r14)
andq $0x0, 0x8(%r14)
movq 0x88(%rbx), %rdi
callq 0xb1a5
movq %rbx, %rdi
callq 0x2030
jmp 0x431e
movq %rdx, %r15
movq 0x20(%r15), %rbx
movslq 0xd8(%rbx), %r13
andq $0x0, 0x30(%rsp)
leaq 0x80(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4451
leaq 0xb0(%rbx), %r14
movq %rbx, 0x10(%rsp)
cmpq $0x0, 0xb0(%rbx)
je 0x3c39
leaq 0x80(%rsp), %rdi
pushq $0x5
popq %rdx
xorl %esi, %esi
callq 0x958a
testl %eax, %eax
je 0x3c33
movl %eax, %r12d
cmpl $0xffff87b2, %eax       # imm = 0xFFFF87B2
jne 0x381c
cmpq $0x0, (%r14)
jne 0x3c9a
movq 0x30(%r15), %rbx
testq %rbx, %rbx
je 0x3c9a
movq %r15, %rax
addq $0x28, %r15
movl 0x38(%rax), %esi
movq %r15, %rdi
callq 0xb1eb
testl %eax, %eax
je 0x3c6c
movl %eax, %r12d
jmp 0x3c63
movl $0xffff87c4, %r12d      # imm = 0xFFFF87C4
movq (%rsp), %r15
jmp 0x381c
movq (%r15), %rax
movq (%rsp), %r15
testq %rbx, %rbx
je 0x3c90
movq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rax)
movq (%rbx), %rdx
movq %rdx, 0x8(%rax,%rcx,8)
movq 0x30(%rbx), %rbx
jmp 0x3c73
andq $0x0, 0x30(%r15)
andl $0x0, 0x38(%r15)
movq %r14, 0x50(%rsp)
pushq $0x1
popq %rax
movl %eax, 0x28(%rsp)
movq 0x10(%rsp), %rax
movl 0xc(%rax), %eax
movl %eax, 0x5c(%rsp)
leaq 0x28(%r15), %rax
movq %rax, 0x8(%rsp)
movq %r13, 0x68(%rsp)
leal 0x1(%r13), %eax
cltq
movq %rax, 0x70(%rsp)
leaq 0x18(%r15), %rax
movq %rax, 0x60(%rsp)
xorl %r13d, %r13d
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %ebp, %ebp
movq 0x10(%rsp), %rax
cmpq 0xb8(%rax), %rbp
jae 0x3d4a
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0x5fe8
testl %eax, %eax
jne 0x37ed
movq 0x20(%rsp), %rax
movq (%rax), %rbp
movq %rbp, 0x30(%rsp)
movq 0x10(%rsp), %rax
cmpq 0xb8(%rax), %rbp
ja 0x4333
leaq 0x80(%rsp), %rdi
xorl %esi, %esi
callq 0x8427
movl $0x0, %r13d
movl $0x0, %ebx
testl %eax, %eax
je 0x3cde
jmp 0x37ed
movq 0x8(%rsp), %rax
movq (%rax), %rax
cmpq (%rax), %r14
jae 0x3e09
testq %r14, %r14
jne 0x3d84
leaq 0x80(%rsp), %rdi
xorl %esi, %esi
pushq $0x9
popq %rdx
callq 0x958a
testl %eax, %eax
je 0x3d84
movl %eax, %r12d
cmpl $0xffff87b2, %eax       # imm = 0xFFFF87B2
jne 0x3c63
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq $0x8, 0x18(%rsp)
movq 0x60(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq (%rax), %rax
movq %rax, %r14
leaq 0x8(,%rax,8), %rax
movq %rax, 0x38(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movl $0x10000, %ecx          # imm = 0x10000
callq 0x453f
testl %eax, %eax
jne 0x3c58
movq 0x8(%rsp), %rax
movq (%rax), %r15
movq (%r15), %rax
cmpq %rax, %r14
jb 0x3da2
movq %r15, %rdi
callq 0xb3d7
movq 0x38(%rsp), %rdx
movq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x2240
movq (%rsp), %r15
jmp 0x3cde
movq 0x50(%rsp), %rax
movq (%rax), %r12
testq %r12, %r12
je 0x3e1c
movq (%r12), %r15
jmp 0x3e1f
xorl %r15d, %r15d
movq (%rsp), %rax
movslq 0x38(%rax), %rax
addq %rax, %r15
cmpq %r15, %rbx
jge 0x3e5b
cmpq 0x68(%rsp), %r13
setge %al
movq 0x30(%rsp), %rcx
cmpq $0x2, %rcx
setae %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x3e55
decq %rcx
movq %rcx, 0x30(%rsp)
xorl %r13d, %r13d
movl 0x28(%rsp), %esi
jmp 0x3e74
movl 0x28(%rsp), %esi
je 0x3f56
testl %esi, %esi
jle 0x3f56
decl %esi
movq 0x30(%rsp), %rcx
subq %r13, %rbx
subq %rbx, %r15
movq 0x68(%rsp), %r13
cmpq %r13, %r15
setg %al
cmpq $0x2, %rcx
setae %dl
andb %al, %dl
cmpb $0x1, %dl
movl %esi, 0x28(%rsp)
jne 0x3eb1
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %r15
cqto
idivq 0x70(%rsp)
addq %r13, %r15
subq %rdx, %r15
jmp 0x3ebd
testq %r15, %r15
movl $0x0, %eax
cmovleq %rax, %r15
movq $0x8, 0x18(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x8(,%r15,8), %rax
movq %rax, 0x38(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movl $0x10000, %ecx          # imm = 0x10000
callq 0x453f
testl %eax, %eax
jne 0x3c58
cmpq %r13, %r15
movl $0x0, %eax
cmovgq %r15, %rax
testl $0x1080000, 0x5c(%rsp)  # imm = 0x1080000
movl $0x0, %ecx
cmovneq %rcx, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
andq %rax, %rcx
leaq (,%rcx,8), %rdi
addq 0x40(%rsp), %rdi
subq %rcx, %rax
leaq 0x8(,%rax,8), %rdx
xorl %esi, %esi
callq 0x2190
addq %r15, %rbx
movq %r15, %r13
movq (%rsp), %r15
jmp 0x3cde
movq (%rsp), %rcx
movq 0x30(%rcx), %rbx
testq %rbx, %rbx
je 0x3fd7
movl %eax, %r14d
leal 0x1(,%r14,2), %esi
movq 0x50(%rsp), %rdi
callq 0xb1eb
testl %eax, %eax
jne 0x3c58
movq 0x50(%rsp), %rax
movq (%rax), %r12
movq -0x8(%r12), %rax
leaq (%r12,%rax,8), %r15
shlq $0x3, %r14
subq %r14, %r15
xorl %eax, %eax
testq %rbx, %rbx
je 0x3fae
movq (%rbx), %rcx
incl %eax
movq %rcx, (%r15,%rax,8)
movq 0x30(%rbx), %rbx
jmp 0x3f9a
movl %eax, %eax
movq %rax, (%r15)
movq %r15, %rdi
callq 0xb3d7
movq %r12, %rdi
movq %r15, %rsi
callq 0xb390
movq (%rsp), %rax
andq $0x0, 0x30(%rax)
andl $0x0, 0x38(%rax)
movq (%r12), %r15
testq %r15, %r15
je 0x40c0
leaq (%r12,%r15,8), %r14
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %r13
movq %r13, %rdx
callq 0x5fe8
movl %eax, %r12d
testl %eax, %eax
jne 0x3c63
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x78(%rsp)
movq 0x38(%rsp), %rbx
cmpq $0x8, %rbx
jb 0x436f
movq 0x10(%rsp), %rcx
cmpq 0xb8(%rcx), %rax
ja 0x436f
shrq $0x3, %rbx
decq %rbx
leaq 0x78(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq %r15, %rbx
jle 0x405d
leaq 0x8(,%r15,8), %rax
movq %rax, 0x38(%rsp)
movq %r15, %rbx
leaq (,%rbx,8), %rax
subq %rax, %r14
movq %r14, 0x40(%rsp)
movq (%r14), %rbp
movq %rbx, (%r14)
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movq %r13, %rdx
pushq $0x40
popq %rcx
callq 0x453f
movl %eax, %r12d
movq %rbp, (%r14)
testl %eax, %eax
jne 0x40b7
subq %rbx, %r15
je 0x40b7
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movq %r13, %rdx
pushq $0x8
popq %rcx
callq 0x60fe
jmp 0x3ffe
testl %r12d, %r12d
jne 0x3c63
movq 0x48(%rsp), %rbx
movq 0xb0(%rbx), %rdi
callq 0xb1a5
andq $0x0, 0xb0(%rbx)
movq 0x8(%rsp), %rdi
callq 0xb1b4
movq (%rsp), %rdi
xorl %esi, %esi
callq 0x52b1
testl %eax, %eax
jne 0x3c58
movq (%rsp), %rax
movl 0x7c(%rax), %eax
btl $0x10, %eax
jb 0x411e
movq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x2dbb
testl %eax, %eax
jne 0x3c58
movq (%rsp), %rax
movl 0x7c(%rax), %eax
movq (%rsp), %rdx
movq 0x18(%rdx), %rcx
movq 0x20(%rdx), %r8
movl %ecx, %edx
andl $0x1, %edx
andl 0xc(%r8), %eax
movq 0x48(%r8,%rdx,8), %rdi
xorl $0x1, %edx
movq 0x48(%r8,%rdx,8), %rdx
movq 0x10(%rdx), %rsi
movq %r8, %rbx
movq 0x70(%r8), %rdx
cmpq %rdx, %rsi
cmovaq %rsi, %rdx
btl $0x13, %eax
jb 0x4218
movq 0x80(%rdi), %rsi
movq %rsi, 0x18(%rsp)
movq 0x78(%rdi), %rsi
movq %rsi, 0x10(%rsp)
leaq 0x90(%rsp), %r14
movq %rdx, (%r14)
movq (%rsp), %rsi
movq 0x58(%rsi), %rdx
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups 0x20(%rdx), %xmm2
movups %xmm2, 0x28(%r14)
movups %xmm1, 0x18(%r14)
movups %xmm0, 0x8(%r14)
movups 0x30(%rdx), %xmm0
movups 0x40(%rdx), %xmm1
movups 0x50(%rdx), %xmm2
movups %xmm0, 0x38(%r14)
movups %xmm1, 0x48(%r14)
movups %xmm2, 0x58(%r14)
movq 0x10(%rsi), %rdx
decq %rdx
movq %rdx, 0x68(%r14)
movq %rcx, 0x70(%r14)
movq 0x38(%rbx), %rcx
negq %rcx
leaq (%rdi,%rcx), %r15
addq $0x10, %r15
xorl %ecx, %ecx
testl $0x50000, %eax          # imm = 0x50000
sete %cl
movl (%rbx,%rcx,8), %ebp
pushq $0x78
popq %r13
movl %ebp, %edi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x22b0
cmpl $0x78, %eax
je 0x4274
testl %eax, %eax
jns 0x42cf
callq 0x2050
movl (%rax), %r12d
cmpl $0x4, %r12d
je 0x41e8
jmp 0x42d3
movq %rdx, 0x10(%rdi)
movq (%rsp), %rdx
movq 0x58(%rdx), %rcx
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0x38(%rdi)
movups %xmm1, 0x28(%rdi)
movups %xmm0, 0x18(%rdi)
movq 0x58(%rdx), %rcx
movups 0x30(%rcx), %xmm0
movups 0x40(%rcx), %xmm1
movups 0x50(%rcx), %xmm2
movups %xmm1, 0x58(%rdi)
movups %xmm2, 0x68(%rdi)
movups %xmm0, 0x48(%rdi)
movq 0x10(%rdx), %rcx
decq %rcx
movq %rcx, 0x78(%rdi)
movq 0x18(%rdx), %rcx
movq %rcx, 0x80(%rdi)
testl $0x50000, %eax          # imm = 0x50000
je 0x4292
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x4289
movq 0x60(%rsp), %rcx
movq (%rcx), %rcx
movq %rcx, 0x30(%rax)
pushq $0x10
popq %rbp
movq (%rsp), %r15
jmp 0x4311
xorl %eax, %eax
btl $0x14, 0xc(%rbx)
setae %al
leal (%rax,%rax,2), %edx
incl %edx
addq $-0x10, %rdi
movl 0x38(%rbx), %eax
movl %edi, %ecx
subl %eax, %ecx
movl 0x14(%rbx), %eax
decl %eax
andl %ecx, %eax
movslq %eax, %rsi
subq %rsi, %rdi
addl 0x10(%rbx), %esi
callq 0x2100
testl %eax, %eax
je 0x4274
callq 0x2050
movl (%rax), %r12d
jmp 0x42fd
pushq $0x5
popq %r12
movq 0x10(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x100(%rsp)
movl (%rbx), %edi
pushq $0x78
popq %rdx
movq %r14, %rsi
movq %r15, %rcx
callq 0x22b0
orb $-0x80, 0xf(%rbx)
testl %r12d, %r12d
movq (%rsp), %r15
jne 0x381c
pushq $0x10
popq %rbp
movq %r15, %rdi
movl %ebp, %esi
callq 0x351c
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%r15), %rdi
leaq 0xa629(%rip), %rsi      # 0xe967
leaq 0xa63b(%rip), %rdx      # 0xe980
movl $0xc11, %ecx            # imm = 0xC11
callq 0xb672
movq (%rsp), %rax
movq 0x20(%rax), %rdi
leaq 0xa09f(%rip), %rsi      # 0xe3fd
leaq 0xa09f(%rip), %rdx      # 0xe404
movl $0xda3, %ecx            # imm = 0xDA3
callq 0xb672
movq (%rsp), %rax
movq 0x20(%rax), %rdi
leaq 0xa614(%rip), %rsi      # 0xe992
leaq 0xa5fb(%rip), %rdx      # 0xe980
movl $0xc85, %ecx            # imm = 0xC85
callq 0xb672