#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
int main(int argv, char *argc[]) {
  char c;
  FILE *in, *out;
  if (argv > 2) {
    in = fopen(argc[1], "r");
    out = fopen(argc[2], "w");
    while ((c = getc(in)) != EOF) {
      if (c == ' ')
        continue;
      putc(c, out);
    }
    fclose(in);
    fclose(out);
    return 0;
  } else {
    printf("Utilizacao comprime <nome do arquivo>\n");
    return -1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1205 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe81(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe6b(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <getc@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e32(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11e7 <main+0x97>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    11d3 <main+0x83>
jmp    11a0 <main+0x50>
mov    -0x11(%rbp),%al
mov    -0x28(%rbp),%rsi
movsbl %al,%edi
call   1050 <putc@plt>
jmp    11a0 <main+0x50>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1218 <main+0xc8>
lea    0xdf8(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x3,%edi
jl     11be <main+0x6e>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe98(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    0x10(%r14),%rdi
lea    0xe87(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1070 <getc@plt>
mov    0x2e56(%rip),%r15
jmp    11a8 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1070 <getc@plt>
cmp    (%r15),%al
je     11d1 <main+0x81>
cmp    $0x20,%al
je     11a0 <main+0x50>
movsbl %al,%edi
mov    %r14,%rsi
call   1050 <putc@plt>
jmp    11a0 <main+0x50>
lea    0xe3f(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
jmp    11e3 <main+0x93>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i8 0
@.str.2 = [39 x i8] c"Utilizacao comprime <nome do arquivo>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32*
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 2
br i1 %10, label %11, label %41
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %7
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %8
br label %20
20: ; preds = %32, %31, %11
%21 = load i32*, i32** %7
%22 = call signext i8 @getc(i32* %21)
store i8 %22, i8* %6
%23 = sext i8 %22 to i32
%24 = load i8, i8* @EOF
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %23, %25
br i1 %26, label %27, label %36
27: ; preds = %20
%28 = load i8, i8* %6
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 32
br i1 %30, label %31, label %32
31: ; preds = %27
br label %20
32: ; preds = %27
%33 = load i8, i8* %6
%34 = load i32*, i32** %8
%35 = call i32 @putc(i8 signext %33, i32* %34)
br label %20
36: ; preds = %20
%37 = load i32*, i32** %7
%38 = call i32 @fclose(i32* %37)
%39 = load i32*, i32** %8
%40 = call i32 @fclose(i32* %39)
store i32 0, i32* %3
br label %43
41: ; preds = %2
%42 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %43
43: ; preds = %41, %36
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i8 0
@str = [38 x i8] c"Utilizacao comprime <nome do arquivo>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %26
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call signext i8 @getc(i32* %7)
%12 = load i8, i8* @EOF
%13 = icmp eq i8 %11, %12
br i1 %13, label %23, label %14
14: ; preds = %4, %19
%15 = phi i8 [ %20, %19 ], [ %11, %4 ]
%16 = icmp eq i8 %15, 32
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32 @putc(i8 signext %15, i32* %10)
br label %19
19: ; preds = %17, %14
%20 = tail call signext i8 @getc(i32* %7)
%21 = load i8, i8* @EOF
%22 = icmp eq i8 %20, %21
br i1 %22, label %23, label %14
23: ; preds = %19, %4
%24 = tail call i32 @fclose(i32* %7)
%25 = tail call i32 @fclose(i32* %10)
br label %28
26: ; preds = %2
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
%29 = phi i32 [ 0, %23 ], [ -1, %26 ]
ret i32 %29
}