#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 */
char getchar();
int /*<<< orphan*/ isspace(char);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rankify1(int *, char *);
int /*<<< orphan*/ rankify2(int *, char *);
scalar_t__ realloc(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int main() {
  int len, i, rank[10], flag, curpos, j, row;
  char *plainText, *cipherText, ch, key[10];
  plainText = NULL;
  len = 1;
  printf("Enter the plain text:\n");
  while (!isspace(ch = getchar())) {
    len++;
    plainText = (char *)realloc(plainText, sizeof(char) * len);
    plainText[len - 2] = ch;
  }
  plainText[len - 1] = '\0';
  do {
    flag = 0;
    printf("\nEnter the encryption key: ");
    scanf("%s", key);
    for (i = 0; i < (strlen(key) - 1) && !flag; i++) {
      for (j = i + 1; j < strlen(key); j++) {
        if (key[i] == key[j]) {
          flag = 1;
          printf("Invalid key!!!\n");
          break;
        }
      }
    }
  } while (flag);
  while (strlen(plainText) % strlen(key)) {
    len++;
    plainText = (char *)realloc(plainText, sizeof(char) * len);
    strcat(plainText, "$");
  }
  cipherText = (char *)malloc(sizeof(char) * len);
  rankify1(rank, key);
  len = strlen(key);
  for (i = j = 0; i < len; i++) {
    curpos = rank[i];
    while (curpos < strlen(plainText)) {
      cipherText[j++] = plainText[curpos];
      curpos += len;
    }
  }
  cipherText[j] = '\0';
  printf("\nCipher Text:\n%s\n", cipherText);
  getchar();
  while (1) {
    printf("\nCipher Text: %s\n", cipherText);
    do {
      flag = 0;
      printf("Enter the encryption key (\"end\" to terminate): ");
      scanf("%s", key);
      if (!strcmp(key, "end"))
        return 0;
      for (i = 0; i < (strlen(key) - 1) && !flag; i++) {
        for (j = i + 1; j < strlen(key); j++) {
          if (key[i] == key[j]) {
            flag = 1;
            printf("Invalid key!!!\n");
            break;
          }
        }
      }
    } while (flag);
    rankify2(rank, key);
    len = strlen(key);
    row = strlen(cipherText) / len;
    for (i = 0; i < len; i++) {
      rank[i] *= row;
    }
    printf("\nDecrypted Plaintext: ");
    for (i = 0; i < row; i++) {
      for (j = 0; j < len; j++) {
        if (cipherText[rank[j]] != '$')
          printf("%c", cipherText[rank[j]]);
        rank[j]++;
      }
    }
    printf("\n\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x58(%rbp)
movl   $0x1,-0x8(%rbp)
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    %al,-0x61(%rbp)
movsbl %al,%edi
call   1060 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1206 <main+0x56>
jmp    123e <main+0x8e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x58(%rbp),%rdi
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%esi
call   10b0 <realloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x61(%rbp),%dl
mov    -0x58(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11df <main+0x2f>
mov    -0x58(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x44(%rbp)
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x6b(%rbp),%rsi
lea    0xdc4(%rip),%rdi
call   10c0 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x70(%rbp)
lea    -0x6b(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x70(%rbp),%ecx
mov    %eax,%edx
sub    $0x1,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x6c(%rbp)
jge    12ab <main+0xfb>
cmpl   $0x0,-0x44(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x6c(%rbp)
mov    -0x6c(%rbp),%al
test   $0x1,%al
jne    12bb <main+0x10b>
jmp    133a <main+0x18a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x74(%rbp)
lea    -0x6b(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
cmp    %ecx,%eax
jge    1327 <main+0x177>
movslq -0xc(%rbp),%rax
movsbl -0x6b(%rbp,%rax,1),%eax
movslq -0x4c(%rbp),%rcx
movsbl -0x6b(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    1314 <main+0x164>
movl   $0x1,-0x44(%rbp)
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1327 <main+0x177>
jmp    1319 <main+0x169>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    12c4 <main+0x114>
jmp    132c <main+0x17c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    127b <main+0xcb>
jmp    133f <main+0x18f>
cmpl   $0x0,-0x44(%rbp)
jne    124f <main+0x9f>
jmp    134e <main+0x19e>
mov    -0x58(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x78(%rbp)
lea    -0x6b(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x78(%rbp),%eax
cltd
idiv   %ecx
cmp    $0x0,%edx
je     13a9 <main+0x1f9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x58(%rbp),%rdi
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%esi
call   10b0 <realloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
lea    0xca7(%rip),%rsi
call   10d0 <strcat@plt>
jmp    134e <main+0x19e>
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x60(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x6b(%rbp),%rsi
call   1030 <rankify1@plt>
lea    -0x6b(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1457 <main+0x2a7>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x58(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
cmp    %ecx,%eax
jge    1444 <main+0x294>
mov    -0x58(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x60(%rbp),%rax
mov    -0x4c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x4c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
jmp    13fa <main+0x24a>
jmp    1449 <main+0x299>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    13e3 <main+0x233>
mov    -0x60(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x60(%rbp),%rsi
lea    0xbda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    -0x60(%rbp),%rsi
lea    0xbd3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x44(%rbp)
lea    0xbd0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x6b(%rbp),%rsi
lea    0xb85(%rip),%rdi
call   10c0 <scanf@plt>
lea    -0x6b(%rbp),%rdi
lea    0xbde(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    14d7 <main+0x327>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x84(%rbp)
lea    -0x6b(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x84(%rbp),%ecx
mov    %eax,%edx
sub    $0x1,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x7d(%rbp)
jge    1514 <main+0x364>
cmpl   $0x0,-0x44(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x7d(%rbp)
mov    -0x7d(%rbp),%al
test   $0x1,%al
jne    1524 <main+0x374>
jmp    15a9 <main+0x3f9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x88(%rbp)
lea    -0x6b(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x88(%rbp),%eax
cmp    %ecx,%eax
jge    1596 <main+0x3e6>
movslq -0xc(%rbp),%rax
movsbl -0x6b(%rbp,%rax,1),%eax
movslq -0x4c(%rbp),%rcx
movsbl -0x6b(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    1583 <main+0x3d3>
movl   $0x1,-0x44(%rbp)
lea    0xabf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1596 <main+0x3e6>
jmp    1588 <main+0x3d8>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    152d <main+0x37d>
jmp    159b <main+0x3eb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    14de <main+0x32e>
jmp    15ae <main+0x3fe>
cmpl   $0x0,-0x44(%rbp)
jne    148e <main+0x2de>
lea    -0x40(%rbp),%rdi
lea    -0x6b(%rbp),%rsi
call   10a0 <rankify2@plt>
lea    -0x6b(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x8(%rbp)
mov    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x50(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1612 <main+0x462>
mov    -0x50(%rbp),%ecx
movslq -0xc(%rbp),%rax
imul   -0x40(%rbp,%rax,4),%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    15e8 <main+0x438>
lea    0xa87(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    16af <main+0x4ff>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    169c <main+0x4ec>
mov    -0x60(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movslq -0x40(%rbp,%rcx,4),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x24,%eax
je     167f <main+0x4cf>
mov    -0x60(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movslq -0x40(%rbp,%rcx,4),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xa3f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x4c(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    163a <main+0x48a>
jmp    16a1 <main+0x4f1>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1627 <main+0x477>
lea    0xa04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    147c <main+0x2cc>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
xor    %r14d,%r14d
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%ebp
movsbl %al,%edi
call   1080 <isspace@plt>
test   %eax,%eax
je     11f9 <main+0x39>
mov    $0x1,%ebx
jmp    122e <main+0x6e>
xor    %ebx,%ebx
xor    %r14d,%r14d
xchg   %ax,%ax
lea    0x2(%rbx),%esi
mov    %r14,%rdi
call   10c0 <realloc@plt>
mov    %rax,%r14
mov    %bpl,(%rax,%rbx,1)
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%ebp
movsbl %al,%edi
call   1080 <isspace@plt>
add    $0x1,%rbx
test   %eax,%eax
je     1200 <main+0x40>
add    $0x1,%ebx
mov    %rbx,0x10(%rsp)
movslq %ebx,%rax
mov    %r14,0x18(%rsp)
movb   $0x0,-0x1(%rax,%r14,1)
lea    0x6(%rsp),%rbp
jmp    1259 <main+0x99>
nopl   0x0(%rax,%rax,1)
test   %r13b,%r13b
jne    1306 <main+0x146>
lea    0xda0(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdae(%rip),%rdi
mov    %rbp,%rsi
call   10d0 <scanf@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
cmp    $0x2,%eax
jl     1306 <main+0x146>
mov    $0x1,%r15d
xor    %ebx,%ebx
nop
lea    0x1(%rbx),%r12
mov    %rbp,%rdi
call   1060 <strlen@plt>
cltq
mov    $0x1,%r13b
mov    %r15,%r14
cmp    %rax,%r12
jge    12df <main+0x11f>
nopl   0x0(%rax)
movzbl 0x6(%rsp,%rbx,1),%eax
cmp    0x6(%rsp,%r14,1),%al
je     12d0 <main+0x110>
add    $0x1,%r14
mov    %rbp,%rdi
call   1060 <strlen@plt>
cmp    %r14d,%eax
jg     12b0 <main+0xf0>
jmp    12df <main+0x11f>
nop
lea    0xdcf(%rip),%rdi
call   1040 <puts@plt>
xor    %r13d,%r13d
mov    %rbp,%rdi
call   1060 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%r12
jge    1250 <main+0x90>
add    $0x1,%r15
mov    %r12,%rbx
test   %r13b,%r13b
jne    1290 <main+0xd0>
jmp    1250 <main+0x90>
mov    0x18(%rsp),%r15
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebp
lea    0x6(%rsp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     137a <main+0x1ba>
lea    0xcee(%rip),%r14
lea    0x6(%rsp),%r12
mov    0x10(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %r15,%rdi
mov    %ebx,%esi
call   10c0 <realloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
call   10e0 <strcat@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    1340 <main+0x180>
jmp    137f <main+0x1bf>
mov    0x10(%rsp),%rbx
mov    %ebx,%edi
call   10a0 <malloc@plt>
mov    %rax,0x18(%rsp)
lea    0x20(%rsp),%rdi
lea    0x6(%rsp),%rbp
mov    %rbp,%rsi
call   1050 <rankify1@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    1414 <main+0x254>
mov    %eax,%r12d
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    13c9 <main+0x209>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r14
cmp    %r12,%r14
je     1416 <main+0x256>
movslq 0x20(%rsp,%r14,4),%rbp
mov    %r15,%rdi
call   1060 <strlen@plt>
cmp    %eax,%ebp
jge    13c0 <main+0x200>
movslq %ebx,%r13
add    0x18(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%r15,%rbp,1),%eax
mov    %al,0x0(%r13)
add    %r12,%rbp
mov    %r15,%rdi
call   1060 <strlen@plt>
cltq
add    $0x1,%r13
add    $0x1,%ebx
cmp    %rax,%rbp
jl     13f0 <main+0x230>
jmp    13c0 <main+0x200>
xor    %ebx,%ebx
movslq %ebx,%rax
mov    0x18(%rsp),%r13
movb   $0x0,0x0(%r13,%rax,1)
lea    0xbf6(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
lea    0xbf0(%rip),%rdi
lea    0x6(%rsp),%r15
jmp    1463 <main+0x2a3>
nopw   0x0(%rax,%rax,1)
lea    0xbda(%rip),%rdi
call   1040 <puts@plt>
lea    0xbd0(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    147e <main+0x2be>
nop
test   %r12b,%r12b
mov    0x18(%rsp),%r13
jne    1550 <main+0x390>
lea    0xbc0(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xb89(%rip),%rdi
mov    %r15,%rsi
call   10d0 <scanf@plt>
cmpl   $0x646e65,0x6(%rsp)
je     177b <main+0x5bb>
mov    %r15,%rdi
call   1060 <strlen@plt>
cmp    $0x2,%eax
jl     1550 <main+0x390>
mov    $0x1,%r13d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rbx),%r14
mov    %r15,%rdi
call   1060 <strlen@plt>
cltq
mov    $0x1,%r12b
mov    %r13,%rbp
cmp    %rax,%r14
jge    151f <main+0x35f>
nopl   0x0(%rax)
movzbl 0x6(%rsp,%rbx,1),%eax
cmp    0x6(%rsp,%rbp,1),%al
je     1510 <main+0x350>
add    $0x1,%rbp
mov    %r15,%rdi
call   1060 <strlen@plt>
cmp    %ebp,%eax
jg     14f0 <main+0x330>
jmp    151f <main+0x35f>
nopl   (%rax)
lea    0xb8f(%rip),%rdi
call   1040 <puts@plt>
xor    %r12d,%r12d
mov    %r15,%rdi
call   1060 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%r14
jge    1470 <main+0x2b0>
add    $0x1,%r13
mov    %r14,%rbx
test   %r12b,%r12b
jne    14d0 <main+0x310>
jmp    1470 <main+0x2b0>
cs nopw 0x0(%rax,%rax,1)
lea    0x20(%rsp),%rdi
mov    %r15,%rsi
call   10b0 <rankify2@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebx
mov    %r13,%rdi
call   1060 <strlen@plt>
cltd
idiv   %ebx
mov    %eax,%r14d
mov    %ebx,%r12d
mov    %ebx,0x10(%rsp)
test   %ebx,%ebx
jle    1705 <main+0x545>
cmpl   $0x8,0x10(%rsp)
jae    15a0 <main+0x3e0>
xor    %eax,%eax
jmp    16f0 <main+0x530>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12d,%eax
and    $0xfffffff8,%eax
movd   %r14d,%xmm0
pshufd $0x0,%xmm0,%xmm0
lea    -0x8(%rax),%rcx
mov    %rcx,%rdx
shr    $0x3,%rdx
add    $0x1,%rdx
pshufd $0xf5,%xmm0,%xmm1
test   %rcx,%rcx
je     176b <main+0x5ab>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
movdqa 0x20(%rsp,%rcx,4),%xmm3
movdqa 0x30(%rsp,%rcx,4),%xmm4
movdqa 0x40(%rsp,%rcx,4),%xmm5
movdqa 0x50(%rsp,%rcx,4),%xmm2
pshufd $0xf5,%xmm3,%xmm6
pmuludq %xmm0,%xmm3
pshufd $0xe8,%xmm3,%xmm3
pmuludq %xmm1,%xmm6
pshufd $0xe8,%xmm6,%xmm6
punpckldq %xmm6,%xmm3
pshufd $0xf5,%xmm4,%xmm6
pmuludq %xmm0,%xmm4
pshufd $0xe8,%xmm4,%xmm4
pmuludq %xmm1,%xmm6
pshufd $0xe8,%xmm6,%xmm6
punpckldq %xmm6,%xmm4
movdqa %xmm3,0x20(%rsp,%rcx,4)
movdqa %xmm4,0x30(%rsp,%rcx,4)
pshufd $0xf5,%xmm5,%xmm3
pmuludq %xmm0,%xmm5
pshufd $0xe8,%xmm5,%xmm4
pmuludq %xmm1,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm4
pshufd $0xf5,%xmm2,%xmm3
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm1,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm2
movdqa %xmm4,0x40(%rsp,%rcx,4)
movdqa %xmm2,0x50(%rsp,%rcx,4)
add    $0x10,%rcx
add    $0xfffffffffffffffe,%rsi
jne    15e0 <main+0x420>
test   $0x1,%dl
je     16dd <main+0x51d>
movdqa 0x20(%rsp,%rcx,4),%xmm2
movdqa 0x30(%rsp,%rcx,4),%xmm3
pshufd $0xf5,%xmm2,%xmm4
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm1,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm2
pmuludq %xmm3,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pshufd $0xf5,%xmm3,%xmm3
pmuludq %xmm1,%xmm3
pshufd $0xe8,%xmm3,%xmm1
punpckldq %xmm1,%xmm0
movdqa %xmm2,0x20(%rsp,%rcx,4)
movdqa %xmm0,0x30(%rsp,%rcx,4)
cmp    %r12,%rax
je     1705 <main+0x545>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x20(%rsp,%rax,4),%ecx
imul   %r14d,%ecx
mov    %ecx,0x20(%rsp,%rax,4)
add    $0x1,%rax
cmp    %rax,%r12
jne    16f0 <main+0x530>
lea    0x96d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
test   %r14d,%r14d
jle    1450 <main+0x290>
xor    %ebp,%ebp
jmp    172c <main+0x56c>
add    $0x1,%ebp
cmp    %r14d,%ebp
je     1450 <main+0x290>
cmpl   $0x0,0x10(%rsp)
jle    1720 <main+0x560>
xor    %ebx,%ebx
jmp    1750 <main+0x590>
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
mov    %eax,0x20(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
je     1720 <main+0x560>
movslq 0x20(%rsp,%rbx,4),%rax
movsbl 0x0(%r13,%rax,1),%edi
cmp    $0x24,%edi
je     1740 <main+0x580>
call   1030 <putchar@plt>
mov    0x20(%rsp,%rbx,4),%eax
jmp    1740 <main+0x580>
xor    %ecx,%ecx
test   $0x1,%dl
jne    168f <main+0x4cf>
jmp    16dd <main+0x51d>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [28 x i8] c"\0AEnter the encryption key: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"$\00"
@.str.5 = [18 x i8] c"\0ACipher Text:\0A%s\0A\00"
@.str.6 = [18 x i8] c"\0ACipher Text: %s\0A\00"
@.str.7 = [48 x i8] c"Enter the encryption key (\22end\22 to terminate): \00"
@.str.8 = [4 x i8] c"end\00"
@.str.9 = [23 x i8] c"\0ADecrypted Plaintext: \00"
@str = [22 x i8] c"Enter the plain text:\00"
@str.12 = [2 x i8] c"\0A\00"
@str.14 = [15 x i8] c"Invalid key!!!\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i8]
%3 = bitcast [10 x i32]* %1 to i8*
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%6 = tail call signext i8 (...) @getchar()
%7 = tail call i32 @isspace(i8 signext %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %25
9: ; preds = %0, %9
%10 = phi i64 [ %13, %9 ], [ 1, %0 ]
%11 = phi i8 [ %19, %9 ], [ %6, %0 ]
%12 = phi i8* [ %16, %9 ], [ null, %0 ]
%13 = add nuw i64 %10, 1
%14 = trunc i64 %13 to i32
%15 = tail call i64 @realloc(i8* %12, i32 %14)
%16 = inttoptr i64 %15 to i8*
%17 = add nsw i64 %10, -1
%18 = getelementptr inbounds i8, i8* %16, i64 %17
store i8 %11, i8* %18
%19 = tail call signext i8 (...) @getchar()
%20 = tail call i32 @isspace(i8 signext %19)
%21 = icmp eq i32 %20, 0
br i1 %21, label %9, label %22
22: ; preds = %9
%23 = trunc i64 %13 to i32
%24 = inttoptr i64 %15 to i8*
br label %25
25: ; preds = %22, %0
%26 = phi i8* [ null, %0 ], [ %24, %22 ]
%27 = phi i32 [ 1, %0 ], [ %23, %22 ]
%28 = add nsw i32 %27, -1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
store i8 0, i8* %30
br label %31
31: ; preds = %66, %25
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%34 = call i32 @strlen(i8* %4)
%35 = icmp sgt i32 %34, 1
br i1 %35, label %36, label %67
36: ; preds = %31, %58
%37 = phi i64 [ %39, %58 ], [ 0, %31 ]
%38 = phi i64 [ %65, %58 ], [ 1, %31 ]
%39 = add nuw nsw i64 %37, 1
%40 = call i32 @strlen(i8* %4)
%41 = sext i32 %40 to i64
%42 = icmp slt i64 %39, %41
br i1 %42, label %43, label %58
43: ; preds = %36
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %37
br label %49
45: ; preds = %49
%46 = call i32 @strlen(i8* %4)
%47 = trunc i64 %55 to i32
%48 = icmp sgt i32 %46, %47
br i1 %48, label %49, label %58
49: ; preds = %43, %45
%50 = phi i64 [ %38, %43 ], [ %55, %45 ]
%51 = load i8, i8* %44
%52 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %50
%53 = load i8, i8* %52
%54 = icmp eq i8 %51, %53
%55 = add nuw nsw i64 %50, 1
br i1 %54, label %56, label %45
56: ; preds = %49
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.14, i64 0, i64 0))
br label %58
58: ; preds = %45, %36, %56
%59 = phi i1 [ true, %36 ], [ false, %56 ], [ true, %45 ]
%60 = call i32 @strlen(i8* %4)
%61 = add nsw i32 %60, -1
%62 = sext i32 %61 to i64
%63 = icmp slt i64 %39, %62
%64 = and i1 %63, %59
%65 = add nuw nsw i64 %38, 1
br i1 %64, label %36, label %66
66: ; preds = %58
br i1 %59, label %67, label %31
67: ; preds = %31, %66
%68 = call i32 @strlen(i8* %26)
%69 = call i32 @strlen(i8* %4)
%70 = srem i32 %68, %69
%71 = icmp eq i32 %70, 0
br i1 %71, label %85, label %72
72: ; preds = %67, %72
%73 = phi i32 [ %75, %72 ], [ %27, %67 ]
%74 = phi i8* [ %77, %72 ], [ %26, %67 ]
%75 = add nuw nsw i32 %73, 1
%76 = call i64 @realloc(i8* %74, i32 %75)
%77 = inttoptr i64 %76 to i8*
%78 = call i32 @strcat(i8* %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%79 = call i32 @strlen(i8* %77)
%80 = call i32 @strlen(i8* %4)
%81 = srem i32 %79, %80
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %72
83: ; preds = %72
%84 = inttoptr i64 %76 to i8*
br label %85
85: ; preds = %83, %67
%86 = phi i8* [ %26, %67 ], [ %84, %83 ]
%87 = phi i32 [ %27, %67 ], [ %75, %83 ]
%88 = call i64 @malloc(i32 %87)
%89 = inttoptr i64 %88 to i8*
%90 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%91 = call i32 @rankify1(i32* %90, i8* %4)
%92 = call i32 @strlen(i8* %4)
%93 = icmp sgt i32 %92, 0
br i1 %93, label %94, label %124
94: ; preds = %85
%95 = zext i32 %92 to i64
%96 = zext i32 %92 to i64
br label %97
97: ; preds = %94, %120
%98 = phi i64 [ 0, %94 ], [ %122, %120 ]
%99 = phi i32 [ 0, %94 ], [ %121, %120 ]
%100 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %98
%101 = load i32, i32* %100
%102 = call i32 @strlen(i8* %86)
%103 = icmp slt i32 %101, %102
br i1 %103, label %104, label %120
104: ; preds = %97
%105 = sext i32 %99 to i64
%106 = sext i32 %101 to i64
br label %107
107: ; preds = %104, %107
%108 = phi i64 [ %106, %104 ], [ %114, %107 ]
%109 = phi i64 [ %105, %104 ], [ %112, %107 ]
%110 = getelementptr inbounds i8, i8* %86, i64 %108
%111 = load i8, i8* %110
%112 = add i64 %109, 1
%113 = getelementptr inbounds i8, i8* %89, i64 %109
store i8 %111, i8* %113
%114 = add i64 %108, %95
%115 = call i32 @strlen(i8* %86)
%116 = sext i32 %115 to i64
%117 = icmp slt i64 %114, %116
br i1 %117, label %107, label %118
118: ; preds = %107
%119 = trunc i64 %112 to i32
br label %120
120: ; preds = %118, %97
%121 = phi i32 [ %99, %97 ], [ %119, %118 ]
%122 = add nuw nsw i64 %98, 1
%123 = icmp eq i64 %122, %96
br i1 %123, label %124, label %97
124: ; preds = %120, %85
%125 = phi i32 [ 0, %85 ], [ %121, %120 ]
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8, i8* %89, i64 %126
store i8 0, i8* %127
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %89)
%129 = call signext i8 (...) @getchar()
br label %130
130: ; preds = %273, %124
%131 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %89)
br label %132
132: ; preds = %171, %130
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0))
%134 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%135 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i64 4)
%136 = icmp eq i32 %135, 0
br i1 %136, label %140, label %137
137: ; preds = %132
%138 = call i32 @strlen(i8* %4)
%139 = icmp sgt i32 %138, 1
br i1 %139, label %141, label %172
140: ; preds = %132
ret i32 0
141: ; preds = %137, %163
%142 = phi i64 [ %144, %163 ], [ 0, %137 ]
%143 = phi i64 [ %170, %163 ], [ 1, %137 ]
%144 = add nuw nsw i64 %142, 1
%145 = call i32 @strlen(i8* %4)
%146 = sext i32 %145 to i64
%147 = icmp slt i64 %144, %146
br i1 %147, label %148, label %163
148: ; preds = %141
%149 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %142
br label %154
150: ; preds = %154
%151 = call i32 @strlen(i8* %4)
%152 = trunc i64 %160 to i32
%153 = icmp sgt i32 %151, %152
br i1 %153, label %154, label %163
154: ; preds = %148, %150
%155 = phi i64 [ %143, %148 ], [ %160, %150 ]
%156 = load i8, i8* %149
%157 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %155
%158 = load i8, i8* %157
%159 = icmp eq i8 %156, %158
%160 = add nuw nsw i64 %155, 1
br i1 %159, label %161, label %150
161: ; preds = %154
%162 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.14, i64 0, i64 0))
br label %163
163: ; preds = %150, %141, %161
%164 = phi i1 [ true, %141 ], [ false, %161 ], [ true, %150 ]
%165 = call i32 @strlen(i8* %4)
%166 = add nsw i32 %165, -1
%167 = sext i32 %166 to i64
%168 = icmp slt i64 %144, %167
%169 = and i1 %168, %164
%170 = add nuw nsw i64 %143, 1
br i1 %169, label %141, label %171
171: ; preds = %163
br i1 %164, label %172, label %132
172: ; preds = %137, %171
%173 = call i32 @rankify2(i32* %90, i8* %4)
%174 = call i32 @strlen(i8* %4)
%175 = call i32 @strlen(i8* %89)
%176 = sdiv i32 %175, %174
%177 = icmp sgt i32 %174, 0
br i1 %177, label %178, label %246
178: ; preds = %172
%179 = zext i32 %174 to i64
%180 = icmp ult i32 %174, 8
br i1 %180, label %237, label %181
181: ; preds = %178
%182 = and i64 %179, 4294967288
%183 = insertelement <4 x i32> poison, i32 %176, i64 0
%184 = shufflevector <4 x i32> %183, <4 x i32> poison, <4 x i32> zeroinitializer
%185 = insertelement <4 x i32> poison, i32 %176, i64 0
%186 = shufflevector <4 x i32> %185, <4 x i32> poison, <4 x i32> zeroinitializer
%187 = add nsw i64 %182, -8
%188 = lshr exact i64 %187, 3
%189 = add nuw nsw i64 %188, 1
%190 = and i64 %189, 1
%191 = icmp eq i64 %187, 0
br i1 %191, label %221, label %192
192: ; preds = %181
%193 = and i64 %189, 4611686018427387902
br label %194
194: ; preds = %194, %192
%195 = phi i64 [ 0, %192 ], [ %218, %194 ]
%196 = phi i64 [ 0, %192 ], [ %219, %194 ]
%197 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %195
%198 = bitcast i32* %197 to <4 x i32>*
%199 = load <4 x i32>, <4 x i32>* %198
%200 = getelementptr inbounds i32, i32* %197, i64 4
%201 = bitcast i32* %200 to <4 x i32>*
%202 = load <4 x i32>, <4 x i32>* %201
%203 = mul nsw <4 x i32> %199, %184
%204 = mul nsw <4 x i32> %202, %186
%205 = bitcast i32* %197 to <4 x i32>*
store <4 x i32> %203, <4 x i32>* %205
%206 = bitcast i32* %200 to <4 x i32>*
store <4 x i32> %204, <4 x i32>* %206
%207 = or i64 %195, 8
%208 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %207
%209 = bitcast i32* %208 to <4 x i32>*
%210 = load <4 x i32>, <4 x i32>* %209
%211 = getelementptr inbounds i32, i32* %208, i64 4
%212 = bitcast i32* %211 to <4 x i32>*
%213 = load <4 x i32>, <4 x i32>* %212
%214 = mul nsw <4 x i32> %210, %184
%215 = mul nsw <4 x i32> %213, %186
%216 = bitcast i32* %208 to <4 x i32>*
store <4 x i32> %214, <4 x i32>* %216
%217 = bitcast i32* %211 to <4 x i32>*
store <4 x i32> %215, <4 x i32>* %217
%218 = add nuw i64 %195, 16
%219 = add i64 %196, 2
%220 = icmp eq i64 %219, %193
br i1 %220, label %221, label %194
221: ; preds = %194, %181
%222 = phi i64 [ 0, %181 ], [ %218, %194 ]
%223 = icmp eq i64 %190, 0
br i1 %223, label %235, label %224
224: ; preds = %221
%225 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %222
%226 = bitcast i32* %225 to <4 x i32>*
%227 = load <4 x i32>, <4 x i32>* %226
%228 = getelementptr inbounds i32, i32* %225, i64 4
%229 = bitcast i32* %228 to <4 x i32>*
%230 = load <4 x i32>, <4 x i32>* %229
%231 = mul nsw <4 x i32> %227, %184
%232 = mul nsw <4 x i32> %230, %186
%233 = bitcast i32* %225 to <4 x i32>*
store <4 x i32> %231, <4 x i32>* %233
%234 = bitcast i32* %228 to <4 x i32>*
store <4 x i32> %232, <4 x i32>* %234
br label %235
235: ; preds = %221, %224
%236 = icmp eq i64 %182, %179
br i1 %236, label %246, label %237
237: ; preds = %178, %235
%238 = phi i64 [ 0, %178 ], [ %182, %235 ]
br label %239
239: ; preds = %237, %239
%240 = phi i64 [ %244, %239 ], [ %238, %237 ]
%241 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %240
%242 = load i32, i32* %241
%243 = mul nsw i32 %242, %176
store i32 %243, i32* %241
%244 = add nuw nsw i64 %240, 1
%245 = icmp eq i64 %244, %179
br i1 %245, label %246, label %239
246: ; preds = %239, %235, %172
%247 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%248 = icmp sgt i32 %176, 0
br i1 %248, label %249, label %273
249: ; preds = %246
%250 = zext i32 %174 to i64
br label %251
251: ; preds = %249, %270
%252 = phi i32 [ 0, %249 ], [ %271, %270 ]
br i1 %177, label %253, label %270
253: ; preds = %251, %265
%254 = phi i64 [ %268, %265 ], [ 0, %251 ]
%255 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %254
%256 = load i32, i32* %255
%257 = sext i32 %256 to i64
%258 = getelementptr inbounds i8, i8* %89, i64 %257
%259 = load i8, i8* %258
%260 = icmp eq i8 %259, 36
br i1 %260, label %265, label %261
261: ; preds = %253
%262 = sext i8 %259 to i32
%263 = call i32 @putchar(i32 %262)
%264 = load i32, i32* %255
br label %265
265: ; preds = %261, %253
%266 = phi i32 [ %264, %261 ], [ %256, %253 ]
%267 = add nsw i32 %266, 1
store i32 %267, i32* %255
%268 = add nuw nsw i64 %254, 1
%269 = icmp eq i64 %268, %250
br i1 %269, label %270, label %253
270: ; preds = %265, %251
%271 = add nuw nsw i32 %252, 1
%272 = icmp eq i32 %271, %176
br i1 %272, label %273, label %251
273: ; preds = %270, %246
%274 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.12, i64 0, i64 0))
br label %130
}