// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb_stat.c
// Function: main
int main(int argc, char *argv[])
{
	int i, rc;
	MDB_env *env;
	MDB_txn *txn;
	MDB_dbi dbi;
	MDB_stat mst;
	MDB_envinfo mei;
	char *prog = argv[0];
	char *envname;
	char *subname = NULL;
	int alldbs = 0, envinfo = 0, envflags = 0, freinfo = 0, rdrinfo = 0;

	if (argc < 2) {
		usage(prog);
	}

	/* -a: print stat of main DB and all subDBs
	 * -s: print stat of only the named subDB
	 * -e: print env info
	 * -f: print freelist info
	 * -r: print reader info
	 * -n: use NOSUBDIR flag on env_open
	 * -V: print version and exit
	 * (default) print stat of only the main DB
	 */
	while ((i = getopt(argc, argv, "Vaefnrs:")) != EOF) {
		switch(i) {
		case 'V':
			printf("%s\n", MDB_VERSION_STRING);
			exit(0);
			break;
		case 'a':
			if (subname)
				usage(prog);
			alldbs++;
			break;
		case 'e':
			envinfo++;
			break;
		case 'f':
			freinfo++;
			break;
		case 'n':
			envflags |= MDB_NOSUBDIR;
			break;
		case 'r':
			rdrinfo++;
			break;
		case 's':
			if (alldbs)
				usage(prog);
			subname = optarg;
			break;
		default:
			usage(prog);
		}
	}

	if (optind != argc - 1)
		usage(prog);

	envname = argv[optind];
	rc = mdb_env_create(&env);
	if (rc) {
		fprintf(stderr, "mdb_env_create failed, error %d %s\n", rc, mdb_strerror(rc));
		return EXIT_FAILURE;
	}

	if (alldbs || subname) {
		mdb_env_set_maxdbs(env, 4);
	}

	rc = mdb_env_open(env, envname, envflags | MDB_RDONLY, 0664);
	if (rc) {
		fprintf(stderr, "mdb_env_open failed, error %d %s\n", rc, mdb_strerror(rc));
		goto env_close;
	}

	if (envinfo) {
		(void)mdb_env_stat(env, &mst);
		(void)mdb_env_info(env, &mei);
		printf("Environment Info\n");
		printf("  Map address: %p\n", mei.me_mapaddr);
		printf("  Map size: %"Z"u\n", mei.me_mapsize);
		printf("  Page size: %u\n", mst.ms_psize);
		printf("  Max pages: %"Z"u\n", mei.me_mapsize / mst.ms_psize);
		printf("  Number of pages used: %"Z"u\n", mei.me_last_pgno+1);
		printf("  Last transaction ID: %"Z"u\n", mei.me_last_txnid);
		printf("  Max readers: %u\n", mei.me_maxreaders);
		printf("  Number of readers used: %u\n", mei.me_numreaders);
	}

	if (rdrinfo) {
		printf("Reader Table Status\n");
		rc = mdb_reader_list(env, (MDB_msg_func *)fputs, stdout);
		if (rdrinfo > 1) {
			int dead;
			mdb_reader_check(env, &dead);
			printf("  %d stale readers cleared.\n", dead);
			rc = mdb_reader_list(env, (MDB_msg_func *)fputs, stdout);
		}
		if (!(subname || alldbs || freinfo))
			goto env_close;
	}

	rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
	if (rc) {
		fprintf(stderr, "mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc));
		goto env_close;
	}

	if (freinfo) {
		MDB_cursor *cursor;
		MDB_val key, data;
		size_t pages = 0, *iptr;

		printf("Freelist Status\n");
		dbi = 0;
		rc = mdb_cursor_open(txn, dbi, &cursor);
		if (rc) {
			fprintf(stderr, "mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc));
			goto txn_abort;
		}
		rc = mdb_stat(txn, dbi, &mst);
		if (rc) {
			fprintf(stderr, "mdb_stat failed, error %d %s\n", rc, mdb_strerror(rc));
			goto txn_abort;
		}
		prstat(&mst);
		while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) == 0) {
			iptr = data.mv_data;
			pages += *iptr;
			if (freinfo > 1) {
				char *bad = "";
				size_t pg, prev;
				ssize_t i, j, span = 0;
				j = *iptr++;
				for (i = j, prev = 1; --i >= 0; ) {
					pg = iptr[i];
					if (pg <= prev)
						bad = " [bad sequence]";
					prev = pg;
					pg += span;
					for (; i >= span && iptr[i-span] == pg; span++, pg++) ;
				}
				printf("    Transaction %"Z"u, %"Z"d pages, maxspan %"Z"d%s\n",
					*(size_t *)key.mv_data, j, span, bad);
				if (freinfo > 2) {
					for (--j; j >= 0; ) {
						pg = iptr[j];
						for (span=1; --j >= 0 && iptr[j] == pg+span; span++) ;
						printf(span>1 ? "     %9"Z"u[%"Z"d]\n" : "     %9"Z"u\n",
							pg, span);
					}
				}
			}
		}
		mdb_cursor_close(cursor);
		printf("  Free pages: %"Z"u\n", pages);
	}

	rc = mdb_open(txn, subname, 0, &dbi);
	if (rc) {
		fprintf(stderr, "mdb_open failed, error %d %s\n", rc, mdb_strerror(rc));
		goto txn_abort;
	}

	rc = mdb_stat(txn, dbi, &mst);
	if (rc) {
		fprintf(stderr, "mdb_stat failed, error %d %s\n", rc, mdb_strerror(rc));
		goto txn_abort;
	}
	printf("Status of %s\n", subname ? subname : "Main DB");
	prstat(&mst);

	if (alldbs) {
		MDB_cursor *cursor;
		MDB_val key;

		rc = mdb_cursor_open(txn, dbi, &cursor);
		if (rc) {
			fprintf(stderr, "mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc));
			goto txn_abort;
		}
		while ((rc = mdb_cursor_get(cursor, &key, NULL, MDB_NEXT_NODUP)) == 0) {
			char *str;
			MDB_dbi db2;
			if (memchr(key.mv_data, '\0', key.mv_size))
				continue;
			str = malloc(key.mv_size+1);
			memcpy(str, key.mv_data, key.mv_size);
			str[key.mv_size] = '\0';
			rc = mdb_open(txn, str, 0, &db2);
			if (rc == MDB_SUCCESS)
				printf("Status of %s\n", str);
			free(str);
			if (rc) continue;
			rc = mdb_stat(txn, db2, &mst);
			if (rc) {
				fprintf(stderr, "mdb_stat failed, error %d %s\n", rc, mdb_strerror(rc));
				goto txn_abort;
			}
			prstat(&mst);
			mdb_close(env, db2);
		}
		mdb_cursor_close(cursor);
	}

	if (rc == MDB_NOTFOUND)
		rc = MDB_SUCCESS;

	mdb_close(env, dbi);
txn_abort:
	mdb_txn_abort(txn);
env_close:
	mdb_env_close(env);

	return rc ? EXIT_FAILURE : EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0x0, -0xa0(%rbp)
movl $0x0, -0xa4(%rbp)
movl $0x0, -0xa8(%rbp)
movl $0x0, -0xac(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x2596
movq -0x88(%rbp), %rdi
callq 0x30b0
jmp 0x2598
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x14ad6(%rip), %rdx     # 0x1707c
callq 0x2320
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x26a8
movl -0x14(%rbp), %eax
addl $-0x56, %eax
movl %eax, %ecx
movq %rcx, -0x148(%rbp)
subl $0x1d, %eax
ja 0x2697
movq -0x148(%rbp), %rax
leaq 0x14a27(%rip), %rcx     # 0x17004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x14ad7(%rip), %rdi     # 0x170c4
leaq 0x14a91(%rip), %rsi     # 0x17085
movb $0x0, %al
callq 0x2120
xorl %edi, %edi
callq 0x2370
cmpq $0x0, -0x98(%rbp)
je 0x2618
movq -0x88(%rbp), %rdi
callq 0x30b0
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x26a3
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x26a3
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x26a3
movl -0xa4(%rbp), %eax
orl $0x4000, %eax           # imm = 0x4000
movl %eax, -0xa4(%rbp)
jmp 0x26a3
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x26a3
cmpl $0x0, -0x9c(%rbp)
je 0x2684
movq -0x88(%rbp), %rdi
callq 0x30b0
movq 0x1894d(%rip), %rax     # 0x1afd8
movq (%rax), %rax
movq %rax, -0x98(%rbp)
jmp 0x26a3
movq -0x88(%rbp), %rdi
callq 0x30b0
jmp 0x2598
movq 0x18919(%rip), %rax     # 0x1afc8
movl (%rax), %eax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x26c7
movq -0x88(%rbp), %rdi
callq 0x30b0
movq -0x10(%rbp), %rax
movq 0x188f6(%rip), %rcx     # 0x1afc8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x90(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x13430
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x273e
movq 0x188ff(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x158(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x14c(%rbp)
movl -0x18(%rbp), %edi
callq 0x3170
movq -0x158(%rbp), %rdi
movl -0x14c(%rbp), %edx
movq %rax, %rcx
leaq 0x14979(%rip), %rsi     # 0x170a4
movb $0x0, %al
callq 0x2210
movl $0x1, -0x4(%rbp)
jmp 0x30a1
cmpl $0x0, -0x9c(%rbp)
jne 0x2751
cmpq $0x0, -0x98(%rbp)
je 0x275f
movq -0x20(%rbp), %rdi
movl $0x4, %esi
callq 0x13770
movq -0x20(%rbp), %rdi
movq -0x90(%rbp), %rsi
movl -0xa4(%rbp), %edx
orl $0x20000, %edx          # imm = 0x20000
movl $0x1b4, %ecx            # imm = 0x1B4
callq 0x13830
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x27ce
movq 0x18868(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x168(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x15c(%rbp)
movl -0x18(%rbp), %edi
callq 0x3170
movq -0x168(%rbp), %rdi
movl -0x15c(%rbp), %edx
movq %rax, %rcx
leaq 0x14906(%rip), %rsi     # 0x170c8
movb $0x0, %al
callq 0x2210
jmp 0x3085
cmpl $0x0, -0xa0(%rbp)
je 0x289f
movq -0x20(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x15250
movq -0x20(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x15320
leaq 0x148ee(%rip), %rdi     # 0x170ea
movb $0x0, %al
callq 0x2120
movq -0x80(%rbp), %rsi
leaq 0x148ee(%rip), %rdi     # 0x170fc
movb $0x0, %al
callq 0x2120
movq -0x78(%rbp), %rsi
leaq 0x148ef(%rip), %rdi     # 0x1710f
movb $0x0, %al
callq 0x2120
movl -0x58(%rbp), %esi
leaq 0x148ef(%rip), %rdi     # 0x17120
movb $0x0, %al
callq 0x2120
movq -0x78(%rbp), %rax
movl -0x58(%rbp), %ecx
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
leaq 0x148e3(%rip), %rdi     # 0x17131
movb $0x0, %al
callq 0x2120
movq -0x70(%rbp), %rsi
addq $0x1, %rsi
leaq 0x148df(%rip), %rdi     # 0x17143
movb $0x0, %al
callq 0x2120
movq -0x68(%rbp), %rsi
leaq 0x148ea(%rip), %rdi     # 0x17160
movb $0x0, %al
callq 0x2120
movl -0x60(%rbp), %esi
leaq 0x148f5(%rip), %rdi     # 0x1717c
movb $0x0, %al
callq 0x2120
movl -0x5c(%rbp), %esi
leaq 0x148f7(%rip), %rdi     # 0x1718f
movb $0x0, %al
callq 0x2120
cmpl $0x0, -0xac(%rbp)
je 0x2944
leaq 0x148fa(%rip), %rdi     # 0x171ad
movb $0x0, %al
callq 0x2120
movq -0x20(%rbp), %rdi
movq 0x186fb(%rip), %rax     # 0x1afc0
movq (%rax), %rdx
movq 0x18701(%rip), %rsi     # 0x1afd0
callq 0x154d0
movl %eax, -0x18(%rbp)
cmpl $0x1, -0xac(%rbp)
jle 0x2921
movq -0x20(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x15670
movl -0xb0(%rbp), %esi
leaq 0x148c5(%rip), %rdi     # 0x171c2
movb $0x0, %al
callq 0x2120
movq -0x20(%rbp), %rdi
movq 0x186b1(%rip), %rax     # 0x1afc0
movq (%rax), %rdx
movq 0x186b7(%rip), %rsi     # 0x1afd0
callq 0x154d0
movl %eax, -0x18(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x2942
cmpl $0x0, -0x9c(%rbp)
jne 0x2942
cmpl $0x0, -0xa8(%rbp)
jne 0x2942
jmp 0x3085
jmp 0x2944
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x20000, %edx          # imm = 0x20000
leaq -0x28(%rbp), %rcx
callq 0x3a60
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x29a8
movq 0x1868e(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x178(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x16c(%rbp)
movl -0x18(%rbp), %edi
callq 0x3170
movq -0x178(%rbp), %rdi
movl -0x16c(%rbp), %edx
movq %rax, %rcx
leaq 0x14843(%rip), %rsi     # 0x171df
movb $0x0, %al
callq 0x2210
jmp 0x3085
cmpl $0x0, -0xa8(%rbp)
je 0x2d89
movq $0x0, -0xe0(%rbp)
leaq 0x1483b(%rip), %rdi     # 0x17202
movb $0x0, %al
callq 0x2120
movl $0x0, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0xb8(%rbp), %rdx
callq 0xd900
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x2a36
movq 0x18600(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x188(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x17c(%rbp)
movl -0x18(%rbp), %edi
callq 0x3170
movq -0x188(%rbp), %rdi
movl -0x17c(%rbp), %edx
movq %rax, %rcx
leaq 0x147e9(%rip), %rsi     # 0x17213
movb $0x0, %al
callq 0x2210
jmp 0x307c
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x58(%rbp), %rdx
callq 0x153f0
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x2a94
movq 0x185a2(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x198(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x18c(%rbp)
movl -0x18(%rbp), %edi
callq 0x3170
movq -0x198(%rbp), %rdi
movl -0x18c(%rbp), %edx
movq %rax, %rcx
leaq 0x147b0(%rip), %rsi     # 0x17238
movb $0x0, %al
callq 0x2210
jmp 0x307c
leaq -0x58(%rbp), %rdi
callq 0x30f0
movq -0xb8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
movl $0x8, %ecx
callq 0x8150
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jne 0x2d68
movq -0xd0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq (%rax), %rax
addq -0xe0(%rbp), %rax
movq %rax, -0xe0(%rbp)
cmpl $0x1, -0xa8(%rbp)
jle 0x2d63
leaq 0x1495d(%rip), %rax     # 0x1745f
movq %rax, -0xf0(%rbp)
movq $0x0, -0x118(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0xe8(%rbp)
movq (%rax), %rax
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rax
movq %rax, -0x108(%rbp)
movq $0x1, -0x100(%rbp)
movq -0x108(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x108(%rbp)
cmpq $0x0, %rax
jl 0x2c3c
movq -0xe8(%rbp), %rax
movq -0x108(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
cmpq -0x100(%rbp), %rax
ja 0x2b9f
leaq 0x146be(%rip), %rax     # 0x17256
movq %rax, -0xf0(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x118(%rbp), %rax
addq -0xf8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x108(%rbp), %rcx
xorl %eax, %eax
cmpq -0x118(%rbp), %rcx
movb %al, -0x199(%rbp)
jl 0x2c03
movq -0xe8(%rbp), %rax
movq -0x108(%rbp), %rcx
subq -0x118(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0xf8(%rbp), %rax
sete %al
movb %al, -0x199(%rbp)
movb -0x199(%rbp), %al
testb $0x1, %al
jne 0x2c0f
jmp 0x2c37
jmp 0x2c11
movq -0x118(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x118(%rbp)
movq -0xf8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xf8(%rbp)
jmp 0x2bc2
jmp 0x2b4c
movq -0xc0(%rbp), %rax
movq (%rax), %rsi
movq -0x110(%rbp), %rdx
movq -0x118(%rbp), %rcx
movq -0xf0(%rbp), %r8
leaq 0x14604(%rip), %rdi     # 0x17266
movb $0x0, %al
callq 0x2120
cmpl $0x2, -0xa8(%rbp)
jle 0x2d61
movq -0x110(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x110(%rbp)
cmpq $0x0, -0x110(%rbp)
jl 0x2d5f
movq -0xe8(%rbp), %rax
movq -0x110(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xf8(%rbp)
movq $0x1, -0x118(%rbp)
movq -0x110(%rbp), %rcx
addq $-0x1, %rcx
movq %rcx, -0x110(%rbp)
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x19a(%rbp)
jl 0x2d06
movq -0xe8(%rbp), %rax
movq -0x110(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0xf8(%rbp), %rcx
addq -0x118(%rbp), %rcx
cmpq %rcx, %rax
sete %al
movb %al, -0x19a(%rbp)
movb -0x19a(%rbp), %al
testb $0x1, %al
jne 0x2d12
jmp 0x2d28
jmp 0x2d14
movq -0x118(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x118(%rbp)
jmp 0x2cba
movq -0x118(%rbp), %rcx
leaq 0x1456f(%rip), %rdi     # 0x172a5
leaq 0x14558(%rip), %rax     # 0x17295
cmpq $0x1, %rcx
cmovgq %rax, %rdi
movq -0xf8(%rbp), %rsi
movq -0x118(%rbp), %rdx
movb $0x0, %al
callq 0x2120
jmp 0x2c88
jmp 0x2d61
jmp 0x2d63
jmp 0x2a9d
movq -0xb8(%rbp), %rdi
callq 0xdc60
movq -0xe0(%rbp), %rsi
leaq 0x1452e(%rip), %rdi     # 0x172b0
movb $0x0, %al
callq 0x2120
movq -0x28(%rbp), %rdi
movq -0x98(%rbp), %rsi
xorl %edx, %edx
leaq -0x2c(%rbp), %rcx
callq 0xe090
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x2ded
movq 0x18249(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x1a8(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1a0(%rbp)
movl -0x18(%rbp), %edi
callq 0x3170
movq -0x1a8(%rbp), %rdi
movl -0x1a0(%rbp), %edx
movq %rax, %rcx
leaq 0x144e2(%rip), %rsi     # 0x172c3
movb $0x0, %al
callq 0x2210
jmp 0x307c
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x58(%rbp), %rdx
callq 0x153f0
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x2e4b
movq 0x181eb(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x1b8(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1ac(%rbp)
movl -0x18(%rbp), %edi
callq 0x3170
movq -0x1b8(%rbp), %rdi
movl -0x1ac(%rbp), %edx
movq %rax, %rcx
leaq 0x143f9(%rip), %rsi     # 0x17238
movb $0x0, %al
callq 0x2210
jmp 0x307c
cmpq $0x0, -0x98(%rbp)
je 0x2e65
movq -0x98(%rbp), %rax
movq %rax, -0x1c0(%rbp)
jmp 0x2e75
leaq 0x14483(%rip), %rax     # 0x172ef
movq %rax, -0x1c0(%rbp)
jmp 0x2e75
movq -0x1c0(%rbp), %rsi
leaq 0x1445e(%rip), %rdi     # 0x172e1
movb $0x0, %al
callq 0x2120
leaq -0x58(%rbp), %rdi
callq 0x30f0
cmpl $0x0, -0x9c(%rbp)
je 0x3060
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x120(%rbp), %rdx
callq 0xd900
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x2f01
movq 0x18135(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x1d0(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1c4(%rbp)
movl -0x18(%rbp), %edi
callq 0x3170
movq -0x1d0(%rbp), %rdi
movl -0x1c4(%rbp), %edx
movq %rax, %rcx
leaq 0x1431e(%rip), %rsi     # 0x17213
movb $0x0, %al
callq 0x2210
jmp 0x307c
jmp 0x2f03
movq -0x120(%rbp), %rdi
leaq -0x130(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0xb, %ecx
callq 0x8150
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jne 0x3054
movq -0x128(%rbp), %rdi
movq -0x130(%rbp), %rdx
xorl %esi, %esi
callq 0x21b0
cmpq $0x0, %rax
je 0x2f48
jmp 0x2f03
movq -0x130(%rbp), %rdi
addq $0x1, %rdi
callq 0x2260
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rdi
movq -0x128(%rbp), %rsi
movq -0x130(%rbp), %rdx
callq 0x2230
movq -0x138(%rbp), %rax
movq -0x130(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x28(%rbp), %rdi
movq -0x138(%rbp), %rsi
xorl %edx, %edx
leaq -0x13c(%rbp), %rcx
callq 0xe090
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x2fc2
movq -0x138(%rbp), %rsi
leaq 0x14326(%rip), %rdi     # 0x172e1
movb $0x0, %al
callq 0x2120
movq -0x138(%rbp), %rdi
callq 0x2030
cmpl $0x0, -0x18(%rbp)
je 0x2fd9
jmp 0x2f03
movq -0x28(%rbp), %rdi
movl -0x13c(%rbp), %esi
leaq -0x58(%rbp), %rdx
callq 0x153f0
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x3037
movq 0x17ffc(%rip), %rax     # 0x1aff8
movq (%rax), %rax
movq %rax, -0x1e0(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1d4(%rbp)
movl -0x18(%rbp), %edi
callq 0x3170
movq -0x1e0(%rbp), %rdi
movl -0x1d4(%rbp), %edx
movq %rax, %rcx
leaq 0x1420a(%rip), %rsi     # 0x17238
movb $0x0, %al
callq 0x2210
jmp 0x307c
leaq -0x58(%rbp), %rdi
callq 0x30f0
movq -0x20(%rbp), %rdi
movl -0x13c(%rbp), %esi
callq 0xe680
jmp 0x2f03
movq -0x120(%rbp), %rdi
callq 0xdc60
cmpl $0xffff87b2, -0x18(%rbp) # imm = 0xFFFF87B2
jne 0x3070
movl $0x0, -0x18(%rbp)
movq -0x20(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0xe680
movq -0x28(%rbp), %rdi
callq 0x4310
movq -0x20(%rbp), %rdi
callq 0x14740
movl -0x18(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nopl (%rax)