// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mtest4.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;
	int count;
	int *values;
	char sval[8];
	char kval[sizeof(int)];

	memset(sval, 0, sizeof(sval));

	count = 510;
	values = (int *)malloc(count*sizeof(int));

	for(i = 0;i<count;i++) {
		values[i] = i*5;
	}

	E(mdb_env_create(&env));
	E(mdb_env_set_mapsize(env, 10485760));
	E(mdb_env_set_maxdbs(env, 4));
	E(mdb_env_open(env, "./testdb", MDB_FIXEDMAP|MDB_NOSYNC, 0664));

	E(mdb_txn_begin(env, NULL, 0, &txn));
	E(mdb_dbi_open(txn, "id4", MDB_CREATE|MDB_DUPSORT|MDB_DUPFIXED, &dbi));

	key.mv_size = sizeof(int);
	key.mv_data = kval;
	data.mv_size = sizeof(sval);
	data.mv_data = sval;

	printf("Adding %d values\n", count);
	strcpy(kval, "001");
	for (i=0;i<count;i++) {
		sprintf(sval, "%07x", values[i]);
		if (RES(MDB_KEYEXIST, mdb_put(txn, dbi, &key, &data, MDB_NODUPDATA)))
			j++;
	}
	if (j) printf("%d duplicates skipped\n", j);
	E(mdb_txn_commit(txn));
	E(mdb_env_stat(env, &mst));

	/* there should be one full page of dups now.
	 */
	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);

	/* test all 3 branches of split code:
	 * 1: new key in lower half
	 * 2: new key at split point
	 * 3: new key in upper half
	 */

	key.mv_size = sizeof(int);
	key.mv_data = kval;
	data.mv_size = sizeof(sval);
	data.mv_data = sval;

	sprintf(sval, "%07x", values[3]+1);
	E(mdb_txn_begin(env, NULL, 0, &txn));
	(void)RES(MDB_KEYEXIST, mdb_put(txn, dbi, &key, &data, MDB_NODUPDATA));
	mdb_txn_abort(txn);

	sprintf(sval, "%07x", values[255]+1);
	E(mdb_txn_begin(env, NULL, 0, &txn));
	(void)RES(MDB_KEYEXIST, mdb_put(txn, dbi, &key, &data, MDB_NODUPDATA));
	mdb_txn_abort(txn);

	sprintf(sval, "%07x", values[500]+1);
	E(mdb_txn_begin(env, NULL, 0, &txn));
	(void)RES(MDB_KEYEXIST, mdb_put(txn, dbi, &key, &data, MDB_NODUPDATA));
	E(mdb_txn_commit(txn));

	/* Try MDB_NEXT_MULTIPLE */
	E(mdb_txn_begin(env, NULL, 0, &txn));
	E(mdb_cursor_open(txn, dbi, &cursor));
	while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT_MULTIPLE)) == 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");
	mdb_cursor_close(cursor);
	mdb_txn_abort(txn);
	j=0;

	for (i= count - 1; i > -1; i-= (rand()%3)) {
		j++;
		txn=NULL;
		E(mdb_txn_begin(env, NULL, 0, &txn));
		sprintf(sval, "%07x", values[i]);
		key.mv_size = sizeof(int);
		key.mv_data = kval;
		data.mv_size = sizeof(sval);
		data.mv_data = sval;
		if (RES(MDB_NOTFOUND, mdb_del(txn, dbi, &key, &data))) {
			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 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");
	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 $0x1c0, %rsp            # imm = 0x1C0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x2180
movl $0x1fe, -0x8c(%rbp)     # imm = 0x1FE
movslq -0x8c(%rbp), %rdi
shlq $0x2, %rdi
callq 0x2250
movq %rax, -0x98(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jge 0x258a
imull $0x5, -0x14(%rbp), %edx
movq -0x98(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2562
leaq -0x28(%rbp), %rdi
callq 0x13840
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x259d
jmp 0x25e6
movq 0x18a54(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0xb0(%rbp), %rdi
movq %rax, %r9
leaq 0x14a3d(%rip), %rsi     # 0x17004
leaq 0x14a45(%rip), %rdx     # 0x17013
movl $0x32, %ecx
leaq 0x14a42(%rip), %r8      # 0x1701c
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x28(%rbp), %rdi
movl $0xa00000, %esi         # imm = 0xA00000
callq 0x138f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x25fe
jmp 0x2647
movq 0x189f3(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0xb8(%rbp), %rdi
movq %rax, %r9
leaq 0x149dc(%rip), %rsi     # 0x17004
leaq 0x149e4(%rip), %rdx     # 0x17013
movl $0x33, %ecx
leaq 0x149f6(%rip), %r8      # 0x17031
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x28(%rbp), %rdi
movl $0x4, %esi
callq 0x13b80
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x265f
jmp 0x26a8
movq 0x18992(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0xc0(%rbp), %rdi
movq %rax, %r9
leaq 0x1497b(%rip), %rsi     # 0x17004
leaq 0x14983(%rip), %rdx     # 0x17013
movl $0x34, %ecx
leaq 0x149b8(%rip), %r8      # 0x17054
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x28(%rbp), %rdi
leaq 0x149bc(%rip), %rsi     # 0x1706f
movl $0x10001, %edx          # imm = 0x10001
movl $0x1b4, %ecx            # imm = 0x1B4
callq 0x13c40
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x26cc
jmp 0x2715
movq 0x18925(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xc8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0xc8(%rbp), %rdi
movq %rax, %r9
leaq 0x1490e(%rip), %rsi     # 0x17004
leaq 0x14916(%rip), %rdx     # 0x17013
movl $0x35, %ecx
leaq 0x1496f(%rip), %r8      # 0x17078
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x3e70
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2732
jmp 0x277b
movq 0x188bf(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0xd0(%rbp), %rdi
movq %rax, %r9
leaq 0x148a8(%rip), %rsi     # 0x17004
leaq 0x148b0(%rip), %rdx     # 0x17013
movl $0x37, %ecx
leaq 0x14946(%rip), %r8      # 0x170b5
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x58(%rbp), %rdi
leaq 0x14951(%rip), %rsi     # 0x170d7
movl $0x40014, %edx          # imm = 0x40014
leaq -0x2c(%rbp), %rcx
callq 0xe4a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x279e
jmp 0x27e7
movq 0x18853(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0xd8(%rbp), %rdi
movq %rax, %r9
leaq 0x1483c(%rip), %rsi     # 0x17004
leaq 0x14844(%rip), %rdx     # 0x17013
movl $0x38, %ecx
leaq 0x14900(%rip), %r8      # 0x170db
movb $0x0, %al
callq 0x2200
callq 0x2040
movq $0x4, -0x40(%rbp)
leaq -0xa4(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x8, -0x50(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x8c(%rbp), %esi
leaq 0x14905(%rip), %rdi     # 0x1711f
movb $0x0, %al
callq 0x2120
leaq -0xa4(%rbp), %rdi
leaq 0x14902(%rip), %rsi     # 0x17131
callq 0x2080
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jge 0x2903
leaq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0x148cf(%rip), %rsi     # 0x17135
movb $0x0, %al
callq 0x2340
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x40(%rbp), %rdx
leaq -0x50(%rbp), %rcx
movl $0x20, %r8d
callq 0xe3b0
movl %eax, -0x1c(%rbp)
cmpl $0xffff87b1, %eax       # imm = 0xFFFF87B1
je 0x28ea
cmpl $0x0, -0x1c(%rbp)
jne 0x2899
jmp 0x28e2
movq 0x18758(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0xe0(%rbp), %rdi
movq %rax, %r9
leaq 0x14741(%rip), %rsi     # 0x17004
leaq 0x14749(%rip), %rdx     # 0x17013
movl $0x43, %ecx
leaq 0x14864(%rip), %r8      # 0x1713a
movb $0x0, %al
callq 0x2200
callq 0x2040
xorl %eax, %eax
testb $0x1, %al
jne 0x28ea
jmp 0x28f3
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x28f5
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x283b
cmpl $0x0, -0x18(%rbp)
je 0x291a
movl -0x18(%rbp), %esi
leaq 0x14855(%rip), %rdi     # 0x17168
movb $0x0, %al
callq 0x2120
movq -0x58(%rbp), %rdi
callq 0x4770
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x292d
jmp 0x2976
movq 0x186c4(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0xe8(%rbp), %rdi
movq %rax, %r9
leaq 0x146ad(%rip), %rsi     # 0x17004
leaq 0x146b5(%rip), %rdx     # 0x17013
movl $0x47, %ecx
leaq 0x14815(%rip), %r8      # 0x1717f
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x28(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x15660
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x298d
jmp 0x29d6
movq 0x18664(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0xf0(%rbp), %rdi
movq %rax, %r9
leaq 0x1464d(%rip), %rsi     # 0x17004
leaq 0x14655(%rip), %rdx     # 0x17013
movl $0x48, %ecx
leaq 0x147c9(%rip), %r8      # 0x17193
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x20000, %edx          # imm = 0x20000
leaq -0x58(%rbp), %rcx
callq 0x3e70
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x29f6
jmp 0x2a3f
movq 0x185fb(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xf8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0xf8(%rbp), %rdi
movq %rax, %r9
leaq 0x145e4(%rip), %rsi     # 0x17004
leaq 0x145ec(%rip), %rdx     # 0x17013
movl $0x4c, %ecx
leaq 0x14778(%rip), %r8      # 0x171ab
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x88(%rbp), %rdx
callq 0xdd10
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2a5c
jmp 0x2aa5
movq 0x18595(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x100(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x100(%rbp), %rdi
movq %rax, %r9
leaq 0x1457e(%rip), %rsi     # 0x17004
leaq 0x14586(%rip), %rdx     # 0x17013
movl $0x4d, %ecx
leaq 0x1473d(%rip), %r8      # 0x171d6
movb $0x0, %al
callq 0x2200
callq 0x2040
jmp 0x2aa7
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0x8, %ecx
callq 0x8560
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2af9
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 0x1470d(%rip), %rdi     # 0x171f9
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2120
jmp 0x2aa7
cmpl $0xffff87b2, -0x1c(%rbp) # imm = 0xFFFF87B2
jne 0x2b04
jmp 0x2b4d
movq 0x184ed(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x108(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x108(%rbp), %rdi
movq %rax, %r9
leaq 0x144d6(%rip), %rsi     # 0x17004
leaq 0x144de(%rip), %rdx     # 0x17013
movl $0x53, %ecx
leaq 0x146d5(%rip), %r8      # 0x17216
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x88(%rbp), %rdi
callq 0xe070
movq -0x58(%rbp), %rdi
callq 0x4720
movq $0x4, -0x40(%rbp)
leaq -0xa4(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x8, -0x50(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rax
movl 0xc(%rax), %edx
addl $0x1, %edx
leaq 0x14592(%rip), %rsi     # 0x17135
movb $0x0, %al
callq 0x2340
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x3e70
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2bc7
jmp 0x2c10
movq 0x1842a(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x110(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x110(%rbp), %rdi
movq %rax, %r9
leaq 0x14413(%rip), %rsi     # 0x17004
leaq 0x1441b(%rip), %rdx     # 0x17013
movl $0x63, %ecx
leaq 0x144b1(%rip), %r8      # 0x170b5
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x40(%rbp), %rdx
leaq -0x50(%rbp), %rcx
movl $0x20, %r8d
callq 0xe3b0
movl %eax, %ecx
movl %ecx, -0x1c(%rbp)
movb $0x1, %al
cmpl $0xffff87b1, %ecx       # imm = 0xFFFF87B1
movb %al, -0x111(%rbp)
je 0x2c9a
cmpl $0x0, -0x1c(%rbp)
jne 0x2c47
jmp 0x2c90
movq 0x183aa(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x120(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x120(%rbp), %rdi
movq %rax, %r9
leaq 0x14393(%rip), %rsi     # 0x17004
leaq 0x1439b(%rip), %rdx     # 0x17013
movl $0x64, %ecx
leaq 0x144b6(%rip), %r8      # 0x1713a
movb $0x0, %al
callq 0x2200
callq 0x2040
xorl %eax, %eax
movb %al, -0x111(%rbp)
jmp 0x2c9a
movb -0x111(%rbp), %al
movq -0x58(%rbp), %rdi
callq 0x4720
leaq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rax
movl 0x3fc(%rax), %edx
addl $0x1, %edx
leaq 0x1446e(%rip), %rsi     # 0x17135
movb $0x0, %al
callq 0x2340
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x3e70
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2ceb
jmp 0x2d34
movq 0x18306(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x128(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x128(%rbp), %rdi
movq %rax, %r9
leaq 0x142ef(%rip), %rsi     # 0x17004
leaq 0x142f7(%rip), %rdx     # 0x17013
movl $0x68, %ecx
leaq 0x1438d(%rip), %r8      # 0x170b5
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x40(%rbp), %rdx
leaq -0x50(%rbp), %rcx
movl $0x20, %r8d
callq 0xe3b0
movl %eax, %ecx
movl %ecx, -0x1c(%rbp)
movb $0x1, %al
cmpl $0xffff87b1, %ecx       # imm = 0xFFFF87B1
movb %al, -0x129(%rbp)
je 0x2dbe
cmpl $0x0, -0x1c(%rbp)
jne 0x2d6b
jmp 0x2db4
movq 0x18286(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x138(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x138(%rbp), %rdi
movq %rax, %r9
leaq 0x1426f(%rip), %rsi     # 0x17004
leaq 0x14277(%rip), %rdx     # 0x17013
movl $0x69, %ecx
leaq 0x14392(%rip), %r8      # 0x1713a
movb $0x0, %al
callq 0x2200
callq 0x2040
xorl %eax, %eax
movb %al, -0x129(%rbp)
jmp 0x2dbe
movb -0x129(%rbp), %al
movq -0x58(%rbp), %rdi
callq 0x4720
leaq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rax
movl 0x7d0(%rax), %edx
addl $0x1, %edx
leaq 0x1434a(%rip), %rsi     # 0x17135
movb $0x0, %al
callq 0x2340
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x3e70
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2e0f
jmp 0x2e58
movq 0x181e2(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x140(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x140(%rbp), %rdi
movq %rax, %r9
leaq 0x141cb(%rip), %rsi     # 0x17004
leaq 0x141d3(%rip), %rdx     # 0x17013
movl $0x6d, %ecx
leaq 0x14269(%rip), %r8      # 0x170b5
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x40(%rbp), %rdx
leaq -0x50(%rbp), %rcx
movl $0x20, %r8d
callq 0xe3b0
movl %eax, %ecx
movl %ecx, -0x1c(%rbp)
movb $0x1, %al
cmpl $0xffff87b1, %ecx       # imm = 0xFFFF87B1
movb %al, -0x141(%rbp)
je 0x2ee2
cmpl $0x0, -0x1c(%rbp)
jne 0x2e8f
jmp 0x2ed8
movq 0x18162(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x150(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x150(%rbp), %rdi
movq %rax, %r9
leaq 0x1414b(%rip), %rsi     # 0x17004
leaq 0x14153(%rip), %rdx     # 0x17013
movl $0x6e, %ecx
leaq 0x1426e(%rip), %r8      # 0x1713a
movb $0x0, %al
callq 0x2200
callq 0x2040
xorl %eax, %eax
movb %al, -0x141(%rbp)
jmp 0x2ee2
movb -0x141(%rbp), %al
movq -0x58(%rbp), %rdi
callq 0x4770
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2efb
jmp 0x2f44
movq 0x180f6(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x158(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x158(%rbp), %rdi
movq %rax, %r9
leaq 0x140df(%rip), %rsi     # 0x17004
leaq 0x140e7(%rip), %rdx     # 0x17013
movl $0x6f, %ecx
leaq 0x14247(%rip), %r8      # 0x1717f
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x3e70
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2f61
jmp 0x2faa
movq 0x18090(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x160(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x160(%rbp), %rdi
movq %rax, %r9
leaq 0x14079(%rip), %rsi     # 0x17004
leaq 0x14081(%rip), %rdx     # 0x17013
movl $0x72, %ecx
leaq 0x14117(%rip), %r8      # 0x170b5
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x88(%rbp), %rdx
callq 0xdd10
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2fc7
jmp 0x3010
movq 0x1802a(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x168(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x168(%rbp), %rdi
movq %rax, %r9
leaq 0x14013(%rip), %rsi     # 0x17004
leaq 0x1401b(%rip), %rdx     # 0x17013
movl $0x73, %ecx
leaq 0x141d2(%rip), %r8      # 0x171d6
movb $0x0, %al
callq 0x2200
callq 0x2040
jmp 0x3012
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0xa, %ecx
callq 0x8560
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x3057
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %r8
leaq 0x141d7(%rip), %rdi     # 0x17225
movb $0x0, %al
callq 0x2120
jmp 0x3012
cmpl $0xffff87b2, -0x1c(%rbp) # imm = 0xFFFF87B2
jne 0x3062
jmp 0x30ab
movq 0x17f8f(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x170(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x170(%rbp), %rdi
movq %rax, %r9
leaq 0x13f78(%rip), %rsi     # 0x17004
leaq 0x13f80(%rip), %rdx     # 0x17013
movl $0x79, %ecx
leaq 0x14177(%rip), %r8      # 0x17216
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x88(%rbp), %rdi
callq 0xe070
movq -0x58(%rbp), %rdi
callq 0x4720
movl $0x0, -0x18(%rbp)
movl -0x8c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jle 0x32a2
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 0x3e70
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x310b
jmp 0x3154
movq 0x17ee6(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x178(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x178(%rbp), %rdi
movq %rax, %r9
leaq 0x13ecf(%rip), %rsi     # 0x17004
leaq 0x13ed7(%rip), %rdx     # 0x17013
movl $0x81, %ecx
leaq 0x13f6d(%rip), %r8      # 0x170b5
movb $0x0, %al
callq 0x2200
callq 0x2040
leaq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0x13fc5(%rip), %rsi     # 0x17135
movb $0x0, %al
callq 0x2340
movq $0x4, -0x40(%rbp)
leaq -0xa4(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x8, -0x50(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x40(%rbp), %rdx
leaq -0x50(%rbp), %rcx
callq 0xe190
movl %eax, -0x1c(%rbp)
cmpl $0xffff87b2, %eax       # imm = 0xFFFF87B2
je 0x3214
cmpl $0x0, -0x1c(%rbp)
jne 0x31c3
jmp 0x320c
movq 0x17e2e(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x180(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x180(%rbp), %rdi
movq %rax, %r9
leaq 0x13e17(%rip), %rsi     # 0x17004
leaq 0x13e1f(%rip), %rdx     # 0x17013
movl $0x87, %ecx
leaq 0x1403c(%rip), %r8      # 0x1723c
movb $0x0, %al
callq 0x2200
callq 0x2040
xorl %eax, %eax
testb $0x1, %al
jne 0x3214
jmp 0x3228
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x58(%rbp), %rdi
callq 0x4720
jmp 0x3286
movq -0x58(%rbp), %rdi
callq 0x4770
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x323b
jmp 0x3284
movq 0x17db6(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x188(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x188(%rbp), %rdi
movq %rax, %r9
leaq 0x13d9f(%rip), %rsi     # 0x17004
leaq 0x13da7(%rip), %rdx     # 0x17013
movl $0x8b, %ecx
leaq 0x13f07(%rip), %r8      # 0x1717f
movb $0x0, %al
callq 0x2200
callq 0x2040
jmp 0x3286
jmp 0x3288
callq 0x23e0
movl $0x3, %ecx
cltd
idivl %ecx
movl -0x14(%rbp), %eax
subl %edx, %eax
movl %eax, -0x14(%rbp)
jmp 0x30d3
movq -0x98(%rbp), %rdi
callq 0x2030
movl -0x18(%rbp), %esi
leaq 0x13fa3(%rip), %rdi     # 0x1725b
movb $0x0, %al
callq 0x2120
movq -0x28(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x15660
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x32d6
jmp 0x331f
movq 0x17d1b(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x190(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x190(%rbp), %rdi
movq %rax, %r9
leaq 0x13d04(%rip), %rsi     # 0x17004
leaq 0x13d0c(%rip), %rdx     # 0x17013
movl $0x91, %ecx
leaq 0x13e80(%rip), %r8      # 0x17193
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x20000, %edx          # imm = 0x20000
leaq -0x58(%rbp), %rcx
callq 0x3e70
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x333f
jmp 0x3388
movq 0x17cb2(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x198(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x198(%rbp), %rdi
movq %rax, %r9
leaq 0x13c9b(%rip), %rsi     # 0x17004
leaq 0x13ca3(%rip), %rdx     # 0x17013
movl $0x92, %ecx
leaq 0x13e2f(%rip), %r8      # 0x171ab
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x88(%rbp), %rdx
callq 0xdd10
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x33a5
jmp 0x33ee
movq 0x17c4c(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x1a0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x1a0(%rbp), %rdi
movq %rax, %r9
leaq 0x13c35(%rip), %rsi     # 0x17004
leaq 0x13c3d(%rip), %rdx     # 0x17013
movl $0x93, %ecx
leaq 0x13df4(%rip), %r8      # 0x171d6
movb $0x0, %al
callq 0x2200
callq 0x2040
leaq 0x13e79(%rip), %rdi     # 0x1726e
movb $0x0, %al
callq 0x2120
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0x8, %ecx
callq 0x8560
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x3441
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %r8
leaq 0x13ded(%rip), %rdi     # 0x17225
movb $0x0, %al
callq 0x2120
jmp 0x33fc
cmpl $0xffff87b2, -0x1c(%rbp) # imm = 0xFFFF87B2
jne 0x344c
jmp 0x3495
movq 0x17ba5(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x1a8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x1a8(%rbp), %rdi
movq %rax, %r9
leaq 0x13b8e(%rip), %rsi     # 0x17004
leaq 0x13b96(%rip), %rdx     # 0x17013
movl $0x9a, %ecx
leaq 0x13d8d(%rip), %r8      # 0x17216
movb $0x0, %al
callq 0x2200
callq 0x2040
leaq 0x13ddf(%rip), %rdi     # 0x1727b
movb $0x0, %al
callq 0x2120
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0xc, %ecx
callq 0x8560
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x34e8
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %r8
leaq 0x13d46(%rip), %rdi     # 0x17225
movb $0x0, %al
callq 0x2120
jmp 0x34a3
cmpl $0xffff87b2, -0x1c(%rbp) # imm = 0xFFFF87B2
jne 0x34f3
jmp 0x353c
movq 0x17afe(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x1b0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3580
movq -0x1b0(%rbp), %rdi
movq %rax, %r9
leaq 0x13ae7(%rip), %rsi     # 0x17004
leaq 0x13aef(%rip), %rdx     # 0x17013
movl $0xa1, %ecx
leaq 0x13ce6(%rip), %r8      # 0x17216
movb $0x0, %al
callq 0x2200
callq 0x2040
movq -0x88(%rbp), %rdi
callq 0xe070
movq -0x58(%rbp), %rdi
callq 0x4720
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0xea90
movq -0x28(%rbp), %rdi
callq 0x14b50
xorl %eax, %eax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)