// File: /workspace/github_cpp_makefile_star2_O1/iZhangHui[P]CppPrimer/CH05_Statements/examples/vowels.cc
// Function: main
int main()
{
    // initialize counters for each vowel
    unsigned aCnt = 0, eCnt = 0, iCnt = 0, oCnt = 0, uCnt = 0;

    char ch;
    while (cin >> ch) {
    	// if ch is a vowel, increment the appropriate counter
    	switch (ch) {
    		case 'a':
    			++aCnt;
    			break;
    		case 'e':
    			++eCnt;
    			break;
    		case 'i':
    			++iCnt;
    			break;
    		case 'o':
    			++oCnt;
    			break;
    		case 'u':
    			++uCnt;
    			break;
    	}
    }
    // print results
    cout << "Number of vowel a: \t" << aCnt << '\n'
         << "Number of vowel e: \t" << eCnt << '\n'
         << "Number of vowel i: \t" << iCnt << '\n'
         << "Number of vowel o: \t" << oCnt << '\n'
         << "Number of vowel u: \t" << uCnt << endl;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x2ddc(%rip), %rdi      # 0x3fe0
leaq -0x29(%rbp), %rsi
callq 0x1090
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
xorl %ebx, %ebx
testb $0x5, 0x20(%rax,%rcx)
je 0x1233
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %r12d, %r12d
movq $0x0, -0x48(%rbp)
jmp 0x12b8
movq 0x2da6(%rip), %r14      # 0x3fe0
leaq -0x29(%rbp), %r15
leaq 0xdbf(%rip), %r12       # 0x2004
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x34(%rbp)
xorl %r13d, %r13d
movsbl -0x29(%rbp), %eax
addl $-0x61, %eax
rorl %eax
cmpl $0xa, %eax
ja 0x128a
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
incl %r13d
jmp 0x128a
incl -0x38(%rbp)
jmp 0x128a
incl -0x34(%rbp)
jmp 0x128a
incl -0x3c(%rbp)
jmp 0x128a
incl %ebx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1090
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x125d
movl %ebx, %eax
movq %rax, -0x48(%rbp)
movl %r13d, %ebx
movl -0x34(%rbp), %r15d
movl -0x38(%rbp), %r13d
movl -0x3c(%rbp), %r12d
movq 0x2d11(%rip), %r14      # 0x3fd0
leaq 0xd6a(%rip), %rsi       # 0x2030
movl $0x14, %edx
movq %r14, %rdi
callq 0x1080
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1040
movb $0xa, %r14b
leaq -0x2a(%rbp), %rsi
movb %r14b, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x1080
movq %rax, %rbx
leaq 0xd46(%rip), %rsi       # 0x2045
movl $0x14, %edx
movq %rax, %rdi
callq 0x1080
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1040
leaq -0x2b(%rbp), %rsi
movb %r14b, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x1080
movq %rax, %rbx
leaq 0xd25(%rip), %rsi       # 0x205a
movl $0x14, %edx
movq %rax, %rdi
callq 0x1080
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1040
leaq -0x2c(%rbp), %rsi
movb %r14b, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x1080
movq %rax, %rbx
leaq 0xd04(%rip), %rsi       # 0x206f
movl $0x14, %edx
movq %rax, %rdi
callq 0x1080
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1040
leaq -0x2d(%rbp), %rsi
movb %r14b, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x1080
movq %rax, %rbx
leaq 0xce3(%rip), %rsi       # 0x2084
movl $0x14, %edx
movq %rax, %rdi
callq 0x1080
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
callq 0x1040
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1070
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1050
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq