// File: /workspace/github_cpp_makefile_star2_O1/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 0x45bf(%rip), %rdx      # 0x8645
leaq -0x60(%rbp), %rdi
movq %rdx, %rsi
callq 0x62ce
movq 0x6f47(%rip), %rdi      # 0xafe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
xorl %esi, %esi
callq 0x2200
movq 0x6f32(%rip), %rbx      # 0xafe0
movl $0x2710, %esi           # imm = 0x2710
movq %rbx, %rdi
movl $0xa, %edx
callq 0x20d0
callq 0x4fda
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %edx
movq 0x6efd(%rip), %r14      # 0xafe0
leaq -0x60(%rbp), %rsi
movq %r14, %rdi
callq 0x2250
leaq -0x90(%rbp), %r15
leaq -0x60(%rbp), %r12
movq 0x6ecf(%rip), %rbx      # 0xafd0
leaq -0x80(%rbp), %r13
movq %r12, %rdi
leaq 0x4318(%rip), %rsi      # 0x8427
callq 0x2070
testl %eax, %eax
je 0x4381
movq %r15, -0xa0(%rbp)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %rdi
callq 0x5e9e
movq -0xb0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x508b
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x416c
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2160
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0x42af
movl $0xa, %edx
movq %rbx, %rdi
leaq 0x3edb(%rip), %rsi      # 0x8064
callq 0x2180
movl $0xa, %edx
movq %rbx, %rdi
leaq 0x43dd(%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 0x42c1(%rip), %rsi      # 0x8482
callq 0x2180
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x428b
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 0x4291(%rip), %rsi      # 0x848b
callq 0x2180
movq -0x40(%rbp), %rsi
addq %r12, %rsi
movq %r13, %rdi
callq 0x6822
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 0x4261
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 0x41da
movq -0xa8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2b63
movq 0x6d3e(%rip), %r14      # 0xafe0
leaq -0x90(%rbp), %r15
leaq -0x60(%rbp), %r12
jmp 0x42fe
movl $0xa, %edx
movq %rbx, %rdi
leaq 0x3da6(%rip), %rsi      # 0x8064
callq 0x2180
movl $0x13, %edx
movq %rbx, %rdi
leaq 0x4294(%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 0x6368
movl $0x1f, %edx
movq %rbx, %rdi
leaq 0x426b(%rip), %rsi      # 0x8585
callq 0x2180
movl $0x24, %edx
movq %rbx, %rdi
leaq 0x40d4(%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 0x4105
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x439a
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 0x4412
jmp 0x43d8
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x43f9
movq -0x90(%rbp), %rsi
jmp 0x43f1
jmp 0x43d8
jmp 0x43d8
movq %rax, %rbx
jmp 0x43f9
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x43f9
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2160
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x4412
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2160
leaq -0x40(%rbp), %rdi
callq 0x2506
movq %rbx, %rdi
callq 0x2220