#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*/ encrypt(char);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ *open_input(int, char **);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  char c;
  FILE *input = open_input(argc, argv);
  while (!feof(input)) {
    c = fgetc(input);
    if (c == EOF) {
      break;
    }
    fputc(encrypt(c), stdout);
  }
  fclose(input);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <open_input@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11a4 <main+0x44>
jmp    11e9 <main+0x89>
mov    -0x20(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    0x2e2d(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11cb <main+0x6b>
jmp    11e9 <main+0x89>
movsbl -0x11(%rbp),%edi
call   1040 <encrypt@plt>
mov    %eax,%edi
mov    0x2dfb(%rip),%rax
mov    (%rax),%esi
call   1060 <fputc@plt>
jmp    1186 <main+0x26>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
call   1080 <open_input@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    11bb <main+0x5b>
mov    0x2e68(%rip),%r14
mov    0x2e51(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    (%r14),%al
je     11bb <main+0x5b>
movsbl %al,%edi
call   1040 <encrypt@plt>
mov    (%r15),%esi
mov    %eax,%edi
call   1060 <fputc@plt>
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     1190 <main+0x30>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i8 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32* @open_input(i32 %8, i8** %9)
store i32* %10, i32** %7
br label %11
11: ; preds = %25, %2
%12 = load i32*, i32** %7
%13 = call i32 @feof(i32* %12)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %16, label %30
16: ; preds = %11
%17 = load i32*, i32** %7
%18 = call signext i8 @fgetc(i32* %17)
store i8 %18, i8* %6
%19 = load i8, i8* %6
%20 = sext i8 %19 to i32
%21 = load i8, i8* @EOF
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %25
24: ; preds = %16
br label %30
25: ; preds = %16
%26 = load i8, i8* %6
%27 = call i32 @encrypt(i8 signext %26)
%28 = load i32, i32* @stdout
%29 = call i32 @fputc(i32 %27, i32 %28)
br label %11
30: ; preds = %24, %11
%31 = load i32*, i32** %7
%32 = call i32 @fclose(i32* %31)
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@EOF = global i8 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32* @open_input(i32 %0, i8** %1)
%4 = tail call i32 @feof(i32* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %2, %10
%7 = tail call signext i8 @fgetc(i32* %3)
%8 = load i8, i8* @EOF
%9 = icmp eq i8 %7, %8
br i1 %9, label %16, label %10
10: ; preds = %6
%11 = tail call i32 @encrypt(i8 signext %7)
%12 = load i32, i32* @stdout
%13 = tail call i32 @fputc(i32 %11, i32 %12)
%14 = tail call i32 @feof(i32* %3)
%15 = icmp eq i32 %14, 0
br i1 %15, label %6, label %16
16: ; preds = %10, %6, %2
%17 = tail call i32 @fclose(i32* %3)
ret i32 0
}