// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH07_Classes/examples/avg_price.cc
// Function: main
int main()
{
	Sales_data total;         // variable to hold the running sum
	if (read(cin, total))  {  // read the first transaction
		Sales_data trans;     // variable to hold data for the next transaction
		while(read(cin, trans)) {      // read the remaining transactions
			if (total.isbn() == trans.isbn())   // check the isbns
				total.combine(trans);  // update the running total
			else {
				print(cout, total) << endl;  // print the results
				total = trans;               // process the next book
			}
		}
		print(cout, total) << endl;          // print the last transaction
	} else {                                 // there was no input
		cerr << "No data?!" << endl;         // notify the user
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
leaq -0x48(%rbp), %r14
movq %r14, -0x10(%r14)
xorl %eax, %eax
movq %rax, -0x8(%r14)
movb $0x0, (%r14)
movl $0x0, 0x10(%r14)
movq %rax, 0x18(%r14)
movq 0x2ce3(%rip), %rdi      # 0x3fd8
leaq -0x58(%rbp), %rsi
callq 0x16ad
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x1357
movq 0x2cdd(%rip), %rbx      # 0x3ff0
leaq 0xcea(%rip), %rsi       # 0x2004
movl $0x9, %edx
movq %rbx, %rdi
callq 0x10e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10b0
movsbl %al, %esi
movq 0x2cab(%rip), %rdi      # 0x3ff0
callq 0x1030
movq %rax, %rdi
callq 0x1070
jmp 0x1520
leaq -0x98(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movl $0x0, 0x10(%rcx)
movq %rax, 0x18(%rcx)
leaq -0x68(%rbp), %r12
leaq -0xb8(%rbp), %rbx
leaq -0xa8(%rbp), %r14
movq 0x2c49(%rip), %rdi      # 0x3fd8
movq %r14, %rsi
callq 0x16ad
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x14c0
movq %r12, -0x78(%rbp)
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %rdi
callq 0x15b2
movq %rbx, -0xc8(%rbp)
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0x15b2
movq -0x70(%rbp), %rdx
cmpq -0xc0(%rbp), %rdx
jne 0x1412
movq -0xc8(%rbp), %r15
testq %rdx, %rdx
je 0x141e
movq -0x78(%rbp), %rdi
movq %r15, %rsi
callq 0x10d0
testl %eax, %eax
sete %r13b
jmp 0x1421
movq -0xc8(%rbp), %r15
xorl %r13d, %r13d
jmp 0x1421
movb $0x1, %r13b
cmpq %rbx, %r15
je 0x1438
movq -0xb8(%rbp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x10c0
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x144d
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x10c0
testb %r13b, %r13b
je 0x1463
leaq -0x58(%rbp), %rdi
movq %r14, %rsi
callq 0x1724
jmp 0x1388
movq 0x2b5e(%rip), %rdi      # 0x3fc8
leaq -0x58(%rbp), %rsi
callq 0x179b
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1070
leaq -0x58(%rbp), %rdi
movq %r14, %rsi
callq 0x1040
leaq -0x98(%rbp), %rax
movups 0x10(%rax), %xmm0
leaq -0x38(%rbp), %rax
movups %xmm0, (%rax)
jmp 0x1388
movq 0x2b01(%rip), %rdi      # 0x3fc8
leaq -0x58(%rbp), %rsi
callq 0x179b
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1070
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
leaq -0x48(%rbp), %r14
je 0x1520
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x10c0
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x1535
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x10c0
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x156c
movq %rax, %rbx
jmp 0x1591
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x156f
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x10c0
jmp 0x156f
jmp 0x156c
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x1591
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x10c0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x15aa
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x10c0
movq %rbx, %rdi
callq 0x1130