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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
scalar_t__ posix_memalign(void **, int, int);
int pq_check(int, int, void *);
int /*<<< orphan*/ pq_gen_base(int, int, void *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ rand_buffer(void *, int);
int /*<<< orphan*/ ref_multi_pq(int, int, void **);
int /*<<< orphan*/ srand(int);
int main(int argc, char *argv[]) {
  int i, j, k, ret, fail = 0;
  void *buffs[16 + 2];
  char c;
  char *tmp_buf[16 + 2];
  int serr, lerr;
  printf("Test pq_check_test %d sources X %d bytes\n", 16, 1024);
  srand(0x1234);
  for (i = 0; i < 16 + 2; i++) {
    void *buf;
    if (posix_memalign(&buf, 16, 1024)) {
      printf("alloc error: Fail");
      return 1;
    }
    buffs[i] = buf;
  }
  for (i = 0; i < 16 + 2; i++)
    memset(buffs[i], 0, 1024);
  ref_multi_pq(16 + 2, 1024, buffs);
  ret = pq_check(16 + 2, 1024, buffs);
  if (ret != 0) {
    fail++;
    printf("\nfail zero test %d\n", ret);
  }
  ((char *)(buffs[0]))[1024 - 2] = 0x7;
  ret = pq_check(16 + 2, 1024, buffs);
  if (ret == 0) {
    fail++;
    printf("\nfail corrupt buffer test %d\n", ret);
  }
  ((char *)(buffs[0]))[1024 - 2] = 0;
  for (j = 0; j < 16 + 2; j++) {
    for (i = 1024 - 1; i >= 0; i--) {
      ((char *)buffs[j])[i] = 0x5;
      ret = pq_check(16 + 2, 1024, buffs);
      if (ret == 0) {
        fail++;
        printf("\nfail corrupt zero buffer test j=%d, i=%d\n", j, i);
        return 1;
      }
      ((char *)buffs[j])[i] = 0;
    }
    putchar('.');
  }
  for (i = 0; i < 16 + 2; i++)
    rand_buffer(buffs[i], 1024);
  ref_multi_pq(16 + 2, 1024, buffs);
  ret = pq_check(16 + 2, 1024, buffs);
  if (ret != 0) {
    fail++;
    printf("fail first rand test %d\n", ret);
  }
  c = ((char *)(buffs[0]))[1024 - 2];
  ((char *)(buffs[0]))[1024 - 2] = c ^ 0x1;
  ret = pq_check(16 + 2, 1024, buffs);
  if (ret == 0) {
    fail++;
    printf("\nFail corrupt buffer test, passed when should have failed\n");
  }
  ((char *)(buffs[0]))[1024 - 2] = c;
  for (j = 0; j < 16 + 2; j++) {
    for (i = 1024 - 1; i >= 0; i--) {
      ret = pq_check(16 + 2, 1024, buffs);
      if (ret != 0) {
        fail++;
        printf("\nFail rand test with un-corrupted buffer j=%d, i=%d\n", j, i);
        return 1;
      }
      c = ((char *)buffs[j])[i];
      ((char *)buffs[j])[i] = c ^ 1;
      ret = pq_check(16 + 2, 1024, buffs);
      if (ret == 0) {
        fail++;
        printf("\nfail corrupt buffer test j=%d, i=%d\n", j, i);
        return 1;
      }
      ((char *)buffs[j])[i] = c;
    }
    putchar('.');
  }
  for (j = 4; j <= 16 + 2; j++) {
    for (i = 0; i < j; i++)
      rand_buffer(buffs[i], 1024);
    ref_multi_pq(j, 1024, buffs);
    for (i = 0; i < j; i++) {
      for (k = 0; k < 1024; k++) {
        ret = pq_check(j, 1024, buffs);
        if (ret != 0) {
          printf("\nfail rand fixed len test %d sources\n", j);
          fail++;
          return 1;
        }
        c = ((char *)buffs[i])[k];
        ((char *)buffs[i])[k] = c ^ 1;
        ret = pq_check(j, 1024, buffs);
        if (ret == 0) {
          printf("\nfail rand fixed len test corrupted buffer %d sources\n", j);
          fail++;
          return 1;
        }
        ((char *)buffs[i])[k] = c;
      }
    }
    putchar('.');
  }
  fflush(0);
  k = 16;
  while (k <= 1024) {
    char *tmp;
    for (j = 4; j <= 16 + 2; j++) {
      for (i = 0; i < j; i++)
        rand_buffer(buffs[i], k);
      ref_multi_pq(j, k, buffs);
      for (lerr = 0; lerr < k; lerr++) {
        for (serr = 0; serr < j; serr++) {
          ret = pq_check(j, k, buffs);
          if (ret != 0) {
            printf("\nfail rand var src, len test %d sources, len=%d\n", j, k);
            fail++;
            return 1;
          }
          tmp = (char *)buffs[serr];
          c = tmp[lerr];
          ((char *)buffs[serr])[lerr] = c ^ 1;
          ret = pq_check(j, k, buffs);
          if (ret == 0) {
            printf("\nfail rand var src, len test corrupted buffer "
                   "%d sources, len=%d, ret=%d\n",
                   j, k, ret);
            fail++;
            return 1;
          }
          ((char *)buffs[serr])[lerr] = c;
        }
      }
      putchar('.');
      fflush(0);
    }
    k += 16;
  }
  for (i = 0; i < 1024; i += 16) {
    for (j = 0; j < 16 + 2; j++) {
      rand_buffer(buffs[j], 1024 - i);
      tmp_buf[j] = (char *)buffs[j] + i;
    }
    pq_gen_base(16 + 2, 1024 - i, (void *)tmp_buf);
    ret = pq_check(16 + 2, 1024 - i, (void *)tmp_buf);
    if (ret != 0) {
      printf("fail end test - offset: %d, len: %d\n", i, 1024 - i);
      fail++;
      return 1;
    }
    for (serr = 0; serr < 16 + 2; serr++) {
      for (lerr = 0; lerr < (1024 - i); lerr++) {
        c = tmp_buf[serr][lerr];
        tmp_buf[serr][lerr] = c ^ 1;
        ret = pq_check(16 + 2, 1024 - i, (void *)tmp_buf);
        if (ret == 0) {
          printf("fail end test corrupted buffer - "
                 "offset: %d, len: %d, ret: %d\n",
                 i, 1024 - i, ret);
          fail++;
          return 1;
        }
        tmp_buf[serr][lerr] = c;
      }
    }
    putchar('.');
    fflush(0);
  }
  if (fail == 0)
    printf("Pass\n");
  return fail;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xe39(%rip),%rdi
mov    $0x10,%esi
mov    $0x400,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1234,%edi
call   1070 <srand@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x12,-0x14(%rbp)
jge    124e <main+0xae>
lea    -0x170(%rbp),%rdi
mov    $0x10,%esi
mov    $0x400,%edx
call   10b0 <posix_memalign@plt>
cmp    $0x0,%rax
je     122d <main+0x8d>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1bf0 <main+0xa50>
mov    -0x170(%rbp),%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0xc0(%rbp,%rax,8)
ff
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e9 <main+0x49>
movl   $0x0,-0x14(%rbp)
cmpl   $0x12,-0x14(%rbp)
jge    1285 <main+0xe5>
movslq -0x14(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rdi
ff
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1255 <main+0xb5>
lea    -0xc0(%rbp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   1080 <ref_multi_pq@plt>
lea    -0xc0(%rbp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     12d8 <main+0x138>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%esi
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc0(%rbp),%rax
movb   $0x7,0x3fe(%rax)
lea    -0xc0(%rbp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1323 <main+0x183>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%esi
lea    0xd34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc0(%rbp),%rax
movb   $0x0,0x3fe(%rax)
movl   $0x0,-0x18(%rbp)
cmpl   $0x12,-0x18(%rbp)
jge    13ed <main+0x24d>
movl   $0x3ff,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     13d5 <main+0x235>
movslq -0x18(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x14(%rbp),%rcx
movb   $0x5,(%rax,%rcx,1)
lea    -0xc0(%rbp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    13b3 <main+0x213>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1bf0 <main+0xa50>
movslq -0x18(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1349 <main+0x1a9>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1338 <main+0x198>
movl   $0x0,-0x14(%rbp)
cmpl   $0x12,-0x14(%rbp)
jge    1422 <main+0x282>
movslq -0x14(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rdi
ff
mov    $0x400,%esi
call   1090 <rand_buffer@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13f4 <main+0x254>
lea    -0xc0(%rbp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   1080 <ref_multi_pq@plt>
lea    -0xc0(%rbp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1475 <main+0x2d5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%esi
lea    0xc2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc0(%rbp),%rax
mov    0x3fe(%rax),%al
mov    %al,-0xc1(%rbp)
movsbl -0xc1(%rbp),%eax
xor    $0x1,%eax
mov    %al,%cl
mov    -0xc0(%rbp),%rax
mov    %cl,0x3fe(%rax)
lea    -0xc0(%rbp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    14db <main+0x33b>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
lea    0xbde(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc1(%rbp),%cl
mov    -0xc0(%rbp),%rax
mov    %cl,0x3fe(%rax)
movl   $0x0,-0x18(%rbp)
cmpl   $0x12,-0x18(%rbp)
jge    161f <main+0x47f>
movl   $0x3ff,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1607 <main+0x467>
lea    -0xc0(%rbp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     155c <main+0x3bc>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xba4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1bf0 <main+0xa50>
movslq -0x18(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xc1(%rbp)
movsbl -0xc1(%rbp),%eax
xor    $0x1,%eax
mov    %al,%dl
movslq -0x18(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
lea    -0xc0(%rbp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    15e0 <main+0x440>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xb55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1bf0 <main+0xa50>
mov    -0xc1(%rbp),%dl
movslq -0x18(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1506 <main+0x366>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    14f5 <main+0x355>
movl   $0x4,-0x18(%rbp)
cmpl   $0x12,-0x18(%rbp)
jg     17ba <main+0x61a>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1667 <main+0x4c7>
movslq -0x14(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rdi
ff
mov    $0x400,%esi
call   1090 <rand_buffer@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1637 <main+0x497>
mov    -0x18(%rbp),%edi
lea    -0xc0(%rbp),%rdx
mov    $0x400,%esi
call   1080 <ref_multi_pq@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    17a2 <main+0x602>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x400,-0x1c(%rbp)
jge    178f <main+0x5ef>
mov    -0x18(%rbp),%edi
lea    -0xc0(%rbp),%rdx
mov    $0x400,%esi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     16e9 <main+0x549>
mov    -0x18(%rbp),%esi
lea    0xa7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x4(%rbp)
jmp    1bf0 <main+0xa50>
movslq -0x14(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xc1(%rbp)
movsbl -0xc1(%rbp),%eax
xor    $0x1,%eax
mov    %al,%dl
movslq -0x14(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%edi
lea    -0xc0(%rbp),%rdx
mov    $0x400,%esi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1768 <main+0x5c8>
mov    -0x18(%rbp),%esi
lea    0xa22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x4(%rbp)
jmp    1bf0 <main+0xa50>
mov    -0xc1(%rbp),%dl
movslq -0x14(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1695 <main+0x4f5>
jmp    1794 <main+0x5f4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1682 <main+0x4e2>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1626 <main+0x486>
xor    %edi,%edi
call   10a0 <fflush@plt>
movl   $0x10,-0x1c(%rbp)
cmpl   $0x400,-0x1c(%rbp)
jg     19bd <main+0x81d>
movl   $0x4,-0x18(%rbp)
cmpl   $0x12,-0x18(%rbp)
jg     19af <main+0x80f>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    181b <main+0x67b>
movslq -0x14(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rdi
ff
mov    -0x1c(%rbp),%esi
call   1090 <rand_buffer@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    17ed <main+0x64d>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
lea    -0xc0(%rbp),%rdx
call   1080 <ref_multi_pq@plt>
movl   $0x0,-0x168(%rbp)
mov    -0x168(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1990 <main+0x7f0>
movl   $0x0,-0x164(%rbp)
mov    -0x164(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1977 <main+0x7d7>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
lea    -0xc0(%rbp),%rdx
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     18a7 <main+0x707>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0x91a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x4(%rbp)
jmp    1bf0 <main+0xa50>
movslq -0x164(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
mov    %rax,-0x178(%rbp)
mov    -0x178(%rbp),%rax
movslq -0x168(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xc1(%rbp)
movsbl -0xc1(%rbp),%eax
xor    $0x1,%eax
mov    %al,%dl
movslq -0x164(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x168(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
lea    -0xc0(%rbp),%rdx
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1944 <main+0x7a4>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0x8ae(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x4(%rbp)
jmp    1bf0 <main+0xa50>
mov    -0xc1(%rbp),%dl
movslq -0x164(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x168(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1850 <main+0x6b0>
jmp    197c <main+0x7dc>
mov    -0x168(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x168(%rbp)
jmp    1837 <main+0x697>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    17dc <main+0x63c>
mov    -0x1c(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x1c(%rbp)
jmp    17c8 <main+0x628>
movl   $0x0,-0x14(%rbp)
cmpl   $0x400,-0x14(%rbp)
jge    1bd2 <main+0xa32>
movl   $0x0,-0x18(%rbp)
cmpl   $0x12,-0x18(%rbp)
jge    1a28 <main+0x888>
movslq -0x18(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rdi
ff
mov    $0x400,%esi
sub    -0x14(%rbp),%esi
call   1090 <rand_buffer@plt>
movslq -0x18(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rcx
ff
movslq -0x14(%rbp),%rax
add    %rax,%rcx
movslq -0x18(%rbp),%rax
mov    %rcx,-0x160(%rbp,%rax,8)
ff
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    19d8 <main+0x838>
mov    $0x400,%esi
sub    -0x14(%rbp),%esi
lea    -0x160(%rbp),%rdx
mov    $0x12,%edi
call   1040 <pq_gen_base@plt>
mov    $0x400,%esi
sub    -0x14(%rbp),%esi
lea    -0x160(%rbp),%rdx
mov    $0x12,%edi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1a95 <main+0x8f5>
mov    -0x14(%rbp),%esi
mov    $0x400,%edx
sub    -0x14(%rbp),%edx
lea    0x7a7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x4(%rbp)
jmp    1bf0 <main+0xa50>
movl   $0x0,-0x164(%rbp)
cmpl   $0x12,-0x164(%rbp)
jge    1bb3 <main+0xa13>
movl   $0x0,-0x168(%rbp)
mov    -0x168(%rbp),%eax
mov    $0x400,%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    1b9a <main+0x9fa>
movslq -0x164(%rbp),%rax
mov    -0x160(%rbp,%rax,8),%rax
ff
movslq -0x168(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xc1(%rbp)
movsbl -0xc1(%rbp),%eax
xor    $0x1,%eax
mov    %al,%dl
movslq -0x164(%rbp),%rax
mov    -0x160(%rbp,%rax,8),%rax
ff
movslq -0x168(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    $0x400,%esi
sub    -0x14(%rbp),%esi
lea    -0x160(%rbp),%rdx
mov    $0x12,%edi
call   10c0 <pq_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1b67 <main+0x9c7>
mov    -0x14(%rbp),%esi
mov    $0x400,%edx
sub    -0x14(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0x6fa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x4(%rbp)
jmp    1bf0 <main+0xa50>
mov    -0xc1(%rbp),%dl
movslq -0x164(%rbp),%rax
mov    -0x160(%rbp,%rax,8),%rax
ff
movslq -0x168(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x168(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x168(%rbp)
jmp    1ab6 <main+0x916>
jmp    1b9f <main+0x9ff>
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1a9f <main+0x8ff>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    -0x14(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x14(%rbp)
jmp    19c4 <main+0x824>
cmpl   $0x0,-0x24(%rbp)
jne    1bea <main+0xa4a>
lea    0x6a1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
lea    0xe38(%rip),%rdi
xor    %ebp,%ebp
mov    $0x10,%esi
mov    $0x400,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1234,%edi
call   1080 <srand@plt>
lea    0xa0(%rsp),%rbx
nopl   (%rax)
mov    %rbx,%rdi
mov    $0x10,%esi
mov    $0x400,%edx
call   10c0 <posix_memalign@plt>
test   %rax,%rax
jne    1adb <main+0x92b>
mov    0xa0(%rsp),%rax
mov    %rax,0x10(%rsp,%rbp,8)
add    $0x1,%rbp
cmp    $0x12,%rbp
jne    11f0 <main+0x40>
mov    0x10(%rsp),%rdi
xor    %r12d,%r12d
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x18(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x20(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x28(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x30(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x38(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x40(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x48(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x50(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x58(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x60(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x68(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x70(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x78(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x80(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x88(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x90(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    0x98(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    0x10(%rsp),%rbx
mov    $0x12,%edi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1090 <ref_multi_pq@plt>
mov    $0x12,%edi
mov    $0x400,%esi
mov    %rbx,%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
je     13a6 <main+0x1f6>
lea    0xca5(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%r12d
mov    0x10(%rsp),%rax
movb   $0x7,0x3fe(%rax)
lea    0x10(%rsp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   10d0 <pq_check@plt>
test   %eax,%eax
jne    13de <main+0x22e>
add    $0x1,%r12d
lea    0xc7b(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%rax
movb   $0x0,0x3fe(%rax)
xor    %ebx,%ebx
lea    0x10(%rsp),%r14
mov    $0x3ff,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp,%rbx,8),%rax
movb   $0x5,(%rax,%rbp,1)
mov    $0x12,%edi
mov    $0x400,%esi
mov    %r14,%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
je     1aeb <main+0x93b>
mov    0x10(%rsp,%rbx,8),%rax
movb   $0x0,(%rax,%rbp,1)
add    $0xffffffffffffffff,%rbp
jb     1400 <main+0x250>
mov    $0x2e,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x12,%rbx
jne    13f1 <main+0x241>
mov    0x10(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x18(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x20(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x28(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x30(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x38(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x40(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x48(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x50(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x58(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x60(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x68(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x70(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x78(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x80(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x88(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x90(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
mov    0x98(%rsp),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
lea    0x10(%rsp),%rbx
mov    $0x12,%edi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1090 <ref_multi_pq@plt>
mov    $0x12,%edi
mov    $0x400,%esi
mov    %rbx,%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
je     15a1 <main+0x3f1>
add    $0x1,%r12d
lea    0xb01(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%rax
mov    0x3fe(%rax),%bl
mov    %ebx,%ecx
xor    $0x1,%cl
mov    %cl,0x3fe(%rax)
lea    0x10(%rsp),%rdx
mov    $0x12,%edi
mov    $0x400,%esi
call   10d0 <pq_check@plt>
test   %eax,%eax
jne    15df <main+0x42f>
add    $0x1,%r12d
lea    0xc74(%rip),%rdi
call   1050 <puts@plt>
mov    0x10(%rsp),%rax
mov    %bl,0x3fe(%rax)
xor    %r15d,%r15d
lea    0x10(%rsp),%r14
mov    $0x3ff,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x12,%edi
mov    $0x400,%esi
mov    %r14,%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
jne    1b18 <main+0x968>
mov    0x10(%rsp,%r15,8),%rax
movzbl (%rax,%rbp,1),%ebx
mov    %ebx,%ecx
xor    $0x1,%cl
mov    %cl,(%rax,%rbp,1)
mov    $0x12,%edi
mov    $0x400,%esi
mov    %r14,%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
je     1b21 <main+0x971>
mov    0x10(%rsp,%r15,8),%rax
mov    %bl,(%rax,%rbp,1)
add    $0xffffffffffffffff,%rbp
jb     1600 <main+0x450>
mov    $0x2e,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
cmp    $0x12,%r15
jne    15f2 <main+0x442>
mov    $0x4,%ebp
lea    0x10(%rsp),%r14
xor    %ebx,%ebx
mov    0x10(%rsp,%rbx,8),%rdi
mov    $0x400,%esi
call   10a0 <rand_buffer@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1673 <main+0x4c3>
mov    %ebp,%edi
mov    $0x400,%esi
mov    %r14,%rdx
call   1090 <ref_multi_pq@plt>
xor    %r15d,%r15d
xor    %ebx,%ebx
mov    %ebp,%edi
mov    $0x400,%esi
mov    %r14,%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
jne    1b2d <main+0x97d>
mov    0x10(%rsp,%r15,8),%rax
movzbl (%rax,%rbx,1),%r13d
mov    %r13d,%ecx
xor    $0x1,%cl
mov    %cl,(%rax,%rbx,1)
mov    %ebp,%edi
mov    $0x400,%esi
mov    %r14,%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
je     1b36 <main+0x986>
mov    0x10(%rsp,%r15,8),%rax
mov    %r13b,(%rax,%rbx,1)
add    $0x1,%rbx
cmp    $0x400,%rbx
jne    169f <main+0x4ef>
add    $0x1,%r15
cmp    %rbp,%r15
jne    169d <main+0x4ed>
mov    $0x2e,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    $0x13,%rbp
jne    1671 <main+0x4c1>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0x10,%r14d
mov    $0x4,%r13d
xor    %ebx,%ebx
mov    0x10(%rsp,%rbx,8),%rdi
mov    %r14d,%esi
call   10a0 <rand_buffer@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    172c <main+0x57c>
mov    %r13d,%edi
mov    %r14d,%esi
lea    0x10(%rsp),%rdx
call   1090 <ref_multi_pq@plt>
xor    %ebx,%ebx
xor    %ebp,%ebp
mov    %r13d,%edi
mov    %r14d,%esi
lea    0x10(%rsp),%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
jne    1b48 <main+0x998>
mov    0x10(%rsp,%rbp,8),%rax
movzbl (%rax,%rbx,1),%r15d
mov    %r15d,%ecx
xor    $0x1,%cl
mov    %cl,(%rax,%rbx,1)
mov    %r13d,%edi
mov    %r14d,%esi
lea    0x10(%rsp),%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
je     1b57 <main+0x9a7>
mov    0x10(%rsp,%rbp,8),%rax
mov    %r15b,(%rax,%rbx,1)
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1756 <main+0x5a6>
add    $0x1,%rbx
cmp    %r14,%rbx
jne    1754 <main+0x5a4>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
add    $0x1,%r13
cmp    $0x13,%r13
jne    172a <main+0x57a>
lea    0x10(%r14),%rax
cmp    $0x3f1,%r14
mov    %rax,%r14
jb     1724 <main+0x574>
mov    $0x400,%r13d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    0x10(%rsp),%rdi
mov    $0x400,%ebp
mov    0x8(%rsp),%rbx
sub    %ebx,%ebp
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x10(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xa0(%rsp)
mov    0x18(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x18(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xa8(%rsp)
mov    0x20(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x20(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xb0(%rsp)
mov    0x28(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x28(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xb8(%rsp)
mov    0x30(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x30(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xc0(%rsp)
mov    0x38(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x38(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xc8(%rsp)
mov    0x40(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x40(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xd0(%rsp)
mov    0x48(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x48(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xd8(%rsp)
mov    0x50(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x50(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xe0(%rsp)
mov    0x58(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x58(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xe8(%rsp)
mov    0x60(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x60(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xf0(%rsp)
mov    0x68(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x68(%rsp),%rax
add    %rbx,%rax
mov    %rax,0xf8(%rsp)
mov    0x70(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x70(%rsp),%rax
add    %rbx,%rax
mov    %rax,0x100(%rsp)
mov    0x78(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x78(%rsp),%rax
add    %rbx,%rax
mov    %rax,0x108(%rsp)
mov    0x80(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x80(%rsp),%rax
add    %rbx,%rax
mov    %rax,0x110(%rsp)
mov    0x88(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x88(%rsp),%rax
add    %rbx,%rax
mov    %rax,0x118(%rsp)
mov    0x90(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x90(%rsp),%rax
add    %rbx,%rax
mov    %rax,0x120(%rsp)
mov    0x98(%rsp),%rdi
mov    %ebp,%esi
call   10a0 <rand_buffer@plt>
mov    0x98(%rsp),%rax
add    %rbx,%rax
mov    %rax,0x128(%rsp)
mov    $0x12,%edi
mov    %ebp,%esi
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdx
call   1040 <pq_gen_base@plt>
mov    $0x12,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
jne    1b7f <main+0x9cf>
xor    %ebx,%ebx
xor    %r15d,%r15d
mov    0xa0(%rsp,%rbx,8),%rax
movzbl (%rax,%r15,1),%r14d
mov    %r14d,%ecx
xor    $0x1,%cl
mov    %cl,(%rax,%r15,1)
mov    $0x12,%edi
mov    %ebp,%esi
lea    0xa0(%rsp),%rdx
call   10d0 <pq_check@plt>
test   %eax,%eax
je     1b6f <main+0x9bf>
mov    0xa0(%rsp,%rbx,8),%rax
mov    %r14b,(%rax,%r15,1)
add    $0x1,%r15
cmp    %r15,%r13
jne    1a43 <main+0x893>
add    $0x1,%rbx
cmp    $0x12,%rbx
jne    1a40 <main+0x890>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    0x8(%rsp),%rcx
lea    0x10(%rcx),%rax
add    $0xfffffffffffffff0,%r13
cmp    $0x3f0,%rcx
mov    %rax,0x8(%rsp)
jb     17f4 <main+0x644>
test   %r12d,%r12d
jne    1b03 <main+0x953>
lea    0x778(%rip),%rdi
call   1050 <puts@plt>
xor    %r12d,%r12d
jmp    1b03 <main+0x953>
lea    0x548(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1afd <main+0x94d>
lea    0x57c(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x593(%rip),%rdi
jmp    1b28 <main+0x978>
lea    0x5bf(%rip),%rdi
mov    %r15d,%esi
jmp    1af4 <main+0x944>
lea    0x5d9(%rip),%rdi
jmp    1b3d <main+0x98d>
lea    0x5f6(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1afd <main+0x94d>
lea    0x61b(%rip),%rdi
mov    %r13d,%esi
mov    %r14d,%edx
jmp    1af6 <main+0x946>
lea    0x63d(%rip),%rdi
mov    %r13d,%esi
mov    %r14d,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1afd <main+0x94d>
lea    0x694(%rip),%rdi
mov    0x8(%rsp),%rsi
mov    %ebp,%edx
jmp    1b64 <main+0x9b4>
lea    0x65f(%rip),%rdi
mov    0x8(%rsp),%rsi
mov    %ebp,%edx
jmp    1af6 <main+0x946>

LLVM IR (-O0):
@.str = [42 x i8] c"Test pq_check_test %d sources X %d bytes\0A\00"
@.str.1 = [18 x i8] c"alloc error: Fail\00"
@.str.2 = [20 x i8] c"\0Afail zero test %d\0A\00"
@.str.3 = [30 x i8] c"\0Afail corrupt buffer test %d\0A\00"
@.str.4 = [43 x i8] c"\0Afail corrupt zero buffer test j=%d, i=%d\0A\00"
@.str.5 = [25 x i8] c"fail first rand test %d\0A\00"
@.str.6 = [59 x i8] c"\0AFail corrupt buffer test, passed when should have failed\0A\00"
@.str.7 = [53 x i8] c"\0AFail rand test with un-corrupted buffer j=%d, i=%d\0A\00"
@.str.8 = [38 x i8] c"\0Afail corrupt buffer test j=%d, i=%d\0A\00"
@.str.9 = [38 x i8] c"\0Afail rand fixed len test %d sources\0A\00"
@.str.10 = [55 x i8] c"\0Afail rand fixed len test corrupted buffer %d sources\0A\00"
@.str.11 = [49 x i8] c"\0Afail rand var src, len test %d sources, len=%d\0A\00"
@.str.12 = [74 x i8] c"\0Afail rand var src, len test corrupted buffer %d sources, len=%d, ret=%d\0A\00"
@.str.13 = [37 x i8] c"fail end test - offset: %d, len: %d\0A\00"
@.str.14 = [63 x i8] c"fail end test corrupted buffer - offset: %d, len: %d, ret: %d\0A\00"
@.str.15 = [6 x i8] c"Pass\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [18 x i8*]
%12 = alloca i8
%13 = alloca [18 x i8*]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 16, i32 1024)
%19 = call i32 @srand(i32 4660)
store i32 0, i32* %6
br label %20
20: ; preds = %33, %2
%21 = load i32, i32* %6
%22 = icmp slt i32 %21, 18
br i1 %22, label %23, label %36
23: ; preds = %20
%24 = call i64 @posix_memalign(i8** %16, i32 16, i32 1024)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %570
28: ; preds = %23
%29 = load i8*, i8** %16
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %31
store i8* %29, i8** %32
br label %33
33: ; preds = %28
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %20
36: ; preds = %20
store i32 0, i32* %6
br label %37
37: ; preds = %46, %36
%38 = load i32, i32* %6
%39 = icmp slt i32 %38, 18
br i1 %39, label %40, label %49
40: ; preds = %37
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @memset(i8* %44, i32 0, i32 1024)
br label %46
46: ; preds = %40
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %37
49: ; preds = %37
%50 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%51 = call i32 @ref_multi_pq(i32 18, i32 1024, i8** %50)
%52 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%53 = bitcast i8** %52 to i8*
%54 = call i32 @pq_check(i32 18, i32 1024, i8* %53)
store i32 %54, i32* %9
%55 = load i32, i32* %9
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %62
57: ; preds = %49
%58 = load i32, i32* %10
%59 = add nsw i32 %58, 1
store i32 %59, i32* %10
%60 = load i32, i32* %9
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %57, %49
%63 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%64 = load i8*, i8** %63
%65 = getelementptr inbounds i8, i8* %64, i64 1022
store i8 7, i8* %65
%66 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%67 = bitcast i8** %66 to i8*
%68 = call i32 @pq_check(i32 18, i32 1024, i8* %67)
store i32 %68, i32* %9
%69 = load i32, i32* %9
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %76
71: ; preds = %62
%72 = load i32, i32* %10
%73 = add nsw i32 %72, 1
store i32 %73, i32* %10
%74 = load i32, i32* %9
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %71, %62
%77 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%78 = load i8*, i8** %77
%79 = getelementptr inbounds i8, i8* %78, i64 1022
store i8 0, i8* %79
store i32 0, i32* %7
br label %80
80: ; preds = %119, %76
%81 = load i32, i32* %7
%82 = icmp slt i32 %81, 18
br i1 %82, label %83, label %122
83: ; preds = %80
store i32 1023, i32* %6
br label %84
84: ; preds = %114, %83
%85 = load i32, i32* %6
%86 = icmp sge i32 %85, 0
br i1 %86, label %87, label %117
87: ; preds = %84
%88 = load i32, i32* %7
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %89
%91 = load i8*, i8** %90
%92 = load i32, i32* %6
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %91, i64 %93
store i8 5, i8* %94
%95 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%96 = bitcast i8** %95 to i8*
%97 = call i32 @pq_check(i32 18, i32 1024, i8* %96)
store i32 %97, i32* %9
%98 = load i32, i32* %9
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %106
100: ; preds = %87
%101 = load i32, i32* %10
%102 = add nsw i32 %101, 1
store i32 %102, i32* %10
%103 = load i32, i32* %7
%104 = load i32, i32* %6
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 %103, i32 %104)
store i32 1, i32* %3
br label %570
106: ; preds = %87
%107 = load i32, i32* %7
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %108
%110 = load i8*, i8** %109
%111 = load i32, i32* %6
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i8, i8* %110, i64 %112
store i8 0, i8* %113
br label %114
114: ; preds = %106
%115 = load i32, i32* %6
%116 = add nsw i32 %115, -1
store i32 %116, i32* %6
br label %84
117: ; preds = %84
%118 = call i32 @putchar(i8 signext 46)
br label %119
119: ; preds = %117
%120 = load i32, i32* %7
%121 = add nsw i32 %120, 1
store i32 %121, i32* %7
br label %80
122: ; preds = %80
store i32 0, i32* %6
br label %123
123: ; preds = %132, %122
%124 = load i32, i32* %6
%125 = icmp slt i32 %124, 18
br i1 %125, label %126, label %135
126: ; preds = %123
%127 = load i32, i32* %6
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %128
%130 = load i8*, i8** %129
%131 = call i32 @rand_buffer(i8* %130, i32 1024)
br label %132
132: ; preds = %126
%133 = load i32, i32* %6
%134 = add nsw i32 %133, 1
store i32 %134, i32* %6
br label %123
135: ; preds = %123
%136 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%137 = call i32 @ref_multi_pq(i32 18, i32 1024, i8** %136)
%138 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%139 = bitcast i8** %138 to i8*
%140 = call i32 @pq_check(i32 18, i32 1024, i8* %139)
store i32 %140, i32* %9
%141 = load i32, i32* %9
%142 = icmp ne i32 %141, 0
br i1 %142, label %143, label %148
143: ; preds = %135
%144 = load i32, i32* %10
%145 = add nsw i32 %144, 1
store i32 %145, i32* %10
%146 = load i32, i32* %9
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %146)
br label %148
148: ; preds = %143, %135
%149 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%150 = load i8*, i8** %149
%151 = getelementptr inbounds i8, i8* %150, i64 1022
%152 = load i8, i8* %151
store i8 %152, i8* %12
%153 = load i8, i8* %12
%154 = sext i8 %153 to i32
%155 = xor i32 %154, 1
%156 = trunc i32 %155 to i8
%157 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%158 = load i8*, i8** %157
%159 = getelementptr inbounds i8, i8* %158, i64 1022
store i8 %156, i8* %159
%160 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%161 = bitcast i8** %160 to i8*
%162 = call i32 @pq_check(i32 18, i32 1024, i8* %161)
store i32 %162, i32* %9
%163 = load i32, i32* %9
%164 = icmp eq i32 %163, 0
br i1 %164, label %165, label %169
165: ; preds = %148
%166 = load i32, i32* %10
%167 = add nsw i32 %166, 1
store i32 %167, i32* %10
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0))
br label %169
169: ; preds = %165, %148
%170 = load i8, i8* %12
%171 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%172 = load i8*, i8** %171
%173 = getelementptr inbounds i8, i8* %172, i64 1022
store i8 %170, i8* %173
store i32 0, i32* %7
br label %174
174: ; preds = %238, %169
%175 = load i32, i32* %7
%176 = icmp slt i32 %175, 18
br i1 %176, label %177, label %241
177: ; preds = %174
store i32 1023, i32* %6
br label %178
178: ; preds = %233, %177
%179 = load i32, i32* %6
%180 = icmp sge i32 %179, 0
br i1 %180, label %181, label %236
181: ; preds = %178
%182 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%183 = bitcast i8** %182 to i8*
%184 = call i32 @pq_check(i32 18, i32 1024, i8* %183)
store i32 %184, i32* %9
%185 = load i32, i32* %9
%186 = icmp ne i32 %185, 0
br i1 %186, label %187, label %193
187: ; preds = %181
%188 = load i32, i32* %10
%189 = add nsw i32 %188, 1
store i32 %189, i32* %10
%190 = load i32, i32* %7
%191 = load i32, i32* %6
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0), i32 %190, i32 %191)
store i32 1, i32* %3
br label %570
193: ; preds = %181
%194 = load i32, i32* %7
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %195
%197 = load i8*, i8** %196
%198 = load i32, i32* %6
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds i8, i8* %197, i64 %199
%201 = load i8, i8* %200
store i8 %201, i8* %12
%202 = load i8, i8* %12
%203 = sext i8 %202 to i32
%204 = xor i32 %203, 1
%205 = trunc i32 %204 to i8
%206 = load i32, i32* %7
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %207
%209 = load i8*, i8** %208
%210 = load i32, i32* %6
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds i8, i8* %209, i64 %211
store i8 %205, i8* %212
%213 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%214 = bitcast i8** %213 to i8*
%215 = call i32 @pq_check(i32 18, i32 1024, i8* %214)
store i32 %215, i32* %9
%216 = load i32, i32* %9
%217 = icmp eq i32 %216, 0
br i1 %217, label %218, label %224
218: ; preds = %193
%219 = load i32, i32* %10
%220 = add nsw i32 %219, 1
store i32 %220, i32* %10
%221 = load i32, i32* %7
%222 = load i32, i32* %6
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i32 %221, i32 %222)
store i32 1, i32* %3
br label %570
224: ; preds = %193
%225 = load i8, i8* %12
%226 = load i32, i32* %7
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %227
%229 = load i8*, i8** %228
%230 = load i32, i32* %6
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds i8, i8* %229, i64 %231
store i8 %225, i8* %232
br label %233
233: ; preds = %224
%234 = load i32, i32* %6
%235 = add nsw i32 %234, -1
store i32 %235, i32* %6
br label %178
236: ; preds = %178
%237 = call i32 @putchar(i8 signext 46)
br label %238
238: ; preds = %236
%239 = load i32, i32* %7
%240 = add nsw i32 %239, 1
store i32 %240, i32* %7
br label %174
241: ; preds = %174
store i32 4, i32* %7
br label %242
242: ; preds = %332, %241
%243 = load i32, i32* %7
%244 = icmp sle i32 %243, 18
br i1 %244, label %245, label %335
245: ; preds = %242
store i32 0, i32* %6
br label %246
246: ; preds = %256, %245
%247 = load i32, i32* %6
%248 = load i32, i32* %7
%249 = icmp slt i32 %247, %248
br i1 %249, label %250, label %259
250: ; preds = %246
%251 = load i32, i32* %6
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %252
%254 = load i8*, i8** %253
%255 = call i32 @rand_buffer(i8* %254, i32 1024)
br label %256
256: ; preds = %250
%257 = load i32, i32* %6
%258 = add nsw i32 %257, 1
store i32 %258, i32* %6
br label %246
259: ; preds = %246
%260 = load i32, i32* %7
%261 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%262 = call i32 @ref_multi_pq(i32 %260, i32 1024, i8** %261)
store i32 0, i32* %6
br label %263
263: ; preds = %327, %259
%264 = load i32, i32* %6
%265 = load i32, i32* %7
%266 = icmp slt i32 %264, %265
br i1 %266, label %267, label %330
267: ; preds = %263
store i32 0, i32* %8
br label %268
268: ; preds = %323, %267
%269 = load i32, i32* %8
%270 = icmp slt i32 %269, 1024
br i1 %270, label %271, label %326
271: ; preds = %268
%272 = load i32, i32* %7
%273 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%274 = bitcast i8** %273 to i8*
%275 = call i32 @pq_check(i32 %272, i32 1024, i8* %274)
store i32 %275, i32* %9
%276 = load i32, i32* %9
%277 = icmp ne i32 %276, 0
br i1 %277, label %278, label %283
278: ; preds = %271
%279 = load i32, i32* %7
%280 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i32 %279)
%281 = load i32, i32* %10
%282 = add nsw i32 %281, 1
store i32 %282, i32* %10
store i32 1, i32* %3
br label %570
283: ; preds = %271
%284 = load i32, i32* %6
%285 = sext i32 %284 to i64
%286 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %285
%287 = load i8*, i8** %286
%288 = load i32, i32* %8
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds i8, i8* %287, i64 %289
%291 = load i8, i8* %290
store i8 %291, i8* %12
%292 = load i8, i8* %12
%293 = sext i8 %292 to i32
%294 = xor i32 %293, 1
%295 = trunc i32 %294 to i8
%296 = load i32, i32* %6
%297 = sext i32 %296 to i64
%298 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %297
%299 = load i8*, i8** %298
%300 = load i32, i32* %8
%301 = sext i32 %300 to i64
%302 = getelementptr inbounds i8, i8* %299, i64 %301
store i8 %295, i8* %302
%303 = load i32, i32* %7
%304 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%305 = bitcast i8** %304 to i8*
%306 = call i32 @pq_check(i32 %303, i32 1024, i8* %305)
store i32 %306, i32* %9
%307 = load i32, i32* %9
%308 = icmp eq i32 %307, 0
br i1 %308, label %309, label %314
309: ; preds = %283
%310 = load i32, i32* %7
%311 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0), i32 %310)
%312 = load i32, i32* %10
%313 = add nsw i32 %312, 1
store i32 %313, i32* %10
store i32 1, i32* %3
br label %570
314: ; preds = %283
%315 = load i8, i8* %12
%316 = load i32, i32* %6
%317 = sext i32 %316 to i64
%318 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %317
%319 = load i8*, i8** %318
%320 = load i32, i32* %8
%321 = sext i32 %320 to i64
%322 = getelementptr inbounds i8, i8* %319, i64 %321
store i8 %315, i8* %322
br label %323
323: ; preds = %314
%324 = load i32, i32* %8
%325 = add nsw i32 %324, 1
store i32 %325, i32* %8
br label %268
326: ; preds = %268
br label %327
327: ; preds = %326
%328 = load i32, i32* %6
%329 = add nsw i32 %328, 1
store i32 %329, i32* %6
br label %263
330: ; preds = %263
%331 = call i32 @putchar(i8 signext 46)
br label %332
332: ; preds = %330
%333 = load i32, i32* %7
%334 = add nsw i32 %333, 1
store i32 %334, i32* %7
br label %242
335: ; preds = %242
%336 = call i32 @fflush(i32 0)
store i32 16, i32* %8
br label %337
337: ; preds = %444, %335
%338 = load i32, i32* %8
%339 = icmp sle i32 %338, 1024
br i1 %339, label %340, label %447
340: ; preds = %337
store i32 4, i32* %7
br label %341
341: ; preds = %441, %340
%342 = load i32, i32* %7
%343 = icmp sle i32 %342, 18
br i1 %343, label %344, label %444
344: ; preds = %341
store i32 0, i32* %6
br label %345
345: ; preds = %356, %344
%346 = load i32, i32* %6
%347 = load i32, i32* %7
%348 = icmp slt i32 %346, %347
br i1 %348, label %349, label %359
349: ; preds = %345
%350 = load i32, i32* %6
%351 = sext i32 %350 to i64
%352 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %351
%353 = load i8*, i8** %352
%354 = load i32, i32* %8
%355 = call i32 @rand_buffer(i8* %353, i32 %354)
br label %356
356: ; preds = %349
%357 = load i32, i32* %6
%358 = add nsw i32 %357, 1
store i32 %358, i32* %6
br label %345
359: ; preds = %345
%360 = load i32, i32* %7
%361 = load i32, i32* %8
%362 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%363 = call i32 @ref_multi_pq(i32 %360, i32 %361, i8** %362)
store i32 0, i32* %15
br label %364
364: ; preds = %435, %359
%365 = load i32, i32* %15
%366 = load i32, i32* %8
%367 = icmp slt i32 %365, %366
br i1 %367, label %368, label %438
368: ; preds = %364
store i32 0, i32* %14
br label %369
369: ; preds = %431, %368
%370 = load i32, i32* %14
%371 = load i32, i32* %7
%372 = icmp slt i32 %370, %371
br i1 %372, label %373, label %434
373: ; preds = %369
%374 = load i32, i32* %7
%375 = load i32, i32* %8
%376 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%377 = bitcast i8** %376 to i8*
%378 = call i32 @pq_check(i32 %374, i32 %375, i8* %377)
store i32 %378, i32* %9
%379 = load i32, i32* %9
%380 = icmp ne i32 %379, 0
br i1 %380, label %381, label %387
381: ; preds = %373
%382 = load i32, i32* %7
%383 = load i32, i32* %8
%384 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), i32 %382, i32 %383)
%385 = load i32, i32* %10
%386 = add nsw i32 %385, 1
store i32 %386, i32* %10
store i32 1, i32* %3
br label %570
387: ; preds = %373
%388 = load i32, i32* %14
%389 = sext i32 %388 to i64
%390 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %389
%391 = load i8*, i8** %390
store i8* %391, i8** %17
%392 = load i8*, i8** %17
%393 = load i32, i32* %15
%394 = sext i32 %393 to i64
%395 = getelementptr inbounds i8, i8* %392, i64 %394
%396 = load i8, i8* %395
store i8 %396, i8* %12
%397 = load i8, i8* %12
%398 = sext i8 %397 to i32
%399 = xor i32 %398, 1
%400 = trunc i32 %399 to i8
%401 = load i32, i32* %14
%402 = sext i32 %401 to i64
%403 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %402
%404 = load i8*, i8** %403
%405 = load i32, i32* %15
%406 = sext i32 %405 to i64
%407 = getelementptr inbounds i8, i8* %404, i64 %406
store i8 %400, i8* %407
%408 = load i32, i32* %7
%409 = load i32, i32* %8
%410 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 0
%411 = bitcast i8** %410 to i8*
%412 = call i32 @pq_check(i32 %408, i32 %409, i8* %411)
store i32 %412, i32* %9
%413 = load i32, i32* %9
%414 = icmp eq i32 %413, 0
br i1 %414, label %415, label %422
415: ; preds = %387
%416 = load i32, i32* %7
%417 = load i32, i32* %8
%418 = load i32, i32* %9
%419 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.12, i64 0, i64 0), i32 %416, i32 %417, i32 %418)
%420 = load i32, i32* %10
%421 = add nsw i32 %420, 1
store i32 %421, i32* %10
store i32 1, i32* %3
br label %570
422: ; preds = %387
%423 = load i8, i8* %12
%424 = load i32, i32* %14
%425 = sext i32 %424 to i64
%426 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %425
%427 = load i8*, i8** %426
%428 = load i32, i32* %15
%429 = sext i32 %428 to i64
%430 = getelementptr inbounds i8, i8* %427, i64 %429
store i8 %423, i8* %430
br label %431
431: ; preds = %422
%432 = load i32, i32* %14
%433 = add nsw i32 %432, 1
store i32 %433, i32* %14
br label %369
434: ; preds = %369
br label %435
435: ; preds = %434
%436 = load i32, i32* %15
%437 = add nsw i32 %436, 1
store i32 %437, i32* %15
br label %364
438: ; preds = %364
%439 = call i32 @putchar(i8 signext 46)
%440 = call i32 @fflush(i32 0)
br label %441
441: ; preds = %438
%442 = load i32, i32* %7
%443 = add nsw i32 %442, 1
store i32 %443, i32* %7
br label %341
444: ; preds = %341
%445 = load i32, i32* %8
%446 = add nsw i32 %445, 16
store i32 %446, i32* %8
br label %337
447: ; preds = %337
store i32 0, i32* %6
br label %448
448: ; preds = %560, %447
%449 = load i32, i32* %6
%450 = icmp slt i32 %449, 1024
br i1 %450, label %451, label %563
451: ; preds = %448
store i32 0, i32* %7
br label %452
452: ; preds = %473, %451
%453 = load i32, i32* %7
%454 = icmp slt i32 %453, 18
br i1 %454, label %455, label %476
455: ; preds = %452
%456 = load i32, i32* %7
%457 = sext i32 %456 to i64
%458 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %457
%459 = load i8*, i8** %458
%460 = load i32, i32* %6
%461 = sub nsw i32 1024, %460
%462 = call i32 @rand_buffer(i8* %459, i32 %461)
%463 = load i32, i32* %7
%464 = sext i32 %463 to i64
%465 = getelementptr inbounds [18 x i8*], [18 x i8*]* %11, i64 0, i64 %464
%466 = load i8*, i8** %465
%467 = load i32, i32* %6
%468 = sext i32 %467 to i64
%469 = getelementptr inbounds i8, i8* %466, i64 %468
%470 = load i32, i32* %7
%471 = sext i32 %470 to i64
%472 = getelementptr inbounds [18 x i8*], [18 x i8*]* %13, i64 0, i64 %471
store i8* %469, i8** %472
br label %473
473: ; preds = %455
%474 = load i32, i32* %7
%475 = add nsw i32 %474, 1
store i32 %475, i32* %7
br label %452
476: ; preds = %452
%477 = load i32, i32* %6
%478 = sub nsw i32 1024, %477
%479 = getelementptr inbounds [18 x i8*], [18 x i8*]* %13, i64 0, i64 0
%480 = bitcast i8** %479 to i8*
%481 = call i32 @pq_gen_base(i32 18, i32 %478, i8* %480)
%482 = load i32, i32* %6
%483 = sub nsw i32 1024, %482
%484 = getelementptr inbounds [18 x i8*], [18 x i8*]* %13, i64 0, i64 0
%485 = bitcast i8** %484 to i8*
%486 = call i32 @pq_check(i32 18, i32 %483, i8* %485)
store i32 %486, i32* %9
%487 = load i32, i32* %9
%488 = icmp ne i32 %487, 0
br i1 %488, label %489, label %496
489: ; preds = %476
%490 = load i32, i32* %6
%491 = load i32, i32* %6
%492 = sub nsw i32 1024, %491
%493 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i32 %490, i32 %492)
%494 = load i32, i32* %10
%495 = add nsw i32 %494, 1
store i32 %495, i32* %10
store i32 1, i32* %3
br label %570
496: ; preds = %476
store i32 0, i32* %14
br label %497
497: ; preds = %554, %496
%498 = load i32, i32* %14
%499 = icmp slt i32 %498, 18
br i1 %499, label %500, label %557
500: ; preds = %497
store i32 0, i32* %15
br label %501
501: ; preds = %550, %500
%502 = load i32, i32* %15
%503 = load i32, i32* %6
%504 = sub nsw i32 1024, %503
%505 = icmp slt i32 %502, %504
br i1 %505, label %506, label %553
506: ; preds = %501
%507 = load i32, i32* %14
%508 = sext i32 %507 to i64
%509 = getelementptr inbounds [18 x i8*], [18 x i8*]* %13, i64 0, i64 %508
%510 = load i8*, i8** %509
%511 = load i32, i32* %15
%512 = sext i32 %511 to i64
%513 = getelementptr inbounds i8, i8* %510, i64 %512
%514 = load i8, i8* %513
store i8 %514, i8* %12
%515 = load i8, i8* %12
%516 = sext i8 %515 to i32
%517 = xor i32 %516, 1
%518 = trunc i32 %517 to i8
%519 = load i32, i32* %14
%520 = sext i32 %519 to i64
%521 = getelementptr inbounds [18 x i8*], [18 x i8*]* %13, i64 0, i64 %520
%522 = load i8*, i8** %521
%523 = load i32, i32* %15
%524 = sext i32 %523 to i64
%525 = getelementptr inbounds i8, i8* %522, i64 %524
store i8 %518, i8* %525
%526 = load i32, i32* %6
%527 = sub nsw i32 1024, %526
%528 = getelementptr inbounds [18 x i8*], [18 x i8*]* %13, i64 0, i64 0
%529 = bitcast i8** %528 to i8*
%530 = call i32 @pq_check(i32 18, i32 %527, i8* %529)
store i32 %530, i32* %9
%531 = load i32, i32* %9
%532 = icmp eq i32 %531, 0
br i1 %532, label %533, label %541
533: ; preds = %506
%534 = load i32, i32* %6
%535 = load i32, i32* %6
%536 = sub nsw i32 1024, %535
%537 = load i32, i32* %9
%538 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.14, i64 0, i64 0), i32 %534, i32 %536, i32 %537)
%539 = load i32, i32* %10
%540 = add nsw i32 %539, 1
store i32 %540, i32* %10
store i32 1, i32* %3
br label %570
541: ; preds = %506
%542 = load i8, i8* %12
%543 = load i32, i32* %14
%544 = sext i32 %543 to i64
%545 = getelementptr inbounds [18 x i8*], [18 x i8*]* %13, i64 0, i64 %544
%546 = load i8*, i8** %545
%547 = load i32, i32* %15
%548 = sext i32 %547 to i64
%549 = getelementptr inbounds i8, i8* %546, i64 %548
store i8 %542, i8* %549
br label %550
550: ; preds = %541
%551 = load i32, i32* %15
%552 = add nsw i32 %551, 1
store i32 %552, i32* %15
br label %501
553: ; preds = %501
br label %554
554: ; preds = %553
%555 = load i32, i32* %14
%556 = add nsw i32 %555, 1
store i32 %556, i32* %14
br label %497
557: ; preds = %497
%558 = call i32 @putchar(i8 signext 46)
%559 = call i32 @fflush(i32 0)
br label %560
560: ; preds = %557
%561 = load i32, i32* %6
%562 = add nsw i32 %561, 16
store i32 %562, i32* %6
br label %448
563: ; preds = %448
%564 = load i32, i32* %10
%565 = icmp eq i32 %564, 0
br i1 %565, label %566, label %568
566: ; preds = %563
%567 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
br label %568
568: ; preds = %566, %563
%569 = load i32, i32* %10
store i32 %569, i32* %3
br label %570
570: ; preds = %568, %533, %489, %415, %381, %309, %278, %218, %187, %100, %26
%571 = load i32, i32* %3
ret i32 %571
}

LLVM IR (-O2):
@.str = [42 x i8] c"Test pq_check_test %d sources X %d bytes\0A\00"
@.str.1 = [18 x i8] c"alloc error: Fail\00"
@.str.2 = [20 x i8] c"\0Afail zero test %d\0A\00"
@.str.3 = [30 x i8] c"\0Afail corrupt buffer test %d\0A\00"
@.str.4 = [43 x i8] c"\0Afail corrupt zero buffer test j=%d, i=%d\0A\00"
@.str.5 = [25 x i8] c"fail first rand test %d\0A\00"
@.str.7 = [53 x i8] c"\0AFail rand test with un-corrupted buffer j=%d, i=%d\0A\00"
@.str.8 = [38 x i8] c"\0Afail corrupt buffer test j=%d, i=%d\0A\00"
@.str.9 = [38 x i8] c"\0Afail rand fixed len test %d sources\0A\00"
@.str.10 = [55 x i8] c"\0Afail rand fixed len test corrupted buffer %d sources\0A\00"
@.str.11 = [49 x i8] c"\0Afail rand var src, len test %d sources, len=%d\0A\00"
@.str.12 = [74 x i8] c"\0Afail rand var src, len test corrupted buffer %d sources, len=%d, ret=%d\0A\00"
@.str.13 = [37 x i8] c"fail end test - offset: %d, len: %d\0A\00"
@.str.14 = [63 x i8] c"fail end test corrupted buffer - offset: %d, len: %d, ret: %d\0A\00"
@str = [5 x i8] c"Pass\00"
@str.16 = [58 x i8] c"\0AFail corrupt buffer test, passed when should have failed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [18 x i8*]
%4 = alloca [18 x i8*]
%5 = alloca i8*
%6 = bitcast [18 x i8*]* %3 to i8*
%7 = bitcast [18 x i8*]* %4 to i8*
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 16, i32 1024)
%9 = tail call i32 @srand(i32 4660)
%10 = bitcast i8** %5 to i8*
br label %11
11: ; preds = %2, %17
%12 = phi i64 [ 0, %2 ], [ %20, %17 ]
%13 = call i64 @posix_memalign(i8** %5, i32 16, i32 1024)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %440
17: ; preds = %11
%18 = load i8*, i8** %5
%19 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 %12
store i8* %18, i8** %19
%20 = add nuw nsw i64 %12, 1
%21 = icmp eq i64 %20, 18
br i1 %21, label %22, label %11
22: ; preds = %17
%23 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 0
%24 = load i8*, i8** %23
%25 = call i32 @memset(i8* %24, i32 0, i32 1024)
%26 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @memset(i8* %27, i32 0, i32 1024)
%29 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 2
%30 = load i8*, i8** %29
%31 = call i32 @memset(i8* %30, i32 0, i32 1024)
%32 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 3
%33 = load i8*, i8** %32
%34 = call i32 @memset(i8* %33, i32 0, i32 1024)
%35 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 4
%36 = load i8*, i8** %35
%37 = call i32 @memset(i8* %36, i32 0, i32 1024)
%38 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 5
%39 = load i8*, i8** %38
%40 = call i32 @memset(i8* %39, i32 0, i32 1024)
%41 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 6
%42 = load i8*, i8** %41
%43 = call i32 @memset(i8* %42, i32 0, i32 1024)
%44 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 7
%45 = load i8*, i8** %44
%46 = call i32 @memset(i8* %45, i32 0, i32 1024)
%47 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 8
%48 = load i8*, i8** %47
%49 = call i32 @memset(i8* %48, i32 0, i32 1024)
%50 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 9
%51 = load i8*, i8** %50
%52 = call i32 @memset(i8* %51, i32 0, i32 1024)
%53 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 10
%54 = load i8*, i8** %53
%55 = call i32 @memset(i8* %54, i32 0, i32 1024)
%56 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 11
%57 = load i8*, i8** %56
%58 = call i32 @memset(i8* %57, i32 0, i32 1024)
%59 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 12
%60 = load i8*, i8** %59
%61 = call i32 @memset(i8* %60, i32 0, i32 1024)
%62 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 13
%63 = load i8*, i8** %62
%64 = call i32 @memset(i8* %63, i32 0, i32 1024)
%65 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 14
%66 = load i8*, i8** %65
%67 = call i32 @memset(i8* %66, i32 0, i32 1024)
%68 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 15
%69 = load i8*, i8** %68
%70 = call i32 @memset(i8* %69, i32 0, i32 1024)
%71 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 16
%72 = load i8*, i8** %71
%73 = call i32 @memset(i8* %72, i32 0, i32 1024)
%74 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 17
%75 = load i8*, i8** %74
%76 = call i32 @memset(i8* %75, i32 0, i32 1024)
%77 = call i32 @ref_multi_pq(i32 18, i32 1024, i8** %23)
%78 = call i32 @pq_check(i32 18, i32 1024, i8* %6)
%79 = icmp eq i32 %78, 0
br i1 %79, label %82, label %80
80: ; preds = %22
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %78)
br label %82
82: ; preds = %80, %22
%83 = phi i32 [ 1, %80 ], [ 0, %22 ]
%84 = load i8*, i8** %23
%85 = getelementptr inbounds i8, i8* %84, i64 1022
store i8 7, i8* %85
%86 = call i32 @pq_check(i32 18, i32 1024, i8* %6)
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %91
88: ; preds = %82
%89 = add nuw nsw i32 %83, 1
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 0)
br label %91
91: ; preds = %88, %82
%92 = phi i32 [ %89, %88 ], [ %83, %82 ]
%93 = load i8*, i8** %23
%94 = getelementptr inbounds i8, i8* %93, i64 1022
store i8 0, i8* %94
br label %95
95: ; preds = %91, %113
%96 = phi i64 [ 0, %91 ], [ %115, %113 ]
%97 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 %96
br label %98
98: ; preds = %95, %108
%99 = phi i64 [ 1023, %95 ], [ %111, %108 ]
%100 = load i8*, i8** %97
%101 = getelementptr inbounds i8, i8* %100, i64 %99
store i8 5, i8* %101
%102 = call i32 @pq_check(i32 18, i32 1024, i8* %6)
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %108
104: ; preds = %98
%105 = trunc i64 %96 to i32
%106 = trunc i64 %99 to i32
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 %105, i32 %106)
br label %440
108: ; preds = %98
%109 = load i8*, i8** %97
%110 = getelementptr inbounds i8, i8* %109, i64 %99
store i8 0, i8* %110
%111 = add nsw i64 %99, -1
%112 = icmp eq i64 %99, 0
br i1 %112, label %113, label %98
113: ; preds = %108
%114 = call i32 @putchar(i8 signext 46)
%115 = add nuw nsw i64 %96, 1
%116 = icmp eq i64 %115, 18
br i1 %116, label %117, label %95
117: ; preds = %113
%118 = load i8*, i8** %23
%119 = call i32 @rand_buffer(i8* %118, i32 1024)
%120 = load i8*, i8** %26
%121 = call i32 @rand_buffer(i8* %120, i32 1024)
%122 = load i8*, i8** %29
%123 = call i32 @rand_buffer(i8* %122, i32 1024)
%124 = load i8*, i8** %32
%125 = call i32 @rand_buffer(i8* %124, i32 1024)
%126 = load i8*, i8** %35
%127 = call i32 @rand_buffer(i8* %126, i32 1024)
%128 = load i8*, i8** %38
%129 = call i32 @rand_buffer(i8* %128, i32 1024)
%130 = load i8*, i8** %41
%131 = call i32 @rand_buffer(i8* %130, i32 1024)
%132 = load i8*, i8** %44
%133 = call i32 @rand_buffer(i8* %132, i32 1024)
%134 = load i8*, i8** %47
%135 = call i32 @rand_buffer(i8* %134, i32 1024)
%136 = load i8*, i8** %50
%137 = call i32 @rand_buffer(i8* %136, i32 1024)
%138 = load i8*, i8** %53
%139 = call i32 @rand_buffer(i8* %138, i32 1024)
%140 = load i8*, i8** %56
%141 = call i32 @rand_buffer(i8* %140, i32 1024)
%142 = load i8*, i8** %59
%143 = call i32 @rand_buffer(i8* %142, i32 1024)
%144 = load i8*, i8** %62
%145 = call i32 @rand_buffer(i8* %144, i32 1024)
%146 = load i8*, i8** %65
%147 = call i32 @rand_buffer(i8* %146, i32 1024)
%148 = load i8*, i8** %68
%149 = call i32 @rand_buffer(i8* %148, i32 1024)
%150 = load i8*, i8** %71
%151 = call i32 @rand_buffer(i8* %150, i32 1024)
%152 = load i8*, i8** %74
%153 = call i32 @rand_buffer(i8* %152, i32 1024)
%154 = call i32 @ref_multi_pq(i32 18, i32 1024, i8** %23)
%155 = call i32 @pq_check(i32 18, i32 1024, i8* %6)
%156 = icmp eq i32 %155, 0
br i1 %156, label %160, label %157
157: ; preds = %117
%158 = add nsw i32 %92, 1
%159 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %155)
br label %160
160: ; preds = %157, %117
%161 = phi i32 [ %158, %157 ], [ %92, %117 ]
%162 = load i8*, i8** %23
%163 = getelementptr inbounds i8, i8* %162, i64 1022
%164 = load i8, i8* %163
%165 = xor i8 %164, 1
store i8 %165, i8* %163
%166 = call i32 @pq_check(i32 18, i32 1024, i8* %6)
%167 = icmp eq i32 %166, 0
br i1 %167, label %168, label %171
168: ; preds = %160
%169 = add nsw i32 %161, 1
%170 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.16, i64 0, i64 0))
br label %171
171: ; preds = %168, %160
%172 = phi i32 [ %169, %168 ], [ %161, %160 ]
%173 = load i8*, i8** %23
%174 = getelementptr inbounds i8, i8* %173, i64 1022
store i8 %164, i8* %174
br label %175
175: ; preds = %171, %202
%176 = phi i64 [ 0, %171 ], [ %204, %202 ]
%177 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 %176
br label %178
178: ; preds = %175, %197
%179 = phi i64 [ 1023, %175 ], [ %200, %197 ]
%180 = call i32 @pq_check(i32 18, i32 1024, i8* %6)
%181 = icmp eq i32 %180, 0
br i1 %181, label %186, label %182
182: ; preds = %178
%183 = trunc i64 %176 to i32
%184 = trunc i64 %179 to i32
%185 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0), i32 %183, i32 %184)
br label %440
186: ; preds = %178
%187 = load i8*, i8** %177
%188 = getelementptr inbounds i8, i8* %187, i64 %179
%189 = load i8, i8* %188
%190 = xor i8 %189, 1
store i8 %190, i8* %188
%191 = call i32 @pq_check(i32 18, i32 1024, i8* %6)
%192 = icmp eq i32 %191, 0
br i1 %192, label %193, label %197
193: ; preds = %186
%194 = trunc i64 %176 to i32
%195 = trunc i64 %179 to i32
%196 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i32 %194, i32 %195)
br label %440
197: ; preds = %186
%198 = load i8*, i8** %177
%199 = getelementptr inbounds i8, i8* %198, i64 %179
store i8 %189, i8* %199
%200 = add nsw i64 %179, -1
%201 = icmp eq i64 %179, 0
br i1 %201, label %202, label %178
202: ; preds = %197
%203 = call i32 @putchar(i8 signext 46)
%204 = add nuw nsw i64 %176, 1
%205 = icmp eq i64 %204, 18
br i1 %205, label %206, label %175
206: ; preds = %202, %246
%207 = phi i64 [ %248, %246 ], [ 4, %202 ]
br label %208
208: ; preds = %206, %208
%209 = phi i64 [ 0, %206 ], [ %213, %208 ]
%210 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 %209
%211 = load i8*, i8** %210
%212 = call i32 @rand_buffer(i8* %211, i32 1024)
%213 = add nuw nsw i64 %209, 1
%214 = icmp eq i64 %213, %207
br i1 %214, label %215, label %208
215: ; preds = %208
%216 = trunc i64 %207 to i32
%217 = call i32 @ref_multi_pq(i32 %216, i32 1024, i8** %23)
br label %218
218: ; preds = %215, %243
%219 = phi i64 [ 0, %215 ], [ %244, %243 ]
%220 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 %219
br label %221
221: ; preds = %218, %238
%222 = phi i64 [ 0, %218 ], [ %241, %238 ]
%223 = call i32 @pq_check(i32 %216, i32 1024, i8* %6)
%224 = icmp eq i32 %223, 0
br i1 %224, label %228, label %225
225: ; preds = %221
%226 = trunc i64 %207 to i32
%227 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i32 %226)
br label %440
228: ; preds = %221
%229 = load i8*, i8** %220
%230 = getelementptr inbounds i8, i8* %229, i64 %222
%231 = load i8, i8* %230
%232 = xor i8 %231, 1
store i8 %232, i8* %230
%233 = call i32 @pq_check(i32 %216, i32 1024, i8* %6)
%234 = icmp eq i32 %233, 0
br i1 %234, label %235, label %238
235: ; preds = %228
%236 = trunc i64 %207 to i32
%237 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0), i32 %236)
br label %440
238: ; preds = %228
%239 = load i8*, i8** %220
%240 = getelementptr inbounds i8, i8* %239, i64 %222
store i8 %231, i8* %240
%241 = add nuw nsw i64 %222, 1
%242 = icmp eq i64 %241, 1024
br i1 %242, label %243, label %221
243: ; preds = %238
%244 = add nuw nsw i64 %219, 1
%245 = icmp eq i64 %244, %207
br i1 %245, label %246, label %218
246: ; preds = %243
%247 = call i32 @putchar(i8 signext 46)
%248 = add nuw nsw i64 %207, 1
%249 = icmp eq i64 %248, 19
br i1 %249, label %250, label %206
250: ; preds = %246
%251 = call i32 @fflush(i32 0)
br label %252
252: ; preds = %250, %303
%253 = phi i64 [ 16, %250 ], [ %304, %303 ]
%254 = trunc i64 %253 to i32
%255 = trunc i64 %253 to i32
br label %256
256: ; preds = %252, %298
%257 = phi i64 [ 4, %252 ], [ %301, %298 ]
br label %258
258: ; preds = %256, %258
%259 = phi i64 [ 0, %256 ], [ %263, %258 ]
%260 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 %259
%261 = load i8*, i8** %260
%262 = call i32 @rand_buffer(i8* %261, i32 %254)
%263 = add nuw nsw i64 %259, 1
%264 = icmp eq i64 %263, %257
br i1 %264, label %265, label %258
265: ; preds = %258
%266 = trunc i64 %257 to i32
%267 = call i32 @ref_multi_pq(i32 %266, i32 %255, i8** %23)
br label %268
268: ; preds = %265, %295
%269 = phi i64 [ 0, %265 ], [ %296, %295 ]
br label %270
270: ; preds = %268, %290
%271 = phi i64 [ 0, %268 ], [ %293, %290 ]
%272 = call i32 @pq_check(i32 %266, i32 %255, i8* %6)
%273 = icmp eq i32 %272, 0
br i1 %273, label %278, label %274
274: ; preds = %270
%275 = trunc i64 %253 to i32
%276 = trunc i64 %257 to i32
%277 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), i32 %276, i32 %275)
br label %440
278: ; preds = %270
%279 = getelementptr inbounds [18 x i8*], [18 x i8*]* %3, i64 0, i64 %271
%280 = load i8*, i8** %279
%281 = getelementptr inbounds i8, i8* %280, i64 %269
%282 = load i8, i8* %281
%283 = xor i8 %282, 1
store i8 %283, i8* %281
%284 = call i32 @pq_check(i32 %266, i32 %255, i8* %6)
%285 = icmp eq i32 %284, 0
br i1 %285, label %286, label %290
286: ; preds = %278
%287 = trunc i64 %253 to i32
%288 = trunc i64 %257 to i32
%289 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.12, i64 0, i64 0), i32 %288, i32 %287, i32 0)
br label %440
290: ; preds = %278
%291 = load i8*, i8** %279
%292 = getelementptr inbounds i8, i8* %291, i64 %269
store i8 %282, i8* %292
%293 = add nuw nsw i64 %271, 1
%294 = icmp eq i64 %293, %257
br i1 %294, label %295, label %270
295: ; preds = %290
%296 = add nuw nsw i64 %269, 1
%297 = icmp eq i64 %296, %253
br i1 %297, label %298, label %268
298: ; preds = %295
%299 = call i32 @putchar(i8 signext 46)
%300 = call i32 @fflush(i32 0)
%301 = add nuw nsw i64 %257, 1
%302 = icmp eq i64 %301, 19
br i1 %302, label %303, label %256
303: ; preds = %298
%304 = add nuw nsw i64 %253, 16
%305 = icmp ult i64 %253, 1009
br i1 %305, label %252, label %306
306: ; preds = %303
%307 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 0
%308 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 1
%309 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 2
%310 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 3
%311 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 4
%312 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 5
%313 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 6
%314 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 7
%315 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 8
%316 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 9
%317 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 10
%318 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 11
%319 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 12
%320 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 13
%321 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 14
%322 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 15
%323 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 16
%324 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 17
br label %325
325: ; preds = %306, %430
%326 = phi i64 [ 0, %306 ], [ %433, %430 ]
%327 = phi i64 [ 1024, %306 ], [ %435, %430 ]
%328 = load i8*, i8** %23
%329 = trunc i64 %326 to i32
%330 = sub nuw nsw i32 1024, %329
%331 = call i32 @rand_buffer(i8* %328, i32 %330)
%332 = load i8*, i8** %23
%333 = getelementptr inbounds i8, i8* %332, i64 %326
store i8* %333, i8** %307
%334 = load i8*, i8** %26
%335 = call i32 @rand_buffer(i8* %334, i32 %330)
%336 = load i8*, i8** %26
%337 = getelementptr inbounds i8, i8* %336, i64 %326
store i8* %337, i8** %308
%338 = load i8*, i8** %29
%339 = call i32 @rand_buffer(i8* %338, i32 %330)
%340 = load i8*, i8** %29
%341 = getelementptr inbounds i8, i8* %340, i64 %326
store i8* %341, i8** %309
%342 = load i8*, i8** %32
%343 = call i32 @rand_buffer(i8* %342, i32 %330)
%344 = load i8*, i8** %32
%345 = getelementptr inbounds i8, i8* %344, i64 %326
store i8* %345, i8** %310
%346 = load i8*, i8** %35
%347 = call i32 @rand_buffer(i8* %346, i32 %330)
%348 = load i8*, i8** %35
%349 = getelementptr inbounds i8, i8* %348, i64 %326
store i8* %349, i8** %311
%350 = load i8*, i8** %38
%351 = call i32 @rand_buffer(i8* %350, i32 %330)
%352 = load i8*, i8** %38
%353 = getelementptr inbounds i8, i8* %352, i64 %326
store i8* %353, i8** %312
%354 = load i8*, i8** %41
%355 = call i32 @rand_buffer(i8* %354, i32 %330)
%356 = load i8*, i8** %41
%357 = getelementptr inbounds i8, i8* %356, i64 %326
store i8* %357, i8** %313
%358 = load i8*, i8** %44
%359 = call i32 @rand_buffer(i8* %358, i32 %330)
%360 = load i8*, i8** %44
%361 = getelementptr inbounds i8, i8* %360, i64 %326
store i8* %361, i8** %314
%362 = load i8*, i8** %47
%363 = call i32 @rand_buffer(i8* %362, i32 %330)
%364 = load i8*, i8** %47
%365 = getelementptr inbounds i8, i8* %364, i64 %326
store i8* %365, i8** %315
%366 = load i8*, i8** %50
%367 = call i32 @rand_buffer(i8* %366, i32 %330)
%368 = load i8*, i8** %50
%369 = getelementptr inbounds i8, i8* %368, i64 %326
store i8* %369, i8** %316
%370 = load i8*, i8** %53
%371 = call i32 @rand_buffer(i8* %370, i32 %330)
%372 = load i8*, i8** %53
%373 = getelementptr inbounds i8, i8* %372, i64 %326
store i8* %373, i8** %317
%374 = load i8*, i8** %56
%375 = call i32 @rand_buffer(i8* %374, i32 %330)
%376 = load i8*, i8** %56
%377 = getelementptr inbounds i8, i8* %376, i64 %326
store i8* %377, i8** %318
%378 = load i8*, i8** %59
%379 = call i32 @rand_buffer(i8* %378, i32 %330)
%380 = load i8*, i8** %59
%381 = getelementptr inbounds i8, i8* %380, i64 %326
store i8* %381, i8** %319
%382 = load i8*, i8** %62
%383 = call i32 @rand_buffer(i8* %382, i32 %330)
%384 = load i8*, i8** %62
%385 = getelementptr inbounds i8, i8* %384, i64 %326
store i8* %385, i8** %320
%386 = load i8*, i8** %65
%387 = call i32 @rand_buffer(i8* %386, i32 %330)
%388 = load i8*, i8** %65
%389 = getelementptr inbounds i8, i8* %388, i64 %326
store i8* %389, i8** %321
%390 = load i8*, i8** %68
%391 = call i32 @rand_buffer(i8* %390, i32 %330)
%392 = load i8*, i8** %68
%393 = getelementptr inbounds i8, i8* %392, i64 %326
store i8* %393, i8** %322
%394 = load i8*, i8** %71
%395 = call i32 @rand_buffer(i8* %394, i32 %330)
%396 = load i8*, i8** %71
%397 = getelementptr inbounds i8, i8* %396, i64 %326
store i8* %397, i8** %323
%398 = load i8*, i8** %74
%399 = call i32 @rand_buffer(i8* %398, i32 %330)
%400 = load i8*, i8** %74
%401 = getelementptr inbounds i8, i8* %400, i64 %326
store i8* %401, i8** %324
%402 = call i32 @pq_gen_base(i32 18, i32 %330, i8* %7)
%403 = call i32 @pq_check(i32 18, i32 %330, i8* %7)
%404 = icmp eq i32 %403, 0
br i1 %404, label %408, label %405
405: ; preds = %325
%406 = trunc i64 %326 to i32
%407 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i32 %406, i32 %330)
br label %440
408: ; preds = %325, %427
%409 = phi i64 [ %428, %427 ], [ 0, %325 ]
%410 = getelementptr inbounds [18 x i8*], [18 x i8*]* %4, i64 0, i64 %409
br label %411
411: ; preds = %408, %422
%412 = phi i64 [ 0, %408 ], [ %425, %422 ]
%413 = load i8*, i8** %410
%414 = getelementptr inbounds i8, i8* %413, i64 %412
%415 = load i8, i8* %414
%416 = xor i8 %415, 1
store i8 %416, i8* %414
%417 = call i32 @pq_check(i32 18, i32 %330, i8* %7)
%418 = icmp eq i32 %417, 0
br i1 %418, label %419, label %422
419: ; preds = %411
%420 = trunc i64 %326 to i32
%421 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.14, i64 0, i64 0), i32 %420, i32 %330, i32 0)
br label %440
422: ; preds = %411
%423 = load i8*, i8** %410
%424 = getelementptr inbounds i8, i8* %423, i64 %412
store i8 %415, i8* %424
%425 = add nuw nsw i64 %412, 1
%426 = icmp eq i64 %425, %327
br i1 %426, label %427, label %411
427: ; preds = %422
%428 = add nuw nsw i64 %409, 1
%429 = icmp eq i64 %428, 18
br i1 %429, label %430, label %408
430: ; preds = %427
%431 = call i32 @putchar(i8 signext 46)
%432 = call i32 @fflush(i32 0)
%433 = add nuw nsw i64 %326, 16
%434 = icmp ult i64 %326, 1008
%435 = add nsw i64 %327, -16
br i1 %434, label %325, label %436
436: ; preds = %430
%437 = icmp eq i32 %172, 0
br i1 %437, label %438, label %440
438: ; preds = %436
%439 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %440
440: ; preds = %286, %274, %15, %436, %438, %419, %405, %235, %225, %193, %182, %104
%441 = phi i32 [ 1, %15 ], [ 1, %104 ], [ 1, %182 ], [ 1, %193 ], [ 1, %225 ], [ 1, %235 ], [ 1, %405 ], [ 1, %419 ], [ 0, %438 ], [ %172, %436 ], [ 1, %274 ], [ 1, %286 ]
ret i32 %441
}