#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*/ passphrase;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
unsigned char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
void crypt(FILE *fp_r, FILE *fp_w, unsigned char *passphrase, int encswitch) {
  assert(fp_r != NULL);
  assert(fp_w != NULL);
  unsigned char c;
  unsigned char d;
  int size;
  int i = 0;
  int u = 0;
  int charbuffer = sizeof(passphrase);
  if (encswitch == 0) {
    while (size = sizeof(char) == fread(&c, sizeof(char), 1, fp_r) != 0) {
      if (passphrase[i] == 0 && passphrase[i + 1] == 0) {
        i = 0;
      }
      c = (c + passphrase[i]) % 256;
      fwrite(&c, sizeof(char), 1, fp_w);
      i++;
    }
    printf("Successfully encrypted!\n");
  } else if (encswitch == 1) {
    while (size = sizeof(char) == fread(&c, sizeof(char), 1, fp_r) != 0) {
      if (passphrase[i] == 0 || passphrase[i] == '\0') {
        i = 0;
      }
      c = (c - passphrase[i]) % 256;
      fwrite(&c, sizeof(char), 1, fp_w);
      i++;
    }
    printf("Successfully decrypted!\n");
  } else if (encswitch == 2) {
    unsigned char *content_r = malloc(30 * sizeof(char));
    i = 0;
    while (size = sizeof(char) == fread(&c, sizeof(char), 1, fp_r) != 0) {
      if (i > 30) {
        break;
      }
      content_r[i] = c;
      i++;
    }
    unsigned char *content_w = malloc(30 * sizeof(char));
    i = 0;
    while (size = sizeof(char) == fread(&d, sizeof(char), 1, fp_w) != 0) {
      if (i > 30) {
        break;
      }
      content_w[i] = d;
      i++;
    }
    unsigned char *solution = malloc(30 * sizeof(char));
    for (u = 0; u < 30; u++) {
      solution[u] = (unsigned char)((256 + content_w[u] - content_r[u]) % 256);
    }
    printf("Your passphrase was:\n");
    i = 0;
    for (u = 1; u < 30; u++) {
      if (solution[i] == solution[u]) {
        if (solution[i + 1] == solution[u + 1]) {
          solution[u] = '\0';
          solution[u + 1] = '\0';
        }
      }
    }
    for (u = 0; u < 30; u++) {
      if (solution[u] != '\0' && solution[u + 1] != '\0') {
        printf("%c", solution[u]);
      } else {
        printf("%c", solution[u]);
        break;
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<crypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x8,-0x30(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    127e <crypt+0x12e>
jmp    11af <crypt+0x5f>
mov    -0x8(%rbp),%rcx
lea    -0x1d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movslq %eax,%rcx
mov    $0x1,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x24(%rbp)
test   $0x1,%al
jne    11f4 <crypt+0xa4>
jmp    126b <crypt+0x11b>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    122a <crypt+0xda>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    122a <crypt+0xda>
movl   $0x0,-0x28(%rbp)
movzbl -0x1d(%rbp),%eax
mov    -0x18(%rbp),%rcx
movslq -0x28(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x1d(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x1d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1070 <fwrite@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11af <crypt+0x5f>
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1618 <crypt+0x4c8>
cmpl   $0x1,-0x1c(%rbp)
jne    1357 <crypt+0x207>
jmp    128d <crypt+0x13d>
mov    -0x8(%rbp),%rcx
lea    -0x1d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movslq %eax,%rcx
mov    $0x1,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x24(%rbp)
test   $0x1,%al
jne    12d2 <crypt+0x182>
jmp    1344 <crypt+0x1f4>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     12fc <crypt+0x1ac>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1303 <crypt+0x1b3>
movl   $0x0,-0x28(%rbp)
movzbl -0x1d(%rbp),%eax
mov    -0x18(%rbp),%rcx
movslq -0x28(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
sub    %ecx,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x1d(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x1d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1070 <fwrite@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    128d <crypt+0x13d>
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1613 <crypt+0x4c3>
cmpl   $0x2,-0x1c(%rbp)
jne    160e <crypt+0x4be>
mov    $0x1e,%edi
call   1060 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x1d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movslq %eax,%rcx
mov    $0x1,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x24(%rbp)
test   $0x1,%al
jne    13bb <crypt+0x26b>
jmp    13e6 <crypt+0x296>
cmpl   $0x1e,-0x28(%rbp)
jle    13ca <crypt+0x27a>
jmp    13e6 <crypt+0x296>
mov    -0x1d(%rbp),%dl
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1376 <crypt+0x226>
mov    $0x1e,%edi
call   1060 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x1e(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movslq %eax,%rcx
mov    $0x1,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x24(%rbp)
test   $0x1,%al
jne    1440 <crypt+0x2f0>
jmp    146b <crypt+0x31b>
cmpl   $0x1e,-0x28(%rbp)
jle    144f <crypt+0x2ff>
jmp    146b <crypt+0x31b>
mov    -0x1e(%rbp),%dl
mov    -0x40(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    13fb <crypt+0x2ab>
mov    $0x1e,%edi
call   1060 <malloc@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x1e,-0x2c(%rbp)
jge    14ca <crypt+0x37a>
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
add    $0x100,%eax
mov    -0x38(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
sub    %ecx,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    -0x48(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1480 <crypt+0x330>
lea    0xb61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
cmpl   $0x1e,-0x2c(%rbp)
jge    156f <crypt+0x41f>
mov    -0x48(%rbp),%rax
movslq -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x48(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    155c <crypt+0x40c>
mov    -0x48(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x48(%rbp),%rcx
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1557 <crypt+0x407>
mov    -0x48(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x48(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    155c <crypt+0x40c>
jmp    1561 <crypt+0x411>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    14e6 <crypt+0x396>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x1e,-0x2c(%rbp)
jge    1600 <crypt+0x4b0>
mov    -0x48(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     15ce <crypt+0x47e>
mov    -0x48(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     15ce <crypt+0x47e>
mov    -0x48(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xa86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    15ed <crypt+0x49d>
mov    -0x48(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xa67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1600 <crypt+0x4b0>
jmp    15f2 <crypt+0x4a2>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1576 <crypt+0x426>
lea    0xa29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1613 <crypt+0x4c3>
jmp    1618 <crypt+0x4c8>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypt>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1070 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1070 <assert@plt>
test   %ebp,%ebp
je     122d <crypt+0xcd>
cmp    $0x2,%ebp
je     12b5 <crypt+0x155>
cmp    $0x1,%ebp
jne    1482 <crypt+0x322>
lea    0xe(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fread@plt>
cmp    $0x1,%eax
jne    148f <crypt+0x32f>
xor    %ebp,%ebp
lea    0xe(%rsp),%r12
jmp    121b <crypt+0xbb>
cs nopw 0x0(%rax,%rax,1)
movzbl 0xe(%rsp),%ecx
movslq %eax,%rbp
sub    (%rbx,%rbp,1),%cl
mov    %cl,0xe(%rsp)
movsbl %cl,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
add    $0x1,%ebp
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fread@plt>
cmp    $0x1,%eax
jne    148f <crypt+0x32f>
movslq %ebp,%rax
cmpb   $0x0,(%rbx,%rax,1)
mov    $0x0,%eax
je     11e0 <crypt+0x80>
mov    %ebp,%eax
jmp    11e0 <crypt+0x80>
lea    0xe(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fread@plt>
cmp    $0x1,%eax
jne    144f <crypt+0x2ef>
xor    %ebp,%ebp
lea    0xe(%rsp),%r12
jmp    129d <crypt+0x13d>
cs nopw 0x0(%rax,%rax,1)
movslq %ecx,%rax
movzbl (%rbx,%rax,1),%eax
mov    %ecx,%ebp
add    0xe(%rsp),%al
mov    %al,0xe(%rsp)
movsbl %al,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
add    $0x1,%ebp
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fread@plt>
cmp    $0x1,%eax
jne    144f <crypt+0x2ef>
movslq %ebp,%rdx
movzbl (%rbx,%rdx,1),%eax
test   %al,%al
jne    1269 <crypt+0x109>
xor    %ecx,%ecx
cmpb   $0x0,0x1(%rdx,%rbx,1)
je     1260 <crypt+0x100>
mov    %ebp,%ecx
jmp    1260 <crypt+0x100>
mov    $0x1e,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
lea    0xe(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fread@plt>
cmp    $0x1,%eax
jne    1320 <crypt+0x1c0>
xor    %ebp,%ebp
lea    0xe(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0xe(%rsp),%eax
mov    %al,(%r12,%rbp,1)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fread@plt>
cmp    $0x1,%eax
jne    1320 <crypt+0x1c0>
lea    0x1(%rbp),%rax
cmp    $0x1e,%rbp
mov    %rax,%rbp
jb     12f0 <crypt+0x190>
mov    $0x1e,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
lea    0xf(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fread@plt>
cmp    $0x1,%eax
jne    1380 <crypt+0x220>
xor    %ebp,%ebp
lea    0xf(%rsp),%rbx
movzbl 0xf(%rsp),%eax
mov    %al,(%r15,%rbp,1)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fread@plt>
cmp    $0x1,%eax
jne    1380 <crypt+0x220>
lea    0x1(%rbp),%rax
cmp    $0x1e,%rbp
mov    %rax,%rbp
jb     1350 <crypt+0x1f0>
mov    $0x1e,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
movdqu (%r15),%xmm0
movdqu (%r12),%xmm1
psubb  %xmm1,%xmm0
movdqu %xmm0,(%rax)
movq   0x10(%r15),%xmm0
movq   0x10(%r12),%xmm1
psubb  %xmm1,%xmm0
movq   %xmm0,0x10(%rax)
mov    0x18(%r15),%al
sub    0x18(%r12),%al
mov    %al,0x18(%r14)
mov    0x19(%r15),%al
sub    0x19(%r12),%al
mov    %al,0x19(%r14)
mov    0x1a(%r15),%al
sub    0x1a(%r12),%al
mov    %al,0x1a(%r14)
mov    0x1b(%r15),%al
sub    0x1b(%r12),%al
mov    %al,0x1b(%r14)
mov    0x1c(%r15),%al
sub    0x1c(%r12),%al
mov    %al,0x1c(%r14)
mov    0x1d(%r15),%al
sub    0x1d(%r12),%al
mov    %al,0x1d(%r14)
lea    0xbf5(%rip),%rdi
call   1040 <puts@plt>
mov    (%r14),%bl
mov    $0x1,%eax
jmp    1430 <crypt+0x2d0>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
mov    %rax,%rcx
mov    %rcx,%rax
cmp    $0x1e,%rcx
je     1458 <crypt+0x2f8>
cmp    (%r14,%rax,1),%bl
jne    1420 <crypt+0x2c0>
movzbl 0x1(%r14),%edx
lea    0x1(%rax),%rcx
cmp    0x1(%r14,%rax,1),%dl
jne    1427 <crypt+0x2c7>
movw   $0x0,(%r14,%rax,1)
jmp    1427 <crypt+0x2c7>
lea    0xbd7(%rip),%rdi
jmp    1496 <crypt+0x336>
mov    $0x1,%ebp
nopl   (%rax)
movzbl %bl,%edi
test   %dil,%dil
je     14a7 <crypt+0x347>
movzbl (%r14,%rbp,1),%ebx
test   %bl,%bl
je     14a7 <crypt+0x347>
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    $0x1f,%rbp
jne    1460 <crypt+0x300>
jmp    14ac <crypt+0x34c>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb7f(%rip),%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>
call   1030 <putchar@plt>
mov    $0xa,%edi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Successfully encrypted!\0A\00"
@.str.1 = [25 x i8] c"Successfully decrypted!\0A\00"
@.str.2 = [22 x i8] c"Your passphrase was:\0A\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @crypt(i32* %0, i32* %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%18 = load i32*, i32** %5
%19 = icmp ne i32* %18, null
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32*, i32** %6
%23 = icmp ne i32* %22, null
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
store i32 0, i32* %12
store i32 0, i32* %13
store i32 8, i32* %14
%26 = load i32, i32* %8
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %73
28: ; preds = %4
br label %29
29: ; preds = %55, %28
%30 = load i32*, i32** %5
%31 = call i32 @fread(i8* %9, i32 1, i32 1, i32* %30)
%32 = sext i32 %31 to i64
%33 = icmp eq i64 1, %32
%34 = zext i1 %33 to i32
%35 = icmp ne i32 %34, 0
%36 = zext i1 %35 to i32
store i32 %36, i32* %11
br i1 %35, label %37, label %71
37: ; preds = %29
%38 = load i8*, i8** %7
%39 = load i32, i32* %12
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %55
45: ; preds = %37
%46 = load i8*, i8** %7
%47 = load i32, i32* %12
%48 = add nsw i32 %47, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %46, i64 %49
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %45
store i32 0, i32* %12
br label %55
55: ; preds = %54, %45, %37
%56 = load i8, i8* %9
%57 = zext i8 %56 to i32
%58 = load i8*, i8** %7
%59 = load i32, i32* %12
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = add nsw i32 %57, %63
%65 = srem i32 %64, 256
%66 = trunc i32 %65 to i8
store i8 %66, i8* %9
%67 = load i32*, i32** %6
%68 = call i32 @fwrite(i8* %9, i32 1, i32 1, i32* %67)
%69 = load i32, i32* %12
%70 = add nsw i32 %69, 1
store i32 %70, i32* %12
br label %29
71: ; preds = %29
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %291
73: ; preds = %4
%74 = load i32, i32* %8
%75 = icmp eq i32 %74, 1
br i1 %75, label %76, label %120
76: ; preds = %73
br label %77
77: ; preds = %102, %76
%78 = load i32*, i32** %5
%79 = call i32 @fread(i8* %9, i32 1, i32 1, i32* %78)
%80 = sext i32 %79 to i64
%81 = icmp eq i64 1, %80
%82 = zext i1 %81 to i32
%83 = icmp ne i32 %82, 0
%84 = zext i1 %83 to i32
store i32 %84, i32* %11
br i1 %83, label %85, label %118
85: ; preds = %77
%86 = load i8*, i8** %7
%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 = zext i8 %90 to i32
%92 = icmp eq i32 %91, 0
br i1 %92, label %101, label %93
93: ; preds = %85
%94 = load i8*, i8** %7
%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 = zext i8 %98 to i32
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %102
101: ; preds = %93, %85
store i32 0, i32* %12
br label %102
102: ; preds = %101, %93
%103 = load i8, i8* %9
%104 = zext i8 %103 to i32
%105 = load i8*, i8** %7
%106 = load i32, i32* %12
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %105, i64 %107
%109 = load i8, i8* %108
%110 = zext i8 %109 to i32
%111 = sub nsw i32 %104, %110
%112 = srem i32 %111, 256
%113 = trunc i32 %112 to i8
store i8 %113, i8* %9
%114 = load i32*, i32** %6
%115 = call i32 @fwrite(i8* %9, i32 1, i32 1, i32* %114)
%116 = load i32, i32* %12
%117 = add nsw i32 %116, 1
store i32 %117, i32* %12
br label %77
118: ; preds = %77
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %290
120: ; preds = %73
%121 = load i32, i32* %8
%122 = icmp eq i32 %121, 2
br i1 %122, label %123, label %289
123: ; preds = %120
%124 = call i8* @malloc(i32 30)
store i8* %124, i8** %15
store i32 0, i32* %12
br label %125
125: ; preds = %137, %123
%126 = load i32*, i32** %5
%127 = call i32 @fread(i8* %9, i32 1, i32 1, i32* %126)
%128 = sext i32 %127 to i64
%129 = icmp eq i64 1, %128
%130 = zext i1 %129 to i32
%131 = icmp ne i32 %130, 0
%132 = zext i1 %131 to i32
store i32 %132, i32* %11
br i1 %131, label %133, label %145
133: ; preds = %125
%134 = load i32, i32* %12
%135 = icmp sgt i32 %134, 30
br i1 %135, label %136, label %137
136: ; preds = %133
br label %145
137: ; preds = %133
%138 = load i8, i8* %9
%139 = load i8*, i8** %15
%140 = load i32, i32* %12
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %139, i64 %141
store i8 %138, i8* %142
%143 = load i32, i32* %12
%144 = add nsw i32 %143, 1
store i32 %144, i32* %12
br label %125
145: ; preds = %136, %125
%146 = call i8* @malloc(i32 30)
store i8* %146, i8** %16
store i32 0, i32* %12
br label %147
147: ; preds = %159, %145
%148 = load i32*, i32** %6
%149 = call i32 @fread(i8* %10, i32 1, i32 1, i32* %148)
%150 = sext i32 %149 to i64
%151 = icmp eq i64 1, %150
%152 = zext i1 %151 to i32
%153 = icmp ne i32 %152, 0
%154 = zext i1 %153 to i32
store i32 %154, i32* %11
br i1 %153, label %155, label %167
155: ; preds = %147
%156 = load i32, i32* %12
%157 = icmp sgt i32 %156, 30
br i1 %157, label %158, label %159
158: ; preds = %155
br label %167
159: ; preds = %155
%160 = load i8, i8* %10
%161 = load i8*, i8** %16
%162 = load i32, i32* %12
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds i8, i8* %161, i64 %163
store i8 %160, i8* %164
%165 = load i32, i32* %12
%166 = add nsw i32 %165, 1
store i32 %166, i32* %12
br label %147
167: ; preds = %158, %147
%168 = call i8* @malloc(i32 30)
store i8* %168, i8** %17
store i32 0, i32* %13
br label %169
169: ; preds = %193, %167
%170 = load i32, i32* %13
%171 = icmp slt i32 %170, 30
br i1 %171, label %172, label %196
172: ; preds = %169
%173 = load i8*, i8** %16
%174 = load i32, i32* %13
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds i8, i8* %173, i64 %175
%177 = load i8, i8* %176
%178 = zext i8 %177 to i32
%179 = add nsw i32 256, %178
%180 = load i8*, i8** %15
%181 = load i32, i32* %13
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds i8, i8* %180, i64 %182
%184 = load i8, i8* %183
%185 = zext i8 %184 to i32
%186 = sub nsw i32 %179, %185
%187 = srem i32 %186, 256
%188 = trunc i32 %187 to i8
%189 = load i8*, i8** %17
%190 = load i32, i32* %13
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds i8, i8* %189, i64 %191
store i8 %188, i8* %192
br label %193
193: ; preds = %172
%194 = load i32, i32* %13
%195 = add nsw i32 %194, 1
store i32 %195, i32* %13
br label %169
196: ; preds = %169
%197 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %12
store i32 1, i32* %13
br label %198
198: ; preds = %243, %196
%199 = load i32, i32* %13
%200 = icmp slt i32 %199, 30
br i1 %200, label %201, label %246
201: ; preds = %198
%202 = load i8*, i8** %17
%203 = load i32, i32* %12
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds i8, i8* %202, i64 %204
%206 = load i8, i8* %205
%207 = zext i8 %206 to i32
%208 = load i8*, i8** %17
%209 = load i32, i32* %13
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds i8, i8* %208, i64 %210
%212 = load i8, i8* %211
%213 = zext i8 %212 to i32
%214 = icmp eq i32 %207, %213
br i1 %214, label %215, label %242
215: ; preds = %201
%216 = load i8*, i8** %17
%217 = load i32, i32* %12
%218 = add nsw i32 %217, 1
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds i8, i8* %216, i64 %219
%221 = load i8, i8* %220
%222 = zext i8 %221 to i32
%223 = load i8*, i8** %17
%224 = load i32, i32* %13
%225 = add nsw i32 %224, 1
%226 = sext i32 %225 to i64
%227 = getelementptr inbounds i8, i8* %223, i64 %226
%228 = load i8, i8* %227
%229 = zext i8 %228 to i32
%230 = icmp eq i32 %222, %229
br i1 %230, label %231, label %241
231: ; preds = %215
%232 = load i8*, i8** %17
%233 = load i32, i32* %13
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds i8, i8* %232, i64 %234
store i8 0, i8* %235
%236 = load i8*, i8** %17
%237 = load i32, i32* %13
%238 = add nsw i32 %237, 1
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds i8, i8* %236, i64 %239
store i8 0, i8* %240
br label %241
241: ; preds = %231, %215
br label %242
242: ; preds = %241, %201
br label %243
243: ; preds = %242
%244 = load i32, i32* %13
%245 = add nsw i32 %244, 1
store i32 %245, i32* %13
br label %198
246: ; preds = %198
store i32 0, i32* %13
br label %247
247: ; preds = %284, %246
%248 = load i32, i32* %13
%249 = icmp slt i32 %248, 30
br i1 %249, label %250, label %287
250: ; preds = %247
%251 = load i8*, i8** %17
%252 = load i32, i32* %13
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds i8, i8* %251, i64 %253
%255 = load i8, i8* %254
%256 = zext i8 %255 to i32
%257 = icmp ne i32 %256, 0
br i1 %257, label %258, label %275
258: ; preds = %250
%259 = load i8*, i8** %17
%260 = load i32, i32* %13
%261 = add nsw i32 %260, 1
%262 = sext i32 %261 to i64
%263 = getelementptr inbounds i8, i8* %259, i64 %262
%264 = load i8, i8* %263
%265 = zext i8 %264 to i32
%266 = icmp ne i32 %265, 0
br i1 %266, label %267, label %275
267: ; preds = %258
%268 = load i8*, i8** %17
%269 = load i32, i32* %13
%270 = sext i32 %269 to i64
%271 = getelementptr inbounds i8, i8* %268, i64 %270
%272 = load i8, i8* %271
%273 = zext i8 %272 to i32
%274 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %273)
br label %283
275: ; preds = %258, %250
%276 = load i8*, i8** %17
%277 = load i32, i32* %13
%278 = sext i32 %277 to i64
%279 = getelementptr inbounds i8, i8* %276, i64 %278
%280 = load i8, i8* %279
%281 = zext i8 %280 to i32
%282 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %281)
br label %287
283: ; preds = %267
br label %284
284: ; preds = %283
%285 = load i32, i32* %13
%286 = add nsw i32 %285, 1
store i32 %286, i32* %13
br label %247
287: ; preds = %275, %247
%288 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %289
289: ; preds = %287, %120
br label %290
290: ; preds = %289, %118
br label %291
291: ; preds = %290, %71
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"Your passphrase was:\00"
@str.5 = [24 x i8] c"Successfully decrypted!\00"
@str.6 = [24 x i8] c"Successfully encrypted!\00"
define void @crypt(i32* %0, i32* %1, i8* nocapture %2, i32 %3) {
%5 = alloca i8
%6 = alloca i8
%7 = icmp ne i32* %0, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = icmp ne i32* %1, null
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
switch i32 %3, label %183 [
i32 0, label %16
i32 1, label %13
i32 2, label %66
]
13: ; preds = %4
%14 = call i32 @fread(i8* %5, i32 1, i32 1, i32* %0)
%15 = icmp eq i32 %14, 1
br i1 %15, label %47, label %64
16: ; preds = %4
%17 = call i32 @fread(i8* %5, i32 1, i32 1, i32* %0)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %45
19: ; preds = %16, %35
%20 = phi i32 [ %42, %35 ], [ 0, %16 ]
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %2, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %35
25: ; preds = %19
%26 = add nsw i32 %20, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %2, i64 %27
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 0
%31 = select i1 %30, i32 0, i32 %20
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %2, i64 %32
%34 = load i8, i8* %33
br label %35
35: ; preds = %25, %19
%36 = phi i8 [ %34, %25 ], [ %23, %19 ]
%37 = phi i32 [ %31, %25 ], [ %20, %19 ]
%38 = load i8, i8* %5
%39 = add i8 %36, %38
store i8 %39, i8* %5
%40 = sext i8 %39 to i32
%41 = tail call i32 @fputc(i32 %40, i32* %1)
%42 = add nsw i32 %37, 1
%43 = call i32 @fread(i8* %5, i32 1, i32 1, i32* %0)
%44 = icmp eq i32 %43, 1
br i1 %44, label %19, label %45
45: ; preds = %35, %16
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.6, i64 0, i64 0))
br label %183
47: ; preds = %13, %47
%48 = phi i32 [ %61, %47 ], [ 0, %13 ]
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %2, i64 %49
%51 = load i8, i8* %50
%52 = icmp eq i8 %51, 0
%53 = select i1 %52, i32 0, i32 %48
%54 = load i8, i8* %5
%55 = sext i32 %53 to i64
%56 = getelementptr inbounds i8, i8* %2, i64 %55
%57 = load i8, i8* %56
%58 = sub i8 %54, %57
store i8 %58, i8* %5
%59 = sext i8 %58 to i32
%60 = tail call i32 @fputc(i32 %59, i32* %1)
%61 = add nsw i32 %53, 1
%62 = call i32 @fread(i8* %5, i32 1, i32 1, i32* %0)
%63 = icmp eq i32 %62, 1
br i1 %63, label %47, label %64
64: ; preds = %47, %13
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.5, i64 0, i64 0))
br label %183
66: ; preds = %4
%67 = tail call dereferenceable_or_null(30) i8* @malloc(i32 30)
%68 = call i32 @fread(i8* %5, i32 1, i32 1, i32* %0)
%69 = icmp eq i32 %68, 1
br i1 %69, label %70, label %79
70: ; preds = %66, %70
%71 = phi i64 [ %74, %70 ], [ 0, %66 ]
%72 = load i8, i8* %5
%73 = getelementptr inbounds i8, i8* %67, i64 %71
store i8 %72, i8* %73
%74 = add nuw nsw i64 %71, 1
%75 = call i32 @fread(i8* %5, i32 1, i32 1, i32* %0)
%76 = icmp ne i32 %75, 1
%77 = icmp ugt i64 %71, 29
%78 = select i1 %76, i1 true, i1 %77
br i1 %78, label %79, label %70
79: ; preds = %70, %66
%80 = tail call dereferenceable_or_null(30) i8* @malloc(i32 30)
%81 = call i32 @fread(i8* %6, i32 1, i32 1, i32* %1)
%82 = icmp eq i32 %81, 1
br i1 %82, label %83, label %92
83: ; preds = %79, %83
%84 = phi i64 [ %87, %83 ], [ 0, %79 ]
%85 = load i8, i8* %6
%86 = getelementptr inbounds i8, i8* %80, i64 %84
store i8 %85, i8* %86
%87 = add nuw nsw i64 %84, 1
%88 = call i32 @fread(i8* %6, i32 1, i32 1, i32* %1)
%89 = icmp ne i32 %88, 1
%90 = icmp ugt i64 %84, 29
%91 = select i1 %89, i1 true, i1 %90
br i1 %91, label %92, label %83
92: ; preds = %83, %79
%93 = tail call dereferenceable_or_null(30) i8* @malloc(i32 30)
%94 = bitcast i8* %80 to <16 x i8>*
%95 = load <16 x i8>, <16 x i8>* %94
%96 = bitcast i8* %67 to <16 x i8>*
%97 = load <16 x i8>, <16 x i8>* %96
%98 = sub <16 x i8> %95, %97
%99 = bitcast i8* %93 to <16 x i8>*
store <16 x i8> %98, <16 x i8>* %99
%100 = getelementptr inbounds i8, i8* %80, i64 16
%101 = bitcast i8* %100 to <8 x i8>*
%102 = load <8 x i8>, <8 x i8>* %101
%103 = getelementptr inbounds i8, i8* %67, i64 16
%104 = bitcast i8* %103 to <8 x i8>*
%105 = load <8 x i8>, <8 x i8>* %104
%106 = sub <8 x i8> %102, %105
%107 = getelementptr inbounds i8, i8* %93, i64 16
%108 = bitcast i8* %107 to <8 x i8>*
store <8 x i8> %106, <8 x i8>* %108
%109 = getelementptr inbounds i8, i8* %80, i64 24
%110 = load i8, i8* %109
%111 = getelementptr inbounds i8, i8* %67, i64 24
%112 = load i8, i8* %111
%113 = sub i8 %110, %112
%114 = getelementptr inbounds i8, i8* %93, i64 24
store i8 %113, i8* %114
%115 = getelementptr inbounds i8, i8* %80, i64 25
%116 = load i8, i8* %115
%117 = getelementptr inbounds i8, i8* %67, i64 25
%118 = load i8, i8* %117
%119 = sub i8 %116, %118
%120 = getelementptr inbounds i8, i8* %93, i64 25
store i8 %119, i8* %120
%121 = getelementptr inbounds i8, i8* %80, i64 26
%122 = load i8, i8* %121
%123 = getelementptr inbounds i8, i8* %67, i64 26
%124 = load i8, i8* %123
%125 = sub i8 %122, %124
%126 = getelementptr inbounds i8, i8* %93, i64 26
store i8 %125, i8* %126
%127 = getelementptr inbounds i8, i8* %80, i64 27
%128 = load i8, i8* %127
%129 = getelementptr inbounds i8, i8* %67, i64 27
%130 = load i8, i8* %129
%131 = sub i8 %128, %130
%132 = getelementptr inbounds i8, i8* %93, i64 27
store i8 %131, i8* %132
%133 = getelementptr inbounds i8, i8* %80, i64 28
%134 = load i8, i8* %133
%135 = getelementptr inbounds i8, i8* %67, i64 28
%136 = load i8, i8* %135
%137 = sub i8 %134, %136
%138 = getelementptr inbounds i8, i8* %93, i64 28
store i8 %137, i8* %138
%139 = getelementptr inbounds i8, i8* %80, i64 29
%140 = load i8, i8* %139
%141 = getelementptr inbounds i8, i8* %67, i64 29
%142 = load i8, i8* %141
%143 = sub i8 %140, %142
%144 = getelementptr inbounds i8, i8* %93, i64 29
store i8 %143, i8* %144
%145 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%146 = getelementptr inbounds i8, i8* %93, i64 1
%147 = load i8, i8* %93
br label %148
148: ; preds = %92, %162
%149 = phi i64 [ 1, %92 ], [ %163, %162 ]
%150 = getelementptr inbounds i8, i8* %93, i64 %149
%151 = load i8, i8* %150
%152 = icmp eq i8 %147, %151
br i1 %152, label %155, label %153
153: ; preds = %148
%154 = add nuw nsw i64 %149, 1
br label %162
155: ; preds = %148
%156 = load i8, i8* %146
%157 = add nuw nsw i64 %149, 1
%158 = getelementptr inbounds i8, i8* %93, i64 %157
%159 = load i8, i8* %158
%160 = icmp eq i8 %156, %159
br i1 %160, label %161, label %162
161: ; preds = %155
store i8 0, i8* %150
store i8 0, i8* %158
br label %162
162: ; preds = %153, %161, %155
%163 = phi i64 [ %154, %153 ], [ %157, %161 ], [ %157, %155 ]
%164 = icmp eq i64 %163, 30
br i1 %164, label %165, label %148
165: ; preds = %162, %175
%166 = phi i8 [ %173, %175 ], [ %147, %162 ]
%167 = phi i64 [ %171, %175 ], [ 0, %162 ]
%168 = zext i8 %166 to i32
%169 = icmp eq i8 %166, 0
br i1 %169, label %178, label %170
170: ; preds = %165
%171 = add nuw nsw i64 %167, 1
%172 = getelementptr inbounds i8, i8* %93, i64 %171
%173 = load i8, i8* %172
%174 = icmp eq i8 %173, 0
br i1 %174, label %178, label %175
175: ; preds = %170
%176 = tail call i32 @putchar(i32 %168)
%177 = icmp eq i64 %171, 30
br i1 %177, label %181, label %165
178: ; preds = %170, %165
%179 = zext i8 %166 to i32
%180 = tail call i32 @putchar(i32 %179)
br label %181
181: ; preds = %175, %178
%182 = tail call i32 @putchar(i32 10)
br label %183
183: ; preds = %4, %64, %181, %45
ret void
}