#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 convertStringToNumdecrypt(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
char getc(int /*<<< orphan*/ *);
int inversesBoxLookup(int);
int keyGenerator(int, int);
int /*<<< orphan*/ printf(char *);
int revroundfunc(int, int);
int /*<<< orphan*/ scanf(char *, char **);
int /*<<< orphan*/ stdout;
void decrypt(int k) {
  int key = k;
  char inputBuff[5];
  char ch;
  int x = -1;
  int h = 0;
  int stateVal, index = 0;
  char path[50] = {'\0'};
  char newpath[50] = {'\0'};
  char decry[8] = {'d', 'e', 'c', 'r', 'y', 'p', 't', '\0'};
  printf("Enter the file name (with full path) : ");
  fflush(stdout);
  scanf("%s", &path);
  FILE *fr;
  FILE *fw;
  fr = fopen(path, "r");
  for (h = 0; h < 50; h++) {
    if (path[h] != '\0') {
      newpath[h] = path[h];
      index = h;
    }
  }
  for (h = 0; h < 8; h++) {
    newpath[index + 1 + h] = decry[h];
  }
  fw = fopen(newpath, "w");
  while (!feof(fr)) {
    x += 1;
    ch = getc(fr);
    inputBuff[x] = ch;
    if (x == 3) {
      inputBuff[4] = '\0';
      x = -1;
      stateVal = convertStringToNumdecrypt(inputBuff);
      int kround = keyGenerator(key, 16);
      stateVal = stateVal ^ kround;
      stateVal = inversesBoxLookup(stateVal);
      for (h = 15; h >= 1; h--) {
        int kround = keyGenerator(key, h);
        stateVal = revroundfunc(stateVal, kround);
      }
      stateVal = stateVal ^ key;
      char finalWrite[5] = {'\0'};
      for (h = 0; h < 4; h++) {
        int temp = stateVal;
        temp = temp >> (24 - 8 * h);
        temp = temp & 255;
        if (temp == 0) {
          finalWrite[h] = '0';
        } else {
          finalWrite[h] = (char)temp;
        }
      }
      fprintf(fw, "%s", finalWrite);
    }
  }
  fclose(fr);
  fclose(fw);
}


