#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] == '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    11ff <main+0xcf>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x61,%eax
je     11e8 <main+0xb8>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x6f,%eax
je     11e8 <main+0xb8>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x65,%eax
je     11e8 <main+0xb8>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x75,%eax
je     11e8 <main+0xb8>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x79,%eax
jne    11f1 <main+0xc1>
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    0xe10(%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    11ab <main+0x7b>
xor    %ebx,%ebx
mov    %rsp,%r14
mov    $0x1104011,%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    11ab <main+0x7b>
movzbl (%rsp,%rbx,1),%eax
add    $0x9f,%al
cmp    $0x18,%al
ja     1180 <main+0x50>
movzbl %al,%eax
bt     %rax,%r15
jae    1180 <main+0x50>
add    $0x1,%ebp
jmp    1180 <main+0x50>
lea    0xe67(%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 = %52, %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 %55
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 %49, 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 %49, 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 %49, 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, 117
br i1 %41, label %49, 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, 121
br i1 %48, label %49, label %52
49: ; preds = %42, %35, %28, %21, %14
%50 = load i32, i32* %4
%51 = add nsw i32 %50, 1
store i32 %51, i32* %4
br label %52
52: ; preds = %49, %42
%53 = load i32, i32* %3
%54 = add nsw i32 %53, 1
store i32 %54, i32* %3
br label %9
55: ; preds = %9
%56 = load i32, i32* %4
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %56)
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 %21
8: ; preds = %0, %15
%9 = phi i64 [ %17, %15 ], [ 0, %0 ]
%10 = phi i32 [ %16, %15 ], [ 0, %0 ]
%11 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 %9
%12 = load i8, i8* %11
switch i8 %12, label %15 [
i8 97, label %13
i8 111, label %13
i8 101, label %13
i8 117, label %13
i8 121, label %13
]
13: ; preds = %8, %8, %8, %8, %8
%14 = add nsw i32 %10, 1
br label %15
15: ; preds = %8, %13
%16 = phi i32 [ %14, %13 ], [ %10, %8 ]
%17 = add nuw nsw i64 %9, 1
%18 = call i32 @strlen(i8* %2)
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %8, label %21
21: ; preds = %15, %0
%22 = phi i32 [ 0, %0 ], [ %16, %15 ]
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %22)
ret i32 0
}