#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int toupper(char);
int main(void) {
  char letter;
  int count = 0;
  printf("enter a sentence: ");
  while ((letter = getchar()) != '\n') {
    switch (toupper(letter)) {
    case 'A':
    case 'E':
    case 'I':
    case 'O':
    case 'U':
      count += 1;
      break;
    default:
      break;
    }
  }
  printf("your 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,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     11e2 <main+0xb2>
movsbl -0x5(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    %ecx,-0x10(%rbp)
sub    $0x41,%eax
je     11ca <main+0x9a>
jmp    1186 <main+0x56>
mov    -0x10(%rbp),%eax
sub    $0x45,%eax
je     11ca <main+0x9a>
jmp    1197 <main+0x67>
mov    -0x10(%rbp),%eax
sub    $0x49,%eax
je     11ca <main+0x9a>
jmp    11a8 <main+0x78>
mov    -0x10(%rbp),%eax
sub    $0x4f,%eax
je     11ca <main+0x9a>
jmp    11b9 <main+0x89>
mov    -0x10(%rbp),%eax
sub    $0x55,%eax
jne    11d8 <main+0xa8>
jmp    11ca <main+0x9a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11dd <main+0xad>
jmp    11dd <main+0xad>
jmp    1154 <main+0x24>
mov    -0xc(%rbp),%esi
lea    0xe27(%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,%al
jne    1167 <main+0x37>
lea    0xebe(%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    117b <main+0x4b>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     114e <main+0x1e>
movsbl %al,%edi
call   1030 <toupper@plt>
add    $0xffffffbf,%eax
ror    %eax
cmp    $0xa,%eax
ja     1170 <main+0x40>
bt     %eax,%ebp
jae    1170 <main+0x40>
add    $0x1,%ebx
jmp    1170 <main+0x40>

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

LLVM IR (-O2):
@.str = [19 x i8] c"enter a sentence: \00"
@.str.1 = [34 x i8] c"your 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 signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %16, label %4
4: ; preds = %0, %12
%5 = phi i8 [ %14, %12 ], [ %2, %0 ]
%6 = phi i32 [ %13, %12 ], [ 0, %0 ]
%7 = tail call i32 @toupper(i8 signext %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 signext i8 (...) @getchar()
%15 = icmp eq i8 %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 ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %17)
ret i32 0
}