// File: /workspace/github_cpp_makefile_star2_O1/iZhangHui[P]CppPrimer/CH08_TheIOLibrary/examples/fileIO.cc
// Function: main
int main(int argc, char* argv[])
{
	// for each file passed to the program
	for (auto p = argv + 1; p != argv + argc; ++p) {
	    ifstream input(*p);   // create input and open the file
	    if (input) {          // if the file is ok, ``process'' this file
	        process(input);
		} else
	        cerr << "couldn't open: " + string(*p);
	} // input goes out of scope and is destroyed on each iteration
	
	auto p = argv + 1, end = argv + argc;
	
	ifstream input;           
	while (p != end) {        // for each file passed to the program
		input.open(*p);       // open the file, automatically clears the stream 
	    if (input) {          // if the file is ok, read and ``process'' the input
	        	process(input);
		} else
			cerr << "couldn't open: " + string(*p);
	    input.close();        // close file when we're done with it
	    ++p;                  // increment pointer to get next file
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rsi, %rbx
movl %edi, -0x54(%rbp)
movslq %edi, %rax
leaq (,%rax,8), %r13
cmpl $0x1, %eax
je 0x146f
movl $0x8, %r12d
leaq -0x280(%rbp), %r15
movq (%rbx,%r12), %rsi
movq %r15, %rdi
movl $0x8, %edx
callq 0x1120
movq -0x280(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x260(%rbp,%rax)
je 0x13ed
movq (%rbx,%r12), %rsi
leaq -0x78(%rbp), %r14
movq %r14, %rdi
leaq -0x29(%rbp), %rdx
callq 0x1060
movl $0xf, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0xc40(%rip), %rcx       # 0x2004
callq 0x10c0
leaq -0x40(%rbp), %rsi
movq %rsi, -0x50(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x13f7
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x13fd
movq %r15, %rdi
callq 0x126c
jmp 0x145a
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x48(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq 0x2bcd(%rip), %rdi      # 0x3ff0
callq 0x10e0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x1441
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x145a
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x10b0
movq %r15, %rdi
callq 0x1050
addq $0x8, %r12
cmpq %r12, %r13
jne 0x1376
leaq -0x280(%rbp), %rdi
callq 0x10d0
cmpl $0x1, -0x54(%rbp)
je 0x158b
movl $0x8, %r15d
leaq -0x280(%rbp), %r14
movq (%rbx,%r15), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x1070
movq -0x280(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x260(%rbp,%rax)
je 0x1509
movq (%rbx,%r15), %rsi
leaq -0x78(%rbp), %r12
movq %r12, %rdi
leaq -0x29(%rbp), %rdx
callq 0x1060
movl $0xf, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0xb24(%rip), %rcx       # 0x2004
callq 0x10c0
leaq -0x40(%rbp), %rsi
movq %rsi, -0x50(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1513
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x1519
movq %r14, %rdi
callq 0x126c
jmp 0x1576
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x48(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq 0x2ab1(%rip), %rdi      # 0x3ff0
callq 0x10e0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x155d
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x1576
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x10b0
movq %r14, %rdi
callq 0x1040
addq $0x8, %r15
cmpq %r15, %r13
jne 0x1492
leaq -0x280(%rbp), %rdi
callq 0x1050
xorl %eax, %eax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x15f1
jmp 0x15ba
jmp 0x15f1
jmp 0x15b5
jmp 0x15f1
movq %rax, %rbx
jmp 0x15d6
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x15d6
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x15f4
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x10b0
jmp 0x15f4
movq %rax, %rbx
leaq -0x280(%rbp), %rdi
callq 0x1050
movq %rbx, %rdi
callq 0x1110