// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mtest.c
// Function: main
int main(int argc,char * argv[])
{
	int i = 0, j = 0, rc;
	MDB_env *env;
	MDB_dbi dbi;
	MDB_val key, data;
	MDB_txn *txn;
	MDB_stat mst;
	MDB_cursor *cursor, *cur2;
	MDB_cursor_op op;
	int count;
	int *values;
	char sval[32] = "";

	srand(time(NULL));

	    count = (rand()%384) + 64;
	    values = (int *)malloc(count*sizeof(int));

	    for(i = 0;i<count;i++) {
			values[i] = rand()%1024;
	    }
    
		E(mdb_env_create(&env));
		E(mdb_env_set_maxreaders(env, 1));
		E(mdb_env_set_mapsize(env, 10485760));
		E(mdb_env_open(env, "./testdb", MDB_FIXEDMAP /*|MDB_NOSYNC*/, 0664));

		E(mdb_txn_begin(env, NULL, 0, &txn));
		E(mdb_dbi_open(txn, NULL, 0, &dbi));
   
		key.mv_size = sizeof(int);
		key.mv_data = sval;

		printf("Adding %d values\n", count);
	    for (i=0;i<count;i++) {	
			sprintf(sval, "%03x %d foo bar", values[i], values[i]);
			/* Set <data> in each iteration, since MDB_NOOVERWRITE may modify it */
			data.mv_size = sizeof(sval);
			data.mv_data = sval;
			if (RES(MDB_KEYEXIST, mdb_put(txn, dbi, &key, &data, MDB_NOOVERWRITE))) {
				j++;
				data.mv_size = sizeof(sval);
				data.mv_data = sval;
			}
	    }
		if (j) printf("%d duplicates skipped\n", j);
		E(mdb_txn_commit(txn));
		E(mdb_env_stat(env, &mst));

		E(mdb_txn_begin(env, NULL, MDB_RDONLY, &txn));
		E(mdb_cursor_open(txn, dbi, &cursor));
		while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) == 0) {
			printf("key: %p %.*s, data: %p %.*s\n",
				key.mv_data,  (int) key.mv_size,  (char *) key.mv_data,
				data.mv_data, (int) data.mv_size, (char *) data.mv_data);
		}
		CHECK(rc == MDB_NOTFOUND, "mdb_cursor_get");
		mdb_cursor_close(cursor);
		mdb_txn_abort(txn);

		j=0;
		key.mv_data = sval;
	    for (i= count - 1; i > -1; i-= (rand()%5)) {
			j++;
			txn=NULL;
			E(mdb_txn_begin(env, NULL, 0, &txn));
			sprintf(sval, "%03x ", values[i]);
			if (RES(MDB_NOTFOUND, mdb_del(txn, dbi, &key, NULL))) {
				j--;
				mdb_txn_abort(txn);
			} else {
				E(mdb_txn_commit(txn));
			}
	    }
	    free(values);
		printf("Deleted %d values\n", j);

		E(mdb_env_stat(env, &mst));
		E(mdb_txn_begin(env, NULL, MDB_RDONLY, &txn));
		E(mdb_cursor_open(txn, dbi, &cursor));
		printf("Cursor next\n");
		while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) == 0) {
			printf("key: %.*s, data: %.*s\n",
				(int) key.mv_size,  (char *) key.mv_data,
				(int) data.mv_size, (char *) data.mv_data);
		}
		CHECK(rc == MDB_NOTFOUND, "mdb_cursor_get");
		printf("Cursor last\n");
		E(mdb_cursor_get(cursor, &key, &data, MDB_LAST));
		printf("key: %.*s, data: %.*s\n",
			(int) key.mv_size,  (char *) key.mv_data,
			(int) data.mv_size, (char *) data.mv_data);
		printf("Cursor prev\n");
		while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_PREV)) == 0) {
			printf("key: %.*s, data: %.*s\n",
				(int) key.mv_size,  (char *) key.mv_data,
				(int) data.mv_size, (char *) data.mv_data);
		}
		CHECK(rc == MDB_NOTFOUND, "mdb_cursor_get");
		printf("Cursor last/prev\n");
		E(mdb_cursor_get(cursor, &key, &data, MDB_LAST));
			printf("key: %.*s, data: %.*s\n",
				(int) key.mv_size,  (char *) key.mv_data,
				(int) data.mv_size, (char *) data.mv_data);
		E(mdb_cursor_get(cursor, &key, &data, MDB_PREV));
			printf("key: %.*s, data: %.*s\n",
				(int) key.mv_size,  (char *) key.mv_data,
				(int) data.mv_size, (char *) data.mv_data);

		mdb_cursor_close(cursor);
		mdb_txn_abort(txn);

		printf("Deleting with cursor\n");
		E(mdb_txn_begin(env, NULL, 0, &txn));
		E(mdb_cursor_open(txn, dbi, &cur2));
		for (i=0; i<50; i++) {
			if (RES(MDB_NOTFOUND, mdb_cursor_get(cur2, &key, &data, MDB_NEXT)))
				break;
			printf("key: %p %.*s, data: %p %.*s\n",
				key.mv_data,  (int) key.mv_size,  (char *) key.mv_data,
				data.mv_data, (int) data.mv_size, (char *) data.mv_data);
			E(mdb_del(txn, dbi, &key, NULL));
		}

		printf("Restarting cursor in txn\n");
		for (op=MDB_FIRST, i=0; i<=32; op=MDB_NEXT, i++) {
			if (RES(MDB_NOTFOUND, mdb_cursor_get(cur2, &key, &data, op)))
				break;
			printf("key: %p %.*s, data: %p %.*s\n",
				key.mv_data,  (int) key.mv_size,  (char *) key.mv_data,
				data.mv_data, (int) data.mv_size, (char *) data.mv_data);
		}
		mdb_cursor_close(cur2);
		E(mdb_txn_commit(txn));

		printf("Restarting cursor outside txn\n");
		E(mdb_txn_begin(env, NULL, 0, &txn));
		E(mdb_cursor_open(txn, dbi, &cursor));
		for (op=MDB_FIRST, i=0; i<=32; op=MDB_NEXT, i++) {
			if (RES(MDB_NOTFOUND, mdb_cursor_get(cursor, &key, &data, op)))
				break;
			printf("key: %p %.*s, data: %p %.*s\n",
				key.mv_data,  (int) key.mv_size,  (char *) key.mv_data,
				data.mv_data, (int) data.mv_size, (char *) data.mv_data);
		}
		mdb_cursor_close(cursor);
		mdb_txn_abort(txn);

		mdb_dbi_close(env, dbi);
		mdb_env_close(env);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2180
