// File: /workspace/github_cpp_makefile_star2_O1/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 0x6b98(%rip), %r14      # 0xafd0
leaq 0x3c25(%rip), %rsi      # 0x8064
movl $0xa, %edx
movq %r14, %rdi
callq 0x2180
movq %rbx, %rdi
callq 0x5269
movq %rbx, %rdi
callq 0x6e84
testl %eax, %eax
je 0x45f5
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 0x417b(%rip), %rsi      # 0x860d
movl $0x9, %edx
movq %r14, %rdi
callq 0x2180
movq %rbx, %rdi
callq 0x6e84
movq %r14, %rdi
movl %eax, %esi
callq 0x2210
leaq 0x415f(%rip), %rsi      # 0x8617
movl $0x16, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x4162(%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 0x6ea4
movq %r14, %rdi
callq 0x21e0
leaq 0x412d(%rip), %rsi      # 0x8643
movl $0x2, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x411c(%rip), %rsi      # 0x8646
movl $0x13, %edx
movq %r14, %rdi
callq 0x2180
leaq 0x411c(%rip), %rsi      # 0x865a
movl $0x10, %edx
movq %r14, %rdi
callq 0x2180
leaq 0x4119(%rip), %rsi      # 0x866b
movl $0x1c, %edx
movq %r14, %rdi
callq 0x2180
leaq 0x4122(%rip), %rsi      # 0x8688
movl $0x25, %edx
movq %r14, %rdi
callq 0x2180
leaq 0x4134(%rip), %rsi      # 0x86ae
movl $0x21, %edx
movq %r14, %rdi
callq 0x2180
movq 0x6a52(%rip), %rdi      # 0xafe0
leaq -0x14(%rbp), %r14
movq %r14, %rsi
callq 0x20c0
movl (%r14), %edi
callq 0x5443
movl (%r14), %eax
cmpl $0x2, %eax
je 0x45e8
cmpl $0x1, %eax
jne 0x45f5
movq %rbx, %rdi
callq 0x6efa
movq 0x6a12(%rip), %rbx      # 0xafd0
leaq 0x3a9f(%rip), %rsi      # 0x8064
movl $0xa, %edx
movq %rbx, %rdi
callq 0x2180
leaq 0x40f7(%rip), %rsi      # 0x86d0
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x2180
jmp 0x45f0
movq %rbx, %rdi
callq 0x6f26
callq 0x2b0d
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq