#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 */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int main() {
  int i, n = 1, nr, nw;
  char buf[64];
  FILE *fpR, *fpW;
  fpR = fopen("text1.txt", "rt");
  fpW = fopen("encrypted.txt", "wt");
  while (!feof(fpR)) {
    nr = fread(buf, 1, 64, fpR);
    for (i = 0; i < 64; i++) {
      if (buf[i] >= 'a' && buf[i] <= ('z' - n)) {
        buf[i] += n;
      } else if (buf[i] > ('z' - n) && buf[i] <= 'z') {
        buf[i] += (n - (26));
      }
    }
    nw = fwrite(buf, 1, nr, fpW);
    if (nw != nr) {
      printf("Error in write command!\n");
      getchar();
      exit(1);
    }
  }
  fclose(fpR);
  fclose(fpW);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xe63(%rip),%rdi
lea    0xe66(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x68(%rbp)
lea    0xe59(%rip),%rdi
lea    0xe60(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x70(%rbp)
mov    -0x68(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e2 <main+0x62>
jmp    12ed <main+0x16d>
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rcx
mov    $0x1,%esi
mov    $0x40,%edx
call   1030 <fread@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jge    12a7 <main+0x127>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     124f <main+0xcf>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
mov    $0x7a,%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     124f <main+0xcf>
mov    -0xc(%rbp),%edx
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%ecx
add    %edx,%ecx
mov    %cl,-0x60(%rbp,%rax,1)
jmp    1294 <main+0x114>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
mov    $0x7a,%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jle    128f <main+0x10f>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     128f <main+0x10f>
mov    -0xc(%rbp),%edx
sub    $0x1a,%edx
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%ecx
add    %edx,%ecx
mov    %cl,-0x60(%rbp,%rax,1)
jmp    1294 <main+0x114>
jmp    1299 <main+0x119>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1203 <main+0x83>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%edx
mov    -0x70(%rbp),%rcx
mov    $0x1,%esi
call   10a0 <fwrite@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     12e8 <main+0x168>
lea    0xd4c(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    11c4 <main+0x44>
mov    -0x68(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x70(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
lea    0xeaf(%rip),%rdi
lea    0xeb2(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xea6(%rip),%rdi
lea    0xead(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    %rsp,%r15
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    136f <main+0x1ef>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x40,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
mov    %eax,%ebp
movdqa (%rsp),%xmm3
movdqa 0x10(%rsp),%xmm2
movdqa 0x20(%rsp),%xmm1
movdqa 0x30(%rsp),%xmm0
movdqa %xmm3,%xmm4
movdqa 0xdf6(%rip),%xmm7
paddb  %xmm7,%xmm4
movdqa %xmm4,%xmm5
movdqa 0xdf5(%rip),%xmm8
pminub %xmm8,%xmm5
pcmpeqb %xmm4,%xmm5
movdqa %xmm3,%xmm4
movdqa 0xdef(%rip),%xmm9
pcmpeqb %xmm9,%xmm4
movdqa %xmm4,%xmm6
pandn  %xmm3,%xmm6
movdqa 0xde9(%rip),%xmm10
pand   %xmm10,%xmm4
por    %xmm6,%xmm4
pcmpeqd %xmm6,%xmm6
psubb  %xmm6,%xmm3
pand   %xmm5,%xmm3
pandn  %xmm4,%xmm5
por    %xmm3,%xmm5
movdqa %xmm5,(%rsp)
movdqa %xmm2,%xmm3
paddb  %xmm7,%xmm3
movdqa %xmm3,%xmm4
pminub %xmm8,%xmm4
pcmpeqb %xmm3,%xmm4
movdqa %xmm2,%xmm3
pcmpeqb %xmm9,%xmm3
movdqa %xmm3,%xmm5
pandn  %xmm2,%xmm5
pand   %xmm10,%xmm3
por    %xmm5,%xmm3
psubb  %xmm6,%xmm2
pand   %xmm4,%xmm2
pandn  %xmm3,%xmm4
por    %xmm2,%xmm4
movdqa %xmm4,0x10(%rsp)
movdqa %xmm1,%xmm2
paddb  %xmm7,%xmm2
movdqa %xmm2,%xmm3
pminub %xmm8,%xmm3
pcmpeqb %xmm2,%xmm3
movdqa %xmm1,%xmm2
pcmpeqb %xmm9,%xmm2
movdqa %xmm2,%xmm4
pandn  %xmm1,%xmm4
pand   %xmm10,%xmm2
por    %xmm4,%xmm2
psubb  %xmm6,%xmm1
pand   %xmm3,%xmm1
pandn  %xmm2,%xmm3
por    %xmm1,%xmm3
movdqa %xmm3,0x20(%rsp)
movdqa %xmm0,%xmm1
paddb  %xmm7,%xmm1
movdqa %xmm1,%xmm2
pminub %xmm8,%xmm2
pcmpeqb %xmm1,%xmm2
movdqa %xmm0,%xmm1
pcmpeqb %xmm9,%xmm1
movdqa %xmm1,%xmm3
pandn  %xmm0,%xmm3
pand   %xmm10,%xmm1
por    %xmm3,%xmm1
psubb  %xmm6,%xmm0
pand   %xmm2,%xmm0
pandn  %xmm1,%xmm2
por    %xmm0,%xmm2
movdqa %xmm2,0x30(%rsp)
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %r14,%rcx
call   10a0 <fwrite@plt>
cmp    %ebp,%eax
je     11c0 <main+0x40>
lea    0xd05(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"text1.txt\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [14 x i8] c"encrypted.txt\00"
@.str.3 = [3 x i8] c"wt\00"
@.str.4 = [25 x i8] c"Error in write command!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [64 x i8]
%7 = alloca i32*
%8 = alloca i32*
store i32 0, i32* %1
store i32 1, i32* %3
%9 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %7
%10 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %10, i32** %8
br label %11
11: ; preds = %91, %0
%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 %92
16: ; preds = %11
%17 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%18 = load i32*, i32** %7
%19 = call i32 @fread(i8* %17, i32 1, i32 64, i32* %18)
store i32 %19, i32* %4
store i32 0, i32* %2
br label %20
20: ; preds = %76, %16
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 64
br i1 %22, label %23, label %79
23: ; preds = %20
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp sge i32 %28, 97
br i1 %29, label %30, label %48
30: ; preds = %23
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = load i32, i32* %3
%37 = sub nsw i32 122, %36
%38 = icmp sle i32 %35, %37
br i1 %38, label %39, label %48
39: ; preds = %30
%40 = load i32, i32* %3
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = add nsw i32 %45, %40
%47 = trunc i32 %46 to i8
store i8 %47, i8* %43
br label %75
48: ; preds = %30, %23
%49 = load i32, i32* %2
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = load i32, i32* %3
%55 = sub nsw i32 122, %54
%56 = icmp sgt i32 %53, %55
br i1 %56, label %57, label %74
57: ; preds = %48
%58 = load i32, i32* %2
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp sle i32 %62, 122
br i1 %63, label %64, label %74
64: ; preds = %57
%65 = load i32, i32* %3
%66 = sub nsw i32 %65, 26
%67 = load i32, i32* %2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = add nsw i32 %71, %66
%73 = trunc i32 %72 to i8
store i8 %73, i8* %69
br label %74
74: ; preds = %64, %57, %48
br label %75
75: ; preds = %74, %39
br label %76
76: ; preds = %75
%77 = load i32, i32* %2
%78 = add nsw i32 %77, 1
store i32 %78, i32* %2
br label %20
79: ; preds = %20
%80 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%81 = load i32, i32* %4
%82 = load i32*, i32** %8
%83 = call i32 @fwrite(i8* %80, i32 1, i32 %81, i32* %82)
store i32 %83, i32* %5
%84 = load i32, i32* %5
%85 = load i32, i32* %4
%86 = icmp ne i32 %84, %85
br i1 %86, label %87, label %91
87: ; preds = %79
%88 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%89 = call i32 (...) @getchar()
%90 = call i32 @exit(i32 1)
unreachable
91: ; preds = %79
br label %11
92: ; preds = %11
%93 = load i32*, i32** %7
%94 = call i32 @fclose(i32* %93)
%95 = load i32*, i32** %8
%96 = call i32 @fclose(i32* %95)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"text1.txt\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [14 x i8] c"encrypted.txt\00"
@.str.3 = [3 x i8] c"wt\00"
@str = [24 x i8] c"Error in write command!\00"
define i32 @main() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 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 ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%5 = bitcast [64 x i8]* %1 to <16 x i8>*
%6 = bitcast [64 x i8]* %1 to <16 x i8>*
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 16
%8 = bitcast i8* %7 to <16 x i8>*
%9 = bitcast i8* %7 to <16 x i8>*
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 32
%11 = bitcast i8* %10 to <16 x i8>*
%12 = bitcast i8* %10 to <16 x i8>*
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 48
%14 = bitcast i8* %13 to <16 x i8>*
%15 = bitcast i8* %13 to <16 x i8>*
br label %16
16: ; preds = %19, %0
%17 = tail call i32 @feof(i32* %3)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %55
19: ; preds = %16
%20 = call i32 @fread(i8* %2, i32 1, i32 64, i32* %3)
%21 = load <16 x i8>, <16 x i8>* %5
%22 = add <16 x i8> %21, <i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97>
%23 = icmp ult <16 x i8> %22, <i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25>
%24 = icmp eq <16 x i8> %21, <i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122>
%25 = select <16 x i1> %24, <16 x i8> <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>, <16 x i8> %21
%26 = add nuw nsw <16 x i8> %21, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
%27 = select <16 x i1> %23, <16 x i8> %26, <16 x i8> %25
store <16 x i8> %27, <16 x i8>* %6
%28 = load <16 x i8>, <16 x i8>* %8
%29 = add <16 x i8> %28, <i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97>
%30 = icmp ult <16 x i8> %29, <i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25>
%31 = icmp eq <16 x i8> %28, <i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122>
%32 = select <16 x i1> %31, <16 x i8> <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>, <16 x i8> %28
%33 = add nuw nsw <16 x i8> %28, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
%34 = select <16 x i1> %30, <16 x i8> %33, <16 x i8> %32
store <16 x i8> %34, <16 x i8>* %9
%35 = load <16 x i8>, <16 x i8>* %11
%36 = add <16 x i8> %35, <i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97>
%37 = icmp ult <16 x i8> %36, <i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25>
%38 = icmp eq <16 x i8> %35, <i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122>
%39 = select <16 x i1> %38, <16 x i8> <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>, <16 x i8> %35
%40 = add nuw nsw <16 x i8> %35, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
%41 = select <16 x i1> %37, <16 x i8> %40, <16 x i8> %39
store <16 x i8> %41, <16 x i8>* %12
%42 = load <16 x i8>, <16 x i8>* %14
%43 = add <16 x i8> %42, <i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97>
%44 = icmp ult <16 x i8> %43, <i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25, i8 25>
%45 = icmp eq <16 x i8> %42, <i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122, i8 122>
%46 = select <16 x i1> %45, <16 x i8> <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>, <16 x i8> %42
%47 = add nuw nsw <16 x i8> %42, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
%48 = select <16 x i1> %44, <16 x i8> %47, <16 x i8> %46
store <16 x i8> %48, <16 x i8>* %15
%49 = call i32 @fwrite(i8* %2, i32 1, i32 %20, i32* %4)
%50 = icmp eq i32 %49, %20
br i1 %50, label %16, label %51
51: ; preds = %19
%52 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%53 = tail call i32 (...) @getchar()
%54 = tail call i32 @exit(i32 1)
unreachable
55: ; preds = %16
%56 = tail call i32 @fclose(i32* %3)
%57 = tail call i32 @fclose(i32* %4)
ret i32 0
}