xorl %eax, %eax
movl %eax, %edi
callq 0x2240
movl %eax, %edi
callq 0x21c0
callq 0x2400
movl $0x180, %ecx            # imm = 0x180
cltd
idivl %ecx
addl $0x40, %edx
movl %edx, -0x98(%rbp)
movslq -0x98(%rbp), %rdi
shlq $0x2, %rdi
callq 0x2270
movq %rax, -0xa0(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0x25cf
callq 0x2400
movl $0x400, %ecx            # imm = 0x400
cltd
idivl %ecx
movq -0xa0(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x259e
leaq -0x28(%rbp), %rdi
callq 0x13a10
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x25e2
jmp 0x262b
movq 0x19a0f(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0xc8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0xc8(%rbp), %rdi
movq %rax, %r9
leaq 0x159f8(%rip), %rsi     # 0x18004
leaq 0x15a00(%rip), %rdx     # 0x18013
movl $0x2f, %ecx
leaq 0x159fc(%rip), %r8      # 0x1801b
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0x13d90
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2643
jmp 0x268c
movq 0x199ae(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0xd0(%rbp), %rdi
movq %rax, %r9
leaq 0x15997(%rip), %rsi     # 0x18004
leaq 0x1599f(%rip), %rdx     # 0x18013
movl $0x30, %ecx
leaq 0x159b0(%rip), %r8      # 0x18030
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
movl $0xa00000, %esi         # imm = 0xA00000
callq 0x13ac0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x26a4
jmp 0x26ed
movq 0x1994d(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0xd8(%rbp), %rdi
movq %rax, %r9
leaq 0x15936(%rip), %rsi     # 0x18004
leaq 0x1593e(%rip), %rdx     # 0x18013
movl $0x31, %ecx
leaq 0x1596e(%rip), %r8      # 0x1804f
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
leaq 0x1597a(%rip), %rsi     # 0x18072
movl $0x1, %edx
movl $0x1b4, %ecx            # imm = 0x1B4
callq 0x13e10
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2711
jmp 0x275a
movq 0x198e0(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0xe0(%rbp), %rdi
movq %rax, %r9
leaq 0x158c9(%rip), %rsi     # 0x18004
leaq 0x158d1(%rip), %rdx     # 0x18013
movl $0x32, %ecx
leaq 0x1592d(%rip), %r8      # 0x1807b
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x4040
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2777
jmp 0x27c0
movq 0x1987a(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0xe8(%rbp), %rdi
movq %rax, %r9
leaq 0x15863(%rip), %rsi     # 0x18004
leaq 0x1586b(%rip), %rdx     # 0x18013
movl $0x34, %ecx
leaq 0x158fa(%rip), %r8      # 0x180ae
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x58(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq -0x2c(%rbp), %rcx
callq 0xe670
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x27dd
jmp 0x2826
movq 0x19814(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0xf0(%rbp), %rdi
movq %rax, %r9
leaq 0x157fd(%rip), %rsi     # 0x18004
leaq 0x15805(%rip), %rdx     # 0x18013
movl $0x35, %ecx
leaq 0x158b6(%rip), %r8      # 0x180d0
movb $0x0, %al
callq 0x2210
callq 0x2040
movq $0x4, -0x40(%rbp)
leaq -0xc0(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x98(%rbp), %esi
leaq 0x158ab(%rip), %rdi     # 0x180f1
movb $0x0, %al
callq 0x2120
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0x2950
leaq -0xc0(%rbp), %rdi
movq -0xa0(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0xa0(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
leaq 0x15876(%rip), %rsi     # 0x18103
movb $0x0, %al
callq 0x2360
movq $0x20, -0x50(%rbp)
leaq -0xc0(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x40(%rbp), %rdx
leaq -0x50(%rbp), %rcx
movl $0x10, %r8d
callq 0xe580
movl %eax, -0x1c(%rbp)
cmpl $0xffff87b1, %eax       # imm = 0xFFFF87B1
je 0x2924
cmpl $0x0, -0x1c(%rbp)
jne 0x28d3
jmp 0x291c
movq 0x1971e(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0xf8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0xf8(%rbp), %rdi
movq %rax, %r9
leaq 0x15707(%rip), %rsi     # 0x18004
leaq 0x1570f(%rip), %rdx     # 0x18013
movl $0x40, %ecx
leaq 0x15803(%rip), %r8      # 0x18113
movb $0x0, %al
callq 0x2210
callq 0x2040
xorl %eax, %eax
testb $0x1, %al
jne 0x2924
jmp 0x2940
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movq $0x20, -0x50(%rbp)
leaq -0xc0(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x2942
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2854
cmpl $0x0, -0x18(%rbp)
je 0x2967
movl -0x18(%rbp), %esi
leaq 0x157e3(%rip), %rdi     # 0x18143
movb $0x0, %al
callq 0x2120
movq -0x58(%rbp), %rdi
callq 0x4940
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x297a
jmp 0x29c3
movq 0x19677(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x100(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x100(%rbp), %rdi
movq %rax, %r9
leaq 0x15660(%rip), %rsi     # 0x18004
leaq 0x15668(%rip), %rdx     # 0x18013
movl $0x47, %ecx
leaq 0x157a3(%rip), %r8      # 0x1815a
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x15830
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x29da
jmp 0x2a23
movq 0x19617(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x108(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x108(%rbp), %rdi
movq %rax, %r9
leaq 0x15600(%rip), %rsi     # 0x18004
leaq 0x15608(%rip), %rdx     # 0x18013
movl $0x48, %ecx
leaq 0x15757(%rip), %r8      # 0x1816e
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x20000, %edx          # imm = 0x20000
leaq -0x58(%rbp), %rcx
callq 0x4040
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2a43
jmp 0x2a8c
movq 0x195ae(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x110(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x110(%rbp), %rdi
movq %rax, %r9
leaq 0x15597(%rip), %rsi     # 0x18004
leaq 0x1559f(%rip), %rdx     # 0x18013
movl $0x4a, %ecx
leaq 0x15706(%rip), %r8      # 0x18186
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x88(%rbp), %rdx
callq 0xdee0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2aa9
jmp 0x2af2
movq 0x19548(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x118(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x118(%rbp), %rdi
movq %rax, %r9
leaq 0x15531(%rip), %rsi     # 0x18004
leaq 0x15539(%rip), %rdx     # 0x18013
movl $0x4b, %ecx
leaq 0x156cb(%rip), %r8      # 0x181b1
movb $0x0, %al
callq 0x2210
callq 0x2040
jmp 0x2af4
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0x8, %ecx
callq 0x8730
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2b46
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rax
movl %eax, %edx
movq -0x38(%rbp), %rcx
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %rax
movl %eax, %r9d
movq -0x48(%rbp), %rax
leaq 0x1569b(%rip), %rdi     # 0x181d4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2120
jmp 0x2af4
cmpl $0xffff87b2, -0x1c(%rbp) # imm = 0xFFFF87B2
jne 0x2b51
jmp 0x2b9a
movq 0x194a0(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x120(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x120(%rbp), %rdi
movq %rax, %r9
leaq 0x15489(%rip), %rsi     # 0x18004
leaq 0x15491(%rip), %rdx     # 0x18013
movl $0x51, %ecx
leaq 0x15663(%rip), %r8      # 0x181f1
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x88(%rbp), %rdi
callq 0xe240
movq -0x58(%rbp), %rdi
callq 0x48f0
movl $0x0, -0x18(%rbp)
leaq -0xc0(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x98(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jle 0x2d76
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x4040
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2c05
jmp 0x2c4e
movq 0x193ec(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x128(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x128(%rbp), %rdi
movq %rax, %r9
leaq 0x153d5(%rip), %rsi     # 0x18004
leaq 0x153dd(%rip), %rdx     # 0x18013
movl $0x5a, %ecx
leaq 0x1546c(%rip), %r8      # 0x180ae
movb $0x0, %al
callq 0x2210
callq 0x2040
leaq -0xc0(%rbp), %rdi
movq -0xa0(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0x15596(%rip), %rsi     # 0x18200
movb $0x0, %al
callq 0x2360
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x40(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0xe360
movl %eax, -0x1c(%rbp)
cmpl $0xffff87b2, %eax       # imm = 0xFFFF87B2
je 0x2ce8
cmpl $0x0, -0x1c(%rbp)
jne 0x2c97
jmp 0x2ce0
movq 0x1935a(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x130(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x130(%rbp), %rdi
movq %rax, %r9
leaq 0x15343(%rip), %rsi     # 0x18004
leaq 0x1534b(%rip), %rdx     # 0x18013
movl $0x5c, %ecx
leaq 0x15532(%rip), %r8      # 0x18206
movb $0x0, %al
callq 0x2210
callq 0x2040
xorl %eax, %eax
testb $0x1, %al
jne 0x2ce8
jmp 0x2cfc
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x58(%rbp), %rdi
callq 0x48f0
jmp 0x2d5a
movq -0x58(%rbp), %rdi
callq 0x4940
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2d0f
jmp 0x2d58
movq 0x192e2(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x138(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x138(%rbp), %rdi
movq %rax, %r9
leaq 0x152cb(%rip), %rsi     # 0x18004
leaq 0x152d3(%rip), %rdx     # 0x18013
movl $0x60, %ecx
leaq 0x1540e(%rip), %r8      # 0x1815a
movb $0x0, %al
callq 0x2210
callq 0x2040
jmp 0x2d5a
jmp 0x2d5c
callq 0x2400
movl $0x5, %ecx
cltd
idivl %ecx
movl -0x14(%rbp), %eax
subl %edx, %eax
movl %eax, -0x14(%rbp)
jmp 0x2bcd
movq -0xa0(%rbp), %rdi
callq 0x2030
movl -0x18(%rbp), %esi
leaq 0x15498(%rip), %rdi     # 0x18224
movb $0x0, %al
callq 0x2120
movq -0x28(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x15830
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2daa
jmp 0x2df3
movq 0x19247(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x140(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x140(%rbp), %rdi
movq %rax, %r9
leaq 0x15230(%rip), %rsi     # 0x18004
leaq 0x15238(%rip), %rdx     # 0x18013
movl $0x66, %ecx
leaq 0x15387(%rip), %r8      # 0x1816e
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x20000, %edx          # imm = 0x20000
leaq -0x58(%rbp), %rcx
callq 0x4040
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2e13
jmp 0x2e5c
movq 0x191de(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x148(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x148(%rbp), %rdi
movq %rax, %r9
leaq 0x151c7(%rip), %rsi     # 0x18004
leaq 0x151cf(%rip), %rdx     # 0x18013
movl $0x67, %ecx
leaq 0x15336(%rip), %r8      # 0x18186
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x88(%rbp), %rdx
callq 0xdee0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2e79
jmp 0x2ec2
movq 0x19178(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x150(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x150(%rbp), %rdi
movq %rax, %r9
leaq 0x15161(%rip), %rsi     # 0x18004
leaq 0x15169(%rip), %rdx     # 0x18013
movl $0x68, %ecx
leaq 0x152fb(%rip), %r8      # 0x181b1
movb $0x0, %al
callq 0x2210
callq 0x2040
leaq 0x1536e(%rip), %rdi     # 0x18237
movb $0x0, %al
callq 0x2120
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0x8, %ecx
callq 0x8730
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2f15
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %r8
leaq 0x15338(%rip), %rdi     # 0x18244
movb $0x0, %al
callq 0x2120
jmp 0x2ed0
cmpl $0xffff87b2, -0x1c(%rbp) # imm = 0xFFFF87B2
jne 0x2f20
jmp 0x2f69
movq 0x190d1(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x158(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x158(%rbp), %rdi
movq %rax, %r9
leaq 0x150ba(%rip), %rsi     # 0x18004
leaq 0x150c2(%rip), %rdx     # 0x18013
movl $0x6f, %ecx
leaq 0x15294(%rip), %r8      # 0x181f1
movb $0x0, %al
callq 0x2210
callq 0x2040
leaq 0x152eb(%rip), %rdi     # 0x1825b
movb $0x0, %al
callq 0x2120
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0x6, %ecx
callq 0x8730
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2f9a
jmp 0x2fe3
movq 0x19057(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x160(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x160(%rbp), %rdi
movq %rax, %r9
leaq 0x15040(%rip), %rsi     # 0x18004
leaq 0x15048(%rip), %rdx     # 0x18013
movl $0x71, %ecx
leaq 0x15291(%rip), %r8      # 0x18268
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %r8
leaq 0x15246(%rip), %rdi     # 0x18244
movb $0x0, %al
callq 0x2120
leaq 0x1528a(%rip), %rdi     # 0x18296
movb $0x0, %al
callq 0x2120
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0xc, %ecx
callq 0x8730
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x3058
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %r8
leaq 0x151f5(%rip), %rdi     # 0x18244
movb $0x0, %al
callq 0x2120
jmp 0x3013
cmpl $0xffff87b2, -0x1c(%rbp) # imm = 0xFFFF87B2
jne 0x3063
jmp 0x30ac
movq 0x18f8e(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x168(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x168(%rbp), %rdi
movq %rax, %r9
leaq 0x14f77(%rip), %rsi     # 0x18004
leaq 0x14f7f(%rip), %rdx     # 0x18013
movl $0x7b, %ecx
leaq 0x15151(%rip), %r8      # 0x181f1
movb $0x0, %al
callq 0x2210
callq 0x2040
leaq 0x151f0(%rip), %rdi     # 0x182a3
movb $0x0, %al
callq 0x2120
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0x6, %ecx
callq 0x8730
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x30dd
jmp 0x3126
movq 0x18f14(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x170(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x170(%rbp), %rdi
movq %rax, %r9
leaq 0x14efd(%rip), %rsi     # 0x18004
leaq 0x14f05(%rip), %rdx     # 0x18013
movl $0x7d, %ecx
leaq 0x1514e(%rip), %r8      # 0x18268
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %r8
leaq 0x15103(%rip), %rdi     # 0x18244
movb $0x0, %al
callq 0x2120
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0xc, %ecx
callq 0x8730
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x316b
jmp 0x31b4
movq 0x18e86(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x178(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x178(%rbp), %rdi
movq %rax, %r9
leaq 0x14e6f(%rip), %rsi     # 0x18004
leaq 0x14e77(%rip), %rdx     # 0x18013
movl $0x81, %ecx
leaq 0x1510d(%rip), %r8      # 0x182b5
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %r8
leaq 0x15075(%rip), %rdi     # 0x18244
movb $0x0, %al
callq 0x2120
movq -0x88(%rbp), %rdi
callq 0xe240
movq -0x58(%rbp), %rdi
callq 0x48f0
leaq 0x150f1(%rip), %rdi     # 0x182e3
movb $0x0, %al
callq 0x2120
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x4040
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x3216
jmp 0x325f
movq 0x18ddb(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x180(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x180(%rbp), %rdi
movq %rax, %r9
leaq 0x14dc4(%rip), %rsi     # 0x18004
leaq 0x14dcc(%rip), %rdx     # 0x18013
movl $0x8a, %ecx
leaq 0x14e5b(%rip), %r8      # 0x180ae
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x90(%rbp), %rdx
callq 0xdee0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x327c
jmp 0x32c5
movq 0x18d75(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x188(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x188(%rbp), %rdi
movq %rax, %r9
leaq 0x14d5e(%rip), %rsi     # 0x18004
leaq 0x14d66(%rip), %rdx     # 0x18013
movl $0x8b, %ecx
leaq 0x15040(%rip), %r8      # 0x182f9
movb $0x0, %al
callq 0x2210
callq 0x2040
movl $0x0, -0x14(%rbp)
cmpl $0x32, -0x14(%rbp)
jge 0x33fd
movq -0x90(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0x8, %ecx
callq 0x8730
movl %eax, -0x1c(%rbp)
cmpl $0xffff87b2, %eax       # imm = 0xFFFF87B2
je 0x3352
cmpl $0x0, -0x1c(%rbp)
jne 0x3301
jmp 0x334a
movq 0x18cf0(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x190(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x190(%rbp), %rdi
movq %rax, %r9
leaq 0x14cd9(%rip), %rsi     # 0x18004
leaq 0x14ce1(%rip), %rdx     # 0x18013
movl $0x8d, %ecx
leaq 0x14fdc(%rip), %r8      # 0x1831a
movb $0x0, %al
callq 0x2210
callq 0x2040
xorl %eax, %eax
testb $0x1, %al
jne 0x3352
jmp 0x3357
jmp 0x33fd
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rax
movl %eax, %edx
movq -0x38(%rbp), %rcx
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %rax
movl %eax, %r9d
movq -0x48(%rbp), %rax
leaq 0x14e59(%rip), %rdi     # 0x181d4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2120
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x40(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0xe360
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x33a4
jmp 0x33ed
movq 0x18c4d(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x198(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x198(%rbp), %rdi
movq %rax, %r9
leaq 0x14c36(%rip), %rsi     # 0x18004
leaq 0x14c3e(%rip), %rdx     # 0x18013
movl $0x92, %ecx
leaq 0x14e25(%rip), %r8      # 0x18206
movb $0x0, %al
callq 0x2210
callq 0x2040
jmp 0x33ef
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x32cc
leaq 0x14f42(%rip), %rdi     # 0x18346
movb $0x0, %al
callq 0x2120
movl $0x0, -0x94(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x20, -0x14(%rbp)
jg 0x34ec
movq -0x90(%rbp), %rdi
movl -0x94(%rbp), %ecx
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x8730
movl %eax, -0x1c(%rbp)
cmpl $0xffff87b2, %eax       # imm = 0xFFFF87B2
je 0x34a3
cmpl $0x0, -0x1c(%rbp)
jne 0x3452
jmp 0x349b
movq 0x18b9f(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x1a0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x1a0(%rbp), %rdi
movq %rax, %r9
leaq 0x14b88(%rip), %rsi     # 0x18004
leaq 0x14b90(%rip), %rdx     # 0x18013
movl $0x97, %ecx
leaq 0x14ed1(%rip), %r8      # 0x18360
movb $0x0, %al
callq 0x2210
callq 0x2040
xorl %eax, %eax
testb $0x1, %al
jne 0x34a3
jmp 0x34a5
jmp 0x34ec
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rax
movl %eax, %edx
movq -0x38(%rbp), %rcx
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %rax
movl %eax, %r9d
movq -0x48(%rbp), %rax
leaq 0x14d0b(%rip), %rdi     # 0x181d4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2120
movl $0x8, -0x94(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x341c
movq -0x90(%rbp), %rdi
callq 0xe240
movq -0x58(%rbp), %rdi
callq 0x4940
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x350b
jmp 0x3554
movq 0x18ae6(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x1a8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x1a8(%rbp), %rdi
movq %rax, %r9
leaq 0x14acf(%rip), %rsi     # 0x18004
leaq 0x14ad7(%rip), %rdx     # 0x18013
movl $0x9e, %ecx
leaq 0x14c12(%rip), %r8      # 0x1815a
movb $0x0, %al
callq 0x2210
callq 0x2040
leaq 0x14e2b(%rip), %rdi     # 0x18386
movb $0x0, %al
callq 0x2120
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x4040
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x357f
jmp 0x35c8
movq 0x18a72(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x1b0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x1b0(%rbp), %rdi
movq %rax, %r9
leaq 0x14a5b(%rip), %rsi     # 0x18004
leaq 0x14a63(%rip), %rdx     # 0x18013
movl $0xa1, %ecx
leaq 0x14af2(%rip), %r8      # 0x180ae
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x88(%rbp), %rdx
callq 0xdee0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x35e5
jmp 0x362e
movq 0x18a0c(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x1b8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x1b8(%rbp), %rdi
movq %rax, %r9
leaq 0x149f5(%rip), %rsi     # 0x18004
leaq 0x149fd(%rip), %rdx     # 0x18013
movl $0xa2, %ecx
leaq 0x14b8f(%rip), %r8      # 0x181b1
movb $0x0, %al
callq 0x2210
callq 0x2040
movl $0x0, -0x94(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x20, -0x14(%rbp)
jg 0x370f
movq -0x88(%rbp), %rdi
movl -0x94(%rbp), %ecx
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x8730
movl %eax, -0x1c(%rbp)
cmpl $0xffff87b2, %eax       # imm = 0xFFFF87B2
je 0x36c6
cmpl $0x0, -0x1c(%rbp)
jne 0x3675
jmp 0x36be
movq 0x1897c(%rip), %rax     # 0x1bff8
movq (%rax), %rax
movq %rax, -0x1c0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3750
movq -0x1c0(%rbp), %rdi
movq %rax, %r9
leaq 0x14965(%rip), %rsi     # 0x18004
leaq 0x1496d(%rip), %rdx     # 0x18013
movl $0xa4, %ecx
leaq 0x14cf3(%rip), %r8      # 0x183a5
movb $0x0, %al
callq 0x2210
callq 0x2040
xorl %eax, %eax
testb $0x1, %al
jne 0x36c6
jmp 0x36c8
jmp 0x370f
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rax
movl %eax, %edx
movq -0x38(%rbp), %rcx
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %rax
movl %eax, %r9d
movq -0x48(%rbp), %rax
leaq 0x14ae8(%rip), %rdi     # 0x181d4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2120
movl $0x8, -0x94(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x363f
movq -0x88(%rbp), %rdi
callq 0xe240
movq -0x58(%rbp), %rdi
callq 0x48f0
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0xec60
movq -0x28(%rbp), %rdi
callq 0x14d20
xorl %eax, %eax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop