// File: nandakishoremmn2[P]multigrid/main.cpp
// Function: get_input(int, char**)
int *get_input(int argc, char *argv[])
{
	int *data = new int[7];
	if( argc >= 6 && argc <= 7 ) // If cmd args are present
	{
		for (int i = 0; i < argc-1; ++i)
		{
			data[i] = atoi(argv[i+1]);
		}
	}
	else 
	{
		std::cout<<"Enter Grid density (no. of points = (2^(grid density)+1)^2 :";
		std::cin>>data[0];
		std::cout<<"Enter no. of grids to use ( < grid density) :";
		std::cin>>data[1];	
		std::cout<<"Enter scheme (0, V cycle) (1, Mu cycle), (2, FMG) : ";
		std::cin>>data[2];
		switch(data[2])
		{
			case 0:
				std::cout<<"Enter v1, v2";
				std::cin>>data[3]>>data[4];
				break;
			case 1:
				std::cout<<"Enter v1, v2, mu";
				std::cin>>data[3]>>data[4]>>data[5];
				break;
			case 2:
				std::cout<<"Enter v0, v1, v2 : ";
				std::cin>>data[3]>>data[4]>>data[5];
				break;
			// default:
				// show_help_and_exit();
		}
	}

	return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1c, %edi
callq 0x1030
movq %rax, -0x18(%rbp)
cmpl $0x6, -0x4(%rbp)
jl 0x1400
cmpl $0x7, -0x4(%rbp)
jg 0x1400
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl -0x4(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x13fb
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1150
movl %eax, %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x13c0
jmp 0x1566
movq 0x6bc9(%rip), %rdi      # 0x7fd0
movq %rdi, -0x30(%rbp)
leaq 0x3bfe(%rip), %rsi      # 0x5010
callq 0x10c0
movq -0x18(%rbp), %rsi
movq 0x6bbe(%rip), %rdi      # 0x7fe0
movq %rdi, -0x28(%rbp)
callq 0x1080
movq -0x30(%rbp), %rdi
leaq 0x3c17(%rip), %rsi      # 0x504d
callq 0x10c0
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
callq 0x1080
movq -0x30(%rbp), %rdi
leaq 0x3c24(%rip), %rsi      # 0x507b
callq 0x10c0
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
callq 0x1080
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x20(%rbp)
testl %eax, %eax
je 0x1498
jmp 0x147d
movl -0x20(%rbp), %eax
subl $0x1, %eax
je 0x14d4
jmp 0x1487
movl -0x20(%rbp), %eax
subl $0x2, %eax
je 0x151d
jmp 0x1564
movq 0x6b31(%rip), %rdi      # 0x7fd0
leaq 0x3c0a(%rip), %rsi      # 0x50b0
callq 0x10c0
movq -0x18(%rbp), %rsi
addq $0xc, %rsi
movq 0x6b26(%rip), %rdi      # 0x7fe0
callq 0x1080
movq %rax, %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
callq 0x1080
jmp 0x1564
movq 0x6af5(%rip), %rdi      # 0x7fd0
leaq 0x3bdb(%rip), %rsi      # 0x50bd
callq 0x10c0
movq -0x18(%rbp), %rsi
addq $0xc, %rsi
movq 0x6aea(%rip), %rdi      # 0x7fe0
callq 0x1080
movq %rax, %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
callq 0x1080
movq %rax, %rdi
movq -0x18(%rbp), %rsi
addq $0x14, %rsi
callq 0x1080
jmp 0x1564
movq 0x6aac(%rip), %rdi      # 0x7fd0
leaq 0x3ba3(%rip), %rsi      # 0x50ce
callq 0x10c0
movq -0x18(%rbp), %rsi
addq $0xc, %rsi
movq 0x6aa1(%rip), %rdi      # 0x7fe0
callq 0x1080
movq %rax, %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
callq 0x1080
movq %rax, %rdi
movq -0x18(%rbp), %rsi
addq $0x14, %rsi
callq 0x1080
jmp 0x1566
movq -0x18(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq