#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int toupper(int);
int main(void) {
  int count = 0;
  int vowel;
  printf("Enter a sentence: ");
  while ((vowel = getchar()) != '\n') {
    switch (toupper(vowel)) {
    case 'A':
    case 'E':
    case 'I':
    case 'O':
    case 'U':
      count++;
      break;
    }
  }
  printf("That sentence contains %d vowels.\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xa,%eax
je     11d4 <main+0xa4>
mov    -0xc(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    %ecx,-0x10(%rbp)
sub    $0x41,%eax
je     11c6 <main+0x96>
jmp    1182 <main+0x52>
mov    -0x10(%rbp),%eax
sub    $0x45,%eax
je     11c6 <main+0x96>
jmp    1193 <main+0x63>
mov    -0x10(%rbp),%eax
sub    $0x49,%eax
je     11c6 <main+0x96>
jmp    11a4 <main+0x74>
mov    -0x10(%rbp),%eax
sub    $0x4f,%eax
je     11c6 <main+0x96>
jmp    11b5 <main+0x85>
mov    -0x10(%rbp),%eax
sub    $0x55,%eax
jne    11cf <main+0x9f>
jmp    11c6 <main+0x96>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x24>
mov    -0x8(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
jne    1168 <main+0x38>
lea    0xebd(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x495,%ebp
xor    %ebx,%ebx
jmp    118c <main+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     114f <main+0x1f>
mov    %eax,%edi
call   1030 <toupper@plt>
add    $0xffffffbf,%eax
ror    %eax
cmp    $0xa,%eax
ja     1180 <main+0x50>
bt     %eax,%ebp
jae    1180 <main+0x50>
add    $0x1,%ebx
jmp    1180 <main+0x50>

LLVM IR (-O0):
@.str = [19 x i8] c"Enter a sentence: \00"
@.str.1 = [35 x i8] c"That sentence contains %d vowels.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %14, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %3
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %3
%10 = call i32 @toupper(i32 %9)
switch i32 %10, label %14 [
i32 65, label %11
i32 69, label %11
i32 73, label %11
i32 79, label %11
i32 85, label %11
]
11: ; preds = %8, %8, %8, %8, %8
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %14
14: ; preds = %8, %11
br label %5
15: ; preds = %5
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter a sentence: \00"
@.str.1 = [35 x i8] c"That sentence contains %d vowels.\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = icmp eq i32 %2, 10
br i1 %3, label %16, label %4
4: ; preds = %0, %12
%5 = phi i32 [ %14, %12 ], [ %2, %0 ]
%6 = phi i32 [ %13, %12 ], [ 0, %0 ]
%7 = tail call i32 @toupper(i32 %5)
%8 = add i32 %7, -65
%9 = tail call i32 @llvm.fshl.i32(i32 %8, i32 %8, i32 31)
switch i32 %9, label %12 [
i32 0, label %10
i32 2, label %10
i32 4, label %10
i32 7, label %10
i32 10, label %10
]
10: ; preds = %4, %4, %4, %4, %4
%11 = add nsw i32 %6, 1
br label %12
12: ; preds = %4, %10
%13 = phi i32 [ %6, %4 ], [ %11, %10 ]
%14 = tail call i32 (...) @getchar()
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %4
16: ; preds = %12, %0
%17 = phi i32 [ 0, %0 ], [ %13, %12 ]
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %17)
ret i32 0
}