// File: iZhangHui[P]CppPrimer/CH14_OverloadedOperationsAndConversions/examples/newcount-size.cc
// Function: biggies(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, unsigned long)
void biggies(vector<string>& words, vector<string>::size_type sz)
{
	elimDups(words);  // puts words in alphabetic order and removes duplicates

    // sort words by size using object of type ShorterString
	// maintaining alphabetic order for words of the same size
    stable_sort(words.begin(), words.end(), ShorterString());

	// use object of type SizeComp to find
	// the first element whose size() is >= sz
    auto wc = find_if(words.begin(), words.end(), SizeComp(sz));

	// compute the number of elements with size >= sz
	auto count = words.end() - wc;

	// print results
    cout << count << " " << make_plural(count, "word", "s")
         << " " << sz << " characters or longer" << endl;

	// use object of type PrintString
	// to print the contents of words, each one followed by a space
	for_each(wc, words.end(), PrintString(cout));
	cout << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2400
movq -0x8(%rbp), %rdi
callq 0x2990
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x29c0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2b80
movq -0x8(%rbp), %rdi
callq 0x2990
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x29c0
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x2c20
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x2bc0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x29c0
movq %rax, -0x58(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2c40
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rsi
movq 0xa9b0(%rip), %rdi      # 0xcfc8
callq 0x2220
movq %rax, %rdi
leaq 0x69ed(%rip), %rsi      # 0x9014
callq 0x2120
movq %rax, -0x110(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x2210
movq -0x100(%rbp), %rdx
leaq 0x69b7(%rip), %rsi      # 0x9016
leaq -0x98(%rbp), %rdi
callq 0x21b0
jmp 0x266d
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x2210
movq -0x118(%rbp), %rdx
leaq 0x698d(%rip), %rsi      # 0x901b
leaq -0xd0(%rbp), %rdi
callq 0x21b0
jmp 0x269c
movq -0x108(%rbp), %rsi
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rdx
leaq -0xd0(%rbp), %rcx
callq 0x2c80
jmp 0x26bc
movq -0x110(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2110
movq %rax, -0x120(%rbp)
jmp 0x26d5
movq -0x120(%rbp), %rdi
leaq 0x6931(%rip), %rsi      # 0x9014
callq 0x2120
movq %rax, -0x128(%rbp)
jmp 0x26f1
movq -0x128(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2040
movq %rax, -0x130(%rbp)
jmp 0x270a
movq -0x130(%rbp), %rdi
leaq 0x6905(%rip), %rsi      # 0x901d
callq 0x2120
movq %rax, -0x138(%rbp)
jmp 0x2726
movq -0x138(%rbp), %rdi
movq 0xa884(%rip), %rsi      # 0xcfb8
callq 0x2150
jmp 0x273b
leaq -0x78(%rbp), %rdi
callq 0x20c0
leaq -0xd0(%rbp), %rdi
callq 0x20c0
leaq -0xd1(%rbp), %rdi
callq 0x2160
leaq -0x98(%rbp), %rdi
callq 0x20c0
leaq -0x99(%rbp), %rdi
callq 0x2160
movq -0x30(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x29c0
movq %rax, -0xe8(%rbp)
leaq -0xf0(%rbp), %rdi
movq 0xa82b(%rip), %rsi      # 0xcfc8
callq 0x2a50
movq -0xe0(%rbp), %rdi
movq -0xe8(%rbp), %rsi
movq -0xf0(%rbp), %rdx
callq 0x29f0
movq %rax, -0xf8(%rbp)
movq 0xa7fe(%rip), %rdi      # 0xcfc8
movq 0xa7e7(%rip), %rsi      # 0xcfb8
callq 0x2150
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x285a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x2842
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x2836
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x20c0
leaq -0xd0(%rbp), %rdi
callq 0x20c0
leaq -0xd1(%rbp), %rdi
callq 0x2160
leaq -0x98(%rbp), %rdi
callq 0x20c0
leaq -0x99(%rbp), %rdi
callq 0x2160
movq -0xa8(%rbp), %rdi
callq 0x2200
nopw %cs:(%rax,%rax)