#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 */
scalar_t__ malloc(int);
char *eliminar_espacios(char *texto) {
  char *auxiliar, *reserva;
  auxiliar = (char *)malloc(sizeof(char));
  reserva = auxiliar;
  char c = *texto;
  while (c != '\0') {
    if (c != ' ') {
      *auxiliar = c;
      auxiliar++;
    }
    texto++;
    c = *texto;
  }
  texto = reserva;
  return reserva;
}


x86 assembly (clang, -O0):
<eliminar_espacios>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x0,%eax
je     1184 <eliminar_espacios+0x74>
movsbl -0x19(%rbp),%eax
cmp    $0x20,%eax
je     116a <eliminar_espacios+0x5a>
mov    -0x19(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
jmp    113b <eliminar_espacios+0x2b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eliminar_espacios>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
jmp    1134 <eliminar_espacios+0x24>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
movzbl (%rbx),%edx
cmp    $0x20,%dl
je     1130 <eliminar_espacios+0x20>
test   %dl,%dl
je     1148 <eliminar_espacios+0x38>
mov    %dl,(%rcx)
add    $0x1,%rcx
jmp    1130 <eliminar_espacios+0x20>
pop    %rbx
ret

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

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