#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ Rotate_Left(char *, int);
int /*<<< orphan*/ Rotate_Right(char *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, ...);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
char *strerror(int /*<<< orphan*/);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  FILE *inFile;
  char instructions[100][40];
  char *password, *line;
  char letter1, letter2, temp;
  int index1, index2, i, p, pwLen, inst;
  if (argc != 3) {
    fprintf(stderr, "Usage:\n\tDay21 <input filename> <password>\n\n");
    return EXIT_FAILURE;
  }
  inFile = fopen(argv[1], "r");
  if (inFile == NULL) {
    fprintf(stderr, "Error opening file: %s\n\n", strerror(errno));
    return EXIT_FAILURE;
  }
  password = argv[2];
  pwLen = strlen(password);
  inst = 0;
  while (fgets(instructions[inst], 40, inFile) != NULL) {
    inst++;
  }
  for (inst = 100 - 1; inst >= 0; inst--) {
    line = instructions[inst];
    if (strncmp(line, "swap", sizeof("swap") - 1) == 0) {
      if (strncmp(line + 5, "position", sizeof("position") - 1) == 0) {
        sscanf(line, "swap position %d with position %d", &index1, &index2);
        temp = password[index1];
        password[index1] = password[index2];
        password[index2] = temp;
      } else {
        sscanf(line, "swap letter %c with letter %c", &letter1, &letter2);
        for (i = 0; i < pwLen; i++) {
          if (password[i] == letter1)
            password[i] = letter2;
          else if (password[i] == letter2)
            password[i] = letter1;
        }
      }
    } else if (strncmp(line, "rotate", sizeof("rotate") - 1) == 0) {
      if (strncmp(line + 7, "based", sizeof("based") - 1) == 0) {
        sscanf(line, "rotate based on position of letter %c", &letter1);
        index1 = strchr(password, letter1) - password;
        const int newToOld[8] = {7, 0, 4, 1, 5, 2, 6, 3};
        index2 = newToOld[index1];
        if (index2 >= 4)
          index2 += 2;
        else
          index2 += 1;
        for (p = 0; p < index2; p++) {
          Rotate_Left(password, pwLen);
        }
      } else {
        if (strncmp(line + 7, "left", sizeof("left") - 1) == 0) {
          sscanf(line, "rotate left %d", &index1);
          for (p = 0; p < index1; p++) {
            Rotate_Right(password, pwLen);
          }
        } else {
          sscanf(line, "rotate right %d", &index1);
          for (p = 0; p < index1; p++) {
            Rotate_Left(password, pwLen);
          }
        }
      }
    } else if (strncmp(line, "reverse", sizeof("reverse") - 1) == 0) {
      sscanf(line, "reverse positions %d through %d", &index1, &index2);
      p = index2 - index1;
      for (i = 0; i <= p / 2; i++) {
        temp = password[index1 + i];
        password[index1 + i] = password[index2 - i];
        password[index2 - i] = temp;
      }
    } else if (strncmp(line, "move", sizeof("move") - 1) == 0) {
      sscanf(line, "move position %d to position %d", &index1, &index2);
      p = index1;
      index1 = index2;
      index2 = p;
      if (index1 > index2) {
        Rotate_Right(password + index2, index1 - index2 + 1);
      } else {
        Rotate_Left(password + index1, index2 - index1 + 1);
      }
    } else {
      fprintf(stderr, "Invalid instruction: %s\n", line);
      fclose(inFile);
      return EXIT_FAILURE;
    }
  }
  fclose(inFile);
  printf("Scrambled password: %s\n", password);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     120b <main+0x4b>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1959 <main+0x799>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe12(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1273 <main+0xb3>
mov    0x2dab(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1014(%rbp)
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x1014(%rbp),%edi
mov    %rax,%rdx
lea    0xdd3(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2d67(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1959 <main+0x799>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0xfc8(%rbp)
mov    -0xfc8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xfe8(%rbp)
movl   $0x0,-0xfec(%rbp)
movslq -0xfec(%rbp),%rax
lea    -0xfc0(%rbp),%rdi
imul   $0x28,%rax,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
mov    $0x28,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     12df <main+0x11f>
mov    -0xfec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfec(%rbp)
jmp    129e <main+0xde>
movl   $0x63,-0xfec(%rbp)
cmpl   $0x0,-0xfec(%rbp)
jl     1931 <main+0x771>
movslq -0xfec(%rbp),%rcx
lea    -0xfc0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0xfd0(%rbp)
mov    -0xfd0(%rbp),%rdi
lea    0xd27(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    14ae <main+0x2ee>
mov    -0xfd0(%rbp),%rdi
add    $0x5,%rdi
lea    0xd06(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    13d2 <main+0x212>
mov    -0xfd0(%rbp),%rdi
lea    0xced(%rip),%rsi
lea    -0xfd8(%rbp),%rdx
lea    -0xfdc(%rbp),%rcx
mov    $0x0,%al
call   10a0 <sscanf@plt>
mov    -0xfc8(%rbp),%rax
movslq -0xfd8(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xfd3(%rbp)
mov    -0xfc8(%rbp),%rax
movslq -0xfdc(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0xfc8(%rbp),%rax
movslq -0xfd8(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xfd3(%rbp),%dl
mov    -0xfc8(%rbp),%rax
movslq -0xfdc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    14a9 <main+0x2e9>
mov    -0xfd0(%rbp),%rdi
lea    0xc97(%rip),%rsi
lea    -0xfd1(%rbp),%rdx
lea    -0xfd2(%rbp),%rcx
mov    $0x0,%al
call   10a0 <sscanf@plt>
movl   $0x0,-0xfe0(%rbp)
mov    -0xfe0(%rbp),%eax
cmp    -0xfe8(%rbp),%eax
jge    14a4 <main+0x2e4>
mov    -0xfc8(%rbp),%rax
movslq -0xfe0(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0xfd1(%rbp),%ecx
cmp    %ecx,%eax
jne    144e <main+0x28e>
mov    -0xfd2(%rbp),%dl
mov    -0xfc8(%rbp),%rax
movslq -0xfe0(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    148b <main+0x2cb>
mov    -0xfc8(%rbp),%rax
movslq -0xfe0(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0xfd2(%rbp),%ecx
cmp    %ecx,%eax
jne    1486 <main+0x2c6>
mov    -0xfd1(%rbp),%dl
mov    -0xfc8(%rbp),%rax
movslq -0xfe0(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    148b <main+0x2cb>
jmp    1490 <main+0x2d0>
mov    -0xfe0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfe0(%rbp)
jmp    13ff <main+0x23f>
jmp    14a9 <main+0x2e9>
jmp    1918 <main+0x758>
mov    -0xfd0(%rbp),%rdi
lea    0xbd9(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    16ee <main+0x52e>
mov    -0xfd0(%rbp),%rdi
add    $0x7,%rdi
lea    0xbba(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    15f8 <main+0x438>
mov    -0xfd0(%rbp),%rdi
lea    0xb9e(%rip),%rsi
lea    -0xfd1(%rbp),%rdx
mov    $0x0,%al
call   10a0 <sscanf@plt>
mov    -0xfc8(%rbp),%rdi
movsbl -0xfd1(%rbp),%esi
call   1060 <strchr@plt>
mov    -0xfc8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0xfd8(%rbp)
mov    0xc34(%rip),%rax
mov    %rax,-0x1010(%rbp)
mov    0xc2e(%rip),%rax
mov    %rax,-0x1008(%rbp)
mov    0xc28(%rip),%rax
mov    %rax,-0x1000(%rbp)
mov    0xc22(%rip),%rax
mov    %rax,-0xff8(%rbp)
movslq -0xfd8(%rbp),%rax
mov    -0x1010(%rbp,%rax,4),%eax
mov    %eax,-0xfdc(%rbp)
cmpl   $0x4,-0xfdc(%rbp)
jl     15a2 <main+0x3e2>
mov    -0xfdc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xfdc(%rbp)
jmp    15b1 <main+0x3f1>
mov    -0xfdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfdc(%rbp)
movl   $0x0,-0xfe4(%rbp)
mov    -0xfe4(%rbp),%eax
cmp    -0xfdc(%rbp),%eax
jge    15f3 <main+0x433>
mov    -0xfc8(%rbp),%rdi
mov    -0xfe8(%rbp),%esi
call   10b0 <Rotate_Left@plt>
mov    -0xfe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfe4(%rbp)
jmp    15bb <main+0x3fb>
jmp    16e9 <main+0x529>
mov    -0xfd0(%rbp),%rdi
add    $0x7,%rdi
lea    0xabe(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1681 <main+0x4c1>
mov    -0xfd0(%rbp),%rdi
lea    0xaa1(%rip),%rsi
lea    -0xfd8(%rbp),%rdx
mov    $0x0,%al
call   10a0 <sscanf@plt>
movl   $0x0,-0xfe4(%rbp)
mov    -0xfe4(%rbp),%eax
cmp    -0xfd8(%rbp),%eax
jge    167c <main+0x4bc>
mov    -0xfc8(%rbp),%rdi
mov    -0xfe8(%rbp),%esi
call   10c0 <Rotate_Right@plt>
mov    -0xfe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfe4(%rbp)
jmp    1644 <main+0x484>
jmp    16e4 <main+0x524>
mov    -0xfd0(%rbp),%rdi
lea    0xa4d(%rip),%rsi
lea    -0xfd8(%rbp),%rdx
mov    $0x0,%al
call   10a0 <sscanf@plt>
movl   $0x0,-0xfe4(%rbp)
mov    -0xfe4(%rbp),%eax
cmp    -0xfd8(%rbp),%eax
jge    16df <main+0x51f>
mov    -0xfc8(%rbp),%rdi
mov    -0xfe8(%rbp),%esi
call   10b0 <Rotate_Left@plt>
mov    -0xfe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfe4(%rbp)
jmp    16a7 <main+0x4e7>
jmp    16e4 <main+0x524>
jmp    16e9 <main+0x529>
jmp    1913 <main+0x753>
mov    -0xfd0(%rbp),%rdi
lea    0x9f0(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1802 <main+0x642>
mov    -0xfd0(%rbp),%rdi
lea    0x9d6(%rip),%rsi
lea    -0xfd8(%rbp),%rdx
lea    -0xfdc(%rbp),%rcx
mov    $0x0,%al
call   10a0 <sscanf@plt>
mov    -0xfdc(%rbp),%eax
sub    -0xfd8(%rbp),%eax
mov    %eax,-0xfe4(%rbp)
movl   $0x0,-0xfe0(%rbp)
mov    -0xfe0(%rbp),%eax
mov    %eax,-0x1018(%rbp)
mov    -0xfe4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1018(%rbp),%eax
cmp    %ecx,%eax
jg     17fd <main+0x63d>
mov    -0xfc8(%rbp),%rax
mov    -0xfd8(%rbp),%ecx
add    -0xfe0(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xfd3(%rbp)
mov    -0xfc8(%rbp),%rax
mov    -0xfdc(%rbp),%ecx
sub    -0xfe0(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0xfc8(%rbp),%rax
mov    -0xfd8(%rbp),%ecx
add    -0xfe0(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xfd3(%rbp),%dl
mov    -0xfc8(%rbp),%rax
mov    -0xfdc(%rbp),%ecx
sub    -0xfe0(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xfe0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfe0(%rbp)
jmp    174f <main+0x58f>
jmp    190e <main+0x74e>
mov    -0xfd0(%rbp),%rdi
lea    0x904(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    18d1 <main+0x711>
mov    -0xfd0(%rbp),%rdi
lea    0x8e7(%rip),%rsi
lea    -0xfd8(%rbp),%rdx
lea    -0xfdc(%rbp),%rcx
mov    $0x0,%al
call   10a0 <sscanf@plt>
mov    -0xfd8(%rbp),%eax
mov    %eax,-0xfe4(%rbp)
mov    -0xfdc(%rbp),%eax
mov    %eax,-0xfd8(%rbp)
mov    -0xfe4(%rbp),%eax
mov    %eax,-0xfdc(%rbp)
mov    -0xfd8(%rbp),%eax
cmp    -0xfdc(%rbp),%eax
jle    18a7 <main+0x6e7>
mov    -0xfc8(%rbp),%rdi
movslq -0xfdc(%rbp),%rax
add    %rax,%rdi
mov    -0xfd8(%rbp),%esi
sub    -0xfdc(%rbp),%esi
add    $0x1,%esi
call   10c0 <Rotate_Right@plt>
jmp    18cc <main+0x70c>
mov    -0xfc8(%rbp),%rdi
movslq -0xfd8(%rbp),%rax
add    %rax,%rdi
mov    -0xfdc(%rbp),%esi
sub    -0xfd8(%rbp),%esi
add    $0x1,%esi
call   10b0 <Rotate_Left@plt>
jmp    1909 <main+0x749>
mov    0x2708(%rip),%rax
mov    (%rax),%edi
mov    -0xfd0(%rbp),%rdx
lea    0x851(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x26d1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1959 <main+0x799>
jmp    190e <main+0x74e>
jmp    1913 <main+0x753>
jmp    1918 <main+0x758>
jmp    191d <main+0x75d>
mov    -0xfec(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xfec(%rbp)
jmp    12e9 <main+0x129>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0xfc8(%rbp),%rsi
lea    0x80a(%rip),%rdi
call   1070 <printf@plt>
mov    0x2674(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xfe8,%rsp
cmp    $0x3,%edi
jne    17b2 <main+0x5f2>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe44(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     17ed <main+0x62d>
mov    %rax,%r14
mov    0x10(%rbx),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,%r15d
lea    0x40(%rsp),%rbx
nopl   (%rax)
mov    %rbx,%rdi
mov    $0x28,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
add    $0x28,%rbx
test   %rax,%rax
jne    1210 <main+0x50>
mov    %r14,0x20(%rsp)
mov    %r15d,%esi
lea    (%rsi,%rbp,1),%rax
lea    0xb(%rsp),%rcx
lea    0xc(%rsp),%rdx
cmp    %rcx,%rbp
setb   %cl
lea    0xa(%rsp),%rdi
cmp    %rax,%rdi
setb   %bl
and    %cl,%bl
cmp    %rdx,%rbp
setb   %cl
lea    0xb(%rsp),%rdx
cmp    %rax,%rdx
setb   %al
and    %cl,%al
or     %bl,%al
mov    %al,0x17(%rsp)
mov    %esi,%eax
and    $0xfffffff8,%eax
mov    %rax,0x30(%rsp)
mov    %rsi,0x18(%rsp)
neg    %rsi
mov    %rsi,0x38(%rsp)
lea    0x1(%rbp),%r14
lea    -0x1(%rbp),%rax
mov    %rax,0x28(%rsp)
mov    $0x63,%r13d
jmp    12da <main+0x11a>
lea    0xdb7(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
xor    %eax,%eax
call   10a0 <sscanf@plt>
movslq 0xc(%rsp),%rax
mov    0x0(%rbp,%rax,1),%cl
movslq 0x10(%rsp),%rdx
mov    0x0(%rbp,%rdx,1),%dl
mov    %dl,0x0(%rbp,%rax,1)
movslq 0x10(%rsp),%rax
mov    %cl,0x0(%rbp,%rax,1)
xchg   %ax,%ax
sub    $0x1,%r13
jb     17cb <main+0x60b>
lea    0x0(,%r13,4),%rbx
add    %r13,%rbx
lea    0x40(%rsp,%rbx,8),%r12
mov    %r12,%rdi
lea    0xd53(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     13b0 <main+0x1f0>
mov    %r12,%rdi
lea    0xd84(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1410 <main+0x250>
mov    %r12,%rdi
lea    0xdbe(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1499 <main+0x2d9>
mov    %r12,%rdi
lea    0xdc9(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1819 <main+0x659>
mov    %r12,%rdi
lea    0xdb1(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
xor    %eax,%eax
call   10a0 <sscanf@plt>
movslq 0xc(%rsp),%rsi
movslq 0x10(%rsp),%rax
mov    %eax,0xc(%rsp)
mov    %esi,0x10(%rsp)
cmp    %esi,%eax
jle    1531 <main+0x371>
mov    %rsi,%rdi
add    %rbp,%rdi
sub    %esi,%eax
add    $0x1,%eax
mov    %eax,%esi
call   10c0 <Rotate_Right@plt>
jmp    12d0 <main+0x110>
nopw   0x0(%rax,%rax,1)
lea    (%rsp,%rbx,8),%rdi
add    $0x45,%rdi
lea    0xc8d(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
mov    %r12,%rdi
test   %rax,%rax
je     1297 <main+0xd7>
lea    0xc9b(%rip),%rsi
lea    0xa(%rsp),%rdx
lea    0xb(%rsp),%rcx
xor    %eax,%eax
call   10a0 <sscanf@plt>
test   %r15d,%r15d
jle    12d0 <main+0x110>
cmp    $0x8,%r15d
setb   %al
or     0x17(%rsp),%al
je     15b9 <main+0x3f9>
xor    %ecx,%ecx
jmp    16e2 <main+0x522>
xchg   %ax,%ax
lea    (%rsp,%rbx,8),%rbx
add    $0x47,%rbx
mov    %rbx,%rdi
lea    0xc7a(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1546 <main+0x386>
mov    %rbx,%rdi
lea    0xc89(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
mov    %r12,%rdi
test   %rax,%rax
je     1700 <main+0x540>
lea    0xc80(%rip),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   10a0 <sscanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    12d0 <main+0x110>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbp,%rdi
mov    %r15d,%esi
call   10b0 <Rotate_Left@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1480 <main+0x2c0>
jmp    12d0 <main+0x110>
mov    %r12,%rdi
lea    0xc51(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
xor    %eax,%eax
call   10a0 <sscanf@plt>
movslq 0x10(%rsp),%rax
movslq 0xc(%rsp),%rdx
mov    %eax,%ecx
sub    %edx,%ecx
cmp    $0xffffffff,%ecx
jl     12d0 <main+0x110>
mov    0x0(%rbp,%rdx,1),%bl
mov    0x0(%rbp,%rax,1),%al
mov    %al,0x0(%rbp,%rdx,1)
movslq 0x10(%rsp),%rax
mov    %bl,0x0(%rbp,%rax,1)
lea    0x1(%rcx),%eax
cmp    $0x3,%eax
jb     12d0 <main+0x110>
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
mov    0x28(%rsp),%rcx
mov    %r14,%rdx
nopl   (%rax)
movslq 0xc(%rsp),%rsi
movslq 0x10(%rsp),%rdi
movzbl (%rdx,%rsi,1),%r8d
movzbl (%rcx,%rdi,1),%ebx
mov    %bl,(%rdx,%rsi,1)
movslq 0x10(%rsp),%rsi
mov    %r8b,(%rcx,%rsi,1)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rcx
add    $0xffffffff,%eax
jne    1500 <main+0x340>
jmp    12d0 <main+0x110>
mov    %rax,%rdi
add    %rbp,%rdi
sub    %eax,%esi
add    $0x1,%esi
call   10b0 <Rotate_Left@plt>
jmp    12d0 <main+0x110>
mov    %r12,%rdi
lea    0xb52(%rip),%rsi
lea    0xa(%rsp),%rdx
xor    %eax,%eax
call   10a0 <sscanf@plt>
movsbl 0xa(%rsp),%esi
mov    %rbp,%rdi
call   1060 <strchr@plt>
sub    %rbp,%rax
movslq %eax,%rcx
lea    0xbfa(%rip),%rdx
mov    (%rdx,%rcx,4),%ecx
mov    $0x55,%edx
bt     %rax,%rdx
adc    $0xffffffff,%ecx
mov    %eax,0xc(%rsp)
add    $0x2,%ecx
mov    %ecx,0x10(%rsp)
test   %ecx,%ecx
jle    12d0 <main+0x110>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r15d,%esi
call   10b0 <Rotate_Left@plt>
add    $0x1,%ebx
cmp    0x10(%rsp),%ebx
jl     15a0 <main+0x3e0>
jmp    12d0 <main+0x110>
movzbl 0xa(%rsp),%eax
movd   %eax,%xmm0
punpcklbw %xmm0,%xmm0
pshuflw $0x0,%xmm0,%xmm0
movzbl 0xb(%rsp),%eax
movd   %eax,%xmm1
punpcklbw %xmm1,%xmm1
pshuflw $0x0,%xmm1,%xmm1
xor    %eax,%eax
mov    0x30(%rsp),%rsi
jmp    15fd <main+0x43d>
cs nopw 0x0(%rax,%rax,1)
add    $0x8,%rax
cmp    %rax,%rsi
je     16d4 <main+0x514>
movq   0x0(%rbp,%rax,1),%xmm4
movdqa %xmm4,%xmm2
pcmpeqb %xmm0,%xmm2
punpcklbw %xmm2,%xmm5
pcmpeqb %xmm1,%xmm4
punpcklbw %xmm4,%xmm3
por    %xmm5,%xmm3
pandn  %xmm4,%xmm2
movdqa %xmm0,%xmm4
pand   %xmm2,%xmm4
pandn  %xmm1,%xmm2
por    %xmm4,%xmm2
psraw  $0x8,%xmm3
movd   %xmm3,%ecx
test   $0x1,%cl
je     1645 <main+0x485>
movd   %xmm2,%edx
mov    %dl,0x0(%rbp,%rax,1)
shr    $0x10,%ecx
test   $0x1,%cl
je     1655 <main+0x495>
movd   %xmm2,%ecx
mov    %ch,0x1(%rbp,%rax,1)
pextrw $0x2,%xmm3,%ecx
test   $0x1,%cl
je     166a <main+0x4aa>
movd   %xmm2,%ecx
shr    $0x10,%ecx
mov    %cl,0x2(%rbp,%rax,1)
pextrw $0x3,%xmm3,%ecx
test   $0x1,%cl
je     167f <main+0x4bf>
movd   %xmm2,%ecx
shr    $0x18,%ecx
mov    %cl,0x3(%rbp,%rax,1)
pextrw $0x4,%xmm3,%ecx
test   $0x1,%cl
je     1692 <main+0x4d2>
pextrw $0x2,%xmm2,%ecx
mov    %cl,0x4(%rbp,%rax,1)
pextrw $0x5,%xmm3,%ecx
test   $0x1,%cl
je     16a5 <main+0x4e5>
pextrw $0x2,%xmm2,%ecx
mov    %ch,0x5(%rbp,%rax,1)
pextrw $0x6,%xmm3,%ecx
test   $0x1,%cl
je     16b8 <main+0x4f8>
pextrw $0x3,%xmm2,%ecx
mov    %cl,0x6(%rbp,%rax,1)
pextrw $0x7,%xmm3,%ecx
test   $0x1,%cl
je     15f0 <main+0x430>
pextrw $0x3,%xmm2,%ecx
mov    %ch,0x7(%rbp,%rax,1)
jmp    15f0 <main+0x430>
mov    %rsi,%rcx
cmp    0x18(%rsp),%rsi
je     12d0 <main+0x110>
mov    %rcx,%rax
testb  $0x1,0x18(%rsp)
je     1748 <main+0x588>
mov    0x0(%rbp,%rcx,1),%dl
mov    0xa(%rsp),%al
mov    0xb(%rsp),%bl
cmp    %al,%dl
jne    1739 <main+0x579>
mov    %ebx,%eax
jmp    173d <main+0x57d>
lea    0x9c6(%rip),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   10a0 <sscanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    12d0 <main+0x110>
xor    %ebx,%ebx
mov    %rbp,%rdi
mov    %r15d,%esi
call   10c0 <Rotate_Right@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1720 <main+0x560>
jmp    12d0 <main+0x110>
cmp    %bl,%dl
jne    1741 <main+0x581>
mov    %al,0x0(%rbp,%rcx,1)
mov    %rcx,%rax
or     $0x1,%rax
not    %rcx
cmp    0x38(%rsp),%rcx
jne    1775 <main+0x5b5>
jmp    12d0 <main+0x110>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%ecx
mov    %cl,(%r14,%rax,1)
add    $0x2,%rax
cmp    %rax,0x18(%rsp)
je     12d0 <main+0x110>
movzbl -0x1(%r14,%rax,1),%edx
movzbl 0xa(%rsp),%ecx
movzbl 0xb(%rsp),%ebx
cmp    %cl,%dl
jne    1790 <main+0x5d0>
mov    %ebx,%ecx
jmp    1794 <main+0x5d4>
nopl   (%rax)
cmp    %bl,%dl
jne    1799 <main+0x5d9>
mov    %cl,-0x1(%r14,%rax,1)
movzbl (%r14,%rax,1),%edx
movzbl 0xa(%rsp),%ecx
movzbl 0xb(%rsp),%ebx
cmp    %cl,%dl
je     1760 <main+0x5a0>
cmp    %bl,%dl
je     1762 <main+0x5a2>
jmp    1766 <main+0x5a6>
mov    0x2827(%rip),%rax
mov    (%rax),%edi
lea    0x83e(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    183d <main+0x67d>
mov    0x20(%rsp),%rdi
call   1040 <fclose@plt>
lea    0x976(%rip),%rdi
mov    %rbp,%rsi
call   1070 <printf@plt>
mov    0x27dd(%rip),%rax
jmp    1844 <main+0x684>
mov    0x27ec(%rip),%rax
mov    (%rax),%ebx
mov    0x27db(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0x823(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    183d <main+0x67d>
mov    0x27c0(%rip),%rax
mov    (%rax),%edi
lea    0x910(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x20(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x278c(%rip),%rax
mov    (%rax),%eax
add    $0xfe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"Usage:\0A\09Day21 <input filename> <password>\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [25 x i8] c"Error opening file: %s\0A\0A\00"
@errno = global i32 0
@.str.3 = [5 x i8] c"swap\00"
@.str.4 = [9 x i8] c"position\00"
@.str.5 = [34 x i8] c"swap position %d with position %d\00"
@.str.6 = [30 x i8] c"swap letter %c with letter %c\00"
@.str.7 = [7 x i8] c"rotate\00"
@.str.8 = [6 x i8] c"based\00"
@.str.9 = [38 x i8] c"rotate based on position of letter %c\00"
@__const.main.newToOld = [8 x i32] [i32 7, i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3]
@.str.10 = [5 x i8] c"left\00"
@.str.11 = [15 x i8] c"rotate left %d\00"
@.str.12 = [16 x i8] c"rotate right %d\00"
@.str.13 = [8 x i8] c"reverse\00"
@.str.14 = [32 x i8] c"reverse positions %d through %d\00"
@.str.15 = [5 x i8] c"move\00"
@.str.16 = [32 x i8] c"move position %d to position %d\00"
@.str.17 = [25 x i8] c"Invalid instruction: %s\0A\00"
@.str.18 = [24 x i8] c"Scrambled password: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [100 x [40 x i8]]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca [8 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 3
br i1 %21, label %22, label %26
22: ; preds = %2
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
store i32 %25, i32* %3
br label %325
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %30, i32** %6
%31 = load i32*, i32** %6
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %39
33: ; preds = %26
%34 = load i32, i32* @stderr
%35 = load i32, i32* @errno
%36 = call i8* @strerror(i32 %35)
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %36)
%38 = load i32, i32* @EXIT_FAILURE
store i32 %38, i32* %3
br label %325
39: ; preds = %26
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
store i8* %42, i8** %8
%43 = load i8*, i8** %8
%44 = call i32 @strlen(i8* %43)
store i32 %44, i32* %17
store i32 0, i32* %18
br label %45
45: ; preds = %53, %39
%46 = load i32, i32* %18
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [100 x [40 x i8]], [100 x [40 x i8]]* %7, i64 0, i64 %47
%49 = getelementptr inbounds [40 x i8], [40 x i8]* %48, i64 0, i64 0
%50 = load i32*, i32** %6
%51 = call i32* @fgets(i8* %49, i32 40, i32* %50)
%52 = icmp ne i32* %51, null
br i1 %52, label %53, label %56
53: ; preds = %45
%54 = load i32, i32* %18
%55 = add nsw i32 %54, 1
store i32 %55, i32* %18
br label %45
56: ; preds = %45
store i32 99, i32* %18
br label %57
57: ; preds = %316, %56
%58 = load i32, i32* %18
%59 = icmp sge i32 %58, 0
br i1 %59, label %60, label %319
60: ; preds = %57
%61 = load i32, i32* %18
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [100 x [40 x i8]], [100 x [40 x i8]]* %7, i64 0, i64 %62
%64 = getelementptr inbounds [40 x i8], [40 x i8]* %63, i64 0, i64 0
store i8* %64, i8** %9
%65 = load i8*, i8** %9
%66 = call i64 @strncmp(i8* %65, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %141
68: ; preds = %60
%69 = load i8*, i8** %9
%70 = getelementptr inbounds i8, i8* %69, i64 5
%71 = call i64 @strncmp(i8* %70, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 8)
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %95
73: ; preds = %68
%74 = load i8*, i8** %9
%75 = call i32 (i8*, i8*, ...) @sscanf(i8* %74, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i32* %13, i32* %14)
%76 = load i8*, i8** %8
%77 = load i32, i32* %13
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %76, i64 %78
%80 = load i8, i8* %79
store i8 %80, i8* %12
%81 = load i8*, i8** %8
%82 = load i32, i32* %14
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %81, i64 %83
%85 = load i8, i8* %84
%86 = load i8*, i8** %8
%87 = load i32, i32* %13
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %86, i64 %88
store i8 %85, i8* %89
%90 = load i8, i8* %12
%91 = load i8*, i8** %8
%92 = load i32, i32* %14
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %91, i64 %93
store i8 %90, i8* %94
br label %140
95: ; preds = %68
%96 = load i8*, i8** %9
%97 = call i32 (i8*, i8*, ...) @sscanf(i8* %96, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* %10, i8* %11)
store i32 0, i32* %15
br label %98
98: ; preds = %136, %95
%99 = load i32, i32* %15
%100 = load i32, i32* %17
%101 = icmp slt i32 %99, %100
br i1 %101, label %102, label %139
102: ; preds = %98
%103 = load i8*, i8** %8
%104 = load i32, i32* %15
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i8, i8* %103, i64 %105
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = load i8, i8* %10
%110 = sext i8 %109 to i32
%111 = icmp eq i32 %108, %110
br i1 %111, label %112, label %118
112: ; preds = %102
%113 = load i8, i8* %11
%114 = load i8*, i8** %8
%115 = load i32, i32* %15
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i8, i8* %114, i64 %116
store i8 %113, i8* %117
br label %135
118: ; preds = %102
%119 = load i8*, i8** %8
%120 = load i32, i32* %15
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds i8, i8* %119, i64 %121
%123 = load i8, i8* %122
%124 = sext i8 %123 to i32
%125 = load i8, i8* %11
%126 = sext i8 %125 to i32
%127 = icmp eq i32 %124, %126
br i1 %127, label %128, label %134
128: ; preds = %118
%129 = load i8, i8* %10
%130 = load i8*, i8** %8
%131 = load i32, i32* %15
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i8, i8* %130, i64 %132
store i8 %129, i8* %133
br label %134
134: ; preds = %128, %118
br label %135
135: ; preds = %134, %112
br label %136
136: ; preds = %135
%137 = load i32, i32* %15
%138 = add nsw i32 %137, 1
store i32 %138, i32* %15
br label %98
139: ; preds = %98
br label %140
140: ; preds = %139, %73
br label %315
141: ; preds = %60
%142 = load i8*, i8** %9
%143 = call i64 @strncmp(i8* %142, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 6)
%144 = icmp eq i64 %143, 0
br i1 %144, label %145, label %224
145: ; preds = %141
%146 = load i8*, i8** %9
%147 = getelementptr inbounds i8, i8* %146, i64 7
%148 = call i64 @strncmp(i8* %147, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 5)
%149 = icmp eq i64 %148, 0
br i1 %149, label %150, label %187
150: ; preds = %145
%151 = load i8*, i8** %9
%152 = call i32 (i8*, i8*, ...) @sscanf(i8* %151, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i8* %10)
%153 = load i8*, i8** %8
%154 = load i8, i8* %10
%155 = call i8* @strchr(i8* %153, i8 signext %154)
%156 = load i8*, i8** %8
%157 = ptrtoint i8* %155 to i64
%158 = ptrtoint i8* %156 to i64
%159 = sub i64 %157, %158
%160 = trunc i64 %159 to i32
store i32 %160, i32* %13
%161 = bitcast [8 x i32]* %19 to i8*
%162 = load i32, i32* %13
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds [8 x i32], [8 x i32]* %19, i64 0, i64 %163
%165 = load i32, i32* %164
store i32 %165, i32* %14
%166 = load i32, i32* %14
%167 = icmp sge i32 %166, 4
br i1 %167, label %168, label %171
168: ; preds = %150
%169 = load i32, i32* %14
%170 = add nsw i32 %169, 2
store i32 %170, i32* %14
br label %174
171: ; preds = %150
%172 = load i32, i32* %14
%173 = add nsw i32 %172, 1
store i32 %173, i32* %14
br label %174
174: ; preds = %171, %168
store i32 0, i32* %16
br label %175
175: ; preds = %183, %174
%176 = load i32, i32* %16
%177 = load i32, i32* %14
%178 = icmp slt i32 %176, %177
br i1 %178, label %179, label %186
179: ; preds = %175
%180 = load i8*, i8** %8
%181 = load i32, i32* %17
%182 = call i32 @Rotate_Left(i8* %180, i32 %181)
br label %183
183: ; preds = %179
%184 = load i32, i32* %16
%185 = add nsw i32 %184, 1
store i32 %185, i32* %16
br label %175
186: ; preds = %175
br label %223
187: ; preds = %145
%188 = load i8*, i8** %9
%189 = getelementptr inbounds i8, i8* %188, i64 7
%190 = call i64 @strncmp(i8* %189, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%191 = icmp eq i64 %190, 0
br i1 %191, label %192, label %207
192: ; preds = %187
%193 = load i8*, i8** %9
%194 = call i32 (i8*, i8*, ...) @sscanf(i8* %193, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i32* %13)
store i32 0, i32* %16
br label %195
195: ; preds = %203, %192
%196 = load i32, i32* %16
%197 = load i32, i32* %13
%198 = icmp slt i32 %196, %197
br i1 %198, label %199, label %206
199: ; preds = %195
%200 = load i8*, i8** %8
%201 = load i32, i32* %17
%202 = call i32 @Rotate_Right(i8* %200, i32 %201)
br label %203
203: ; preds = %199
%204 = load i32, i32* %16
%205 = add nsw i32 %204, 1
store i32 %205, i32* %16
br label %195
206: ; preds = %195
br label %222
207: ; preds = %187
%208 = load i8*, i8** %9
%209 = call i32 (i8*, i8*, ...) @sscanf(i8* %208, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32* %13)
store i32 0, i32* %16
br label %210
210: ; preds = %218, %207
%211 = load i32, i32* %16
%212 = load i32, i32* %13
%213 = icmp slt i32 %211, %212
br i1 %213, label %214, label %221
214: ; preds = %210
%215 = load i8*, i8** %8
%216 = load i32, i32* %17
%217 = call i32 @Rotate_Left(i8* %215, i32 %216)
br label %218
218: ; preds = %214
%219 = load i32, i32* %16
%220 = add nsw i32 %219, 1
store i32 %220, i32* %16
br label %210
221: ; preds = %210
br label %222
222: ; preds = %221, %206
br label %223
223: ; preds = %222, %186
br label %314
224: ; preds = %141
%225 = load i8*, i8** %9
%226 = call i64 @strncmp(i8* %225, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i32 7)
%227 = icmp eq i64 %226, 0
br i1 %227, label %228, label %271
228: ; preds = %224
%229 = load i8*, i8** %9
%230 = call i32 (i8*, i8*, ...) @sscanf(i8* %229, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0), i32* %13, i32* %14)
%231 = load i32, i32* %14
%232 = load i32, i32* %13
%233 = sub nsw i32 %231, %232
store i32 %233, i32* %16
store i32 0, i32* %15
br label %234
234: ; preds = %267, %228
%235 = load i32, i32* %15
%236 = load i32, i32* %16
%237 = sdiv i32 %236, 2
%238 = icmp sle i32 %235, %237
br i1 %238, label %239, label %270
239: ; preds = %234
%240 = load i8*, i8** %8
%241 = load i32, i32* %13
%242 = load i32, i32* %15
%243 = add nsw i32 %241, %242
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds i8, i8* %240, i64 %244
%246 = load i8, i8* %245
store i8 %246, i8* %12
%247 = load i8*, i8** %8
%248 = load i32, i32* %14
%249 = load i32, i32* %15
%250 = sub nsw i32 %248, %249
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds i8, i8* %247, i64 %251
%253 = load i8, i8* %252
%254 = load i8*, i8** %8
%255 = load i32, i32* %13
%256 = load i32, i32* %15
%257 = add nsw i32 %255, %256
%258 = sext i32 %257 to i64
%259 = getelementptr inbounds i8, i8* %254, i64 %258
store i8 %253, i8* %259
%260 = load i8, i8* %12
%261 = load i8*, i8** %8
%262 = load i32, i32* %14
%263 = load i32, i32* %15
%264 = sub nsw i32 %262, %263
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds i8, i8* %261, i64 %265
store i8 %260, i8* %266
br label %267
267: ; preds = %239
%268 = load i32, i32* %15
%269 = add nsw i32 %268, 1
store i32 %269, i32* %15
br label %234
270: ; preds = %234
br label %313
271: ; preds = %224
%272 = load i8*, i8** %9
%273 = call i64 @strncmp(i8* %272, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 4)
%274 = icmp eq i64 %273, 0
br i1 %274, label %275, label %305
275: ; preds = %271
%276 = load i8*, i8** %9
%277 = call i32 (i8*, i8*, ...) @sscanf(i8* %276, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.16, i64 0, i64 0), i32* %13, i32* %14)
%278 = load i32, i32* %13
store i32 %278, i32* %16
%279 = load i32, i32* %14
store i32 %279, i32* %13
%280 = load i32, i32* %16
store i32 %280, i32* %14
%281 = load i32, i32* %13
%282 = load i32, i32* %14
%283 = icmp sgt i32 %281, %282
br i1 %283, label %284, label %294
284: ; preds = %275
%285 = load i8*, i8** %8
%286 = load i32, i32* %14
%287 = sext i32 %286 to i64
%288 = getelementptr inbounds i8, i8* %285, i64 %287
%289 = load i32, i32* %13
%290 = load i32, i32* %14
%291 = sub nsw i32 %289, %290
%292 = add nsw i32 %291, 1
%293 = call i32 @Rotate_Right(i8* %288, i32 %292)
br label %304
294: ; preds = %275
%295 = load i8*, i8** %8
%296 = load i32, i32* %13
%297 = sext i32 %296 to i64
%298 = getelementptr inbounds i8, i8* %295, i64 %297
%299 = load i32, i32* %14
%300 = load i32, i32* %13
%301 = sub nsw i32 %299, %300
%302 = add nsw i32 %301, 1
%303 = call i32 @Rotate_Left(i8* %298, i32 %302)
br label %304
304: ; preds = %294, %284
br label %312
305: ; preds = %271
%306 = load i32, i32* @stderr
%307 = load i8*, i8** %9
%308 = call i32 (i32, i8*, ...) @fprintf(i32 %306, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0), i8* %307)
%309 = load i32*, i32** %6
%310 = call i32 @fclose(i32* %309)
%311 = load i32, i32* @EXIT_FAILURE
store i32 %311, i32* %3
br label %325
312: ; preds = %304
br label %313
313: ; preds = %312, %270
br label %314
314: ; preds = %313, %223
br label %315
315: ; preds = %314, %140
br label %316
316: ; preds = %315
%317 = load i32, i32* %18
%318 = add nsw i32 %317, -1
store i32 %318, i32* %18
br label %57
319: ; preds = %57
%320 = load i32*, i32** %6
%321 = call i32 @fclose(i32* %320)
%322 = load i8*, i8** %8
%323 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i8* %322)
%324 = load i32, i32* @EXIT_SUCCESS
store i32 %324, i32* %3
br label %325
325: ; preds = %319, %305, %33, %22
%326 = load i32, i32* %3
ret i32 %326
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"Usage:\0A\09Day21 <input filename> <password>\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [25 x i8] c"Error opening file: %s\0A\0A\00"
@errno = global i32 0
@.str.3 = [5 x i8] c"swap\00"
@.str.4 = [9 x i8] c"position\00"
@.str.5 = [34 x i8] c"swap position %d with position %d\00"
@.str.6 = [30 x i8] c"swap letter %c with letter %c\00"
@.str.7 = [7 x i8] c"rotate\00"
@.str.8 = [6 x i8] c"based\00"
@.str.9 = [38 x i8] c"rotate based on position of letter %c\00"
@__const.main.newToOld = [8 x i32] [i32 7, i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3]
@.str.10 = [5 x i8] c"left\00"
@.str.11 = [15 x i8] c"rotate left %d\00"
@.str.12 = [16 x i8] c"rotate right %d\00"
@.str.13 = [8 x i8] c"reverse\00"
@.str.14 = [32 x i8] c"reverse positions %d through %d\00"
@.str.15 = [5 x i8] c"move\00"
@.str.16 = [32 x i8] c"move position %d to position %d\00"
@.str.17 = [25 x i8] c"Invalid instruction: %s\0A\00"
@.str.18 = [24 x i8] c"Scrambled password: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x [40 x i8]]
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = getelementptr inbounds [100 x [40 x i8]], [100 x [40 x i8]]* %3, i64 0, i64 0, i64 0
%9 = bitcast i32* %6 to i8*
%10 = bitcast i32* %7 to i8*
%11 = icmp eq i32 %0, 3
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %315
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %25
20: ; preds = %15
%21 = load i32, i32* @stderr
%22 = load i32, i32* @errno
%23 = tail call i8* @strerror(i32 %22)
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %23)
br label %315
25: ; preds = %15
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = tail call i32 @strlen(i8* %27)
br label %29
29: ; preds = %29, %25
%30 = phi i64 [ %34, %29 ], [ 0, %25 ]
%31 = getelementptr inbounds [100 x [40 x i8]], [100 x [40 x i8]]* %3, i64 0, i64 %30, i64 0
%32 = call i32* @fgets(i8* %31, i32 40, i32* %18)
%33 = icmp eq i32* %32, null
%34 = add nuw i64 %30, 1
br i1 %33, label %35, label %29
35: ; preds = %29
%36 = ptrtoint i8* %27 to i64
%37 = icmp sgt i32 %28, 0
%38 = zext i32 %28 to i64
%39 = getelementptr i8, i8* %27, i64 %38
%40 = getelementptr inbounds i8, i8* %4, i64 1
%41 = getelementptr inbounds i8, i8* %5, i64 1
%42 = icmp ult i32 %28, 8
%43 = icmp ult i8* %27, %40
%44 = icmp ult i8* %4, %39
%45 = and i1 %43, %44
%46 = icmp ult i8* %27, %41
%47 = icmp ult i8* %5, %39
%48 = and i1 %46, %47
%49 = or i1 %45, %48
%50 = and i64 %38, 4294967288
%51 = icmp eq i64 %50, %38
%52 = and i64 %38, 1
%53 = icmp eq i64 %52, 0
%54 = sub nsw i64 0, %38
br label %55
55: ; preds = %35, %309
%56 = phi i64 [ 99, %35 ], [ %310, %309 ]
%57 = getelementptr inbounds [100 x [40 x i8]], [100 x [40 x i8]]* %3, i64 0, i64 %56, i64 0
%58 = call i64 @strncmp(i8* %57, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %192
60: ; preds = %55
%61 = getelementptr inbounds [100 x [40 x i8]], [100 x [40 x i8]]* %3, i64 0, i64 %56, i64 5
%62 = call i64 @strncmp(i8* %61, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 8)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %77
64: ; preds = %60
%65 = call i32 (i8*, i8*, ...) @sscanf(i8* %57, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i32* %6, i32* %7)
%66 = load i32, i32* %6
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %27, i64 %67
%69 = load i8, i8* %68
%70 = load i32, i32* %7
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %27, i64 %71
%73 = load i8, i8* %72
store i8 %73, i8* %68
%74 = load i32, i32* %7
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %27, i64 %75
store i8 %69, i8* %76
br label %309
77: ; preds = %60
%78 = call i32 (i8*, i8*, ...) @sscanf(i8* %57, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* %4, i8* %5)
br i1 %37, label %79, label %309
79: ; preds = %77
%80 = select i1 %42, i1 true, i1 %49
br i1 %80, label %149, label %81
81: ; preds = %79
%82 = load i8, i8* %4
%83 = insertelement <8 x i8> poison, i8 %82, i64 0
%84 = shufflevector <8 x i8> %83, <8 x i8> poison, <8 x i32> zeroinitializer
%85 = load i8, i8* %5
%86 = insertelement <8 x i8> poison, i8 %85, i64 0
%87 = shufflevector <8 x i8> %86, <8 x i8> poison, <8 x i32> zeroinitializer
br label %88
88: ; preds = %145, %81
%89 = phi i64 [ 0, %81 ], [ %146, %145 ]
%90 = getelementptr inbounds i8, i8* %27, i64 %89
%91 = bitcast i8* %90 to <8 x i8>*
%92 = load <8 x i8>, <8 x i8>* %91
%93 = icmp eq <8 x i8> %92, %84
%94 = icmp eq <8 x i8> %92, %87
%95 = xor <8 x i1> %93, <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>
%96 = select <8 x i1> %95, <8 x i1> %94, <8 x i1> zeroinitializer
%97 = select <8 x i1> %96, <8 x i8> %84, <8 x i8> %87
%98 = or <8 x i1> %96, %93
%99 = extractelement <8 x i1> %98, i64 0
br i1 %99, label %100, label %103
100: ; preds = %88
%101 = getelementptr inbounds i8, i8* %27, i64 %89
%102 = extractelement <8 x i8> %97, i64 0
store i8 %102, i8* %101
br label %103
103: ; preds = %100, %88
%104 = extractelement <8 x i1> %98, i64 1
br i1 %104, label %105, label %109
105: ; preds = %103
%106 = or i64 %89, 1
%107 = getelementptr inbounds i8, i8* %27, i64 %106
%108 = extractelement <8 x i8> %97, i64 1
store i8 %108, i8* %107
br label %109
109: ; preds = %105, %103
%110 = extractelement <8 x i1> %98, i64 2
br i1 %110, label %111, label %115
111: ; preds = %109
%112 = or i64 %89, 2
%113 = getelementptr inbounds i8, i8* %27, i64 %112
%114 = extractelement <8 x i8> %97, i64 2
store i8 %114, i8* %113
br label %115
115: ; preds = %111, %109
%116 = extractelement <8 x i1> %98, i64 3
br i1 %116, label %117, label %121
117: ; preds = %115
%118 = or i64 %89, 3
%119 = getelementptr inbounds i8, i8* %27, i64 %118
%120 = extractelement <8 x i8> %97, i64 3
store i8 %120, i8* %119
br label %121
121: ; preds = %117, %115
%122 = extractelement <8 x i1> %98, i64 4
br i1 %122, label %123, label %127
123: ; preds = %121
%124 = or i64 %89, 4
%125 = getelementptr inbounds i8, i8* %27, i64 %124
%126 = extractelement <8 x i8> %97, i64 4
store i8 %126, i8* %125
br label %127
127: ; preds = %123, %121
%128 = extractelement <8 x i1> %98, i64 5
br i1 %128, label %129, label %133
129: ; preds = %127
%130 = or i64 %89, 5
%131 = getelementptr inbounds i8, i8* %27, i64 %130
%132 = extractelement <8 x i8> %97, i64 5
store i8 %132, i8* %131
br label %133
133: ; preds = %129, %127
%134 = extractelement <8 x i1> %98, i64 6
br i1 %134, label %135, label %139
135: ; preds = %133
%136 = or i64 %89, 6
%137 = getelementptr inbounds i8, i8* %27, i64 %136
%138 = extractelement <8 x i8> %97, i64 6
store i8 %138, i8* %137
br label %139
139: ; preds = %135, %133
%140 = extractelement <8 x i1> %98, i64 7
br i1 %140, label %141, label %145
141: ; preds = %139
%142 = or i64 %89, 7
%143 = getelementptr inbounds i8, i8* %27, i64 %142
%144 = extractelement <8 x i8> %97, i64 7
store i8 %144, i8* %143
br label %145
145: ; preds = %141, %139
%146 = add nuw i64 %89, 8
%147 = icmp eq i64 %146, %50
br i1 %147, label %148, label %88
148: ; preds = %145
br i1 %51, label %309, label %149
149: ; preds = %79, %148
%150 = phi i64 [ 0, %79 ], [ %50, %148 ]
%151 = xor i64 %150, -1
br i1 %53, label %164, label %152
152: ; preds = %149
%153 = getelementptr inbounds i8, i8* %27, i64 %150
%154 = load i8, i8* %153
%155 = load i8, i8* %4
%156 = icmp eq i8 %154, %155
%157 = load i8, i8* %5
br i1 %156, label %160, label %158
158: ; preds = %152
%159 = icmp eq i8 %154, %157
br i1 %159, label %160, label %162
160: ; preds = %158, %152
%161 = phi i8 [ %157, %152 ], [ %155, %158 ]
store i8 %161, i8* %153
br label %162
162: ; preds = %160, %158
%163 = or i64 %150, 1
br label %164
164: ; preds = %162, %149
%165 = phi i64 [ %150, %149 ], [ %163, %162 ]
%166 = icmp eq i64 %151, %54
br i1 %166, label %309, label %167
167: ; preds = %164, %189
%168 = phi i64 [ %190, %189 ], [ %165, %164 ]
%169 = getelementptr inbounds i8, i8* %27, i64 %168
%170 = load i8, i8* %169
%171 = load i8, i8* %4
%172 = icmp eq i8 %170, %171
%173 = load i8, i8* %5
br i1 %172, label %176, label %174
174: ; preds = %167
%175 = icmp eq i8 %170, %173
br i1 %175, label %176, label %178
176: ; preds = %174, %167
%177 = phi i8 [ %173, %167 ], [ %171, %174 ]
store i8 %177, i8* %169
br label %178
178: ; preds = %176, %174
%179 = add nuw nsw i64 %168, 1
%180 = getelementptr inbounds i8, i8* %27, i64 %179
%181 = load i8, i8* %180
%182 = load i8, i8* %4
%183 = icmp eq i8 %181, %182
%184 = load i8, i8* %5
br i1 %183, label %187, label %185
185: ; preds = %178
%186 = icmp eq i8 %181, %184
br i1 %186, label %187, label %189
187: ; preds = %185, %178
%188 = phi i8 [ %184, %178 ], [ %182, %185 ]
store i8 %188, i8* %180
br label %189
189: ; preds = %187, %185
%190 = add nuw nsw i64 %168, 2
%191 = icmp eq i64 %190, %38
br i1 %191, label %309, label %167
192: ; preds = %55
%193 = call i64 @strncmp(i8* %57, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 6)
%194 = icmp eq i64 %193, 0
br i1 %194, label %195, label %245
195: ; preds = %192
%196 = getelementptr inbounds [100 x [40 x i8]], [100 x [40 x i8]]* %3, i64 0, i64 %56, i64 7
%197 = call i64 @strncmp(i8* %196, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 5)
%198 = icmp eq i64 %197, 0
br i1 %198, label %199, label %222
199: ; preds = %195
%200 = call i32 (i8*, i8*, ...) @sscanf(i8* %57, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i8* %4)
%201 = load i8, i8* %4
%202 = call i8* @strchr(i8* dereferenceable(1) %27, i8 signext %201)
%203 = ptrtoint i8* %202 to i64
%204 = sub i64 %203, %36
%205 = trunc i64 %204 to i32
store i32 %205, i32* %6
%206 = shl i64 %204, 32
%207 = ashr exact i64 %206, 32
%208 = getelementptr inbounds [8 x i32], [8 x i32]* @__const.main.newToOld, i64 0, i64 %207
%209 = load i32, i32* %208
%210 = lshr i64 85, %207
%211 = and i64 %210, 1
%212 = icmp eq i64 %211, 0
%213 = select i1 %212, i32 1, i32 2
%214 = add nsw i32 %213, %209
store i32 %214, i32* %7
%215 = icmp sgt i32 %214, 0
br i1 %215, label %216, label %309
216: ; preds = %199, %216
%217 = phi i32 [ %219, %216 ], [ 0, %199 ]
%218 = call i32 @Rotate_Left(i8* %27, i32 %28)
%219 = add nuw nsw i32 %217, 1
%220 = load i32, i32* %7
%221 = icmp slt i32 %219, %220
br i1 %221, label %216, label %309
222: ; preds = %195
%223 = call i64 @strncmp(i8* %196, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%224 = icmp eq i64 %223, 0
br i1 %224, label %225, label %235
225: ; preds = %222
%226 = call i32 (i8*, i8*, ...) @sscanf(i8* %57, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i32* %6)
%227 = load i32, i32* %6
%228 = icmp sgt i32 %227, 0
br i1 %228, label %229, label %309
229: ; preds = %225, %229
%230 = phi i32 [ %232, %229 ], [ 0, %225 ]
%231 = call i32 @Rotate_Right(i8* %27, i32 %28)
%232 = add nuw nsw i32 %230, 1
%233 = load i32, i32* %6
%234 = icmp slt i32 %232, %233
br i1 %234, label %229, label %309
235: ; preds = %222
%236 = call i32 (i8*, i8*, ...) @sscanf(i8* %57, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32* %6)
%237 = load i32, i32* %6
%238 = icmp sgt i32 %237, 0
br i1 %238, label %239, label %309
239: ; preds = %235, %239
%240 = phi i32 [ %242, %239 ], [ 0, %235 ]
%241 = call i32 @Rotate_Left(i8* %27, i32 %28)
%242 = add nuw nsw i32 %240, 1
%243 = load i32, i32* %6
%244 = icmp slt i32 %242, %243
br i1 %244, label %239, label %309
245: ; preds = %192
%246 = call i64 @strncmp(i8* %57, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i32 7)
%247 = icmp eq i64 %246, 0
br i1 %247, label %248, label %285
248: ; preds = %245
%249 = call i32 (i8*, i8*, ...) @sscanf(i8* %57, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0), i32* %6, i32* %7)
%250 = load i32, i32* %7
%251 = load i32, i32* %6
%252 = sub nsw i32 %250, %251
%253 = icmp slt i32 %252, -1
br i1 %253, label %309, label %254
254: ; preds = %248
%255 = sdiv i32 %252, 2
%256 = sext i32 %251 to i64
%257 = getelementptr inbounds i8, i8* %27, i64 %256
%258 = load i8, i8* %257
%259 = sext i32 %250 to i64
%260 = getelementptr inbounds i8, i8* %27, i64 %259
%261 = load i8, i8* %260
store i8 %261, i8* %257
%262 = load i32, i32* %7
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds i8, i8* %27, i64 %263
store i8 %258, i8* %264
%265 = add i32 %252, 1
%266 = icmp ult i32 %265, 3
br i1 %266, label %309, label %267
267: ; preds = %254, %267
%268 = phi i32 [ %269, %267 ], [ 0, %254 ]
%269 = add nuw nsw i32 %268, 1
%270 = load i32, i32* %6
%271 = load i32, i32* %7
%272 = add nsw i32 %270, %269
%273 = sext i32 %272 to i64
%274 = getelementptr inbounds i8, i8* %27, i64 %273
%275 = load i8, i8* %274
%276 = sub nsw i32 %271, %269
%277 = sext i32 %276 to i64
%278 = getelementptr inbounds i8, i8* %27, i64 %277
%279 = load i8, i8* %278
store i8 %279, i8* %274
%280 = load i32, i32* %7
%281 = sub nsw i32 %280, %269
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds i8, i8* %27, i64 %282
store i8 %275, i8* %283
%284 = icmp eq i32 %269, %255
br i1 %284, label %309, label %267
285: ; preds = %245
%286 = call i64 @strncmp(i8* %57, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 4)
%287 = icmp eq i64 %286, 0
br i1 %287, label %288, label %305
288: ; preds = %285
%289 = call i32 (i8*, i8*, ...) @sscanf(i8* %57, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.16, i64 0, i64 0), i32* %6, i32* %7)
%290 = load i32, i32* %6
%291 = load i32, i32* %7
store i32 %291, i32* %6
store i32 %290, i32* %7
%292 = icmp sgt i32 %291, %290
br i1 %292, label %293, label %299
293: ; preds = %288
%294 = sext i32 %290 to i64
%295 = getelementptr inbounds i8, i8* %27, i64 %294
%296 = sub i32 1, %290
%297 = add i32 %296, %291
%298 = call i32 @Rotate_Right(i8* %295, i32 %297)
br label %309
299: ; preds = %288
%300 = sext i32 %291 to i64
%301 = getelementptr inbounds i8, i8* %27, i64 %300
%302 = add i32 %290, 1
%303 = sub i32 %302, %291
%304 = call i32 @Rotate_Left(i8* %301, i32 %303)
br label %309
305: ; preds = %285
%306 = load i32, i32* @stderr
%307 = call i32 (i32, i8*, ...) @fprintf(i32 %306, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0), i8* %57)
%308 = call i32 @fclose(i32* %18)
br label %315
309: ; preds = %267, %239, %229, %216, %164, %189, %254, %148, %248, %235, %225, %199, %77, %64, %293, %299
%310 = add nsw i64 %56, -1
%311 = icmp eq i64 %56, 0
br i1 %311, label %312, label %55
312: ; preds = %309
%313 = call i32 @fclose(i32* %18)
%314 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i8* %27)
br label %315
315: ; preds = %312, %305, %20, %12
%316 = phi i32* [ @EXIT_FAILURE, %12 ], [ @EXIT_FAILURE, %20 ], [ @EXIT_FAILURE, %305 ], [ @EXIT_SUCCESS, %312 ]
%317 = load i32, i32* %316
ret i32 %317
}