#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);
int /*<<< orphan*/ printf(char *, char *);
int eliminar_espacios_local(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;
  printf("El texto pasado por puntero es:%s\n", texto);
  printf("El texto denominado reserva es:%s\n", reserva);
  return 0;
}


x86 assembly (clang, -O0):
<eliminar_espacios_local>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1040 <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     1194 <eliminar_espacios_local+0x74>
movsbl -0x19(%rbp),%eax
cmp    $0x20,%eax
je     117a <eliminar_espacios_local+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    114b <eliminar_espacios_local+0x2b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eliminar_espacios_local>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
jmp    1144 <eliminar_espacios_local+0x24>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%ecx
cmp    $0x20,%cl
je     1140 <eliminar_espacios_local+0x20>
test   %cl,%cl
je     1158 <eliminar_espacios_local+0x38>
mov    %cl,(%rax)
add    $0x1,%rax
jmp    1140 <eliminar_espacios_local+0x20>
lea    0xea1(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [35 x i8] c"El texto pasado por puntero es:%s\0A\00"
@.str.1 = [35 x i8] c"El texto denominado reserva es:%s\0A\00"
define i32 @eliminar_espacios_local(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** %2
%32 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = load i8*, i8** %4
%34 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"El texto pasado por puntero es:%s\0A\00"
@.str.1 = [35 x i8] c"El texto denominado reserva es:%s\0A\00"
define i32 @eliminar_espacios_local(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
%14 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %3)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}