#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*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ decrypt(char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ perror(char *);
int main() {
  FILE *file;
  char *buffer;
  char filename[] = "sss.txt";
  int size, i;
  char c;
  size = 0, i = 0;
  c = '0';
  file = fopen(filename, "r");
  if (file == NULL) {
    perror("Error opening file");
    return -1;
  }
  fseek(file, 0L, SEEK_END);
  size = ftell(file);
  fseek(file, 0L, SEEK_SET);
  buffer = (char *)malloc(size * sizeof(char));
  buffer[size] = '\0';
  while ((c = fgetc(file)) != EOF) {
    c = (c - 5);
    buffer[i++] = c;
  }
  buffer[i] = '\0';
  decrypt(buffer, size);
  fclose(file);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe6a(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movb   $0x30,-0x29(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xe51(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11e3 <main+0x63>
lea    0xe38(%rip),%rdi
call   10a0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12aa <main+0x12a>
mov    -0x10(%rbp),%rdi
mov    0x2dfa(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1080 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1060 <ftell@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2dc0(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1080 <fseek@plt>
movslq -0x24(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x29(%rbp)
movsbl %al,%eax
mov    0x2d90(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1282 <main+0x102>
movsbl -0x29(%rbp),%eax
sub    $0x5,%eax
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%dl
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x28(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    123a <main+0xba>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <decrypt@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movabs $0x7478742e737373,%rax
mov    %rax,(%rsp)
lea    0xe60(%rip),%rsi
mov    %rsp,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1267 <main+0xe7>
mov    %rax,%r13
mov    0x2e2d(%rip),%rax
mov    (%rax),%edx
xor    %r12d,%r12d
mov    %r13,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
mov    %r13,%rdi
call   1060 <ftell@plt>
mov    %eax,%r14d
mov    0x2df4(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
movslq %r14d,%r15
mov    %r15d,%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
movb   $0x0,(%rax,%r15,1)
mov    %r13,%rdi
call   1050 <fgetc@plt>
mov    0x2dd6(%rip),%r15
cmp    (%r15),%al
je     123a <main+0xba>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xfb,%al
mov    %al,0x0(%rbp,%rbx,1)
add    $0x1,%rbx
mov    %r13,%rdi
call   1050 <fgetc@plt>
cmp    (%r15),%al
jne    1220 <main+0xa0>
mov    %ebx,%r12d
movb   $0x0,0x0(%rbp,%r12,1)
mov    %rbp,%rdi
mov    %r14d,%esi
call   1030 <decrypt@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd94(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%eax
jmp    1258 <main+0xd8>

LLVM IR (-O0):
@__const.main.filename = [8 x i8] c"sss.txt\00"
@.str = [2 x i8] c"r\00"
@.str.1 = [19 x i8] c"Error opening file\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca [8 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %1
%8 = bitcast [8 x i8]* %4 to i8*
store i32 0, i32* %5
store i32 0, i32* %6
store i8 48, i8* %7
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %2
%11 = load i32*, i32** %2
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %62
15: ; preds = %0
%16 = load i32*, i32** %2
%17 = load i32, i32* @SEEK_END
%18 = call i32 @fseek(i32* %16, i64 0, i32 %17)
%19 = load i32*, i32** %2
%20 = call i32 @ftell(i32* %19)
store i32 %20, i32* %5
%21 = load i32*, i32** %2
%22 = load i32, i32* @SEEK_SET
%23 = call i32 @fseek(i32* %21, i64 0, i32 %22)
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = mul i64 %25, 1
%27 = trunc i64 %26 to i32
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to i8*
store i8* %29, i8** %3
%30 = load i8*, i8** %3
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
store i8 0, i8* %33
br label %34
34: ; preds = %41, %15
%35 = load i32*, i32** %2
%36 = call signext i8 @fgetc(i32* %35)
store i8 %36, i8* %7
%37 = sext i8 %36 to i32
%38 = load i8, i8* @EOF
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %37, %39
br i1 %40, label %41, label %52
41: ; preds = %34
%42 = load i8, i8* %7
%43 = sext i8 %42 to i32
%44 = sub nsw i32 %43, 5
%45 = trunc i32 %44 to i8
store i8 %45, i8* %7
%46 = load i8, i8* %7
%47 = load i8*, i8** %3
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds i8, i8* %47, i64 %50
store i8 %46, i8* %51
br label %34
52: ; preds = %34
%53 = load i8*, i8** %3
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
store i8 0, i8* %56
%57 = load i8*, i8** %3
%58 = load i32, i32* %5
%59 = call i32 @decrypt(i8* %57, i32 %58)
%60 = load i32*, i32** %2
%61 = call i32 @fclose(i32* %60)
store i32 1, i32* %1
br label %62
62: ; preds = %52, %13
%63 = load i32, i32* %1
ret i32 %63
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [19 x i8] c"Error opening file\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@EOF = global i8 0
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 32783537689293683, i64* %1
%3 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %36
7: ; preds = %0
%8 = load i32, i32* @SEEK_END
%9 = tail call i32 @fseek(i32* %3, i64 0, i32 %8)
%10 = tail call i32 @ftell(i32* %3)
%11 = load i32, i32* @SEEK_SET
%12 = tail call i32 @fseek(i32* %3, i64 0, i32 %11)
%13 = sext i32 %10 to i64
%14 = tail call i64 @malloc(i32 %10)
%15 = inttoptr i64 %14 to i8*
%16 = getelementptr inbounds i8, i8* %15, i64 %13
store i8 0, i8* %16
%17 = tail call signext i8 @fgetc(i32* %3)
%18 = load i8, i8* @EOF
%19 = icmp eq i8 %17, %18
br i1 %19, label %31, label %20
20: ; preds = %7, %20
%21 = phi i64 [ %24, %20 ], [ 0, %7 ]
%22 = phi i8 [ %26, %20 ], [ %17, %7 ]
%23 = add i8 %22, -5
%24 = add nuw i64 %21, 1
%25 = getelementptr inbounds i8, i8* %15, i64 %21
store i8 %23, i8* %25
%26 = tail call signext i8 @fgetc(i32* %3)
%27 = load i8, i8* @EOF
%28 = icmp eq i8 %26, %27
br i1 %28, label %29, label %20
29: ; preds = %20
%30 = and i64 %24, 4294967295
br label %31
31: ; preds = %29, %7
%32 = phi i64 [ 0, %7 ], [ %30, %29 ]
%33 = getelementptr inbounds i8, i8* %15, i64 %32
store i8 0, i8* %33
%34 = tail call i32 @decrypt(i8* %15, i32 %10)
%35 = tail call i32 @fclose(i32* %3)
br label %36
36: ; preds = %31, %5
%37 = phi i32 [ -1, %5 ], [ 1, %31 ]
ret i32 %37
}