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

/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
double playfairCrack(char *, int, char *);
int /*<<< orphan*/ playfairDecipher(char *, char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ srand(unsigned int);
int strlen(char *);
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  char cipher[] =
      "XZOGQRWVQWNROKCOAELBXZWGEQYLGDRZXYZRQAEKLRHDUMNUXYXSXYEMXEHDGNXZYNTZONYE"
      "LBEUGYSCOREUSWTZRLRYBYCOLZYLEMWNSXFBUSDBORBZCYLQEDMHQRWVQWAEDPGDPOYHORXZ"
      "INNYWPXZGROKCOLCCOCYTZUEUIICERLEVHMVQWLNWPRYXHGNMLEKLRHDUYSUCYRAWPUYECRY"
      "RYXHGNBLUYSCCOUYOHRYUMNUXYXSXYEMXEHDGN";
  int i, len = strlen(cipher);
  char *out = malloc(sizeof(char) * (len + 1));
  srand((unsigned)time(NULL));
  printf("Running playfaircrack, this could take a few minutes...\n");
  char key[] = "ABCDEFGHIKLMNOPQRSTUVWXYZ";
  double score, maxscore = -99e99;
  if (len % 2 != 0)
    printf("Warning: cipher length is odd, not possible with playfair, "
           "continuing anyway (len %d)\n",
           len);
  for (i = 0; i < len; i += 2) {
    if (cipher[i] == cipher[i + 1])
      printf("Warning: found two consecutive identical letters, not possible "
             "with playfair, continuing anyway (pos %d: %c, %c)\n",
             i, cipher[i], cipher[i + 1]);
    if (cipher[i] == 'J' || cipher[i + 1] == 'J')
      printf(
          "Warning: found letter J, not possible with this implementation, "
          "consider modifying 'key' variable to include 'J' (you will have to "
          "remove some other character), continuing anyway (pos %d: '%c%c')\n",
          i, cipher[i], cipher[i + 1]);
    if (cipher[i] < 'A' || cipher[i] > 'Z')
      printf("Warning: found non-uppercase letter, please remove, continuing "
             "anyway (pos %d: '%c')\n",
             i, cipher[i]);
    if (cipher[i + 1] < 'A' || cipher[i + 1] > 'Z')
      printf("Warning: found non-uppercase letter, please remove, continuing "
             "anyway (pos %d: '%c')\n",
             i + 1, cipher[i + 1]);
  }
  for (i = 0;; i++) {
    score = playfairCrack(cipher, len, key);
    if (score > maxscore) {
      maxscore = score;
      printf("best score so far: %f, on iteration %d\n", score, i);
      printf("    Key: '%s'\n", key);
      playfairDecipher(key, cipher, out, len);
      printf("    plaintext: '%s'\n", out);
    }
  }
  free(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe69(%rip),%rsi
mov    $0xff,%edx
call   1080 <memcpy@plt>
lea    -0x110(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x118(%rbp)
mov    -0x118(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x120(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
lea    0xf33(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0xf0b(%rip),%rax
mov    %rax,-0x140(%rbp)
mov    0xf05(%rip),%rax
mov    %rax,-0x138(%rbp)
mov    0xeff(%rip),%rax
mov    %rax,-0x130(%rbp)
mov    0xef9(%rip),%ax
mov    %ax,-0x128(%rbp)
movsd  0xdc2(%rip),%xmm0
movsd  %xmm0,-0x150(%rbp)
ff
mov    -0x118(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1271 <main+0xf1>
mov    -0x118(%rbp),%esi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x114(%rbp)
mov    -0x114(%rbp),%eax
cmp    -0x118(%rbp),%eax
jge    1426 <main+0x2a6>
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
mov    -0x114(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x110(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    12ee <main+0x16e>
mov    -0x114(%rbp),%esi
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%edx
ff
mov    -0x114(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%ecx
ff
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x4a,%eax
je     1322 <main+0x1a2>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x4a,%eax
jne    1358 <main+0x1d8>
mov    -0x114(%rbp),%esi
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%edx
ff
mov    -0x114(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%ecx
ff
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x41,%eax
jl     1388 <main+0x208>
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x5a,%eax
jle    13ab <main+0x22b>
mov    -0x114(%rbp),%esi
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%edx
ff
lea    0xf4d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x41,%eax
jl     13e3 <main+0x263>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x5a,%eax
jle    140d <main+0x28d>
mov    -0x114(%rbp),%esi
add    $0x1,%esi
mov    -0x114(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%edx
ff
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1412 <main+0x292>
mov    -0x114(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x114(%rbp)
jmp    127b <main+0xfb>
movl   $0x0,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x118(%rbp),%esi
lea    -0x140(%rbp),%rdx
call   1030 <playfairCrack@plt>
movsd  %xmm0,-0x148(%rbp)
ff
movsd  -0x148(%rbp),%xmm0
ff
ucomisd -0x150(%rbp),%xmm0
ff
jbe    14dd <main+0x35d>
movsd  -0x148(%rbp),%xmm0
ff
movsd  %xmm0,-0x150(%rbp)
ff
movsd  -0x148(%rbp),%xmm0
ff
mov    -0x114(%rbp),%esi
lea    0xebb(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    -0x140(%rbp),%rsi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x140(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    -0x120(%rbp),%rdx
mov    -0x118(%rbp),%ecx
call   1050 <playfairDecipher@plt>
mov    -0x120(%rbp),%rsi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14e2 <main+0x362>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1430 <main+0x2b0>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
lea    0xe68(%rip),%rsi
lea    0x30(%rsp),%rbx
mov    $0xff,%edx
mov    %rbx,%rdi
call   1090 <memcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%r15d
lea    0x1(%r15),%edi
call   10b0 <malloc@plt>
mov    %rax,%r14
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
lea    0x1174(%rip),%rdi
call   1030 <puts@plt>
movups 0xf28(%rip),%xmm0
movups %xmm0,0x1a(%rsp)
movaps 0xf12(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
test   $0x1,%r15b
je     121a <main+0x8a>
lea    0xf1a(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
test   %r15d,%r15d
jle    12c6 <main+0x136>
lea    0xf57(%rip),%rbx
lea    0xfc2(%rip),%r12
lea    0x1080(%rip),%r13
xor    %ebp,%ebp
jmp    1249 <main+0xb9>
nopl   0x0(%rax)
add    $0x2,%rbp
cmp    %ebp,%r15d
jle    12c6 <main+0x136>
movzbl 0x30(%rsp,%rbp,1),%eax
cmp    0x31(%rsp,%rbp,1),%al
jne    126a <main+0xda>
movsbl %al,%ecx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1070 <printf@plt>
movzbl 0x30(%rsp,%rbp,1),%eax
movzbl 0x31(%rsp,%rbp,1),%ecx
cmp    $0x4a,%al
je     127a <main+0xea>
cmp    $0x4a,%cl
mov    $0x4a,%cl
jne    1291 <main+0x101>
movsbl %al,%edx
movsbl %cl,%ecx
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
movzbl 0x30(%rsp,%rbp,1),%eax
lea    -0x5b(%rax),%ecx
cmp    $0xe5,%cl
ja     12a8 <main+0x118>
movsbl %al,%edx
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
movsbl 0x31(%rsp,%rbp,1),%edx
lea    -0x5b(%rdx),%eax
cmp    $0xe5,%al
ja     1240 <main+0xb0>
lea    0x1(%rbp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1240 <main+0xb0>
movsd  0xd32(%rip),%xmm0
movsd  %xmm0,(%rsp)
lea    0x30(%rsp),%rbp
lea    0x10(%rsp),%rbx
lea    0x1061(%rip),%r12
xor    %r13d,%r13d
jmp    12f4 <main+0x164>
nopl   0x0(%rax)
add    $0x1,%r13d
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
call   1040 <playfairCrack@plt>
ucomisd (%rsp),%xmm0
jbe    12f0 <main+0x160>
lea    0xffe(%rip),%rdi
movsd  %xmm0,0x8(%rsp)
mov    %r13d,%esi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0x100f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    %r15d,%ecx
call   1060 <playfairDecipher@plt>
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
jmp    12f0 <main+0x160>

LLVM IR (-O0):
@__const.main.cipher = [255 x i8] c"XZOGQRWVQWNROKCOAELBXZWGEQYLGDRZXYZRQAEKLRHDUMNUXYXSXYEMXEHDGNXZYNTZONYELBEUGYSCOREUSWTZRLRYBYCOLZYLEMWNSXFBUSDBORBZCYLQEDMHQRWVQWAEDPGDPOYHORXZINNYWPXZGROKCOLCCOCYTZUEUIICERLEVHMVQWLNWPRYXHGNMLEKLRHDUYSUCYRAWPUYECRYRYXHGNBLUYSCCOUYOHRYUMNUXYXSXYEMXEHDGN\00"
@.str = [57 x i8] c"Running playfaircrack, this could take a few minutes...\0A\00"
@__const.main.key = [26 x i8] c"ABCDEFGHIKLMNOPQRSTUVWXYZ\00"
@.str.1 = [87 x i8] c"Warning: cipher length is odd, not possible with playfair, continuing anyway (len %d)\0A\00"
@.str.2 = [114 x i8] c"Warning: found two consecutive identical letters, not possible with playfair, continuing anyway (pos %d: %c, %c)\0A\00"
@.str.3 = [197 x i8] c"Warning: found letter J, not possible with this implementation, consider modifying 'key' variable to include 'J' (you will have to remove some other character), continuing anyway (pos %d: '%c%c')\0A\00"
@.str.4 = [86 x i8] c"Warning: found non-uppercase letter, please remove, continuing anyway (pos %d: '%c')\0A\00"
@.str.5 = [40 x i8] c"best score so far: %f, on iteration %d\0A\00"
@.str.6 = [15 x i8] c" Key: '%s'\0A\00"
@.str.7 = [21 x i8] c" plaintext: '%s'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [255 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca [26 x i8]
%11 = alloca double
%12 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [255 x i8]* %6 to i8*
%14 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = add nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = mul i64 1, %18
%20 = trunc i64 %19 to i32
%21 = call i8* @malloc(i32 %20)
store i8* %21, i8** %9
%22 = call i64 @time(i32* null)
%23 = trunc i64 %22 to i32
%24 = call i32 @srand(i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%26 = bitcast [26 x i8]* %10 to i8*
store double -9.900000e+100, double* %12
%27 = load i32, i32* %8
%28 = srem i32 %27, 2
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %2
%31 = load i32, i32* %8
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.1, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %30, %2
store i32 0, i32* %7
br label %34
34: ; preds = %143, %33
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %146
38: ; preds = %34
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %43, %49
br i1 %50, label %51, label %65
51: ; preds = %38
%52 = load i32, i32* %7
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.2, i64 0, i64 0), i32 %52, i32 %57, i32 %63)
br label %65
65: ; preds = %51, %38
%66 = load i32, i32* %7
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 74
br i1 %71, label %80, label %72
72: ; preds = %65
%73 = load i32, i32* %7
%74 = add nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %75
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 74
br i1 %79, label %80, label %94
80: ; preds = %72, %65
%81 = load i32, i32* %7
%82 = load i32, i32* %7
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = load i32, i32* %7
%88 = add nsw i32 %87, 1
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.3, i64 0, i64 0), i32 %81, i32 %86, i32 %92)
br label %94
94: ; preds = %80, %72
%95 = load i32, i32* %7
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %96
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = icmp slt i32 %99, 65
br i1 %100, label %108, label %101
101: ; preds = %94
%102 = load i32, i32* %7
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %103
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = icmp sgt i32 %106, 90
br i1 %107, label %108, label %116
108: ; preds = %101, %94
%109 = load i32, i32* %7
%110 = load i32, i32* %7
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %111
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.4, i64 0, i64 0), i32 %109, i32 %114)
br label %116
116: ; preds = %108, %101
%117 = load i32, i32* %7
%118 = add nsw i32 %117, 1
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %119
%121 = load i8, i8* %120
%122 = sext i8 %121 to i32
%123 = icmp slt i32 %122, 65
br i1 %123, label %132, label %124
124: ; preds = %116
%125 = load i32, i32* %7
%126 = add nsw i32 %125, 1
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %127
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp sgt i32 %130, 90
br i1 %131, label %132, label %142
132: ; preds = %124, %116
%133 = load i32, i32* %7
%134 = add nsw i32 %133, 1
%135 = load i32, i32* %7
%136 = add nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %137
%139 = load i8, i8* %138
%140 = sext i8 %139 to i32
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.4, i64 0, i64 0), i32 %134, i32 %140)
br label %142
142: ; preds = %132, %124
br label %143
143: ; preds = %142
%144 = load i32, i32* %7
%145 = add nsw i32 %144, 2
store i32 %145, i32* %7
br label %34
146: ; preds = %34
store i32 0, i32* %7
br label %147
147: ; preds = %170, %146
%148 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%149 = load i32, i32* %8
%150 = getelementptr inbounds [26 x i8], [26 x i8]* %10, i64 0, i64 0
%151 = call double @playfairCrack(i8* %148, i32 %149, i8* %150)
store double %151, double* %11
%152 = load double, double* %11
%153 = load double, double* %12
%154 = fcmp ogt double %152, %153
br i1 %154, label %155, label %169
155: ; preds = %147
%156 = load double, double* %11
store double %156, double* %12
%157 = load double, double* %11
%158 = load i32, i32* %7
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %157, i32 %158)
%160 = getelementptr inbounds [26 x i8], [26 x i8]* %10, i64 0, i64 0
%161 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %160)
%162 = getelementptr inbounds [26 x i8], [26 x i8]* %10, i64 0, i64 0
%163 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%164 = load i8*, i8** %9
%165 = load i32, i32* %8
%166 = call i32 @playfairDecipher(i8* %162, i8* %163, i8* %164, i32 %165)
%167 = load i8*, i8** %9
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* %167)
br label %169
169: ; preds = %155, %147
br label %170
170: ; preds = %169
%171 = load i32, i32* %7
%172 = add nsw i32 %171, 1
store i32 %172, i32* %7
br label %147
}

LLVM IR (-O2):
@__const.main.cipher = [255 x i8] c"XZOGQRWVQWNROKCOAELBXZWGEQYLGDRZXYZRQAEKLRHDUMNUXYXSXYEMXEHDGNXZYNTZONYELBEUGYSCOREUSWTZRLRYBYCOLZYLEMWNSXFBUSDBORBZCYLQEDMHQRWVQWAEDPGDPOYHORXZINNYWPXZGROKCOLCCOCYTZUEUIICERLEVHMVQWLNWPRYXHGNMLEKLRHDUYSUCYRAWPUYECRYRYXHGNBLUYSCCOUYOHRYUMNUXYXSXYEMXEHDGN\00"
@__const.main.key = [26 x i8] c"ABCDEFGHIKLMNOPQRSTUVWXYZ\00"
@.str.1 = [87 x i8] c"Warning: cipher length is odd, not possible with playfair, continuing anyway (len %d)\0A\00"
@.str.2 = [114 x i8] c"Warning: found two consecutive identical letters, not possible with playfair, continuing anyway (pos %d: %c, %c)\0A\00"
@.str.3 = [197 x i8] c"Warning: found letter J, not possible with this implementation, consider modifying 'key' variable to include 'J' (you will have to remove some other character), continuing anyway (pos %d: '%c%c')\0A\00"
@.str.4 = [86 x i8] c"Warning: found non-uppercase letter, please remove, continuing anyway (pos %d: '%c')\0A\00"
@.str.5 = [40 x i8] c"best score so far: %f, on iteration %d\0A\00"
@.str.6 = [15 x i8] c" Key: '%s'\0A\00"
@.str.7 = [21 x i8] c" plaintext: '%s'\0A\00"
@str = [56 x i8] c"Running playfaircrack, this could take a few minutes...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [255 x i8]
%4 = alloca [26 x i8]
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = call i8* @malloc(i32 %7)
%9 = call i64 @time(i32* null)
%10 = trunc i64 %9 to i32
%11 = call i32 @srand(i32 %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%13 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%14 = and i32 %6, 1
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([87 x i8], [87 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %18
18: ; preds = %16, %2
%19 = icmp sgt i32 %6, 0
br i1 %19, label %20, label %66
20: ; preds = %18, %62
%21 = phi i64 [ %63, %62 ], [ 0, %18 ]
%22 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = or i64 %21, 1
%25 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %23, %26
br i1 %27, label %28, label %33
28: ; preds = %20
%29 = sext i8 %23 to i32
%30 = trunc i64 %21 to i32
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([114 x i8], [114 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %29, i32 %29)
%32 = load i8, i8* %22
br label %33
33: ; preds = %28, %20
%34 = phi i8 [ %32, %28 ], [ %23, %20 ]
%35 = icmp eq i8 %34, 74
%36 = load i8, i8* %25
br i1 %35, label %39, label %37
37: ; preds = %33
%38 = icmp eq i8 %36, 74
br i1 %38, label %39, label %46
39: ; preds = %33, %37
%40 = phi i8 [ 74, %37 ], [ %36, %33 ]
%41 = sext i8 %34 to i32
%42 = sext i8 %40 to i32
%43 = trunc i64 %21 to i32
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([197 x i8], [197 x i8]* @.str.3, i64 0, i64 0), i32 %43, i32 %41, i32 %42)
%45 = load i8, i8* %22
br label %46
46: ; preds = %39, %37
%47 = phi i8 [ %45, %39 ], [ %34, %37 ]
%48 = add i8 %47, -91
%49 = icmp ult i8 %48, -26
br i1 %49, label %50, label %54
50: ; preds = %46
%51 = sext i8 %47 to i32
%52 = trunc i64 %21 to i32
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str.4, i64 0, i64 0), i32 %52, i32 %51)
br label %54
54: ; preds = %46, %50
%55 = load i8, i8* %25
%56 = add i8 %55, -91
%57 = icmp ult i8 %56, -26
br i1 %57, label %58, label %62
58: ; preds = %54
%59 = sext i8 %55 to i32
%60 = trunc i64 %24 to i32
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str.4, i64 0, i64 0), i32 %60, i32 %59)
br label %62
62: ; preds = %54, %58
%63 = add nuw i64 %21, 2
%64 = trunc i64 %63 to i32
%65 = icmp sgt i32 %6, %64
br i1 %65, label %20, label %66
66: ; preds = %62, %18
br label %67
67: ; preds = %66, %77
%68 = phi i32 [ %79, %77 ], [ 0, %66 ]
%69 = phi double [ %78, %77 ], [ -9.900000e+100, %66 ]
%70 = call double @playfairCrack(i8* %5, i32 %6, i8* %13)
%71 = fcmp ogt double %70, %69
br i1 %71, label %72, label %77
72: ; preds = %67
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %70, i32 %68)
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %13)
%75 = call i32 @playfairDecipher(i8* %13, i8* %5, i8* %8, i32 %6)
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* %8)
br label %77
77: ; preds = %67, %72
%78 = phi double [ %70, %72 ], [ %69, %67 ]
%79 = add nuw nsw i32 %68, 1
br label %67
}