#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 */
char *strdup(char *);
void cleanup(char *s) {
  char *d = strdup(s);
  for (; *d; d++)
    if (*d != '\r' && *d != ' ')
      *s++ = *d;
  *s = 0;
}


x86 assembly (clang, -O0):
<cleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1183 <cleanup+0x73>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     116d <cleanup+0x5d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     116d <cleanup+0x5d>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1172 <cleanup+0x62>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1129 <cleanup+0x19>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strdup@plt>
jmp    1124 <cleanup+0x14>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0xd,%cl
je     1120 <cleanup+0x10>
cmp    $0x20,%cl
je     1120 <cleanup+0x10>
test   %cl,%cl
je     113d <cleanup+0x2d>
mov    %cl,(%rbx)
add    $0x1,%rbx
jmp    1120 <cleanup+0x10>
movb   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @cleanup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
br label %3
3: ; preds = %9, %1
%4 = phi i8* [ %0, %1 ], [ %10, %9 ]
%5 = phi i8* [ %2, %1 ], [ %11, %9 ]
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 0, label %12
i8 13, label %9
i8 32, label %9
]
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %6, i8* %4
br label %9
9: ; preds = %3, %3, %7
%10 = phi i8* [ %8, %7 ], [ %4, %3 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %5, i64 1
br label %3
12: ; preds = %3
store i8 0, i8* %4
ret void
}