// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, 0x8(%rsp)
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, 0x40(%rsp)
movb $0x0, (%rax)
movb $0x1, %al
movl %eax, 0x4(%rsp)
movq 0x13d1f(%rip), %r15     # 0x1dfb0
leaq 0x68(%rsp), %rbp
leaq 0xb264(%rip), %rbx      # 0x15501
testb $0x1, 0x4(%rsp)
je 0xa5f2
movq %r15, %rdi
leaq 0x9b0e(%rip), %rsi      # 0x13dc0
callq 0x5380
movq %rax, %rdi
callq 0x5180
movq %rax, %rdi
callq 0x5180
movq 0x8(%rsp), %rax
movq (%rax), %r14
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
cmpq 0x18(%rsp), %r14
je 0xa36a
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0xa, 0x10(%r15,%rax)
movq %r15, %rdi
leaq 0x9247(%rip), %rsi      # 0x13544
callq 0x5380
movq (%r14), %r12
movq 0x8(%r14), %r13
cmpq %r13, %r12
je 0xa359
movb (%r12), %al
movq (%r15), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x10(%r15,%rcx)
cmpb $0x1, %al
jne 0xa333
movq %r15, %rdi
movq %rbx, %rsi
callq 0x5380
jmp 0xa353
movl 0x4(%r12), %esi
movq %rbp, %rdi
callq 0x6f8f
movq %r15, %rdi
movq %rbp, %rsi
callq 0x52f0
movq %rbp, %rdi
callq 0x5160
addq $0x8, %r12
jmp 0xa309
movq %r15, %rdi
callq 0x5180
addq $0x18, %r14
jmp 0xa2d8
movq %r15, %rdi
callq 0x5180
leaq 0x48(%rsp), %r14
movq %rax, %rdi
callq 0x5180
movq %r15, %rdi
leaq 0x9a53(%rip), %rsi      # 0x13ddc
callq 0x5380
movq %rax, %rdi
callq 0x5180
movq 0x13c3b(%rip), %rdi     # 0x1dfd8
movq %r14, %rsi
callq 0x5090
movq %r14, %rdi
leaq 0x8de3(%rip), %rsi      # 0x13192
callq 0x6f43
testb %al, %al
jne 0xa5e5
movq %r14, %rdi
leaq 0x9a2b(%rip), %rsi      # 0x13df1
callq 0x6f43
testb %al, %al
jne 0xa5e5
movq %r14, %rdi
leaq 0x8dbb(%rip), %rsi      # 0x13198
callq 0x6f43
testb %al, %al
jne 0xa5e5
movq %r15, %rdi
leaq 0x9a01(%rip), %rsi      # 0x13df5
callq 0x5380
movq %rax, %rdi
callq 0x5180
movq 0x13bd0(%rip), %rdi     # 0x1dfd8
movq %r14, %rsi
callq 0x5090
movq 0x48(%rsp), %rdi
callq 0x52a0
movq %rax, %rsi
decq %rsi
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cmpq %rax, %rsi
jae 0xa563
movq %rsi, 0x18(%rsp)
movq %r15, %rdi
leaq 0x99c0(%rip), %rsi      # 0x13e1a
callq 0x5380
movq %rax, %rdi
callq 0x5180
movq 0x13b6a(%rip), %rdi     # 0x1dfd8
leaq 0x48(%rsp), %rsi
callq 0x5090
leaq 0x48(%rsp), %rdi
leaq 0x90c0(%rip), %rsi      # 0x13544
callq 0x5630
xorl %r14d, %r14d
incq %r14
leaq 0x48(%rsp), %r12
movq %r12, %rdi
pushq $0x20
popq %rsi
movq %r14, %rdx
callq 0x5480
cmpq $-0x1, %rax
je 0xa57c
movq %rax, %r14
leaq -0x1(%rax), %rdx
movq %rbp, %rdi
movq %r12, %rsi
pushq $0x1
popq %rcx
callq 0x53b0
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x6f43
testb %al, %al
je 0xa4fd
movq 0x40(%rsp), %rcx
movq 0x48(%rcx), %rax
subq 0x40(%rcx), %rax
shrq $0x3, %rax
decl %eax
movb $0x1, 0x10(%rsp)
movl %eax, 0x14(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xe3ba
jmp 0xa556
movq 0x68(%rsp), %rdi
callq 0x52a0
movq %rax, %r13
movq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x7028
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
cmpq %rcx, %r13
jb 0xa53d
movq %r15, %rdi
leaq 0x991c(%rip), %rsi      # 0x13e4c
callq 0x5380
movq %rax, %rdi
callq 0x5180
movb $0x0, 0x10(%rsp)
movl %r13d, 0x14(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xe3ba
movq %rbp, %rdi
callq 0x5160
jmp 0xa48c
movq %r15, %rdi
leaq 0x989e(%rip), %rsi      # 0x13e0b
callq 0x5380
movq %rax, %rdi
callq 0x5180
jmp 0xa5d6
movq 0x20(%rsp), %r12
movq 0x28(%rsp), %r14
movq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x7028
subq %r12, %r14
movq 0x8(%rax), %rcx
subq (%rax), %rcx
cmpq %rcx, %r14
jne 0xa5bf
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x7028
movq %rax, %rdi
leaq 0x20(%rsp), %rsi
callq 0xc010
jmp 0xa5d6
movq %r15, %rdi
leaq 0x9883(%rip), %rsi      # 0x13e4c
callq 0x5380
movq %rax, %rdi
callq 0x5180
leaq 0x20(%rsp), %rdi
callq 0x7140
jmp 0xa29d
movl $0x0, 0x4(%rsp)
jmp 0xa29d
leaq 0x48(%rsp), %rdi
callq 0x5160
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa618
jmp 0xa618
jmp 0xa61d
jmp 0xa61d
jmp 0xa649
movq %rax, %rbx
jmp 0xa62a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x5160
leaq 0x20(%rsp), %rdi
callq 0x7140
jmp 0xa64c
jmp 0xa649
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x5160
jmp 0xa64c
jmp 0xa649
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x5160
movq %rbx, %rdi
callq 0x5610