#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 */
typedef int /*<<< orphan*/ src;
typedef size_t int32_t;

/* Variables and functions */
char *rmalloc(int);
char *remove_spaces(char *src) {
  char *dst = rmalloc(sizeof(src));
  int32_t s, d = 0;
  for (s = 0; src[s] != 0; s++)
    if (src[s] != ' ' && src[s] != '\t') {
      dst[d] = src[s];
      d++;
    }
  dst[d] = 0;
  return dst;
}


x86 assembly (clang, -O0):
<remove_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x8,%edi
call   1030 <rmalloc@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11b1 <remove_spaces+0xa1>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     119b <remove_spaces+0x8b>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
je     119b <remove_spaces+0x8b>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11a0 <remove_spaces+0x90>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113a <remove_spaces+0x2a>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_spaces>:
push   %rbx
mov    %rdi,%rbx
mov    $0x8,%edi
call   1030 <rmalloc@plt>
xor    %ecx,%ecx
jmp    1134 <remove_spaces+0x24>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
movzbl (%rbx),%edx
cmp    $0x9,%dl
je     1130 <remove_spaces+0x20>
cmp    $0x20,%dl
je     1130 <remove_spaces+0x20>
test   %dl,%dl
je     114e <remove_spaces+0x3e>
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
jmp    1130 <remove_spaces+0x20>
movb   $0x0,(%rax,%rcx,1)
pop    %rbx
ret

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

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