// File: /workspace/github_cpp_makefile_star2_O1/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 0x2a74(%rip), %rdi      # 0x3fe0
leaq -0xe8(%rbp), %rsi
callq 0x1323
movq 0x2a61(%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 0x18b0
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 0x29ee(%rip), %rbx      # 0x3fd0
movq %rbx, %rdi
callq 0x13f1
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq 0x29c8(%rip), %rdi      # 0x3fd0
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq -0x58(%rbp), %rdi
cmpq %r12, %rdi
je 0x162a
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 0x297d(%rip), %rdi      # 0x3fe0
callq 0x1c19
leaq -0xb8(%rbp), %rsi
movq %rax, %rdi
callq 0x1c19
leaq -0x88(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x1d7a
movq 0x293b(%rip), %rbx      # 0x3fd0
leaq -0x88(%rbp), %rsi
movq %rbx, %rdi
callq 0x1c70
leaq -0x78(%rbp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x16be
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 0x28f4(%rip), %rdi      # 0x3fd0
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq 0x28f0(%rip), %rdi      # 0x3fe0
leaq -0x58(%rbp), %rsi
callq 0x19a9
leaq -0xb8(%rbp), %rsi
movq %rax, %rdi
callq 0x19a9
leaq -0x88(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x1ab6
movq 0x28aa(%rip), %rdi      # 0x3fd0
leaq -0x88(%rbp), %rsi
callq 0x1b0f
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 0x1774
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x178f
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x17a8
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x17c3
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x17de
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 0x183a
movq %rax, %rbx
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x181e
jmp 0x183d
jmp 0x183a
jmp 0x180a
movq %rax, %rbx
jmp 0x1871
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x183d
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10b0
jmp 0x183d
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r12, %rdi
jne 0x1865
jmp 0x1871
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x1858
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x1871
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x188c
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x18a7
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x10b0
movq %rbx, %rdi
callq 0x1120
nop