#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;
    case 'y':
      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    0xf27(%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     1210 <main+0xf0>
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x18,%eax
ja     11f7 <main+0xd7>
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    11fd <main+0xdd>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11fd <main+0xdd>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11fd <main+0xdd>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11fd <main+0xdd>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11fd <main+0xdd>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11fd <main+0xdd>
mov    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1202 <main+0xe2>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1162 <main+0x42>
mov    -0x24(%rbp),%esi
lea    0xe63(%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    0xf08(%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    $0xc,%edx
ja     1170 <main+0x50>
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
add    $0x1,%ebx
jmp    1170 <main+0x50>
lea    0xeb0(%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 = %43, %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 %46
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 %40 [
i32 97, label %22
i32 101, label %25
i32 105, label %28
i32 111, label %31
i32 117, label %34
i32 121, label %37
]
22: ; preds = %16
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %42
25: ; preds = %16
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %42
28: ; preds = %16
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %42
31: ; preds = %16
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %42
34: ; preds = %16
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %42
37: ; preds = %16
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %42
40: ; preds = %16
%41 = load i32, i32* %3
store i32 %41, i32* %3
br label %42
42: ; preds = %40, %37, %34, %31, %28, %25, %22
br label %43
43: ; preds = %42
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %9
46: ; preds = %9
%47 = load i32, i32* %3
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %47)
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 %33, label %8
8: ; preds = %0, %27
%9 = phi i64 [ %29, %27 ], [ 0, %0 ]
%10 = phi i8 [ %31, %27 ], [ %6, %0 ]
%11 = phi i32 [ %28, %27 ], [ 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 %27 [
i32 0, label %15
i32 2, label %17
i32 4, label %19
i32 7, label %21
i32 10, label %23
i32 12, label %25
]
15: ; preds = %8
%16 = add nsw i32 %11, 1
br label %27
17: ; preds = %8
%18 = add nsw i32 %11, 1
br label %27
19: ; preds = %8
%20 = add nsw i32 %11, 1
br label %27
21: ; preds = %8
%22 = add nsw i32 %11, 1
br label %27
23: ; preds = %8
%24 = add nsw i32 %11, 1
br label %27
25: ; preds = %8
%26 = add nsw i32 %11, 1
br label %27
27: ; preds = %8, %15, %17, %19, %21, %23, %25
%28 = phi i32 [ %26, %25 ], [ %24, %23 ], [ %22, %21 ], [ %20, %19 ], [ %18, %17 ], [ %16, %15 ], [ %11, %8 ]
%29 = add nuw i64 %9, 1
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 0
br i1 %32, label %33, label %8
33: ; preds = %27, %0
%34 = phi i32 [ 0, %0 ], [ %28, %27 ]
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %34)
ret i32 0
}