// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH05_Statements/examples/add_item2.cc
// Function: main
int main() 
{
	Sales_item item1, item2;
	
	while (cin >> item1 >> item2) {
	    try {
	        // execute code that will add the two Sales_items
	        // if the addition fails, the code throws a runtime_error exception
	        // first check that the data are for the same item 
	        if (item1.isbn() != item2.isbn())
	            throw runtime_error("Data must refer to same ISBN");
	
	        // if we're still here, the ISBNs are the same
	        cout << item1 + item2 << endl;
	    } catch (runtime_error err) {
	        // remind the user that the ISBNs must match 
			// and prompt for another pair
	        cout << err.what() 
	             << "\nTry Again?  Enter y or n" << endl;
	        char c;
	        cin >> c;
	        if (!cin || c == 'n')
	            break;      // break out of the while loop
	    }  // ends the catch clause
	}  // ends the while loop
	
	return 0;   // indicate success
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
andl $0x0, 0x10(%rax)
andq $0x0, 0x18(%rax)
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
andl $0x0, 0x10(%rax)
andq $0x0, 0x18(%rax)
movq 0x2aba(%rip), %rbx      # 0x4fd8
leaq -0xe0(%rbp), %r12
leaq -0xb0(%rbp), %r13
movq %rbx, %rdi
leaq -0x90(%rbp), %rsi
callq 0x235c
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
callq 0x235c
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
jne 0x26f3
movq %r12, %rdi
leaq -0x90(%rbp), %rsi
callq 0x2160
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
callq 0x2160
movq %r12, %rdi
movq %r13, %rsi
callq 0x27a1
movq %r13, %rdi
movl %eax, %r13d
movq %rdi, %r14
callq 0x2080
movq %r12, %rdi
callq 0x2080
testb %r13b, %r13b
jne 0x25d7
movq %r12, %rdi
leaq -0x90(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x232a
movq 0x2a14(%rip), %r15      # 0x4fc8
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %r13
callq 0x23f3
movq %r15, %rdi
callq 0x2090
movq %r12, %rdi
callq 0x2080
jmp 0x252c
pushq $0x10
popq %rdi
callq 0x20a0
movq %rax, %r13
movq %rax, %rdi
leaq 0xa1a(%rip), %rsi       # 0x3006
callq 0x2040
movq %r13, %rdi
movq 0x29f5(%rip), %rsi      # 0x4ff0
movq 0x29be(%rip), %rdx      # 0x4fc0
callq 0x21a0
jmp 0x271c
movq %rax, %r15
movq %r14, %r13
movq %rdx, %r14
jmp 0x265f
movq %rdx, -0x30(%rbp)
movq %rax, %r15
movq %r13, %rdi
callq 0x20d0
jmp 0x262f
movq %rdx, -0x30(%rbp)
movq %rax, %r15
movq %r14, %r13
jmp 0x265b
movq %rdx, %r14
movq %rax, %r15
movq %r12, %rdi
callq 0x2080
jmp 0x265f
movq %rdx, %r14
movq %rax, %r15
jmp 0x265f
movq %rdx, -0x30(%rbp)
movq %rax, %r15
movq %r12, %rdi
callq 0x2080
movq -0x30(%rbp), %r14
cmpl $0x1, %r14d
jne 0x2741
movq %r15, %rdi
callq 0x2120
movq %r12, %rdi
movq %rax, %rsi
callq 0x2060
movq %r15, %rdi
callq 0x2050
movq %r12, %rdi
callq 0x2150
movq 0x2935(%rip), %rdi      # 0x4fc8
movq %rax, %rsi
callq 0x2100
movq %rax, %rdi
leaq 0x97e(%rip), %rsi       # 0x3023
callq 0x2100
movq %rax, %rdi
callq 0x2090
movq %rbx, %rdi
movq %r13, %r14
movq %r13, %rsi
callq 0x2140
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x20(%rbx,%rax), %r13d
movb -0xb0(%rbp), %r15b
movq %r12, %rdi
callq 0x21d8
callq 0x2190
testb $0x5, %r13b
jne 0x26f3
movq %r14, %r13
cmpb $0x6e, %r15b
jne 0x252c
leaq -0x60(%rbp), %rdi
callq 0x2080
leaq -0x90(%rbp), %rdi
callq 0x2080
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x273e
jmp 0x2720
movq %rax, %r15
leaq -0xe0(%rbp), %rdi
callq 0x21d8
callq 0x2190
jmp 0x2741
movq %rax, %rdi
callq 0x27ae
movq %rax, %r15
leaq -0x60(%rbp), %rdi
callq 0x2080
leaq -0x90(%rbp), %rdi
callq 0x2080
movq %r15, %rdi
callq 0x21c0