#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*/ timlib_strcpy(char *, char *, int /*<<< orphan*/);
char *remove_character(char *source_destination, char character) {
  char *anchor = source_destination;
  if (source_destination) {
    while (*source_destination) {
      if (*source_destination == character)
        timlib_strcpy(source_destination, source_destination + 1, 0);
      else
        source_destination++;
    }
  }
  return anchor;
}


x86 assembly (clang, -O0):
<remove_character>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1188 <remove_character+0x78>
jmp    113a <remove_character+0x2a>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1183 <remove_character+0x73>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1172 <remove_character+0x62>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
xor    %edx,%edx
call   1030 <timlib_strcpy@plt>
jmp    117e <remove_character+0x6e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    113a <remove_character+0x2a>
jmp    1188 <remove_character+0x78>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_character>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
test   %rdi,%rdi
je     114f <remove_character+0x3f>
mov    (%r14),%al
test   %al,%al
je     114f <remove_character+0x3f>
mov    %esi,%ebp
mov    %r14,%rbx
jmp    1141 <remove_character+0x31>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %edx,%edx
call   1030 <timlib_strcpy@plt>
movzbl (%rbx),%eax
test   %al,%al
je     114f <remove_character+0x3f>
lea    0x1(%rbx),%rsi
cmp    %bpl,%al
je     1130 <remove_character+0x20>
mov    %rsi,%rbx
jmp    113a <remove_character+0x2a>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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