#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main(void) {
  char str[20];
  int cnt, i;
  printf("Please enter a string > ");
  scanf("%s", str);
  for (i = 0; i < strlen(str); i++) {
    if (str[i] == 'a' || str[i] == 'e')
      cnt++;
    if (str[i] == 'i' || str[i] == 'o')
      cnt++;
    if (str[i] == 'u' || str[i] == 'y')
      cnt++;
  }
  printf("The number of syllables is %d.\n", cnt);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jge    121a <main+0xea>
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x61,%eax
je     11a4 <main+0x74>
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x65,%eax
jne    11ad <main+0x7d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x69,%eax
je     11d1 <main+0xa1>
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x6f,%eax
jne    11da <main+0xaa>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x75,%eax
je     11fe <main+0xce>
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x79,%eax
jne    1207 <main+0xd7>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    120c <main+0xdc>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1164 <main+0x34>
mov    -0x24(%rbp),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
jmp    1186 <main+0x56>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11ac <main+0x7c>
movzbl (%rsp,%rbx,1),%eax
mov    %eax,%ecx
or     $0x4,%cl
cmp    $0x65,%cl
jne    1197 <main+0x67>
add    $0x1,%ebp
cmp    $0x6f,%al
je     119f <main+0x6f>
cmp    $0x69,%al
jne    11a2 <main+0x72>
add    $0x1,%ebp
cmp    $0x79,%al
je     1170 <main+0x40>
cmp    $0x75,%al
je     1170 <main+0x40>
jmp    1173 <main+0x43>
lea    0xe69(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Please enter a string > \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [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
%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 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
store i32 0, i32* %4
br label %8
8: ; preds = %65, %0
%9 = load i32, i32* %4
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %68
13: ; preds = %8
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 97
br i1 %19, label %27, label %20
20: ; preds = %13
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 101
br i1 %26, label %27, label %30
27: ; preds = %20, %13
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %30
30: ; preds = %27, %20
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 105
br i1 %36, label %44, label %37
37: ; preds = %30
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 111
br i1 %43, label %44, label %47
44: ; preds = %37, %30
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %47
47: ; preds = %44, %37
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 117
br i1 %53, label %61, label %54
54: ; preds = %47
%55 = load i32, i32* %4
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 121
br i1 %60, label %61, label %64
61: ; preds = %54, %47
%62 = load i32, i32* %3
%63 = add nsw i32 %62, 1
store i32 %63, i32* %3
br label %64
64: ; preds = %61, %54
br label %65
65: ; preds = %64
%66 = load i32, i32* %4
%67 = add nsw i32 %66, 1
store i32 %67, i32* %4
br label %8
68: ; preds = %8
%69 = load i32, i32* %3
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %69)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Please enter a string > \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [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 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @strlen(i8* %2)
%6 = icmp sgt i32 %5, 0
br label %7
7: ; preds = %0, %22
%8 = phi i64 [ 0, %0 ], [ %24, %22 ]
%9 = phi i32 [ undef, %0 ], [ %23, %22 ]
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %8
%11 = load i8, i8* %10
switch i8 %11, label %14 [
i8 97, label %12
i8 101, label %12
]
12: ; preds = %7, %7
%13 = add nsw i32 %9, 1
br label %14
14: ; preds = %7, %12
%15 = phi i32 [ %13, %12 ], [ %9, %7 ]
switch i8 %11, label %18 [
i8 105, label %16
i8 111, label %16
]
16: ; preds = %14, %14
%17 = add nsw i32 %15, 1
br label %18
18: ; preds = %14, %16
%19 = phi i32 [ %17, %16 ], [ %15, %14 ]
switch i8 %11, label %22 [
i8 117, label %20
i8 121, label %20
]
20: ; preds = %18, %18
%21 = add nsw i32 %19, 1
br label %22
22: ; preds = %18, %20
%23 = phi i32 [ %21, %20 ], [ %19, %18 ]
%24 = add nuw nsw i64 %8, 1
%25 = call i32 @strlen(i8* %2)
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %7, label %28
28: ; preds = %22
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %23)
ret i32 0
}