// File: lrq3000[P]rfrb/./src/raidSystem.cpp
// Function: RaidSystem::easyCheck()
bool RaidSystem::easyCheck()
{
	//Initial buffer allocations
	char buf1[CHECKSIZE];
	char buf5[CHECKSIZE];
	char *checkAgainstMe;
	char *in;
	unsigned int raid1=0, raid5=0, misses=0;

	//Starting fileReader for each image
	std::vector<FileReader *> inFiles = handle->getInFiles();

	//Check if enough images are specified
	if(inFiles.size() < 2)
	{
		std::cout << "\tThere are too few devices for a Raid system." << std::endl;
		return false;
	}
	//Check if images are too broken
	if (handle->findGoodBlock() == false)
	{
		std::cerr << "\tNo valid readable block found! Disc too broken!" << std::endl;
		return false;
	}

	for (int j = 0; j < CHECKSIZE; ++j)
	{
		buf1[j] = 0;
	}

	std::cout << "\tTesting 1.5 million blocks to check if a valid Raid-version can be estimated." << std::endl;

	//Iterate over many blocks and trying to estimate the RAID-level
	for (size_t i = 0; i < inFiles.size(); ++i)
	{
		inFiles.at(i)->setBlockSize(CHECKSIZE);
	}
	std::cout << "| ";
	for (size_t count=0; count < 1500000; ++count)
	{
		if ((count%5000) == 0)
			std::cout << "* ";
		//Get a block from the first image
		checkAgainstMe = inFiles.at(0)->getBlock();
		int raid1_miss = 0;
		int raid1_hit = 0;
		for (int j = 0; j < CHECKSIZE; ++j)
		{
			buf5[j] = checkAgainstMe[j];
		}
		//Get blocks from the other images
		for (unsigned int j = 1; j < inFiles.size(); ++j)
		{
			in = inFiles.at(j)->getBlock();
			//Calculate XOR
			for (int x = 0; x < CHECKSIZE; ++x)
			{
				buf1[x] = checkAgainstMe[x]^in[x];
				buf5[x] = buf5[x]^in[x];
			}
			//If XOR is in buf1 is not zero, then we have no RAID1
			if (checkForNull(buf1, CHECKSIZE)==false)
			{
				++raid1_miss;
				for (int x = 0; x < CHECKSIZE; ++x)
				{
					buf1[x] = 0;
				}
			}
			else
			{
				++raid1_hit;
			}
		}
		if (raid1_miss == 0)
		{
			//Blocks are equal, we have a RAID1 hit
			++raid1;
		}
		//else if (checkForEqual(buf5,checkAgainstMe+startAdress,CHECKSIZE) == true)
		else if (checkForNull(buf5, CHECKSIZE)==true)
		{
			//block0 = block1 XOR block2 XOR ...
			//There is Parity information, that's why we assume RAID5
			++raid5;
		}
		else
		{
			++misses;
		}
		if (handle->findGoodBlock() == false)
		{
			std::cout << "\tCouldnt find enough testable blocks. Trying to estimate with heuristics." << std::endl;
			break;
		}
	}
	std::cout << std::endl;

	//Final outputs
	std::cout << "\tMirrored blocks:\t\t: " << std::setw(6) << raid1 << "\t(Raid1)"<< std::endl;
	std::cout << "\tBlocks with parity info\t\t: " << std::setw(6) << raid5 << "\t(Raid5)"<< std::endl;
	std::cout << "\tBlocks without relevant info\t: "       << std::setw(6) << misses << std::endl;
	handle->reset();

	//Trying to estimate the RAID-level from the results above
	if (raid1 > (misses+raid5)*1.5)
	{
		//Enough RAID1 hits to evaluate this to RAID1
		raidSystem = Raid1;
		std::cout << "Found a Raid 1 system." << std::endl;
		return true;
	}
	else if (raid5 > (misses+raid1)*1.5 && inFiles.size() >= 3)
	{
		//Enough RAID5 hits and enough images to evaluate this to RAID5
		raidSystem = Raid5_complete;
		std::cout << "Found a complete Raid 5 system." << std::endl;
		return true;
	}

	//See if you can find two identical partitiontables at the beginning of two images out of all.
	std::vector<char *> tables;
	for (unsigned int i = 0; i < inFiles.size(); ++i)
	{
		char *buf = inFiles.at(i)->getBlock();
		if (checkForNull(buf, 512)==false)
			tables.push_back(buf);
	}
	//If this can be found, it's RAID5 with one missing image (incomplete).
	if (tables.size() == 2)
	{
		if (checkForEqual(tables.at(0),tables.at(1),512)==true)
		{
			lostImages = 1;
			raidSystem = Raid5_incomplete;
			std::cout << "Found a mirrored partition table. Has to be an incomplete Raid 5 system." << std::endl;
			handle->reset();
			return true;
		}
	}
	//Otherwise it can still be RAID5-incomplete or RAID0
	if (raid1 < (100*misses/(inFiles.size()+1)) && (raid1+raid5) > 0.007*(float)misses)
	{
		//At this point it could only be RAID0 or RAID5.
		//There are enough hits for identical blocks and parity blocks => RAID5
		lostImages = 1;
		raidSystem = Raid5_incomplete;
		std::cout << "Some mirrored blocks and some parity blocks found. It's probably an incomplete Raid 5 system." << std::endl;
		handle->reset();
		return true;
	}
	else if (raid1 >= (100*misses/(inFiles.size()+1)))
	{
		//Still too much identical blocks found. This has to be RAID1
		raidSystem = Raid1;
		std::cout << "Above average mirrored blocks found. Has to be a Raid 1 system." << std::endl;
		return true;
	}
	else
	{
		//Now it can only be RAID0
		raidSystem = Raid0;
		std::cout << "Too few mirrored blocks or parity infos found. Has to be a Raid 0 system." << std::endl;
		return true;
	}
	return false;
}

