// File: lrq3000[P]rfrb/./src/fileHandler.cpp
// Function: FileHandler::userStripeMapInteraction(std::vector<std::vector<mapEntry, std::allocator<mapEntry>>, std::allocator<std::vector<mapEntry, std::allocator<mapEntry>>>>&)
void FileHandler::userStripeMapInteraction(std::vector<std::vector<mapEntry>> &stripingMap)
{
	bool finished=false;
	std::string answer;
	while (finished == false)
	{
		std::cout << "Found following stripemap: " << std::endl << std::endl;
		for (auto &in : stripingMap)
		{
			std::cout << std::setw(10) << " ";
			for (auto &it : in)
			{
				if (it.isParity)
				{
					std::cout << std::setw(4) << "P";
				}
				else
				{
					std::cout << std::setw(4) << std::to_string(it.dataBlock);
				}
			}
			std::cout << std::endl;
		}
		std::cout << std::endl << std::endl;
		std::cout << "Everything ok? [y/n]" << std::endl;
		std::getline(std::cin,answer);
		if (answer == "y" || answer == "yes" || answer == "Y")
		{
			finished=true;
		}
		else
		{
			std::cout << "Which line to change?" << std::endl;
			std::getline(std::cin,answer);
			size_t line = std::atoll(answer.c_str())-1;
			std::vector<mapEntry> tmp;
			if (line >= stripingMap.size())
			{
				std::cout << "Line not found" << std::endl;
			}
			else
			{
				size_t pos=0;
				std::cout << "Insert line like '0 1 P'(RAID5) or '0 1 2'(RAID0)" << std::endl;
				std::getline(std::cin,answer);
				answer += " ";
				while (pos != std::string::npos)
				{
					pos = answer.find_first_of(' ',pos+1);
					if (pos == std::string::npos)
						break;
					std::string ent = answer.substr(pos-1, 1);
					if (ent == "P")
					{
						tmp.push_back(mapEntry(true,inFiles.size()-1));
					}
					else
					{
						size_t t = std::atoll(ent.c_str());
						if (t >= stripingMap.at(0).size())
						{
							std::cout << "Invalid line" << std::endl;
						}
						tmp.push_back(mapEntry(false, t));
					}
				}
				if (tmp.size() != stripingMap.at(0).size())
				{
					std::cout << "Invalid line" << std::endl;
				}
				else
				{
					stripingMap.at(line) = tmp;
				}
			}
		}
	}
}

