#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*/ isspace(int);
char *strdup(char *);
size_t strlen(char *);
char *eliminaEspacios(char *buffer) {
  size_t i = 0;
  size_t j = 0;
  int salir = 0;
  char aux[2000];
  for (i = 0; salir == 0 && i < strlen(buffer); i++) {
    if (!isspace((int)buffer[i])) {
      for (j = 0; j < strlen(buffer); j++) {
        aux[j] = buffer[i];
        i++;
      }
      salir = 1;
    }
  }
  aux[j] = '\0';
  return strdup(aux);
}


x86 assembly (clang, -O0):
<eliminaEspacios>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x7f1(%rbp)
jne    119a <eliminaEspacios+0x6a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x800(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x800(%rbp),%rax
cmp    %rcx,%rax
setb   %al
mov    %al,-0x7f1(%rbp)
mov    -0x7f1(%rbp),%al
test   $0x1,%al
jne    11ad <eliminaEspacios+0x7d>
jmp    1246 <eliminaEspacios+0x116>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    1230 <eliminaEspacios+0x100>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x808(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x808(%rbp),%rax
cmp    %rcx,%rax
jae    1229 <eliminaEspacios+0xf9>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x18(%rbp),%rax
mov    %cl,-0x7f0(%rbp,%rax,1)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11cf <eliminaEspacios+0x9f>
movl   $0x1,-0x1c(%rbp)
jmp    1235 <eliminaEspacios+0x105>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    115e <eliminaEspacios+0x2e>
mov    -0x18(%rbp),%rax
movb   $0x0,-0x7f0(%rbp,%rax,1)
lea    -0x7f0(%rbp),%rdi
call   1050 <strdup@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eliminaEspacios>:
push   %r15
push   %r14
push   %rbx
sub    $0x7d0,%rsp
mov    %rdi,%r15
call   1030 <strlen@plt>
test   %rax,%rax
je     1177 <eliminaEspacios+0x37>
mov    %rax,%r14
xor    %ebx,%ebx
xchg   %ax,%ax
movsbl (%r15,%rbx,1),%edi
call   1040 <isspace@plt>
test   %eax,%eax
je     117c <eliminaEspacios+0x3c>
add    $0x1,%rbx
cmp    %r14,%rbx
jb     1160 <eliminaEspacios+0x20>
xor    %r14d,%r14d
jmp    118d <eliminaEspacios+0x4d>
add    %rbx,%r15
mov    %rsp,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <memcpy@plt>
movb   $0x0,(%rsp,%r14,1)
mov    %rsp,%rdi
call   1060 <strdup@plt>
add    $0x7d0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define noalias i8* @eliminaEspacios(i8* nocapture %0) {
%2 = alloca [2000 x i8]
%3 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 0
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %1, %16
%8 = phi i64 [ %17, %16 ], [ 0, %1 ]
%9 = getelementptr i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = tail call i32 @isspace(i32 %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %7
%15 = getelementptr i8, i8* %0, i64 %8
br label %19
16: ; preds = %7
%17 = add nuw i64 %8, 1
%18 = icmp ult i64 %17, %5
br i1 %18, label %7, label %19
19: ; preds = %16, %1, %14
%20 = phi i64 [ %5, %14 ], [ 0, %1 ], [ 0, %16 ]
%21 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 %20
store i8 0, i8* %21
%22 = call i8* @strdup(i8* %4)
ret i8* %22
}