#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*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
void removeWhiteSpace(char *html) {
  char *buffer = malloc(strlen(html) + 1), *in, *out;
  memset(buffer, 0, strlen(html) + 1);
  out = buffer;
  for (in = html; *in != '\0'; in++) {
    if (*in <= ' ')
      continue;
    *out++ = *in;
  }
  strcpy(html, buffer);
  free(buffer);
}


x86 assembly (clang, -O0):
<removeWhiteSpace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rdx
add    $0x1,%rdx
xor    %esi,%esi
call   1060 <memset@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11f5 <removeWhiteSpace+0xa5>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jg     11cd <removeWhiteSpace+0x7d>
jmp    11e4 <removeWhiteSpace+0x94>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11a8 <removeWhiteSpace+0x58>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeWhiteSpace>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0x1(%rax),%rbx
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1060 <memset@plt>
mov    (%r14),%dl
test   %dl,%dl
je     11a8 <removeWhiteSpace+0x58>
lea    0x1(%r14),%rax
mov    %r15,%rcx
jmp    119b <removeWhiteSpace+0x4b>
nopl   0x0(%rax)
movzbl (%rax),%edx
add    $0x1,%rax
test   %dl,%dl
je     11a8 <removeWhiteSpace+0x58>
cmp    $0x21,%dl
jl     1190 <removeWhiteSpace+0x40>
mov    %dl,(%rcx)
add    $0x1,%rcx
jmp    1190 <removeWhiteSpace+0x40>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @removeWhiteSpace(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @memset(i8* %4, i32 0, i64 %3)
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %20, label %8
8: ; preds = %1, %15
%9 = phi i8 [ %18, %15 ], [ %6, %1 ]
%10 = phi i8* [ %16, %15 ], [ %4, %1 ]
%11 = phi i8* [ %17, %15 ], [ %0, %1 ]
%12 = icmp slt i8 %9, 33
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %9, i8* %10
br label %15
15: ; preds = %8, %13
%16 = phi i8* [ %10, %8 ], [ %14, %13 ]
%17 = getelementptr inbounds i8, i8* %11, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %8
20: ; preds = %15, %1
%21 = tail call i32 @strcpy(i8* %0, i8* %4)
%22 = tail call i32 @free(i8* %4)
ret void
}