// File: 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
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x2680
leaq -0x49(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x2350
movq -0xb0(%rbp), %rdx
leaq 0x5537(%rip), %rsi      # 0x9641
leaq -0x48(%rbp), %rdi
callq 0x5590
jmp 0x4115
leaq -0x49(%rbp), %rdi
callq 0x2240
movq 0x8ebb(%rip), %rdi      # 0xcfe0
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x2320
jmp 0x4138
movq 0x8ea1(%rip), %rdi      # 0xcfe0
movl $0x2710, %esi           # imm = 0x2710
movl $0xa, %edx
callq 0x2160
jmp 0x4150
callq 0x4eb0
jmp 0x4157
movq 0x8e82(%rip), %rdi      # 0xcfe0
leaq -0x48(%rbp), %rsi
callq 0x2050
jmp 0x4169
jmp 0x416b
leaq 0x52b1(%rip), %rsi      # 0x9423
leaq -0x48(%rbp), %rdi
callq 0x5640
movb %al, -0xb1(%rbp)
jmp 0x4183
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x4192
jmp 0x442a
movq -0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x20e0
jmp 0x41ac
movq -0xc0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x4f10
jmp 0x41c2
leaq -0x80(%rbp), %rdi
callq 0x2150
leaq -0x28(%rbp), %rdi
callq 0x5670
testb $0x1, %al
jne 0x41dd
jmp 0x425f
callq 0x2de0
jmp 0x41e4
movq 0x8de5(%rip), %rdi      # 0xcfd0
leaq 0x5370(%rip), %rsi      # 0x9562
callq 0x21f0
movq %rax, -0xc8(%rbp)
jmp 0x4200
movq -0xc8(%rbp), %rdi
movq 0x8db2(%rip), %rsi      # 0xcfc0
callq 0x2220
jmp 0x4215
jmp 0x43bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x2240
jmp 0x444e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4445
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x2150
jmp 0x4445
callq 0x2de0
jmp 0x4266
movq 0x8d63(%rip), %rdi      # 0xcfd0
leaq 0x5302(%rip), %rsi      # 0x9576
callq 0x21f0
movq %rax, -0xd0(%rbp)
jmp 0x4282
movq -0xd0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x21e0
movq %rax, -0xd8(%rbp)
jmp 0x429b
movq -0xd8(%rbp), %rdi
leaq 0x51d5(%rip), %rsi      # 0x947e
callq 0x21f0
jmp 0x42b0
movl $0x0, -0x84(%rbp)
movslq -0x84(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5400
movq %rax, %rcx
movq -0xe0(%rbp), %rax
cmpq %rcx, %rax
jae 0x43ac
movl -0x84(%rbp), %esi
incl %esi
movq 0x8cdd(%rip), %rdi      # 0xcfd0
callq 0x2330
movq %rax, -0xe8(%rbp)
jmp 0x4301
movq -0xe8(%rbp), %rdi
leaq 0x5178(%rip), %rsi      # 0x9487
callq 0x21f0
movq %rax, -0xf0(%rbp)
jmp 0x431d
movslq -0x84(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x5430
movq %rax, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x7cc0
jmp 0x433e
movq -0xf0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x21e0
movq %rax, -0xf8(%rbp)
jmp 0x435a
movq -0xf8(%rbp), %rdi
movq 0x8c58(%rip), %rsi      # 0xcfc0
callq 0x2220
jmp 0x436f
leaq -0xa8(%rbp), %rdi
callq 0x2150
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x42ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x2150
jmp 0x4445
movq -0x8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x2e60
jmp 0x43bb
jmp 0x43bd
leaq -0x28(%rbp), %rdi
callq 0x56b0
movq 0x8c03(%rip), %rdi      # 0xcfd0
leaq 0x51ad(%rip), %rsi      # 0x9581
callq 0x21f0
movq %rax, -0x100(%rbp)
jmp 0x43e2
movq -0x100(%rbp), %rdi
leaq 0x500e(%rip), %rsi      # 0x93fe
callq 0x21f0
movq %rax, -0x108(%rbp)
jmp 0x43fe
movq -0x108(%rbp), %rdi
movq 0x8bb4(%rip), %rsi      # 0xcfc0
callq 0x2220
jmp 0x4413
movq 0x8bc6(%rip), %rdi      # 0xcfe0
leaq -0x48(%rbp), %rsi
callq 0x2050
jmp 0x4425
jmp 0x416b
leaq -0x48(%rbp), %rdi
callq 0x2150
leaq -0x28(%rbp), %rdi
callq 0x26a0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x2150
leaq -0x28(%rbp), %rdi
callq 0x26a0
movq -0x58(%rbp), %rdi
callq 0x2340