// File: /workspace/github_cpp_makefile_star2_O2/KitchMKelly[P]Team-9-OSU-Hackathon-Winter-2018/BawkBusterFunctions.cpp
// Function: moviesInCartMain(Cart&)
void moviesInCartMain(Cart& newCart)
{
	clearScreen();
	displayMoviesInCart(newCart);
	if(newCart.getNumCart() == 0)  //Andrew: if cart is empty, return to the main menu
		return;
	cout << endl;
	cout << "You Have " << newCart.getNumCart() << " Movies in Your Cart.\n";
	cout << "The Total Price is $" << 
	std::fixed << std::setprecision(2) << newCart.getTPrice() << "\n\n";
	cout << "Would You Like to:\n";
	//cout << "	1. Check Out?\n";
	cout << "	1. Clear Cart?\n";
	cout << "	2. Remove Last Item Added?\n";
	cout << "	3. Return to Main Menu to Checkout?\n";
	//cout << "	5. Exit the Program?\n\n";  Andrew: User should only be able to exit from the main menu
	cout << "Please Enter Your Choice (1 - 3)\n";

	int choice;
	cin >> choice;
	validateCartChoice(choice);
	//Perform the desired action

	switch (choice)
	{
		/*case 1:
		{	checkOutMain(newCart);
			break;
		}*/ //Herbert:Commented Out and Instead Make the User Enter The Main Menu To Leave
		case 1:
		{
			newCart.emptyCart();
			clearScreen();
			cout << "Your cart has been cleared!\n";
			systemPause();
			break;
		}
		case 2:
		{
			newCart.unAddToCart();  //removes last video from real cart
			systemPause();
			break;
		}
		case 3:
			break; //Andrew: this will automatically return to main menu, no need to add anything here

		//Andrew: User should only be able to exit the program from the main menu so I deleted the option
	}


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x28a1
movq %rbx, %rdi
callq 0x3fd0
movq %rbx, %rdi
callq 0x5154
testl %eax, %eax
je 0x38f2
movq 0x6812(%rip), %r14      # 0x9fd0
movq %r14, %rdi
callq 0x20d0
leaq 0x2e40(%rip), %rsi      # 0x660d
movq %r14, %rdi
callq 0x2180
movq %rax, %r15
movq %rbx, %rdi
callq 0x5154
movq %r15, %rdi
movl %eax, %esi
callq 0x2240
leaq 0x2e26(%rip), %rsi      # 0x6617
movq %rax, %rdi
callq 0x2180
leaq 0x2e2e(%rip), %rsi      # 0x662e
movq %r14, %rdi
callq 0x2180
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rcx
movl $0xfffffefb, %edx       # imm = 0xFFFFFEFB
andl 0x18(%r15,%rcx), %edx
orl $0x4, %edx
movl %edx, 0x18(%r15,%rcx)
movq -0x18(%rax), %rax
movq $0x2, 0x8(%r15,%rax)
movq %rbx, %rdi
callq 0x5174
movq %r15, %rdi
callq 0x2210
leaq 0x2dfb(%rip), %rsi      # 0x6643
movq %rax, %rdi
callq 0x2180
leaq 0x2def(%rip), %rsi      # 0x6646
movq %r14, %rdi
callq 0x2180
leaq 0x2df4(%rip), %rsi      # 0x665a
movq %r14, %rdi
callq 0x2180
leaq 0x2df6(%rip), %rsi      # 0x666b
movq %r14, %rdi
callq 0x2180
leaq 0x2e04(%rip), %rsi      # 0x6688
movq %r14, %rdi
callq 0x2180
leaq 0x2e1b(%rip), %rsi      # 0x66ae
movq %r14, %rdi
callq 0x2180
movq 0x673e(%rip), %rdi      # 0x9fe0
leaq -0x1c(%rbp), %r14
movq %r14, %rsi
callq 0x2100
movl (%r14), %edi
callq 0x40ed
movl (%r14), %eax
cmpl $0x2, %eax
je 0x38e5
cmpl $0x1, %eax
jne 0x38f2
movq %rbx, %rdi
callq 0x51ca
callq 0x28a1
movq 0x66f9(%rip), %rdi      # 0x9fd0
leaq 0x2df2(%rip), %rsi      # 0x66d0
callq 0x2180
jmp 0x38ed
movq %rbx, %rdi
callq 0x51ec
callq 0x28b9
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq