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

/* Variables and functions */
char decifrar(char);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ initialize();
int main() {
  FILE *file1 = fopen("filein1.bin", "r+");
  FILE *file2 = fopen("filein2.bin", "r+");
  FILE *fileout = fopen("fileout.txt", "w+");
  char line[80], line2[80];
  int i, ret, ret2;
  initialize();
  while (!feof(file1) && !feof(file2)) {
    fgets(line, sizeof(line), file1);
    fgets(line2, sizeof(line2), file2);
    for (i = 0; i < sizeof(line); i++) {
      char letter = decifrar(line[i]);
      fprintf(fileout, "%c", letter);
    }
    fprintf(fileout, "\n");
    for (i = 0; i < sizeof(line2); i++) {
      char letter2 = decifrar(line2[i]);
      fprintf(fileout, "%c", letter2);
    }
    fprintf(fileout, "\n");
  }
  fclose(file1);
  fclose(file2);
  fclose(fileout);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe67(%rip),%rdi
lea    0xe6c(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe5f(%rip),%rdi
lea    0xe55(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe54(%rip),%rdi
lea    0xe59(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <initialize@plt>
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xcf(%rbp)
jne    1211 <main+0x91>
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0xcf(%rbp)
mov    -0xcf(%rbp),%al
test   $0x1,%al
jne    1224 <main+0xa4>
jmp    1335 <main+0x1b5>
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x50,%esi
call   1050 <fgets@plt>
lea    -0xc0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x50,%esi
call   1050 <fgets@plt>
movl   $0x0,-0xc4(%rbp)
movslq -0xc4(%rbp),%rax
cmp    $0x50,%rax
jae    12aa <main+0x12a>
movslq -0xc4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1060 <decifrar@plt>
mov    %al,-0xcd(%rbp)
mov    -0x20(%rbp),%rdi
movsbl -0xcd(%rbp),%edx
lea    0xd9b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1255 <main+0xd5>
mov    -0x20(%rbp),%rdi
lea    0xd78(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0xc4(%rbp)
movslq -0xc4(%rbp),%rax
cmp    $0x50,%rax
jae    131e <main+0x19e>
movslq -0xc4(%rbp),%rax
movsbl -0xc0(%rbp,%rax,1),%edi
ff
call   1060 <decifrar@plt>
mov    %al,-0xce(%rbp)
mov    -0x20(%rbp),%rdi
movsbl -0xce(%rbp),%edx
lea    0xd27(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    12c6 <main+0x146>
mov    -0x20(%rbp),%rdi
lea    0xd04(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    11de <main+0x5e>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
lea    0xe68(%rip),%rdi
lea    0xe6d(%rip),%rbx
mov    %rbx,%rsi
call   1090 <fopen@plt>
mov    %rax,%r14
lea    0xe5e(%rip),%rdi
mov    %rbx,%rsi
call   1090 <fopen@plt>
mov    %rax,%r15
lea    0xe58(%rip),%rdi
lea    0xe5d(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <initialize@plt>
mov    %r14,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    12ab <main+0x12b>
lea    0x50(%rsp),%r12
mov    %rsp,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    12ab <main+0x12b>
mov    %r12,%rdi
mov    $0x50,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
mov    %r13,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl 0x50(%rsp,%rbp,1),%edi
call   1070 <decifrar@plt>
movsbl %al,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
add    $0x1,%rbp
cmp    $0x50,%rbp
jne    1240 <main+0xc0>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
xor    %ebp,%ebp
xchg   %ax,%ax
movsbl (%rsp,%rbp,1),%edi
call   1070 <decifrar@plt>
movsbl %al,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
add    $0x1,%rbp
cmp    $0x50,%rbp
jne    1270 <main+0xf0>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    %r14,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     1200 <main+0x80>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"filein1.bin\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [12 x i8] c"filein2.bin\00"
@.str.3 = [12 x i8] c"fileout.txt\00"
@.str.4 = [3 x i8] c"w+\00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [80 x i8]
%6 = alloca [80 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8
store i32 0, i32* %1
%12 = 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* %12, i32** %2
%13 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 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* %13, i32** %3
%14 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %14, i32** %4
%15 = call i32 (...) @initialize()
br label %16
16: ; preds = %71, %0
%17 = load i32*, i32** %2
%18 = call i32 @feof(i32* %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %16
%21 = load i32*, i32** %3
%22 = call i32 @feof(i32* %21)
%23 = icmp ne i32 %22, 0
%24 = xor i1 %23, true
br label %25
25: ; preds = %20, %16
%26 = phi i1 [ false, %16 ], [ %24, %20 ]
br i1 %26, label %27, label %74
27: ; preds = %25
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%29 = load i32*, i32** %2
%30 = call i32 @fgets(i8* %28, i32 80, i32* %29)
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%32 = load i32*, i32** %3
%33 = call i32 @fgets(i8* %31, i32 80, i32* %32)
store i32 0, i32* %7
br label %34
34: ; preds = %48, %27
%35 = load i32, i32* %7
%36 = sext i32 %35 to i64
%37 = icmp ult i64 %36, 80
br i1 %37, label %38, label %51
38: ; preds = %34
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = call signext i8 @decifrar(i8 signext %42)
store i8 %43, i8* %10
%44 = load i32*, i32** %4
%45 = load i8, i8* %10
%46 = sext i8 %45 to i32
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %38
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %34
51: ; preds = %34
%52 = load i32*, i32** %4
%53 = call i32 (i32*, i8*, ...) @fprintf(i32* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %7
br label %54
54: ; preds = %68, %51
%55 = load i32, i32* %7
%56 = sext i32 %55 to i64
%57 = icmp ult i64 %56, 80
br i1 %57, label %58, label %71
58: ; preds = %54
%59 = load i32, i32* %7
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 %60
%62 = load i8, i8* %61
%63 = call signext i8 @decifrar(i8 signext %62)
store i8 %63, i8* %11
%64 = load i32*, i32** %4
%65 = load i8, i8* %11
%66 = sext i8 %65 to i32
%67 = call i32 (i32*, i8*, ...) @fprintf(i32* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %66)
br label %68
68: ; preds = %58
%69 = load i32, i32* %7
%70 = add nsw i32 %69, 1
store i32 %70, i32* %7
br label %54
71: ; preds = %54
%72 = load i32*, i32** %4
%73 = call i32 (i32*, i8*, ...) @fprintf(i32* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %16
74: ; preds = %25
%75 = load i32*, i32** %2
%76 = call i32 @fclose(i32* %75)
%77 = load i32*, i32** %3
%78 = call i32 @fclose(i32* %77)
%79 = load i32*, i32** %4
%80 = call i32 @fclose(i32* %79)
%81 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"filein1.bin\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [12 x i8] c"filein2.bin\00"
@.str.3 = [12 x i8] c"fileout.txt\00"
@.str.4 = [3 x i8] c"w+\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x 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 ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%8 = tail call i32 (...) @initialize()
%9 = call i32 @feof(i32* %3)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %41
11: ; preds = %0, %37
%12 = call i32 @feof(i32* %4)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %41
14: ; preds = %11
%15 = call i32 @fgets(i8* %6, i32 80, i32* %3)
%16 = call i32 @fgets(i8* %7, i32 80, i32* %4)
br label %17
17: ; preds = %14, %17
%18 = phi i64 [ 0, %14 ], [ %24, %17 ]
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = call signext i8 @decifrar(i8 signext %20)
%22 = sext i8 %21 to i32
%23 = call i32 @fputc(i32 %22, i32* %5)
%24 = add nuw nsw i64 %18, 1
%25 = icmp eq i64 %24, 80
br i1 %25, label %26, label %17
26: ; preds = %17
%27 = call i32 @fputc(i32 10, i32* %5)
br label %28
28: ; preds = %26, %28
%29 = phi i64 [ 0, %26 ], [ %35, %28 ]
%30 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = call signext i8 @decifrar(i8 signext %31)
%33 = sext i8 %32 to i32
%34 = call i32 @fputc(i32 %33, i32* %5)
%35 = add nuw nsw i64 %29, 1
%36 = icmp eq i64 %35, 80
br i1 %36, label %37, label %28
37: ; preds = %28
%38 = call i32 @fputc(i32 10, i32* %5)
%39 = call i32 @feof(i32* %3)
%40 = icmp eq i32 %39, 0
br i1 %40, label %11, label %41
41: ; preds = %11, %37, %0
%42 = call i32 @fclose(i32* %3)
%43 = call i32 @fclose(i32* %4)
%44 = call i32 @fclose(i32* %5)
%45 = call i32 @exit(i32 0)
unreachable
}