// Assembly:
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rdi, 0x1d0(%rsp)
movq %rsi, 0x1c8(%rsp)
movq 0x1d0(%rsp), %rax
movq %rax, 0xb8(%rsp)
movb $0x0, 0x1c7(%rsp)
leaq 0x1a0(%rsp), %rdi
callq 0x65c0
movb 0x1c7(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x12728
movq 0x42018(%rip), %rdi     # 0x53fb0
leaq 0x296c1(%rip), %rsi     # 0x3b660
callq 0x6420
movq %rax, 0xb0(%rsp)
jmp 0x11fae
movq 0xb0(%rsp), %rdi
movq 0x41fb3(%rip), %rsi     # 0x53f70
callq 0x6470
movq %rax, 0xa8(%rsp)
jmp 0x11fcc
movq 0xa8(%rsp), %rdi
movq 0x41f95(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x11fe2
movq 0x1c8(%rsp), %rax
movq %rax, 0x188(%rsp)
movq 0x188(%rsp), %rdi
callq 0x9fc0
movq %rax, 0x180(%rsp)
movq 0x188(%rsp), %rdi
callq 0x9ff0
movq %rax, 0x178(%rsp)
leaq 0x180(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0xa020
testb $0x1, %al
jne 0x1203a
jmp 0x1226a
leaq 0x180(%rsp), %rdi
callq 0xa060
movq %rax, 0x170(%rsp)
movl $0xa, %edi
callq 0x9fa0
movl %eax, 0xa4(%rsp)
jmp 0x12062
movl 0xa4(%rsp), %eax
movl %eax, 0x16c(%rsp)
movl 0x16c(%rsp), %esi
movq 0x41f32(%rip), %rdi     # 0x53fb0
callq 0x64d0
movq %rax, 0x98(%rsp)
jmp 0x1208d
movq 0x98(%rsp), %rdi
leaq 0x28478(%rip), %rsi     # 0x3a514
callq 0x6420
jmp 0x120a3
movq 0x170(%rsp), %rax
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rdi
callq 0xa070
movq %rax, 0x158(%rsp)
movq 0x160(%rsp), %rdi
callq 0xa0a0
movq %rax, 0x150(%rsp)
leaq 0x158(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0xa0d0
testb $0x1, %al
jne 0x120fb
jmp 0x12241
leaq 0x158(%rsp), %rdi
callq 0xa110
movq %rax, 0x148(%rsp)
movq 0x148(%rsp), %rax
testb $0x1, (%rax)
je 0x1218f
movl $0x4, %edi
callq 0x9fa0
movl %eax, 0x94(%rsp)
jmp 0x12130
movl 0x94(%rsp), %eax
movl %eax, 0x144(%rsp)
movl 0x144(%rsp), %esi
movq 0x41e64(%rip), %rdi     # 0x53fb0
callq 0x64d0
movq %rax, 0x88(%rsp)
jmp 0x1215b
movq 0x88(%rsp), %rdi
leaq 0x2a3ff(%rip), %rsi     # 0x3c569
callq 0x6420
jmp 0x12171
jmp 0x1222d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x198(%rsp)
movl %eax, 0x194(%rsp)
jmp 0x1273d
movl $0x4, %edi
callq 0x9fa0
movl %eax, 0x84(%rsp)
jmp 0x121a2
movl 0x84(%rsp), %eax
movl %eax, 0x140(%rsp)
movl 0x140(%rsp), %esi
movq 0x41df2(%rip), %rdi     # 0x53fb0
callq 0x64d0
movq %rax, 0x78(%rsp)
jmp 0x121ca
movq 0x148(%rsp), %rax
movl 0x4(%rax), %esi
leaq 0x120(%rsp), %rdi
callq 0xa120
jmp 0x121e4
movq 0x78(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x6390
jmp 0x121f8
leaq 0x120(%rsp), %rdi
callq 0x6260
jmp 0x1222d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x198(%rsp)
movl %eax, 0x194(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x6260
jmp 0x1273d
jmp 0x1222f
leaq 0x158(%rsp), %rdi
callq 0xa260
jmp 0x120dd
movq 0x41d68(%rip), %rdi     # 0x53fb0
movq 0x41d21(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x12256
jmp 0x12258
leaq 0x180(%rsp), %rdi
callq 0xa280
jmp 0x1201c
movq 0x41d3f(%rip), %rdi     # 0x53fb0
movq 0x41cf8(%rip), %rsi     # 0x53f70
callq 0x6470
movq %rax, 0x70(%rsp)
jmp 0x12284
movq 0x70(%rsp), %rdi
movq 0x41ce0(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x12297
movq 0x41d12(%rip), %rdi     # 0x53fb0
leaq 0x293d7(%rip), %rsi     # 0x3b67c
callq 0x6420
movq %rax, 0x68(%rsp)
jmp 0x122b1
movq 0x68(%rsp), %rdi
movq 0x41cb3(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x122c4
movq 0x41d0d(%rip), %rdi     # 0x53fd8
leaq 0x1a0(%rsp), %rsi
callq 0x60c0
jmp 0x122da
leaq 0x27e81(%rip), %rsi     # 0x3a162
leaq 0x1a0(%rsp), %rdi
callq 0x9e10
movb %al, 0x67(%rsp)
jmp 0x122f4
movb 0x67(%rsp), %al
testb $0x1, %al
jne 0x12346
jmp 0x122fe
leaq 0x2938c(%rip), %rsi     # 0x3b691
leaq 0x1a0(%rsp), %rdi
callq 0x9e10
movb %al, 0x66(%rsp)
jmp 0x12318
movb 0x66(%rsp), %al
testb $0x1, %al
jne 0x12346
jmp 0x12322
leaq 0x27e3f(%rip), %rsi     # 0x3a168
leaq 0x1a0(%rsp), %rdi
callq 0x9e10
movb %al, 0x65(%rsp)
jmp 0x1233c
movb 0x65(%rsp), %al
testb $0x1, %al
jne 0x12346
jmp 0x12353
movb $0x1, 0x1c7(%rsp)
jmp 0x12723
movq 0x41c56(%rip), %rdi     # 0x53fb0
leaq 0x29334(%rip), %rsi     # 0x3b695
callq 0x6420
movq %rax, 0x58(%rsp)
jmp 0x1236d
movq 0x58(%rsp), %rdi
movq 0x41bf7(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x12380
movq 0x41c51(%rip), %rdi     # 0x53fd8
leaq 0x1a0(%rsp), %rsi
callq 0x60c0
jmp 0x12396
leaq 0x1a0(%rsp), %rdi
callq 0x6180
movq %rax, %rdi
callq 0x6330
subq $0x1, %rax
movq %rax, 0x118(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x19ac0
movq 0x118(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x1c8(%rsp), %rdi
callq 0x9e80
movq %rax, %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
jb 0x12436
movq 0x41bbe(%rip), %rdi     # 0x53fb0
leaq 0x292b2(%rip), %rsi     # 0x3b6ab
callq 0x6420
movq %rax, 0x48(%rsp)
jmp 0x12405
movq 0x48(%rsp), %rdi
movq 0x41b5f(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x12418
jmp 0x12705
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x198(%rsp)
movl %eax, 0x194(%rsp)
jmp 0x12714
movq $0x0, 0xf8(%rsp)
movq 0x41b67(%rip), %rdi     # 0x53fb0
leaq 0x2926a(%rip), %rsi     # 0x3b6ba
callq 0x6420
movq %rax, 0x40(%rsp)
jmp 0x1245c
movq 0x40(%rsp), %rdi
movq 0x41b08(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x1246f
movq 0x41b62(%rip), %rdi     # 0x53fd8
leaq 0x1a0(%rsp), %rsi
callq 0x60c0
jmp 0x12485
leaq 0x28088(%rip), %rsi     # 0x3a514
leaq 0x1a0(%rsp), %rdi
callq 0x6400
jmp 0x1249b
jmp 0x1249d
cmpq $-0x1, 0xf8(%rsp)
je 0x12663
movq 0xf8(%rsp), %rdx
addq $0x1, %rdx
leaq 0x1a0(%rsp), %rdi
movl $0x20, %esi
callq 0x6270
movq %rax, 0xf8(%rsp)
cmpq $-0x1, 0xf8(%rsp)
jne 0x124e2
jmp 0x12663
movq 0xf8(%rsp), %rdx
decq %rdx
leaq 0xd8(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
movl $0x1, %ecx
callq 0x6450
jmp 0x12509
leaq 0x2a059(%rip), %rsi     # 0x3c569
leaq 0xd8(%rsp), %rdi
callq 0x9e10
movb %al, 0x3f(%rsp)
jmp 0x12523
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x1252d
jmp 0x12598
movq 0xb8(%rsp), %rdi
addq $0x40, %rdi
callq 0x9d50
movl %eax, %edx
decl %edx
leaq 0xd0(%rsp), %rdi
movl $0x1, %esi
callq 0x19b40
jmp 0x12556
leaq 0x100(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x19b10
jmp 0x1256d
jmp 0x12651
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x198(%rsp)
movl %eax, 0x194(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x6260
jmp 0x12714
leaq 0xd8(%rsp), %rdi
callq 0x6180
movq %rax, %rdi
callq 0x6330
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x1c8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa4b0
movq %rax, 0x30(%rsp)
jmp 0x125da
movq 0x30(%rsp), %rdi
callq 0xa4f0
movq %rax, %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
jb 0x12620
movq 0x419b8(%rip), %rdi     # 0x53fb0
leaq 0x290ed(%rip), %rsi     # 0x3b6ec
callq 0x6420
movq %rax, 0x20(%rsp)
jmp 0x1260b
movq 0x20(%rsp), %rdi
movq 0x41959(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x1261e
jmp 0x12620
movl 0xc8(%rsp), %edx
leaq 0xc0(%rsp), %rdi
xorl %esi, %esi
callq 0x19b40
jmp 0x12638
leaq 0x100(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x19b10
jmp 0x1264f
jmp 0x12651
leaq 0xd8(%rsp), %rdi
callq 0x6260
jmp 0x1249d
leaq 0x100(%rsp), %rdi
callq 0xa4f0
movq %rax, 0x10(%rsp)
movq 0x1c8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa4b0
movq %rax, 0x18(%rsp)
jmp 0x1268d
movq 0x18(%rsp), %rdi
callq 0xa4f0
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
je 0x126d3
movq 0x41905(%rip), %rdi     # 0x53fb0
leaq 0x2903a(%rip), %rsi     # 0x3b6ec
callq 0x6420
movq %rax, 0x8(%rsp)
jmp 0x126be
movq 0x8(%rsp), %rdi
movq 0x418a6(%rip), %rsi     # 0x53f70
callq 0x6470
jmp 0x126d1
jmp 0x12703
movq 0x1c8(%rsp), %rdi
movq 0x118(%rsp), %rsi
callq 0xa4b0
movq %rax, (%rsp)
jmp 0x126ee
movq (%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x1b080
jmp 0x12701
jmp 0x12703
jmp 0x12705
leaq 0x100(%rsp), %rdi
callq 0xa910
jmp 0x12723
leaq 0x100(%rsp), %rdi
callq 0xa910
jmp 0x1273d
jmp 0x11f7c
leaq 0x1a0(%rsp), %rdi
callq 0x6260
addq $0x1d8, %rsp            # imm = 0x1D8
retq
leaq 0x1a0(%rsp), %rdi
callq 0x6260
movq 0x198(%rsp), %rdi
callq 0x6750
nopw (%rax,%rax)