// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH10_GenericAlgorithms/examples/newcount-size.cc
// Function: main
int main()
{
    vector<string> words;

    // copy contents of each book into a single vector
    string next_word;
    while (cin >> next_word) {
        // insert next book's contents at end of words
        words.push_back(next_word);
    }

	biggies(words, 5); // biggies changes its first argument

	// alternative solution using bind and check_size function
	// NB: words was changed inside biggies, 
	//     at this point in the program words has only unique
	//     words and is in order by size
	size_t sz = 5;
	auto
	wc = find_if(words.begin(), words.end(), 
	             bind(check_size, std::placeholders::_1, sz));
	auto count = words.end() - wc;
    cout << count << " " << make_plural(count, "word", "s")
         << " of length " << sz << " or longer" << endl;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %rbx
movaps %xmm0, (%rbx)
xorl %eax, %eax
movq %rax, 0x10(%rbx)
leaq -0xb0(%rbp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb $0x0, (%r12)
movq 0x46c5(%rip), %r14      # 0x6fe0
leaq -0xc0(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2948
movq %rbx, %rdi
movq %r15, %rsi
callq 0x374a
jmp 0x2922
leaq -0x60(%rbp), %rdi
movl $0x5, %esi
callq 0x2551
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq -0x98(%rip), %rax       # 0x28cd
leaq -0x48(%rbp), %rdx
movq %rax, (%rdx)
movq $0x5, 0x8(%rdx)
callq 0x4ad4
movq -0x58(%rbp), %r14
subq %rax, %r14
sarq $0x5, %r14
movq 0x4645(%rip), %rdi      # 0x6fd0
movq %r14, %rsi
callq 0x2110
movq %rax, %rbx
leaq 0x2678(%rip), %rsi      # 0x5015
movl $0x1, %edx
movq %rax, %rdi
callq 0x2160
leaq -0x70(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x264b(%rip), %rsi      # 0x5004
leaq 0x2648(%rip), %rdx      # 0x5008
leaq -0x80(%rbp), %rdi
callq 0x4810
leaq -0x90(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x262e(%rip), %rsi      # 0x5009
leaq 0x2628(%rip), %rdx      # 0x500a
leaq -0xa0(%rbp), %rdi
callq 0x4810
cmpq $0x2, %r14
jb 0x2a0a
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x3803
jmp 0x2a26
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x3868
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x2160
movq %rax, %rbx
leaq 0x25cb(%rip), %rsi      # 0x500b
movl $0xb, %edx
movq %rax, %rdi
callq 0x2160
movl $0x5, %esi
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
leaq 0x25b3(%rip), %rsi      # 0x5017
movl $0xa, %edx
movq %rax, %rdi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20b0
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ab1
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xa0(%rbp), %rdi
cmpq %r13, %rdi
je 0x2acc
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x2ae1
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x2afc
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x60(%rbp), %rdi
callq 0x3796
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x2b47
movq %rax, %rbx
jmp 0x2b62
jmp 0x2b79
jmp 0x2b79
jmp 0x2b79
jmp 0x2b79
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b47
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xa0(%rbp), %rdi
cmpq %r13, %rdi
je 0x2b62
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x2b7c
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2140
jmp 0x2b7c
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x2b97
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x60(%rbp), %rdi
callq 0x3796
movq %rbx, %rdi
callq 0x21c0