#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 /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main() {
  char str[20];
  int num = 0, i;
  printf("Please enter a string > ");
  fgets(str, 20, stdin);
  for (i = 0; str[i] != '\0'; i++) {
    switch (str[i]) {
    case 'a':
      num = num + 1;
      break;
    case 'e':
      num = num + 1;
      break;
    case 'i':
      num = num + 1;
      break;
    case 'o':
      num = num + 1;
      break;
    case 'u':
      num = num + 1;
      break;
    default:
      num = num;
    }
  }
  printf("The number of syllables is %d.\n", num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xf17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1040 <fgets@plt>
movl   $0x0,-0x28(%rbp)
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1202 <main+0xe2>
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x14,%eax
ja     11e9 <main+0xc9>
mov    -0x30(%rbp),%rax
lea    0xe66(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ef <main+0xcf>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ef <main+0xcf>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ef <main+0xcf>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ef <main+0xcf>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ef <main+0xcf>
mov    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11f4 <main+0xd4>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1162 <main+0x42>
mov    -0x24(%rbp),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xf00(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x14,%esi
call   1040 <fgets@plt>
mov    (%rsp),%dl
test   %dl,%dl
je     1196 <main+0x76>
lea    0x1(%rsp),%rax
xor    %ebx,%ebx
lea    0xea0(%rip),%rcx
jmp    117b <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rax),%edx
add    $0x1,%rax
test   %dl,%dl
je     1196 <main+0x76>
movsbl %dl,%edx
add    $0xffffff9f,%edx
ror    %edx
cmp    $0xa,%edx
ja     1170 <main+0x50>
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
add    $0x1,%ebx
jmp    1170 <main+0x50>
lea    0xea8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Please enter a string > \00"
@stdin = global i32 0
@.str.1 = [32 x i8] c"The number of syllables is %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 20, i32 %7)
store i32 0, i32* %4
br label %9
9: ; preds = %40, %0
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %43
16: ; preds = %9
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
switch i32 %21, label %37 [
i32 97, label %22
i32 101, label %25
i32 105, label %28
i32 111, label %31
i32 117, label %34
]
22: ; preds = %16
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %39
25: ; preds = %16
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %39
28: ; preds = %16
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %39
31: ; preds = %16
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %39
34: ; preds = %16
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %39
37: ; preds = %16
%38 = load i32, i32* %3
store i32 %38, i32* %3
br label %39
39: ; preds = %37, %34, %31, %28, %25, %22
br label %40
40: ; preds = %39
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %9
43: ; preds = %9
%44 = load i32, i32* %3
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Please enter a string > \00"
@stdin = global i32 0
@.str.1 = [32 x i8] c"The number of syllables is %d.\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 20, i32 %4)
%6 = load i8, i8* %2
%7 = icmp eq i8 %6, 0
br i1 %7, label %31, label %8
8: ; preds = %0, %25
%9 = phi i64 [ %27, %25 ], [ 0, %0 ]
%10 = phi i8 [ %29, %25 ], [ %6, %0 ]
%11 = phi i32 [ %26, %25 ], [ 0, %0 ]
%12 = sext i8 %10 to i32
%13 = add nsw i32 %12, -97
%14 = call i32 @llvm.fshl.i32(i32 %13, i32 %13, i32 31)
switch i32 %14, label %25 [
i32 0, label %15
i32 2, label %17
i32 4, label %19
i32 7, label %21
i32 10, label %23
]
15: ; preds = %8
%16 = add nsw i32 %11, 1
br label %25
17: ; preds = %8
%18 = add nsw i32 %11, 1
br label %25
19: ; preds = %8
%20 = add nsw i32 %11, 1
br label %25
21: ; preds = %8
%22 = add nsw i32 %11, 1
br label %25
23: ; preds = %8
%24 = add nsw i32 %11, 1
br label %25
25: ; preds = %8, %15, %17, %19, %21, %23
%26 = phi i32 [ %24, %23 ], [ %22, %21 ], [ %20, %19 ], [ %18, %17 ], [ %16, %15 ], [ %11, %8 ]
%27 = add nuw i64 %9, 1
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 0
br i1 %30, label %31, label %8
31: ; preds = %25, %0
%32 = phi i32 [ 0, %0 ], [ %26, %25 ]
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %32)
ret i32 0
}