#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 strlen(char *);
int main() {
  char word[40];
  int i = 0;
  int count = 0;
  printf("Please enter a string > ");
  fgets(word, 19, stdin);
  while (i < strlen(word)) {
    if (word[i] == 'a' || word[i] == 'o' || word[i] == 'e' || word[i] == 'i' ||
        word[i] == 'u' || word[i] == 'y')
      count++;
    i++;
  }
  printf("The number of syllables is %d.\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    0x2e82(%rip),%rax
mov    (%rax),%edx
mov    $0x13,%esi
call   1050 <fgets@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
jge    1211 <main+0xe1>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x61,%eax
je     11fa <main+0xca>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x6f,%eax
je     11fa <main+0xca>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x65,%eax
je     11fa <main+0xca>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x69,%eax
je     11fa <main+0xca>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x75,%eax
je     11fa <main+0xca>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x79,%eax
jne    1203 <main+0xd3>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1172 <main+0x42>
mov    -0x38(%rbp),%esi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xebf(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x13,%esi
call   1050 <fgets@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11ad <main+0x7d>
xor    %ebx,%ebx
mov    %rsp,%r14
mov    $0x1495,%r15d
xor    %ebp,%ebp
jmp    1193 <main+0x63>
xchg   %ax,%ax
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11ad <main+0x7d>
movzbl (%rsp,%rbx,1),%eax
add    $0x9f,%al
ror    %al
cmp    $0xc,%al
ja     1180 <main+0x50>
movzbl %al,%eax
bt     %rax,%r15
jae    1180 <main+0x50>
add    $0x1,%ebp
jmp    1180 <main+0x50>
lea    0xe65(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
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 [40 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 19, i32 %7)
br label %9
9: ; preds = %59, %0
%10 = load i32, i32* %3
%11 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %62
14: ; preds = %9
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 97
br i1 %20, label %56, label %21
21: ; preds = %14
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 111
br i1 %27, label %56, label %28
28: ; preds = %21
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 101
br i1 %34, label %56, label %35
35: ; preds = %28
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 105
br i1 %41, label %56, label %42
42: ; preds = %35
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 117
br i1 %48, label %56, label %49
49: ; preds = %42
%50 = load i32, i32* %3
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp eq i32 %54, 121
br i1 %55, label %56, label %59
56: ; preds = %49, %42, %35, %28, %21, %14
%57 = load i32, i32* %4
%58 = add nsw i32 %57, 1
store i32 %58, i32* %4
br label %59
59: ; preds = %56, %49
%60 = load i32, i32* %3
%61 = add nsw i32 %60, 1
store i32 %61, i32* %3
br label %9
62: ; preds = %9
%63 = load i32, i32* %4
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %63)
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 [40 x i8]
%2 = getelementptr inbounds [40 x i8], [40 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 19, i32 %4)
%6 = call i32 @strlen(i8* %2)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %0, %17
%9 = phi i64 [ %19, %17 ], [ 0, %0 ]
%10 = phi i32 [ %18, %17 ], [ 0, %0 ]
%11 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 %9
%12 = load i8, i8* %11
%13 = add i8 %12, -97
%14 = call i8 @llvm.fshl.i8(i8 %13, i8 %13, i8 7)
switch i8 %14, label %17 [
i8 0, label %15
i8 7, label %15
i8 2, label %15
i8 4, label %15
i8 10, label %15
i8 12, label %15
]
15: ; preds = %8, %8, %8, %8, %8, %8
%16 = add nsw i32 %10, 1
br label %17
17: ; preds = %8, %15
%18 = phi i32 [ %16, %15 ], [ %10, %8 ]
%19 = add nuw nsw i64 %9, 1
%20 = call i32 @strlen(i8* %2)
%21 = sext i32 %20 to i64
%22 = icmp slt i64 %19, %21
br i1 %22, label %8, label %23
23: ; preds = %17, %0
%24 = phi i32 [ 0, %0 ], [ %18, %17 ]
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %24)
ret i32 0
}