#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 EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ *Openfile(char *, char *);
char *calloc(int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *f_cleartext;
  FILE *f_ciphertext;
  char *ciphertext = "ciphertext.txt";
  char *buf_rows;
  int r_char;
  int tot_rows = 0, i = 0;
  if (argc < 2) {
    fprintf(stderr, "Uso: %s <file_da_cifrare>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  f_cleartext = Openfile(argv[1], "r");
  while ((r_char = fgetc(f_cleartext)) != EOF) {
    tot_rows++;
  }
  fclose(f_cleartext);
  buf_rows = calloc(tot_rows, sizeof(char));
  f_cleartext = Openfile(argv[1], "r");
  while ((r_char = fgetc(f_cleartext)) != EOF) {
    buf_rows[i++] = r_char;
  }
  fclose(f_cleartext);
  f_ciphertext = Openfile(ciphertext, "w+");
  for (i = 0; i < tot_rows; i++) {
    if ((buf_rows[i] >= 88 && buf_rows[i] <= 90) ||
        (buf_rows[i] >= 120 && buf_rows[i] <= 122))
      buf_rows[i] = buf_rows[i] - 23;
    else if ((buf_rows[i] >= 65 && buf_rows[i] <= 87) ||
             (buf_rows[i] >= 97 && buf_rows[i] <= 120))
      buf_rows[i] += 3;
    else if ((buf_rows[i] >= 48 && buf_rows[i] <= 54))
      buf_rows[i] += 3;
    else if ((buf_rows[i] >= 55 && buf_rows[i] <= 57))
      buf_rows[i] = buf_rows[i] - 23;
    fprintf(f_ciphertext, "%c", buf_rows[i]);
  }
  printf("Il file %s e' stato cifrato con successo: \"%s\"\n", argv[1],
         ciphertext);
  fclose(f_ciphertext);
  free(buf_rows);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe63(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11e6 <main+0x66>
mov    0x2e18(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe3e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe35(%rip),%rsi
call   1070 <Openfile@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x34(%rbp)
mov    0x2dd7(%rip),%rcx
cmp    (%rcx),%eax
je     1227 <main+0xa7>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11fe <main+0x7e>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x38(%rbp),%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdda(%rip),%rsi
call   1070 <Openfile@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x34(%rbp)
mov    0x2d7c(%rip),%rcx
cmp    (%rcx),%eax
je     1293 <main+0x113>
mov    -0x34(%rbp),%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x3c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1259 <main+0xd9>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    0xd85(%rip),%rsi
call   1070 <Openfile@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1465 <main+0x2e5>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x58,%eax
jl     12ed <main+0x16d>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
jle    1317 <main+0x197>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x78,%eax
jl     1338 <main+0x1b8>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jg     1338 <main+0x1b8>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x17,%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1439 <main+0x2b9>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x41,%eax
jl     1362 <main+0x1e2>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x57,%eax
jle    138c <main+0x20c>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x61,%eax
jl     13a3 <main+0x223>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x78,%eax
jg     13a3 <main+0x223>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
add    $0x3,%edx
mov    %dl,(%rax,%rcx,1)
jmp    1434 <main+0x2b4>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     13e4 <main+0x264>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x36,%eax
jg     13e4 <main+0x264>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
add    $0x3,%edx
mov    %dl,(%rax,%rcx,1)
jmp    142f <main+0x2af>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x37,%eax
jl     142a <main+0x2aa>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     142a <main+0x2aa>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x17,%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    142f <main+0x2af>
jmp    1434 <main+0x2b4>
jmp    1439 <main+0x2b9>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xbdf(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12b7 <main+0x137>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x28(%rbp),%rdx
lea    0xbba(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    0x2b32(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x1,%edi
jle    1308 <main+0x178>
mov    0x8(%r14),%rdi
lea    0xe78(%rip),%rsi
call   1080 <Openfile@plt>
mov    %rax,%r15
mov    $0xffffffffffffffff,%rbx
mov    0x2e20(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1060 <fgetc@plt>
add    $0x1,%rbx
cmp    0x0(%r13),%eax
jne    11d0 <main+0x40>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1090 <calloc@plt>
mov    %rax,%r15
mov    0x8(%r14),%rdi
lea    0xe26(%rip),%rsi
call   1080 <Openfile@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1060 <fgetc@plt>
cmp    0x0(%r13),%eax
je     1235 <main+0xa5>
mov    %r15,%rbp
nopl   (%rax)
mov    %al,0x0(%rbp)
mov    %r12,%rdi
call   1060 <fgetc@plt>
add    $0x1,%rbp
cmp    0x0(%r13),%eax
jne    1220 <main+0x90>
mov    %r12,%rdi
call   1040 <fclose@plt>
lea    0xdbc(%rip),%rdi
lea    0xde1(%rip),%rsi
call   1080 <Openfile@plt>
mov    %rax,%r12
test   %ebx,%ebx
je     12c9 <main+0x139>
movabs $0x700000007,%r13
mov    %r15,%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x0(%rbp),%eax
mov    $0xe9,%cl
lea    -0x58(%rax),%edx
cmp    $0x22,%dl
ja     12a3 <main+0x113>
movzbl %dl,%edx
bt     %rdx,%r13
jae    12a3 <main+0x113>
add    %cl,%al
mov    %al,0x0(%rbp)
movsbl %al,%edi
mov    %r12,%rsi
call   1070 <fputc@plt>
add    $0x1,%rbp
add    $0xffffffffffffffff,%rbx
jne    1270 <main+0xe0>
jmp    12c9 <main+0x139>
lea    -0x41(%rax),%edx
mov    $0x3,%cl
cmp    $0x17,%dl
jb     1287 <main+0xf7>
lea    -0x61(%rax),%edx
cmp    $0x18,%dl
jb     1287 <main+0xf7>
lea    -0x30(%rax),%edx
cmp    $0x7,%dl
jb     1287 <main+0xf7>
lea    -0x37(%rax),%edx
mov    $0xe9,%cl
cmp    $0x2,%dl
jbe    1287 <main+0xf7>
jmp    128c <main+0xfc>
mov    0x8(%r14),%rsi
lea    0xd5b(%rip),%rdi
lea    0xd25(%rip),%rdx
call   1050 <printf@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x2cd1(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cc9(%rip),%rax
movslq (%rax),%rdi
mov    (%r14),%rdx
lea    0xcf3(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x2ca6(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"ciphertext.txt\00"
@stderr = global i32 0
@.str.1 = [27 x i8] c"Uso: %s <file_da_cifrare>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.3 = [3 x i8] c"w+\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [48 x i8] c"Il file %s e' stato cifrato con successo: \22%s\22\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %8
store i32 0, i32* %11
store i32 0, i32* %12
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %25
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32* @Openfile(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %29, i32** %6
br label %30
30: ; preds = %35, %25
%31 = load i32*, i32** %6
%32 = call i32 @fgetc(i32* %31)
store i32 %32, i32* %10
%33 = load i32, i32* @EOF
%34 = icmp ne i32 %32, %33
br i1 %34, label %35, label %38
35: ; preds = %30
%36 = load i32, i32* %11
%37 = add nsw i32 %36, 1
store i32 %37, i32* %11
br label %30
38: ; preds = %30
%39 = load i32*, i32** %6
%40 = call i32 @fclose(i32* %39)
%41 = load i32, i32* %11
%42 = call i8* @calloc(i32 %41, i32 1)
store i8* %42, i8** %9
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32* @Openfile(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %46, i32** %6
br label %47
47: ; preds = %52, %38
%48 = load i32*, i32** %6
%49 = call i32 @fgetc(i32* %48)
store i32 %49, i32* %10
%50 = load i32, i32* @EOF
%51 = icmp ne i32 %49, %50
br i1 %51, label %52, label %60
52: ; preds = %47
%53 = load i32, i32* %10
%54 = trunc i32 %53 to i8
%55 = load i8*, i8** %9
%56 = load i32, i32* %12
%57 = add nsw i32 %56, 1
store i32 %57, i32* %12
%58 = sext i32 %56 to i64
%59 = getelementptr inbounds i8, i8* %55, i64 %58
store i8 %54, i8* %59
br label %47
60: ; preds = %47
%61 = load i32*, i32** %6
%62 = call i32 @fclose(i32* %61)
%63 = load i8*, i8** %8
%64 = call i32* @Openfile(i8* %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %64, i32** %7
store i32 0, i32* %12
br label %65
65: ; preds = %221, %60
%66 = load i32, i32* %12
%67 = load i32, i32* %11
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %224
69: ; preds = %65
%70 = load i8*, i8** %9
%71 = load i32, i32* %12
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %70, i64 %72
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp sge i32 %75, 88
br i1 %76, label %77, label %85
77: ; preds = %69
%78 = load i8*, i8** %9
%79 = load i32, i32* %12
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %78, i64 %80
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp sle i32 %83, 90
br i1 %84, label %101, label %85
85: ; preds = %77, %69
%86 = load i8*, i8** %9
%87 = load i32, i32* %12
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %86, i64 %88
%90 = load i8, i8* %89
%91 = sext i8 %90 to i32
%92 = icmp sge i32 %91, 120
br i1 %92, label %93, label %114
93: ; preds = %85
%94 = load i8*, i8** %9
%95 = load i32, i32* %12
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %94, i64 %96
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = icmp sle i32 %99, 122
br i1 %100, label %101, label %114
101: ; preds = %93, %77
%102 = load i8*, i8** %9
%103 = load i32, i32* %12
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %102, i64 %104
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = sub nsw i32 %107, 23
%109 = trunc i32 %108 to i8
%110 = load i8*, i8** %9
%111 = load i32, i32* %12
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i8, i8* %110, i64 %112
store i8 %109, i8* %113
br label %212
114: ; preds = %93, %85
%115 = load i8*, i8** %9
%116 = load i32, i32* %12
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8, i8* %115, i64 %117
%119 = load i8, i8* %118
%120 = sext i8 %119 to i32
%121 = icmp sge i32 %120, 65
br i1 %121, label %122, label %130
122: ; preds = %114
%123 = load i8*, i8** %9
%124 = load i32, i32* %12
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i8, i8* %123, i64 %125
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = icmp sle i32 %128, 87
br i1 %129, label %146, label %130
130: ; preds = %122, %114
%131 = load i8*, i8** %9
%132 = load i32, i32* %12
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds i8, i8* %131, i64 %133
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = icmp sge i32 %136, 97
br i1 %137, label %138, label %155
138: ; preds = %130
%139 = load i8*, i8** %9
%140 = load i32, i32* %12
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %139, i64 %141
%143 = load i8, i8* %142
%144 = sext i8 %143 to i32
%145 = icmp sle i32 %144, 120
br i1 %145, label %146, label %155
146: ; preds = %138, %122
%147 = load i8*, i8** %9
%148 = load i32, i32* %12
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8, i8* %147, i64 %149
%151 = load i8, i8* %150
%152 = sext i8 %151 to i32
%153 = add nsw i32 %152, 3
%154 = trunc i32 %153 to i8
store i8 %154, i8* %150
br label %211
155: ; preds = %138, %130
%156 = load i8*, i8** %9
%157 = load i32, i32* %12
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds i8, i8* %156, i64 %158
%160 = load i8, i8* %159
%161 = sext i8 %160 to i32
%162 = icmp sge i32 %161, 48
br i1 %162, label %163, label %180
163: ; preds = %155
%164 = load i8*, i8** %9
%165 = load i32, i32* %12
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds i8, i8* %164, i64 %166
%168 = load i8, i8* %167
%169 = sext i8 %168 to i32
%170 = icmp sle i32 %169, 54
br i1 %170, label %171, label %180
171: ; preds = %163
%172 = load i8*, i8** %9
%173 = load i32, i32* %12
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds i8, i8* %172, i64 %174
%176 = load i8, i8* %175
%177 = sext i8 %176 to i32
%178 = add nsw i32 %177, 3
%179 = trunc i32 %178 to i8
store i8 %179, i8* %175
br label %210
180: ; preds = %163, %155
%181 = load i8*, i8** %9
%182 = load i32, i32* %12
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds i8, i8* %181, i64 %183
%185 = load i8, i8* %184
%186 = sext i8 %185 to i32
%187 = icmp sge i32 %186, 55
br i1 %187, label %188, label %209
188: ; preds = %180
%189 = load i8*, i8** %9
%190 = load i32, i32* %12
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds i8, i8* %189, i64 %191
%193 = load i8, i8* %192
%194 = sext i8 %193 to i32
%195 = icmp sle i32 %194, 57
br i1 %195, label %196, label %209
196: ; preds = %188
%197 = load i8*, i8** %9
%198 = load i32, i32* %12
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds i8, i8* %197, i64 %199
%201 = load i8, i8* %200
%202 = sext i8 %201 to i32
%203 = sub nsw i32 %202, 23
%204 = trunc i32 %203 to i8
%205 = load i8*, i8** %9
%206 = load i32, i32* %12
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds i8, i8* %205, i64 %207
store i8 %204, i8* %208
br label %209
209: ; preds = %196, %188, %180
br label %210
210: ; preds = %209, %171
br label %211
211: ; preds = %210, %146
br label %212
212: ; preds = %211, %101
%213 = load i32*, i32** %7
%214 = load i8*, i8** %9
%215 = load i32, i32* %12
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds i8, i8* %214, i64 %216
%218 = load i8, i8* %217
%219 = sext i8 %218 to i32
%220 = call i32 (i32*, i8*, ...) @fprintf(i32* %213, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %219)
br label %221
221: ; preds = %212
%222 = load i32, i32* %12
%223 = add nsw i32 %222, 1
store i32 %223, i32* %12
br label %65
224: ; preds = %65
%225 = load i8**, i8*** %5
%226 = getelementptr inbounds i8*, i8** %225, i64 1
%227 = load i8*, i8** %226
%228 = load i8*, i8** %8
%229 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i8* %227, i8* %228)
%230 = load i32*, i32** %7
%231 = call i32 @fclose(i32* %230)
%232 = load i8*, i8** %9
%233 = call i32 @free(i8* %232)
%234 = load i32, i32* @EXIT_SUCCESS
ret i32 %234
}

LLVM IR (-O2):
@.str = [15 x i8] c"ciphertext.txt\00"
@stderr = global i32 0
@.str.1 = [27 x i8] c"Uso: %s <file_da_cifrare>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.3 = [3 x i8] c"w+\00"
@.str.5 = [48 x i8] c"Il file %s e' stato cifrato con successo: \22%s\22\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load i8*, i8** %1
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @Openfile(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %16, %12
%17 = phi i32 [ 0, %12 ], [ %21, %16 ]
%18 = tail call i32 @fgetc(i32* %15)
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
%21 = add nuw nsw i32 %17, 1
br i1 %20, label %22, label %16
22: ; preds = %16
%23 = tail call i32 @fclose(i32* %15)
%24 = tail call i8* @calloc(i32 %17, i32 1)
%25 = load i8*, i8** %13
%26 = tail call i32* @Openfile(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = tail call i32 @fgetc(i32* %26)
%28 = load i32, i32* @EOF
%29 = icmp eq i32 %27, %28
br i1 %29, label %39, label %30
30: ; preds = %22, %30
%31 = phi i64 [ %34, %30 ], [ 0, %22 ]
%32 = phi i32 [ %36, %30 ], [ %27, %22 ]
%33 = trunc i32 %32 to i8
%34 = add nuw i64 %31, 1
%35 = getelementptr inbounds i8, i8* %24, i64 %31
store i8 %33, i8* %35
%36 = tail call i32 @fgetc(i32* %26)
%37 = load i32, i32* @EOF
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %30
39: ; preds = %30, %22
%40 = tail call i32 @fclose(i32* %26)
%41 = tail call i32* @Openfile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%42 = icmp eq i32 %17, 0
br i1 %42, label %70, label %43
43: ; preds = %39
%44 = zext i32 %17 to i64
br label %45
45: ; preds = %43, %64
%46 = phi i64 [ 0, %43 ], [ %68, %64 ]
%47 = getelementptr inbounds i8, i8* %24, i64 %46
%48 = load i8, i8* %47
switch i8 %48, label %49 [
i8 122, label %61
i8 121, label %61
i8 120, label %61
i8 90, label %61
i8 89, label %61
i8 88, label %61
]
49: ; preds = %45
%50 = add i8 %48, -65
%51 = icmp ult i8 %50, 23
%52 = add i8 %48, -97
%53 = icmp ult i8 %52, 24
%54 = or i1 %51, %53
%55 = add i8 %48, -48
%56 = icmp ult i8 %55, 7
%57 = select i1 %54, i1 true, i1 %56
br i1 %57, label %61, label %58
58: ; preds = %49
%59 = add i8 %48, -55
%60 = icmp ult i8 %59, 3
br i1 %60, label %61, label %64
61: ; preds = %58, %49, %45, %45, %45, %45, %45, %45
%62 = phi i8 [ -23, %45 ], [ -23, %45 ], [ -23, %45 ], [ -23, %45 ], [ -23, %45 ], [ -23, %45 ], [ 3, %49 ], [ -23, %58 ]
%63 = add nsw i8 %48, %62
store i8 %63, i8* %47
br label %64
64: ; preds = %61, %58
%65 = phi i8 [ %48, %58 ], [ %63, %61 ]
%66 = sext i8 %65 to i32
%67 = tail call i32 @fputc(i32 %66, i32* %41)
%68 = add nuw nsw i64 %46, 1
%69 = icmp eq i64 %68, %44
br i1 %69, label %70, label %45
70: ; preds = %64, %39
%71 = load i8*, i8** %13
%72 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i8* %71, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%73 = tail call i32 @fclose(i32* %41)
%74 = tail call i32 @free(i8* %24)
%75 = load i32, i32* @EXIT_SUCCESS
ret i32 %75
}