// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mtest3.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[32];
	char kval[sizeof(int)];

	srand(time(NULL));

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

	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_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, "id2", MDB_CREATE|MDB_DUPSORT, &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);
	for (i=0;i<count;i++) {
		if (!(i & 0x0f))
			sprintf(kval, "%03x", values[i]);
		sprintf(sval, "%03x %d foo bar", values[i], 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));

	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;

	for (i= count - 1; i > -1; i-= (rand()%5)) {
		j++;
		txn=NULL;
		E(mdb_txn_begin(env, NULL, 0, &txn));
		sprintf(kval, "%03x", values[i & ~0x0f]);
		sprintf(sval, "%03x %d foo bar", values[i], 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 $0x170, %rsp            # imm = 0x170
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x2240
movl %eax, %edi
callq 0x21c0
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2180
callq 0x2400
movl $0x180, %ecx            # imm = 0x180
cltd
idivl %ecx
addl $0x40, %edx
movl %edx, -0x8c(%rbp)
movslq -0x8c(%rbp), %rdi
shlq $0x2, %rdi
callq 0x2270
movq %rax, -0x98(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jge 0x25cf
callq 0x2400
movl $0x400, %ecx            # imm = 0x400
cltd
idivl %ecx
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 0x259e
leaq -0x28(%rbp), %rdi
callq 0x13380
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x25e2
jmp 0x262b
movq 0x18a0f(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0xd0(%rbp), %rdi
movq %rax, %r9
leaq 0x149f8(%rip), %rsi     # 0x17004
leaq 0x14a00(%rip), %rdx     # 0x17013
movl $0x34, %ecx
leaq 0x149fd(%rip), %r8      # 0x1701c
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
movl $0xa00000, %esi         # imm = 0xA00000
callq 0x13430
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2643
jmp 0x268c
movq 0x189ae(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0xd8(%rbp), %rdi
movq %rax, %r9
leaq 0x14997(%rip), %rsi     # 0x17004
leaq 0x1499f(%rip), %rdx     # 0x17013
movl $0x35, %ecx
leaq 0x149b1(%rip), %r8      # 0x17031
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
movl $0x4, %esi
callq 0x136c0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x26a4
jmp 0x26ed
movq 0x1894d(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0xe0(%rbp), %rdi
movq %rax, %r9
leaq 0x14936(%rip), %rsi     # 0x17004
leaq 0x1493e(%rip), %rdx     # 0x17013
movl $0x36, %ecx
leaq 0x14973(%rip), %r8      # 0x17054
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
leaq 0x14977(%rip), %rsi     # 0x1706f
movl $0x10001, %edx          # imm = 0x10001
movl $0x1b4, %ecx            # imm = 0x1B4
callq 0x13780
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2711
jmp 0x275a
movq 0x188e0(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0xe8(%rbp), %rdi
movq %rax, %r9
leaq 0x148c9(%rip), %rsi     # 0x17004
leaq 0x148d1(%rip), %rdx     # 0x17013
movl $0x37, %ecx
leaq 0x1492a(%rip), %r8      # 0x17078
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 0x39b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2777
jmp 0x27c0
movq 0x1887a(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0xf0(%rbp), %rdi
movq %rax, %r9
leaq 0x14863(%rip), %rsi     # 0x17004
leaq 0x1486b(%rip), %rdx     # 0x17013
movl $0x39, %ecx
leaq 0x14901(%rip), %r8      # 0x170b5
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x58(%rbp), %rdi
leaq 0x1490c(%rip), %rsi     # 0x170d7
movl $0x40004, %edx          # imm = 0x40004
leaq -0x2c(%rbp), %rcx
callq 0xdfe0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x27e3
jmp 0x282c
movq 0x1880e(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0xf8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0xf8(%rbp), %rdi
movq %rax, %r9
leaq 0x147f7(%rip), %rsi     # 0x17004
leaq 0x147ff(%rip), %rdx     # 0x17013
movl $0x3a, %ecx
leaq 0x148bb(%rip), %r8      # 0x170db
movb $0x0, %al
callq 0x2210
callq 0x2040
movq $0x4, -0x40(%rbp)
leaq -0xc4(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x20, -0x50(%rbp)
leaq -0xc0(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x8c(%rbp), %esi
leaq 0x148b3(%rip), %rdi     # 0x17112
movb $0x0, %al
callq 0x2120
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jge 0x2971
movl -0x14(%rbp), %eax
andl $0xf, %eax
cmpl $0x0, %eax
jne 0x28aa
leaq -0xc4(%rbp), %rdi
movq -0x98(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0x14881(%rip), %rsi     # 0x17124
movb $0x0, %al
callq 0x2360
leaq -0xc0(%rbp), %rdi
movq -0x98(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x98(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
leaq 0x14855(%rip), %rsi     # 0x17129
movb $0x0, %al
callq 0x2360
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x40(%rbp), %rdx
leaq -0x50(%rbp), %rcx
movl $0x20, %r8d
callq 0xdef0
movl %eax, -0x1c(%rbp)
cmpl $0xffff87b1, %eax       # imm = 0xFFFF87B1
je 0x2958
cmpl $0x0, -0x1c(%rbp)
jne 0x2907
jmp 0x2950
movq 0x186ea(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x100(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x100(%rbp), %rdi
movq %rax, %r9
leaq 0x146d3(%rip), %rsi     # 0x17004
leaq 0x146db(%rip), %rdx     # 0x17013
movl $0x46, %ecx
leaq 0x147f5(%rip), %r8      # 0x17139
movb $0x0, %al
callq 0x2210
callq 0x2040
xorl %eax, %eax
testb $0x1, %al
jne 0x2958
jmp 0x2961
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2963
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x286d
cmpl $0x0, -0x18(%rbp)
je 0x2988
movl -0x18(%rbp), %esi
leaq 0x147e6(%rip), %rdi     # 0x17167
movb $0x0, %al
callq 0x2120
movq -0x58(%rbp), %rdi
callq 0x42b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x299b
jmp 0x29e4
movq 0x18656(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x108(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x108(%rbp), %rdi
movq %rax, %r9
leaq 0x1463f(%rip), %rsi     # 0x17004
leaq 0x14647(%rip), %rdx     # 0x17013
movl $0x4a, %ecx
leaq 0x147a6(%rip), %r8      # 0x1717e
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x28(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x151a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x29fb
jmp 0x2a44
movq 0x185f6(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x110(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x110(%rbp), %rdi
movq %rax, %r9
leaq 0x145df(%rip), %rsi     # 0x17004
leaq 0x145e7(%rip), %rdx     # 0x17013
movl $0x4b, %ecx
leaq 0x1475a(%rip), %r8      # 0x17192
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 0x39b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2a64
jmp 0x2aad
movq 0x1858d(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x118(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x118(%rbp), %rdi
movq %rax, %r9
leaq 0x14576(%rip), %rsi     # 0x17004
leaq 0x1457e(%rip), %rdx     # 0x17013
movl $0x4d, %ecx
leaq 0x14709(%rip), %r8      # 0x171aa
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x88(%rbp), %rdx
callq 0xd850
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2aca
jmp 0x2b13
movq 0x18527(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x120(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x120(%rbp), %rdi
movq %rax, %r9
leaq 0x14510(%rip), %rsi     # 0x17004
leaq 0x14518(%rip), %rdx     # 0x17013
movl $0x4e, %ecx
leaq 0x146ce(%rip), %r8      # 0x171d5
movb $0x0, %al
callq 0x2210
callq 0x2040
jmp 0x2b15
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0x8, %ecx
callq 0x80a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2b67
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 0x1469e(%rip), %rdi     # 0x171f8
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2120
jmp 0x2b15
cmpl $0xffff87b2, -0x1c(%rbp) # imm = 0xFFFF87B2
jne 0x2b72
jmp 0x2bbb
movq 0x1847f(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x128(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x128(%rbp), %rdi
movq %rax, %r9
leaq 0x14468(%rip), %rsi     # 0x17004
leaq 0x14470(%rip), %rdx     # 0x17013
movl $0x54, %ecx
leaq 0x14666(%rip), %r8      # 0x17215
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x88(%rbp), %rdi
callq 0xdbb0
movq -0x58(%rbp), %rdi
callq 0x4260
movl $0x0, -0x18(%rbp)
movl -0x8c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jle 0x2de8
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 0x39b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2c1b
jmp 0x2c64
movq 0x183d6(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x130(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x130(%rbp), %rdi
movq %rax, %r9
leaq 0x143bf(%rip), %rsi     # 0x17004
leaq 0x143c7(%rip), %rdx     # 0x17013
movl $0x5d, %ecx
leaq 0x1445d(%rip), %r8      # 0x170b5
movb $0x0, %al
callq 0x2210
callq 0x2040
leaq -0xc4(%rbp), %rdi
movq -0x98(%rbp), %rax
movl -0x14(%rbp), %ecx
andl $-0x10, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
leaq 0x1449f(%rip), %rsi     # 0x17124
movb $0x0, %al
callq 0x2360
leaq -0xc0(%rbp), %rdi
movq -0x98(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x98(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
leaq 0x14473(%rip), %rsi     # 0x17129
movb $0x0, %al
callq 0x2360
movq $0x4, -0x40(%rbp)
leaq -0xc4(%rbp), %rax
movq %rax, -0x38(%rbp)
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
callq 0xdcd0
movl %eax, -0x1c(%rbp)
cmpl $0xffff87b2, %eax       # imm = 0xFFFF87B2
je 0x2d5a
cmpl $0x0, -0x1c(%rbp)
jne 0x2d09
jmp 0x2d52
movq 0x182e8(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x138(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x138(%rbp), %rdi
movq %rax, %r9
leaq 0x142d1(%rip), %rsi     # 0x17004
leaq 0x142d9(%rip), %rdx     # 0x17013
movl $0x64, %ecx
leaq 0x144de(%rip), %r8      # 0x17224
movb $0x0, %al
callq 0x2210
callq 0x2040
xorl %eax, %eax
testb $0x1, %al
jne 0x2d5a
jmp 0x2d6e
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x58(%rbp), %rdi
callq 0x4260
jmp 0x2dcc
movq -0x58(%rbp), %rdi
callq 0x42b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2d81
jmp 0x2dca
movq 0x18270(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x140(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x140(%rbp), %rdi
movq %rax, %r9
leaq 0x14259(%rip), %rsi     # 0x17004
leaq 0x14261(%rip), %rdx     # 0x17013
movl $0x68, %ecx
leaq 0x143c0(%rip), %r8      # 0x1717e
movb $0x0, %al
callq 0x2210
callq 0x2040
jmp 0x2dcc
jmp 0x2dce
callq 0x2400
movl $0x5, %ecx
cltd
idivl %ecx
movl -0x14(%rbp), %eax
subl %edx, %eax
movl %eax, -0x14(%rbp)
jmp 0x2be3
movq -0x98(%rbp), %rdi
callq 0x2030
movl -0x18(%rbp), %esi
leaq 0x14445(%rip), %rdi     # 0x17243
movb $0x0, %al
callq 0x2120
movq -0x28(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x151a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2e1c
jmp 0x2e65
movq 0x181d5(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x148(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x148(%rbp), %rdi
movq %rax, %r9
leaq 0x141be(%rip), %rsi     # 0x17004
leaq 0x141c6(%rip), %rdx     # 0x17013
movl $0x6e, %ecx
leaq 0x14339(%rip), %r8      # 0x17192
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 0x39b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2e85
jmp 0x2ece
movq 0x1816c(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x150(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x150(%rbp), %rdi
movq %rax, %r9
leaq 0x14155(%rip), %rsi     # 0x17004
leaq 0x1415d(%rip), %rdx     # 0x17013
movl $0x6f, %ecx
leaq 0x142e8(%rip), %r8      # 0x171aa
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x58(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x88(%rbp), %rdx
callq 0xd850
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2eeb
jmp 0x2f34
movq 0x18106(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x158(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x158(%rbp), %rdi
movq %rax, %r9
leaq 0x140ef(%rip), %rsi     # 0x17004
leaq 0x140f7(%rip), %rdx     # 0x17013
movl $0x70, %ecx
leaq 0x142ad(%rip), %r8      # 0x171d5
movb $0x0, %al
callq 0x2210
callq 0x2040
leaq 0x1431b(%rip), %rdi     # 0x17256
movb $0x0, %al
callq 0x2120
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0x8, %ecx
callq 0x80a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x2f87
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %r8
leaq 0x142e5(%rip), %rdi     # 0x17263
movb $0x0, %al
callq 0x2120
jmp 0x2f42
cmpl $0xffff87b2, -0x1c(%rbp) # imm = 0xFFFF87B2
jne 0x2f92
jmp 0x2fdb
movq 0x1805f(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x160(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x160(%rbp), %rdi
movq %rax, %r9
leaq 0x14048(%rip), %rsi     # 0x17004
leaq 0x14050(%rip), %rdx     # 0x17013
movl $0x77, %ecx
leaq 0x14246(%rip), %r8      # 0x17215
movb $0x0, %al
callq 0x2210
callq 0x2040
leaq 0x14298(%rip), %rdi     # 0x1727a
movb $0x0, %al
callq 0x2120
movq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl $0xc, %ecx
callq 0x80a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0x302e
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %r8
leaq 0x1423e(%rip), %rdi     # 0x17263
movb $0x0, %al
callq 0x2120
jmp 0x2fe9
cmpl $0xffff87b2, -0x1c(%rbp) # imm = 0xFFFF87B2
jne 0x3039
jmp 0x3082
movq 0x17fb8(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x168(%rbp)
movl -0x1c(%rbp), %edi
callq 0x30c0
movq -0x168(%rbp), %rdi
movq %rax, %r9
leaq 0x13fa1(%rip), %rsi     # 0x17004
leaq 0x13fa9(%rip), %rdx     # 0x17013
movl $0x7e, %ecx
leaq 0x1419f(%rip), %r8      # 0x17215
movb $0x0, %al
callq 0x2210
callq 0x2040
movq -0x88(%rbp), %rdi
callq 0xdbb0
movq -0x58(%rbp), %rdi
callq 0x4260
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0xe5d0
movq -0x28(%rbp), %rdi
callq 0x14690
xorl %eax, %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopw (%rax,%rax)