// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x128, %rsp            # imm = 0x128
leaq 0xdc1(%rip), %rsi       # 0x3050
leaq -0xe0(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x2030
leaq -0x110(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movsd 0xd53(%rip), %xmm0      # 0x3008
callq 0x2506
leaq -0xe0(%rbp), %rdi
callq 0x2040
leaq 0xd91(%rip), %rsi       # 0x305e
leaq -0x50(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x2030
leaq -0xe0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movsd 0xd18(%rip), %xmm0      # 0x3008
pushq $0x3
popq %rdx
movsd 0xd15(%rip), %xmm1      # 0x3010
callq 0x2538
leaq -0x50(%rbp), %rdi
callq 0x2040
movq 0x2cc8(%rip), %rdi      # 0x4fd8
leaq -0x110(%rbp), %rsi
pushq $0x14
popq %rdx
callq 0x26a4
movq 0x2cb2(%rip), %rdi      # 0x4fd8
leaq -0xe0(%rbp), %rsi
pushq $0x14
popq %rdx
callq 0x26a4
leaq 0xd22(%rip), %rsi       # 0x305e
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x2030
leaq -0xa0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movsd 0xcbc(%rip), %xmm0      # 0x3018
callq 0x2506
leaq -0x50(%rbp), %rdi
callq 0x2040
leaq 0xced(%rip), %rsi       # 0x305e
leaq -0x70(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x2030
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movsd 0xc8a(%rip), %xmm0      # 0x3018
pushq $0x5
popq %rdx
movsd 0xc87(%rip), %xmm1      # 0x3020
callq 0x2538
leaq -0x70(%rbp), %rdi
callq 0x2040
leaq -0x50(%rbp), %rdi
pushq $0x14
popq %rsi
callq 0x276a
movq 0x2c1e(%rip), %rdi      # 0x4fd8
callq 0x20f0
movq 0x2c12(%rip), %rdi      # 0x4fd8
callq 0x2050
leaq -0xa0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x255c
movsd -0x78(%rbp), %xmm0
mulsd 0xc40(%rip), %xmm0      # 0x3028
movq 0x2be9(%rip), %rdi      # 0x4fd8
callq 0x20f0
movq 0x2bdd(%rip), %rdi      # 0x4fd8
callq 0x2050
leaq -0x50(%rbp), %rdi
movq (%rdi), %rax
pushq $0x14
popq %rsi
callq *0x10(%rax)
movq 0x2bc4(%rip), %rdi      # 0x4fd8
callq 0x20f0
leaq -0x48(%rbp), %rsi
leaq -0x130(%rbp), %rdi
callq 0x20d0
leaq -0x130(%rbp), %rdi
callq 0x2040
movq 0x2b9c(%rip), %rdi      # 0x4fd8
callq 0x2050
leaq -0x50(%rbp), %rdi
callq 0x25b6
leaq -0xa0(%rbp), %rdi
callq 0x25b6
leaq -0xe0(%rbp), %rdi
callq 0x25b6
leaq -0x110(%rbp), %rdi
callq 0x25b6
xorl %eax, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x2040
jmp 0x24d9
movq %rax, %rbx
jmp 0x24d9
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x2040
jmp 0x24e5
jmp 0x24c6
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x2040
jmp 0x24f1
movq %rax, %rbx
jmp 0x24f1
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x2040
jmp 0x24fd
movq %rax, %rbx
jmp 0x24fd
movq %rax, %rbx
jmp 0x24e5
jmp 0x24cd
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x25b6
leaq -0xa0(%rbp), %rdi
callq 0x25b6
leaq -0xe0(%rbp), %rdi
callq 0x25b6
leaq -0x110(%rbp), %rdi
callq 0x25b6
movq %rbx, %rdi
callq 0x2100
nop