#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);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  if (argc != 4) {
    printf("Usage: vigenere -d[ecrypt]|-e[ncrypt] <Key> <Message>\r\n");
    return -1;
  }
  int key_len = strlen(argv[2]);
  if (key_len <= 0) {
    printf("Please provide a valid key.\r\n");
    return -1;
  }
  char *key = malloc(sizeof(char) * key_len);
  if (!key) {
    printf("Malloc failed. Please make sure enough memory is available.\r\n");
    return -1;
  }
  memset(key, 0, key_len);
  strcpy(key, argv[2]);
  int len = strlen(argv[3]);
  if (len <= 0) {
    printf("Please provide a valid message.\r\n");
    return -1;
  }
  char *input = malloc(sizeof(char) * len);
  if (!input) {
    printf("Malloc failed. Please make sure enough memory is available.\r\n");
    return -1;
  }
  memset(input, 0, len);
  strcpy(input, argv[3]);
  int y;
  for (y = 0; y < len; y++) {
    if (input[y] < 65 || (input[y] > 90 && input[y] < 97) || (input[y] > 122)) {
      printf("Message does not contain valid characters!\r\n");
      return -1;
    }
    if (input[y] >= 97 && input[y] <= 122)
      input[y] = input[y] - 32;
  }
  int x;
  int modifier = (argv[1][1] == 'd' ? -1 : 1);
  int val = 0;
  for (x = 0; x < len; x++) {
    val = (((input[x] - 65) + (modifier * (key[x % key_len] - 65))) % 26);
    while (val < 0)
      val += 26;
    input[x] = val + 65;
  }
  printf("Input: %s\r\nKey: %s\r\nOutput:%s\r\n", argv[3], argv[2], input);
  free(key);
  free(input);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     119a <main+0x3a>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1477 <main+0x317>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     11ce <main+0x6e>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1477 <main+0x317>
