#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 */
scalar_t__ EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, unsigned char *);
int /*<<< orphan*/ printf(char *);
int main() {
  FILE *original = fopen("textoIn.txt", "rb");
  FILE *huffed = fopen("decompressed.txt", "rb");
  unsigned char originalByte;
  while (fscanf(original, "%c", &originalByte) != EOF) {
    unsigned char decompressedByte;
    if (fscanf(huffed, "%c", &decompressedByte) == EOF ||
        decompressedByte != originalByte) {
      printf("ETA POARR T-T\n");
      return (1);
    }
  }
  printf("FOI POARR!!!!!\n");
  fclose(original);
  fclose(huffed);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xea2(%rip),%rdi
lea    0xe98(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe98(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1050 <fscanf@plt>
mov    0x2e50(%rip),%rcx
cmp    (%rcx),%rax
je     11f2 <main+0xb2>
mov    -0x18(%rbp),%rdi
lea    0xe74(%rip),%rsi
lea    -0x1a(%rbp),%rdx
call   1050 <fscanf@plt>
mov    0x2e2c(%rip),%rcx
cmp    (%rcx),%rax
je     11d5 <main+0x95>
movzbl -0x1a(%rbp),%eax
movzbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
je     11ed <main+0xad>
lea    0xe47(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1217 <main+0xd7>
jmp    117d <main+0x3d>
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rdi
lea    0xeb3(%rip),%rbx
mov    %rbx,%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
lea    0xea3(%rip),%rsi
lea    0x6(%rsp),%rdx
mov    %r15,%rdi
call   1050 <fscanf@plt>
mov    0x2e57(%rip),%rbp
cmp    0x0(%rbp),%rax
je     11e3 <main+0xa3>
lea    0xe82(%rip),%rbx
lea    0x7(%rsp),%r12
lea    0x6(%rsp),%r13
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
cmp    0x0(%rbp),%rax
je     1203 <main+0xc3>
movzbl 0x7(%rsp),%eax
cmp    0x6(%rsp),%al
jne    1203 <main+0xc3>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1050 <fscanf@plt>
cmp    0x0(%rbp),%rax
jne    11b0 <main+0x70>
lea    0xe39(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    1214 <main+0xd4>
lea    0xe28(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"textoIn.txt\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [17 x i8] c"decompressed.txt\00"
@.str.3 = [3 x i8] c"%c\00"
@EOF = global i64 0
@.str.4 = [15 x i8] c"ETA POARR T-T\0A\00"
@.str.5 = [16 x i8] c"FOI POARR!!!!!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i8
%5 = alloca i8
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
%7 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %3
br label %8
8: ; preds = %26, %0
%9 = load i32*, i32** %2
%10 = call i64 @fscanf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%11 = load i64, i64* @EOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %27
13: ; preds = %8
%14 = load i32*, i32** %3
%15 = call i64 @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%16 = load i64, i64* @EOF
%17 = icmp eq i64 %15, %16
br i1 %17, label %24, label %18
18: ; preds = %13
%19 = load i8, i8* %5
%20 = zext i8 %19 to i32
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = icmp ne i32 %20, %22
br i1 %23, label %24, label %26
24: ; preds = %18, %13
%25 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %1
br label %33
26: ; preds = %18
br label %8
27: ; preds = %8
%28 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%29 = load i32*, i32** %2
%30 = call i32 @fclose(i32* %29)
%31 = load i32*, i32** %3
%32 = call i32 @fclose(i32* %31)
store i32 0, i32* %1
br label %33
33: ; preds = %27, %24
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [12 x i8] c"textoIn.txt\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [17 x i8] c"decompressed.txt\00"
@.str.3 = [3 x i8] c"%c\00"
@EOF = global i64 0
@str = [15 x i8] c"FOI POARR!!!!!\00"
@str.6 = [14 x i8] c"ETA POARR T-T\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = call i64 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %22, label %8
8: ; preds = %0, %18
%9 = call i64 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load i8, i8* %2
%14 = load i8, i8* %1
%15 = icmp eq i8 %13, %14
br i1 %15, label %18, label %16
16: ; preds = %8, %12
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
br label %26
18: ; preds = %12
%19 = call i64 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%20 = load i64, i64* @EOF
%21 = icmp eq i64 %19, %20
br i1 %21, label %22, label %8
22: ; preds = %18, %0
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%24 = call i32 @fclose(i32* %3)
%25 = call i32 @fclose(i32* %4)
br label %26
26: ; preds = %16, %22
%27 = phi i32 [ 0, %22 ], [ 1, %16 ]
ret i32 %27
}