// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x6b1f(%rip), %r14      # 0xafd0
leaq 0x3bac(%rip), %rsi      # 0x8064
movl $0xa, %edx
movq %r14, %rdi
callq 0x2180
movq %rbx, %rdi
callq 0x5335
movq %rbx, %rdi
callq 0x6f88
testl %eax, %eax
je 0x466e
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leaq 0x4102(%rip), %rsi      # 0x860d
movl $0x9, %edx
movq %r14, %rdi
callq 0x2180
movq %rbx, %rdi
callq 0x6f88
movq %r14, %rdi
movl %eax, %esi
callq 0x2210
leaq 0x40e6(%rip), %rsi      # 0x8617
movl $0x16, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x40e9(%rip), %rsi      # 0x862e
movl $0x14, %edx
movq %r14, %rdi
callq 0x2180
movq (%r14), %rax
movq -0x18(%rax), %rcx
movl $0xfffffefb, %edx       # imm = 0xFFFFFEFB
andl 0x18(%r14,%rcx), %edx
orl $0x4, %edx
movl %edx, 0x18(%r14,%rcx)
movq -0x18(%rax), %rax
movq $0x2, 0x8(%r14,%rax)
movq %rbx, %rdi
callq 0x6fa8
movq %r14, %rdi
callq 0x21e0
leaq 0x40b4(%rip), %rsi      # 0x8643
movl $0x2, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x40a3(%rip), %rsi      # 0x8646
movl $0x13, %edx
movq %r14, %rdi
callq 0x2180
leaq 0x40a3(%rip), %rsi      # 0x865a
movl $0x10, %edx
movq %r14, %rdi
callq 0x2180
leaq 0x40a0(%rip), %rsi      # 0x866b
movl $0x1c, %edx
movq %r14, %rdi
callq 0x2180
leaq 0x40a9(%rip), %rsi      # 0x8688
movl $0x25, %edx
movq %r14, %rdi
callq 0x2180
leaq 0x40bb(%rip), %rsi      # 0x86ae
movl $0x21, %edx
movq %r14, %rdi
callq 0x2180
movq 0x69d9(%rip), %rdi      # 0xafe0
leaq -0x14(%rbp), %r14
movq %r14, %rsi
callq 0x20c0
movl (%r14), %edi
callq 0x550f
movl (%r14), %eax
cmpl $0x2, %eax
je 0x4661
cmpl $0x1, %eax
jne 0x466e
movq %rbx, %rdi
callq 0x6ffe
movq 0x6999(%rip), %rbx      # 0xafd0
leaq 0x3a26(%rip), %rsi      # 0x8064
movl $0xa, %edx
movq %rbx, %rdi
callq 0x2180
leaq 0x407e(%rip), %rsi      # 0x86d0
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x2180
jmp 0x4669
movq %rbx, %rdi
callq 0x702a
callq 0x2b0a
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq