// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH15_ObjectOrientedProgramming/examples/sample.cc
// Function: main
int main()
{
	Quote basic("0-201-54848-8", 45);
	Bulk_quote bulk("0-201-82470-1", 45, 3, .15);

	// basic has type Quote; bulk has type Bulk_quote
	print_total(cout, basic, 20); // calls Quote version of net_price 
	print_total(cout, bulk, 20);  // calls Bulk_quote version of net_price 
	Quote base("0-201-82470-1", 50);
	Bulk_quote derived("0-201-82470-1", 50, 5, .19);
	cout << derived.net_price(20); // calls Bulk_quote::net_price
	cout << endl;

	base = derived;        // copies the Quote part of derived into base
	cout << base.net_price(20);    // calls Quote::net_price
	cout << endl;

	Quote &item = derived; // dynamic and static types of item differ
	cout << item.net_price(20);    // calls Bulk_quote::net_price

	item.isbn();           // isbn is not virtual, calls Bulk::isbn
	cout << 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 -0x98(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xd7e(%rip), %rsi       # 0x3030
leaq 0xd84(%rip), %rdx       # 0x303d
leaq -0xa8(%rbp), %rdi
callq 0x2998
leaq 0x2a14(%rip), %r12      # 0x4ce0
leaq -0x120(%rbp), %rdi
movq %r12, -0x8(%rdi)
leaq -0x110(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
addq %rsi, %rdx
callq 0x28fa
movabsq $0x4046800000000000, %rbx # imm = 0x4046800000000000
movq %rbx, -0x100(%rbp)
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x2324
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x20c0
leaq -0x58(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xd0b(%rip), %rsi       # 0x303e
leaq 0xd11(%rip), %rdx       # 0x304b
leaq -0x68(%rbp), %rdi
callq 0x2998
leaq -0xa0(%rbp), %rdi
movq %r12, -0x8(%rdi)
leaq -0x90(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
callq 0x28fa
movq %rbx, -0x80(%rbp)
movq $0x3, -0x78(%rbp)
movabsq $0x3fc3333333333333, %rax # imm = 0x3FC3333333333333
movq %rax, -0x70(%rbp)
leaq 0x2986(%rip), %r15      # 0x4d10
addq $0x10, %r15
movq %r15, -0xa8(%rbp)
movq -0x68(%rbp), %rdi
cmpq %r14, %rdi
je 0x23aa
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x20c0
movq 0x2c27(%rip), %rdi      # 0x4fd8
leaq -0x128(%rbp), %rsi
movl $0x14, %edx
callq 0x2a38
movq 0x2c0f(%rip), %rdi      # 0x4fd8
leaq -0xa8(%rbp), %rsi
movl $0x14, %edx
callq 0x2a38
leaq -0x68(%rbp), %rdi
movq %r14, (%rdi)
leaq 0xc56(%rip), %rsi       # 0x303e
leaq 0xc5c(%rip), %rdx       # 0x304b
callq 0x2998
leaq -0xf0(%rbp), %rbx
movq %r12, -0x8(%rbx)
leaq -0xe0(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x28fa
movabsq $0x4049000000000000, %r12 # imm = 0x4049000000000000
movq %r12, -0xd0(%rbp)
movq -0x68(%rbp), %rdi
cmpq %r14, %rdi
je 0x2443
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x20c0
leaq -0xb8(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0xbe9(%rip), %rsi       # 0x303e
leaq 0xbef(%rip), %rdx       # 0x304b
leaq -0xc8(%rbp), %rdi
callq 0x2998
leaq -0x60(%rbp), %r14
leaq 0x286d(%rip), %rax      # 0x4ce0
movq %rax, -0x8(%r14)
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x28fa
movq %r12, -0x40(%rbp)
movq $0x5, -0x38(%rbp)
movabsq $0x3fc851eb851eb852, %rax # imm = 0x3FC851EB851EB852
movq %rax, -0x30(%rbp)
movq %r15, -0x68(%rbp)
movq -0xc8(%rbp), %rdi
cmpq %r13, %rdi
je 0x24d1
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x20c0
leaq -0x68(%rbp), %rdi
movl $0x14, %esi
leaq 0x27ff(%rip), %r12      # 0x4ce0
callq 0x2b5c
movq 0x2aeb(%rip), %r15      # 0x4fd8
movq %r15, %rdi
callq 0x20f0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x20a0
movsbl %al, %esi
movq 0x2ac5(%rip), %rdi      # 0x4fd8
callq 0x2030
movq %rax, %rdi
callq 0x2060
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2040
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
mulsd 0xac8(%rip), %xmm0      # 0x3008
movq 0x2a91(%rip), %rbx      # 0x4fd8
movq %rbx, %rdi
callq 0x20f0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x20a0
movsbl %al, %esi
movq 0x2a6b(%rip), %rdi      # 0x4fd8
callq 0x2030
movq %rax, %rdi
callq 0x2060
leaq -0x68(%rbp), %rdi
movq (%rdi), %rax
movl $0x14, %esi
callq *0x10(%rax)
movq 0x2a48(%rip), %rbx      # 0x4fd8
movq %rbx, %rdi
callq 0x20f0
leaq -0x138(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
addq %rsi, %rdx
leaq -0x148(%rbp), %rdi
callq 0x28fa
movq -0x148(%rbp), %rdi
cmpq %r14, %rdi
je 0x25d5
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x20c0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x20a0
movsbl %al, %esi
movq 0x29e5(%rip), %rdi      # 0x4fd8
callq 0x2030
movq %rax, %rdi
callq 0x2060
movq %r12, -0x68(%rbp)
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x261d
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x20c0
movq %r12, -0xf8(%rbp)
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x2646
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x20c0
movq %r12, -0xa8(%rbp)
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x266f
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x20c0
movq %r12, -0x128(%rbp)
movq -0x120(%rbp), %rdi
leaq -0x110(%rbp), %rax
cmpq %rax, %rdi
je 0x2698
movq -0x110(%rbp), %rsi
incq %rsi
callq 0x20c0
xorl %eax, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r13, %rdi
je 0x2764
movq -0xb8(%rbp), %rsi
jmp 0x275c
movq %rax, %rbx
jmp 0x2764
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r14, %rdi
je 0x2794
movq -0x58(%rbp), %rsi
jmp 0x278c
jmp 0x2736
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r14, %rdi
je 0x27c4
movq -0x58(%rbp), %rsi
jmp 0x27bc
movq %rax, %rbx
jmp 0x27c4
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x27f4
movq -0x98(%rbp), %rsi
jmp 0x27ec
movq %rax, %rbx
jmp 0x27f4
movq %rax, %rbx
jmp 0x2794
jmp 0x273d
movq %rax, %rbx
leaq 0x2599(%rip), %rax      # 0x4ce0
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x2764
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x20c0
leaq 0x2575(%rip), %rax      # 0x4ce0
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x2794
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x20c0
leaq 0x2545(%rip), %rax      # 0x4ce0
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x27c4
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x20c0
leaq 0x2515(%rip), %rax      # 0x4ce0
movq %rax, -0x128(%rbp)
movq -0x120(%rbp), %rdi
leaq -0x110(%rbp), %rax
cmpq %rax, %rdi
je 0x27f4
movq -0x110(%rbp), %rsi
incq %rsi
callq 0x20c0
movq %rbx, %rdi
callq 0x2100