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

/* Variables and functions */
unsigned char answer_1(int);
unsigned char answer_10(unsigned char *);
unsigned char answer_2(int);
unsigned char answer_3(unsigned char, int);
unsigned char answer_4(unsigned char, int);
unsigned char answer_5(unsigned char);
unsigned char answer_6(unsigned char, int);
unsigned char answer_7(unsigned char, int);
unsigned char answer_8(unsigned char, int, int);
unsigned char answer_9(int);
int /*<<< orphan*/ print_heading(char, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  time_t t;
  srand((unsigned)time(&t));
  print_heading('~', NULL, 0);
  print_heading('~', "Playing with bits and bytes", (79 - 27) / 2);
  print_heading('~', NULL, 0);
  printf("\n");
  int n, m;
  unsigned char b, *b_p, ex_uc, ac_uc;
  bool failed[10];
  for (int i = 0; i < 10; i++) {
    switch (i) {
    case 0:
      print_heading('.', "|PROBLEM 1|", 5);
      printf(
          "'answer_1()' receives a bit number. Return a byte with the "
          "corresponding bit\nset, and all other bits cleared.\nTesting...\n");
      for (int ii = 0; ii < 50; ii++) {
        n = rand() % 8;
        ex_uc = (1 << n);
        ac_uc = answer_1(n);
        failed[i] = !(ex_uc == ac_uc);
        if (failed[i]) {
          break;
        }
      }
      printf("Expected return:\t0x%02X\t\tActual return:\t0x%02X\t\t%s\n",
             ex_uc, ac_uc, failed[i] ? "FAILED!" : "PASSED!");
      break;
    case 1:
      print_heading('.', "|PROBLEM 2|", 5);
      printf(
          "'answer_2()' receives a bit number. Return a byte with the "
          "corresponding bit\ncleared, and all other bits set.\nTesting...\n");
      for (int ii = 0; ii < 50; ii++) {
        n = rand() % 8;
        ex_uc = ~(1 << n);
        ac_uc = answer_2(n);
        failed[i] = !(ex_uc == ac_uc);
        if (failed[i]) {
          break;
        }
      }
      printf("Expected return:\t0x%02X\t\tActual return:\t0x%02X\t\t%s\n",
             ex_uc, ac_uc, failed[i] ? "FAILED!" : "PASSED!");
      break;
    case 2:
      print_heading('.', "|PROBLEM 3|", 5);
      printf("'answer_3()' receives a byte and bit number. Return the same "
             "byte with the\ncorresponding bit set, and all other bits "
             "unchanged.\nTesting...\n");
      for (int ii = 0; ii < 50; ii++) {
        n = rand() % 8;
        b = rand() % 256;
        ex_uc = b | (1 << n);
        ac_uc = answer_3(b, n);
        failed[i] = !(ex_uc == ac_uc);
        if (failed[i]) {
          break;
        }
      }
      printf("Expected return:\t0x%02X\t\tActual return:\t0x%02X\t\t%s\n",
             ex_uc, ac_uc, failed[i] ? "FAILED!" : "PASSED!");
      break;
    case 3:
      print_heading('.', "|PROBLEM 4|", 5);
      printf("'answer_4()' receives a byte and bit number. Return the same "
             "byte with the\ncorresponding bit cleared, and all other bits "
             "unchanged.\nTesting...\n");
      for (int ii = 0; ii < 50; ii++) {
        n = rand() % 8;
        b = rand() % 256;
        ex_uc = b & ~(1 << n);
        ac_uc = answer_4(b, n);
        failed[i] = !(ex_uc == ac_uc);
        if (failed[i]) {
          break;
        }
      }
      printf("Expected return:\t0x%02X\t\tActual return:\t0x%02X\t\t%s\n",
             ex_uc, ac_uc, failed[i] ? "FAILED!" : "PASSED!");
      break;
    case 4:
      print_heading('.', "|PROBLEM 5|", 5);
      printf("'answer_5()' receives a byte. Return the byte with all 8 bits "
             "toggled.\nTesting...\n");
      for (int ii = 0; ii < 50; ii++) {
        b = rand() % 256;
        ex_uc = ~b;
        ac_uc = answer_5(b);
        failed[i] = !(ex_uc == ac_uc);
        if (failed[i]) {
          break;
        }
      }
      printf("Expected return:\t0x%02X\t\tActual return:\t0x%02X\t\t%s\n",
             ex_uc, ac_uc, failed[i] ? "FAILED!" : "PASSED!");
      break;
    case 5:
      print_heading('.', "|PROBLEM 6|", 5);
      printf("'answer_6()' receives a byte and bit number. Return the same "
             "byte with the\ncorresponding bit toggled, and all other bits "
             "unchanged.\nTesting...\n");
      for (int ii = 0; ii < 50; ii++) {
        n = rand() % 8;
        b = rand() % 256;
        ex_uc = b ^ (1 << n);
        ac_uc = answer_6(b, n);
        failed[i] = !(ex_uc == ac_uc);
        if (failed[i]) {
          break;
        }
      }
      printf("Expected return:\t0x%02X\t\tActual return:\t0x%02X\t\t%s\n",
             ex_uc, ac_uc, failed[i] ? "FAILED!" : "PASSED!");
      break;
    case 6:
      print_heading('.', "|PROBLEM 7|", 5);
      printf("'answer_7()' receives a byte and bit number. Return the value "
             "(set or unset)\nof the corresponding bit.\nTesting...\n");
      for (int ii = 0; ii < 50; ii++) {
        n = rand() % 8;
        b = rand() % 256;
        ex_uc = (b >> n) & 1;
        ac_uc = answer_7(b, n);
        failed[i] = !(ex_uc == ac_uc);
        if (failed[i]) {
          break;
        }
      }
      printf("Expected return:\t%d\t\t\tActual return:\t%d\t\t\t%s\n", ex_uc,
             ac_uc, failed[i] ? "FAILED!" : "PASSED!");
      break;
    case 7:
      print_heading('.', "|PROBLEM 8|", 5);
      printf("'answer_8()' receives a byte and two bit numbers. Set the bit "
             "corresponding\nto the first bit number, toggle every bit in the "
             "byte, then return the value of\nthe bit corresponding to the "
             "second bit number.\nTesting...\n");
      for (int ii = 0; ii < 50; ii++) {
        n = rand() % 8;
        m = rand() % 8;
        b = rand() % 256;
        ex_uc = (~(b | (1 << n)) >> m) & 1;
        ac_uc = answer_8(b, n, m);
        failed[i] = !(ex_uc == ac_uc);
        if (failed[i]) {
          break;
        }
      }
      printf("Expected return:\t%d\t\t\tActual return:\t%d\t\t\t%s\n", ex_uc,
             ac_uc, failed[i] ? "FAILED!" : "PASSED!");
      break;
    case 8:
      print_heading('.', "|PROBLEM 9|", 5);
      printf("'answer_9()' receives a bit number. Return a byte with every bit "
             "up to\nand including that bit number set, with all other bits "
             "cleared.\nTesting...\n");
      for (int ii = 0; ii < 50; ii++) {
        n = rand() % 8;
        ex_uc = ~(~0 << (n + 1));
        ac_uc = answer_9(n);
        failed[i] = !(ex_uc == ac_uc);
        if (failed[i]) {
          break;
        }
      }
      printf("Expected return:\t0x%02X\t\tActual return:\t0x%02X\t\t%s\n",
             ex_uc, ac_uc, failed[i] ? "FAILED!" : "PASSED!");
      break;
    case 9:
      print_heading('.', "|PROBLEM 10|", 5);
      printf("'answer_10()' receives a pointer to a byte. Return the data in "
             "the two most\nsignificant bits of that byte.\nTesting...\n");
      for (int ii = 0; ii < 50; ii++) {
        b = rand() % 256;
        b_p = &b;
        ex_uc = (*b_p & 0xC0) >> 6;
        ac_uc = answer_10(b_p);
        failed[i] = !(ex_uc == ac_uc);
        if (failed[i]) {
          break;
        }
      }
      printf("Expected return:\t0x%02X\t\tActual return:\t0x%02X\t\t%s\n",
             ex_uc, ac_uc, failed[i] ? "FAILED!" : "PASSED!");
      break;
    default:
      return -1;
    }
    print_heading('.', NULL, 0);
    printf("\n\n");
  }
  int total = 0;
  for (int i = 0; i < 10; i++) {
    total += failed[i] ? 0 : 1;
  }
  char buff[80];
  print_heading('~', NULL, 0);
  sprintf(buff, "Your total score for the problems was: %.2d / %.2d", total,
          10);
  print_heading('~', buff, (79 - 46) / 2);
  print_heading('~', NULL, 0);
  if (total == 10) {
    sprintf(buff, "You managed to find where all of your missing data was!");
    sprintf(buff, "Well done. You've mastered playing with bits and bytes!");
  } else {
    sprintf(buff, "Keep on playing with my bits until you get them all ...");
  }
  print_heading('~', buff, (79 - 55) / 2);
  print_heading('~', NULL, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1090 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
mov    $0x7e,%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10f0 <print_heading@plt>
mov    $0x7e,%edi
lea    0xdea(%rip),%rsi
mov    $0x1a,%edx
call   10f0 <print_heading@plt>
mov    $0x7e,%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10f0 <print_heading@plt>
lea    0x1419(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    1c3e <main+0xa3e>
mov    -0x54(%rbp),%eax
mov    %rax,-0xe8(%rbp)
sub    $0x9,%rax
ja     1c06 <main+0xa06>
mov    -0xe8(%rbp),%rax
lea    0xd67(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x2e,%edi
lea    0xd96(%rip),%rsi
mov    $0x5,%edx
call   10f0 <print_heading@plt>
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x58(%rbp)
cmpl   $0x32,-0x58(%rbp)
jge    1344 <main+0x144>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,-0x21(%rbp)
mov    -0xc(%rbp),%edi
call   10b0 <answer_1@plt>
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     1331 <main+0x131>
jmp    1344 <main+0x144>
jmp    1336 <main+0x136>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    12cd <main+0xcd>
movzbl -0x21(%rbp),%esi
movzbl -0x22(%rbp),%edx
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
lea    0xdab(%rip),%rcx
lea    0xd9c(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1c12 <main+0xa12>
mov    $0x2e,%edi
lea    0xd86(%rip),%rsi
mov    $0x5,%edx
call   10f0 <print_heading@plt>
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x5c(%rbp)
cmpl   $0x32,-0x5c(%rbp)
jge    1421 <main+0x221>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %al,-0x21(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <answer_2@plt>
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     140e <main+0x20e>
jmp    1421 <main+0x221>
jmp    1413 <main+0x213>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    13a7 <main+0x1a7>
movzbl -0x21(%rbp),%esi
movzbl -0x22(%rbp),%edx
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
lea    0xcce(%rip),%rcx
lea    0xcbf(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xc7d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1c12 <main+0xa12>
mov    $0x2e,%edi
lea    0xd2f(%rip),%rsi
mov    $0x5,%edx
call   10f0 <print_heading@plt>
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x60(%rbp)
cmpl   $0x32,-0x60(%rbp)
jge    151d <main+0x31d>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %al,-0x21(%rbp)
mov    -0x11(%rbp),%al
mov    -0xc(%rbp),%esi
movzbl %al,%edi
call   10a0 <answer_3@plt>
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     150a <main+0x30a>
jmp    151d <main+0x31d>
jmp    150f <main+0x30f>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1484 <main+0x284>
movzbl -0x21(%rbp),%esi
movzbl -0x22(%rbp),%edx
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
lea    0xbd2(%rip),%rcx
lea    0xbc3(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xb81(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1c12 <main+0xa12>
mov    $0x2e,%edi
lea    0xccb(%rip),%rsi
mov    $0x5,%edx
call   10f0 <print_heading@plt>
lea    0xcc6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x32,-0x64(%rbp)
jge    161c <main+0x41c>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %al,-0x21(%rbp)
mov    -0x11(%rbp),%al
mov    -0xc(%rbp),%esi
movzbl %al,%edi
call   1050 <answer_4@plt>
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     1609 <main+0x409>
jmp    161c <main+0x41c>
jmp    160e <main+0x40e>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1580 <main+0x380>
movzbl -0x21(%rbp),%esi
movzbl -0x22(%rbp),%edx
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
lea    0xad3(%rip),%rcx
lea    0xac4(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xa82(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1c12 <main+0xa12>
mov    $0x2e,%edi
lea    0xc68(%rip),%rsi
mov    $0x5,%edx
call   10f0 <print_heading@plt>
lea    0xc63(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x68(%rbp)
cmpl   $0x32,-0x68(%rbp)
jge    16f6 <main+0x4f6>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0x21(%rbp)
movzbl -0x11(%rbp),%edi
call   10d0 <answer_5@plt>
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     16e3 <main+0x4e3>
jmp    16f6 <main+0x4f6>
jmp    16e8 <main+0x4e8>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    167f <main+0x47f>
movzbl -0x21(%rbp),%esi
movzbl -0x22(%rbp),%edx
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
lea    0x9f9(%rip),%rcx
lea    0x9ea(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0x9a8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1c12 <main+0xa12>
mov    $0x2e,%edi
lea    0xbed(%rip),%rsi
mov    $0x5,%edx
call   10f0 <print_heading@plt>
lea    0xbe8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x6c(%rbp)
cmpl   $0x32,-0x6c(%rbp)
jge    17f2 <main+0x5f2>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
mov    %al,-0x21(%rbp)
mov    -0x11(%rbp),%al
mov    -0xc(%rbp),%esi
movzbl %al,%edi
call   1040 <answer_6@plt>
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     17df <main+0x5df>
jmp    17f2 <main+0x5f2>
jmp    17e4 <main+0x5e4>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1759 <main+0x559>
movzbl -0x21(%rbp),%esi
movzbl -0x22(%rbp),%edx
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
lea    0x8fd(%rip),%rcx
lea    0x8ee(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0x8ac(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1c12 <main+0xa12>
mov    $0x2e,%edi
lea    0xb8d(%rip),%rsi
mov    $0x5,%edx
call   10f0 <print_heading@plt>
lea    0xb88(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x70(%rbp)
cmpl   $0x32,-0x70(%rbp)
jge    18e8 <main+0x6e8>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %al,-0x21(%rbp)
mov    -0x11(%rbp),%al
mov    -0xc(%rbp),%esi
movzbl %al,%edi
call   10c0 <answer_7@plt>
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     18d5 <main+0x6d5>
jmp    18e8 <main+0x6e8>
jmp    18da <main+0x6da>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    1855 <main+0x655>
movzbl -0x21(%rbp),%esi
movzbl -0x22(%rbp),%edx
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
lea    0x807(%rip),%rcx
lea    0x7f8(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xb2e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1c12 <main+0xa12>
mov    $0x2e,%edi
lea    0xb44(%rip),%rsi
mov    $0x5,%edx
call   10f0 <print_heading@plt>
lea    0xb3f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x32,-0x74(%rbp)
jge    1a04 <main+0x804>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
xor    $0xffffffff,%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %al,-0x21(%rbp)
mov    -0x11(%rbp),%al
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movzbl %al,%edi
call   1060 <answer_8@plt>
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     19f1 <main+0x7f1>
jmp    1a04 <main+0x804>
jmp    19f6 <main+0x7f6>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    194b <main+0x74b>
movzbl -0x21(%rbp),%esi
movzbl -0x22(%rbp),%edx
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
lea    0x6eb(%rip),%rcx
lea    0x6dc(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xa12(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1c12 <main+0xa12>
mov    $0x2e,%edi
lea    0xb0c(%rip),%rsi
mov    $0x5,%edx
call   10f0 <print_heading@plt>
lea    0xb07(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x78(%rbp)
cmpl   $0x32,-0x78(%rbp)
jge    1ae4 <main+0x8e4>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %al,-0x21(%rbp)
mov    -0xc(%rbp),%edi
call   10e0 <answer_9@plt>
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     1ad1 <main+0x8d1>
jmp    1ae4 <main+0x8e4>
jmp    1ad6 <main+0x8d6>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1a67 <main+0x867>
movzbl -0x21(%rbp),%esi
movzbl -0x22(%rbp),%edx
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
lea    0x60b(%rip),%rcx
lea    0x5fc(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0x5ba(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1c12 <main+0xa12>
mov    $0x2e,%edi
lea    0xacb(%rip),%rsi
mov    $0x5,%edx
call   10f0 <print_heading@plt>
lea    0xac7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x7c(%rbp)
cmpl   $0x32,-0x7c(%rbp)
jge    1bce <main+0x9ce>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x11(%rbp)
lea    -0x11(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
and    $0xc0,%eax
sar    $0x6,%eax
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rdi
call   1100 <answer_10@plt>
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
je     1bbb <main+0x9bb>
jmp    1bce <main+0x9ce>
jmp    1bc0 <main+0x9c0>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1b47 <main+0x947>
movzbl -0x21(%rbp),%esi
movzbl -0x22(%rbp),%edx
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
lea    0x521(%rip),%rcx
lea    0x512(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0x4d0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1c12 <main+0xa12>
movl   $0xffffffff,-0x4(%rbp)
jmp    1d5c <main+0xb5c>
mov    $0x2e,%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10f0 <print_heading@plt>
lea    0xa4e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    126d <main+0x6d>
movl   $0x0,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
cmpl   $0xa,-0x84(%rbp)
jge    1c8e <main+0xa8e>
movslq -0x84(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    -0x80(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1c4f <main+0xa4f>
mov    $0x7e,%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10f0 <print_heading@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x80(%rbp),%edx
lea    0x9cb(%rip),%rsi
mov    $0xa,%ecx
mov    $0x0,%al
call   1110 <sprintf@plt>
lea    -0xe0(%rbp),%rsi
mov    $0x7e,%edi
mov    $0x10,%edx
call   10f0 <print_heading@plt>
mov    $0x7e,%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10f0 <print_heading@plt>
cmpl   $0xa,-0x80(%rbp)
jne    1d1a <main+0xb1a>
lea    -0xe0(%rbp),%rdi
lea    0x9b4(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
lea    -0xe0(%rbp),%rdi
lea    0x9d7(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
jmp    1d2f <main+0xb2f>
lea    -0xe0(%rbp),%rdi
lea    0x9f5(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
lea    -0xe0(%rbp),%rsi
mov    $0x7e,%edi
mov    $0xc,%edx
call   10f0 <print_heading@plt>
mov    $0x7e,%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10f0 <print_heading@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0x3c(%rsp),%rdi
call   10b0 <time@plt>
mov    %eax,%edi
call   10a0 <srand@plt>
mov    $0x7e,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1110 <print_heading@plt>
lea    0xdd1(%rip),%rsi
mov    $0x7e,%edi
mov    $0x1a,%edx
call   1110 <print_heading@plt>
mov    $0x7e,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1110 <print_heading@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd7b(%rip),%r15
lea    0xe7c(%rip),%r14
lea    0xf(%rsp),%r12
xor    %r13d,%r13d
jmp    12dd <main+0xbd>
lea    0xde7(%rip),%rcx
lea    0xe64(%rip),%r14
movzbl %bpl,%esi
movzbl %al,%edx
lea    0xd9e(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x2e,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1110 <print_heading@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
add    $0x1,%r13
cmp    $0xa,%r13
je     185b <main+0x63b>
cmp    $0x9,%r13d
ja     1998 <main+0x778>
mov    %r13d,%eax
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
mov    $0x2e,%edi
lea    0xd45(%rip),%rsi
mov    $0x5,%edx
call   1110 <print_heading@plt>
lea    0x1387(%rip),%rdi
call   1040 <puts@plt>
mov    $0x32,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1140 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
mov    $0x1,%ebp
mov    %eax,%ecx
shl    %cl,%ebp
mov    %eax,%edi
call   10d0 <answer_1@plt>
xor    %ecx,%ecx
cmp    %bpl,%al
setne  %cl
mov    %ecx,0x10(%rsp,%r13,4)
jne    184f <main+0x62f>
add    $0xffffffff,%ebx
jne    1320 <main+0x100>
lea    0xd29(%rip),%rcx
mov    %ebp,%eax
jmp    12a4 <main+0x84>
mov    $0x2e,%edi
lea    0xd1e(%rip),%rsi
mov    $0x5,%edx
call   1110 <print_heading@plt>
lea    0x1297(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
xchg   %ax,%ax
xor    %eax,%eax
call   1140 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
mov    $0x1,%ebp
mov    %eax,%ecx
shl    %cl,%ebp
not    %bpl
mov    %eax,%edi
call   1050 <answer_2@plt>
xor    %ecx,%ecx
cmp    %bpl,%al
setne  %cl
mov    %ecx,0x10(%rsp,%r13,4)
jne    17d1 <main+0x5b1>
lea    0x1(%rbx),%ecx
cmp    $0x31,%ebx
mov    %ecx,%ebx
jb     1390 <main+0x170>
jmp    17d1 <main+0x5b1>
mov    $0x2e,%edi
lea    0xcbb(%rip),%rsi
mov    $0x5,%edx
call   1110 <print_heading@plt>
lea    0x119d(%rip),%rdi
call   1040 <puts@plt>
mov    $0x32,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1140 <rand@plt>
mov    %eax,%ebx
lea    0x7(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffff8,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1140 <rand@plt>
mov    %al,0xf(%rsp)
mov    %eax,%ebp
bts    %ebx,%ebp
movzbl %al,%edi
mov    %ebx,%esi
call   10c0 <answer_3@plt>
xor    %ecx,%ecx
cmp    %bpl,%al
setne  %cl
mov    %ecx,0x10(%rsp,%r13,4)
jne    1296 <main+0x76>
add    $0xffffffff,%r14d
jne    1410 <main+0x1f0>
jmp    15b9 <main+0x399>
mov    $0x2e,%edi
lea    0xc42(%rip),%rsi
mov    $0x5,%edx
call   1110 <print_heading@plt>
lea    0x1089(%rip),%rdi
call   1040 <puts@plt>
mov    $0x32,%r14d
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1140 <rand@plt>
mov    %eax,%ebx
lea    0x7(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffff8,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1140 <rand@plt>
mov    %al,0xf(%rsp)
mov    %eax,%ebp
btr    %ebx,%ebp
movzbl %al,%edi
mov    %ebx,%esi
call   1070 <answer_4@plt>
xor    %ecx,%ecx
cmp    %bpl,%al
setne  %cl
mov    %ecx,0x10(%rsp,%r13,4)
jne    1296 <main+0x76>
add    $0xffffffff,%r14d
jne    1490 <main+0x270>
jmp    15b9 <main+0x399>
mov    $0x2e,%edi
lea    0xbce(%rip),%rsi
mov    $0x5,%edx
call   1110 <print_heading@plt>
lea    0xfb7(%rip),%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1140 <rand@plt>
mov    %eax,%ebx
mov    %bl,0xf(%rsp)
movzbl %bl,%edi
not    %bl
call   10f0 <answer_5@plt>
xor    %ecx,%ecx
cmp    %bl,%al
setne  %cl
mov    %ecx,0x10(%rsp,%r13,4)
jne    153f <main+0x31f>
lea    0x1(%rbp),%ecx
cmp    $0x31,%ebp
mov    %ecx,%ebp
jb     1510 <main+0x2f0>
cmp    %bl,%al
jmp    1832 <main+0x612>
mov    $0x2e,%edi
lea    0xb72(%rip),%rsi
mov    $0x5,%edx
call   1110 <print_heading@plt>
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
mov    $0x32,%r14d
xchg   %ax,%ax
xor    %eax,%eax
call   1140 <rand@plt>
mov    %eax,%ebx
lea    0x7(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffff8,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1140 <rand@plt>
mov    %al,0xf(%rsp)
mov    %eax,%ebp
btc    %ebx,%ebp
movzbl %al,%edi
mov    %ebx,%esi
call   1060 <answer_6@plt>
xor    %ecx,%ecx
cmp    %bpl,%al
setne  %cl
mov    %ecx,0x10(%rsp,%r13,4)
jne    1296 <main+0x76>
add    $0xffffffff,%r14d
jne    1570 <main+0x350>
lea    0xacc(%rip),%rcx
mov    %ebp,%eax
lea    0xb3f(%rip),%r14
jmp    12a4 <main+0x84>
mov    $0x2e,%edi
lea    0xaf6(%rip),%rsi
mov    $0x5,%edx
call   1110 <print_heading@plt>
lea    0xdc6(%rip),%rdi
call   1040 <puts@plt>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1140 <rand@plt>
mov    %eax,%ebx
lea    0x7(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffff8,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1140 <rand@plt>
mov    %al,0xf(%rsp)
movzbl %al,%edi
mov    %edi,%ebp
mov    %ebx,%ecx
shr    %cl,%ebp
and    $0x1,%bpl
mov    %ebx,%esi
call   10e0 <answer_7@plt>
xor    %ecx,%ecx
cmp    %al,%bpl
setne  %cl
mov    %ecx,0x10(%rsp,%r13,4)
jne    1651 <main+0x431>
lea    0x1(%r14),%ecx
cmp    $0x31,%r14d
mov    %ecx,%r14d
jb     1600 <main+0x3e0>
cmp    %al,%bpl
movzbl %bpl,%esi
movzbl %al,%edx
lea    0xa2a(%rip),%rcx
lea    0xa1b(%rip),%rax
cmovne %rax,%rcx
lea    0xa68(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xa86(%rip),%r14
jmp    12b9 <main+0x99>
mov    $0x2e,%edi
lea    0xa77(%rip),%rsi
mov    $0x5,%edx
call   1110 <print_heading@plt>
lea    0xc36(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1140 <rand@plt>
mov    %eax,%r14d
lea    0x7(%r14),%eax
test   %r14d,%r14d
cmovns %r14d,%eax
and    $0xfffffff8,%eax
sub    %eax,%r14d
xor    %eax,%eax
call   1140 <rand@plt>
mov    %eax,%r15d
lea    0x7(%r15),%eax
test   %r15d,%r15d
cmovns %r15d,%eax
and    $0xfffffff8,%eax
sub    %eax,%r15d
xor    %eax,%eax
call   1140 <rand@plt>
movzbl %al,%edi
mov    %edi,%ebp
bts    %r14d,%ebp
mov    %r15d,%ecx
shr    %cl,%ebp
mov    %al,0xf(%rsp)
not    %bpl
and    $0x1,%bpl
mov    %r14d,%esi
mov    %r15d,%edx
call   1080 <answer_8@plt>
xor    %ecx,%ecx
cmp    %al,%bpl
setne  %cl
mov    %ecx,0x10(%rsp,%r13,4)
jne    172a <main+0x50a>
lea    0x1(%rbx),%ecx
cmp    $0x31,%ebx
mov    %ecx,%ebx
jb     16b0 <main+0x490>
cmp    %al,%bpl
movzbl %bpl,%esi
movzbl %al,%edx
lea    0x951(%rip),%rcx
lea    0x942(%rip),%rax
cmovne %rax,%rcx
lea    0x98f(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x8a5(%rip),%r15
lea    0x9a6(%rip),%r14
jmp    12b9 <main+0x99>
mov    $0x2e,%edi
lea    0x9a3(%rip),%rsi
mov    $0x5,%edx
call   1110 <print_heading@plt>
lea    0xac4(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1140 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
lea    0x1(%rax),%ecx
mov    $0xffffffff,%ebp
shl    %cl,%ebp
not    %bpl
mov    %eax,%edi
call   1100 <answer_9@plt>
xor    %ecx,%ecx
cmp    %bpl,%al
setne  %cl
mov    %ecx,0x10(%rsp,%r13,4)
jne    17d1 <main+0x5b1>
lea    0x1(%rbx),%ecx
cmp    $0x31,%ebx
mov    %ecx,%ebx
jb     1790 <main+0x570>
cmp    %bpl,%al
movzbl %bpl,%esi
jmp    1835 <main+0x615>
mov    $0x2e,%edi
lea    0x93c(%rip),%rsi
mov    $0x5,%edx
call   1110 <print_heading@plt>
lea    0x9db(%rip),%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
xchg   %ax,%ax
xor    %eax,%eax
call   1140 <rand@plt>
mov    %eax,%ebx
mov    %bl,0xf(%rsp)
shr    $0x6,%bl
mov    %r12,%rdi
call   1120 <answer_10@plt>
xor    %ecx,%ecx
cmp    %al,%bl
setne  %cl
mov    %ecx,0x10(%rsp,%r13,4)
jne    1830 <main+0x610>
lea    0x1(%rbp),%ecx
cmp    $0x31,%ebp
mov    %ecx,%ebp
jb     1800 <main+0x5e0>
cmp    %al,%bl
movzbl %bl,%esi
movzbl %al,%edx
lea    0x84d(%rip),%rcx
lea    0x83e(%rip),%rax
cmovne %rax,%rcx
jmp    12ab <main+0x8b>
lea    0x82e(%rip),%rcx
jmp    12a4 <main+0x84>
pxor   %xmm0,%xmm0
movdqa 0x20(%rsp),%xmm1
pcmpeqd %xmm0,%xmm1
pcmpeqd 0x10(%rsp),%xmm0
packssdw %xmm1,%xmm0
packsswb %xmm0,%xmm0
pmovmskb %xmm0,%eax
mov    %eax,%ecx
shr    %cl
and    $0x55,%cl
sub    %cl,%al
mov    %eax,%ecx
and    $0x33,%cl
shr    $0x2,%al
and    $0x33,%al
add    %cl,%al
mov    %eax,%ecx
shr    $0x4,%cl
add    %al,%cl
and    $0xf,%cl
movzbl %cl,%ebx
cmpl   $0x1,0x30(%rsp)
adc    $0x0,%ebx
cmpl   $0x1,0x34(%rsp)
adc    $0x0,%ebx
mov    $0x7e,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1110 <print_heading@plt>
lea    0x86d(%rip),%rsi
lea    0x40(%rsp),%rbp
mov    %rbp,%rdi
mov    %ebx,%edx
mov    $0xa,%ecx
xor    %eax,%eax
call   1130 <sprintf@plt>
mov    $0x7e,%edi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1110 <print_heading@plt>
mov    $0x7e,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1110 <print_heading@plt>
cmp    $0xa,%ebx
jne    192d <main+0x70d>
movups 0x87e(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movups 0x862(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movups 0x846(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movabs $0x21736574796220,%rax
jmp    195b <main+0x73b>
movups 0x886(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movups 0x86a(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movups 0x84e(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movabs $0x2e2e2e206c6c61,%rax
mov    %rax,0x70(%rsp)
lea    0x40(%rsp),%rsi
mov    $0x7e,%edi
mov    $0xc,%edx
call   1110 <print_heading@plt>
xor    %ebx,%ebx
mov    $0x7e,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1110 <print_heading@plt>
mov    %ebx,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%ebx
jmp    1984 <main+0x764>

LLVM IR (-O0):
@.str = [28 x i8] c"Playing with bits and bytes\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [12 x i8] c"|PROBLEM 1|\00"
@.str.3 = [122 x i8] c"'answer_1()' receives a bit number. Return a byte with the corresponding bit\0Aset, and all other bits cleared.\0ATesting...\0A\00"
@.str.4 = [52 x i8] c"Expected return:\090x%02X\09\09Actual return:\090x%02X\09\09%s\0A\00"
@.str.5 = [8 x i8] c"FAILED!\00"
@.str.6 = [8 x i8] c"PASSED!\00"
@.str.7 = [12 x i8] c"|PROBLEM 2|\00"
@.str.8 = [122 x i8] c"'answer_2()' receives a bit number. Return a byte with the corresponding bit\0Acleared, and all other bits set.\0ATesting...\0A\00"
@.str.9 = [12 x i8] c"|PROBLEM 3|\00"
@.str.10 = [140 x i8] c"'answer_3()' receives a byte and bit number. Return the same byte with the\0Acorresponding bit set, and all other bits unchanged.\0ATesting...\0A\00"
@.str.11 = [12 x i8] c"|PROBLEM 4|\00"
@.str.12 = [144 x i8] c"'answer_4()' receives a byte and bit number. Return the same byte with the\0Acorresponding bit cleared, and all other bits unchanged.\0ATesting...\0A\00"
@.str.13 = [12 x i8] c"|PROBLEM 5|\00"
@.str.14 = [83 x i8] c"'answer_5()' receives a byte. Return the byte with all 8 bits toggled.\0ATesting...\0A\00"
@.str.15 = [12 x i8] c"|PROBLEM 6|\00"
@.str.16 = [144 x i8] c"'answer_6()' receives a byte and bit number. Return the same byte with the\0Acorresponding bit toggled, and all other bits unchanged.\0ATesting...\0A\00"
@.str.17 = [12 x i8] c"|PROBLEM 7|\00"
@.str.18 = [115 x i8] c"'answer_7()' receives a byte and bit number. Return the value (set or unset)\0Aof the corresponding bit.\0ATesting...\0A\00"
@.str.19 = [46 x i8] c"Expected return:\09%d\09\09\09Actual return:\09%d\09\09\09%s\0A\00"
@.str.20 = [12 x i8] c"|PROBLEM 8|\00"
@.str.21 = [216 x i8] c"'answer_8()' receives a byte and two bit numbers. Set the bit corresponding\0Ato the first bit number, toggle every bit in the byte, then return the value of\0Athe bit corresponding to the second bit number.\0ATesting...\0A\00"
@.str.22 = [12 x i8] c"|PROBLEM 9|\00"
@.str.23 = [147 x i8] c"'answer_9()' receives a bit number. Return a byte with every bit up to\0Aand including that bit number set, with all other bits cleared.\0ATesting...\0A\00"
@.str.24 = [13 x i8] c"|PROBLEM 10|\00"
@.str.25 = [119 x i8] c"'answer_10()' receives a pointer to a byte. Return the data in the two most\0Asignificant bits of that byte.\0ATesting...\0A\00"
@.str.26 = [3 x i8] c"\0A\0A\00"
@.str.27 = [51 x i8] c"Your total score for the problems was: %.2d / %.2d\00"
@.str.28 = [56 x i8] c"You managed to find where all of your missing data was!\00"
@.str.29 = [56 x i8] c"Well done. You've mastered playing with bits and bytes!\00"
@.str.30 = [56 x i8] c"Keep on playing with my bits until you get them all ...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i8
%9 = alloca [10 x i32]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca [80 x i8]
store i32 0, i32* %1
%24 = call i64 @time(i32* %2)
%25 = trunc i64 %24 to i32
%26 = call i32 @srand(i32 %25)
%27 = call i32 @print_heading(i8 signext 126, i8* null, i32 0)
%28 = call i32 @print_heading(i8 signext 126, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 26)
%29 = call i32 @print_heading(i8 signext 126, i8* null, i32 0)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %10
br label %31
31: ; preds = %562, %0
%32 = load i32, i32* %10
%33 = icmp slt i32 %32, 10
br i1 %33, label %34, label %565
34: ; preds = %31
%35 = load i32, i32* %10
switch i32 %35, label %558 [
i32 0, label %36
i32 1, label %83
i32 2, label %131
i32 3, label %185
i32 4, label %240
i32 5, label %289
i32 6, label %343
i32 7, label %397
i32 8, label %458
i32 9, label %507
]
36: ; preds = %34
%37 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 5)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %11
br label %39
39: ; preds = %67, %36
%40 = load i32, i32* %11
%41 = icmp slt i32 %40, 50
br i1 %41, label %42, label %70
42: ; preds = %39
%43 = call i32 (...) @rand()
%44 = srem i32 %43, 8
store i32 %44, i32* %3
%45 = load i32, i32* %3
%46 = shl i32 1, %45
%47 = trunc i32 %46 to i8
store i8 %47, i8* %7
%48 = load i32, i32* %3
%49 = call zeroext i8 @answer_1(i32 %48)
store i8 %49, i8* %8
%50 = load i8, i8* %7
%51 = zext i8 %50 to i32
%52 = load i8, i8* %8
%53 = zext i8 %52 to i32
%54 = icmp eq i32 %51, %53
%55 = xor i1 %54, true
%56 = zext i1 %55 to i32
%57 = load i32, i32* %10
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %58
store i32 %56, i32* %59
%60 = load i32, i32* %10
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %42
br label %70
66: ; preds = %42
br label %67
67: ; preds = %66
%68 = load i32, i32* %11
%69 = add nsw i32 %68, 1
store i32 %69, i32* %11
br label %39
70: ; preds = %65, %39
%71 = load i8, i8* %7
%72 = zext i8 %71 to i32
%73 = load i8, i8* %8
%74 = zext i8 %73 to i32
%75 = load i32, i32* %10
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %76
%78 = load i32, i32* %77
%79 = icmp ne i32 %78, 0
%80 = zext i1 %79 to i64
%81 = select i1 %79, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %72, i32 %74, i8* %81)
br label %559
83: ; preds = %34
%84 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 5)
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %12
br label %86
86: ; preds = %115, %83
%87 = load i32, i32* %12
%88 = icmp slt i32 %87, 50
br i1 %88, label %89, label %118
89: ; preds = %86
%90 = call i32 (...) @rand()
%91 = srem i32 %90, 8
store i32 %91, i32* %3
%92 = load i32, i32* %3
%93 = shl i32 1, %92
%94 = xor i32 %93, -1
%95 = trunc i32 %94 to i8
store i8 %95, i8* %7
%96 = load i32, i32* %3
%97 = call zeroext i8 @answer_2(i32 %96)
store i8 %97, i8* %8
%98 = load i8, i8* %7
%99 = zext i8 %98 to i32
%100 = load i8, i8* %8
%101 = zext i8 %100 to i32
%102 = icmp eq i32 %99, %101
%103 = xor i1 %102, true
%104 = zext i1 %103 to i32
%105 = load i32, i32* %10
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %106
store i32 %104, i32* %107
%108 = load i32, i32* %10
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %109
%111 = load i32, i32* %110
%112 = icmp ne i32 %111, 0
br i1 %112, label %113, label %114
113: ; preds = %89
br label %118
114: ; preds = %89
br label %115
115: ; preds = %114
%116 = load i32, i32* %12
%117 = add nsw i32 %116, 1
store i32 %117, i32* %12
br label %86
118: ; preds = %113, %86
%119 = load i8, i8* %7
%120 = zext i8 %119 to i32
%121 = load i8, i8* %8
%122 = zext i8 %121 to i32
%123 = load i32, i32* %10
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %124
%126 = load i32, i32* %125
%127 = icmp ne i32 %126, 0
%128 = zext i1 %127 to i64
%129 = select i1 %127, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %120, i32 %122, i8* %129)
br label %559
131: ; preds = %34
%132 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 5)
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %13
br label %134
134: ; preds = %169, %131
%135 = load i32, i32* %13
%136 = icmp slt i32 %135, 50
br i1 %136, label %137, label %172
137: ; preds = %134
%138 = call i32 (...) @rand()
%139 = srem i32 %138, 8
store i32 %139, i32* %3
%140 = call i32 (...) @rand()
%141 = srem i32 %140, 256
%142 = trunc i32 %141 to i8
store i8 %142, i8* %5
%143 = load i8, i8* %5
%144 = zext i8 %143 to i32
%145 = load i32, i32* %3
%146 = shl i32 1, %145
%147 = or i32 %144, %146
%148 = trunc i32 %147 to i8
store i8 %148, i8* %7
%149 = load i8, i8* %5
%150 = load i32, i32* %3
%151 = call zeroext i8 @answer_3(i8 zeroext %149, i32 %150)
store i8 %151, i8* %8
%152 = load i8, i8* %7
%153 = zext i8 %152 to i32
%154 = load i8, i8* %8
%155 = zext i8 %154 to i32
%156 = icmp eq i32 %153, %155
%157 = xor i1 %156, true
%158 = zext i1 %157 to i32
%159 = load i32, i32* %10
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %160
store i32 %158, i32* %161
%162 = load i32, i32* %10
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %163
%165 = load i32, i32* %164
%166 = icmp ne i32 %165, 0
br i1 %166, label %167, label %168
167: ; preds = %137
br label %172
168: ; preds = %137
br label %169
169: ; preds = %168
%170 = load i32, i32* %13
%171 = add nsw i32 %170, 1
store i32 %171, i32* %13
br label %134
172: ; preds = %167, %134
%173 = load i8, i8* %7
%174 = zext i8 %173 to i32
%175 = load i8, i8* %8
%176 = zext i8 %175 to i32
%177 = load i32, i32* %10
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %178
%180 = load i32, i32* %179
%181 = icmp ne i32 %180, 0
%182 = zext i1 %181 to i64
%183 = select i1 %181, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%184 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %174, i32 %176, i8* %183)
br label %559
185: ; preds = %34
%186 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 5)
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %14
br label %188
188: ; preds = %224, %185
%189 = load i32, i32* %14
%190 = icmp slt i32 %189, 50
br i1 %190, label %191, label %227
191: ; preds = %188
%192 = call i32 (...) @rand()
%193 = srem i32 %192, 8
store i32 %193, i32* %3
%194 = call i32 (...) @rand()
%195 = srem i32 %194, 256
%196 = trunc i32 %195 to i8
store i8 %196, i8* %5
%197 = load i8, i8* %5
%198 = zext i8 %197 to i32
%199 = load i32, i32* %3
%200 = shl i32 1, %199
%201 = xor i32 %200, -1
%202 = and i32 %198, %201
%203 = trunc i32 %202 to i8
store i8 %203, i8* %7
%204 = load i8, i8* %5
%205 = load i32, i32* %3
%206 = call zeroext i8 @answer_4(i8 zeroext %204, i32 %205)
store i8 %206, i8* %8
%207 = load i8, i8* %7
%208 = zext i8 %207 to i32
%209 = load i8, i8* %8
%210 = zext i8 %209 to i32
%211 = icmp eq i32 %208, %210
%212 = xor i1 %211, true
%213 = zext i1 %212 to i32
%214 = load i32, i32* %10
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %215
store i32 %213, i32* %216
%217 = load i32, i32* %10
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %218
%220 = load i32, i32* %219
%221 = icmp ne i32 %220, 0
br i1 %221, label %222, label %223
222: ; preds = %191
br label %227
223: ; preds = %191
br label %224
224: ; preds = %223
%225 = load i32, i32* %14
%226 = add nsw i32 %225, 1
store i32 %226, i32* %14
br label %188
227: ; preds = %222, %188
%228 = load i8, i8* %7
%229 = zext i8 %228 to i32
%230 = load i8, i8* %8
%231 = zext i8 %230 to i32
%232 = load i32, i32* %10
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %233
%235 = load i32, i32* %234
%236 = icmp ne i32 %235, 0
%237 = zext i1 %236 to i64
%238 = select i1 %236, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%239 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %229, i32 %231, i8* %238)
br label %559
240: ; preds = %34
%241 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i32 5)
%242 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %15
br label %243
243: ; preds = %273, %240
%244 = load i32, i32* %15
%245 = icmp slt i32 %244, 50
br i1 %245, label %246, label %276
246: ; preds = %243
%247 = call i32 (...) @rand()
%248 = srem i32 %247, 256
%249 = trunc i32 %248 to i8
store i8 %249, i8* %5
%250 = load i8, i8* %5
%251 = zext i8 %250 to i32
%252 = xor i32 %251, -1
%253 = trunc i32 %252 to i8
store i8 %253, i8* %7
%254 = load i8, i8* %5
%255 = call zeroext i8 @answer_5(i8 zeroext %254)
store i8 %255, i8* %8
%256 = load i8, i8* %7
%257 = zext i8 %256 to i32
%258 = load i8, i8* %8
%259 = zext i8 %258 to i32
%260 = icmp eq i32 %257, %259
%261 = xor i1 %260, true
%262 = zext i1 %261 to i32
%263 = load i32, i32* %10
%264 = sext i32 %263 to i64
%265 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %264
store i32 %262, i32* %265
%266 = load i32, i32* %10
%267 = sext i32 %266 to i64
%268 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %267
%269 = load i32, i32* %268
%270 = icmp ne i32 %269, 0
br i1 %270, label %271, label %272
271: ; preds = %246
br label %276
272: ; preds = %246
br label %273
273: ; preds = %272
%274 = load i32, i32* %15
%275 = add nsw i32 %274, 1
store i32 %275, i32* %15
br label %243
276: ; preds = %271, %243
%277 = load i8, i8* %7
%278 = zext i8 %277 to i32
%279 = load i8, i8* %8
%280 = zext i8 %279 to i32
%281 = load i32, i32* %10
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %282
%284 = load i32, i32* %283
%285 = icmp ne i32 %284, 0
%286 = zext i1 %285 to i64
%287 = select i1 %285, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%288 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %278, i32 %280, i8* %287)
br label %559
289: ; preds = %34
%290 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), i32 5)
%291 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.16, i64 0, i64 0))
store i32 0, i32* %16
br label %292
292: ; preds = %327, %289
%293 = load i32, i32* %16
%294 = icmp slt i32 %293, 50
br i1 %294, label %295, label %330
295: ; preds = %292
%296 = call i32 (...) @rand()
%297 = srem i32 %296, 8
store i32 %297, i32* %3
%298 = call i32 (...) @rand()
%299 = srem i32 %298, 256
%300 = trunc i32 %299 to i8
store i8 %300, i8* %5
%301 = load i8, i8* %5
%302 = zext i8 %301 to i32
%303 = load i32, i32* %3
%304 = shl i32 1, %303
%305 = xor i32 %302, %304
%306 = trunc i32 %305 to i8
store i8 %306, i8* %7
%307 = load i8, i8* %5
%308 = load i32, i32* %3
%309 = call zeroext i8 @answer_6(i8 zeroext %307, i32 %308)
store i8 %309, i8* %8
%310 = load i8, i8* %7
%311 = zext i8 %310 to i32
%312 = load i8, i8* %8
%313 = zext i8 %312 to i32
%314 = icmp eq i32 %311, %313
%315 = xor i1 %314, true
%316 = zext i1 %315 to i32
%317 = load i32, i32* %10
%318 = sext i32 %317 to i64
%319 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %318
store i32 %316, i32* %319
%320 = load i32, i32* %10
%321 = sext i32 %320 to i64
%322 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %321
%323 = load i32, i32* %322
%324 = icmp ne i32 %323, 0
br i1 %324, label %325, label %326
325: ; preds = %295
br label %330
326: ; preds = %295
br label %327
327: ; preds = %326
%328 = load i32, i32* %16
%329 = add nsw i32 %328, 1
store i32 %329, i32* %16
br label %292
330: ; preds = %325, %292
%331 = load i8, i8* %7
%332 = zext i8 %331 to i32
%333 = load i8, i8* %8
%334 = zext i8 %333 to i32
%335 = load i32, i32* %10
%336 = sext i32 %335 to i64
%337 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %336
%338 = load i32, i32* %337
%339 = icmp ne i32 %338, 0
%340 = zext i1 %339 to i64
%341 = select i1 %339, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%342 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %332, i32 %334, i8* %341)
br label %559
343: ; preds = %34
%344 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.17, i64 0, i64 0), i32 5)
%345 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.18, i64 0, i64 0))
store i32 0, i32* %17
br label %346
346: ; preds = %381, %343
%347 = load i32, i32* %17
%348 = icmp slt i32 %347, 50
br i1 %348, label %349, label %384
349: ; preds = %346
%350 = call i32 (...) @rand()
%351 = srem i32 %350, 8
store i32 %351, i32* %3
%352 = call i32 (...) @rand()
%353 = srem i32 %352, 256
%354 = trunc i32 %353 to i8
store i8 %354, i8* %5
%355 = load i8, i8* %5
%356 = zext i8 %355 to i32
%357 = load i32, i32* %3
%358 = ashr i32 %356, %357
%359 = and i32 %358, 1
%360 = trunc i32 %359 to i8
store i8 %360, i8* %7
%361 = load i8, i8* %5
%362 = load i32, i32* %3
%363 = call zeroext i8 @answer_7(i8 zeroext %361, i32 %362)
store i8 %363, i8* %8
%364 = load i8, i8* %7
%365 = zext i8 %364 to i32
%366 = load i8, i8* %8
%367 = zext i8 %366 to i32
%368 = icmp eq i32 %365, %367
%369 = xor i1 %368, true
%370 = zext i1 %369 to i32
%371 = load i32, i32* %10
%372 = sext i32 %371 to i64
%373 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %372
store i32 %370, i32* %373
%374 = load i32, i32* %10
%375 = sext i32 %374 to i64
%376 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %375
%377 = load i32, i32* %376
%378 = icmp ne i32 %377, 0
br i1 %378, label %379, label %380
379: ; preds = %349
br label %384
380: ; preds = %349
br label %381
381: ; preds = %380
%382 = load i32, i32* %17
%383 = add nsw i32 %382, 1
store i32 %383, i32* %17
br label %346
384: ; preds = %379, %346
%385 = load i8, i8* %7
%386 = zext i8 %385 to i32
%387 = load i8, i8* %8
%388 = zext i8 %387 to i32
%389 = load i32, i32* %10
%390 = sext i32 %389 to i64
%391 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %390
%392 = load i32, i32* %391
%393 = icmp ne i32 %392, 0
%394 = zext i1 %393 to i64
%395 = select i1 %393, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%396 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.19, i64 0, i64 0), i32 %386, i32 %388, i8* %395)
br label %559
397: ; preds = %34
%398 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0), i32 5)
%399 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.21, i64 0, i64 0))
store i32 0, i32* %18
br label %400
400: ; preds = %442, %397
%401 = load i32, i32* %18
%402 = icmp slt i32 %401, 50
br i1 %402, label %403, label %445
403: ; preds = %400
%404 = call i32 (...) @rand()
%405 = srem i32 %404, 8
store i32 %405, i32* %3
%406 = call i32 (...) @rand()
%407 = srem i32 %406, 8
store i32 %407, i32* %4
%408 = call i32 (...) @rand()
%409 = srem i32 %408, 256
%410 = trunc i32 %409 to i8
store i8 %410, i8* %5
%411 = load i8, i8* %5
%412 = zext i8 %411 to i32
%413 = load i32, i32* %3
%414 = shl i32 1, %413
%415 = or i32 %412, %414
%416 = xor i32 %415, -1
%417 = load i32, i32* %4
%418 = ashr i32 %416, %417
%419 = and i32 %418, 1
%420 = trunc i32 %419 to i8
store i8 %420, i8* %7
%421 = load i8, i8* %5
%422 = load i32, i32* %3
%423 = load i32, i32* %4
%424 = call zeroext i8 @answer_8(i8 zeroext %421, i32 %422, i32 %423)
store i8 %424, i8* %8
%425 = load i8, i8* %7
%426 = zext i8 %425 to i32
%427 = load i8, i8* %8
%428 = zext i8 %427 to i32
%429 = icmp eq i32 %426, %428
%430 = xor i1 %429, true
%431 = zext i1 %430 to i32
%432 = load i32, i32* %10
%433 = sext i32 %432 to i64
%434 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %433
store i32 %431, i32* %434
%435 = load i32, i32* %10
%436 = sext i32 %435 to i64
%437 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %436
%438 = load i32, i32* %437
%439 = icmp ne i32 %438, 0
br i1 %439, label %440, label %441
440: ; preds = %403
br label %445
441: ; preds = %403
br label %442
442: ; preds = %441
%443 = load i32, i32* %18
%444 = add nsw i32 %443, 1
store i32 %444, i32* %18
br label %400
445: ; preds = %440, %400
%446 = load i8, i8* %7
%447 = zext i8 %446 to i32
%448 = load i8, i8* %8
%449 = zext i8 %448 to i32
%450 = load i32, i32* %10
%451 = sext i32 %450 to i64
%452 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %451
%453 = load i32, i32* %452
%454 = icmp ne i32 %453, 0
%455 = zext i1 %454 to i64
%456 = select i1 %454, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%457 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.19, i64 0, i64 0), i32 %447, i32 %449, i8* %456)
br label %559
458: ; preds = %34
%459 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0), i32 5)
%460 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str.23, i64 0, i64 0))
store i32 0, i32* %19
br label %461
461: ; preds = %491, %458
%462 = load i32, i32* %19
%463 = icmp slt i32 %462, 50
br i1 %463, label %464, label %494
464: ; preds = %461
%465 = call i32 (...) @rand()
%466 = srem i32 %465, 8
store i32 %466, i32* %3
%467 = load i32, i32* %3
%468 = add nsw i32 %467, 1
%469 = shl i32 -1, %468
%470 = xor i32 %469, -1
%471 = trunc i32 %470 to i8
store i8 %471, i8* %7
%472 = load i32, i32* %3
%473 = call zeroext i8 @answer_9(i32 %472)
store i8 %473, i8* %8
%474 = load i8, i8* %7
%475 = zext i8 %474 to i32
%476 = load i8, i8* %8
%477 = zext i8 %476 to i32
%478 = icmp eq i32 %475, %477
%479 = xor i1 %478, true
%480 = zext i1 %479 to i32
%481 = load i32, i32* %10
%482 = sext i32 %481 to i64
%483 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %482
store i32 %480, i32* %483
%484 = load i32, i32* %10
%485 = sext i32 %484 to i64
%486 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %485
%487 = load i32, i32* %486
%488 = icmp ne i32 %487, 0
br i1 %488, label %489, label %490
489: ; preds = %464
br label %494
490: ; preds = %464
br label %491
491: ; preds = %490
%492 = load i32, i32* %19
%493 = add nsw i32 %492, 1
store i32 %493, i32* %19
br label %461
494: ; preds = %489, %461
%495 = load i8, i8* %7
%496 = zext i8 %495 to i32
%497 = load i8, i8* %8
%498 = zext i8 %497 to i32
%499 = load i32, i32* %10
%500 = sext i32 %499 to i64
%501 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %500
%502 = load i32, i32* %501
%503 = icmp ne i32 %502, 0
%504 = zext i1 %503 to i64
%505 = select i1 %503, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%506 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %496, i32 %498, i8* %505)
br label %559
507: ; preds = %34
%508 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.24, i64 0, i64 0), i32 5)
%509 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str.25, i64 0, i64 0))
store i32 0, i32* %20
br label %510
510: ; preds = %542, %507
%511 = load i32, i32* %20
%512 = icmp slt i32 %511, 50
br i1 %512, label %513, label %545
513: ; preds = %510
%514 = call i32 (...) @rand()
%515 = srem i32 %514, 256
%516 = trunc i32 %515 to i8
store i8 %516, i8* %5
store i8* %5, i8** %6
%517 = load i8*, i8** %6
%518 = load i8, i8* %517
%519 = zext i8 %518 to i32
%520 = and i32 %519, 192
%521 = ashr i32 %520, 6
%522 = trunc i32 %521 to i8
store i8 %522, i8* %7
%523 = load i8*, i8** %6
%524 = call zeroext i8 @answer_10(i8* %523)
store i8 %524, i8* %8
%525 = load i8, i8* %7
%526 = zext i8 %525 to i32
%527 = load i8, i8* %8
%528 = zext i8 %527 to i32
%529 = icmp eq i32 %526, %528
%530 = xor i1 %529, true
%531 = zext i1 %530 to i32
%532 = load i32, i32* %10
%533 = sext i32 %532 to i64
%534 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %533
store i32 %531, i32* %534
%535 = load i32, i32* %10
%536 = sext i32 %535 to i64
%537 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %536
%538 = load i32, i32* %537
%539 = icmp ne i32 %538, 0
br i1 %539, label %540, label %541
540: ; preds = %513
br label %545
541: ; preds = %513
br label %542
542: ; preds = %541
%543 = load i32, i32* %20
%544 = add nsw i32 %543, 1
store i32 %544, i32* %20
br label %510
545: ; preds = %540, %510
%546 = load i8, i8* %7
%547 = zext i8 %546 to i32
%548 = load i8, i8* %8
%549 = zext i8 %548 to i32
%550 = load i32, i32* %10
%551 = sext i32 %550 to i64
%552 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %551
%553 = load i32, i32* %552
%554 = icmp ne i32 %553, 0
%555 = zext i1 %554 to i64
%556 = select i1 %554, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%557 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %547, i32 %549, i8* %556)
br label %559
558: ; preds = %34
store i32 -1, i32* %1
br label %604
559: ; preds = %545, %494, %445, %384, %330, %276, %227, %172, %118, %70
%560 = call i32 @print_heading(i8 signext 46, i8* null, i32 0)
%561 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.26, i64 0, i64 0))
br label %562
562: ; preds = %559
%563 = load i32, i32* %10
%564 = add nsw i32 %563, 1
store i32 %564, i32* %10
br label %31
565: ; preds = %31
store i32 0, i32* %21
store i32 0, i32* %22
br label %566
566: ; preds = %579, %565
%567 = load i32, i32* %22
%568 = icmp slt i32 %567, 10
br i1 %568, label %569, label %582
569: ; preds = %566
%570 = load i32, i32* %22
%571 = sext i32 %570 to i64
%572 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %571
%573 = load i32, i32* %572
%574 = icmp ne i32 %573, 0
%575 = zext i1 %574 to i64
%576 = select i1 %574, i32 0, i32 1
%577 = load i32, i32* %21
%578 = add nsw i32 %577, %576
store i32 %578, i32* %21
br label %579
579: ; preds = %569
%580 = load i32, i32* %22
%581 = add nsw i32 %580, 1
store i32 %581, i32* %22
br label %566
582: ; preds = %566
%583 = call i32 @print_heading(i8 signext 126, i8* null, i32 0)
%584 = getelementptr inbounds [80 x i8], [80 x i8]* %23, i64 0, i64 0
%585 = load i32, i32* %21
%586 = call i32 (i8*, i8*, ...) @sprintf(i8* %584, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.27, i64 0, i64 0), i32 %585, i32 10)
%587 = getelementptr inbounds [80 x i8], [80 x i8]* %23, i64 0, i64 0
%588 = call i32 @print_heading(i8 signext 126, i8* %587, i32 16)
%589 = call i32 @print_heading(i8 signext 126, i8* null, i32 0)
%590 = load i32, i32* %21
%591 = icmp eq i32 %590, 10
br i1 %591, label %592, label %597
592: ; preds = %582
%593 = getelementptr inbounds [80 x i8], [80 x i8]* %23, i64 0, i64 0
%594 = call i32 (i8*, i8*, ...) @sprintf(i8* %593, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.28, i64 0, i64 0))
%595 = getelementptr inbounds [80 x i8], [80 x i8]* %23, i64 0, i64 0
%596 = call i32 (i8*, i8*, ...) @sprintf(i8* %595, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.29, i64 0, i64 0))
br label %600
597: ; preds = %582
%598 = getelementptr inbounds [80 x i8], [80 x i8]* %23, i64 0, i64 0
%599 = call i32 (i8*, i8*, ...) @sprintf(i8* %598, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.30, i64 0, i64 0))
br label %600
600: ; preds = %597, %592
%601 = getelementptr inbounds [80 x i8], [80 x i8]* %23, i64 0, i64 0
%602 = call i32 @print_heading(i8 signext 126, i8* %601, i32 12)
%603 = call i32 @print_heading(i8 signext 126, i8* null, i32 0)
store i32 0, i32* %1
br label %604
604: ; preds = %600, %558
%605 = load i32, i32* %1
ret i32 %605
}

LLVM IR (-O2):
@.str = [28 x i8] c"Playing with bits and bytes\00"
@.str.2 = [12 x i8] c"|PROBLEM 1|\00"
@.str.4 = [52 x i8] c"Expected return:\090x%02X\09\09Actual return:\090x%02X\09\09%s\0A\00"
@.str.5 = [8 x i8] c"FAILED!\00"
@.str.6 = [8 x i8] c"PASSED!\00"
@.str.7 = [12 x i8] c"|PROBLEM 2|\00"
@.str.9 = [12 x i8] c"|PROBLEM 3|\00"
@.str.11 = [12 x i8] c"|PROBLEM 4|\00"
@.str.13 = [12 x i8] c"|PROBLEM 5|\00"
@.str.15 = [12 x i8] c"|PROBLEM 6|\00"
@.str.17 = [12 x i8] c"|PROBLEM 7|\00"
@.str.19 = [46 x i8] c"Expected return:\09%d\09\09\09Actual return:\09%d\09\09\09%s\0A\00"
@.str.20 = [12 x i8] c"|PROBLEM 8|\00"
@.str.22 = [12 x i8] c"|PROBLEM 9|\00"
@.str.24 = [13 x i8] c"|PROBLEM 10|\00"
@.str.27 = [51 x i8] c"Your total score for the problems was: %.2d / %.2d\00"
@.str.29 = [56 x i8] c"Well done. You've mastered playing with bits and bytes!\00"
@.str.30 = [56 x i8] c"Keep on playing with my bits until you get them all ...\00"
@str = [118 x i8] c"'answer_10()' receives a pointer to a byte. Return the data in the two most\0Asignificant bits of that byte.\0ATesting...\00"
@str.31 = [2 x i8] c"\0A\00"
@str.32 = [146 x i8] c"'answer_9()' receives a bit number. Return a byte with every bit up to\0Aand including that bit number set, with all other bits cleared.\0ATesting...\00"
@str.33 = [215 x i8] c"'answer_8()' receives a byte and two bit numbers. Set the bit corresponding\0Ato the first bit number, toggle every bit in the byte, then return the value of\0Athe bit corresponding to the second bit number.\0ATesting...\00"
@str.34 = [114 x i8] c"'answer_7()' receives a byte and bit number. Return the value (set or unset)\0Aof the corresponding bit.\0ATesting...\00"
@str.35 = [143 x i8] c"'answer_6()' receives a byte and bit number. Return the same byte with the\0Acorresponding bit toggled, and all other bits unchanged.\0ATesting...\00"
@str.36 = [82 x i8] c"'answer_5()' receives a byte. Return the byte with all 8 bits toggled.\0ATesting...\00"
@str.37 = [143 x i8] c"'answer_4()' receives a byte and bit number. Return the same byte with the\0Acorresponding bit cleared, and all other bits unchanged.\0ATesting...\00"
@str.38 = [139 x i8] c"'answer_3()' receives a byte and bit number. Return the same byte with the\0Acorresponding bit set, and all other bits unchanged.\0ATesting...\00"
@str.39 = [121 x i8] c"'answer_2()' receives a bit number. Return a byte with the corresponding bit\0Acleared, and all other bits set.\0ATesting...\00"
@str.40 = [121 x i8] c"'answer_1()' receives a bit number. Return a byte with the corresponding bit\0Aset, and all other bits cleared.\0ATesting...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [10 x i32]
%4 = alloca [80 x i8]
%5 = bitcast i32* %1 to i8*
%6 = call i64 @time(i32* %1)
%7 = trunc i64 %6 to i32
%8 = call i32 @srand(i32 %7)
%9 = call i32 @print_heading(i8 signext 126, i8* null, i32 0)
%10 = call i32 @print_heading(i8 signext 126, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 26)
%11 = call i32 @print_heading(i8 signext 126, i8* null, i32 0)
%12 = call i32 @putchar(i32 10)
%13 = bitcast [10 x i32]* %3 to i8*
br label %14
14: ; preds = %0, %269
%15 = phi i64 [ 0, %0 ], [ %272, %269 ]
%16 = trunc i64 %15 to i32
switch i32 %16, label %302 [
i32 0, label %17
i32 1, label %41
i32 2, label %64
i32 3, label %91
i32 4, label %119
i32 5, label %140
i32 6, label %167
i32 7, label %193
i32 8, label %224
i32 9, label %248
]
17: ; preds = %14
%18 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 5)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([121 x i8], [121 x i8]* @str.40, i64 0, i64 0))
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
br label %24
21: ; preds = %24
%22 = add nuw nsw i32 %25, 1
%23 = icmp eq i32 %22, 50
br i1 %23, label %33, label %24
24: ; preds = %17, %21
%25 = phi i32 [ 0, %17 ], [ %22, %21 ]
%26 = call i32 (...) @rand()
%27 = srem i32 %26, 8
%28 = shl nuw nsw i32 1, %27
%29 = trunc i32 %28 to i8
%30 = call zeroext i8 @answer_1(i32 %27)
%31 = icmp ne i8 %30, %29
%32 = zext i1 %31 to i32
store i32 %32, i32* %20
br i1 %31, label %35, label %21
33: ; preds = %21
%34 = trunc i32 %28 to i8
br label %35
35: ; preds = %24, %33
%36 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %33 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %24 ]
%37 = phi i8 [ %34, %33 ], [ %30, %24 ]
%38 = and i32 %28, 255
%39 = zext i8 %37 to i32
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %38, i32 %39, i8* %36)
br label %269
41: ; preds = %14
%42 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 5)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([121 x i8], [121 x i8]* @str.39, i64 0, i64 0))
%44 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
br label %45
45: ; preds = %45, %41
%46 = phi i32 [ 0, %41 ], [ %55, %45 ]
%47 = call i32 (...) @rand()
%48 = srem i32 %47, 8
%49 = shl nuw nsw i32 1, %48
%50 = trunc i32 %49 to i8
%51 = xor i8 %50, -1
%52 = call zeroext i8 @answer_2(i32 %48)
%53 = icmp ne i8 %52, %51
%54 = zext i1 %53 to i32
store i32 %54, i32* %44
%55 = add nuw nsw i32 %46, 1
%56 = xor i1 %53, true
%57 = icmp ult i32 %46, 49
%58 = select i1 %56, i1 %57, i1 false
br i1 %58, label %45, label %59
59: ; preds = %45
%60 = zext i8 %51 to i32
%61 = zext i8 %52 to i32
%62 = select i1 %53, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %60, i32 %61, i8* %62)
br label %269
64: ; preds = %14
%65 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 5)
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([139 x i8], [139 x i8]* @str.38, i64 0, i64 0))
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
br label %71
68: ; preds = %71
%69 = add nuw nsw i32 %72, 1
%70 = icmp eq i32 %69, 50
br i1 %70, label %83, label %71
71: ; preds = %64, %68
%72 = phi i32 [ 0, %64 ], [ %69, %68 ]
%73 = call i32 (...) @rand()
%74 = srem i32 %73, 8
%75 = call i32 (...) @rand()
%76 = trunc i32 %75 to i8
store i8 %76, i8* %2
%77 = shl nuw nsw i32 1, %74
%78 = or i32 %77, %75
%79 = trunc i32 %78 to i8
%80 = call zeroext i8 @answer_3(i8 zeroext %76, i32 %74)
%81 = icmp ne i8 %80, %79
%82 = zext i1 %81 to i32
store i32 %82, i32* %67
br i1 %81, label %85, label %68
83: ; preds = %68
%84 = trunc i32 %78 to i8
br label %85
85: ; preds = %71, %83
%86 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %83 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %71 ]
%87 = phi i8 [ %84, %83 ], [ %80, %71 ]
%88 = and i32 %78, 255
%89 = zext i8 %87 to i32
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %88, i32 %89, i8* %86)
br label %269
91: ; preds = %14
%92 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 5)
%93 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([143 x i8], [143 x i8]* @str.37, i64 0, i64 0))
%94 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
br label %98
95: ; preds = %98
%96 = add nuw nsw i32 %99, 1
%97 = icmp eq i32 %96, 50
br i1 %97, label %111, label %98
98: ; preds = %91, %95
%99 = phi i32 [ 0, %91 ], [ %96, %95 ]
%100 = call i32 (...) @rand()
%101 = srem i32 %100, 8
%102 = call i32 (...) @rand()
%103 = trunc i32 %102 to i8
store i8 %103, i8* %2
%104 = shl nuw nsw i32 1, %101
%105 = xor i32 %104, -1
%106 = and i32 %102, %105
%107 = trunc i32 %106 to i8
%108 = call zeroext i8 @answer_4(i8 zeroext %103, i32 %101)
%109 = icmp ne i8 %108, %107
%110 = zext i1 %109 to i32
store i32 %110, i32* %94
br i1 %109, label %113, label %95
111: ; preds = %95
%112 = trunc i32 %106 to i8
br label %113
113: ; preds = %98, %111
%114 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %111 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %98 ]
%115 = phi i8 [ %112, %111 ], [ %108, %98 ]
%116 = and i32 %106, 255
%117 = zext i8 %115 to i32
%118 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %116, i32 %117, i8* %114)
br label %269
119: ; preds = %14
%120 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i32 5)
%121 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @str.36, i64 0, i64 0))
%122 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
br label %123
123: ; preds = %123, %119
%124 = phi i32 [ 0, %119 ], [ %131, %123 ]
%125 = call i32 (...) @rand()
%126 = trunc i32 %125 to i8
store i8 %126, i8* %2
%127 = xor i8 %126, -1
%128 = call zeroext i8 @answer_5(i8 zeroext %126)
%129 = icmp ne i8 %128, %127
%130 = zext i1 %129 to i32
store i32 %130, i32* %122
%131 = add nuw nsw i32 %124, 1
%132 = xor i1 %129, true
%133 = icmp ult i32 %124, 49
%134 = select i1 %132, i1 %133, i1 false
br i1 %134, label %123, label %135
135: ; preds = %123
%136 = zext i8 %127 to i32
%137 = zext i8 %128 to i32
%138 = select i1 %129, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %136, i32 %137, i8* %138)
br label %269
140: ; preds = %14
%141 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), i32 5)
%142 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([143 x i8], [143 x i8]* @str.35, i64 0, i64 0))
%143 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
br label %147
144: ; preds = %147
%145 = add nuw nsw i32 %148, 1
%146 = icmp eq i32 %145, 50
br i1 %146, label %159, label %147
147: ; preds = %140, %144
%148 = phi i32 [ 0, %140 ], [ %145, %144 ]
%149 = call i32 (...) @rand()
%150 = srem i32 %149, 8
%151 = call i32 (...) @rand()
%152 = trunc i32 %151 to i8
store i8 %152, i8* %2
%153 = shl nuw nsw i32 1, %150
%154 = xor i32 %153, %151
%155 = trunc i32 %154 to i8
%156 = call zeroext i8 @answer_6(i8 zeroext %152, i32 %150)
%157 = icmp ne i8 %156, %155
%158 = zext i1 %157 to i32
store i32 %158, i32* %143
br i1 %157, label %161, label %144
159: ; preds = %144
%160 = trunc i32 %154 to i8
br label %161
161: ; preds = %147, %159
%162 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %159 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %147 ]
%163 = phi i8 [ %160, %159 ], [ %156, %147 ]
%164 = and i32 %154, 255
%165 = zext i8 %163 to i32
%166 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %164, i32 %165, i8* %162)
br label %269
167: ; preds = %14
%168 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.17, i64 0, i64 0), i32 5)
%169 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([114 x i8], [114 x i8]* @str.34, i64 0, i64 0))
%170 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
br label %171
171: ; preds = %171, %167
%172 = phi i32 [ 0, %167 ], [ %184, %171 ]
%173 = call i32 (...) @rand()
%174 = srem i32 %173, 8
%175 = call i32 (...) @rand()
%176 = trunc i32 %175 to i8
store i8 %176, i8* %2
%177 = and i32 %175, 255
%178 = lshr i32 %177, %174
%179 = trunc i32 %178 to i8
%180 = and i8 %179, 1
%181 = call zeroext i8 @answer_7(i8 zeroext %176, i32 %174)
%182 = icmp ne i8 %180, %181
%183 = zext i1 %182 to i32
store i32 %183, i32* %170
%184 = add nuw nsw i32 %172, 1
%185 = xor i1 %182, true
%186 = icmp ult i32 %172, 49
%187 = select i1 %185, i1 %186, i1 false
br i1 %187, label %171, label %188
188: ; preds = %171
%189 = zext i8 %180 to i32
%190 = zext i8 %181 to i32
%191 = select i1 %182, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%192 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.19, i64 0, i64 0), i32 %189, i32 %190, i8* %191)
br label %269
193: ; preds = %14
%194 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0), i32 5)
%195 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([215 x i8], [215 x i8]* @str.33, i64 0, i64 0))
%196 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
br label %197
197: ; preds = %197, %193
%198 = phi i32 [ 0, %193 ], [ %215, %197 ]
%199 = call i32 (...) @rand()
%200 = srem i32 %199, 8
%201 = call i32 (...) @rand()
%202 = srem i32 %201, 8
%203 = call i32 (...) @rand()
%204 = trunc i32 %203 to i8
store i8 %204, i8* %2
%205 = and i32 %203, 255
%206 = shl nuw nsw i32 1, %200
%207 = or i32 %205, %206
%208 = lshr i32 %207, %202
%209 = trunc i32 %208 to i8
%210 = and i8 %209, 1
%211 = xor i8 %210, 1
%212 = call zeroext i8 @answer_8(i8 zeroext %204, i32 %200, i32 %202)
%213 = icmp ne i8 %211, %212
%214 = zext i1 %213 to i32
store i32 %214, i32* %196
%215 = add nuw nsw i32 %198, 1
%216 = xor i1 %213, true
%217 = icmp ult i32 %198, 49
%218 = select i1 %216, i1 %217, i1 false
br i1 %218, label %197, label %219
219: ; preds = %197
%220 = zext i8 %211 to i32
%221 = zext i8 %212 to i32
%222 = select i1 %213, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%223 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.19, i64 0, i64 0), i32 %220, i32 %221, i8* %222)
br label %269
224: ; preds = %14
%225 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0), i32 5)
%226 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([146 x i8], [146 x i8]* @str.32, i64 0, i64 0))
%227 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
br label %228
228: ; preds = %228, %224
%229 = phi i32 [ 0, %224 ], [ %239, %228 ]
%230 = call i32 (...) @rand()
%231 = srem i32 %230, 8
%232 = add nsw i32 %231, 1
%233 = shl nsw i32 -1, %232
%234 = trunc i32 %233 to i8
%235 = xor i8 %234, -1
%236 = call zeroext i8 @answer_9(i32 %231)
%237 = icmp ne i8 %236, %235
%238 = zext i1 %237 to i32
store i32 %238, i32* %227
%239 = add nuw nsw i32 %229, 1
%240 = xor i1 %237, true
%241 = icmp ult i32 %229, 49
%242 = select i1 %240, i1 %241, i1 false
br i1 %242, label %228, label %243
243: ; preds = %228
%244 = zext i8 %235 to i32
%245 = zext i8 %236 to i32
%246 = select i1 %237, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%247 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %244, i32 %245, i8* %246)
br label %269
248: ; preds = %14
%249 = call i32 @print_heading(i8 signext 46, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.24, i64 0, i64 0), i32 5)
%250 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([118 x i8], [118 x i8]* @str, i64 0, i64 0))
%251 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %15
br label %252
252: ; preds = %252, %248
%253 = phi i32 [ 0, %248 ], [ %260, %252 ]
%254 = call i32 (...) @rand()
%255 = trunc i32 %254 to i8
store i8 %255, i8* %2
%256 = lshr i8 %255, 6
%257 = call zeroext i8 @answer_10(i8* %2)
%258 = icmp ne i8 %256, %257
%259 = zext i1 %258 to i32
store i32 %259, i32* %251
%260 = add nuw nsw i32 %253, 1
%261 = xor i1 %258, true
%262 = icmp ult i32 %253, 49
%263 = select i1 %261, i1 %262, i1 false
br i1 %263, label %252, label %264
264: ; preds = %252
%265 = zext i8 %256 to i32
%266 = zext i8 %257 to i32
%267 = select i1 %258, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%268 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %265, i32 %266, i8* %267)
br label %269
269: ; preds = %264, %243, %219, %188, %161, %135, %113, %85, %59, %35
%270 = call i32 @print_heading(i8 signext 46, i8* null, i32 0)
%271 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.31, i64 0, i64 0))
%272 = add nuw nsw i64 %15, 1
%273 = icmp eq i64 %272, 10
br i1 %273, label %274, label %14
274: ; preds = %269
%275 = bitcast [10 x i32]* %3 to <8 x i32>*
%276 = load <8 x i32>, <8 x i32>* %275
%277 = icmp eq <8 x i32> %276, zeroinitializer
%278 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
%279 = load i32, i32* %278
%280 = icmp eq i32 %279, 0
%281 = zext i1 %280 to i32
%282 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
%283 = load i32, i32* %282
%284 = icmp eq i32 %283, 0
%285 = zext i1 %284 to i32
%286 = bitcast <8 x i1> %277 to i8
%287 = call i8 @llvm.ctpop.i8(i8 %286)
%288 = zext i8 %287 to i32
%289 = add nuw nsw i32 %288, %281
%290 = add nuw nsw i32 %289, %285
%291 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%292 = call i32 @print_heading(i8 signext 126, i8* null, i32 0)
%293 = call i32 (i8*, i8*, ...) @sprintf(i8* %291, i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.27, i64 0, i64 0), i32 %290, i32 10)
%294 = call i32 @print_heading(i8 signext 126, i8* %291, i32 16)
%295 = call i32 @print_heading(i8 signext 126, i8* null, i32 0)
%296 = icmp eq i32 %290, 10
br i1 %296, label %297, label %298
297: ; preds = %274
br label %299
298: ; preds = %274
br label %299
299: ; preds = %298, %297
%300 = call i32 @print_heading(i8 signext 126, i8* %291, i32 12)
%301 = call i32 @print_heading(i8 signext 126, i8* null, i32 0)
br label %302
302: ; preds = %14, %299
%303 = phi i32 [ 0, %299 ], [ -1, %14 ]
ret i32 %303
}