// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH14_OverloadedOperationsAndConversions/examples/add.cc
// Function: main
int main()
{
    Sales_item item1, item2;
    // read a pair of transactions
    cin >> item1 >> item2;
    // print the sum of two Sales_items
    cout << item1 + item2 << endl;

	Sales_data data1, data2;
    /**
     * read a pair of transactions
     * std::istream& read(std::istream&, Sales_data&)
     */
    read(read(cin, data1), data2);
    // print the sum of two Sales_datas
    print(cout, add(data1, data2));
 	cout << std::endl;

    // use input operator to read Sales_datas
	cin >> data1 >> data2;
    // use operators to print the sum of two Sales_datas
    cout << data1 + data2 << endl;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
leaq -0xd8(%rbp), %r14
movq %r14, -0x10(%r14)
xorl %eax, %eax
movq %rax, -0x8(%r14)
movb %al, (%r14)
movl %eax, 0x10(%r14)
movq %rax, 0x18(%r14)
leaq -0x108(%rbp), %r15
movq %r15, -0x10(%r15)
movq %rax, -0x8(%r15)
movb %al, (%r15)
movl %eax, 0x10(%r15)
movq %rax, 0x18(%r15)
movq 0x2a80(%rip), %rdi      # 0x3fe0
leaq -0xe8(%rbp), %rsi
callq 0x1323
movq 0x2a6d(%rip), %rdi      # 0x3fe0
leaq -0x118(%rbp), %rsi
callq 0x1323
leaq -0x48(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %rdi
callq 0x18a4
leaq -0xc8(%rbp), %rax
movups (%rax), %xmm0
leaq -0x58(%rbp), %rsi
movups %xmm0, 0x20(%rsi)
movl -0xf8(%rbp), %eax
addl %eax, 0x20(%rsi)
movsd -0xf0(%rbp), %xmm0
addsd 0x28(%rsi), %xmm0
movsd %xmm0, 0x28(%rsi)
movq 0x29fa(%rip), %rbx      # 0x3fd0
movq %rbx, %rdi
callq 0x13e5
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq 0x29d4(%rip), %rdi      # 0x3fd0
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq -0x58(%rbp), %rdi
cmpq %r12, %rdi
je 0x161e
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x10b0
leaq -0x58(%rbp), %rsi
movq %r12, (%rsi)
xorl %eax, %eax
movq %rax, 0x8(%rsi)
movb %al, 0x10(%rsi)
movl %eax, 0x20(%rsi)
movq %rax, 0x28(%rsi)
leaq -0xa8(%rbp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
movl %eax, 0x10(%r13)
movq %rax, 0x18(%r13)
movq 0x2989(%rip), %rdi      # 0x3fe0
callq 0x1c05
leaq -0xb8(%rbp), %rsi
movq %rax, %rdi
callq 0x1c05
leaq -0x88(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x1d66
movq 0x2947(%rip), %rbx      # 0x3fd0
leaq -0x88(%rbp), %rsi
movq %rbx, %rdi
callq 0x1c5c
leaq -0x78(%rbp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x16b2
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq 0x2900(%rip), %rdi      # 0x3fd0
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq 0x28fc(%rip), %rdi      # 0x3fe0
leaq -0x58(%rbp), %rsi
callq 0x19a1
leaq -0xb8(%rbp), %rsi
movq %rax, %rdi
callq 0x19a1
leaq -0x88(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x1aa2
movq 0x28b6(%rip), %rdi      # 0x3fd0
leaq -0x88(%rbp), %rsi
callq 0x1afb
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x1768
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x1783
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x179c
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x17b7
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x17d2
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x10b0
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x182e
movq %rax, %rbx
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x1812
jmp 0x1831
jmp 0x182e
jmp 0x17fe
movq %rax, %rbx
jmp 0x1865
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x1831
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10b0
jmp 0x1831
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r12, %rdi
jne 0x1859
jmp 0x1865
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x184c
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x1865
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x1880
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x189b
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x10b0
movq %rbx, %rdi
callq 0x1120
nop