movslq -0x14(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1206 <main+0xa6>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1477 <main+0x317>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jg     1259 <main+0xf9>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1477 <main+0x317>
movslq -0x24(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1291 <main+0x131>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1477 <main+0x317>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1040 <strcpy@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    138a <main+0x22a>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x41,%eax
jl     1317 <main+0x1b7>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
jle    1302 <main+0x1a2>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x61,%eax
jl     1317 <main+0x1b7>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jle    1331 <main+0x1d1>
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1477 <main+0x317>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x61,%eax
jl     1377 <main+0x217>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jg     1377 <main+0x217>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x20,%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    137c <main+0x21c>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12b7 <main+0x157>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%edx
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    $0x64,%edx
cmove  %ecx,%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1443 <main+0x2e3>
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x41,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x3c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    -0x4c(%rbp),%eax
mov    %edx,%esi
mov    -0x48(%rbp),%rdx
movslq %esi,%rsi
movsbl (%rdx,%rsi,1),%edx
sub    $0x41,%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %edx,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jge    1422 <main+0x2c2>
mov    -0x40(%rbp),%eax
add    $0x1a,%eax
mov    %eax,-0x40(%rbp)
jmp    140a <main+0x2aa>
mov    -0x40(%rbp),%eax
add    $0x41,%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    13b7 <main+0x257>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x30(%rbp),%rcx
lea    0xc85(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
cmp    $0x4,%edi
jne    123c <main+0xcc>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    1245 <main+0xd5>
mov    %eax,%r15d
mov    %eax,%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     124e <main+0xde>
mov    %rax,%r12
mov    %rax,%rdi
xor    %esi,%esi
mov    %r15d,%edx
call   1080 <memset@plt>
mov    0x10(%rbx),%rsi
mov    %r12,%rdi
call   1040 <strcpy@plt>
mov    0x18(%rbx),%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    1257 <main+0xe7>
mov    %eax,%r14d
mov    %eax,%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     124e <main+0xde>
mov    %rax,%r13
xor    %ebp,%ebp
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14d,%edx
call   1080 <memset@plt>
mov    0x18(%rbx),%rsi
mov    %r13,%rdi
call   1040 <strcpy@plt>
mov    %r14d,%edi
jmp    1219 <main+0xa9>
nopl   (%rax)
add    $0x1,%rbp
cmp    %rbp,%rdi
je     1282 <main+0x112>
movzbl 0x0(%r13,%rbp,1),%eax
cmp    $0x41,%al
jl     1260 <main+0xf0>
cmp    $0x7a,%al
ja     1260 <main+0xf0>
lea    -0x5b(%rax),%ecx
cmp    $0x5,%cl
jbe    1260 <main+0xf0>
cmp    $0x61,%al
jb     1210 <main+0xa0>
add    $0xe0,%al
mov    %al,0x0(%r13,%rbp,1)
jmp    1210 <main+0xa0>
lea    0xf14(%rip),%rdi
jmp    1267 <main+0xf7>
lea    0xeee(%rip),%rdi
jmp    1267 <main+0xf7>
lea    0xe5b(%rip),%rdi
jmp    1267 <main+0xf7>
lea    0xebb(%rip),%rdi
jmp    1267 <main+0xf7>
lea    0xe86(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rbx),%rax
mov    0x1(%rax),%r9b
xor    %r8d,%r8d
cmp    $0x8,%r14d
jb     1bf0 <main+0xa80>
cmp    $0x10,%r14d
mov    %r12,0x28(%rsp)
mov    %rdi,0x18(%rsp)
mov    %rbx,0x48(%rsp)
mov    %r13,0x8(%rsp)
jae    12b9 <main+0x149>
xor    %r8d,%r8d
jmp    18a5 <main+0x735>
mov    %r9b,0x3(%rsp)
mov    %edi,%r8d
and    $0xfffffff0,%r8d
xor    %r13d,%r13d
movdqa 0xd40(%rip),%xmm6
movdqa 0xd67(%rip),%xmm15
movdqa 0xd6e(%rip),%xmm13
mov    %r15d,0x4(%rsp)
jmp    15ca <main+0x45a>
paddd  %xmm3,%xmm5
movdqa %xmm5,%xmm0
mov    0x18(%rsp),%rdi
paddd  %xmm0,%xmm8
paddd  %xmm3,%xmm8
paddd  %xmm3,%xmm1
paddd  %xmm3,%xmm2
paddd  %xmm3,%xmm4
pslld  $0x10,%xmm4
psrad  $0x10,%xmm4
pslld  $0x10,%xmm2
psrad  $0x10,%xmm2
packssdw %xmm2,%xmm4
pslld  $0x10,%xmm1
psrad  $0x10,%xmm1
pslld  $0x10,%xmm8
psrad  $0x10,%xmm8
packssdw %xmm1,%xmm8
movdqa %xmm8,%xmm0
movdqa 0xcd1(%rip),%xmm2
pmulhw %xmm2,%xmm0
movdqa %xmm0,%xmm1
psrlw  $0xf,%xmm1
psraw  $0x3,%xmm0
paddw  %xmm1,%xmm0
movdqa 0xcc3(%rip),%xmm3
pmullw %xmm3,%xmm0
psubw  %xmm0,%xmm8
movdqa %xmm4,%xmm0
pmulhw %xmm2,%xmm0
movdqa %xmm0,%xmm1
psrlw  $0xf,%xmm1
psraw  $0x3,%xmm0
paddw  %xmm1,%xmm0
pmullw %xmm3,%xmm0
psubw  %xmm0,%xmm4
punpcklwd %xmm4,%xmm9
psrad  $0x10,%xmm9
punpckhwd %xmm4,%xmm10
psrad  $0x10,%xmm10
punpcklwd %xmm8,%xmm11
psrad  $0x10,%xmm11
punpckhwd %xmm8,%xmm1
psrad  $0x10,%xmm1
movdqa %xmm1,%xmm6
pxor   %xmm3,%xmm3
pcmpgtd %xmm3,%xmm6
pand   %xmm1,%xmm6
movdqa %xmm11,%xmm0
pcmpgtd %xmm3,%xmm0
pand   %xmm11,%xmm0
movdqa %xmm10,%xmm7
pcmpgtd %xmm3,%xmm7
pand   %xmm10,%xmm7
movdqa %xmm9,%xmm2
pcmpgtd %xmm3,%xmm2
pand   %xmm9,%xmm2
psrlw  $0xf,%xmm8
psrlw  $0xf,%xmm4
movdqa %xmm4,%xmm5
punpcklwd %xmm3,%xmm5
punpckhwd %xmm3,%xmm4
movdqa %xmm8,%xmm14
punpcklwd %xmm3,%xmm14
punpckhwd %xmm3,%xmm8
movdqa %xmm8,%xmm3
paddd  %xmm1,%xmm3
psubd  %xmm3,%xmm6
movdqa %xmm14,%xmm3
paddd  %xmm11,%xmm3
psubd  %xmm3,%xmm0
movdqa %xmm4,%xmm3
paddd  %xmm10,%xmm3
psubd  %xmm3,%xmm7
movdqa %xmm5,%xmm3
paddd  %xmm9,%xmm3
psubd  %xmm3,%xmm2
pshufd $0xf5,%xmm6,%xmm3
pmuludq %xmm15,%xmm6
pshufd $0xed,%xmm6,%xmm12
pmuludq %xmm15,%xmm3
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm3,%xmm12
pshufd $0xf5,%xmm0,%xmm3
pmuludq %xmm15,%xmm0
pshufd $0xed,%xmm0,%xmm0
pmuludq %xmm15,%xmm3
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm3,%xmm0
pshufd $0xf5,%xmm7,%xmm3
pmuludq %xmm15,%xmm7
pshufd $0xed,%xmm7,%xmm7
pmuludq %xmm15,%xmm3
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm3,%xmm7
pshufd $0xf5,%xmm2,%xmm3
pmuludq %xmm15,%xmm2
pshufd $0xed,%xmm2,%xmm2
pmuludq %xmm15,%xmm3
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm3,%xmm2
psrld  $0x3,%xmm2
paddd  %xmm5,%xmm2
psrld  $0x3,%xmm7
paddd  %xmm4,%xmm7
psrld  $0x3,%xmm0
paddd  %xmm14,%xmm0
psrld  $0x3,%xmm12
paddd  %xmm8,%xmm12
pshufd $0xf5,%xmm12,%xmm4
pmuludq %xmm13,%xmm12
pshufd $0xe8,%xmm12,%xmm3
pmuludq %xmm13,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm3
pshufd $0xf5,%xmm0,%xmm4
pmuludq %xmm13,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm13,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm0
pshufd $0xf5,%xmm7,%xmm5
pmuludq %xmm13,%xmm7
pshufd $0xe8,%xmm7,%xmm4
pmuludq %xmm13,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm4
pshufd $0xf5,%xmm2,%xmm5
pmuludq %xmm13,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm13,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm2
paddd  %xmm9,%xmm2
paddd  %xmm10,%xmm4
paddd  %xmm11,%xmm0
paddd  %xmm1,%xmm3
movdqa 0xada(%rip),%xmm1
pand   %xmm1,%xmm3
pand   %xmm1,%xmm0
packuswb %xmm3,%xmm0
pand   %xmm1,%xmm4
pand   %xmm1,%xmm2
packuswb %xmm4,%xmm2
packuswb %xmm0,%xmm2
paddb  0xac6(%rip),%xmm2
mov    0x8(%rsp),%rax
movdqu %xmm2,(%rax,%r13,1)
add    $0x10,%r13
cmp    %r13,%r8
movdqa 0xa4c(%rip),%xmm6
je     187e <main+0x70e>
lea    0x1(%r13),%r10d
lea    0x2(%r13),%r12d
lea    0x3(%r13),%r11d
lea    0x4(%r13),%esi
lea    0x5(%r13),%ebp
lea    0x6(%r13),%ebx
lea    0x7(%r13),%edi
lea    0x8(%r13),%ecx
lea    0x9(%r13),%r9d
lea    0xa(%r13),%eax
mov    %eax,0x38(%rsp)
lea    0xb(%r13),%eax
mov    %eax,0x3c(%rsp)
lea    0xc(%r13),%eax
mov    %eax,0x40(%rsp)
lea    0xd(%r13),%eax
mov    %eax,0x44(%rsp)
mov    %r13d,%eax
cltd
idiv   %r15d
mov    %rdx,0x20(%rsp)
mov    %r10d,%eax
cltd
idiv   %r15d
mov    %rdx,0x10(%rsp)
mov    %r12d,%eax
cltd
idiv   %r15d
mov    %rdx,0x60(%rsp)
mov    %r11d,%eax
cltd
idiv   %r15d
mov    %edx,%r11d
mov    %esi,%eax
cltd
idiv   %r15d
mov    %edx,%r14d
mov    %ebp,%eax
cltd
idiv   %r15d
mov    %rdx,0x30(%rsp)
mov    %ebx,%eax
cltd
idiv   %r15d
mov    %rdx,0x58(%rsp)
mov    %edi,%eax
cltd
idiv   %r15d
mov    %rdx,0x50(%rsp)
mov    %ecx,%eax
cltd
idiv   %r15d
mov    %edx,%ecx
mov    %r9d,%eax
cltd
idiv   %r15d
mov    %edx,%r9d
mov    0x38(%rsp),%eax
cltd
idiv   %r15d
mov    %edx,%r10d
mov    0x3c(%rsp),%eax
cltd
idiv   %r15d
mov    %edx,%r12d
mov    0x40(%rsp),%eax
cltd
idiv   %r15d
mov    %edx,%ebx
mov    0x44(%rsp),%eax
cltd
lea    0xe(%r13),%edi
idiv   %r15d
mov    %edx,%esi
mov    %edi,%eax
cltd
idiv   %r15d
mov    %edx,%ebp
lea    0xf(%r13),%eax
cltd
idiv   %r15d
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rax
movzbl (%rdi,%rax,1),%eax
shl    $0x8,%eax
pxor   %xmm1,%xmm1
pinsrw $0x1,%eax,%xmm1
mov    0x10(%rsp),%rax
movzbl (%rdi,%rax,1),%eax
shl    $0x8,%eax
pinsrw $0x3,%eax,%xmm1
mov    0x60(%rsp),%rax
movzbl (%rdi,%rax,1),%eax
shl    $0x8,%eax
pinsrw $0x5,%eax,%xmm1
movzbl (%rdi,%r11,1),%eax
shl    $0x8,%eax
pinsrw $0x7,%eax,%xmm1
movzbl (%rdi,%r12,1),%r12d
shl    $0x8,%r12d
movzbl (%rdi,%r10,1),%r10d
shl    $0x8,%r10d
movzbl (%rdi,%r9,1),%r9d
shl    $0x8,%r9d
movzbl (%rdi,%rcx,1),%r11d
shl    $0x8,%r11d
movzbl (%rdi,%rdx,1),%edx
shl    $0x8,%edx
movzbl (%rdi,%rbp,1),%r15d
shl    $0x8,%r15d
movzbl (%rdi,%rsi,1),%eax
shl    $0x8,%eax
movzbl (%rdi,%rbx,1),%ebp
shl    $0x8,%ebp
mov    0x50(%rsp),%rcx
movzbl (%rdi,%rcx,1),%ebx
shl    $0x8,%ebx
mov    0x58(%rsp),%rcx
movzbl (%rdi,%rcx,1),%ecx
shl    $0x8,%ecx
mov    0x30(%rsp),%rsi
movzbl (%rdi,%rsi,1),%esi
shl    $0x8,%esi
movzbl (%rdi,%r14,1),%r14d
shl    $0x8,%r14d
psrad  $0x18,%xmm1
cmpb   $0x64,0x3(%rsp)
je     178c <main+0x61c>
movdqa 0x87e(%rip),%xmm3
paddd  %xmm3,%xmm1
movdqa %xmm1,%xmm0
jmp    179c <main+0x62c>
movdqa %xmm6,%xmm0
psubd  %xmm1,%xmm0
movdqa 0x864(%rip),%xmm3
pxor   %xmm1,%xmm1
pinsrw $0x1,%r14d,%xmm1
pinsrw $0x3,%esi,%xmm1
pinsrw $0x5,%ecx,%xmm1
mov    0x8(%rsp),%rcx
movdqu (%rcx,%r13,1),%xmm2
pinsrw $0x7,%ebx,%xmm1
psrad  $0x18,%xmm1
je     17d1 <main+0x661>
paddd  %xmm3,%xmm1
movdqa %xmm1,%xmm4
jmp    17d9 <main+0x669>
movdqa %xmm6,%xmm4
psubd  %xmm1,%xmm4
pxor   %xmm1,%xmm1
pinsrw $0x1,%ebp,%xmm1
pinsrw $0x3,%eax,%xmm1
pinsrw $0x5,%r15d,%xmm1
pinsrw $0x7,%edx,%xmm1
psrad  $0x18,%xmm1
je     1803 <main+0x693>
paddd  %xmm3,%xmm1
movdqa %xmm1,%xmm5
jmp    180b <main+0x69b>
movdqa %xmm6,%xmm5
psubd  %xmm1,%xmm5
mov    0x4(%rsp),%r15d
punpckhbw %xmm2,%xmm1
punpcklwd %xmm1,%xmm8
psrad  $0x18,%xmm8
punpckhwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm5,%xmm1
punpcklbw %xmm2,%xmm5
punpckhwd %xmm5,%xmm2
psrad  $0x18,%xmm2
paddd  %xmm4,%xmm2
punpcklwd %xmm5,%xmm4
psrad  $0x18,%xmm4
pxor   %xmm5,%xmm5
pinsrw $0x1,%r11d,%xmm5
pinsrw $0x3,%r9d,%xmm5
pinsrw $0x5,%r10d,%xmm5
paddd  %xmm0,%xmm4
pinsrw $0x7,%r12d,%xmm5
psrad  $0x18,%xmm5
jne    12ec <main+0x17c>
movdqa %xmm6,%xmm0
psubd  %xmm5,%xmm0
jmp    12f4 <main+0x184>
cmp    %rdi,%r8
mov    0x48(%rsp),%rbx
mov    0x28(%rsp),%r12
mov    0x8(%rsp),%r13
mov    0x3(%rsp),%r9b
je     1c7b <main+0xb0b>
test   $0x8,%dil
je     1bf0 <main+0xa80>
and    $0xfffffff8,%edi
mov    %r13,%r10
xor    %r13d,%r13d
movdqa 0x749(%rip),%xmm13
pxor   %xmm14,%xmm14
movdqa 0x74b(%rip),%xmm10
movdqa 0x752(%rip),%xmm8
movdqa 0x759(%rip),%xmm9
movdqa 0x760(%rip),%xmm15
movdqa 0x768(%rip),%xmm6
movdqa 0x76f(%rip),%xmm12
movdqa 0x786(%rip),%xmm11
mov    %rdi,0x20(%rsp)
mov    %rdi,%rax
jmp    1a6d <main+0x8fd>
paddd  %xmm13,%xmm3
movdqa %xmm3,%xmm0
paddd  %xmm0,%xmm2
paddd  %xmm13,%xmm2
paddd  %xmm13,%xmm7
pslld  $0x10,%xmm7
psrad  $0x10,%xmm7
pslld  $0x10,%xmm2
psrad  $0x10,%xmm2
packssdw %xmm2,%xmm7
movdqa %xmm7,%xmm2
pmulhw %xmm8,%xmm2
movdqa %xmm2,%xmm3
psrlw  $0xf,%xmm3
psraw  $0x3,%xmm2
paddw  %xmm3,%xmm2
pmullw %xmm9,%xmm2
psubw  %xmm2,%xmm7
punpcklwd %xmm7,%xmm1
psrad  $0x10,%xmm1
punpckhwd %xmm7,%xmm0
psrad  $0x10,%xmm0
movdqa %xmm0,%xmm3
pcmpgtd %xmm14,%xmm3
pand   %xmm0,%xmm3
movdqa %xmm1,%xmm2
pcmpgtd %xmm14,%xmm2
pand   %xmm1,%xmm2
psrlw  $0xf,%xmm7
movdqa %xmm7,%xmm5
punpcklwd %xmm14,%xmm5
punpckhwd %xmm14,%xmm7
movdqa %xmm7,%xmm4
paddd  %xmm0,%xmm4
psubd  %xmm4,%xmm3
movdqa %xmm5,%xmm4
paddd  %xmm1,%xmm4
psubd  %xmm4,%xmm2
pshufd $0xf5,%xmm3,%xmm4
pmuludq %xmm15,%xmm3
pshufd $0xed,%xmm3,%xmm3
pmuludq %xmm15,%xmm4
pshufd $0xed,%xmm4,%xmm4
punpckldq %xmm4,%xmm3
psrld  $0x3,%xmm3
pshufd $0xf5,%xmm2,%xmm4
pmuludq %xmm15,%xmm2
pshufd $0xed,%xmm2,%xmm2
pmuludq %xmm15,%xmm4
pshufd $0xed,%xmm4,%xmm4
punpckldq %xmm4,%xmm2
psrld  $0x3,%xmm2
paddd  %xmm5,%xmm2
paddd  %xmm7,%xmm3
pshufd $0xf5,%xmm3,%xmm4
pmuludq %xmm6,%xmm3
pshufd $0xe8,%xmm3,%xmm3
pmuludq %xmm6,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm3
pshufd $0xf5,%xmm2,%xmm4
pmuludq %xmm6,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm6,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm2
paddd  %xmm1,%xmm2
paddd  %xmm0,%xmm3
pand   %xmm12,%xmm3
pand   %xmm12,%xmm2
packuswb %xmm3,%xmm2
packuswb %xmm2,%xmm2
paddb  %xmm11,%xmm2
movq   %xmm2,(%r10,%r8,1)
add    $0x8,%r10
add    $0xfffffffffffffff8,%rax
add    $0x8,%r13
cmp    %rax,%r8
je     1bc2 <main+0xa52>
mov    %rax,0x10(%rsp)
lea    (%r8,%r13,1),%eax
lea    (%r8,%r13,1),%esi
add    $0x1,%esi
lea    0x4(%r13,%r8,1),%edi
lea    0x2(%r13,%r8,1),%ebx
lea    0x3(%r13,%r8,1),%ebp
lea    0x5(%r13,%r8,1),%ecx
lea    (%r8,%r13,1),%r11d
add    $0x6,%r11d
lea    (%r8,%r13,1),%r12d
add    $0x7,%r12d
cltd
idiv   %r15d
mov    %rdx,0x30(%rsp)
mov    %esi,%eax
cltd
idiv   %r15d
mov    %r9d,%r14d
mov    %edx,%r9d
mov    %ebx,%eax
cltd
idiv   %r15d
mov    %edx,%ebx
mov    %ebp,%eax
cltd
idiv   %r15d
mov    %edx,%esi
mov    %edi,%eax
cltd
idiv   %r15d
mov    %edx,%edi
mov    %ecx,%eax
cltd
idiv   %r15d
mov    %edx,%ecx
mov    %r11d,%eax
cltd
idiv   %r15d
mov    %edx,%ebp
mov    %r12d,%eax
mov    0x28(%rsp),%r12
cltd
idiv   %r15d
movzbl (%r12,%rdx,1),%r11d
shl    $0x8,%r11d
movzbl (%r12,%rbp,1),%edx
shl    $0x8,%edx
movzbl (%r12,%rcx,1),%ecx
shl    $0x8,%ecx
movzbl (%r12,%rdi,1),%edi
shl    $0x8,%edi
movzbl (%r12,%rsi,1),%esi
shl    $0x8,%esi
movzbl (%r12,%rbx,1),%ebp
shl    $0x8,%ebp
movzbl (%r12,%r9,1),%ebx
mov    %r14d,%r9d
shl    $0x8,%ebx
mov    0x30(%rsp),%rax
movzbl (%r12,%rax,1),%eax
shl    $0x8,%eax
pxor   %xmm2,%xmm2
pinsrw $0x1,%eax,%xmm2
pinsrw $0x3,%ebx,%xmm2
pinsrw $0x5,%ebp,%xmm2
pinsrw $0x7,%esi,%xmm2
psrad  $0x18,%xmm2
cmp    $0x64,%r14b
je     1b62 <main+0x9f2>
paddd  %xmm13,%xmm2
movdqa %xmm2,%xmm3
jmp    1b6b <main+0x9fb>
movdqa %xmm10,%xmm3
psubd  %xmm2,%xmm3
mov    0x10(%rsp),%rax
movq   (%r10,%r8,1),%xmm2
punpcklbw %xmm2,%xmm4
punpckhwd %xmm4,%xmm2
punpcklwd %xmm4,%xmm7
psrad  $0x18,%xmm7
paddd  %xmm3,%xmm7
pxor   %xmm3,%xmm3
pinsrw $0x1,%edi,%xmm3
pinsrw $0x3,%ecx,%xmm3
pinsrw $0x5,%edx,%xmm3
psrad  $0x18,%xmm2
pinsrw $0x7,%r11d,%xmm3
psrad  $0x18,%xmm3
jne    1907 <main+0x797>
movdqa %xmm10,%xmm0
psubd  %xmm3,%xmm0
jmp    1910 <main+0x7a0>
mov    0x20(%rsp),%rax
mov    %rax,%r8
mov    0x18(%rsp),%rdi
cmp    %rdi,%rax
mov    0x48(%rsp),%rbx
mov    0x8(%rsp),%r13
je     1c7b <main+0xb0b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r8d,%eax
cltd
idiv   %r15d
movsbl (%r12,%rdx,1),%eax
mov    $0x41,%ecx
sub    %eax,%ecx
add    $0xffbf,%eax
cmp    $0x64,%r9b
movsbl 0x0(%r13,%r8,1),%edx
cmove  %ecx,%eax
add    %edx,%eax
add    $0xffbf,%eax
movswl %ax,%ecx
imul   $0x4ec5,%ecx,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x13,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
movzwl %ax,%eax
movswl %ax,%ecx
test   %ecx,%ecx
mov    $0x0,%edx
cmovg  %ecx,%edx
shr    $0xf,%eax
sub    %eax,%edx
sub    %ecx,%edx
imul   $0x4ec4ec4f,%rdx,%rdx
shr    $0x23,%rdx
add    %eax,%edx
lea    (%rdx,%rdx,4),%eax
lea    (%rax,%rax,4),%eax
add    %edx,%eax
add    %ecx,%eax
add    $0x41,%al
mov    %al,0x0(%r13,%r8,1)
add    $0x1,%r8
cmp    %r8,%rdi
jne    1bf0 <main+0xa80>
mov    0x10(%rbx),%rdx
mov    0x18(%rbx),%rsi
lea    0x406(%rip),%rdi
xor    %ebx,%ebx
mov    %r13,%rcx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
jmp    1271 <main+0x101>

LLVM IR (-O0):
@.str = [56 x i8] c"Usage: vigenere -d[ecrypt]|-e[ncrypt] <Key> <Message>\0D\0A\00"
@.str.1 = [30 x i8] c"Please provide a valid key.\0D\0A\00"
@.str.2 = [62 x i8] c"Malloc failed. Please make sure enough memory is available.\0D\0A\00"
@.str.3 = [34 x i8] c"Please provide a valid message.\0D\0A\00"
@.str.4 = [45 x i8] c"Message does not contain valid characters!\0D\0A\00"
@.str.5 = [32 x i8] c"Input: %s\0D\0AKey: %s\0D\0AOutput:%s\0D\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 4
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %209
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @strlen(i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = icmp sle i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %18
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %209
27: ; preds = %18
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = mul i64 1, %29
%31 = trunc i64 %30 to i32
%32 = call i8* @malloc(i32 %31)
store i8* %32, i8** %7
%33 = load i8*, i8** %7
%34 = icmp ne i8* %33, null
br i1 %34, label %37, label %35
35: ; preds = %27
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %209
37: ; preds = %27
%38 = load i8*, i8** %7
%39 = load i32, i32* %6
%40 = call i32 @memset(i8* %38, i32 0, i32 %39)
%41 = load i8*, i8** %7
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
%45 = call i32 @strcpy(i8* %41, i8* %44)
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 3
%48 = load i8*, i8** %47
%49 = call i32 @strlen(i8* %48)
store i32 %49, i32* %8
%50 = load i32, i32* %8
%51 = icmp sle i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %37
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %209
54: ; preds = %37
%55 = load i32, i32* %8
%56 = sext i32 %55 to i64
%57 = mul i64 1, %56
%58 = trunc i64 %57 to i32
%59 = call i8* @malloc(i32 %58)
store i8* %59, i8** %9
%60 = load i8*, i8** %9
%61 = icmp ne i8* %60, null
br i1 %61, label %64, label %62
62: ; preds = %54
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %209
64: ; preds = %54
%65 = load i8*, i8** %9
%66 = load i32, i32* %8
%67 = call i32 @memset(i8* %65, i32 0, i32 %66)
%68 = load i8*, i8** %9
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 3
%71 = load i8*, i8** %70
%72 = call i32 @strcpy(i8* %68, i8* %71)
store i32 0, i32* %10
br label %73
73: ; preds = %141, %64
%74 = load i32, i32* %10
%75 = load i32, i32* %8
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %144
77: ; preds = %73
%78 = load i8*, i8** %9
%79 = load i32, i32* %10
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %78, i64 %80
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp slt i32 %83, 65
br i1 %84, label %109, label %85
85: ; preds = %77
%86 = load i8*, i8** %9
%87 = load i32, i32* %10
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %86, i64 %88
%90 = load i8, i8* %89
%91 = sext i8 %90 to i32
%92 = icmp sgt i32 %91, 90
br i1 %92, label %93, label %101
93: ; preds = %85
%94 = load i8*, i8** %9
%95 = load i32, i32* %10
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %94, i64 %96
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = icmp slt i32 %99, 97
br i1 %100, label %109, label %101
101: ; preds = %93, %85
%102 = load i8*, i8** %9
%103 = load i32, i32* %10
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %102, i64 %104
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp sgt i32 %107, 122
br i1 %108, label %109, label %111
109: ; preds = %101, %93, %77
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %209
111: ; preds = %101
%112 = load i8*, i8** %9
%113 = load i32, i32* %10
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i8, i8* %112, i64 %114
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = icmp sge i32 %117, 97
br i1 %118, label %119, label %140
119: ; preds = %111
%120 = load i8*, i8** %9
%121 = load i32, i32* %10
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8, i8* %120, i64 %122
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = icmp sle i32 %125, 122
br i1 %126, label %127, label %140
127: ; preds = %119
%128 = load i8*, i8** %9
%129 = load i32, i32* %10
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %128, i64 %130
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = sub nsw i32 %133, 32
%135 = trunc i32 %134 to i8
%136 = load i8*, i8** %9
%137 = load i32, i32* %10
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds i8, i8* %136, i64 %138
store i8 %135, i8* %139
br label %140
140: ; preds = %127, %119, %111
br label %141
141: ; preds = %140
%142 = load i32, i32* %10
%143 = add nsw i32 %142, 1
store i32 %143, i32* %10
br label %73
144: ; preds = %73
%145 = load i8**, i8*** %5
%146 = getelementptr inbounds i8*, i8** %145, i64 1
%147 = load i8*, i8** %146
%148 = getelementptr inbounds i8, i8* %147, i64 1
%149 = load i8, i8* %148
%150 = sext i8 %149 to i32
%151 = icmp eq i32 %150, 100
%152 = zext i1 %151 to i64
%153 = select i1 %151, i32 -1, i32 1
store i32 %153, i32* %12
store i32 0, i32* %13
store i32 0, i32* %11
br label %154
154: ; preds = %193, %144
%155 = load i32, i32* %11
%156 = load i32, i32* %8
%157 = icmp slt i32 %155, %156
br i1 %157, label %158, label %196
158: ; preds = %154
%159 = load i8*, i8** %9
%160 = load i32, i32* %11
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds i8, i8* %159, i64 %161
%163 = load i8, i8* %162
%164 = sext i8 %163 to i32
%165 = sub nsw i32 %164, 65
%166 = load i32, i32* %12
%167 = load i8*, i8** %7
%168 = load i32, i32* %11
%169 = load i32, i32* %6
%170 = srem i32 %168, %169
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i8, i8* %167, i64 %171
%173 = load i8, i8* %172
%174 = sext i8 %173 to i32
%175 = sub nsw i32 %174, 65
%176 = mul nsw i32 %166, %175
%177 = add nsw i32 %165, %176
%178 = srem i32 %177, 26
store i32 %178, i32* %13
br label %179
179: ; preds = %182, %158
%180 = load i32, i32* %13
%181 = icmp slt i32 %180, 0
br i1 %181, label %182, label %185
182: ; preds = %179
%183 = load i32, i32* %13
%184 = add nsw i32 %183, 26
store i32 %184, i32* %13
br label %179
185: ; preds = %179
%186 = load i32, i32* %13
%187 = add nsw i32 %186, 65
%188 = trunc i32 %187 to i8
%189 = load i8*, i8** %9
%190 = load i32, i32* %11
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds i8, i8* %189, i64 %191
store i8 %188, i8* %192
br label %193
193: ; preds = %185
%194 = load i32, i32* %11
%195 = add nsw i32 %194, 1
store i32 %195, i32* %11
br label %154
196: ; preds = %154
%197 = load i8**, i8*** %5
%198 = getelementptr inbounds i8*, i8** %197, i64 3
%199 = load i8*, i8** %198
%200 = load i8**, i8*** %5
%201 = getelementptr inbounds i8*, i8** %200, i64 2
%202 = load i8*, i8** %201
%203 = load i8*, i8** %9
%204 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %199, i8* %202, i8* %203)
%205 = load i8*, i8** %7
%206 = call i32 @free(i8* %205)
%207 = load i8*, i8** %9
%208 = call i32 @free(i8* %207)
br label %209
209: ; preds = %196, %109, %62, %52, %35, %25, %16
%210 = load i32, i32* %3
ret i32 %210
}

LLVM IR (-O2):
@.str.5 = [32 x i8] c"Input: %s\0D\0AKey: %s\0D\0AOutput:%s\0D\0A\00"
@str.6 = [61 x i8] c"Malloc failed. Please make sure enough memory is available.\0D\00"
@str.7 = [44 x i8] c"Message does not contain valid characters!\0D\00"
@str.8 = [33 x i8] c"Please provide a valid message.\0D\00"
@str.9 = [29 x i8] c"Please provide a valid key.\0D\00"
@str.10 = [55 x i8] c"Usage: vigenere -d[ecrypt]|-e[ncrypt] <Key> <Message>\0D\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.10, i64 0, i64 0))
br label %321
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @strlen(i8* %8)
%10 = icmp slt i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.9, i64 0, i64 0))
br label %321
13: ; preds = %6
%14 = tail call i8* @malloc(i32 %9)
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.6, i64 0, i64 0))
br label %321
18: ; preds = %13
%19 = tail call i32 @memset(i8* %14, i32 0, i32 %9)
%20 = load i8*, i8** %7
%21 = tail call i32 @strcpy(i8* %14, i8* %20)
%22 = getelementptr inbounds i8*, i8** %1, i64 3
%23 = load i8*, i8** %22
%24 = tail call i32 @strlen(i8* %23)
%25 = icmp slt i32 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %18
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.8, i64 0, i64 0))
br label %321
28: ; preds = %18
%29 = tail call i8* @malloc(i32 %24)
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.6, i64 0, i64 0))
br label %321
33: ; preds = %28
%34 = tail call i32 @memset(i8* %29, i32 0, i32 %24)
%35 = load i8*, i8** %22
%36 = tail call i32 @strcpy(i8* %29, i8* %35)
%37 = zext i32 %24 to i64
br label %38
38: ; preds = %33, %54
%39 = phi i64 [ 0, %33 ], [ %55, %54 ]
%40 = getelementptr inbounds i8, i8* %29, i64 %39
%41 = load i8, i8* %40
%42 = icmp slt i8 %41, 65
br i1 %42, label %48, label %43
43: ; preds = %38
%44 = add nsw i8 %41, -91
%45 = icmp ult i8 %44, 6
%46 = icmp ugt i8 %41, 122
%47 = or i1 %46, %45
br i1 %47, label %48, label %50
48: ; preds = %43, %38
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.7, i64 0, i64 0))
br label %321
50: ; preds = %43
%51 = icmp ugt i8 %41, 96
br i1 %51, label %52, label %54
52: ; preds = %50
%53 = add nsw i8 %41, -32
store i8 %53, i8* %40
br label %54
54: ; preds = %50, %52
%55 = add nuw nsw i64 %39, 1
%56 = icmp eq i64 %55, %37
br i1 %56, label %57, label %38
57: ; preds = %54
%58 = getelementptr inbounds i8*, i8** %1, i64 1
%59 = load i8*, i8** %58
%60 = getelementptr inbounds i8, i8* %59, i64 1
%61 = load i8, i8* %60
%62 = icmp eq i8 %61, 100
%63 = zext i32 %24 to i64
%64 = icmp ult i32 %24, 8
br i1 %64, label %281, label %65
65: ; preds = %57
%66 = icmp ult i32 %24, 16
br i1 %66, label %199, label %67
67: ; preds = %65
%68 = and i64 %37, 4294967280
br label %69
69: ; preds = %69, %67
%70 = phi i64 [ 0, %67 ], [ %192, %69 ]
%71 = trunc i64 %70 to i32
%72 = or i32 %71, 1
%73 = or i32 %71, 2
%74 = or i32 %71, 3
%75 = or i32 %71, 4
%76 = or i32 %71, 5
%77 = or i32 %71, 6
%78 = or i32 %71, 7
%79 = or i32 %71, 8
%80 = or i32 %71, 9
%81 = or i32 %71, 10
%82 = or i32 %71, 11
%83 = or i32 %71, 12
%84 = or i32 %71, 13
%85 = or i32 %71, 14
%86 = or i32 %71, 15
%87 = getelementptr inbounds i8, i8* %29, i64 %70
%88 = bitcast i8* %87 to <16 x i8>*
%89 = load <16 x i8>, <16 x i8>* %88
%90 = sext <16 x i8> %89 to <16 x i32>
%91 = add nsw <16 x i32> %90, <i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471>
%92 = srem i32 %71, %9
%93 = srem i32 %72, %9
%94 = srem i32 %73, %9
%95 = srem i32 %74, %9
%96 = srem i32 %75, %9
%97 = srem i32 %76, %9
%98 = srem i32 %77, %9
%99 = srem i32 %78, %9
%100 = srem i32 %79, %9
%101 = srem i32 %80, %9
%102 = srem i32 %81, %9
%103 = srem i32 %82, %9
%104 = srem i32 %83, %9
%105 = srem i32 %84, %9
%106 = srem i32 %85, %9
%107 = srem i32 %86, %9
%108 = zext i32 %92 to i64
%109 = zext i32 %93 to i64
%110 = zext i32 %94 to i64
%111 = zext i32 %95 to i64
%112 = zext i32 %96 to i64
%113 = zext i32 %97 to i64
%114 = zext i32 %98 to i64
%115 = zext i32 %99 to i64
%116 = zext i32 %100 to i64
%117 = zext i32 %101 to i64
%118 = zext i32 %102 to i64
%119 = zext i32 %103 to i64
%120 = zext i32 %104 to i64
%121 = zext i32 %105 to i64
%122 = zext i32 %106 to i64
%123 = zext i32 %107 to i64
%124 = getelementptr inbounds i8, i8* %14, i64 %108
%125 = getelementptr inbounds i8, i8* %14, i64 %109
%126 = getelementptr inbounds i8, i8* %14, i64 %110
%127 = getelementptr inbounds i8, i8* %14, i64 %111
%128 = getelementptr inbounds i8, i8* %14, i64 %112
%129 = getelementptr inbounds i8, i8* %14, i64 %113
%130 = getelementptr inbounds i8, i8* %14, i64 %114
%131 = getelementptr inbounds i8, i8* %14, i64 %115
%132 = getelementptr inbounds i8, i8* %14, i64 %116
%133 = getelementptr inbounds i8, i8* %14, i64 %117
%134 = getelementptr inbounds i8, i8* %14, i64 %118
%135 = getelementptr inbounds i8, i8* %14, i64 %119
%136 = getelementptr inbounds i8, i8* %14, i64 %120
%137 = getelementptr inbounds i8, i8* %14, i64 %121
%138 = getelementptr inbounds i8, i8* %14, i64 %122
%139 = getelementptr inbounds i8, i8* %14, i64 %123
%140 = load i8, i8* %124
%141 = load i8, i8* %125
%142 = load i8, i8* %126
%143 = load i8, i8* %127
%144 = load i8, i8* %128
%145 = load i8, i8* %129
%146 = load i8, i8* %130
%147 = load i8, i8* %131
%148 = load i8, i8* %132
%149 = load i8, i8* %133
%150 = load i8, i8* %134
%151 = load i8, i8* %135
%152 = load i8, i8* %136
%153 = load i8, i8* %137
%154 = load i8, i8* %138
%155 = load i8, i8* %139
%156 = insertelement <16 x i8> poison, i8 %140, i64 0
%157 = insertelement <16 x i8> %156, i8 %141, i64 1
%158 = insertelement <16 x i8> %157, i8 %142, i64 2
%159 = insertelement <16 x i8> %158, i8 %143, i64 3
%160 = insertelement <16 x i8> %159, i8 %144, i64 4
%161 = insertelement <16 x i8> %160, i8 %145, i64 5
%162 = insertelement <16 x i8> %161, i8 %146, i64 6
%163 = insertelement <16 x i8> %162, i8 %147, i64 7
%164 = insertelement <16 x i8> %163, i8 %148, i64 8
%165 = insertelement <16 x i8> %164, i8 %149, i64 9
%166 = insertelement <16 x i8> %165, i8 %150, i64 10
%167 = insertelement <16 x i8> %166, i8 %151, i64 11
%168 = insertelement <16 x i8> %167, i8 %152, i64 12
%169 = insertelement <16 x i8> %168, i8 %153, i64 13
%170 = insertelement <16 x i8> %169, i8 %154, i64 14
%171 = insertelement <16 x i8> %170, i8 %155, i64 15
%172 = sext <16 x i8> %171 to <16 x i32>
%173 = add nsw <16 x i32> %172, <i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471>
%174 = sub nsw <16 x i32> <i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65>, %172
%175 = select i1 %62, <16 x i32> %174, <16 x i32> %173
%176 = add nsw <16 x i32> %91, %175
%177 = trunc <16 x i32> %176 to <16 x i16>
%178 = srem <16 x i16> %177, <i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26>
%179 = sext <16 x i16> %178 to <16 x i32>
%180 = call <16 x i32> @llvm.smax.v16i32(<16 x i32> %179, <16 x i32> zeroinitializer)
%181 = lshr <16 x i16> %178, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
%182 = zext <16 x i16> %181 to <16 x i32>
%183 = add nsw <16 x i32> %182, %179
%184 = sub nsw <16 x i32> %180, %183
%185 = udiv <16 x i32> %184, <i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26>
%186 = add nuw nsw <16 x i32> %185, %182
%187 = mul <16 x i32> %186, <i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26>
%188 = add <16 x i32> %187, %179
%189 = trunc <16 x i32> %188 to <16 x i8>
%190 = add <16 x i8> %189, <i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65>
%191 = bitcast i8* %87 to <16 x i8>*
store <16 x i8> %190, <16 x i8>* %191
%192 = add nuw i64 %70, 16
%193 = icmp eq i64 %192, %68
br i1 %193, label %194, label %69
194: ; preds = %69
%195 = icmp eq i64 %68, %37
br i1 %195, label %315, label %196
196: ; preds = %194
%197 = and i64 %37, 8
%198 = icmp eq i64 %197, 0
br i1 %198, label %281, label %199
199: ; preds = %65, %196
%200 = phi i64 [ %68, %196 ], [ 0, %65 ]
%201 = and i64 %37, 4294967288
br label %202
202: ; preds = %202, %199
%203 = phi i64 [ %200, %199 ], [ %277, %202 ]
%204 = trunc i64 %203 to i32
%205 = or i32 %204, 1
%206 = or i32 %204, 2
%207 = or i32 %204, 3
%208 = or i32 %204, 4
%209 = or i32 %204, 5
%210 = or i32 %204, 6
%211 = or i32 %204, 7
%212 = getelementptr inbounds i8, i8* %29, i64 %203
%213 = bitcast i8* %212 to <8 x i8>*
%214 = load <8 x i8>, <8 x i8>* %213
%215 = sext <8 x i8> %214 to <8 x i32>
%216 = add nsw <8 x i32> %215, <i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471>
%217 = srem i32 %204, %9
%218 = srem i32 %205, %9
%219 = srem i32 %206, %9
%220 = srem i32 %207, %9
%221 = srem i32 %208, %9
%222 = srem i32 %209, %9
%223 = srem i32 %210, %9
%224 = srem i32 %211, %9
%225 = zext i32 %217 to i64
%226 = zext i32 %218 to i64
%227 = zext i32 %219 to i64
%228 = zext i32 %220 to i64
%229 = zext i32 %221 to i64
%230 = zext i32 %222 to i64
%231 = zext i32 %223 to i64
%232 = zext i32 %224 to i64
%233 = getelementptr inbounds i8, i8* %14, i64 %225
%234 = getelementptr inbounds i8, i8* %14, i64 %226
%235 = getelementptr inbounds i8, i8* %14, i64 %227
%236 = getelementptr inbounds i8, i8* %14, i64 %228
%237 = getelementptr inbounds i8, i8* %14, i64 %229
%238 = getelementptr inbounds i8, i8* %14, i64 %230
%239 = getelementptr inbounds i8, i8* %14, i64 %231
%240 = getelementptr inbounds i8, i8* %14, i64 %232
%241 = load i8, i8* %233
%242 = load i8, i8* %234
%243 = load i8, i8* %235
%244 = load i8, i8* %236
%245 = load i8, i8* %237
%246 = load i8, i8* %238
%247 = load i8, i8* %239
%248 = load i8, i8* %240
%249 = insertelement <8 x i8> poison, i8 %241, i64 0
%250 = insertelement <8 x i8> %249, i8 %242, i64 1
%251 = insertelement <8 x i8> %250, i8 %243, i64 2
%252 = insertelement <8 x i8> %251, i8 %244, i64 3
%253 = insertelement <8 x i8> %252, i8 %245, i64 4
%254 = insertelement <8 x i8> %253, i8 %246, i64 5
%255 = insertelement <8 x i8> %254, i8 %247, i64 6
%256 = insertelement <8 x i8> %255, i8 %248, i64 7
%257 = sext <8 x i8> %256 to <8 x i32>
%258 = add nsw <8 x i32> %257, <i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471, i32 65471>
%259 = sub nsw <8 x i32> <i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65, i32 65>, %257
%260 = select i1 %62, <8 x i32> %259, <8 x i32> %258
%261 = add nsw <8 x i32> %216, %260
%262 = trunc <8 x i32> %261 to <8 x i16>
%263 = srem <8 x i16> %262, <i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26, i16 26>
%264 = sext <8 x i16> %263 to <8 x i32>
%265 = call <8 x i32> @llvm.smax.v8i32(<8 x i32> %264, <8 x i32> zeroinitializer)
%266 = lshr <8 x i16> %263, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
%267 = zext <8 x i16> %266 to <8 x i32>
%268 = add nsw <8 x i32> %267, %264
%269 = sub nsw <8 x i32> %265, %268
%270 = udiv <8 x i32> %269, <i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26>
%271 = add nuw nsw <8 x i32> %270, %267
%272 = mul <8 x i32> %271, <i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26>
%273 = add <8 x i32> %272, %264
%274 = trunc <8 x i32> %273 to <8 x i8>
%275 = add <8 x i8> %274, <i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65, i8 65>
%276 = bitcast i8* %212 to <8 x i8>*
store <8 x i8> %275, <8 x i8>* %276
%277 = add nuw i64 %203, 8
%278 = icmp eq i64 %277, %201
br i1 %278, label %279, label %202
279: ; preds = %202
%280 = icmp eq i64 %201, %37
br i1 %280, label %315, label %281
281: ; preds = %57, %196, %279
%282 = phi i64 [ 0, %57 ], [ %68, %196 ], [ %201, %279 ]
br label %283
283: ; preds = %281, %283
%284 = phi i64 [ %313, %283 ], [ %282, %281 ]
%285 = getelementptr inbounds i8, i8* %29, i64 %284
%286 = load i8, i8* %285
%287 = sext i8 %286 to i32
%288 = add nsw i32 %287, 65471
%289 = trunc i64 %284 to i32
%290 = srem i32 %289, %9
%291 = zext i32 %290 to i64
%292 = getelementptr inbounds i8, i8* %14, i64 %291
%293 = load i8, i8* %292
%294 = sext i8 %293 to i32
%295 = add nsw i32 %294, 65471
%296 = sub nsw i32 65, %294
%297 = select i1 %62, i32 %296, i32 %295
%298 = add nsw i32 %288, %297
%299 = trunc i32 %298 to i16
%300 = srem i16 %299, 26
%301 = sext i16 %300 to i32
%302 = call i32 @llvm.smax.i32(i32 %301, i32 0)
%303 = lshr i16 %300, 15
%304 = zext i16 %303 to i32
%305 = add nsw i32 %304, %301
%306 = sub nsw i32 %302, %305
%307 = udiv i32 %306, 26
%308 = add nuw nsw i32 %307, %304
%309 = mul i32 %308, 26
%310 = add i32 %309, %301
%311 = trunc i32 %310 to i8
%312 = add i8 %311, 65
store i8 %312, i8* %285
%313 = add nuw nsw i64 %284, 1
%314 = icmp eq i64 %313, %63
br i1 %314, label %315, label %283
315: ; preds = %283, %279, %194
%316 = load i8*, i8** %22
%317 = load i8*, i8** %7
%318 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %316, i8* %317, i8* %29)
%319 = tail call i32 @free(i8* %14)
%320 = tail call i32 @free(i8* %29)
br label %321
321: ; preds = %11, %26, %48, %315, %31, %16, %4
%322 = phi i32 [ -1, %4 ], [ -1, %11 ], [ -1, %16 ], [ -1, %26 ], [ -1, %31 ], [ -1, %48 ], [ 0, %315 ]
ret i32 %322
}