#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*/ message;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
char getchar();
scalar_t__ isalpha(char);
scalar_t__ iscntrl(char);
scalar_t__ isdigit(char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int strlen(char *);
char tolower(char);
int main() {
  char mode = 0;
  char keychar = 0;
  int key = 1;
  int delta = 0;
  char message[1024];
  int c, cn;
  while ((mode != 'e') && (mode != 'd') && (mode != 'b')) {
    if (mode)
      printf("Please type only 'E', 'D', or 'B' and press ENTER\n");
    printf("(E)ncode, (D)ecode, or (B)reak? ");
    mode = tolower(getchar());
    while (iscntrl(mode))
      mode = tolower(getchar());
  }
  if (mode != 'b') {
    printf("Input Key:\n What does A equal? ");
    keychar = tolower(getchar());
    while (!isalpha(keychar))
      keychar = tolower(getchar());
    getchar();
    key = keychar - 'a';
    printf("Shift incrament per character?\n"
           "(Input 0 for a normal shift cypher)? ");
    scanf("%d", &delta);
  }
  printf("\nType the message string:\n");
  do {
    fgets(message, sizeof(message), stdin);
  } while (!message[0] || message[0] == '\n');
  cn = strlen(message);
  for (; key < ((mode == 'b') ? 26 : (keychar - 'a' + 1)); key++) {
    printf("\n");
    if (mode == 'b')
      printf("Key: A = %c\n", 'A' + key);
    for (c = 0; c < cn; c++) {
      char l = message[c];
      if (isalpha(l)) {
        int pos = tolower(l) - 'a';
        if (tolower(l) == l)
          if (mode == 'd')
            putchar('a' + (26 + pos - (key + c * delta) % 26) % 26);
          else
            putchar('a' + (pos + key + c * delta) % 26);
        else if (mode == 'd')
          putchar('A' + (26 + pos - (key + c * delta) % 26) % 26);
        else
          putchar('A' + (pos + key + c * delta) % 26);
      } else if (isdigit(message[c])) {
        int num = l - '0';
        if (mode == 'd')
          putchar('0' + (20 + num - (key + c * delta) % 10) % 10);
        else
          putchar('0' + (num + key + c * delta) % 10);
      } else
        putchar(l);
    }
    printf("\n");
    if (mode == 'b') {
      printf("Does that look translated? (Y/N) ");
      if (tolower(getchar()) == 'y')
        break;
    }
  }
  printf("\nFarewell Super Sleuth.\n");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movb   $0x0,-0x6(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x65,%ecx
mov    %al,-0x425(%rbp)
je     1202 <main+0x62>
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x64,%ecx
mov    %al,-0x425(%rbp)
je     1202 <main+0x62>
movsbl -0x5(%rbp),%eax
cmp    $0x62,%eax
setne  %al
mov    %al,-0x425(%rbp)
mov    -0x425(%rbp),%al
test   $0x1,%al
jne    1215 <main+0x75>
jmp    127c <main+0xdc>
cmpb   $0x0,-0x5(%rbp)
je     122d <main+0x8d>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
movsbl %al,%edi
call   10a0 <tolower@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1050 <iscntrl@plt>
cmp    $0x0,%rax
je     1277 <main+0xd7>
mov    $0x0,%al
call   1090 <getchar@plt>
movsbl %al,%edi
call   10a0 <tolower@plt>
mov    %al,-0x5(%rbp)
jmp    124d <main+0xad>
jmp    11c8 <main+0x28>
movsbl -0x5(%rbp),%eax
cmp    $0x62,%eax
je     130e <main+0x16e>
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
movsbl %al,%edi
call   10a0 <tolower@plt>
mov    %al,-0x6(%rbp)
movsbl -0x6(%rbp),%edi
call   10b0 <isalpha@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12c8 <main+0x128>
jmp    12df <main+0x13f>
mov    $0x0,%al
call   1090 <getchar@plt>
movsbl %al,%edi
call   10a0 <tolower@plt>
mov    %al,-0x6(%rbp)
jmp    12a9 <main+0x109>
mov    $0x0,%al
call   1090 <getchar@plt>
movsbl -0x6(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0xc(%rbp)
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xdb4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10c0 <scanf@plt>
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    0x2cbe(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1080 <fgets@plt>
mov    $0x1,%al
cmpb   $0x0,-0x410(%rbp)
mov    %al,-0x426(%rbp)
je     135e <main+0x1be>
movsbl -0x410(%rbp),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x426(%rbp)
mov    -0x426(%rbp),%al
test   $0x1,%al
jne    131c <main+0x17c>
lea    -0x410(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x418(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x42c(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x62,%eax
jne    13a4 <main+0x204>
mov    $0x1a,%eax
mov    %eax,-0x430(%rbp)
jmp    13b4 <main+0x214>
movsbl -0x6(%rbp),%eax
sub    $0x61,%eax
add    $0x1,%eax
mov    %eax,-0x430(%rbp)
mov    -0x42c(%rbp),%eax
mov    -0x430(%rbp),%ecx
cmp    %ecx,%eax
jge    16bd <main+0x51d>
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x62,%eax
jne    13f7 <main+0x257>
mov    -0xc(%rbp),%esi
add    $0x41,%esi
lea    0xce7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x414(%rbp)
mov    -0x414(%rbp),%eax
cmp    -0x418(%rbp),%eax
jge    165c <main+0x4bc>
movslq -0x414(%rbp),%rax
mov    -0x410(%rbp,%rax,1),%al
mov    %al,-0x419(%rbp)
movsbl -0x419(%rbp),%edi
call   10b0 <isalpha@plt>
cmp    $0x0,%rax
je     1580 <main+0x3e0>
movsbl -0x419(%rbp),%edi
call   10a0 <tolower@plt>
movsbl %al,%eax
sub    $0x61,%eax
mov    %eax,-0x420(%rbp)
movsbl -0x419(%rbp),%edi
call   10a0 <tolower@plt>
movsbl %al,%eax
movsbl -0x419(%rbp),%ecx
cmp    %ecx,%eax
jne    14f7 <main+0x357>
movsbl -0x5(%rbp),%eax
cmp    $0x64,%eax
jne    14c8 <main+0x328>
mov    -0x420(%rbp),%eax
add    $0x1a,%eax
mov    %eax,-0x434(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x414(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    -0x434(%rbp),%eax
sub    %edx,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    14f2 <main+0x352>
mov    -0x420(%rbp),%eax
add    -0xc(%rbp),%eax
mov    -0x414(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    157b <main+0x3db>
movsbl -0x5(%rbp),%eax
cmp    $0x64,%eax
jne    154c <main+0x3ac>
mov    -0x420(%rbp),%eax
add    $0x1a,%eax
mov    %eax,-0x438(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x414(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    -0x438(%rbp),%eax
sub    %edx,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1576 <main+0x3d6>
mov    -0x420(%rbp),%eax
add    -0xc(%rbp),%eax
mov    -0x414(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    157b <main+0x3db>
jmp    1643 <main+0x4a3>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%edi
ff
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     1632 <main+0x492>
movsbl -0x419(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x424(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x64,%eax
jne    1603 <main+0x463>
mov    -0x424(%rbp),%eax
add    $0x14,%eax
mov    %eax,-0x43c(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x414(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x43c(%rbp),%eax
sub    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    162d <main+0x48d>
mov    -0x424(%rbp),%eax
add    -0xc(%rbp),%eax
mov    -0x414(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    163e <main+0x49e>
movsbl -0x419(%rbp),%edi
call   1030 <putchar@plt>
jmp    1643 <main+0x4a3>
jmp    1648 <main+0x4a8>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    1401 <main+0x261>
lea    0xaba(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x62,%eax
jne    16aa <main+0x50a>
lea    0xa66(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
movsbl %al,%edi
call   10a0 <tolower@plt>
movsbl %al,%eax
cmp    $0x79,%eax
jne    16a5 <main+0x505>
jmp    16bd <main+0x51d>
jmp    16aa <main+0x50a>
jmp    16af <main+0x50f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    137e <main+0x1de>
lea    0xa42(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
xor    %eax,%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
movl   $0x0,0x4(%rsp)
lea    0xe30(%rip),%rbp
lea    0xf13(%rip),%r14
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
test   %r13b,%r13b
je     11ff <main+0x4f>
lea    -0x64(%r13),%eax
cmp    $0x2,%al
jb     1231 <main+0x81>
cmp    $0x62,%r13b
je     1293 <main+0xe3>
mov    %r14,%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   10a0 <getchar@plt>
movsbl %al,%edi
call   10b0 <tolower@plt>
mov    %eax,%r13d
movsbl %al,%edi
call   1060 <iscntrl@plt>
test   %rax,%rax
jne    1210 <main+0x60>
jmp    11e0 <main+0x30>
lea    0xde9(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
nop
xor    %eax,%eax
call   10a0 <getchar@plt>
movsbl %al,%edi
call   10b0 <tolower@plt>
mov    %eax,%r14d
movsbl %al,%edi
call   10c0 <isalpha@plt>
test   %rax,%rax
je     1240 <main+0x90>
xor    %eax,%eax
call   10a0 <getchar@plt>
movsbl %r14b,%eax
add    $0xffffff9f,%eax
mov    %rax,0x8(%rsp)
lea    0xdc8(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xdff(%rip),%rdi
lea    0x4(%rsp),%rsi
call   10d0 <scanf@plt>
jmp    12a0 <main+0xf0>
mov    $0x1,%eax
mov    %rax,0x8(%rsp)
xor    %r14d,%r14d
lea    0xe11(%rip),%rdi
call   1050 <puts@plt>
mov    0x2d35(%rip),%rbx
lea    0x20(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edx
mov    %rbp,%rdi
mov    $0x400,%esi
call   1090 <fgets@plt>
movzbl 0x20(%rsp),%eax
test   %al,%al
je     12c0 <main+0x110>
cmp    $0xa,%al
je     12c0 <main+0x110>
lea    0x20(%rsp),%rdi
call   1070 <strlen@plt>
mov    %eax,0x18(%rsp)
movsbl %r14b,%eax
add    $0xffffffa0,%eax
cmp    $0x62,%r13b
mov    $0x1a,%ecx
cmovne %eax,%ecx
mov    %ecx,0x14(%rsp)
cmp    %ecx,0x8(%rsp)
jge    15d9 <main+0x429>
mov    0x18(%rsp),%r15d
jmp    1337 <main+0x187>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x8(%rsp)
cmp    0x14(%rsp),%eax
jge    15d9 <main+0x429>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x62,%r13b
jne    135d <main+0x1ad>
mov    0x8(%rsp),%rax
lea    0x41(%rax),%esi
lea    0xd33(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmpl   $0x0,0x18(%rsp)
jle    15a0 <main+0x3f0>
mov    0x8(%rsp),%rax
add    $0xffffffd0,%eax
mov    %eax,0x1c(%rsp)
xor    %r14d,%r14d
jmp    13c3 <main+0x213>
add    0x8(%rsp),%ebx
mov    0x4(%rsp),%eax
imul   %r14d,%eax
add    %ebx,%eax
movslq %eax,%r12
imul   $0x4ec4ec4f,%r12,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x23,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rcx,%rcx,4),%ecx
add    %eax,%ecx
sub    %ecx,%r12d
add    $0x61,%r12b
movsbl %r12b,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
cmp    %r14,%r15
je     15a0 <main+0x3f0>
movzbl 0x20(%rsp,%r14,1),%r12d
movsbl %r12b,%ebp
mov    %ebp,%edi
call   10c0 <isalpha@plt>
test   %rax,%rax
je     1460 <main+0x2b0>
mov    %ebp,%edi
call   10b0 <tolower@plt>
movsbl %al,%r12d
lea    -0x61(%r12),%ebx
mov    %ebp,%edi
call   10b0 <tolower@plt>
cmp    %bpl,%al
jne    14d0 <main+0x320>
cmp    $0x64,%r13b
jne    1379 <main+0x1c9>
mov    0x4(%rsp),%eax
imul   %r14d,%eax
add    0x8(%rsp),%eax
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %eax,%edx
add    %edx,%r12d
add    $0xffb9,%r12d
movswl %r12w,%eax
imul   $0x4ec5,%eax,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
shr    $0x13,%eax
add    %ecx,%eax
jmp    139e <main+0x1ee>
cs nopw 0x0(%rax,%rax,1)
movsbl 0x20(%rsp,%r14,1),%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     13ad <main+0x1fd>
cmp    $0x64,%r13b
jne    155b <main+0x3ab>
mov    0x4(%rsp),%eax
imul   %r14d,%eax
add    0x8(%rsp),%eax
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %eax,%ecx
lea    (%rcx,%rbp,1),%r12d
add    $0xffe4,%r12d
movswl %r12w,%eax
imul   $0x6667,%eax,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
shr    $0x12,%eax
add    %ecx,%eax
jmp    1580 <main+0x3d0>
nopl   0x0(%rax,%rax,1)
cmp    $0x64,%r13b
jne    1522 <main+0x372>
mov    0x4(%rsp),%eax
imul   %r14d,%eax
add    0x8(%rsp),%eax
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %eax,%edx
add    %edx,%r12d
add    $0xffb9,%r12d
movswl %r12w,%eax
imul   $0x4ec5,%eax,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
shr    $0x13,%eax
add    %ecx,%eax
jmp    1547 <main+0x397>
add    0x8(%rsp),%ebx
mov    0x4(%rsp),%eax
imul   %r14d,%eax
add    %ebx,%eax
movslq %eax,%r12
imul   $0x4ec4ec4f,%r12,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x23,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rcx,%rcx,4),%ecx
add    %eax,%ecx
sub    %ecx,%r12d
add    $0x41,%r12b
jmp    13ad <main+0x1fd>
mov    0x4(%rsp),%eax
imul   %r14d,%eax
add    0x1c(%rsp),%ebp
add    %eax,%ebp
movslq %ebp,%r12
imul   $0x66666667,%r12,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r12d
add    $0x30,%r12b
jmp    13ad <main+0x1fd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x62,%r13b
jne    1320 <main+0x170>
lea    0xadb(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
call   10a0 <getchar@plt>
movsbl %al,%edi
call   10b0 <tolower@plt>
cmp    $0x79,%al
jne    1320 <main+0x170>
lea    0xaf2(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10a0 <getchar@plt>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Please type only 'E', 'D', or 'B' and press ENTER\0A\00"
@.str.1 = [33 x i8] c"(E)ncode, (D)ecode, or (B)reak? \00"
@.str.2 = [32 x i8] c"Input Key:\0A What does A equal? \00"
@.str.3 = [69 x i8] c"Shift incrament per character?\0A(Input 0 for a normal shift cypher)? \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [27 x i8] c"\0AType the message string:\0A\00"
@stdin = global i32 0
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [13 x i8] c"Key: A = %c\0A\00"
@.str.8 = [34 x i8] c"Does that look translated? (Y/N) \00"
@.str.9 = [25 x i8] c"\0AFarewell Super Sleuth.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1024 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
store i8 0, i8* %2
store i8 0, i8* %3
store i32 1, i32* %4
store i32 0, i32* %5
br label %12
12: ; preds = %42, %0
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 101
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 100
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 98
br label %24
24: ; preds = %20, %16, %12
%25 = phi i1 [ false, %16 ], [ false, %12 ], [ %23, %20 ]
br i1 %25, label %26, label %43
26: ; preds = %24
%27 = load i8, i8* %2
%28 = icmp ne i8 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%33 = call signext i8 (...) @getchar()
%34 = call signext i8 @tolower(i8 signext %33)
store i8 %34, i8* %2
br label %35
35: ; preds = %39, %31
%36 = load i8, i8* %2
%37 = call i64 @iscntrl(i8 signext %36)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = call signext i8 (...) @getchar()
%41 = call signext i8 @tolower(i8 signext %40)
store i8 %41, i8* %2
br label %35
42: ; preds = %35
br label %12
43: ; preds = %24
%44 = load i8, i8* %2
%45 = sext i8 %44 to i32
%46 = icmp ne i32 %45, 98
br i1 %46, label %47, label %66
47: ; preds = %43
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%49 = call signext i8 (...) @getchar()
%50 = call signext i8 @tolower(i8 signext %49)
store i8 %50, i8* %3
br label %51
51: ; preds = %56, %47
%52 = load i8, i8* %3
%53 = call i64 @isalpha(i8 signext %52)
%54 = icmp ne i64 %53, 0
%55 = xor i1 %54, true
br i1 %55, label %56, label %59
56: ; preds = %51
%57 = call signext i8 (...) @getchar()
%58 = call signext i8 @tolower(i8 signext %57)
store i8 %58, i8* %3
br label %51
59: ; preds = %51
%60 = call signext i8 (...) @getchar()
%61 = load i8, i8* %3
%62 = sext i8 %61 to i32
%63 = sub nsw i32 %62, 97
store i32 %63, i32* %4
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0))
%65 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
br label %66
66: ; preds = %59, %43
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %68
68: ; preds = %81, %66
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%70 = load i32, i32* @stdin
%71 = call i32 @fgets(i8* %69, i32 1024, i32 %70)
br label %72
72: ; preds = %68
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%74 = load i8, i8* %73
%75 = icmp ne i8 %74, 0
br i1 %75, label %76, label %81
76: ; preds = %72
%77 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = icmp eq i32 %79, 10
br label %81
81: ; preds = %76, %72
%82 = phi i1 [ true, %72 ], [ %80, %76 ]
br i1 %82, label %68, label %83
83: ; preds = %81
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%85 = call i32 @strlen(i8* %84)
store i32 %85, i32* %8
br label %86
86: ; preds = %259, %83
%87 = load i32, i32* %4
%88 = load i8, i8* %2
%89 = sext i8 %88 to i32
%90 = icmp eq i32 %89, 98
br i1 %90, label %91, label %92
91: ; preds = %86
br label %97
92: ; preds = %86
%93 = load i8, i8* %3
%94 = sext i8 %93 to i32
%95 = sub nsw i32 %94, 97
%96 = add nsw i32 %95, 1
br label %97
97: ; preds = %92, %91
%98 = phi i32 [ 26, %91 ], [ %96, %92 ]
%99 = icmp slt i32 %87, %98
br i1 %99, label %100, label %262
100: ; preds = %97
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%102 = load i8, i8* %2
%103 = sext i8 %102 to i32
%104 = icmp eq i32 %103, 98
br i1 %104, label %105, label %109
105: ; preds = %100
%106 = load i32, i32* %4
%107 = add nsw i32 65, %106
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %107)
br label %109
109: ; preds = %105, %100
store i32 0, i32* %7
br label %110
110: ; preds = %242, %109
%111 = load i32, i32* %7
%112 = load i32, i32* %8
%113 = icmp slt i32 %111, %112
br i1 %113, label %114, label %245
114: ; preds = %110
%115 = load i32, i32* %7
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %116
%118 = load i8, i8* %117
store i8 %118, i8* %9
%119 = load i8, i8* %9
%120 = call i64 @isalpha(i8 signext %119)
%121 = icmp ne i64 %120, 0
br i1 %121, label %122, label %196
122: ; preds = %114
%123 = load i8, i8* %9
%124 = call signext i8 @tolower(i8 signext %123)
%125 = sext i8 %124 to i32
%126 = sub nsw i32 %125, 97
store i32 %126, i32* %10
%127 = load i8, i8* %9
%128 = call signext i8 @tolower(i8 signext %127)
%129 = sext i8 %128 to i32
%130 = load i8, i8* %9
%131 = sext i8 %130 to i32
%132 = icmp eq i32 %129, %131
br i1 %132, label %133, label %164
133: ; preds = %122
%134 = load i8, i8* %2
%135 = sext i8 %134 to i32
%136 = icmp eq i32 %135, 100
br i1 %136, label %137, label %151
137: ; preds = %133
%138 = load i32, i32* %10
%139 = add nsw i32 26, %138
%140 = load i32, i32* %4
%141 = load i32, i32* %7
%142 = load i32, i32* %5
%143 = mul nsw i32 %141, %142
%144 = add nsw i32 %140, %143
%145 = srem i32 %144, 26
%146 = sub nsw i32 %139, %145
%147 = srem i32 %146, 26
%148 = add nsw i32 97, %147
%149 = trunc i32 %148 to i8
%150 = call i32 @putchar(i8 signext %149)
br label %163
151: ; preds = %133
%152 = load i32, i32* %10
%153 = load i32, i32* %4
%154 = add nsw i32 %152, %153
%155 = load i32, i32* %7
%156 = load i32, i32* %5
%157 = mul nsw i32 %155, %156
%158 = add nsw i32 %154, %157
%159 = srem i32 %158, 26
%160 = add nsw i32 97, %159
%161 = trunc i32 %160 to i8
%162 = call i32 @putchar(i8 signext %161)
br label %163
163: ; preds = %151, %137
br label %195
164: ; preds = %122
%165 = load i8, i8* %2
%166 = sext i8 %165 to i32
%167 = icmp eq i32 %166, 100
br i1 %167, label %168, label %182
168: ; preds = %164
%169 = load i32, i32* %10
%170 = add nsw i32 26, %169
%171 = load i32, i32* %4
%172 = load i32, i32* %7
%173 = load i32, i32* %5
%174 = mul nsw i32 %172, %173
%175 = add nsw i32 %171, %174
%176 = srem i32 %175, 26
%177 = sub nsw i32 %170, %176
%178 = srem i32 %177, 26
%179 = add nsw i32 65, %178
%180 = trunc i32 %179 to i8
%181 = call i32 @putchar(i8 signext %180)
br label %194
182: ; preds = %164
%183 = load i32, i32* %10
%184 = load i32, i32* %4
%185 = add nsw i32 %183, %184
%186 = load i32, i32* %7
%187 = load i32, i32* %5
%188 = mul nsw i32 %186, %187
%189 = add nsw i32 %185, %188
%190 = srem i32 %189, 26
%191 = add nsw i32 65, %190
%192 = trunc i32 %191 to i8
%193 = call i32 @putchar(i8 signext %192)
br label %194
194: ; preds = %182, %168
br label %195
195: ; preds = %194, %163
br label %241
196: ; preds = %114
%197 = load i32, i32* %7
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %198
%200 = load i8, i8* %199
%201 = call i64 @isdigit(i8 signext %200)
%202 = icmp ne i64 %201, 0
br i1 %202, label %203, label %237
203: ; preds = %196
%204 = load i8, i8* %9
%205 = sext i8 %204 to i32
%206 = sub nsw i32 %205, 48
store i32 %206, i32* %11
%207 = load i8, i8* %2
%208 = sext i8 %207 to i32
%209 = icmp eq i32 %208, 100
br i1 %209, label %210, label %224
210: ; preds = %203
%211 = load i32, i32* %11
%212 = add nsw i32 20, %211
%213 = load i32, i32* %4
%214 = load i32, i32* %7
%215 = load i32, i32* %5
%216 = mul nsw i32 %214, %215
%217 = add nsw i32 %213, %216
%218 = srem i32 %217, 10
%219 = sub nsw i32 %212, %218
%220 = srem i32 %219, 10
%221 = add nsw i32 48, %220
%222 = trunc i32 %221 to i8
%223 = call i32 @putchar(i8 signext %222)
br label %236
224: ; preds = %203
%225 = load i32, i32* %11
%226 = load i32, i32* %4
%227 = add nsw i32 %225, %226
%228 = load i32, i32* %7
%229 = load i32, i32* %5
%230 = mul nsw i32 %228, %229
%231 = add nsw i32 %227, %230
%232 = srem i32 %231, 10
%233 = add nsw i32 48, %232
%234 = trunc i32 %233 to i8
%235 = call i32 @putchar(i8 signext %234)
br label %236
236: ; preds = %224, %210
br label %240
237: ; preds = %196
%238 = load i8, i8* %9
%239 = call i32 @putchar(i8 signext %238)
br label %240
240: ; preds = %237, %236
br label %241
241: ; preds = %240, %195
br label %242
242: ; preds = %241
%243 = load i32, i32* %7
%244 = add nsw i32 %243, 1
store i32 %244, i32* %7
br label %110
245: ; preds = %110
%246 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%247 = load i8, i8* %2
%248 = sext i8 %247 to i32
%249 = icmp eq i32 %248, 98
br i1 %249, label %250, label %258
250: ; preds = %245
%251 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%252 = call signext i8 (...) @getchar()
%253 = call signext i8 @tolower(i8 signext %252)
%254 = sext i8 %253 to i32
%255 = icmp eq i32 %254, 121
br i1 %255, label %256, label %257
256: ; preds = %250
br label %262
257: ; preds = %250
br label %258
258: ; preds = %257, %245
br label %259
259: ; preds = %258
%260 = load i32, i32* %4
%261 = add nsw i32 %260, 1
store i32 %261, i32* %4
br label %86
262: ; preds = %256, %97
%263 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%264 = call signext i8 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [33 x i8] c"(E)ncode, (D)ecode, or (B)reak? \00"
@.str.2 = [32 x i8] c"Input Key:\0A What does A equal? \00"
@.str.3 = [69 x i8] c"Shift incrament per character?\0A(Input 0 for a normal shift cypher)? \00"
@.str.4 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.7 = [13 x i8] c"Key: A = %c\0A\00"
@.str.8 = [34 x i8] c"Does that look translated? (Y/N) \00"
@str = [26 x i8] c"\0AType the message string:\00"
@str.10 = [24 x i8] c"\0AFarewell Super Sleuth.\00"
@str.11 = [50 x i8] c"Please type only 'E', 'D', or 'B' and press ENTER\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %15, %0
%6 = phi i8 [ 0, %0 ], [ %16, %15 ]
switch i8 %6, label %7 [
i8 0, label %9
i8 98, label %40
i8 100, label %22
i8 101, label %22
]
7: ; preds = %5
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.11, i64 0, i64 0))
br label %9
9: ; preds = %5, %7
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call signext i8 (...) @getchar()
%12 = tail call signext i8 @tolower(i8 signext %11)
%13 = tail call i64 @iscntrl(i8 signext %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %17, %9
%16 = phi i8 [ %12, %9 ], [ %19, %17 ]
br label %5
17: ; preds = %9, %17
%18 = tail call signext i8 (...) @getchar()
%19 = tail call signext i8 @tolower(i8 signext %18)
%20 = tail call i64 @iscntrl(i8 signext %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %15, label %17
22: ; preds = %5, %5
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%24 = tail call signext i8 (...) @getchar()
%25 = tail call signext i8 @tolower(i8 signext %24)
%26 = tail call i64 @isalpha(i8 signext %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %22, %28
%29 = tail call signext i8 (...) @getchar()
%30 = tail call signext i8 @tolower(i8 signext %29)
%31 = tail call i64 @isalpha(i8 signext %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %28, label %33
33: ; preds = %28, %22
%34 = phi i8 [ %25, %22 ], [ %30, %28 ]
%35 = tail call signext i8 (...) @getchar()
%36 = sext i8 %34 to i32
%37 = add nsw i32 %36, -97
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0))
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
br label %40
40: ; preds = %5, %33
%41 = phi i32 [ %37, %33 ], [ 1, %5 ]
%42 = phi i8 [ %34, %33 ], [ 0, %5 ]
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %44
44: ; preds = %48, %40
%45 = load i32, i32* @stdin
%46 = call i32 @fgets(i8* %4, i32 1024, i32 %45)
%47 = load i8, i8* %4
switch i8 %47, label %49 [
i8 10, label %48
i8 0, label %48
]
48: ; preds = %44, %44
br label %44
49: ; preds = %44
%50 = call i32 @strlen(i8* %4)
%51 = icmp eq i8 %6, 98
%52 = sext i8 %42 to i32
%53 = add nsw i32 %52, -96
%54 = select i1 %51, i32 26, i32 %53
%55 = icmp slt i32 %41, %54
br i1 %55, label %56, label %172
56: ; preds = %49
%57 = icmp sgt i32 %50, 0
%58 = icmp eq i8 %6, 100
%59 = zext i32 %50 to i64
br label %60
60: ; preds = %170, %56
%61 = phi i32 [ %41, %56 ], [ %171, %170 ]
%62 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
br i1 %51, label %63, label %66
63: ; preds = %60
%64 = add nsw i32 %61, 65
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %64)
br label %66
66: ; preds = %63, %60
br i1 %57, label %67, label %157
67: ; preds = %66
%68 = add i32 %61, -48
br label %69
69: ; preds = %67, %152
%70 = phi i64 [ 0, %67 ], [ %155, %152 ]
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = call i64 @isalpha(i8 signext %72)
%74 = icmp eq i64 %73, 0
br i1 %74, label %125, label %75
75: ; preds = %69
%76 = call signext i8 @tolower(i8 signext %72)
%77 = sext i8 %76 to i32
%78 = add nsw i32 %77, -97
%79 = call signext i8 @tolower(i8 signext %72)
%80 = icmp eq i8 %79, %72
br i1 %80, label %81, label %103
81: ; preds = %75
br i1 %58, label %82, label %94
82: ; preds = %81
%83 = add nsw i32 %77, 65465
%84 = load i32, i32* %1
%85 = trunc i64 %70 to i32
%86 = mul nsw i32 %84, %85
%87 = add nsw i32 %86, %61
%88 = srem i32 %87, 26
%89 = sub nsw i32 %83, %88
%90 = trunc i32 %89 to i16
%91 = srem i16 %90, 26
%92 = trunc i16 %91 to i8
%93 = add nsw i8 %92, 97
br label %152
94: ; preds = %81
%95 = add nsw i32 %78, %61
%96 = load i32, i32* %1
%97 = trunc i64 %70 to i32
%98 = mul nsw i32 %96, %97
%99 = add nsw i32 %95, %98
%100 = srem i32 %99, 26
%101 = trunc i32 %100 to i8
%102 = add nsw i8 %101, 97
br label %152
103: ; preds = %75
br i1 %58, label %104, label %116
104: ; preds = %103
%105 = add nsw i32 %77, 65465
%106 = load i32, i32* %1
%107 = trunc i64 %70 to i32
%108 = mul nsw i32 %106, %107
%109 = add nsw i32 %108, %61
%110 = srem i32 %109, 26
%111 = sub nsw i32 %105, %110
%112 = trunc i32 %111 to i16
%113 = srem i16 %112, 26
%114 = trunc i16 %113 to i8
%115 = add nsw i8 %114, 65
br label %152
116: ; preds = %103
%117 = add nsw i32 %78, %61
%118 = load i32, i32* %1
%119 = trunc i64 %70 to i32
%120 = mul nsw i32 %118, %119
%121 = add nsw i32 %117, %120
%122 = srem i32 %121, 26
%123 = trunc i32 %122 to i8
%124 = add nsw i8 %123, 65
br label %152
125: ; preds = %69
%126 = load i8, i8* %71
%127 = call i64 @isdigit(i8 signext %126)
%128 = icmp eq i64 %127, 0
br i1 %128, label %152, label %129
129: ; preds = %125
%130 = sext i8 %72 to i32
br i1 %58, label %131, label %143
131: ; preds = %129
%132 = add nsw i32 %130, 65508
%133 = load i32, i32* %1
%134 = trunc i64 %70 to i32
%135 = mul nsw i32 %133, %134
%136 = add nsw i32 %135, %61
%137 = srem i32 %136, 10
%138 = sub nsw i32 %132, %137
%139 = trunc i32 %138 to i16
%140 = srem i16 %139, 10
%141 = trunc i16 %140 to i8
%142 = add nsw i8 %141, 48
br label %152
143: ; preds = %129
%144 = load i32, i32* %1
%145 = trunc i64 %70 to i32
%146 = mul nsw i32 %144, %145
%147 = add i32 %68, %130
%148 = add i32 %147, %146
%149 = srem i32 %148, 10
%150 = trunc i32 %149 to i8
%151 = add nsw i8 %150, 48
br label %152
152: ; preds = %125, %131, %143, %94, %82, %116, %104
%153 = phi i8 [ %142, %131 ], [ %151, %143 ], [ %102, %94 ], [ %93, %82 ], [ %124, %116 ], [ %115, %104 ], [ %72, %125 ]
%154 = call i32 @putchar(i8 signext %153)
%155 = add nuw nsw i64 %70, 1
%156 = icmp eq i64 %155, %59
br i1 %156, label %157, label %69
157: ; preds = %152, %66
%158 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
br i1 %51, label %159, label %167
159: ; preds = %157
%160 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%161 = call signext i8 (...) @getchar()
%162 = call signext i8 @tolower(i8 signext %161)
%163 = icmp ne i8 %162, 121
%164 = add nsw i32 %61, 1
%165 = icmp slt i32 %164, %54
%166 = select i1 %163, i1 %165, i1 false
br i1 %166, label %170, label %172
167: ; preds = %157
%168 = add nsw i32 %61, 1
%169 = icmp slt i32 %168, %54
br i1 %169, label %170, label %172
170: ; preds = %167, %159
%171 = phi i32 [ %168, %167 ], [ %164, %159 ]
br label %60
172: ; preds = %167, %159, %49
%173 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.10, i64 0, i64 0))
%174 = call signext i8 (...) @getchar()
ret i32 0
}