// File: /workspace/github_c_makefile_star2_O1/ranbenbasat[P]RHHH/check2.cpp
// Function: main
int main(int argc, char * argv[]) {
	if (argc != 6 && argc != 7 && argc != 3 && argc != 4) {
		printf("Usage: %s <n> <c> <t> <data> <output> [<exact>]\n", argv[0]);
		printf("Usage: %s <data> <output> [<exact>]\n", argv[0]);
		printf("\t<n>=number of IP pairs\n");
		printf("\t<c>=counters (1/eps)\n");
		printf("\t<data>=data file (IP pairs)\n");
		printf("\t<output>=output of HHH algorithm to check\n");
		printf("\t<exact>=file to output exact HHH\n");
		return 0;
	}
	int n, counters, threshold, num;
	float time=-1; char * algname = dummy;
	FILE * data, * output, * exactfile;
	if (argc > 4) {
		n = atoi(argv[1]);
		counters = atoi(argv[2]);
		threshold = atoi(argv[3]);
		data = fopen(argv[4], "r");
		output = fopen(argv[5], "r");
		exactfile = (argc == 7 ? fopen(argv[6], "w") : NULL);
		fscanf(output, "%d", &num);
	} else {
		data = fopen(argv[1], "r");
		output = fopen(argv[2], "r");
		exactfile = (argc == 4 ? fopen(argv[3], "w") : NULL);
		fscanf(output, "%as %d %d %d %d %f\n", &algname, &n, &counters, &threshold, &num, &time);
	}

	if (getenv("DONTCHECKABOVE") != NULL && atoi(getenv("DONTCHECKABOVE")) < n) {
		fclose(data);
		fclose(output);
		if (exactfile != NULL) fclose(exactfile);
		return 0;
	}

	FILE * fsummary = (getenv("SUMMARYFILE") != NULL ? fopen(getenv("SUMMARYFILE"), "a") : NULL);

	map<Item, Counter> m[NUM_MASKS];
	for (int i = 0; i < n; i++) {
		Item x;
		Item item = 0;
		for (int j = 0; j < 8; j++) {
			fscanf(data, "%llu", &x);
			item = ((item << 8) | x);
		}
		for (int j = 0; j < NUM_MASKS; j++) {
			m[j][item & masks[j]].inc();
		}
	}	

	vector<Pair> exact;
	vector<int> exactcount;
	for (int i = 0; i < NUM_MASKS; i++) {
		for (map<Item, Counter>::const_iterator it = m[i].begin(); it != m[i].end(); ++it) {
			if (it->second.get() >= threshold && conditionedcount(m, exact, it->first, i) >= threshold) {
				exact.push_back(Pair(i, it->first));
				exactcount.push_back(it->second.get());
			}
		}
	}
	if (exactfile != NULL) {
		fprintf(exactfile, "%d\n", (int)exact.size()); 
		vector< Pair >::const_iterator it1 = exact.begin();
		vector< int >::const_iterator it2 = exactcount.begin();
		while (it1 != exact.end())  {
			fprintf(exactfile, "%d ", it1->first);
			printip(it1->second >> 32, exactfile);
			fprintf(exactfile, " ");
			printip(it1->second, exactfile);
			fprintf(exactfile, " %d %d\n", *it2, *it2);
			++it1;
			++it2;
		}
	}
	if (fsummary != NULL && argc > 4) {
		fprintf(fsummary, "algorithm=%s nitems=%d counters=%d threshold=%d outputsize=%d\n",
		                   argv[0],     n,        counters,   threshold,   (int)exact.size()); 
	}

	int accErrors=0;
	int covErrors=0;
	double eps=-1;
	double epsil=-1;
	
	vector<Pair> p;
	set<Pair> s;
	for (int i = 0; i < num; i++) {
		int mask;
		fscanf(output, "%d", &mask);
		Item item = 0;
		Item w, x, y, z;
		fscanf(output, "%llu.%llu.%llu.%llu", &w, &x, &y, &z);
		item = ((item << 8)|w);
		item = ((item << 8)|x);
		item = ((item << 8)|y);
		item = ((item << 8)|z);
		fscanf(output, "%llu.%llu.%llu.%llu", &w, &x, &y, &z);
		item = ((item << 8)|w);
		item = ((item << 8)|x);
		item = ((item << 8)|y);
		item = ((item << 8)|z);
		int fmin, fmax;
		fscanf(output, "%d%d", &fmin, &fmax);

		int truecount = m[mask][item].get();
		if (truecount < fmin - n/counters || truecount > fmax + n/counters) {
			accErrors++;
			if (getenv("NONVERBOSE") == NULL){
				printf("Accuracy: [%d] ", mask);
				printip(item >> 32);
				printf(" ");
				printip(item);
				printf(" [%d] %d %d\n", truecount, fmin, fmax);
			}
		}

		double epscand = ((double) (fmax-fmin)) / truecount;
		if (epscand > eps) eps = epscand;
		epsil = max(epsil, ((double)(fmax-fmin))/n);

		p.push_back(Pair(mask, item));
		s.insert(Pair(mask, item));
	}

	for (int i = 0; i < NUM_MASKS; i++) {
		for (map<Item, Counter>::const_iterator it = m[i].begin(); it != m[i].end(); ++it) {
			if (it->second.get() >= threshold && conditionedcount(m, p, it->first, i) >= threshold && 0==s.count(Pair(it->first, i))) {
				covErrors++;
				if (getenv("NONVERBOSE") == NULL){
					printf("Coverage: [%d] ", i);
					printip(it->first);
					printf(" [%d/%d]\n", it->second.get(), conditionedcount(m, p, it->first, i));
				}
			}
		}
	}

	if (accErrors+covErrors > 0 && fsummary != NULL) {
		fprintf(fsummary, "Error: algorithm=%s nitems=%d counters=%d threshold=%d accErrors=%d covErrors=%d\n",
			                  argv[0],     n,        counters,   threshold, accErrors, covErrors); 
	}

	if (fsummary != NULL && argc <= 4) {
		fprintf(fsummary, "check=true  algorithm=%-14s nitems=%-10d counters=%-5d threshold=%-9d outputsize=%-3d exactsize=%-3d time=%f accuracy=%lf epsilon=%lf\n",
		                   algname,        n,           counters,     threshold,     num,        (int)exact.size(), time,   eps, epsil); 
	}

	if (exactfile != NULL) fclose(exactfile);
	if (fsummary != NULL) fclose(fsummary);
	fclose(data);
	fclose(output);
	if (argc <= 4) free(algname);

	printf("%d accErrors %d covErrors %d exact hhhs\n", accErrors, covErrors, (int)exact.size());

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xcd88, %rsp           # imm = 0xCD88
movq %rsi, %r15
cmpl $0x7, %edi
ja 0x22bf
movl %edi, %ebp
movl $0xd8, %eax
btl %edi, %eax
jae 0x22bf
movl $0xbf800000, 0x5c(%rsp) # imm = 0xBF800000
leaq 0x5b92(%rip), %rax      # 0x7301
movq %rax, 0x78(%rsp)
movq 0x8(%r15), %rdi
cmpl $0x5, %ebp
jl 0x17e1
callq 0x1180
movl %eax, 0xc(%rsp)
movq 0x10(%r15), %rdi
callq 0x1180
movl %eax, 0x14(%rsp)
movq 0x18(%r15), %rdi
callq 0x1180
movl %eax, 0x10(%rsp)
movq 0x20(%r15), %rdi
leaq 0x194e(%rip), %rbx      # 0x30f9
movq %rbx, %rsi
callq 0x1110
movq %rax, %r14
movq 0x28(%r15), %rdi
movq %rbx, %rsi
callq 0x1110
movq %rax, 0x38(%rsp)
cmpl $0x7, %ebp
jne 0x181e
movq 0x30(%r15), %rdi
leaq 0x1924(%rip), %rsi      # 0x30fb
callq 0x1110
movq %rax, %rbx
jmp 0x1820
leaq 0x1911(%rip), %rbx      # 0x30f9
movq %rbx, %rsi
callq 0x1110
movq %rax, %r14
movq 0x10(%r15), %rdi
movq %rbx, %rsi
callq 0x1110
movq %rax, 0x38(%rsp)
cmpl $0x4, %ebp
jne 0x183a
movq 0x18(%r15), %rdi
leaq 0x18e7(%rip), %rsi      # 0x30fb
callq 0x1110
movq %rax, %rbx
jmp 0x183c
xorl %ebx, %ebx
leaq 0x1812(%rip), %rsi      # 0x3039
leaq 0x2c(%rsp), %rdx
movq 0x38(%rsp), %rdi
xorl %eax, %eax
callq 0x11b0
jmp 0x1875
xorl %ebx, %ebx
leaq 0x5c(%rsp), %r10
leaq 0x2c(%rsp), %r11
leaq 0x18b0(%rip), %rsi      # 0x30fd
leaq 0x78(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x14(%rsp), %r8
leaq 0x10(%rsp), %r9
movq 0x38(%rsp), %rdi
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x11b0
addq $0x10, %rsp
leaq 0x1895(%rip), %rdi      # 0x3111
callq 0x1130
testq %rax, %rax
je 0x18bc
movq %rax, %rdi
callq 0x1180
cmpl 0xc(%rsp), %eax
jge 0x18bc
movq %r14, %rdi
callq 0x10d0
movq 0x38(%rsp), %rdi
callq 0x10d0
testq %rbx, %rbx
je 0x231d
movq %rbx, %rdi
callq 0x10d0
jmp 0x231d
leaq 0x185d(%rip), %rdi      # 0x3120
callq 0x1130
testq %rax, %rax
je 0x18de
leaq 0x1858(%rip), %rsi      # 0x312c
movq %rax, %rdi
callq 0x1110
jmp 0x18e0
xorl %eax, %eax
movq %rax, 0xa8(%rsp)
movq %rbx, 0xb0(%rsp)
movq %r15, 0xa0(%rsp)
movq %r14, 0xb8(%rsp)
movl %ebp, 0x58(%rsp)
leaq 0x158(%rsp), %rax
xorl %ecx, %ecx
xorl %edx, %edx
leaq (%rax,%rdx), %rsi
movl $0x0, 0x158(%rsp,%rdx)
movq %rcx, 0x160(%rsp,%rdx)
movq %rsi, 0x168(%rsp,%rdx)
movq %rsi, 0x170(%rsp,%rdx)
movq %rcx, 0x178(%rsp,%rdx)
addq $0x30, %rdx
cmpq $0xcc30, %rdx           # imm = 0xCC30
jne 0x1910
cmpl $0x0, 0xc(%rsp)
jle 0x19ec
leaq 0x100(%rsp), %rbp
leaq 0x40(%rsp), %r12
xorl %eax, %eax
movl %eax, 0x18(%rsp)
movl $0x8, %ebx
xorl %r14d, %r14d
movq 0xb8(%rsp), %r13
leaq 0x17fb(%rip), %r15      # 0x317c
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x11b0
shlq $0x8, %r14
orq 0x100(%rsp), %r14
decl %ebx
jne 0x1981
leaq 0x150(%rsp), %r13
xorl %ebx, %ebx
leaq 0x373e(%rip), %r15      # 0x50f0
movq (%rbx,%r15), %rax
andq %r14, %rax
movq %rax, 0x40(%rsp)
movq %r13, %rdi
movq %r12, %rsi
callq 0x24fa
incl (%rax)
addq $0x8, %rbx
addq $0x30, %r13
cmpq $0x2208, %rbx           # imm = 0x2208
jne 0x19b2
movl 0x18(%rsp), %eax
incl %eax
cmpl 0xc(%rsp), %eax
jl 0x1966
xorpd %xmm0, %xmm0
leaq 0x40(%rsp), %rbx
movapd %xmm0, (%rbx)
xorl %r15d, %r15d
movq %r15, 0x10(%rbx)
leaq 0xe0(%rsp), %rax
movq %r15, 0x10(%rax)
movapd %xmm0, (%rax)
leaq 0x150(%rsp), %r13
leaq 0x100(%rsp), %rbp
leaq (%r15,%r15,2), %rax
shlq $0x4, %rax
leaq (%rsp,%rax), %r14
addq $0x158, %r14            # imm = 0x158
movq 0x10(%r14), %r12
cmpq %r14, %r12
je 0x1afb
movl 0x28(%r12), %eax
cmpl 0x10(%rsp), %eax
jl 0x1ae7
movq 0x20(%r12), %rdx
movq %r13, %rdi
movq %rbx, %rsi
movl %r15d, %ecx
callq 0x1320
cmpl 0x10(%rsp), %eax
jl 0x1ae7
movl %r15d, 0x100(%rsp)
movq 0x20(%r12), %rax
movq %rax, 0x108(%rsp)
movq 0x48(%rsp), %rsi
cmpq 0x50(%rsp), %rsi
je 0x1a9e
movupd 0x100(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x48(%rsp)
jmp 0x1aa9
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x25d0
movl 0x28(%r12), %eax
movl %eax, 0x100(%rsp)
movq 0xe8(%rsp), %rsi
cmpq 0xf0(%rsp), %rsi
je 0x1ad7
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xe8(%rsp)
jmp 0x1ae7
leaq 0xe0(%rsp), %rdi
movq %rbp, %rdx
callq 0x28d8
movq %r12, %rdi
callq 0x1100
movq %rax, %r12
cmpq %r14, %rax
jne 0x1a40
incq %r15
cmpq $0x441, %r15            # imm = 0x441
jne 0x1a20
movq 0xb0(%rsp), %r13
testq %r13, %r13
je 0x1c1b
movq 0x48(%rsp), %rdx
subq 0x40(%rsp), %rdx
shrq $0x4, %rdx
leaq 0x1679(%rip), %rsi      # 0x31aa
movq %r13, %rdi
xorl %eax, %eax
callq 0x1160
movq 0x40(%rsp), %r14
cmpq 0x48(%rsp), %r14
je 0x1c1b
movq 0xe0(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0xff, %ebp
leaq 0x14cc(%rip), %r15      # 0x3030
xorl %ebx, %ebx
leaq (%r14,%rbx,4), %r12
addq $0x10, %r12
movl -0x10(%r12), %edx
movq %r13, %rdi
leaq 0x14bf(%rip), %rsi      # 0x303c
xorl %eax, %eax
callq 0x1160
movq -0x8(%r12), %r8
movq %r8, %r9
shrq $0x20, %r9
movq %r8, %rdx
shrq $0x38, %rdx
movq %r8, %rcx
shrq $0x30, %rcx
andl %ebp, %ecx
shrq $0x28, %r8
andl %ebp, %r8d
andl %ebp, %r9d
movq %r13, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1160
movl $0x20, %edi
movq %r13, %rsi
callq 0x1140
movl -0x8(%r12), %r9d
movl %r9d, %edx
shrl $0x18, %edx
movl %r9d, %ecx
shrl $0x10, %ecx
andl %ebp, %ecx
movl %r9d, %r8d
shrl $0x8, %r8d
andl %ebp, %r8d
andl %ebp, %r9d
movq %r13, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1160
movq 0x18(%rsp), %rax
movl (%rax,%rbx), %ecx
movq %r13, %rdi
leaq 0x15a3(%rip), %rsi      # 0x31a6
movl %ecx, %edx
xorl %eax, %eax
callq 0x1160
addq $0x4, %rbx
cmpq 0x48(%rsp), %r12
jne 0x1b66
cmpl $0x5, 0x58(%rsp)
setl %al
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
movq 0xa0(%rsp), %rax
jne 0x1c74
movq (%rax), %rdx
movl 0xc(%rsp), %ecx
movl 0x14(%rsp), %r8d
movl 0x10(%rsp), %r9d
movq 0x48(%rsp), %r10
subq 0x40(%rsp), %r10
shrq $0x4, %r10
subq $0x8, %rsp
leaq 0x14c7(%rip), %rsi      # 0x312e
xorl %eax, %eax
pushq %r10
callq 0x1160
addq $0x10, %rsp
xorpd %xmm0, %xmm0
movapd %xmm0, 0x80(%rsp)
xorl %eax, %eax
movq %rax, 0x90(%rsp)
leaq 0x108(%rsp), %rcx
movl $0x0, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
cmpl $0x0, 0x2c(%rsp)
jle 0x1fca
movapd 0x1364(%rip), %xmm0     # 0x3020
xorl %eax, %eax
movq $0x0, 0x60(%rsp)
movl %eax, 0x18(%rsp)
movapd %xmm0, 0x130(%rsp)
movq 0x38(%rsp), %r14
movq %r14, %rdi
leaq 0x1356(%rip), %rsi      # 0x3039
leaq 0x28(%rsp), %rdx
xorl %eax, %eax
callq 0x11b0
movq $0x0, 0x20(%rsp)
movq %r14, %rdi
leaq 0x146b(%rip), %r15      # 0x316d
movq %r15, %rsi
leaq 0xd8(%rsp), %rbp
movq %rbp, %rdx
leaq 0xd0(%rsp), %r13
movq %r13, %rcx
leaq 0xc8(%rsp), %r12
movq %r12, %r8
leaq 0xc0(%rsp), %rbx
movq %rbx, %r9
xorl %eax, %eax
callq 0x11b0
movq 0x20(%rsp), %rax
movq 0xd8(%rsp), %rcx
shlq $0x8, %rcx
shlq $0x10, %rax
orq %rcx, %rax
orq 0xd0(%rsp), %rax
movq 0xc8(%rsp), %rcx
shlq $0x10, %rax
shlq $0x8, %rcx
orq %rax, %rcx
orq 0xc0(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r13, %rcx
movq %r12, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x11b0
movq 0x20(%rsp), %rax
movq 0xd8(%rsp), %rcx
shlq $0x8, %rcx
shlq $0x10, %rax
orq %rcx, %rax
orq 0xd0(%rsp), %rax
movq 0xc8(%rsp), %rcx
shlq $0x10, %rax
shlq $0x8, %rcx
orq %rax, %rcx
orq 0xc0(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq %r14, %rdi
leaq 0x13a6(%rip), %rsi      # 0x3181
leaq 0x34(%rsp), %rdx
leaq 0x30(%rsp), %rcx
xorl %eax, %eax
callq 0x11b0
movslq 0x28(%rsp), %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rsp,%rax), %rdi
addq $0x150, %rdi            # imm = 0x150
leaq 0x20(%rsp), %rsi
callq 0x24fa
movl (%rax), %r15d
movl 0x34(%rsp), %ecx
movl 0xc(%rsp), %eax
cltd
idivl 0x14(%rsp)
subl %eax, %ecx
cmpl %ecx, %r15d
jl 0x1e32
addl 0x30(%rsp), %eax
cmpl %eax, %r15d
jle 0x1f02
movq 0x60(%rsp), %rax
incl %eax
movq %rax, 0x60(%rsp)
leaq 0x1341(%rip), %rdi      # 0x3186
callq 0x1130
testq %rax, %rax
leaq 0x68(%rsp), %r12
jne 0x1f07
movl 0x28(%rsp), %esi
leaq 0x132e(%rip), %rdi      # 0x3191
xorl %eax, %eax
callq 0x1030
movq 0x20(%rsp), %r8
movq %r8, %r9
shrq $0x20, %r9
movq 0x3153(%rip), %rbx      # 0x4fd0
movq (%rbx), %rdi
movq %r8, %rdx
shrq $0x38, %rdx
movq %r8, %rcx
shrq $0x30, %rcx
movl $0xff, %ebp
andl %ebp, %ecx
shrq $0x28, %r8
andl %ebp, %r8d
andl %ebp, %r9d
leaq 0x118a(%rip), %r14      # 0x3030
movq %r14, %rsi
xorl %eax, %eax
callq 0x1160
movl $0x20, %edi
callq 0x1150
movl 0x20(%rsp), %r9d
movq (%rbx), %rdi
movl %r9d, %edx
shrl $0x18, %edx
movl %r9d, %ecx
shrl $0x10, %ecx
andl %ebp, %ecx
movl %r9d, %r8d
shrl $0x8, %r8d
andl %ebp, %r8d
andl %ebp, %r9d
movq %r14, %rsi
xorl %eax, %eax
callq 0x1160
movl 0x34(%rsp), %edx
movl 0x30(%rsp), %ecx
leaq 0x12ab(%rip), %rdi      # 0x31a1
movl %r15d, %esi
xorl %eax, %eax
callq 0x1030
jmp 0x1f07
leaq 0x68(%rsp), %r12
movl 0x30(%rsp), %r14d
subl 0x34(%rsp), %r14d
movss 0xc(%rsp), %xmm0
movaps %xmm0, 0x140(%rsp)
movl 0x28(%rsp), %eax
movl %eax, 0x68(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x88(%rsp), %rsi
cmpq 0x90(%rsp), %rsi
je 0x1f56
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x88(%rsp)
jmp 0x1f66
leaq 0x80(%rsp), %rdi
movq %r12, %rdx
callq 0x25d0
movl 0x28(%rsp), %eax
movl %eax, 0x68(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x100(%rsp), %rdi
movq %r12, %rsi
callq 0x2a10
movl 0x18(%rsp), %eax
cvtsi2sd %r14d, %xmm1
movd %r15d, %xmm0
movdqa 0x140(%rsp), %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
cvtdq2pd %xmm2, %xmm0
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
divpd %xmm0, %xmm1
maxpd 0x130(%rsp), %xmm1
incl %eax
movapd %xmm1, %xmm0
cmpl 0x2c(%rsp), %eax
jl 0x1cc7
jmp 0x1fdb
movapd 0x104e(%rip), %xmm1     # 0x3020
movq $0x0, 0x60(%rsp)
movapd %xmm1, 0x130(%rsp)
leaq 0x150(%rsp), %r12
leaq 0x80(%rsp), %r13
xorl %ebx, %ebx
movq $0x0, 0x18(%rsp)
leaq (%rbx,%rbx,2), %rax
shlq $0x4, %rax
leaq (%rsp,%rax), %r14
addq $0x158, %r14            # imm = 0x158
movq 0x10(%r14), %rbp
cmpq %r14, %rbp
je 0x211b
movl 0x28(%rbp), %eax
cmpl 0x10(%rsp), %eax
jl 0x2107
movq 0x20(%rbp), %rdx
movq %r12, %rdi
movq %r13, %rsi
movl %ebx, %ecx
callq 0x1320
cmpl 0x10(%rsp), %eax
jl 0x2107
movl 0x20(%rbp), %eax
movl %eax, 0x68(%rsp)
movq %rbx, 0x70(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x2b68
leaq 0x108(%rsp), %rcx
cmpq %rcx, %rax
jne 0x2107
movq 0x18(%rsp), %rax
incl %eax
movq %rax, 0x18(%rsp)
leaq 0x10fd(%rip), %rdi      # 0x3186
callq 0x1130
testq %rax, %rax
jne 0x2107
leaq 0x1114(%rip), %rdi      # 0x31ae
movl %ebx, %esi
xorl %eax, %eax
callq 0x1030
movl 0x20(%rbp), %r9d
movq 0x2f22(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
movl %r9d, %edx
shrl $0x18, %edx
movl %r9d, %ecx
shrl $0x10, %ecx
movl $0xff, %eax
andl %eax, %ecx
movl %r9d, %r8d
shrl $0x8, %r8d
andl %eax, %r8d
andl %eax, %r9d
leaq 0xf58(%rip), %rsi       # 0x3030
xorl %eax, %eax
callq 0x1160
movl 0x28(%rbp), %r15d
movq 0x20(%rbp), %rdx
movq %r12, %rdi
movq %r13, %rsi
movl %ebx, %ecx
callq 0x1320
leaq 0x10c3(%rip), %rdi      # 0x31be
movl %r15d, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x1030
movq %rbp, %rdi
callq 0x1100
movq %rax, %rbp
cmpq %r14, %rax
jne 0x201f
incq %rbx
cmpq $0x441, %rbx            # imm = 0x441
jne 0x1fff
movq 0xa8(%rsp), %r12
testq %r12, %r12
movq 0x60(%rsp), %r13
movq 0x18(%rsp), %rbp
je 0x217c
leal (%rbp,%r13), %eax
testl %eax, %eax
jle 0x217c
movq 0xa0(%rsp), %rax
movq (%rax), %rdx
movl 0xc(%rsp), %ecx
movl 0x14(%rsp), %r8d
movl 0x10(%rsp), %r9d
leaq 0x105d(%rip), %rsi      # 0x31c8
movq %r12, %rdi
xorl %eax, %eax
pushq %rbp
pushq %r13
callq 0x1160
addq $0x10, %rsp
testq %r12, %r12
sete %al
movl 0x58(%rsp), %ebx
cmpl $0x5, %ebx
setge %cl
orb %al, %cl
movq 0xb8(%rsp), %r14
movq 0xb0(%rsp), %r15
jne 0x21f9
movq 0x78(%rsp), %rdx
movl 0xc(%rsp), %ecx
movl 0x14(%rsp), %r8d
movl 0x10(%rsp), %r9d
movl 0x2c(%rsp), %r10d
movq 0x48(%rsp), %r11
subq 0x40(%rsp), %r11
shrq $0x4, %r11
xorps %xmm0, %xmm0
cvtss2sd 0x5c(%rsp), %xmm0
movapd 0x130(%rsp), %xmm2
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
leaq 0x1033(%rip), %rsi      # 0x321a
movq %r12, %rdi
movb $0x3, %al
pushq %r11
pushq %r10
callq 0x1160
addq $0x10, %rsp
testq %r15, %r15
je 0x2206
movq %r15, %rdi
callq 0x10d0
testq %r12, %r12
je 0x2213
movq %r12, %rdi
callq 0x10d0
movq %r14, %rdi
callq 0x10d0
movq 0x38(%rsp), %rdi
callq 0x10d0
cmpl $0x4, %ebx
jg 0x2234
movq 0x78(%rsp), %rdi
callq 0x1120
movq 0x48(%rsp), %rcx
subq 0x40(%rsp), %rcx
shrq $0x4, %rcx
leaq 0x1058(%rip), %rdi      # 0x32a1
movl %r13d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x1030
leaq 0x100(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x259a
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x2278
callq 0x10c0
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x228a
callq 0x10c0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x2299
callq 0x10c0
xorl %r14d, %r14d
leaq (%rsp,%r14), %rdi
addq $0xcd50, %rdi           # imm = 0xCD50
movq 0x10(%rdi), %rsi
callq 0x2564
addq $-0x30, %r14
cmpq $-0xcc30, %r14          # imm = 0xFFFF33D0
jne 0x229c
jmp 0x231d
movq (%r15), %rsi
leaq 0xdda(%rip), %rdi       # 0x30a3
xorl %eax, %eax
callq 0x1030
movq (%r15), %rsi
leaq 0xdfa(%rip), %rdi       # 0x30d4
xorl %eax, %eax
callq 0x1030
leaq 0xffc(%rip), %rdi       # 0x32e4
callq 0x1170
leaq 0x1008(%rip), %rdi      # 0x32fc
callq 0x1170
leaq 0x1012(%rip), %rdi      # 0x3312
callq 0x1170
leaq 0x1023(%rip), %rdi      # 0x332f
callq 0x1170
leaq 0x1042(%rip), %rdi      # 0x335a
callq 0x1170
xorl %eax, %eax
addq $0xcd88, %rsp           # imm = 0xCD88
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x239b
jmp 0x2387
jmp 0x2387
jmp 0x2387
movq %rax, %rbx
movq %r14, %r15
subq $-0xcc00, %r15          # imm = 0xFFFF3400
je 0x23fa
negq %r15
addq %rsp, %r14
addq $0xcd20, %r14           # imm = 0xCD20
movq 0x10(%r14), %rsi
movq %r14, %rdi
callq 0x2564
addq $-0x30, %r14
addq $0x30, %r15
jne 0x235c
jmp 0x23fa
jmp 0x2402
jmp 0x2382
jmp 0x2382
jmp 0x2387
movq %rax, %rbx
jmp 0x23ad
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x259a
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x23ad
callq 0x10c0
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x23bf
callq 0x10c0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x23d5
callq 0x10c0
jmp 0x23d5
jmp 0x2402
movq %rax, %rbx
movq $-0xcc30, %r15          # imm = 0xFFFF33D0
leaq 0xcd50(%rsp), %r14
movq 0x10(%r14), %rsi
movq %r14, %rdi
callq 0x2564
addq $-0x30, %r14
addq $0x30, %r15
jne 0x23e4
movq %rbx, %rdi
callq 0x11a0
movq %rax, %rdi
callq 0x24ef