// File: iZhangHui[P]CppPrimer/CH06_Functions/examples/refparms.cc
// Function: main
int main() 
{
	
	string s;
	getline(cin, s); 
	size_t ctr = 0;
	auto index = find_char(s, 'o', ctr);
	cout << index << " " << ctr << endl;
	
	vector<int> ivec;
	int i;
	// read values into ivec
	while (cin >> i)
		ivec.push_back(i);

	// for each value in the list of ints
	for (auto i : {42, 33, 92}) {
		auto it = find_val(ivec.begin(), ivec.end(), i, ctr);
		if (it == ivec.end())
			cout << i << " is not in the input data" << endl;
		else
			cout << i << " was at position " 
			     << it - ivec.begin() << endl;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movl $0x0, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x1140
movq -0xe8(%rbp), %rsi
movq 0x3b80(%rip), %rdi      # 0x4fe0
callq 0x1030
jmp 0x1467
movq $0x0, -0x40(%rbp)
leaq -0x28(%rbp), %rdi
movl $0x6f, %esi
leaq -0x40(%rbp), %rdx
callq 0x12e0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rsi
movq 0x3b40(%rip), %rdi      # 0x4fd0
callq 0x1040
movq %rax, -0xf0(%rbp)
jmp 0x149e
movq -0xf0(%rbp), %rdi
leaq 0x1b82(%rip), %rsi      # 0x302e
callq 0x10e0
movq %rax, -0xf8(%rbp)
jmp 0x14ba
movq -0xf8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x1040
movq %rax, -0x100(%rbp)
jmp 0x14d3
movq -0x100(%rbp), %rdi
movq 0x3adf(%rip), %rsi      # 0x4fc0
callq 0x1110
jmp 0x14e8
leaq -0x60(%rbp), %rdi
callq 0x1870
movq 0x3ae8(%rip), %rdi      # 0x4fe0
leaq -0x64(%rbp), %rsi
callq 0x1090
movq %rax, -0x108(%rbp)
jmp 0x150a
movq -0x108(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x1130
movb %al, -0x109(%rbp)
jmp 0x1528
movb -0x109(%rbp), %al
testb $0x1, %al
jne 0x1534
jmp 0x1570
leaq -0x60(%rbp), %rdi
leaq -0x64(%rbp), %rsi
callq 0x1890
jmp 0x1543
jmp 0x14f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1797
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x1a80
jmp 0x1797
movl $0x2a, -0x8c(%rbp)
movl $0x21, -0x88(%rbp)
movl $0x5c, -0x84(%rbp)
leaq -0x8c(%rbp), %rax
movq %rax, -0x80(%rbp)
movq $0x3, -0x78(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0x1900
movq %rax, -0x98(%rbp)
movq -0x70(%rbp), %rdi
callq 0x1920
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rax
cmpq -0xa0(%rbp), %rax
je 0x1772
movq -0x98(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xa4(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x1960
movq %rax, -0xc0(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x1990
leaq -0x60(%rbp), %rdi
callq 0x19d0
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x1990
movl -0xa4(%rbp), %edx
movq -0xb8(%rbp), %rdi
movq -0xc8(%rbp), %rsi
leaq -0x40(%rbp), %rcx
callq 0x13a0
movq %rax, -0xb0(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x19d0
movq %rax, -0xd8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x1a00
testb $0x1, %al
jne 0x167f
jmp 0x16d0
movl -0xa4(%rbp), %esi
movq 0x3944(%rip), %rdi      # 0x4fd0
callq 0x1170
movq %rax, -0x118(%rbp)
jmp 0x169a
movq -0x118(%rbp), %rdi
leaq 0x195c(%rip), %rsi      # 0x3004
callq 0x10e0
movq %rax, -0x120(%rbp)
jmp 0x16b6
movq -0x120(%rbp), %rdi
movq 0x38fc(%rip), %rsi      # 0x4fc0
callq 0x1110
jmp 0x16cb
jmp 0x1759
movl -0xa4(%rbp), %esi
movq 0x38f3(%rip), %rdi      # 0x4fd0
callq 0x1170
movq %rax, -0x128(%rbp)
jmp 0x16eb
movq -0x128(%rbp), %rdi
leaq 0x1925(%rip), %rsi      # 0x301e
callq 0x10e0
movq %rax, -0x130(%rbp)
jmp 0x1707
leaq -0x60(%rbp), %rdi
callq 0x1960
movq %rax, -0xe0(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x1a40
movq -0x130(%rbp), %rdi
movq %rax, %rsi
callq 0x1190
movq %rax, -0x138(%rbp)
jmp 0x1742
movq -0x138(%rbp), %rdi
movq 0x3870(%rip), %rsi      # 0x4fc0
callq 0x1110
jmp 0x1757
jmp 0x1759
jmp 0x175b
movq -0x98(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x98(%rbp)
jmp 0x15c9
movl $0x0, -0x4(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x1a80
leaq -0x28(%rbp), %rdi
callq 0x10a0
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x10a0
movq -0x30(%rbp), %rdi
callq 0x1180
nopl (%rax)