#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*/ gets(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char *str = malloc(1000);
  printf("Enter a string: ");
  gets(str);
  printf("The vowels are: \n");
  while (*str) {
    if (*str == 'a' || *str == 'o' || *str == 'e' || *str == 'u' ||
        *str == 'i') {
      printf("%c ", *str);
    }
    str++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3e8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <gets@plt>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11f5 <main+0xc5>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
je     11cf <main+0x9f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6f,%eax
je     11cf <main+0x9f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x65,%eax
je     11cf <main+0x9f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x75,%eax
je     11cf <main+0x9f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x69,%eax
jne    11e4 <main+0xb4>
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1172 <main+0x42>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x3e8,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x104111,%r15d
lea    0xe90(%rip),%r14
jmp    1194 <main+0x54>
test   %al,%al
je     11b7 <main+0x77>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%eax
lea    -0x61(%rax),%ecx
cmp    $0x14,%cl
ja     1183 <main+0x43>
movzbl %cl,%ecx
bt     %rcx,%r15
jae    1183 <main+0x43>
movzbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1190 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a string: \00"
@.str.1 = [18 x i8] c"The vowels are: \0A\00"
@.str.2 = [4 x i8] c"%c \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @malloc(i32 1000)
store i8* %3, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32 @gets(i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %42, %0
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %45
12: ; preds = %8
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 97
br i1 %16, label %37, label %17
17: ; preds = %12
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 111
br i1 %21, label %37, label %22
22: ; preds = %17
%23 = load i8*, i8** %2
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 101
br i1 %26, label %37, label %27
27: ; preds = %22
%28 = load i8*, i8** %2
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 117
br i1 %31, label %37, label %32
32: ; preds = %27
%33 = load i8*, i8** %2
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 105
br i1 %36, label %37, label %42
37: ; preds = %32, %27, %22, %17, %12
%38 = load i8*, i8** %2
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %37, %32
%43 = load i8*, i8** %2
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %2
br label %8
45: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a string: \00"
@.str.2 = [4 x i8] c"%c \00"
@str = [17 x i8] c"The vowels are: \00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(1000) i8* @malloc(i32 1000)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @gets(i8* %1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %11, %0
%6 = phi i8* [ %1, %0 ], [ %12, %11 ]
%7 = load i8, i8* %6
switch i8 %7, label %11 [
i8 0, label %13
i8 97, label %8
i8 111, label %8
i8 101, label %8
i8 117, label %8
i8 105, label %8
]
8: ; preds = %5, %5, %5, %5, %5
%9 = zext i8 %7 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %5, %8
%12 = getelementptr inbounds i8, i8* %6, i64 1
br label %5
13: ; preds = %5
ret i32 0
}