#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 array[20];
  char vowels[] = {'a', 'e', 'i', 'o', 'u', 'y'};
  int i, count, d;
  printf("Please enter a string > ");
  fgets(array, 20, stdin);
  count = 0;
  for (i = 0; i < strlen(array) - 1; i++) {
    for (d = 0; d <= 5; d++) {
      if ((char)array[i] == (char)vowels[d]) {
        count++;
        break;
      }
    }
  }
  printf("The number of syllables is %.0d.\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x26(%rbp)
mov    0xeb5(%rip),%ax
mov    %ax,-0x22(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1050 <fgets@plt>
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x38(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1204 <main+0xd4>
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jg     11f1 <main+0xc1>
movslq -0x2c(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
movslq -0x34(%rbp),%rcx
movsbl -0x26(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    11de <main+0xae>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11f1 <main+0xc1>
jmp    11e3 <main+0xb3>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ac <main+0x7c>
jmp    11f6 <main+0xc6>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1186 <main+0x56>
mov    -0x30(%rbp),%esi
lea    0xe11(%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    $0x18,%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    $0x14,%esi
call   1050 <fgets@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     11b0 <main+0x80>
xor    %ebx,%ebx
mov    %rsp,%r14
mov    $0x1495,%r15d
xor    %ebp,%ebp
jmp    1196 <main+0x66>
nop
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%rbx
jge    11b0 <main+0x80>
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    0xe62(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [25 x i8] c"Please enter a string > \00"
@stdin = global i32 0
@.str.1 = [34 x i8] c"The number of syllables is %.0d.\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 = call i32 @strlen(i8* %2)
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %24
8: ; preds = %0, %17
%9 = phi i64 [ %19, %17 ], [ 0, %0 ]
%10 = phi i32 [ %18, %17 ], [ 0, %0 ]
%11 = getelementptr inbounds [20 x i8], [20 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 2, label %15
i8 4, label %15
i8 7, 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 = add nsw i32 %20, -1
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %19, %22
br i1 %23, label %8, label %24
24: ; preds = %17, %0
%25 = phi i32 [ 0, %0 ], [ %18, %17 ]
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %25)
ret i32 0
}