// File: /workspace/github_cpp_makefile_star2_O1/iZhangHui[P]CppPrimer/CH08_TheIOLibrary/examples/sstream.cc
// Function: process(std::ostream&, std::vector<PersonInfo, std::allocator<PersonInfo>>)
ostream& process(ostream &os, vector<PersonInfo> people)
{
	for (const auto &entry : people) {    // for each entry in people
		ostringstream formatted, badNums; // objects created on each loop
		for (const auto &nums : entry.phones) {  // for each number 
			if (!valid(nums)) {           
				badNums << " " << nums;  // string in badNums
			} else                        
				// ``writes'' to formatted's string
				formatted << " " << format(nums); 
		}
		if (badNums.str().empty())      // there were no bad numbers
			os << entry.name << " "     // print the name 
			   << formatted.str() << endl; // and reformatted numbers 
		else                   // otherwise, print the name and bad numbers
			cerr << "input error: " << entry.name 
			     << " invalid number(s) " << badNums.str() << endl;
	}
	
	return os;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x328, %rsp            # imm = 0x328
movq %rdi, -0x50(%rbp)
movq (%rsi), %r13
movq 0x8(%rsi), %rax
movq %rax, -0x58(%rbp)
cmpq %rax, %r13
je 0x27ea
leaq -0x38(%rbp), %r14
leaq -0x350(%rbp), %r15
leaq -0x1d8(%rbp), %rbx
leaq -0x48(%rbp), %r12
movq %r15, %rdi
callq 0x2140
movq %rbx, %rdi
callq 0x2140
movq 0x20(%r13), %rbx
movq %r13, -0x60(%rbp)
movq 0x28(%r13), %r13
cmpq %r13, %rbx
je 0x2653
movl $0x1, %edx
movq %r15, %rdi
leaq 0x1a33(%rip), %rsi      # 0x4040
callq 0x2120
movq %r14, -0x48(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x2a78
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %r15, %rdi
callq 0x2120
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x264d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2110
addq $0x20, %rbx
jmp 0x25f9
movq %r12, %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x2180
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rbx
cmpq %r14, %rdi
movq -0x60(%rbp), %r13
je 0x267f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2110
testq %rbx, %rbx
je 0x2716
movl $0xd, %edx
movq 0x395c(%rip), %rdi      # 0x5ff0
leaq 0x1985(%rip), %rsi      # 0x4020
callq 0x2120
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq 0x3941(%rip), %rdi      # 0x5ff0
callq 0x2120
movq %rax, %rbx
movl $0x13, %edx
movq %rax, %rdi
leaq 0x1968(%rip), %rsi      # 0x402e
callq 0x2120
movq %r12, %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x2180
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x2120
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
jmp 0x2787
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq -0x50(%rbp), %rdi
callq 0x2120
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1907(%rip), %rsi      # 0x4040
callq 0x2120
movq %r12, %rdi
leaq -0x348(%rbp), %rsi
callq 0x2180
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x2120
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x279c
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2110
leaq -0x1d8(%rbp), %rbx
movq %rbx, %rdi
movq 0x3813(%rip), %r12      # 0x5fc0
movq %r12, %rsi
callq 0x2090
leaq -0x168(%rbp), %rdi
callq 0x2050
movq %r15, %rdi
movq %r12, %rsi
callq 0x2090
leaq -0x2e0(%rbp), %rdi
callq 0x2050
addq $0x38, %r13
cmpq -0x58(%rbp), %r13
leaq -0x48(%rbp), %r12
jne 0x25dd
movq -0x50(%rbp), %rax
addq $0x328, %rsp            # imm = 0x328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x282d
jmp 0x282d
jmp 0x282d
movq %rax, %rbx
jmp 0x284f
jmp 0x2811
jmp 0x2811
jmp 0x282d
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x2830
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2110
jmp 0x2830
jmp 0x282d
movq %rax, %rbx
movq 0x3789(%rip), %rsi      # 0x5fc0
leaq -0x1d8(%rbp), %rdi
callq 0x2090
leaq -0x168(%rbp), %rdi
callq 0x2050
movq 0x376a(%rip), %rsi      # 0x5fc0
leaq -0x350(%rbp), %rdi
callq 0x2090
leaq -0x2e0(%rbp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x21b0