// Assembly:
subq $0x628, %rsp            # imm = 0x628
movq %rdi, 0x618(%rsp)
movq 0x618(%rsp), %rax
movq %rax, 0x158(%rsp)
movl $0x0, 0x1fc(%rsp)
movl $0x0, 0x1f8(%rsp)
movl $0x0, 0x1f4(%rsp)
movq (%rax), %rdi
callq 0xcc90
movq %rax, %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x9c50
leaq 0x1d8(%rsp), %rdi
callq 0x9d50
cmpq $0x2, %rax
jae 0x7d5f
movq 0x4c2ae(%rip), %rdi     # 0x53fb0
leaq 0x3280d(%rip), %rsi     # 0x3a516
callq 0x6420
movq %rax, 0x150(%rsp)
jmp 0x7d18
movq 0x150(%rsp), %rdi
movq 0x4c249(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x7d2e
movb $0x0, 0x627(%rsp)
movl $0x1, 0x1c8(%rsp)
jmp 0x8975
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
jmp 0x8993
movq 0x158(%rsp), %rax
movq (%rax), %rdi
callq 0xcf50
movb %al, 0x14f(%rsp)
jmp 0x7d78
movb 0x14f(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x7dd4
movq 0x4c260(%rip), %rdi     # 0x53ff0
leaq 0x327ad(%rip), %rsi     # 0x3a544
callq 0x6420
movq %rax, 0x140(%rsp)
jmp 0x7da6
movq 0x140(%rsp), %rdi
movq 0x4c1bb(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x7dbc
movb $0x0, 0x627(%rsp)
movl $0x1, 0x1c8(%rsp)
jmp 0x8975
movl $0x0, 0x1c4(%rsp)
cmpl $0x200, 0x1c4(%rsp) # imm = 0x200
jge 0x7e0f
movslq 0x1c4(%rsp), %rax
movb $0x0, 0x410(%rsp,%rax)
movl 0x1c4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c4(%rsp)
jmp 0x7ddf
movq 0x4c19a(%rip), %rdi     # 0x53fb0
leaq 0x32758(%rip), %rsi     # 0x3a575
callq 0x6420
movq %rax, 0x138(%rsp)
jmp 0x7e2c
movq 0x138(%rsp), %rdi
movq 0x4c135(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x7e42
movq $0x0, 0x1b8(%rsp)
movq 0x1b8(%rsp), %rax
movq %rax, 0x130(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x9d50
movq %rax, %rcx
movq 0x130(%rsp), %rax
cmpq %rcx, %rax
jae 0x7ec9
movq 0x1b8(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x9d70
movq %rax, 0x128(%rsp)
jmp 0x7e9a
movq 0x128(%rsp), %rax
movq (%rax), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x2fed0
jmp 0x7eb1
jmp 0x7eb3
movq 0x1b8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x1b8(%rsp)
jmp 0x7e4e
movq 0x4c0e0(%rip), %rdi     # 0x53fb0
leaq 0x326ed(%rip), %rsi     # 0x3a5c4
callq 0x6420
jmp 0x7ede
movq $0x0, 0x1b0(%rsp)
cmpq $0x16e360, 0x1b0(%rsp) # imm = 0x16E360
jae 0x8278
movq 0x1b0(%rsp), %rax
movl $0x1388, %ecx           # imm = 0x1388
xorl %edx, %edx
divq %rcx
cmpq $0x0, %rdx
jne 0x7f2b
movq 0x4c095(%rip), %rdi     # 0x53fb0
leaq 0x326a5(%rip), %rsi     # 0x3a5c7
callq 0x6420
jmp 0x7f29
jmp 0x7f2b
xorl %eax, %eax
movl %eax, %esi
leaq 0x1d8(%rsp), %rdi
callq 0x9d70
movq %rax, 0x120(%rsp)
jmp 0x7f46
movq 0x120(%rsp), %rax
movq (%rax), %rdi
callq 0x2fc80
movq %rax, 0x118(%rsp)
jmp 0x7f60
movq 0x118(%rsp), %rax
movq %rax, 0x208(%rsp)
movl $0x0, 0x1ac(%rsp)
movl $0x0, 0x1a8(%rsp)
movl $0x0, 0x1a4(%rsp)
cmpl $0x200, 0x1a4(%rsp) # imm = 0x200
jge 0x7fd3
movq 0x208(%rsp), %rax
movslq 0x1a4(%rsp), %rcx
movb (%rax,%rcx), %cl
movslq 0x1a4(%rsp), %rax
movb %cl, 0x210(%rsp,%rax)
movl 0x1a4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a4(%rsp)
jmp 0x7f91
movl $0x1, 0x1a0(%rsp)
movl 0x1a0(%rsp), %eax
movq %rax, 0x110(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x9d50
movq %rax, %rcx
movq 0x110(%rsp), %rax
cmpq %rcx, %rax
jae 0x8197
movl 0x1a0(%rsp), %eax
movl %eax, %esi
leaq 0x1d8(%rsp), %rdi
callq 0x9d70
movq %rax, 0x108(%rsp)
jmp 0x802e
movq 0x108(%rsp), %rax
movq (%rax), %rdi
callq 0x2fc80
movq %rax, 0x100(%rsp)
jmp 0x8048
movq 0x100(%rsp), %rax
movq %rax, 0x200(%rsp)
movl $0x0, 0x19c(%rsp)
cmpl $0x200, 0x19c(%rsp) # imm = 0x200
jge 0x80fc
movq 0x208(%rsp), %rax
movslq 0x19c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
movq 0x200(%rsp), %rcx
movslq 0x19c(%rsp), %rdx
movsbl (%rcx,%rdx), %ecx
xorl %ecx, %eax
movb %al, %cl
movslq 0x19c(%rsp), %rax
movb %cl, 0x410(%rsp,%rax)
movslq 0x19c(%rsp), %rax
movsbl 0x210(%rsp,%rax), %eax
movq 0x200(%rsp), %rcx
movslq 0x19c(%rsp), %rdx
movsbl (%rcx,%rdx), %ecx
xorl %ecx, %eax
movb %al, %cl
movslq 0x19c(%rsp), %rax
movb %cl, 0x210(%rsp,%rax)
movl 0x19c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x19c(%rsp)
jmp 0x8063
movq 0x158(%rsp), %rdi
leaq 0x410(%rsp), %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x9ad0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x816e
movl 0x1ac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ac(%rsp)
movl $0x0, 0x198(%rsp)
cmpl $0x200, 0x198(%rsp) # imm = 0x200
jge 0x816c
movslq 0x198(%rsp), %rax
movb $0x0, 0x410(%rsp,%rax)
movl 0x198(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x198(%rsp)
jmp 0x813c
jmp 0x817f
movl 0x1a8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a8(%rsp)
jmp 0x8181
movl 0x1a0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a0(%rsp)
jmp 0x7fde
cmpl $0x0, 0x1ac(%rsp)
jne 0x81b4
movl 0x1fc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1fc(%rsp)
jmp 0x81fe
movq 0x158(%rsp), %rdi
leaq 0x210(%rsp), %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x9ad0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x81eb
movl 0x1f8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1f8(%rsp)
jmp 0x81fc
movl 0x1f4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1f4(%rsp)
jmp 0x81fe
movq 0x158(%rsp), %rax
movq (%rax), %rdi
callq 0xcf50
movb %al, 0xff(%rsp)
jmp 0x8217
movb 0xff(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x825d
movq 0x4bd81(%rip), %rdi     # 0x53fb0
leaq 0x32394(%rip), %rsi     # 0x3a5ca
callq 0x6420
movq %rax, 0xf0(%rsp)
jmp 0x8245
movq 0xf0(%rsp), %rdi
movq 0x4bd1c(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x825b
jmp 0x8278
jmp 0x825f
movq 0x1b0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x1b0(%rsp)
jmp 0x7eea
movq 0x4bd31(%rip), %rdi     # 0x53fb0
movq 0x4bcea(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x828d
movq 0x4bd1c(%rip), %rdi     # 0x53fb0
leaq 0x32379(%rip), %rsi     # 0x3a614
callq 0x6420
movq %rax, 0xe8(%rsp)
jmp 0x82aa
movl $0x6, %edi
callq 0x9fa0
movl %eax, 0xe4(%rsp)
jmp 0x82bd
movq 0xe8(%rsp), %rdi
movl 0xe4(%rsp), %eax
movl %eax, 0x194(%rsp)
movl 0x194(%rsp), %esi
callq 0x64d0
movq %rax, 0xd8(%rsp)
jmp 0x82e9
movq 0xd8(%rsp), %rdi
movl 0x1fc(%rsp), %esi
callq 0x6580
movq %rax, 0xd0(%rsp)
jmp 0x8307
movq 0xd0(%rsp), %rdi
leaq 0x32314(%rip), %rsi     # 0x3a62a
callq 0x6420
movq %rax, 0xc8(%rsp)
jmp 0x8325
movq 0xc8(%rsp), %rdi
movq 0x4bc3c(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x833b
movq 0x4bc6e(%rip), %rdi     # 0x53fb0
leaq 0x322ea(%rip), %rsi     # 0x3a633
callq 0x6420
movq %rax, 0xc0(%rsp)
jmp 0x8358
movl $0x6, %edi
callq 0x9fa0
movl %eax, 0xbc(%rsp)
jmp 0x836b
movq 0xc0(%rsp), %rdi
movl 0xbc(%rsp), %eax
movl %eax, 0x190(%rsp)
movl 0x190(%rsp), %esi
callq 0x64d0
movq %rax, 0xb0(%rsp)
jmp 0x8397
movq 0xb0(%rsp), %rdi
movl 0x1f8(%rsp), %esi
callq 0x6580
movq %rax, 0xa8(%rsp)
jmp 0x83b5
movq 0xa8(%rsp), %rdi
leaq 0x3228c(%rip), %rsi     # 0x3a650
callq 0x6420
movq %rax, 0xa0(%rsp)
jmp 0x83d3
movq 0xa0(%rsp), %rdi
movq 0x4bb8e(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x83e9
movq 0x4bbc0(%rip), %rdi     # 0x53fb0
leaq 0x32262(%rip), %rsi     # 0x3a659
callq 0x6420
movq %rax, 0x98(%rsp)
jmp 0x8406
movl $0x6, %edi
callq 0x9fa0
movl %eax, 0x94(%rsp)
jmp 0x8419
movq 0x98(%rsp), %rdi
movl 0x94(%rsp), %eax
movl %eax, 0x18c(%rsp)
movl 0x18c(%rsp), %esi
callq 0x64d0
movq %rax, 0x88(%rsp)
jmp 0x8445
movq 0x88(%rsp), %rdi
movl 0x1f4(%rsp), %esi
callq 0x6580
movq %rax, 0x80(%rsp)
jmp 0x8463
movq 0x80(%rsp), %rdi
movq 0x4bafe(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x8479
movq 0x158(%rsp), %rax
movq (%rax), %rdi
callq 0xd0b0
jmp 0x848b
movl 0x1fc(%rsp), %eax
cvtsi2sd %rax, %xmm0
movl 0x1f4(%rsp), %eax
movl 0x1f8(%rsp), %ecx
addl %ecx, %eax
cvtsi2sd %rax, %xmm1
movsd 0x31b54(%rip), %xmm2    # 0x3a008
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x8512
movq 0x158(%rsp), %rax
movl $0x1, 0x8(%rax)
movq 0x4badc(%rip), %rdi     # 0x53fb0
leaq 0x3219f(%rip), %rsi     # 0x3a67a
callq 0x6420
movq %rax, 0x78(%rsp)
jmp 0x84e7
movq 0x78(%rsp), %rdi
movq 0x4ba7d(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x84fa
movb $0x1, 0x627(%rsp)
movl $0x1, 0x1c8(%rsp)
jmp 0x8975
movl 0x1f8(%rsp), %eax
cvtsi2sd %rax, %xmm0
movl 0x1f4(%rsp), %eax
movl 0x1fc(%rsp), %ecx
addl %ecx, %eax
cvtsi2sd %rax, %xmm1
movsd 0x31acd(%rip), %xmm2    # 0x3a008
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x85ac
leaq 0x1d8(%rsp), %rdi
callq 0x9d50
cmpq $0x3, %rax
jb 0x85ac
movq 0x158(%rsp), %rax
movl $0x4, 0x8(%rax)
movq 0x4ba42(%rip), %rdi     # 0x53fb0
leaq 0x3211c(%rip), %rsi     # 0x3a691
callq 0x6420
movq %rax, 0x70(%rsp)
jmp 0x8581
movq 0x70(%rsp), %rdi
movq 0x4b9e3(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x8594
movb $0x1, 0x627(%rsp)
movl $0x1, 0x1c8(%rsp)
jmp 0x8975
jmp 0x85ae
leaq 0x170(%rsp), %rdi
callq 0xa2a0
movl $0x0, 0x16c(%rsp)
movl 0x16c(%rsp), %eax
movq %rax, 0x68(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x9d50
movq %rax, %rcx
movq 0x68(%rsp), %rax
cmpq %rcx, %rax
jae 0x86a9
movl 0x16c(%rsp), %eax
movl %eax, %esi
leaq 0x1d8(%rsp), %rdi
callq 0x9d70
movq %rax, 0x60(%rsp)
jmp 0x860d
movq 0x60(%rsp), %rax
movq (%rax), %rdi
callq 0x2fc80
movq %rax, 0x58(%rsp)
jmp 0x8621
movq 0x158(%rsp), %rdi
movq 0x58(%rsp), %rax
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x9ad0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x8691
leaq 0x170(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0xa2b0
jmp 0x8669
jmp 0x8691
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
leaq 0x170(%rsp), %rdi
callq 0xa380
jmp 0x8993
jmp 0x8693
movl 0x16c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x16c(%rsp)
jmp 0x85c6
leaq 0x170(%rsp), %rdi
callq 0xa320
cmpq $0x2, %rax
jne 0x8796
xorl %eax, %eax
movl %eax, %esi
leaq 0x170(%rsp), %rdi
callq 0xa340
movq %rax, 0x50(%rsp)
jmp 0x86d8
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x40(%rsp)
leaq 0x170(%rsp), %rdi
movl $0x1, %esi
callq 0xa340
movq %rax, 0x48(%rsp)
jmp 0x86fe
movq 0x40(%rsp), %rsi
movq 0x158(%rsp), %rdi
movq 0x48(%rsp), %rax
movq (%rax), %rdx
movl $0x200, %ecx            # imm = 0x200
callq 0x9b30
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x8794
movq 0x158(%rsp), %rax
movl $0x1, 0x28(%rax)
movl $0x3, 0x8(%rax)
movq 0x4b86c(%rip), %rdi     # 0x53fb0
leaq 0x31f66(%rip), %rsi     # 0x3a6b1
callq 0x6420
movq %rax, 0x38(%rsp)
jmp 0x8757
movq 0x38(%rsp), %rdi
movq 0x4b80d(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x876a
movq 0x158(%rsp), %rax
movq (%rax), %rdi
callq 0xd0b0
jmp 0x877c
movb $0x1, 0x627(%rsp)
movl $0x1, 0x1c8(%rsp)
jmp 0x8968
jmp 0x8796
movl 0x1fc(%rsp), %eax
movq %rax, 0x30(%rsp)
imull $0x64, 0x1f4(%rsp), %eax
movl %eax, %eax
movq %rax, 0x28(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x9d50
movq %rax, %rcx
movq 0x28(%rsp), %rax
addq $0x1, %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
jae 0x8884
movl 0x1fc(%rsp), %eax
movl 0x1f8(%rsp), %ecx
addl %ecx, %eax
cvtsi2sd %rax, %xmm0
movl 0x1f4(%rsp), %eax
cvtsi2ss %rax, %xmm1
cvtss2sd %xmm1, %xmm2
movsd 0x31803(%rip), %xmm1    # 0x3a010
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x8884
movq 0x158(%rsp), %rax
movl $0x1, 0x28(%rax)
movl $0x3, 0x8(%rax)
movq 0x4b77c(%rip), %rdi     # 0x53fb0
leaq 0x31ebf(%rip), %rsi     # 0x3a6fa
callq 0x6420
movq %rax, 0x20(%rsp)
jmp 0x8847
movq 0x20(%rsp), %rdi
movq 0x4b71d(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x885a
movq 0x158(%rsp), %rax
movq (%rax), %rdi
callq 0xd0b0
jmp 0x886c
movb $0x1, 0x627(%rsp)
movl $0x1, 0x1c8(%rsp)
jmp 0x8968
movl 0x1fc(%rsp), %eax
movq %rax, 0x18(%rsp)
imull $0x64, 0x1f4(%rsp), %eax
movl %eax, %eax
movq %rax, 0x10(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x9d50
movq %rax, %rcx
movq 0x10(%rsp), %rax
addq $0x1, %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jb 0x891b
movq 0x158(%rsp), %rax
movl $0x1, 0x8(%rax)
movq 0x4b6d0(%rip), %rdi     # 0x53fb0
leaq 0x31e71(%rip), %rsi     # 0x3a758
callq 0x6420
movq %rax, 0x8(%rsp)
jmp 0x88f3
movq 0x8(%rsp), %rdi
movq 0x4b671(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x8906
movb $0x1, 0x627(%rsp)
movl $0x1, 0x1c8(%rsp)
jmp 0x8968
movq 0x158(%rsp), %rax
movl $0x0, 0x8(%rax)
movq 0x4b67f(%rip), %rdi     # 0x53fb0
leaq 0x31e60(%rip), %rsi     # 0x3a798
callq 0x6420
movq %rax, (%rsp)
jmp 0x8943
movq (%rsp), %rdi
movq 0x4b622(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x8955
movb $0x1, 0x627(%rsp)
movl $0x1, 0x1c8(%rsp)
leaq 0x170(%rsp), %rdi
callq 0xa380
leaq 0x1d8(%rsp), %rdi
callq 0x9db0
movb 0x627(%rsp), %al
andb $0x1, %al
addq $0x628, %rsp            # imm = 0x628
retq
leaq 0x1d8(%rsp), %rdi
callq 0x9db0
movq 0x1d0(%rsp), %rdi
callq 0x6750
nopl (%rax)