// File: /workspace/github_cpp_makefile_star2_O3/KitchMKelly[P]Team-9-OSU-Hackathon-Winter-2018/BawkBusterFunctions.cpp
// Function: directorSearchMain(Cart&, std::vector<Video, std::allocator<Video>>&)
void directorSearchMain(Cart& newCart, vector<Video>& videoList)
{
	vector<Video> results;		//Initialize an empty vector of movie results
	string director = "";			//Initalize new string to hold user input

	cin.clear();				//Clear bad input flag
	cin.ignore(10000, '\n');	//Discard input
	displayDirectorSearchMenu();

	getline(cin, director);		//Get user input, store in 'title'
	while (director != "0")		//As long as the user doesn't enter '0',
								//(s)he can search as many times as desired.
	{							
		//search for movie directors, return results (if any)
		directorSearchVector(videoList, results, director);
		if (results.empty())  //if results is empty, we didn't find it
		{
			clearScreen();
			cout << "Director not found\n" << endl;
		}
		else
		{
			clearScreen();
			cout << "Movies by " << director <<" found:\n";  //results now holds the movie!!
			for (int i = 0; i < results.size(); i++)
			{
				cout << i+1 << ". " << results[i].getTitle() << endl;
			}
			addToCart(newCart, results);	//User decides if (s)he wants to add the movie to the cart,
							//and continues searching.
		}
		results.clear(); //delete everything from the vector to prepare for the next search
		cout << "Please enter another director,\n"
			 << "or enter '0' to return to Main Menu." << endl;
		getline(cin, director);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, -0xb0(%rbp)
movq %rdi, -0xa8(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x4546(%rip), %rdx      # 0x8645
leaq -0x60(%rbp), %rdi
movq %rdx, %rsi
callq 0x63ca
movq 0x6ece(%rip), %rdi      # 0xafe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
xorl %esi, %esi
callq 0x2200
movq 0x6eb9(%rip), %rbx      # 0xafe0
movl $0x2710, %esi           # imm = 0x2710
movq %rbx, %rdi
movl $0xa, %edx
callq 0x20d0
callq 0x5095
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %edx
movq 0x6e84(%rip), %r14      # 0xafe0
leaq -0x60(%rbp), %rsi
movq %r14, %rdi
callq 0x2250
leaq -0x90(%rbp), %r15
leaq -0x60(%rbp), %r12
movq 0x6e56(%rip), %rbx      # 0xafd0
leaq -0x80(%rbp), %r13
movq %r12, %rdi
leaq 0x429f(%rip), %rsi      # 0x8427
callq 0x2070
testl %eax, %eax
je 0x43fa
movq %r15, -0xa0(%rbp)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %rdi
callq 0x5f92
movq -0xb0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x5146
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x41e5
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2160
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0x4328
movl $0xa, %edx
movq %rbx, %rdi
leaq 0x3e62(%rip), %rsi      # 0x8064
callq 0x2180
movl $0xa, %edx
movq %rbx, %rdi
leaq 0x4364(%rip), %rsi      # 0x857a
callq 0x2180
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %rbx, %rdi
callq 0x2180
movl $0x8, %edx
movq %rax, %rdi
leaq 0x4248(%rip), %rsi      # 0x8482
callq 0x2180
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x4304
xorl %r12d, %r12d
xorl %r14d, %r14d
incq %r14
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2210
movq %rax, %r15
movl $0x2, %edx
movq %rax, %rdi
leaq 0x4218(%rip), %rsi      # 0x848b
callq 0x2180
movq -0x40(%rbp), %rsi
addq %r12, %rsi
movq %r13, %rdi
callq 0x6922
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq %r15, %rdi
callq 0x2180
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x42da
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2160
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
sarq $0x3, %rax
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rax
addq $0x98, %r12
cmpq %r14, %rax
ja 0x4253
movq -0xa8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2b60
movq 0x6cc5(%rip), %r14      # 0xafe0
leaq -0x90(%rbp), %r15
leaq -0x60(%rbp), %r12
jmp 0x4377
movl $0xa, %edx
movq %rbx, %rdi
leaq 0x3d2d(%rip), %rsi      # 0x8064
callq 0x2180
movl $0x13, %edx
movq %rbx, %rdi
leaq 0x421b(%rip), %rsi      # 0x8566
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq -0x40(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x6468
movl $0x1f, %edx
movq %rbx, %rdi
leaq 0x41f2(%rip), %rsi      # 0x8585
callq 0x2180
movl $0x24, %edx
movq %rbx, %rdi
leaq 0x405b(%rip), %rsi      # 0x8402
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x2250
jmp 0x417e
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x4413
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2160
leaq -0x40(%rbp), %rdi
callq 0x2506
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x448b
jmp 0x4451
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x4472
movq -0x90(%rbp), %rsi
jmp 0x446a
jmp 0x4451
jmp 0x4451
movq %rax, %rbx
jmp 0x4472
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x4472
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2160
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x448b
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2160
leaq -0x40(%rbp), %rdi
callq 0x2506
movq %rbx, %rdi
callq 0x2220