// File: Windfisch[P]production-flow/read_factory.cpp
// Function: read_factory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Factory read_factory(string file)
{
	ifstream f(file);
	if (!f.good())
		throw runtime_error("could not open file '"+file+"'");
	
	Factory factory;
	string line;

	// parse facilities
	while (getline(f, line))
	{
		if (line == "#") break;

		size_t p1 = line.find(' ');
		if (p1 == string::npos)
			throw runtime_error("invalid format");
	
		if (p1 == line.length()-1)
		{
			vector<Factory::FacilityConfiguration> upgrade_plan;
			Factory::FacilityConfiguration conf;
			upgrade_plan.push_back(conf); // push an empty configuration. this is a splitter node

			factory.facilities.emplace_back(upgrade_plan);
		}
		else
		{
			size_t p2 = line.find(' ', p1+1);
			if (p2 == string::npos)
				throw runtime_error("invalid format");

			size_t p3 = line.find('/', p2+1);
			if (p3 == string::npos)
				throw runtime_error("invalid format");

			string recipe = line.substr(p1+1, p2-p1-1);
			double current = stod(line.substr(p2+1, p3-p2-1));
			double maximum = stod(line.substr(p3+1));

			cout << "recipe '" << recipe << "' with " << current << "/" << maximum << endl;

			vector<Factory::FacilityConfiguration> upgrade_plan;
			
			for (int i=0; i<5; i++)
			{
				Factory::FacilityConfiguration conf;
				
				for (auto iter : recipes.at(recipe))
					conf.production_or_consumption[iter.first] = int(SCALING_FACTOR * iter.second * (current + (maximum-current)*i/5.));
				upgrade_plan.push_back(conf);
			}

			factory.facilities.emplace_back(upgrade_plan);
		}
	}

	if (line != "#")
		throw runtime_error("invalid format: could not find edge list");

	while (getline(f, line))
	{
		size_t p1 = line.find(' ');
		if (p1 == string::npos)
			throw runtime_error("invalid format");
		size_t p2 = line.find(' ',p1+1);
		if (p2 == string::npos)
			throw runtime_error("invalid format");
		size_t p3 = line.find(' ',p2+1);
		if (p3 == string::npos)
			throw runtime_error("invalid format");

		int from = stoi(line.substr(0, p1));
		int to = stoi(line.substr(p1+1,p2-p1-1));
		string item = line.substr(p2+1,p3-p2-1);
		string dist_x = line.substr(p3+1);

		bool exists = (dist_x.substr(dist_x.length()-1) != "x");
		double dist = stod(dist_x);

		cout << "transport of " << item << " " << from << "->" << to << ", distance " << dist << " (line exists=" << exists << ")" << endl;

		vector<Factory::TransportLineConfiguration> upgrade_plan;

		upgrade_plan.emplace_back(Factory::TransportLineConfiguration{int(SCALING_FACTOR * 1*13.3), dist}); // one yellow
		upgrade_plan.emplace_back(Factory::TransportLineConfiguration{int(SCALING_FACTOR * 2*13.3), dist}); // two yellow
		upgrade_plan.emplace_back(Factory::TransportLineConfiguration{int(SCALING_FACTOR * 3*13.3), 4*dist}); // red+yellow
		upgrade_plan.emplace_back(Factory::TransportLineConfiguration{int(SCALING_FACTOR * 4*13.3), 4*dist}); // red+red
		upgrade_plan.emplace_back(Factory::TransportLineConfiguration{int(SCALING_FACTOR * 5*13.3), 15*dist}); // blue+red
		upgrade_plan.emplace_back(Factory::TransportLineConfiguration{int(SCALING_FACTOR * 6*13.3), 15*dist}); // blue+blue

		factory.transport_lines.emplace_back(item_lookup.at(item), from-1, to-1, upgrade_plan);
	}

	return factory;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x6d0, %rsp            # imm = 0x6D0
movq %rsi, -0x568(%rbp)
movq %rdi, -0x560(%rbp)
movq %rdi, %rax
movq %rax, -0x558(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x3470
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x34b0
movb %al, -0x549(%rbp)
jmp 0x1910c
movb -0x549(%rbp), %al
testb $0x1, %al
jne 0x1922c
jmp 0x1911c
movb $0x1, -0x269(%rbp)
movl $0x10, %edi
callq 0x3170
movq -0x568(%rbp), %rdx
movq %rax, -0x570(%rbp)
leaq 0xc854(%rip), %rsi      # 0x25996
leaq -0x268(%rbp), %rdi
callq 0x1afb0
jmp 0x19150
leaq 0xc853(%rip), %rdx      # 0x259aa
leaq -0x248(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x1af60
jmp 0x1916c
movq -0x570(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x3480
jmp 0x19181
movq -0x570(%rbp), %rdi
movb $0x0, -0x269(%rbp)
movq 0x1fe5a(%rip), %rsi     # 0x38ff0
movq 0x1fe23(%rip), %rdx     # 0x38fc0
callq 0x34c0
jmp 0x1a20f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x1a1f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x19210
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x19204
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x3588
leaq -0x268(%rbp), %rdi
callq 0x3588
testb $0x1, -0x269(%rbp)
jne 0x1921b
jmp 0x19227
movq -0x570(%rbp), %rdi
callq 0x3230
jmp 0x1a1f7
movq -0x560(%rbp), %rdi
movb $0x0, -0x26a(%rbp)
callq 0x1b0c0
leaq -0x290(%rbp), %rdi
callq 0x33e0
leaq -0x218(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x3090
movq %rax, -0x578(%rbp)
jmp 0x19267
movq -0x578(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3390
movb %al, -0x579(%rbp)
jmp 0x19285
movb -0x579(%rbp), %al
testb $0x1, %al
jne 0x19294
jmp 0x1995c
leaq 0xc711(%rip), %rsi      # 0x259ac
leaq -0x290(%rbp), %rdi
callq 0x1b120
movb %al, -0x57a(%rbp)
jmp 0x192af
movb -0x57a(%rbp), %al
testb $0x1, %al
jne 0x192bb
jmp 0x192d7
jmp 0x1995c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x1a1b5
leaq -0x290(%rbp), %rdi
movl $0x20, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x33a0
movq %rax, -0x298(%rbp)
cmpq $-0x1, -0x298(%rbp)
jne 0x19364
movl $0x10, %edi
callq 0x3170
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x588(%rbp)
leaq 0xc693(%rip), %rsi      # 0x259ae
callq 0x3120
jmp 0x19322
movq -0x588(%rbp), %rdi
movq 0x1fcc0(%rip), %rsi     # 0x38ff0
movq 0x1fc89(%rip), %rdx     # 0x38fc0
callq 0x34c0
jmp 0x1a20f
movq -0x588(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x3230
jmp 0x1a1b5
movq -0x298(%rbp), %rax
movq %rax, -0x590(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x3410
movq %rax, %rcx
movq -0x590(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x19431
leaq -0x2b0(%rbp), %rdi
movq %rdi, -0x5a0(%rbp)
callq 0x1b150
leaq -0x2e8(%rbp), %rdi
movq %rdi, -0x598(%rbp)
callq 0x1b170
movq -0x5a0(%rbp), %rdi
movq -0x598(%rbp), %rsi
callq 0x1b190
jmp 0x193d0
movq -0x560(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x1b200
jmp 0x193e5
leaq -0x2e8(%rbp), %rdi
callq 0x7090
leaq -0x2b0(%rbp), %rdi
callq 0x6bd0
jmp 0x19957
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x7090
leaq -0x2b0(%rbp), %rdi
callq 0x6bd0
jmp 0x1a1b5
movq -0x298(%rbp), %rdx
addq $0x1, %rdx
leaq -0x290(%rbp), %rdi
movl $0x20, %esi
callq 0x33a0
movq %rax, -0x2f0(%rbp)
cmpq $-0x1, -0x2f0(%rbp)
jne 0x194c5
movl $0x10, %edi
callq 0x3170
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x5a8(%rbp)
leaq 0xc532(%rip), %rsi      # 0x259ae
callq 0x3120
jmp 0x19483
movq -0x5a8(%rbp), %rdi
movq 0x1fb5f(%rip), %rsi     # 0x38ff0
movq 0x1fb28(%rip), %rdx     # 0x38fc0
callq 0x34c0
jmp 0x1a20f
movq -0x5a8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x3230
jmp 0x1a1b5
movq -0x2f0(%rbp), %rdx
addq $0x1, %rdx
leaq -0x290(%rbp), %rdi
movl $0x2f, %esi
callq 0x33a0
movq %rax, -0x2f8(%rbp)
cmpq $-0x1, -0x2f8(%rbp)
jne 0x19559
movl $0x10, %edi
callq 0x3170
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x5b0(%rbp)
leaq 0xc49e(%rip), %rsi      # 0x259ae
callq 0x3120
jmp 0x19517
movq -0x5b0(%rbp), %rdi
movq 0x1facb(%rip), %rsi     # 0x38ff0
movq 0x1fa94(%rip), %rdx     # 0x38fc0
callq 0x34c0
jmp 0x1a20f
movq -0x5b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x3230
jmp 0x1a1b5
movq -0x298(%rbp), %rcx
movq %rcx, %rdx
incq %rdx
movq -0x2f0(%rbp), %rax
notq %rcx
addq %rax, %rcx
leaq -0x318(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x32d0
jmp 0x19588
movq -0x2f0(%rbp), %rcx
movq %rcx, %rdx
incq %rdx
movq -0x2f8(%rbp), %rax
notq %rcx
addq %rax, %rcx
leaq -0x340(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x32d0
jmp 0x195b7
xorl %eax, %eax
movl %eax, %esi
leaq -0x340(%rbp), %rdi
callq 0x1b280
movsd %xmm0, -0x5b8(%rbp)
jmp 0x195d1
leaq -0x340(%rbp), %rdi
callq 0x3588
movsd -0x5b8(%rbp), %xmm0
movsd %xmm0, -0x320(%rbp)
movq -0x2f8(%rbp), %rdx
incq %rdx
leaq -0x368(%rbp), %rdi
leaq -0x290(%rbp), %rsi
movq $-0x1, %rcx
callq 0x32d0
jmp 0x19613
xorl %eax, %eax
movl %eax, %esi
leaq -0x368(%rbp), %rdi
callq 0x1b280
movsd %xmm0, -0x5c0(%rbp)
jmp 0x1962d
leaq -0x368(%rbp), %rdi
callq 0x3588
movsd -0x5c0(%rbp), %xmm0
movsd %xmm0, -0x348(%rbp)
movq 0x1f978(%rip), %rdi     # 0x38fc8
leaq 0xc366(%rip), %rsi      # 0x259bd
callq 0x3290
movq %rax, -0x5c8(%rbp)
jmp 0x19665
movq -0x5c8(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x3280
movq %rax, -0x5d0(%rbp)
jmp 0x19681
movq -0x5d0(%rbp), %rdi
leaq 0xc337(%rip), %rsi      # 0x259c6
callq 0x3290
movq %rax, -0x5d8(%rbp)
jmp 0x1969d
movq -0x5d8(%rbp), %rdi
movsd -0x320(%rbp), %xmm0
callq 0x3530
movq %rax, -0x5e0(%rbp)
jmp 0x196ba
movq -0x5e0(%rbp), %rdi
leaq 0xbd23(%rip), %rsi      # 0x253eb
callq 0x3290
movq %rax, -0x5e8(%rbp)
jmp 0x196d6
movq -0x5e8(%rbp), %rdi
movsd -0x348(%rbp), %xmm0
callq 0x3530
movq %rax, -0x5f0(%rbp)
jmp 0x196f3
movq -0x5f0(%rbp), %rdi
movq 0x1f89f(%rip), %rsi     # 0x38fa0
callq 0x32f0
jmp 0x19708
leaq -0x380(%rbp), %rdi
callq 0x1b150
movl $0x0, -0x384(%rbp)
cmpl $0x5, -0x384(%rbp)
jge 0x198f9
leaq -0x3c0(%rbp), %rdi
callq 0x1b170
leaq 0x1fc12(%rip), %rdi     # 0x39350
leaq -0x318(%rbp), %rsi
callq 0x1b2c0
movq %rax, -0x5f8(%rbp)
jmp 0x19753
movq -0x5f8(%rbp), %rax
movq %rax, -0x3c8(%rbp)
movq -0x3c8(%rbp), %rdi
callq 0x1b360
movq %rax, -0x3d0(%rbp)
movq -0x3c8(%rbp), %rdi
callq 0x1b390
movq %rax, -0x3d8(%rbp)
leaq -0x3d0(%rbp), %rdi
leaq -0x3d8(%rbp), %rsi
callq 0x1b3c0
testb $0x1, %al
jne 0x197a3
jmp 0x198c4
leaq -0x3d0(%rbp), %rdi
callq 0x1b3f0
movups (%rax), %xmm0
movaps %xmm0, -0x3f0(%rbp)
movsd -0x3e8(%rbp), %xmm0
movsd 0xc18f(%rip), %xmm1     # 0x25958
mulsd %xmm1, %xmm0
movsd -0x320(%rbp), %xmm1
movsd -0x348(%rbp), %xmm2
subsd %xmm1, %xmm2
cvtsi2sdl -0x384(%rbp), %xmm3
mulsd %xmm3, %xmm2
movsd 0xc16b(%rip), %xmm3     # 0x25960
divsd %xmm3, %xmm2
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x604(%rbp)
leaq -0x3c0(%rbp), %rdi
leaq -0x3f0(%rbp), %rsi
callq 0x1b410
movq %rax, -0x600(%rbp)
jmp 0x19827
movq -0x600(%rbp), %rax
movl -0x604(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x3d0(%rbp), %rdi
callq 0x1b4f0
jmp 0x19787
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x19946
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x3588
jmp 0x19946
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x3588
jmp 0x19946
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x3c0(%rbp), %rdi
callq 0x7090
jmp 0x1993a
leaq -0x380(%rbp), %rdi
leaq -0x3c0(%rbp), %rsi
callq 0x1b190
jmp 0x198d9
leaq -0x3c0(%rbp), %rdi
callq 0x7090
movl -0x384(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x384(%rbp)
jmp 0x1971e
movq -0x560(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x1b200
jmp 0x1990e
leaq -0x380(%rbp), %rdi
callq 0x6bd0
leaq -0x318(%rbp), %rdi
callq 0x3588
jmp 0x19957
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x6bd0
leaq -0x318(%rbp), %rdi
callq 0x3588
jmp 0x1a1b5
jmp 0x1924b
leaq 0xc049(%rip), %rsi      # 0x259ac
leaq -0x290(%rbp), %rdi
callq 0x1b520
movb %al, -0x605(%rbp)
jmp 0x19977
movb -0x605(%rbp), %al
testb $0x1, %al
jne 0x19983
jmp 0x199ea
movl $0x10, %edi
callq 0x3170
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x610(%rbp)
leaq 0xc02d(%rip), %rsi      # 0x259ce
callq 0x3120
jmp 0x199a8
movq -0x610(%rbp), %rdi
movq 0x1f63a(%rip), %rsi     # 0x38ff0
movq 0x1f603(%rip), %rdx     # 0x38fc0
callq 0x34c0
jmp 0x1a20f
movq -0x610(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x3230
jmp 0x1a1b5
jmp 0x199ec
leaq -0x218(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x3090
movq %rax, -0x618(%rbp)
jmp 0x19a08
movq -0x618(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3390
movb %al, -0x619(%rbp)
jmp 0x19a26
movb -0x619(%rbp), %al
testb $0x1, %al
jne 0x19a35
jmp 0x1a197
leaq -0x290(%rbp), %rdi
movl $0x20, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x33a0
movq %rax, -0x3f8(%rbp)
cmpq $-0x1, -0x3f8(%rbp)
jne 0x19ac2
movl $0x10, %edi
callq 0x3170
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x628(%rbp)
leaq 0xbf35(%rip), %rsi      # 0x259ae
callq 0x3120
jmp 0x19a80
movq -0x628(%rbp), %rdi
movq 0x1f562(%rip), %rsi     # 0x38ff0
movq 0x1f52b(%rip), %rdx     # 0x38fc0
callq 0x34c0
jmp 0x1a20f
movq -0x628(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x3230
jmp 0x1a1b5
movq -0x3f8(%rbp), %rdx
addq $0x1, %rdx
leaq -0x290(%rbp), %rdi
movl $0x20, %esi
callq 0x33a0
movq %rax, -0x400(%rbp)
cmpq $-0x1, -0x400(%rbp)
jne 0x19b56
movl $0x10, %edi
callq 0x3170
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x630(%rbp)
leaq 0xbea1(%rip), %rsi      # 0x259ae
callq 0x3120
jmp 0x19b14
movq -0x630(%rbp), %rdi
movq 0x1f4ce(%rip), %rsi     # 0x38ff0
movq 0x1f497(%rip), %rdx     # 0x38fc0
callq 0x34c0
jmp 0x1a20f
movq -0x630(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x3230
jmp 0x1a1b5
movq -0x400(%rbp), %rdx
addq $0x1, %rdx
leaq -0x290(%rbp), %rdi
movl $0x20, %esi
callq 0x33a0
movq %rax, -0x408(%rbp)
cmpq $-0x1, -0x408(%rbp)
jne 0x19bea
movl $0x10, %edi
callq 0x3170
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x638(%rbp)
leaq 0xbe0d(%rip), %rsi      # 0x259ae
callq 0x3120
jmp 0x19ba8
movq -0x638(%rbp), %rdi
movq 0x1f43a(%rip), %rsi     # 0x38ff0
movq 0x1f403(%rip), %rdx     # 0x38fc0
callq 0x34c0
jmp 0x1a20f
movq -0x638(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x3230
jmp 0x1a1b5
movq -0x3f8(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x430(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x32d0
jmp 0x19c0a
xorl %eax, %eax
movl %eax, %esi
leaq -0x430(%rbp), %rdi
movl $0xa, %edx
callq 0x1b550
movl %eax, -0x63c(%rbp)
jmp 0x19c27
leaq -0x430(%rbp), %rdi
callq 0x3588
movl -0x63c(%rbp), %eax
movl %eax, -0x40c(%rbp)
movq -0x3f8(%rbp), %rcx
movq %rcx, %rdx
incq %rdx
movq -0x400(%rbp), %rax
notq %rcx
addq %rax, %rcx
leaq -0x458(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x32d0
jmp 0x19c6e
xorl %eax, %eax
movl %eax, %esi
leaq -0x458(%rbp), %rdi
movl $0xa, %edx
callq 0x1b550
movl %eax, -0x640(%rbp)
jmp 0x19c8b
leaq -0x458(%rbp), %rdi
callq 0x3588
movl -0x640(%rbp), %eax
movl %eax, -0x434(%rbp)
movq -0x400(%rbp), %rcx
movq %rcx, %rdx
incq %rdx
movq -0x408(%rbp), %rax
notq %rcx
addq %rax, %rcx
leaq -0x478(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x32d0
jmp 0x19cd2
movq -0x408(%rbp), %rdx
incq %rdx
leaq -0x498(%rbp), %rdi
leaq -0x290(%rbp), %rsi
movq $-0x1, %rcx
callq 0x32d0
jmp 0x19cf8
leaq -0x498(%rbp), %rdi
movq %rdi, -0x648(%rbp)
callq 0x3410
movq -0x648(%rbp), %rsi
movq %rax, %rdx
decq %rdx
leaq -0x4c0(%rbp), %rdi
movq $-0x1, %rcx
callq 0x32d0
jmp 0x19d2d
leaq 0xbcc3(%rip), %rsi      # 0x259f7
leaq -0x4c0(%rbp), %rdi
callq 0x1b520
movb %al, -0x649(%rbp)
jmp 0x19d48
leaq -0x4c0(%rbp), %rdi
callq 0x3588
movb -0x649(%rbp), %al
andb $0x1, %al
movb %al, -0x499(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x498(%rbp), %rdi
callq 0x1b280
movsd %xmm0, -0x658(%rbp)
jmp 0x19d7c
movsd -0x658(%rbp), %xmm0
movsd %xmm0, -0x4c8(%rbp)
movq 0x1f235(%rip), %rdi     # 0x38fc8
leaq 0xbc5f(%rip), %rsi      # 0x259f9
callq 0x3290
movq %rax, -0x660(%rbp)
jmp 0x19da8
movq -0x660(%rbp), %rdi
leaq -0x478(%rbp), %rsi
callq 0x3280
movq %rax, -0x668(%rbp)
jmp 0x19dc4
movq -0x668(%rbp), %rdi
leaq 0xb820(%rip), %rsi      # 0x255f2
callq 0x3290
movq %rax, -0x670(%rbp)
jmp 0x19de0
movq -0x670(%rbp), %rdi
movl -0x40c(%rbp), %esi
callq 0x34e0
movq %rax, -0x678(%rbp)
jmp 0x19dfb
movq -0x678(%rbp), %rdi
leaq 0xb35a(%rip), %rsi      # 0x25163
callq 0x3290
movq %rax, -0x680(%rbp)
jmp 0x19e17
movq -0x680(%rbp), %rdi
movl -0x434(%rbp), %esi
callq 0x34e0
movq %rax, -0x688(%rbp)
jmp 0x19e32
movq -0x688(%rbp), %rdi
leaq 0xbbc7(%rip), %rsi      # 0x25a07
callq 0x3290
movq %rax, -0x690(%rbp)
jmp 0x19e4e
movq -0x690(%rbp), %rdi
movsd -0x4c8(%rbp), %xmm0
callq 0x3530
movq %rax, -0x698(%rbp)
jmp 0x19e6b
movq -0x698(%rbp), %rdi
leaq 0xbb9a(%rip), %rsi      # 0x25a13
callq 0x3290
movq %rax, -0x6a0(%rbp)
jmp 0x19e87
movq -0x6a0(%rbp), %rdi
movzbl -0x499(%rbp), %esi
andl $0x1, %esi
callq 0x3510
movq %rax, -0x6a8(%rbp)
jmp 0x19ea6
movq -0x6a8(%rbp), %rdi
leaq 0xb87d(%rip), %rsi      # 0x25731
callq 0x3290
movq %rax, -0x6b0(%rbp)
jmp 0x19ec2
movq -0x6b0(%rbp), %rdi
movq 0x1f0d0(%rip), %rsi     # 0x38fa0
callq 0x32f0
jmp 0x19ed7
leaq -0x4e0(%rbp), %rdi
movq %rdi, -0x6b8(%rbp)
callq 0x1b590
movq -0x6b8(%rbp), %rdi
movl $0x33f4, -0x4f0(%rbp)   # imm = 0x33F4
movsd -0x4c8(%rbp), %xmm0
movsd %xmm0, -0x4e8(%rbp)
leaq -0x4f0(%rbp), %rsi
callq 0x1b5b0
jmp 0x19f19
movl $0x67e8, -0x500(%rbp)   # imm = 0x67E8
movsd -0x4c8(%rbp), %xmm0
movsd %xmm0, -0x4f8(%rbp)
leaq -0x4e0(%rbp), %rdi
leaq -0x500(%rbp), %rsi
callq 0x1b5b0
jmp 0x19f48
movl $0x9bdc, -0x510(%rbp)   # imm = 0x9BDC
movsd -0x4c8(%rbp), %xmm0
movsd 0xba06(%rip), %xmm1     # 0x25968
mulsd %xmm1, %xmm0
movsd %xmm0, -0x508(%rbp)
leaq -0x4e0(%rbp), %rdi
leaq -0x510(%rbp), %rsi
callq 0x1b5b0
jmp 0x19f83
movl $0xcfd0, -0x520(%rbp)   # imm = 0xCFD0
movsd -0x4c8(%rbp), %xmm0
movsd 0xb9cb(%rip), %xmm1     # 0x25968
mulsd %xmm1, %xmm0
movsd %xmm0, -0x518(%rbp)
leaq -0x4e0(%rbp), %rdi
leaq -0x520(%rbp), %rsi
callq 0x1b5b0
jmp 0x19fbe
movl $0x103c4, -0x530(%rbp)  # imm = 0x103C4
movsd -0x4c8(%rbp), %xmm0
movsd 0xb998(%rip), %xmm1     # 0x25970
mulsd %xmm1, %xmm0
movsd %xmm0, -0x528(%rbp)
leaq -0x4e0(%rbp), %rdi
leaq -0x530(%rbp), %rsi
callq 0x1b5b0
jmp 0x19ff9
movl $0x137b8, -0x540(%rbp)  # imm = 0x137B8
movsd -0x4c8(%rbp), %xmm0
movsd 0xb95d(%rip), %xmm1     # 0x25970
mulsd %xmm1, %xmm0
movsd %xmm0, -0x538(%rbp)
leaq -0x4e0(%rbp), %rdi
leaq -0x540(%rbp), %rsi
callq 0x1b5b0
jmp 0x1a034
movq -0x560(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x6c8(%rbp)
leaq 0x1f333(%rip), %rdi     # 0x39380
leaq -0x478(%rbp), %rsi
callq 0x1b6d0
movq %rax, -0x6c0(%rbp)
jmp 0x1a062
movq -0x6c0(%rbp), %rsi
movq -0x6c8(%rbp), %rdi
movl -0x40c(%rbp), %eax
decl %eax
movl %eax, -0x544(%rbp)
movl -0x434(%rbp), %eax
decl %eax
movl %eax, -0x548(%rbp)
leaq -0x544(%rbp), %rdx
leaq -0x548(%rbp), %rcx
leaq -0x4e0(%rbp), %r8
callq 0x1b630
jmp 0x1a0a8
leaq -0x4e0(%rbp), %rdi
callq 0x6760
leaq -0x498(%rbp), %rdi
callq 0x3588
leaq -0x478(%rbp), %rdi
callq 0x3588
jmp 0x199ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x430(%rbp), %rdi
callq 0x3588
jmp 0x1a1b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x458(%rbp), %rdi
callq 0x3588
jmp 0x1a1b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x1a189
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x1a17d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x4c0(%rbp), %rdi
callq 0x3588
jmp 0x1a17d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x6760
leaq -0x498(%rbp), %rdi
callq 0x3588
leaq -0x478(%rbp), %rdi
callq 0x3588
jmp 0x1a1b5
movb $0x1, -0x26a(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x3588
testb $0x1, -0x26a(%rbp)
jne 0x1a1db
jmp 0x1a1cf
leaq -0x290(%rbp), %rdi
callq 0x3588
movq -0x560(%rbp), %rdi
callq 0x58d0
jmp 0x1a1f7
movq -0x560(%rbp), %rdi
callq 0x58d0
leaq -0x218(%rbp), %rdi
callq 0x30d0
movq -0x558(%rbp), %rax
addq $0x6d0, %rsp            # imm = 0x6D0
popq %rbp
retq
leaq -0x218(%rbp), %rdi
callq 0x30d0
movq -0x220(%rbp), %rdi
callq 0x34f0
nop