x86 assembly (clang, -O0):
<decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1090 <memset@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1090 <memset@plt>
mov    0xddd(%rip),%rax
mov    %rax,-0xa8(%rbp)
lea    0xdd7(%rip),%rdi
call   1070 <printf@plt>
mov    0x2da3(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
lea    -0x60(%rbp),%rsi
lea    0xde1(%rip),%rdi
call   10d0 <scanf@plt>
lea    -0x60(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0xb0(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x32,-0x18(%rbp)
jge    12ba <decrypt+0xea>
movslq -0x18(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     12a7 <decrypt+0xd7>
movslq -0x18(%rbp),%rax
mov    -0x60(%rbp,%rax,1),%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0xa0(%rbp,%rax,1)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    12ac <decrypt+0xdc>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1272 <decrypt+0xa2>
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    12f6 <decrypt+0x126>
movslq -0x18(%rbp),%rax
mov    -0xa8(%rbp,%rax,1),%cl
mov    -0x20(%rbp),%eax
add    $0x1,%eax
add    -0x18(%rbp),%eax
cltq
mov    %cl,-0xa0(%rbp,%rax,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12c1 <decrypt+0xf1>
lea    -0xa0(%rbp),%rdi
lea    0xd31(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0xb8(%rbp)
mov    -0xb0(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1331 <decrypt+0x161>
jmp    14a5 <decrypt+0x2d5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xb0(%rbp),%rdi
call   10f0 <getc@plt>
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0xd(%rbp,%rax,1)
cmpl   $0x3,-0x14(%rbp)
jne    14a0 <decrypt+0x2d0>
movb   $0x0,-0x9(%rbp)
movl   $0xffffffff,-0x14(%rbp)
lea    -0xd(%rbp),%rdi
call   1060 <convertStringToNumdecrypt@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x10,%esi
call   1040 <keyGenerator@plt>
mov    %eax,-0xbc(%rbp)
mov    -0x1c(%rbp),%eax
xor    -0xbc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1080 <inversesBoxLookup@plt>
mov    %eax,-0x1c(%rbp)
movl   $0xf,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jl     13e0 <decrypt+0x210>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <keyGenerator@plt>
mov    %eax,-0xc0(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0xc0(%rbp),%esi
call   1030 <revroundfunc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    13a6 <decrypt+0x1d6>
mov    -0x1c(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    -0xc5(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1090 <memset@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    1486 <decrypt+0x2b6>
mov    -0x1c(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
mov    -0x18(%rbp),%edx
shl    $0x3,%edx
mov    $0x18,%ecx
sub    %edx,%ecx
sar    %cl,%eax
mov    %eax,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0xcc(%rbp)
cmpl   $0x0,-0xcc(%rbp)
jne    1460 <decrypt+0x290>
movslq -0x18(%rbp),%rax
movb   $0x30,-0xc5(%rbp,%rax,1)
30
jmp    1473 <decrypt+0x2a3>
mov    -0xcc(%rbp),%eax
mov    %al,%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0xc5(%rbp,%rax,1)
jmp    1478 <decrypt+0x2a8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1403 <decrypt+0x233>
mov    -0xb8(%rbp),%rdi
lea    -0xc5(%rbp),%rdx
lea    0xb95(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    1310 <decrypt+0x140>
mov    -0xb0(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0xb8(%rbp),%rdi
call   1050 <fclose@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decrypt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %edi,%ebx
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movw   $0x0,0x80(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movw   $0x0,0x40(%rsp)
lea    0xdf4(%rip),%rdi
call   1070 <printf@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
lea    0xe02(%rip),%rdi
lea    0x50(%rsp),%r14
mov    %r14,%rsi
call   10c0 <scanf@plt>
lea    0xdf1(%rip),%rsi
mov    %r14,%rdi
call   10d0 <fopen@plt>
mov    %rax,%r14
xor    %eax,%eax
xor    %ecx,%ecx
jmp    125a <decrypt+0x9a>
nopl   0x0(%rax,%rax,1)
add    $0x2,%rax
cmp    $0x32,%rax
je     127b <decrypt+0xbb>
movzbl 0x50(%rsp,%rax,1),%edx
test   %dl,%dl
je     1269 <decrypt+0xa9>
mov    %dl,0x10(%rsp,%rax,1)
mov    %eax,%ecx
movzbl 0x51(%rsp,%rax,1),%edx
test   %dl,%dl
je     1250 <decrypt+0x90>
mov    %dl,0x11(%rsp,%rax,1)
lea    0x1(%rax),%ecx
jmp    1250 <decrypt+0x90>
add    $0x1,%ecx
movslq %ecx,%rax
movabs $0x74707972636564,%rcx
mov    %rcx,0x10(%rsp,%rax,1)
lea    0xd96(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10d0 <fopen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
je     12d2 <decrypt+0x112>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%ebp
mov    $0x30,%r12d
jmp    12ec <decrypt+0x12c>
nop
mov    %r14,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
jne    12b0 <decrypt+0xf0>
movslq %ebp,%r13
lea    0x1(%r13),%rbp
mov    %r14,%rdi
call   10e0 <getc@plt>
mov    %al,0xc(%rsp,%r13,1)
cmp    $0x3,%ebp
jne    12e0 <decrypt+0x120>
movb   $0x0,0xf(%rsp)
lea    0xb(%rsp),%rdi
call   1060 <convertStringToNumdecrypt@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x10,%esi
call   1040 <keyGenerator@plt>
xor    %eax,%ebp
mov    %ebp,%edi
call   1090 <inversesBoxLookup@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0xf,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0xe,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0xd,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0xc,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0xb,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0xa,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x9,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x8,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x7,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x6,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x5,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x4,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x3,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x2,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x1,%esi
call   1040 <keyGenerator@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <revroundfunc@plt>
xor    %ebx,%eax
mov    %eax,%ecx
shr    $0x18,%ecx
cmove  %r12d,%ecx
movb   $0x0,0xa(%rsp)
mov    %cl,0x6(%rsp)
mov    %eax,%ecx
shr    $0x10,%ecx
test   $0xff0000,%eax
cmove  %r12d,%ecx
mov    %cl,0x7(%rsp)
mov    %eax,%ecx
shr    $0x8,%ecx
test   $0xff00,%eax
cmove  %r12d,%ecx
mov    %cl,0x8(%rsp)
test   %al,%al
cmove  %r12d,%eax
mov    %al,0x9(%rsp)
lea    0x6(%rsp),%rdi
mov    %r15,%rsi
call   1080 <fputs@plt>
mov    $0xffffffff,%ebp
jmp    12e0 <decrypt+0x120>

LLVM IR (-O0):
@__const.decrypt.decry = [8 x i8] c"decrypt\00"
@.str = [40 x i8] c"Enter the file name (with full path) : \00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [2 x i8] c"w\00"
define void @decrypt(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [5 x i8]
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [50 x i8]
%11 = alloca [50 x i8]
%12 = alloca [8 x i8]
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca [5 x i8]
%18 = alloca i32
store i32 %0, i32* %2
%19 = load i32, i32* %2
store i32 %19, i32* %3
store i32 -1, i32* %6
store i32 0, i32* %7
store i32 0, i32* %9
%20 = bitcast [50 x i8]* %10 to i8*
%21 = bitcast [50 x i8]* %11 to i8*
%22 = bitcast [8 x i8]* %12 to i8*
%23 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* @stdout
%25 = call i32 @fflush(i32 %24)
%26 = bitcast [50 x i8]* %10 to i8**
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %26)
%28 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %29, i32** %13
store i32 0, i32* %7
br label %30
30: ; preds = %50, %1
%31 = load i32, i32* %7
%32 = icmp slt i32 %31, 50
br i1 %32, label %33, label %53
33: ; preds = %30
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %49
40: ; preds = %33
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [50 x i8], [50 x i8]* %11, i64 0, i64 %46
store i8 %44, i8* %47
%48 = load i32, i32* %7
store i32 %48, i32* %9
br label %49
49: ; preds = %40, %33
br label %50
50: ; preds = %49
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %30
53: ; preds = %30
store i32 0, i32* %7
br label %54
54: ; preds = %68, %53
%55 = load i32, i32* %7
%56 = icmp slt i32 %55, 8
br i1 %56, label %57, label %71
57: ; preds = %54
%58 = load i32, i32* %7
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = load i32, i32* %9
%63 = add nsw i32 %62, 1
%64 = load i32, i32* %7
%65 = add nsw i32 %63, %64
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [50 x i8], [50 x i8]* %11, i64 0, i64 %66
store i8 %61, i8* %67
br label %68
68: ; preds = %57
%69 = load i32, i32* %7
%70 = add nsw i32 %69, 1
store i32 %70, i32* %7
br label %54
71: ; preds = %54
%72 = getelementptr inbounds [50 x i8], [50 x i8]* %11, i64 0, i64 0
%73 = call i32* @fopen(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %73, i32** %14
br label %74
74: ; preds = %151, %71
%75 = load i32*, i32** %13
%76 = call i32 @feof(i32* %75)
%77 = icmp ne i32 %76, 0
%78 = xor i1 %77, true
br i1 %78, label %79, label %152
79: ; preds = %74
%80 = load i32, i32* %6
%81 = add nsw i32 %80, 1
store i32 %81, i32* %6
%82 = load i32*, i32** %13
%83 = call signext i8 @getc(i32* %82)
store i8 %83, i8* %5
%84 = load i8, i8* %5
%85 = load i32, i32* %6
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %86
store i8 %84, i8* %87
%88 = load i32, i32* %6
%89 = icmp eq i32 %88, 3
br i1 %89, label %90, label %151
90: ; preds = %79
%91 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 4
store i8 0, i8* %91
store i32 -1, i32* %6
%92 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%93 = call i32 @convertStringToNumdecrypt(i8* %92)
store i32 %93, i32* %8
%94 = load i32, i32* %3
%95 = call i32 @keyGenerator(i32 %94, i32 16)
store i32 %95, i32* %15
%96 = load i32, i32* %8
%97 = load i32, i32* %15
%98 = xor i32 %96, %97
store i32 %98, i32* %8
%99 = load i32, i32* %8
%100 = call i32 @inversesBoxLookup(i32 %99)
store i32 %100, i32* %8
store i32 15, i32* %7
br label %101
101: ; preds = %111, %90
%102 = load i32, i32* %7
%103 = icmp sge i32 %102, 1
br i1 %103, label %104, label %114
104: ; preds = %101
%105 = load i32, i32* %3
%106 = load i32, i32* %7
%107 = call i32 @keyGenerator(i32 %105, i32 %106)
store i32 %107, i32* %16
%108 = load i32, i32* %8
%109 = load i32, i32* %16
%110 = call i32 @revroundfunc(i32 %108, i32 %109)
store i32 %110, i32* %8
br label %111
111: ; preds = %104
%112 = load i32, i32* %7
%113 = add nsw i32 %112, -1
store i32 %113, i32* %7
br label %101
114: ; preds = %101
%115 = load i32, i32* %8
%116 = load i32, i32* %3
%117 = xor i32 %115, %116
store i32 %117, i32* %8
%118 = bitcast [5 x i8]* %17 to i8*
store i32 0, i32* %7
br label %119
119: ; preds = %144, %114
%120 = load i32, i32* %7
%121 = icmp slt i32 %120, 4
br i1 %121, label %122, label %147
122: ; preds = %119
%123 = load i32, i32* %8
store i32 %123, i32* %18
%124 = load i32, i32* %18
%125 = load i32, i32* %7
%126 = mul nsw i32 8, %125
%127 = sub nsw i32 24, %126
%128 = ashr i32 %124, %127
store i32 %128, i32* %18
%129 = load i32, i32* %18
%130 = and i32 %129, 255
store i32 %130, i32* %18
%131 = load i32, i32* %18
%132 = icmp eq i32 %131, 0
br i1 %132, label %133, label %137
133: ; preds = %122
%134 = load i32, i32* %7
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [5 x i8], [5 x i8]* %17, i64 0, i64 %135
store i8 48, i8* %136
br label %143
137: ; preds = %122
%138 = load i32, i32* %18
%139 = trunc i32 %138 to i8
%140 = load i32, i32* %7
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [5 x i8], [5 x i8]* %17, i64 0, i64 %141
store i8 %139, i8* %142
br label %143
143: ; preds = %137, %133
br label %144
144: ; preds = %143
%145 = load i32, i32* %7
%146 = add nsw i32 %145, 1
store i32 %146, i32* %7
br label %119
147: ; preds = %119
%148 = load i32*, i32** %14
%149 = getelementptr inbounds [5 x i8], [5 x i8]* %17, i64 0, i64 0
%150 = call i32 @fprintf(i32* %148, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %149)
br label %151
151: ; preds = %147, %79
br label %74
152: ; preds = %74
%153 = load i32*, i32** %13
%154 = call i32 @fclose(i32* %153)
%155 = load i32*, i32** %14
%156 = call i32 @fclose(i32* %155)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Enter the file name (with full path) : \00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [2 x i8] c"w\00"
define void @decrypt(i32 %0) {
%2 = alloca [5 x i8]
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = alloca [5 x i8]
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stdout
%11 = tail call i32 @fflush(i32 %10)
%12 = bitcast [50 x i8]* %3 to i8**
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %12)
%14 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %43
15: ; preds = %61
%16 = add i32 %62, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %17
store i8 100, i8* %18
%19 = add i32 %62, 2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %20
store i8 101, i8* %21
%22 = add i32 %62, 3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %23
store i8 99, i8* %24
%25 = add i32 %62, 4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %26
store i8 114, i8* %27
%28 = add i32 %62, 5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %29
store i8 121, i8* %30
%31 = add i32 %62, 6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %32
store i8 112, i8* %33
%34 = add i32 %62, 7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %35
store i8 116, i8* %36
%37 = add i32 %62, 8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %38
store i8 0, i8* %39
%40 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%41 = call i32 @feof(i32* %14)
%42 = icmp eq i32 %41, 0
br i1 %42, label %65, label %139
43: ; preds = %61, %1
%44 = phi i64 [ 0, %1 ], [ %63, %61 ]
%45 = phi i32 [ 0, %1 ], [ %62, %61 ]
%46 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %44
%47 = load i8, i8* %46
%48 = icmp eq i8 %47, 0
br i1 %48, label %52, label %49
49: ; preds = %43
%50 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %44
store i8 %47, i8* %50
%51 = trunc i64 %44 to i32
br label %52
52: ; preds = %43, %49
%53 = phi i32 [ %51, %49 ], [ %45, %43 ]
%54 = or i64 %44, 1
%55 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = icmp eq i8 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %52
%59 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %54
store i8 %56, i8* %59
%60 = trunc i64 %54 to i32
br label %61
61: ; preds = %58, %52
%62 = phi i32 [ %60, %58 ], [ %53, %52 ]
%63 = add nuw nsw i64 %44, 2
%64 = icmp eq i64 %63, 50
br i1 %64, label %15, label %43
65: ; preds = %15
%66 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
%67 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%68 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 4
%69 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 1
%70 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 2
%71 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 3
br label %72
72: ; preds = %65, %135
%73 = phi i32 [ -1, %65 ], [ %136, %135 ]
%74 = add nsw i32 %73, 1
%75 = call signext i8 @getc(i32* %14)
%76 = sext i32 %74 to i64
%77 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 %76
store i8 %75, i8* %77
%78 = icmp eq i32 %74, 3
br i1 %78, label %79, label %135
79: ; preds = %72
store i8 0, i8* %66
%80 = call i32 @convertStringToNumdecrypt(i8* %6)
%81 = call i32 @keyGenerator(i32 %0, i32 16)
%82 = xor i32 %81, %80
%83 = call i32 @inversesBoxLookup(i32 %82)
%84 = call i32 @keyGenerator(i32 %0, i32 15)
%85 = call i32 @revroundfunc(i32 %83, i32 %84)
%86 = call i32 @keyGenerator(i32 %0, i32 14)
%87 = call i32 @revroundfunc(i32 %85, i32 %86)
%88 = call i32 @keyGenerator(i32 %0, i32 13)
%89 = call i32 @revroundfunc(i32 %87, i32 %88)
%90 = call i32 @keyGenerator(i32 %0, i32 12)
%91 = call i32 @revroundfunc(i32 %89, i32 %90)
%92 = call i32 @keyGenerator(i32 %0, i32 11)
%93 = call i32 @revroundfunc(i32 %91, i32 %92)
%94 = call i32 @keyGenerator(i32 %0, i32 10)
%95 = call i32 @revroundfunc(i32 %93, i32 %94)
%96 = call i32 @keyGenerator(i32 %0, i32 9)
%97 = call i32 @revroundfunc(i32 %95, i32 %96)
%98 = call i32 @keyGenerator(i32 %0, i32 8)
%99 = call i32 @revroundfunc(i32 %97, i32 %98)
%100 = call i32 @keyGenerator(i32 %0, i32 7)
%101 = call i32 @revroundfunc(i32 %99, i32 %100)
%102 = call i32 @keyGenerator(i32 %0, i32 6)
%103 = call i32 @revroundfunc(i32 %101, i32 %102)
%104 = call i32 @keyGenerator(i32 %0, i32 5)
%105 = call i32 @revroundfunc(i32 %103, i32 %104)
%106 = call i32 @keyGenerator(i32 %0, i32 4)
%107 = call i32 @revroundfunc(i32 %105, i32 %106)
%108 = call i32 @keyGenerator(i32 %0, i32 3)
%109 = call i32 @revroundfunc(i32 %107, i32 %108)
%110 = call i32 @keyGenerator(i32 %0, i32 2)
%111 = call i32 @revroundfunc(i32 %109, i32 %110)
%112 = call i32 @keyGenerator(i32 %0, i32 1)
%113 = call i32 @revroundfunc(i32 %111, i32 %112)
%114 = xor i32 %113, %0
store i8 0, i8* %68
%115 = ashr i32 %114, 24
%116 = and i32 %115, 255
%117 = icmp eq i32 %116, 0
%118 = trunc i32 %115 to i8
%119 = select i1 %117, i8 48, i8 %118
store i8 %119, i8* %67
%120 = and i32 %114, 16711680
%121 = icmp eq i32 %120, 0
%122 = lshr i32 %114, 16
%123 = trunc i32 %122 to i8
%124 = select i1 %121, i8 48, i8 %123
store i8 %124, i8* %69
%125 = and i32 %114, 65280
%126 = icmp eq i32 %125, 0
%127 = lshr i32 %114, 8
%128 = trunc i32 %127 to i8
%129 = select i1 %126, i8 48, i8 %128
store i8 %129, i8* %70
%130 = and i32 %114, 255
%131 = icmp eq i32 %130, 0
%132 = trunc i32 %114 to i8
%133 = select i1 %131, i8 48, i8 %132
store i8 %133, i8* %71
%134 = call i32 @fputs(i8* %67, i32* %40)
br label %135
135: ; preds = %79, %72
%136 = phi i32 [ -1, %79 ], [ %74, %72 ]
%137 = call i32 @feof(i32* %14)
%138 = icmp eq i32 %137, 0
br i1 %138, label %72, label %139
139: ; preds = %135, %15
%140 = call i32 @fclose(i32* %14)
%141 = call i32 @fclose(i32* %40)
ret void
}