#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*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
void stripCtrlE(char *entryName) {
  char *tmpBuffer = (char *)malloc(strlen(entryName) + 1);
  size_t i;
  int j = 0;
  for (i = 0; i < strlen(entryName); i++)
    if (entryName[i] != 0x05) {
      tmpBuffer[j] = entryName[i];
      j++;
    }
  tmpBuffer[j] = 0;
  strcpy(entryName, tmpBuffer);
  free(tmpBuffer);
}


x86 assembly (clang, -O0):
<stripCtrlE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jae    11de <stripCtrlE+0x9e>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5,%eax
je     11c8 <stripCtrlE+0x88>
mov    -0x8(%rbp),%rax
mov    -0x18(%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    11cd <stripCtrlE+0x8d>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1173 <stripCtrlE+0x33>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripCtrlE>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    (%r15),%al
xor    %r12d,%r12d
test   %al,%al
je     1197 <stripCtrlE+0x57>
mov    $0x1,%ebx
cmp    $0x5,%al
je     117b <stripCtrlE+0x3b>
xchg   %ax,%ax
movslq %r12d,%r12
mov    %al,(%r14,%r12,1)
add    $0x1,%r12d
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    %rax,%rbx
jae    1197 <stripCtrlE+0x57>
movzbl (%r15,%rbx,1),%eax
add    $0x1,%rbx
cmp    $0x5,%al
jne    1170 <stripCtrlE+0x30>
jmp    117b <stripCtrlE+0x3b>
movslq %r12d,%rax
movb   $0x0,(%r14,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @stripCtrlE(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i64 @strlen(i8* %6)
%8 = add i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
store i32 0, i32* %5
store i64 0, i64* %4
br label %12
12: ; preds = %36, %1
%13 = load i64, i64* %4
%14 = load i8*, i8** %2
%15 = call i64 @strlen(i8* %14)
%16 = icmp ult i64 %13, %15
br i1 %16, label %17, label %39
17: ; preds = %12
%18 = load i8*, i8** %2
%19 = load i64, i64* %4
%20 = getelementptr inbounds i8, i8* %18, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 5
br i1 %23, label %24, label %35
24: ; preds = %17
%25 = load i8*, i8** %2
%26 = load i64, i64* %4
%27 = getelementptr inbounds i8, i8* %25, i64 %26
%28 = load i8, i8* %27
%29 = load i8*, i8** %3
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 %28, i8* %32
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %35
35: ; preds = %24, %17
br label %36
36: ; preds = %35
%37 = load i64, i64* %4
%38 = add i64 %37, 1
store i64 %38, i64* %4
br label %12
39: ; preds = %12
%40 = load i8*, i8** %3
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
store i8 0, i8* %43
%44 = load i8*, i8** %2
%45 = load i8*, i8** %3
%46 = call i32 @strcpy(i8* %44, i8* %45)
%47 = load i8*, i8** %3
%48 = call i32 @free(i8* %47)
ret void
}

LLVM IR (-O2):
define void @stripCtrlE(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = add i32 %3, 1
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %26, label %9
9: ; preds = %1, %23
%10 = phi i8 [ %25, %23 ], [ %7, %1 ]
%11 = phi i32 [ %19, %23 ], [ 0, %1 ]
%12 = phi i64 [ %20, %23 ], [ 0, %1 ]
%13 = icmp eq i8 %10, 5
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = sext i32 %11 to i64
%16 = getelementptr inbounds i8, i8* %6, i64 %15
store i8 %10, i8* %16
%17 = add nsw i32 %11, 1
br label %18
18: ; preds = %9, %14
%19 = phi i32 [ %17, %14 ], [ %11, %9 ]
%20 = add nuw i64 %12, 1
%21 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%22 = icmp ult i64 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = getelementptr inbounds i8, i8* %0, i64 %20
%25 = load i8, i8* %24
br label %9
26: ; preds = %18, %1
%27 = phi i32 [ 0, %1 ], [ %19, %18 ]
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %6, i64 %28
store i8 0, i8* %29
%30 = tail call i32 @strcpy(i8* %0, i8* %6)
%31 = tail call i32 @free(i8* %6)
ret void
}