// File: /workspace/github_cpp_makefile_star2_O1/KitchMKelly[P]Team-9-OSU-Hackathon-Winter-2018/BawkBusterFunctions.cpp
// Function: titleSearchMain(Cart&, std::vector<Video, std::allocator<Video>>&)
void titleSearchMain(Cart& newCart, vector<Video>& videoList)  //Needed to pass the vector so it's available to search
{
	vector<Video> results;		//Initialize an empty vector of movie results
	string title = "";			//Initalize new string to hold user input

	cin.clear();				//Clear bad input flag
	cin.ignore(10000, '\n');	//Discard input
	clearScreen();				//Clear screen before displaying menu
	cout << "Search Movies by: Title\n" << endl;
	cout << "Enter the complete title of the movie you are searching for,\n" 
		<< "or enter '0' to return to Main Menu." << endl;

	getline(cin, title);		//Get user input, store in 'title'
	while (title != "0")		//As long as the user doesn't enter '0',
								//(s)he can search as many times as desired.
	{							
		//search for movie titles, return results (if any)
		titleSearchVector(videoList, results, title);
		if (results.empty())  //if results is empty, we didn't find it
		{
			clearScreen();
			cout << "Movie not found\n" << endl;
		}
		else
		{
			clearScreen();
			cout << "Movie found!!\n";  //results now holds the movie!!
			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 movie title,\n"
			 << "or enter '0' to return to Main Menu." << endl;
		getline(cin, title);
	}
	//TODO: Function to add user selections to cart
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, -0x90(%rbp)
movq %rdi, -0x88(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x4d0f(%rip), %rdx      # 0x8645
leaq -0x48(%rbp), %rdi
movq %rdx, %rsi
callq 0x62ce
movq 0x7697(%rip), %rdi      # 0xafe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
xorl %esi, %esi
callq 0x2200
movq 0x7682(%rip), %rbx      # 0xafe0
movl $0x2710, %esi           # imm = 0x2710
movq %rbx, %rdi
movl $0xa, %edx
callq 0x20d0
movq 0x7659(%rip), %rdi      # 0xafd0
leaq 0x46e6(%rip), %rsi      # 0x8064
movl $0xa, %edx
callq 0x2180
movq 0x7641(%rip), %r14      # 0xafd0
leaq 0x4a15(%rip), %rsi      # 0x83ab
movl $0x18, %edx
movq %r14, %rdi
callq 0x2180
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq 0x760f(%rip), %rdi      # 0xafd0
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq 0x75fb(%rip), %rdi      # 0xafd0
leaq 0x49e8(%rip), %rsi      # 0x83c4
movl $0x3d, %edx
callq 0x2180
movq 0x75e3(%rip), %r14      # 0xafd0
leaq 0x4a0e(%rip), %rsi      # 0x8402
movl $0x24, %edx
movq %r14, %rdi
callq 0x2180
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq 0x75b1(%rip), %r15      # 0xafd0
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %edx
movq 0x7593(%rip), %r12      # 0xafe0
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x2250
leaq -0x48(%rbp), %r14
leaq -0x80(%rbp), %r13
leaq -0x60(%rbp), %rbx
movq %r14, %rdi
leaq 0x49b8(%rip), %rsi      # 0x8427
callq 0x2070
testl %eax, %eax
je 0x3bd7
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x5e9e
movq -0x90(%rbp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x480f
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x3ac2
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2160
movq -0x60(%rbp), %rax
cmpq -0x58(%rbp), %rax
je 0x3b05
movl $0xa, %edx
movq %r15, %rdi
leaq 0x4589(%rip), %rsi      # 0x8064
callq 0x2180
movl $0xe, %edx
movq %r15, %rdi
leaq 0x494b(%rip), %rsi      # 0x843a
callq 0x2180
movq -0x88(%rbp), %rdi
movq %rbx, %rsi
callq 0x2b63
jmp 0x3b54
movl $0xa, %edx
movq %r15, %rdi
leaq 0x4550(%rip), %rsi      # 0x8064
callq 0x2180
movl $0x10, %edx
movq %r15, %rdi
leaq 0x4901(%rip), %rsi      # 0x8429
callq 0x2180
movq (%r15), %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 -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x6368
movl $0x22, %edx
movq %r15, %rdi
leaq 0x48da(%rip), %rsi      # 0x8449
callq 0x2180
movl $0x24, %edx
movq %r15, %rdi
leaq 0x487f(%rip), %rsi      # 0x8402
callq 0x2180
movq (%r15), %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 (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %edx
movq %r12, %rdi
movq %r14, %rsi
callq 0x2250
jmp 0x3a65
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x3bf0
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2160
leaq -0x60(%rbp), %rdi
callq 0x2506
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3c49
jmp 0x3c2d
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x3c30
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2160
jmp 0x3c30
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x3c49
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2160
leaq -0x60(%rbp), %rdi
callq 0x2506
movq %rbx, %rdi
callq 0x2220