#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__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ remove_chars(char **, char *);
int main() {
  char *original = (char *)malloc(60 * sizeof(char));
  char *tmp = "Battle of the Vowels: Hawaii vs. Grozny";
  int c;
  for (c = 0; tmp[c] != '\0'; c++) {
    original[c] = tmp[c];
  }
  char *remove = "aeoiu";
  printf("original: %s\n", original);
  remove_chars(&original, remove);
  printf("removed:  %s\n", original);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3c,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xeac(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1198 <main+0x68>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115f <main+0x2f>
lea    0xe89(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1050 <remove_chars@plt>
mov    -0x10(%rbp),%rsi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3c,%edi
call   1040 <malloc@plt>
mov    %rax,(%rsp)
xor    %ecx,%ecx
lea    0xeb8(%rip),%rsi
nopl   0x0(%rax,%rax,1)
movzbl (%rcx,%rsi,1),%edx
movzbl 0x1(%rcx,%rsi,1),%edi
mov    %dl,(%rax,%rcx,1)
mov    (%rsp),%rax
mov    %dil,0x1(%rax,%rcx,1)
mov    (%rsp),%rax
movzbl 0x2(%rcx,%rsi,1),%edx
mov    %dl,0x2(%rax,%rcx,1)
add    $0x3,%rcx
mov    (%rsp),%rax
cmp    $0x27,%rcx
jne    1150 <main+0x20>
lea    0xea7(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xe92(%rip),%rsi
mov    %rsp,%rdi
call   1050 <remove_chars@plt>
mov    (%rsp),%rsi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Battle of the Vowels: Hawaii vs. Grozny\00"
@.str.1 = [6 x i8] c"aeoiu\00"
@.str.2 = [14 x i8] c"original: %s\0A\00"
@.str.3 = [14 x i8] c"removed: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i32 0, i32* %1
%6 = call i64 @malloc(i32 60)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %2
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8** %3
store i32 0, i32* %4
br label %8
8: ; preds = %26, %0
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %29
16: ; preds = %8
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = load i8*, i8** %2
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 %21, i8* %25
br label %26
26: ; preds = %16
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %8
29: ; preds = %8
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %5
%30 = load i8*, i8** %2
%31 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = load i8*, i8** %5
%33 = call i32 @remove_chars(i8** %2, i8* %32)
%34 = load i8*, i8** %2
%35 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"Battle of the Vowels: Hawaii vs. Grozny\00"
@.str.1 = [6 x i8] c"aeoiu\00"
@.str.2 = [14 x i8] c"original: %s\0A\00"
@.str.3 = [14 x i8] c"removed: %s\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = tail call i64 @malloc(i32 60)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %1
br label %5
5: ; preds = %5, %0
%6 = phi i8* [ %4, %0 ], [ %23, %5 ]
%7 = phi i64 [ 0, %0 ], [ %21, %5 ]
%8 = getelementptr inbounds [40 x i8], [40 x i8]* @.str, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %6, i64 %7
store i8 %9, i8* %10
%11 = add nuw nsw i64 %7, 1
%12 = load i8*, i8** %1
%13 = getelementptr inbounds [40 x i8], [40 x i8]* @.str, i64 0, i64 %11
%14 = load i8, i8* %13
%15 = getelementptr inbounds i8, i8* %12, i64 %11
store i8 %14, i8* %15
%16 = add nuw nsw i64 %7, 2
%17 = load i8*, i8** %1
%18 = getelementptr inbounds [40 x i8], [40 x i8]* @.str, i64 0, i64 %16
%19 = load i8, i8* %18
%20 = getelementptr inbounds i8, i8* %17, i64 %16
store i8 %19, i8* %20
%21 = add nuw nsw i64 %7, 3
%22 = icmp eq i64 %21, 39
%23 = load i8*, i8** %1
br i1 %22, label %24, label %5
24: ; preds = %5
%25 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%26 = call i32 @remove_chars(i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%27 = load i8*, i8** %1
%28 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %27)
ret i32 0
}