// File: tplinderoth[P]introDist/introDist.cpp
// Function: comp2DistReg(std::basic_fstream<char, std::char_traits<char>>&, std::basic_fstream<char, std::char_traits<char>>&, unsigned int, unsigned int)
int comp2DistReg (std::fstream &freqfile, std::fstream &genofile, unsigned int window, unsigned int step) {

	/*
	 * this calculates the difference in the genetic distance between individual i and population2
	 * and the expected distance between individual i's population and population2 in a region
	 *
	 * D = d_R(i, P2) - d_R(Pi, P2)
	 * subscript R denotes average across region
	 *
	 * at site s:
	 * expected distance between individual i and population 2: E[d(i, P2)] = |g_i - E[g_p2]|/2
	 * expected difference between the distance of individuals i's population and population 2: d(Pi, P2) = |E[g_p1] - E[g_p2]|/2
	 *
	 * d_R(Pi, P2) = 1/N_R * sum_from=1_to=N_R |E[g_p1] - E[g_p2]|/2, where N_R is total number of sites in the window
	 *
	 * d_R(i, P2) = 1/N_R * sum_from=1_to=N_R |g_i - E[g_p2]|/2, where N_R is the number of sites in the window
	 *
	 * assumes individual i is from population 1
	 *
	 */

	std::vector<sitedist> dist;
	dist.resize(window);
	std::vector<sitedist>::iterator distiter = dist.begin();
	unsigned int lastidx = window-1;
	unsigned int nsites = 0;
	unsigned int dr_nsites = 0;
	double windD = 0.0;
	unsigned int midpoint = 0;
	unsigned int i = 0;
	unsigned int n = window-step;

	std::stringstream ss;

	std::string(fline);
	std::string(fchr);
	unsigned int fpos;
	double p1f;
	double p2f;

	std::string(gline);
	std::string(gchr);
	unsigned int gpos;
	int geno;

	getline(freqfile, fline);
	getline(genofile, gline);

	// calculate windows
	while (!fline.empty()) {

		// parse frequency file lines
		ss.str(std::string());
		ss.clear();
		ss.str(fline);
		ss >> fchr >> fpos >> p1f >> p2f;

		// parse genotype file lines
		ss.str(std::string());
		ss.clear();
		ss.str(gline);
		ss >> gchr >> gpos >> geno;

		// ensure that files are synched
		if (gchr.compare(fchr) != 0 || gpos != fpos) {
			std::cerr << "Positions in input files differ\n";
			return -1;
		}

		// update window
		distiter->first=gpos;
		distiter->second = geno < 0 ? -3.0 : expectIndPopDist(geno, p2f) - expect2PopDist(p1f, p2f);
		++distiter;
		++nsites;

		if (distiter == dist.end()) {

			// calculate window value
			windD = 0.0;
			dr_nsites = 0;
			for (distiter = dist.begin(); distiter != dist.end(); ++distiter) {
				if (distiter->second < -2.0) continue;
				windD += distiter->second;
				++dr_nsites;
			}
			if (dr_nsites > 0) {
				windD /= (double)dr_nsites;
			} else {
				std::cerr << "Warning: window " << gchr << " " << dist[0].first << "," << dist[lastidx].first << " has no sites with data\n";
			}
			midpoint = (dist[0].first + dist[lastidx].first)/2;
			std::cout << gchr << "\t" << dist[0].first << "\t" << dist[lastidx].first << "\t" << midpoint << "\t" << windD << "\t" << dr_nsites << "\n";

			// prepare vector for new values
			for (i = 0; i < n; ++i) {
				dist[i].first = dist[step+i].first;
				dist[i].second = dist[step+i].second;
			}

			nsites = n;
			distiter = dist.begin() + n;
		}

		getline(freqfile, fline);
		getline(genofile, gline);
	}

	// print last window
	if (nsites > n && nsites < window) {
		unsigned int lastwinidx = nsites-1;
		dr_nsites = 0;
		windD = 0.0;
		for (i=0; i < lastwinidx; ++i) {
			if (dist[i].second < -2.0) continue;
			windD += dist[i].second;
			++dr_nsites;
		}
		if (dr_nsites > 0) {
			windD /= (double)dr_nsites;
		} else {
			std::cerr << "Warning: window " << gchr << " " << dist[0].first << "," << dist[lastwinidx].first << " has no sites with data\n";
		}
		midpoint = (dist[0].first + dist[lastwinidx].first)/2;
		std::cout << gchr << "\t" << dist[0].first << "\t" << dist[lastwinidx].first << "\t" << midpoint << "\t" << windD << "\t" << dr_nsites << "\n";
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4d0, %rsp            # imm = 0x4D0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x9240
movq -0x320(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x9260
jmp 0x647c
leaq -0x38(%rbp), %rdi
callq 0x92f0
movq %rax, -0x50(%rbp)
movl -0x1c(%rbp), %eax
decl %eax
movl %eax, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
movq $0x0, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
movl -0x1c(%rbp), %eax
movl -0x20(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x74(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x31f0
jmp 0x64ce
leaq -0x220(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x33d0
leaq -0x240(%rbp), %rdi
callq 0x33d0
leaq -0x278(%rbp), %rdi
callq 0x33d0
leaq -0x298(%rbp), %rdi
callq 0x33d0
movq -0x328(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x30b0
jmp 0x6517
movq -0x18(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x30b0
jmp 0x6529
jmp 0x652b
leaq -0x220(%rbp), %rdi
callq 0x3470
xorb $-0x1, %al
testb $0x1, %al
jne 0x6542
jmp 0x6c72
leaq -0x2c0(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x33d0
movq -0x330(%rbp), %rsi
leaq -0x200(%rbp), %rdi
callq 0x3340
jmp 0x656a
leaq -0x2c0(%rbp), %rdi
callq 0x31b0
movq -0x200(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x200(%rbp,%rax), %rdi
xorl %esi, %esi
callq 0x3480
jmp 0x6592
leaq -0x200(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x3340
jmp 0x65a7
leaq -0x200(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x33a0
movq %rax, -0x338(%rbp)
jmp 0x65c3
movq -0x338(%rbp), %rdi
leaq -0x244(%rbp), %rsi
callq 0x3060
movq %rax, -0x340(%rbp)
jmp 0x65df
movq -0x340(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x3250
movq %rax, -0x348(%rbp)
jmp 0x65fb
movq -0x348(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x3250
jmp 0x6610
leaq -0x2e0(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x33d0
movq -0x350(%rbp), %rsi
leaq -0x200(%rbp), %rdi
callq 0x3340
jmp 0x6638
leaq -0x2e0(%rbp), %rdi
callq 0x31b0
movq -0x200(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x200(%rbp,%rax), %rdi
xorl %esi, %esi
callq 0x3480
jmp 0x6660
leaq -0x200(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x3340
jmp 0x6675
leaq -0x200(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x33a0
movq %rax, -0x358(%rbp)
jmp 0x6691
movq -0x358(%rbp), %rdi
leaq -0x29c(%rbp), %rsi
callq 0x3060
movq %rax, -0x360(%rbp)
jmp 0x66ad
movq -0x360(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x31a0
jmp 0x66c2
leaq -0x298(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x3040
movl %eax, -0x364(%rbp)
jmp 0x66dd
movl -0x364(%rbp), %eax
cmpl $0x0, %eax
jne 0x66fa
movl -0x29c(%rbp), %eax
cmpl -0x244(%rbp), %eax
je 0x6781
movq 0xe8ef(%rip), %rdi      # 0x14ff0
leaq 0x8c89(%rip), %rsi      # 0xf391
callq 0x32c0
jmp 0x670f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x2e4(%rbp)
jmp 0x6fa3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7030
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6ff4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x31b0
jmp 0x6ff4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x31b0
jmp 0x6ff4
movl -0x29c(%rbp), %eax
movl %eax, -0x368(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x9460
movl -0x368(%rbp), %ecx
movl %ecx, (%rax)
cmpl $0x0, -0x2a0(%rbp)
jge 0x67b9
movsd 0x8879(%rip), %xmm0     # 0xf028
movsd %xmm0, -0x370(%rbp)
jmp 0x6813
cvtsi2sdl -0x2a0(%rbp), %xmm0
movsd -0x258(%rbp), %xmm1
callq 0x63d0
movsd %xmm0, -0x378(%rbp)
jmp 0x67d8
movsd -0x250(%rbp), %xmm0
movsd -0x258(%rbp), %xmm1
callq 0x6320
movsd %xmm0, -0x380(%rbp)
jmp 0x67f7
movsd -0x380(%rbp), %xmm1
movsd -0x378(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x370(%rbp)
movsd -0x370(%rbp), %xmm0
movsd %xmm0, -0x388(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x9460
movsd -0x388(%rbp), %xmm0
movsd %xmm0, 0x8(%rax)
leaq -0x50(%rbp), %rdi
callq 0x9480
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x94e0
movq %rax, -0x2f0(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x94a0
testb $0x1, %al
jne 0x6874
jmp 0x6c49
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movl $0x0, -0x5c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x92f0
movq %rax, -0x2f8(%rbp)
movq -0x2f8(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x94e0
movq %rax, -0x300(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x9510
testb $0x1, %al
jne 0x68c4
jmp 0x690a
leaq -0x50(%rbp), %rdi
callq 0x9460
movsd 0x874b(%rip), %xmm0     # 0xf020
ucomisd 0x8(%rax), %xmm0
jbe 0x68de
jmp 0x68ff
leaq -0x50(%rbp), %rdi
callq 0x9460
movsd 0x8(%rax), %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x9480
jmp 0x689e
cmpl $0x0, -0x5c(%rbp)
jbe 0x692b
movl -0x5c(%rbp), %eax
cvtsi2sd %rax, %xmm1
movsd -0x68(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
jmp 0x69fb
movq 0xe6be(%rip), %rdi      # 0x14ff0
leaq 0x8b52(%rip), %rsi      # 0xf48b
callq 0x32c0
movq %rax, -0x390(%rbp)
jmp 0x6947
movq -0x390(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x3280
movq %rax, -0x398(%rbp)
jmp 0x6963
movq -0x398(%rbp), %rdi
leaq 0x92c0(%rip), %rsi      # 0xfc31
callq 0x32c0
movq %rax, -0x3a0(%rbp)
jmp 0x697f
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movq -0x3a0(%rbp), %rdi
movl (%rax), %esi
callq 0x33b0
movq %rax, -0x3a8(%rbp)
jmp 0x69a3
movq -0x3a8(%rbp), %rdi
leaq 0x8aeb(%rip), %rsi      # 0xf49c
callq 0x32c0
movq %rax, -0x3b0(%rbp)
jmp 0x69bf
movl -0x54(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movq -0x3b0(%rbp), %rdi
movl (%rax), %esi
callq 0x33b0
movq %rax, -0x3b8(%rbp)
jmp 0x69e4
movq -0x3b8(%rbp), %rdi
leaq 0x8aac(%rip), %rsi      # 0xf49e
callq 0x32c0
jmp 0x69f9
jmp 0x69fb
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x9550
movq -0x3d0(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x3c4(%rbp)
movl -0x54(%rbp), %eax
movl %eax, %esi
callq 0x9550
movq %rax, %rcx
movl -0x3c4(%rbp), %eax
movl (%rcx), %ecx
addl %ecx, %eax
shrl %eax
movl %eax, -0x6c(%rbp)
movq 0xe587(%rip), %rdi      # 0x14fc8
leaq -0x298(%rbp), %rsi
callq 0x3280
movq %rax, -0x3c0(%rbp)
jmp 0x6a56
movq -0x3c0(%rbp), %rdi
leaq 0x88bf(%rip), %rsi      # 0xf323
callq 0x32c0
movq %rax, -0x3d8(%rbp)
jmp 0x6a72
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movq -0x3d8(%rbp), %rdi
movl (%rax), %esi
callq 0x33b0
movq %rax, -0x3e0(%rbp)
jmp 0x6a96
movq -0x3e0(%rbp), %rdi
leaq 0x887f(%rip), %rsi      # 0xf323
callq 0x32c0
movq %rax, -0x3e8(%rbp)
jmp 0x6ab2
movl -0x54(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movq -0x3e8(%rbp), %rdi
movl (%rax), %esi
callq 0x33b0
movq %rax, -0x3f0(%rbp)
jmp 0x6ad7
movq -0x3f0(%rbp), %rdi
leaq 0x883e(%rip), %rsi      # 0xf323
callq 0x32c0
movq %rax, -0x3f8(%rbp)
jmp 0x6af3
movq -0x3f8(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x33b0
movq %rax, -0x400(%rbp)
jmp 0x6b0b
movq -0x400(%rbp), %rdi
leaq 0x880a(%rip), %rsi      # 0xf323
callq 0x32c0
movq %rax, -0x408(%rbp)
jmp 0x6b27
movq -0x408(%rbp), %rdi
movsd -0x68(%rbp), %xmm0
callq 0x3530
movq %rax, -0x410(%rbp)
jmp 0x6b41
movq -0x410(%rbp), %rdi
leaq 0x87d4(%rip), %rsi      # 0xf323
callq 0x32c0
movq %rax, -0x418(%rbp)
jmp 0x6b5d
movq -0x418(%rbp), %rdi
movl -0x5c(%rbp), %esi
callq 0x33b0
movq %rax, -0x420(%rbp)
jmp 0x6b75
movq -0x420(%rbp), %rdi
leaq 0x9069(%rip), %rsi      # 0xfbec
callq 0x32c0
jmp 0x6b8a
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x74(%rbp), %eax
jae 0x6c10
movl -0x20(%rbp), %eax
addl -0x70(%rbp), %eax
movl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movl (%rax), %eax
movl %eax, -0x42c(%rbp)
movl -0x70(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movl -0x42c(%rbp), %ecx
movl %ecx, (%rax)
movl -0x20(%rbp), %eax
addl -0x70(%rbp), %eax
movl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x428(%rbp)
movl -0x70(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movsd -0x428(%rbp), %xmm0
movsd %xmm0, 0x8(%rax)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x6b91
movl -0x74(%rbp), %eax
movl %eax, -0x58(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x92f0
movq %rax, -0x310(%rbp)
movl -0x74(%rbp), %eax
movl %eax, %esi
leaq -0x310(%rbp), %rdi
callq 0x95a0
movq %rax, -0x308(%rbp)
movq -0x308(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x30b0
jmp 0x6c5b
movq -0x18(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x30b0
jmp 0x6c6d
jmp 0x652b
movl -0x58(%rbp), %eax
cmpl -0x74(%rbp), %eax
jbe 0x6f92
movl -0x58(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x6f92
movl -0x58(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x314(%rbp)
movl $0x0, -0x5c(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x314(%rbp), %eax
jae 0x6d07
movl -0x70(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movsd 0x8353(%rip), %xmm0     # 0xf020
ucomisd 0x8(%rax), %xmm0
jbe 0x6cd6
jmp 0x6cfc
movl -0x70(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movsd 0x8(%rax), %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x6cac
cmpl $0x0, -0x5c(%rbp)
jbe 0x6d28
movl -0x5c(%rbp), %eax
cvtsi2sd %rax, %xmm1
movsd -0x68(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
jmp 0x6dfb
movq 0xe2c1(%rip), %rdi      # 0x14ff0
leaq 0x8755(%rip), %rsi      # 0xf48b
callq 0x32c0
movq %rax, -0x438(%rbp)
jmp 0x6d44
movq -0x438(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x3280
movq %rax, -0x440(%rbp)
jmp 0x6d60
movq -0x440(%rbp), %rdi
leaq 0x8ec3(%rip), %rsi      # 0xfc31
callq 0x32c0
movq %rax, -0x448(%rbp)
jmp 0x6d7c
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movq -0x448(%rbp), %rdi
movl (%rax), %esi
callq 0x33b0
movq %rax, -0x450(%rbp)
jmp 0x6da0
movq -0x450(%rbp), %rdi
leaq 0x86ee(%rip), %rsi      # 0xf49c
callq 0x32c0
movq %rax, -0x458(%rbp)
jmp 0x6dbc
movl -0x314(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movq -0x458(%rbp), %rdi
movl (%rax), %esi
callq 0x33b0
movq %rax, -0x460(%rbp)
jmp 0x6de4
movq -0x460(%rbp), %rdi
leaq 0x86ac(%rip), %rsi      # 0xf49e
callq 0x32c0
jmp 0x6df9
jmp 0x6dfb
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x478(%rbp)
callq 0x9550
movq -0x478(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x46c(%rbp)
movl -0x314(%rbp), %eax
movl %eax, %esi
callq 0x9550
movq %rax, %rcx
movl -0x46c(%rbp), %eax
movl (%rcx), %ecx
addl %ecx, %eax
shrl %eax
movl %eax, -0x6c(%rbp)
movq 0xe184(%rip), %rdi      # 0x14fc8
leaq -0x298(%rbp), %rsi
callq 0x3280
movq %rax, -0x468(%rbp)
jmp 0x6e59
movq -0x468(%rbp), %rdi
leaq 0x84bc(%rip), %rsi      # 0xf323
callq 0x32c0
movq %rax, -0x480(%rbp)
jmp 0x6e75
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movq -0x480(%rbp), %rdi
movl (%rax), %esi
callq 0x33b0
movq %rax, -0x488(%rbp)
jmp 0x6e99
movq -0x488(%rbp), %rdi
leaq 0x847c(%rip), %rsi      # 0xf323
callq 0x32c0
movq %rax, -0x490(%rbp)
jmp 0x6eb5
movl -0x314(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x9550
movq -0x490(%rbp), %rdi
movl (%rax), %esi
callq 0x33b0
movq %rax, -0x498(%rbp)
jmp 0x6edd
movq -0x498(%rbp), %rdi
leaq 0x8438(%rip), %rsi      # 0xf323
callq 0x32c0
movq %rax, -0x4a0(%rbp)
jmp 0x6ef9
movq -0x4a0(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x33b0
movq %rax, -0x4a8(%rbp)
jmp 0x6f11
movq -0x4a8(%rbp), %rdi
leaq 0x8404(%rip), %rsi      # 0xf323
callq 0x32c0
movq %rax, -0x4b0(%rbp)
jmp 0x6f2d
movq -0x4b0(%rbp), %rdi
movsd -0x68(%rbp), %xmm0
callq 0x3530
movq %rax, -0x4b8(%rbp)
jmp 0x6f47
movq -0x4b8(%rbp), %rdi
leaq 0x83ce(%rip), %rsi      # 0xf323
callq 0x32c0
movq %rax, -0x4c0(%rbp)
jmp 0x6f63
movq -0x4c0(%rbp), %rdi
movl -0x5c(%rbp), %esi
callq 0x33b0
movq %rax, -0x4c8(%rbp)
jmp 0x6f7b
movq -0x4c8(%rbp), %rdi
leaq 0x8c63(%rip), %rsi      # 0xfbec
callq 0x32c0
jmp 0x6f90
jmp 0x6f92
movl $0x0, -0x4(%rbp)
movl $0x1, -0x2e4(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x31b0
leaq -0x278(%rbp), %rdi
callq 0x31b0
leaq -0x240(%rbp), %rdi
callq 0x31b0
leaq -0x220(%rbp), %rdi
callq 0x31b0
leaq -0x200(%rbp), %rdi
callq 0x3210
leaq -0x38(%rbp), %rdi
callq 0x9720
movl -0x4(%rbp), %eax
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbp
retq
leaq -0x298(%rbp), %rdi
callq 0x31b0
leaq -0x278(%rbp), %rdi
callq 0x31b0
leaq -0x240(%rbp), %rdi
callq 0x31b0
leaq -0x220(%rbp), %rdi
callq 0x31b0
leaq -0x200(%rbp), %rdi
callq 0x3210
leaq -0x38(%rbp), %rdi
callq 0x9720
movq -0x40(%rbp), %rdi
callq 0x34c0
nopw %cs:(%rax,%rax)