#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*/ memmove(char *, char *, int /*<<< orphan*/);
char *strchr(char *, char);
int /*<<< orphan*/ strlen(char *);
char *strrchr(char *, char);
void remove_unwanted_characters(char *input) {
  char *p;
  if (*input == '\'')
    memmove(&input[0], &input[1], strlen(input));
  p = strrchr(input, ' ');
  if (p)
    *p = '\0';
  p = strrchr(input, '\'');
  if (p)
    *p = '\0';
  p = strrchr(input, '\n');
  if (p)
    *p = '\0';
  p = strchr(input, '\0');
  if (p && *(p - 1) == '/')
    *(p - 1) = '\0';
}


x86 assembly (clang, -O0):
<remove_unwanted_characters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    1188 <remove_unwanted_characters+0x48>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1060 <memmove@plt>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11ac <remove_unwanted_characters+0x6c>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x27,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11d0 <remove_unwanted_characters+0x90>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11f4 <remove_unwanted_characters+0xb4>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1227 <remove_unwanted_characters+0xe7>
mov    -0x10(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x2f,%eax
jne    1227 <remove_unwanted_characters+0xe7>
mov    -0x10(%rbp),%rax
movb   $0x0,-0x1(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_unwanted_characters>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
cmpb   $0x27,(%rdi)
jne    1155 <remove_unwanted_characters+0x25>
lea    0x1(%rbx),%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1050 <memmove@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     116a <remove_unwanted_characters+0x3a>
movb   $0x0,(%rax)
mov    %rbx,%rdi
mov    $0x27,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     117f <remove_unwanted_characters+0x4f>
movb   $0x0,(%rax)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     1194 <remove_unwanted_characters+0x64>
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    %rbx,%rax
je     11ab <remove_unwanted_characters+0x7b>
cmpb   $0x2f,-0x1(%rax)
jne    11ab <remove_unwanted_characters+0x7b>
movb   $0x0,-0x1(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @remove_unwanted_characters(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 39
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = tail call i32 @strlen(i8* %0)
%7 = tail call i32 @memmove(i8* %0, i8* %5, i32 %6)
br label %8
8: ; preds = %4, %1
%9 = tail call i8* @strrchr(i8* %0, i8 signext 32)
%10 = icmp eq i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %8
store i8 0, i8* %9
br label %12
12: ; preds = %11, %8
%13 = tail call i8* @strrchr(i8* %0, i8 signext 39)
%14 = icmp eq i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %12
store i8 0, i8* %13
br label %16
16: ; preds = %15, %12
%17 = tail call i8* @strrchr(i8* %0, i8 signext 10)
%18 = icmp eq i8* %17, null
br i1 %18, label %20, label %19
19: ; preds = %16
store i8 0, i8* %17
br label %20
20: ; preds = %19, %16
%21 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %0)
%22 = getelementptr i8, i8* %0, i64 %21
%23 = icmp eq i8* %22, null
br i1 %23, label %29, label %24
24: ; preds = %20
%25 = getelementptr inbounds i8, i8* %22, i64 -1
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 47
br i1 %27, label %28, label %29
28: ; preds = %24
store i8 0, i8* %25
br label %29
29: ; preds = %28, %24, %20
ret void
}