#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*/ strcpy(char *, char *);
char *timlib_delete_character(char *source_destination, char character) {
  char buffer[4096];
  char *source_ptr = source_destination;
  char *destination_ptr = buffer;
  while (*source_ptr) {
    if (*source_ptr != character)
      *destination_ptr++ = *source_ptr;
    source_ptr++;
  }
  *destination_ptr = '\0';
  strcpy(source_destination, buffer);
  return source_destination;
}


x86 assembly (clang, -O0):
<timlib_delete_character>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x1018(%rbp)
lea    -0x1010(%rbp),%rax
mov    %rax,-0x1020(%rbp)
mov    -0x1018(%rbp),%rax
cmpb   $0x0,(%rax)
je     119b <timlib_delete_character+0x8b>
mov    -0x1018(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
je     1184 <timlib_delete_character+0x74>
mov    -0x1018(%rbp),%rax
mov    (%rax),%cl
mov    -0x1020(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x1020(%rbp)
mov    %cl,(%rax)
mov    -0x1018(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1018(%rbp)
jmp    113e <timlib_delete_character+0x2e>
mov    -0x1020(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timlib_delete_character>:
push   %rbx
sub    $0x1000,%rsp
mov    %rdi,%rbx
mov    (%rdi),%dl
mov    %rsp,%rax
test   %dl,%dl
je     1148 <timlib_delete_character+0x38>
lea    0x1(%rbx),%rcx
jmp    113b <timlib_delete_character+0x2b>
nopw   0x0(%rax,%rax,1)
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
je     1148 <timlib_delete_character+0x38>
cmp    %sil,%dl
je     1130 <timlib_delete_character+0x20>
mov    %dl,(%rax)
add    $0x1,%rax
jmp    1130 <timlib_delete_character+0x20>
movb   $0x0,(%rax)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x1000,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @timlib_delete_character(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca [4096 x i8]
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
store i8 %1, i8* %4
%8 = load i8*, i8** %3
store i8* %8, i8** %6
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
store i8* %9, i8** %7
br label %10
10: ; preds = %26, %2
%11 = load i8*, i8** %6
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %29
14: ; preds = %10
%15 = load i8*, i8** %6
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i8, i8* %4
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %17, %19
br i1 %20, label %21, label %26
21: ; preds = %14
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = load i8*, i8** %7
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %7
store i8 %23, i8* %24
br label %26
26: ; preds = %21, %14
%27 = load i8*, i8** %6
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %6
br label %10
29: ; preds = %10
%30 = load i8*, i8** %7
store i8 0, i8* %30
%31 = load i8*, i8** %3
%32 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%33 = call i32 @strcpy(i8* %31, i8* %32)
%34 = load i8*, i8** %3
ret i8* %34
}

LLVM IR (-O2):
define i8* @timlib_delete_character(i8* returned %0, i8 signext %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %2, %14
%8 = phi i8 [ %17, %14 ], [ %5, %2 ]
%9 = phi i8* [ %15, %14 ], [ %4, %2 ]
%10 = phi i8* [ %16, %14 ], [ %0, %2 ]
%11 = icmp eq i8 %8, %1
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = getelementptr inbounds i8, i8* %9, i64 1
store i8 %8, i8* %9
br label %14
14: ; preds = %12, %7
%15 = phi i8* [ %13, %12 ], [ %9, %7 ]
%16 = getelementptr inbounds i8, i8* %10, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %7
19: ; preds = %14, %2
%20 = phi i8* [ %4, %2 ], [ %15, %14 ]
store i8 0, i8* %20
%21 = call i32 @strcpy(i8* %0, i8* %4)
ret i8* %0
}