#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 */
scalar_t__ strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void take_away_vowels(char *s) {
  int cnt = 0, i;
  for (i = 0; i < strlen(s) && cnt < 3; ++i)
    if (strchr("aeiou", s[i])) {
      strcpy(s + i, s + i + 1);
      --i;
      ++cnt;
    }
}


x86 assembly (clang, -O0):
<take_away_vowels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
jge    1175 <take_away_vowels+0x45>
cmpl   $0x3,-0xc(%rbp)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1185 <take_away_vowels+0x55>
jmp    11eb <take_away_vowels+0xbb>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
lea    0xe6c(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     11d8 <take_away_vowels+0xa8>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
add    %rax,%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11dd <take_away_vowels+0xad>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114a <take_away_vowels+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<take_away_vowels>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r12
call   1040 <strlen@plt>
test   %eax,%eax
jle    1190 <take_away_vowels+0x60>
xor    %ebp,%ebp
lea    0xeb3(%rip),%r14
xor    %r15d,%r15d
movslq %ebp,%rbx
movsbl (%r12,%rbx,1),%esi
mov    %r14,%rdi
call   1050 <strchr@plt>
test   %rax,%rax
je     117b <take_away_vowels+0x4b>
lea    (%r12,%rbx,1),%rdi
lea    0x1(%rdi),%rsi
call   1030 <strcpy@plt>
add    $0xffffffff,%ebx
add    $0x1,%r15d
mov    %ebx,%ebp
add    $0x1,%ebp
mov    %r12,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jge    1190 <take_away_vowels+0x60>
cmp    $0x3,%r15d
jl     1150 <take_away_vowels+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"aeiou\00"
define void @take_away_vowels(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %39, %1
%6 = load i32, i32* %4
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 3
br label %13
13: ; preds = %10, %5
%14 = phi i1 [ false, %5 ], [ %12, %10 ]
br i1 %14, label %15, label %42
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = call i64 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %38
23: ; preds = %15
%24 = load i8*, i8** %2
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8*, i8** %2
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = call i32 @strcpy(i8* %27, i8* %32)
%34 = load i32, i32* %4
%35 = add nsw i32 %34, -1
store i32 %35, i32* %4
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %38
38: ; preds = %23, %15
br label %39
39: ; preds = %38
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %5
42: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"aeiou\00"
define void @take_away_vowels(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %25
4: ; preds = %1, %17
%5 = phi i32 [ %20, %17 ], [ 0, %1 ]
%6 = phi i32 [ %18, %17 ], [ 0, %1 ]
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i64 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %4
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = tail call i32 @strcpy(i8* %8, i8* %13)
%15 = add nsw i32 %5, -1
%16 = add nsw i32 %6, 1
br label %17
17: ; preds = %4, %12
%18 = phi i32 [ %16, %12 ], [ %6, %4 ]
%19 = phi i32 [ %15, %12 ], [ %5, %4 ]
%20 = add nsw i32 %19, 1
%21 = tail call i32 @strlen(i8* %0)
%22 = icmp slt i32 %20, %21
%23 = icmp slt i32 %18, 3
%24 = select i1 %22, i1 %23, i1 false
br i1 %24, label %4, label %25
25: ; preds = %17, %1
ret void
}