#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__ strcmp(char *, char *);
char tolower(char);
void RemoverEspacos(char *entrada, char saida[]) {
  char *linha = entrada;
  int a = 0;
  while (strcmp(linha, "") != 0) {
    if ((linha[0] == ' ') || (linha[0] == '\n'))
      linha++;
    else {
      saida[a] = tolower(linha[0]);
      linha++;
      a++;
    }
  }
  saida[a] = '\0';
  return;
}


x86 assembly (clang, -O0):
<RemoverEspacos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11bd <RemoverEspacos+0x9d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1179 <RemoverEspacos+0x59>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    118a <RemoverEspacos+0x6a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11b8 <RemoverEspacos+0x98>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113f <RemoverEspacos+0x1f>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RemoverEspacos>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecb(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1185 <RemoverEspacos+0x65>
add    $0x1,%rbx
xor    %r12d,%r12d
lea    0xeb3(%rip),%r15
jmp    1164 <RemoverEspacos+0x44>
nop
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
add    $0x1,%rbx
test   %rax,%rax
je     1188 <RemoverEspacos+0x68>
movzbl -0x1(%rbx),%eax
cmp    $0xa,%al
je     1150 <RemoverEspacos+0x30>
cmp    $0x20,%al
je     1150 <RemoverEspacos+0x30>
movsbl %al,%edi
call   1040 <tolower@plt>
movslq %r12d,%r12
mov    %al,(%r14,%r12,1)
add    $0x1,%r12d
jmp    1150 <RemoverEspacos+0x30>
xor    %r12d,%r12d
movslq %r12d,%rax
movb   $0x0,(%r14,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @RemoverEspacos(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %19, label %5
5: ; preds = %2, %14
%6 = phi i32 [ %15, %14 ], [ 0, %2 ]
%7 = phi i8* [ %16, %14 ], [ %0, %2 ]
%8 = load i8, i8* %7
switch i8 %8, label %9 [
i8 32, label %14
i8 10, label %14
]
9: ; preds = %5
%10 = tail call signext i8 @tolower(i8 signext %8)
%11 = sext i32 %6 to i64
%12 = getelementptr inbounds i8, i8* %1, i64 %11
store i8 %10, i8* %12
%13 = add nsw i32 %6, 1
br label %14
14: ; preds = %5, %5, %9
%15 = phi i32 [ %13, %9 ], [ %6, %5 ], [ %6, %5 ]
%16 = getelementptr inbounds i8, i8* %7, i64 1
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %5
19: ; preds = %14, %2
%20 = phi i32 [ 0, %2 ], [ %15, %14 ]
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %1, i64 %21
store i8 0, i8* %22
ret void
}