// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH15_ObjectOrientedProgramming/examples/vecBasket.cc
// Function: main
int main ()
{
	Quote base("0-201-82470-1", 50);  
	Bulk_quote bulk("0-201-54848-8", 50, 10, .25); 

	// ok: but probably not what is wanted---
	//     the objects in basket have no derived members
	vector<Quote> basket;
	basket.push_back(Quote("0-201-82470-1", 50));

	// ok, but copies only the Quote part of the object into basket
	basket.push_back(Bulk_quote("0-201-54848-8", 50, 10, .25));  
	
	// calls version defined by Quote, prints 750, i.e., 15 * $50
	cout << basket.back().net_price(15) << endl;  
	
	// better approach---store shared_ptrs
	vector<shared_ptr<Quote>> basket2;
	
	basket2.push_back(make_shared<Quote>("0-201-82470-1", 50));  
	basket2.push_back(
		make_shared<Bulk_quote>("0-201-54848-8", 50, 10, .25));  
	
	// calls the version defined by Quote; 
	// prints 562.5, i.e., 15 * $50 less the discount
	cout << basket2.back()->net_price(15) << endl; 

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
leaq -0xd0(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1c8e(%rip), %rsi      # 0x4030
leaq 0x1c94(%rip), %rdx      # 0x403d
leaq -0xe0(%rbp), %rdi
callq 0x2c3c
leaq 0x4854(%rip), %rax      # 0x6c10
leaq -0x138(%rbp), %rdi
movq %rax, -0x8(%rdi)
leaq -0x128(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
addq %rsi, %rdx
callq 0x2b24
movabsq $0x4049000000000000, %r14 # imm = 0x4049000000000000
movq %r14, -0x118(%rbp)
movq -0xe0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2414
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x2110
leaq -0x80(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1c1b(%rip), %rsi      # 0x403e
leaq 0x1c21(%rip), %rdx      # 0x404b
leaq -0x90(%rbp), %rdi
callq 0x2c3c
leaq -0xd8(%rbp), %rdi
leaq 0x47cc(%rip), %rax      # 0x6c10
movq %rax, -0x8(%rdi)
leaq -0xc8(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
addq %rsi, %rdx
callq 0x2b24
movq %r14, -0xb8(%rbp)
movq $0xa, -0xb0(%rbp)
movabsq $0x3fd0000000000000, %r13 # imm = 0x3FD0000000000000
movq %r13, -0xa8(%rbp)
leaq 0x4875(%rip), %r12      # 0x6d08
addq $0x10, %r12
movq %r12, -0xe0(%rbp)
movq -0x90(%rbp), %rdi
cmpq %rbx, %rdi
je 0x24b6
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2110
xorps %xmm0, %xmm0
movaps %xmm0, -0x100(%rbp)
movq $0x0, -0xf0(%rbp)
leaq -0x40(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1b56(%rip), %rsi      # 0x4030
leaq 0x1b5c(%rip), %rdx      # 0x403d
leaq -0x50(%rbp), %rdi
callq 0x2c3c
leaq -0x88(%rbp), %rdi
leaq 0x4718(%rip), %rax      # 0x6c10
movq %rax, -0x8(%rdi)
leaq -0x78(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
callq 0x2b24
leaq -0x90(%rbp), %rsi
movq %r14, 0x28(%rsi)
leaq -0x100(%rbp), %rdi
callq 0x2cda
leaq 0x46de(%rip), %rax      # 0x6c10
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x2551
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2110
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2566
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2110
leaq -0x50(%rbp), %rdi
movq %rbx, (%rdi)
leaq 0x1aca(%rip), %rsi      # 0x403e
leaq 0x1ad0(%rip), %rdx      # 0x404b
callq 0x2c3c
leaq -0x88(%rbp), %rdi
leaq 0x4682(%rip), %rax      # 0x6c10
movq %rax, -0x8(%rdi)
movq %r15, (%rdi)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
callq 0x2b24
leaq -0x90(%rbp), %rsi
movq %r14, 0x28(%rsi)
movq $0xa, 0x30(%rsi)
movq %r13, 0x38(%rsi)
movq %r12, (%rsi)
leaq -0x100(%rbp), %rdi
callq 0x2cda
leaq 0x463e(%rip), %rax      # 0x6c10
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x25f1
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2110
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2606
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2110
movq -0xf8(%rbp), %rdi
movq -0x30(%rdi), %rax
addq $-0x30, %rdi
movl $0xf, %esi
callq *0x10(%rax)
movq 0x49b4(%rip), %rdi      # 0x6fd8
callq 0x2170
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
xorps %xmm0, %xmm0
movaps %xmm0, -0x90(%rbp)
xorl %eax, %eax
movq %rax, -0x80(%rbp)
leaq -0xa0(%rbp), %r8
movl $0x32, (%r8)
leaq -0x48(%rbp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x19b0(%rip), %rcx      # 0x4030
leaq -0x50(%rbp), %rsi
leaq -0x108(%rbp), %rbx
movq %rbx, %rdx
callq 0x3038
leaq -0x90(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x31fc
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x26b1
callq 0x2bd0
leaq -0x110(%rbp), %r8
movl $0x32, (%r8)
leaq -0x10c(%rbp), %r9
movl $0xa, (%r9)
movq %r13, -0x108(%rbp)
leaq -0x98(%rbp), %rdi
movq $0x0, -0x8(%rdi)
movq %rbx, (%rsp)
leaq 0x1950(%rip), %rcx      # 0x403e
leaq -0xa0(%rbp), %rsi
leaq -0x29(%rbp), %rdx
callq 0x33c4
movups -0xa0(%rbp), %xmm0
leaq -0x50(%rbp), %rsi
movups %xmm0, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, -0xa0(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x31fc
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x2730
callq 0x2bd0
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x2741
callq 0x2bd0
movq -0x88(%rbp), %rax
movq -0x10(%rax), %rdi
movq (%rdi), %rax
movl $0xf, %esi
callq *0x10(%rax)
movq 0x487a(%rip), %rdi      # 0x6fd8
callq 0x2170
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
leaq -0x90(%rbp), %rdi
callq 0x29a0
leaq -0x100(%rbp), %rdi
callq 0x29fc
leaq 0x4464(%rip), %rax      # 0x6c10
movq %rax, -0xe0(%rbp)
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x27d5
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2110
leaq 0x4434(%rip), %rax      # 0x6c10
movq %rax, -0x140(%rbp)
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x2805
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x2110
xorl %eax, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r13
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x282a
callq 0x2bd0
movq -0x98(%rbp), %rdi
jmp 0x283f
jmp 0x28ec
movq %rax, %r13
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x28ef
callq 0x2bd0
jmp 0x28ef
jmp 0x28ec
jmp 0x2860
jmp 0x288b
jmp 0x28fd
movq %rax, %r13
leaq 0x43a6(%rip), %rax      # 0x6c10
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x288e
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2110
jmp 0x288e
movq %rax, %r13
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2900
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2110
jmp 0x2900
jmp 0x28fd
movq %rax, %r13
movq -0x90(%rbp), %rdi
cmpq %rbx, %rdi
je 0x293c
movq -0x80(%rbp), %rsi
jmp 0x2934
movq %rax, %r13
jmp 0x293c
movq %rax, %r13
movq -0xe0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x296c
movq -0xd0(%rbp), %rsi
jmp 0x2964
movq %rax, %r13
jmp 0x296c
movq %rax, %r13
leaq -0x90(%rbp), %rdi
callq 0x29a0
jmp 0x2900
movq %rax, %r13
leaq -0x100(%rbp), %rdi
callq 0x29fc
leaq 0x42fd(%rip), %rax      # 0x6c10
movq %rax, -0xe0(%rbp)
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x293c
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2110
leaq 0x42cd(%rip), %rax      # 0x6c10
movq %rax, -0x140(%rbp)
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x296c
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x2110
movq %r13, %rdi
callq 0x2190