// File: /workspace/github_cpp_makefile_star2_O1/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 0x46c2(%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 0x294b
movq %rbx, %rdi
movq %r15, %rsi
callq 0x36e6
jmp 0x2925
leaq -0x60(%rbp), %rdi
movl $0x5, %esi
callq 0x2551
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq -0x98(%rip), %rax       # 0x28d0
leaq -0x48(%rbp), %rdx
movq %rax, (%rdx)
movq $0x5, 0x8(%rdx)
callq 0x4ac8
movq -0x58(%rbp), %r14
subq %rax, %r14
sarq $0x5, %r14
movq 0x4642(%rip), %rdi      # 0x6fd0
movq %r14, %rsi
callq 0x2110
movq %rax, %rbx
leaq 0x2675(%rip), %rsi      # 0x5015
movl $0x1, %edx
movq %rax, %rdi
callq 0x2160
leaq -0x70(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2648(%rip), %rsi      # 0x5004
leaq 0x2645(%rip), %rdx      # 0x5008
leaq -0x80(%rbp), %rdi
callq 0x47e0
leaq -0x90(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x262b(%rip), %rsi      # 0x5009
leaq 0x2625(%rip), %rdx      # 0x500a
leaq -0xa0(%rbp), %rdi
callq 0x47e0
cmpq $0x2, %r14
jb 0x2a0d
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x379c
jmp 0x2a29
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x3800
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x2160
movq %rax, %rbx
leaq 0x25c8(%rip), %rsi      # 0x500b
movl $0xb, %edx
movq %rax, %rdi
callq 0x2160
movl $0x5, %esi
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
leaq 0x25b0(%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 0x2ab4
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xa0(%rbp), %rdi
cmpq %r13, %rdi
je 0x2acf
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x2ae4
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x2aff
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x60(%rbp), %rdi
callq 0x3732
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x2b4a
movq %rax, %rbx
jmp 0x2b65
jmp 0x2b7c
jmp 0x2b7c
jmp 0x2b7c
jmp 0x2b7c
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b4a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xa0(%rbp), %rdi
cmpq %r13, %rdi
je 0x2b65
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x2b7f
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2140
jmp 0x2b7f
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x2b9a
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x60(%rbp), %rdi
callq 0x3732
movq %rbx, %rdi
callq 0x21c0