// File: /workspace/github_cpp_makefile_star2_O1/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 -0x68(%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 -0x78(%rbp), %rsi
callq 0x16a5
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 0x151b
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 -0x38(%rbp), %r12
leaq -0xb8(%rbp), %rbx
leaq -0xa8(%rbp), %r14
leaq -0x78(%rbp), %r13
movq 0x2c45(%rip), %rdi      # 0x3fd8
movq %r14, %rsi
callq 0x16a5
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x14bb
movq %r12, -0x48(%rbp)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x15ae
movq %rbx, -0xc8(%rbp)
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0x15ae
movq -0x40(%rbp), %rdx
cmpq -0xc0(%rbp), %rdx
jne 0x1413
testq %rdx, %rdx
je 0x1418
movq -0xc8(%rbp), %rsi
movq -0x48(%rbp), %rdi
callq 0x10d0
testl %eax, %eax
sete %r15b
jmp 0x141b
xorl %r15d, %r15d
jmp 0x141b
movb $0x1, %r15b
movq -0xc8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x1436
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x10c0
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x144b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10c0
testb %r15b, %r15b
je 0x1460
movq %r13, %rdi
movq %r14, %rsi
callq 0x171c
jmp 0x138c
movq 0x2b61(%rip), %rdi      # 0x3fc8
movq %r13, %rsi
callq 0x1793
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
movq %r13, %rdi
movq %r14, %rsi
callq 0x1040
leaq -0x98(%rbp), %rax
movups 0x10(%rax), %xmm0
leaq -0x58(%rbp), %rax
movups %xmm0, (%rax)
jmp 0x138c
movq 0x2b06(%rip), %rdi      # 0x3fc8
leaq -0x78(%rbp), %rsi
callq 0x1793
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 -0x68(%rbp), %r14
je 0x151b
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x10c0
movq -0x78(%rbp), %rdi
cmpq %r14, %rdi
je 0x1530
movq -0x68(%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 0x1567
movq %rax, %rbx
jmp 0x158c
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x156a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10c0
jmp 0x156a
jmp 0x1567
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x158c
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x10c0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x15a5
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x10c0
movq %rbx, %rdi
callq 0x1130
nop