#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 CHAR_BIT;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int isal_zero_detect(unsigned char *, long long);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
scalar_t__ posix_memalign(void **, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int rand();
int /*<<< orphan*/ srand(int);
int main(int argc, char *argv[]) {
  int i, j, sign;
  long long r, l;
  void *buf;
  unsigned char *a;
  int failures = 0, ret_neg = 1;
  printf("mem_zero_detect_test %d bytes, %d randoms, seed=0x%x ",
         10 * 1024 * 1024, 2000, 0x1234);
  if (posix_memalign(&buf, 64, 10 * 1024 * 1024)) {
    printf("alloc error: Fail");
    return -1;
  }
  srand(0x1234);
  memset(buf, 0, 10 * 1024 * 1024);
  failures = isal_zero_detect(buf, 10 * 1024 * 1024);
  if (failures) {
    printf("Fail large buf test\n");
    return failures;
  }
  putchar('.');
  for (i = 0; i < 8 * 1024; i++) {
    failures |= isal_zero_detect(buf, i);
    if (failures) {
      printf("Fail len=%d\n", i);
      return failures;
    }
  }
  putchar('.');
  a = buf;
  for (i = 0; i < 8 * 1024; i++)
    failures |= isal_zero_detect(&a[8 * 1024 - i], i);
  if (failures) {
    printf("Fail:\n");
    return failures;
  }
  putchar('.');
  a[10 * 1024 * 1024 / 2] = 1;
  ret_neg = isal_zero_detect(a, 10 * 1024 * 1024);
  if (ret_neg == 0) {
    printf("Fail on not detect\n");
    return -1;
  }
  a[10 * 1024 * 1024 / 2] = 0;
  putchar('.');
  for (i = 0; i < (5 * 32 + 7); i++) {
    for (j = 0; j < CHAR_BIT; j++) {
      a[i] = 1 << j;
      ret_neg = isal_zero_detect(a, 10 * 1024 * 1024);
      if (ret_neg == 0) {
        printf("Fail on not detect offsets %d, %d\n", i, j);
        return -1;
      }
      a[i] = 0;
    }
  }
  putchar('.');
  fflush(0);
  for (i = 0; i < 2000; i++) {
    r = rand();
    r = (r % 8 * 1024) ^ (r & (32 - 1));
    if (r >= 8 * 1024)
      continue;
    a[r] = 1 << (r & (CHAR_BIT - 1));
    ret_neg = isal_zero_detect(a, 10 * 1024 * 1024);
    if (ret_neg == 0) {
      printf("Fail on not detect rand %d, e=%lld\n", i, r);
      return -1;
    }
    a[r] = 0;
  }
  putchar('.');
  fflush(0);
  for (i = 1; i < (5 * 32 + 7); i++) {
    for (j = 0; j < CHAR_BIT; j++) {
      a[10 * 1024 * 1024 - i] = 1 << j;
      ret_neg = isal_zero_detect(a, 10 * 1024 * 1024);
      if (ret_neg == 0) {
        printf("Fail on not detect rand offset=%d, idx=%d\n", i, j);
        return -1;
      }
      a[10 * 1024 * 1024 - i] = 0;
    }
  }
  putchar('.');
  for (l = 1; l < 8 * 1024; l++) {
    for (i = 0; i < l + (5 * 32 + 7); i++) {
      failures = isal_zero_detect(a, l);
      if (failures) {
        printf("Fail on detect non-zero with l=%lld\n", l);
        return -1;
      }
      a[i] = 1;
      ret_neg = isal_zero_detect(a, l);
      if ((i < l) && (ret_neg == 0)) {
        printf("Fail on non-zero buffer l=%lld err=%d\n", l, i);
        return -1;
      }
      if ((i >= l) && (ret_neg != 0)) {
        printf("Fail on bad pass detect l=%lld err=%d\n", l, i);
        return -1;
      }
      a[i] = 0;
    }
  }
  putchar('.');
  for (i = 0; i < 2000; i++) {
    r = rand();
    r = (r % 8 * 1024) ^ (r & (32 - 1));
    l = r + 1 + (rand() & (CHAR_BIT - 1));
    a[r] = 1 << (r & (CHAR_BIT - 1));
    ret_neg = isal_zero_detect(a, l);
    if (ret_neg == 0) {
      printf("Fail on not detect rand %d, l=%lld, e=%lld\n", i, l, r);
      return -1;
    }
    a[r] = 0;
  }
  putchar('.');
  fflush(0);
  for (i = 0; i < 2000; i++) {
    r = rand();
    r = (r % 8 * 1024) ^ (r & (32 - 1));
    sign = rand() & 1 ? 1 : -1;
    l = r + sign * (rand() & (2 * 32 - 1));
    if ((l >= 8 * 1024) || (l < 0) || (r >= 8 * 1024))
      continue;
    a[r] = 1 << (r & (CHAR_BIT - 1));
    ret_neg = isal_zero_detect(a, l);
    if ((r < l) && (ret_neg == 0)) {
      printf("Fail on non-zero rand buffer %d, l=%lld, e=%lld\n", i, l, r);
      return -1;
    }
    if ((r >= l) && (ret_neg != 0)) {
      printf("Fail on bad pass zero detect rand %d, l=%lld, e=%lld\n", i, l, r);
      return -1;
    }
    a[r] = 0;
  }
  putchar('.');
  fflush(0);
  printf(failures == 0 ? " Pass\n" : " Fail\n");
  return failures;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x1,-0x48(%rbp)
lea    0xe55(%rip),%rdi
mov    $0xa00000,%esi
mov    $0x7d0,%edx
mov    $0x1234,%ecx
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x38(%rbp),%rdi
mov    $0x40,%esi
mov    $0xa00000,%edx
call   1090 <posix_memalign@plt>
cmp    $0x0,%rax
je     11f8 <main+0x78>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    $0x1234,%edi
call   1060 <srand@plt>
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0xa00000,%edx
call   1050 <memset@plt>
mov    -0x38(%rbp),%rdi
mov    $0xa00000,%esi
call   1080 <isal_zero_detect@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1246 <main+0xc6>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    $0x2e,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x2000,-0x14(%rbp)
jge    12b0 <main+0x130>
mov    -0x38(%rbp),%rdi
movslq -0x14(%rbp),%rsi
call   1080 <isal_zero_detect@plt>
or     -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     129d <main+0x11d>
mov    -0x14(%rbp),%esi
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    19f7 <main+0x877>
jmp    12a2 <main+0x122>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1257 <main+0xd7>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2000,-0x14(%rbp)
jge    1304 <main+0x184>
mov    -0x40(%rbp),%rdi
mov    $0x2000,%eax
sub    -0x14(%rbp),%eax
cltq
add    %rax,%rdi
movslq -0x14(%rbp),%rsi
call   1080 <isal_zero_detect@plt>
or     -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12c9 <main+0x149>
cmpl   $0x0,-0x44(%rbp)
je     1327 <main+0x1a7>
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    -0x40(%rbp),%rax
movb   $0x1,0x500000(%rax)
mov    -0x40(%rbp),%rdi
mov    $0xa00000,%esi
call   1080 <isal_zero_detect@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jne    1371 <main+0x1f1>
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    -0x40(%rbp),%rax
movb   $0x0,0x500000(%rax)
mov    $0x2e,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa7,-0x14(%rbp)
jge    1432 <main+0x2b2>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2c35(%rip),%rcx
cmp    (%rcx),%eax
jge    141f <main+0x29f>
mov    -0x18(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
mov    $0xa00000,%esi
call   1080 <isal_zero_detect@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jne    1405 <main+0x285>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xc93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    -0x40(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    13a1 <main+0x221>
jmp    1424 <main+0x2a4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    138d <main+0x20d>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1070 <fflush@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x7d0,-0x14(%rbp)
jge    151d <main+0x39d>
mov    $0x0,%al
call   10a0 <rand@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
shl    $0xa,%rax
mov    -0x28(%rbp),%rcx
and    $0x1f,%rcx
xor    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x2000,-0x28(%rbp)
jl     149b <main+0x31b>
jmp    150f <main+0x38f>
mov    -0x28(%rbp),%rax
mov    0x2b3a(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
mov    $0xa00000,%esi
call   1080 <isal_zero_detect@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jne    1503 <main+0x383>
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
lea    0xbb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    144a <main+0x2ca>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1070 <fflush@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0xa7,-0x14(%rbp)
jge    15e8 <main+0x468>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2a8d(%rip),%rcx
cmp    (%rcx),%eax
jge    15d5 <main+0x455>
mov    -0x18(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    $0xa00000,%ecx
sub    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
mov    $0xa00000,%esi
call   1080 <isal_zero_detect@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jne    15b4 <main+0x434>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xb2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    -0x40(%rbp),%rax
mov    $0xa00000,%ecx
sub    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1549 <main+0x3c9>
jmp    15da <main+0x45a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1535 <main+0x3b5>
mov    $0x2e,%edi
call   1030 <putchar@plt>
movq   $0x1,-0x30(%rbp)
cmpq   $0x2000,-0x30(%rbp)
jge    171d <main+0x59d>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp),%rcx
add    $0xa7,%rcx
cmp    %rcx,%rax
jge    1707 <main+0x587>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1080 <isal_zero_detect@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     165f <main+0x4df>
mov    -0x30(%rbp),%rsi
lea    0xaab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    -0x40(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1080 <isal_zero_detect@plt>
mov    %eax,-0x48(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    16b4 <main+0x534>
cmpl   $0x0,-0x48(%rbp)
jne    16b4 <main+0x534>
mov    -0x30(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xa7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
movslq -0x14(%rbp),%rax
cmp    -0x30(%rbp),%rax
jl     16ed <main+0x56d>
cmpl   $0x0,-0x48(%rbp)
je     16ed <main+0x56d>
mov    -0x30(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xa69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    -0x40(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    160f <main+0x48f>
jmp    170c <main+0x58c>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    15fa <main+0x47a>
mov    $0x2e,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x7d0,-0x14(%rbp)
jge    1822 <main+0x6a2>
mov    $0x0,%al
call   10a0 <rand@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
shl    $0xa,%rax
mov    -0x28(%rbp),%rcx
and    $0x1f,%rcx
xor    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
mov    $0x0,%al
call   10a0 <rand@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
mov    0x2854(%rip),%rdx
mov    (%rdx),%edx
sub    $0x1,%edx
and    %edx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2838(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1080 <isal_zero_detect@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jne    1808 <main+0x688>
mov    -0x14(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0x975(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    172e <main+0x5ae>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1070 <fflush@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x7d0,-0x14(%rbp)
jge    19c1 <main+0x841>
mov    $0x0,%al
call   10a0 <rand@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
shl    $0xa,%rax
mov    -0x28(%rbp),%rcx
and    $0x1f,%rcx
xor    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   10a0 <rand@plt>
mov    %eax,%edx
and    $0x1,%edx
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    $0x0,%al
call   10a0 <rand@plt>
mov    -0x5c(%rbp),%ecx
mov    %eax,%edx
mov    -0x58(%rbp),%rax
and    $0x3f,%edx
imul   %edx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x2000,-0x30(%rbp)
jge    18ec <main+0x76c>
cmpq   $0x0,-0x30(%rbp)
jl     18ec <main+0x76c>
cmpq   $0x2000,-0x28(%rbp)
jl     18f1 <main+0x771>
jmp    19b3 <main+0x833>
mov    -0x28(%rbp),%rax
mov    0x26e4(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1080 <isal_zero_detect@plt>
mov    %eax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    196a <main+0x7ea>
cmpl   $0x0,-0x48(%rbp)
jne    196a <main+0x7ea>
mov    -0x14(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0x83f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
jl     19a7 <main+0x827>
cmpl   $0x0,-0x48(%rbp)
je     19a7 <main+0x827>
mov    -0x14(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0x833(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    19f7 <main+0x877>
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    183a <main+0x6ba>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1070 <fflush@plt>
mov    -0x44(%rbp),%ecx
lea    0x828(%rip),%rdi
lea    0x81a(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe5e(%rip),%rdi
mov    $0xa00000,%esi
mov    $0x7d0,%edx
mov    $0x1234,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rdi
mov    $0x40,%esi
mov    $0xa00000,%edx
call   10a0 <posix_memalign@plt>
test   %rax,%rax
je     11e8 <main+0x58>
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%r14d
jmp    12c3 <main+0x133>
mov    $0x1234,%edi
call   1070 <srand@plt>
mov    (%rsp),%rdi
xor    %esi,%esi
mov    $0xa00000,%edx
call   1060 <memset@plt>
mov    (%rsp),%rdi
mov    $0xa00000,%esi
call   1090 <isal_zero_detect@plt>
test   %eax,%eax
je     1228 <main+0x98>
mov    %eax,%r14d
lea    0xfce(%rip),%rdi
call   1040 <puts@plt>
jmp    12c3 <main+0x133>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rsp),%rdi
mov    %rbx,%rsi
call   1090 <isal_zero_detect@plt>
test   %eax,%eax
jne    12b0 <main+0x120>
add    $0x1,%rbx
cmp    $0x2000,%rbx
jne    1240 <main+0xb0>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    (%rsp),%r12
lea    0x2000(%r12),%rbx
xor    %ebp,%ebp
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <isal_zero_detect@plt>
or     %eax,%r14d
add    $0x1,%rbp
add    $0xffffffffffffffff,%rbx
cmp    $0x2000,%rbp
jne    1280 <main+0xf0>
test   %r14d,%r14d
je     12d5 <main+0x145>
lea    0xf3b(%rip),%rdi
jmp    121e <main+0x8e>
mov    %eax,%r14d
lea    0xd8e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x2e,%edi
call   1030 <putchar@plt>
movb   $0x1,0x500000(%r12)
mov    $0xa00000,%esi
mov    %r12,%rdi
call   1090 <isal_zero_detect@plt>
test   %eax,%eax
je     138d <main+0x1fd>
movb   $0x0,0x500000(%r12)
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    0x2cc9(%rip),%r13
mov    0x0(%r13),%eax
xor    %ebp,%ebp
jmp    132c <main+0x19c>
add    $0x1,%rbp
cmp    $0xa7,%rbp
je     13a4 <main+0x214>
test   %eax,%eax
jle    131f <main+0x18f>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %al,(%r12,%rbp,1)
mov    $0xa00000,%esi
mov    %r12,%rdi
call   1090 <isal_zero_detect@plt>
test   %eax,%eax
je     1370 <main+0x1e0>
movb   $0x0,(%r12,%rbp,1)
add    $0x1,%ebx
mov    0x0(%r13),%eax
cmp    %eax,%ebx
jl     1340 <main+0x1b0>
jmp    131f <main+0x18f>
lea    0xcde(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%r14d
jmp    12c3 <main+0x133>
lea    0xe3f(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%r14d
jmp    12c3 <main+0x133>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
xor    %r14d,%r14d
jmp    13c7 <main+0x237>
add    $0x1,%r14d
cmp    $0x7d0,%r14d
je     1423 <main+0x293>
xor    %eax,%eax
call   10b0 <rand@plt>
mov    %eax,%ebp
lea    0x7(%rbp),%eax
test   %ebp,%ebp
cmovns %ebp,%eax
and    $0xfffffff8,%eax
mov    %ebp,%ecx
sub    %eax,%ecx
movslq %ecx,%rax
shl    $0xa,%rax
and    $0x1f,%ebp
or     %rax,%rbp
cmp    $0x1fff,%rbp
jg     13ba <main+0x22a>
mov    0x0(%r13),%eax
add    $0xffffffff,%eax
mov    %ebp,%ecx
and    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,(%r12,%rbp,1)
mov    $0xa00000,%esi
mov    %r12,%rdi
call   1090 <isal_zero_detect@plt>
test   %eax,%eax
je     149a <main+0x30a>
movb   $0x0,(%r12,%rbp,1)
jmp    13ba <main+0x22a>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    0x0(%r13),%eax
mov    $0x1,%r14d
jmp    144d <main+0x2bd>
add    $0x1,%r14
cmp    $0xa7,%r14
je     14b9 <main+0x329>
test   %eax,%eax
jle    1440 <main+0x2b0>
mov    $0xa00000,%ebp
sub    %r14,%rbp
xor    %ebx,%ebx
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %al,(%r12,%rbp,1)
mov    $0xa00000,%esi
mov    %r12,%rdi
call   1090 <isal_zero_detect@plt>
test   %eax,%eax
je     148b <main+0x2fb>
movb   $0x0,(%r12,%rbp,1)
add    $0x1,%ebx
mov    0x0(%r13),%eax
cmp    %eax,%ebx
jl     145b <main+0x2cb>
jmp    1440 <main+0x2b0>
lea    0xc0a(%rip),%rdi
mov    %r14d,%esi
jmp    1379 <main+0x1e9>
lea    0xbd7(%rip),%rdi
mov    %r14d,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%r14d
jmp    12c3 <main+0x133>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%r14d
mov    $0xa8,%ebx
xor    %ebp,%ebp
jmp    14e0 <main+0x350>
movb   $0x0,(%r12,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     151e <main+0x38e>
mov    %r12,%rdi
mov    %r14,%rsi
call   1090 <isal_zero_detect@plt>
test   %eax,%eax
jne    15c8 <main+0x438>
movb   $0x1,(%r12,%rbp,1)
mov    %r12,%rdi
mov    %r14,%rsi
call   1090 <isal_zero_detect@plt>
cmp    %rbp,%r14
jbe    1510 <main+0x380>
test   %eax,%eax
je     15e4 <main+0x454>
cmp    %rbp,%r14
ja     14d2 <main+0x342>
test   %eax,%eax
je     14d2 <main+0x342>
jmp    15ed <main+0x45d>
add    $0x1,%r14
add    $0x1,%rbx
cmp    $0x20a7,%rbx
jne    14ce <main+0x33e>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %r14d,%r14d
xor    %eax,%eax
call   10b0 <rand@plt>
mov    %eax,%ebx
lea    0x7(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffff8,%eax
mov    %ebx,%ecx
sub    %eax,%ecx
movslq %ecx,%rax
shl    $0xa,%rax
and    $0x1f,%ebx
lea    (%rbx,%rax,1),%rbp
xor    %eax,%eax
call   10b0 <rand@plt>
movslq 0x0(%r13),%rcx
add    $0xffffffffffffffff,%rcx
cltq
and    %rcx,%rax
lea    (%rax,%rbp,1),%r15
add    $0x1,%r15
and    %ecx,%ebx
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %al,(%r12,%rbp,1)
mov    %r12,%rdi
mov    %r15,%rsi
call   1090 <isal_zero_detect@plt>
test   %eax,%eax
je     16c2 <main+0x532>
movb   $0x0,(%r12,%rbp,1)
add    $0x1,%r14d
cmp    $0x7d0,%r14d
jne    153c <main+0x3ac>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
xor    %r14d,%r14d
jmp    1621 <main+0x491>
lea    0xaf8(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%r14d
jmp    12c3 <main+0x133>
lea    0xb01(%rip),%rdi
jmp    15f4 <main+0x464>
lea    0xb1f(%rip),%rdi
mov    %r14,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%r14d
jmp    12c3 <main+0x133>
movb   $0x0,(%r12,%rbp,1)
add    $0x1,%r14d
cmp    $0x7d0,%r14d
je     16d1 <main+0x541>
xor    %eax,%eax
call   10b0 <rand@plt>
mov    %eax,%ebp
lea    0x7(%rbp),%eax
test   %ebp,%ebp
cmovns %ebp,%eax
and    $0xfffffff8,%eax
mov    %ebp,%ecx
sub    %eax,%ecx
movslq %ecx,%rax
shl    $0xa,%rax
and    $0x1f,%ebp
or     %rax,%rbp
xor    %eax,%eax
call   10b0 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   10b0 <rand@plt>
and    $0x3f,%eax
mov    %eax,%r15d
neg    %r15d
test   $0x1,%bl
cmovne %eax,%r15d
cmp    $0x1fff,%rbp
jg     1610 <main+0x480>
movslq %r15d,%rbx
add    %rbp,%rbx
cmp    $0x1fff,%rbx
ja     1610 <main+0x480>
mov    0x0(%r13),%eax
add    $0xffffffff,%eax
mov    %ebp,%ecx
and    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,(%r12,%rbp,1)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1090 <isal_zero_detect@plt>
test   %r15d,%r15d
jle    16a8 <main+0x518>
test   %eax,%eax
je     16f1 <main+0x561>
test   %r15d,%r15d
jg     160b <main+0x47b>
test   %eax,%eax
je     160b <main+0x47b>
lea    0xad7(%rip),%rdi
jmp    16f8 <main+0x568>
lea    0xa71(%rip),%rdi
mov    %r14d,%esi
mov    %r15,%rdx
jmp    16fe <main+0x56e>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %r14d,%r14d
xor    %edi,%edi
call   1080 <fflush@plt>
lea    0xae1(%rip),%rdi
jmp    121e <main+0x8e>
lea    0xa6e(%rip),%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%r14d
jmp    12c3 <main+0x133>

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

LLVM IR (-O2):
@.str = [54 x i8] c"mem_zero_detect_test %d bytes, %d randoms, seed=0x%x \00"
@.str.1 = [18 x i8] c"alloc error: Fail\00"
@.str.3 = [13 x i8] c"Fail len=%d\0A\00"
@CHAR_BIT = global i32 0
@.str.6 = [35 x i8] c"Fail on not detect offsets %d, %d\0A\00"
@.str.7 = [36 x i8] c"Fail on not detect rand %d, e=%lld\0A\00"
@.str.8 = [43 x i8] c"Fail on not detect rand offset=%d, idx=%d\0A\00"
@.str.9 = [37 x i8] c"Fail on detect non-zero with l=%lld\0A\00"
@.str.10 = [39 x i8] c"Fail on non-zero buffer l=%lld err=%d\0A\00"
@.str.11 = [39 x i8] c"Fail on bad pass detect l=%lld err=%d\0A\00"
@.str.12 = [44 x i8] c"Fail on not detect rand %d, l=%lld, e=%lld\0A\00"
@.str.13 = [49 x i8] c"Fail on non-zero rand buffer %d, l=%lld, e=%lld\0A\00"
@.str.14 = [54 x i8] c"Fail on bad pass zero detect rand %d, l=%lld, e=%lld\0A\00"
@str = [6 x i8] c" Pass\00"
@str.17 = [19 x i8] c"Fail on not detect\00"
@str.18 = [6 x i8] c"Fail:\00"
@str.19 = [20 x i8] c"Fail large buf test\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 10485760, i32 2000, i32 4660)
%6 = call i64 @posix_memalign(i8** %3, i32 64, i32 10485760)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %254
10: ; preds = %2
%11 = call i32 @srand(i32 4660)
%12 = load i8*, i8** %3
%13 = call i32 @memset(i8* %12, i32 0, i32 10485760)
%14 = load i8*, i8** %3
%15 = call i32 @isal_zero_detect(i8* %14, i64 10485760)
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %10
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.19, i64 0, i64 0))
br label %254
19: ; preds = %10
%20 = call i32 @putchar(i8 signext 46)
br label %21
21: ; preds = %19, %29
%22 = phi i64 [ 0, %19 ], [ %30, %29 ]
%23 = load i8*, i8** %3
%24 = call i32 @isal_zero_detect(i8* %23, i64 %22)
%25 = icmp eq i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %21
%27 = trunc i64 %22 to i32
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %27)
br label %254
29: ; preds = %21
%30 = add nuw nsw i64 %22, 1
%31 = icmp eq i64 %30, 8192
br i1 %31, label %32, label %21
32: ; preds = %29
%33 = call i32 @putchar(i8 signext 46)
%34 = load i8*, i8** %3
br label %35
35: ; preds = %32, %35
%36 = phi i64 [ 0, %32 ], [ %42, %35 ]
%37 = phi i32 [ 0, %32 ], [ %41, %35 ]
%38 = sub nuw nsw i64 8192, %36
%39 = getelementptr inbounds i8, i8* %34, i64 %38
%40 = call i32 @isal_zero_detect(i8* %39, i64 %36)
%41 = or i32 %40, %37
%42 = add nuw nsw i64 %36, 1
%43 = icmp eq i64 %42, 8192
br i1 %43, label %44, label %35
44: ; preds = %35
%45 = icmp eq i32 %41, 0
br i1 %45, label %48, label %46
46: ; preds = %44
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.18, i64 0, i64 0))
br label %254
48: ; preds = %44
%49 = call i32 @putchar(i8 signext 46)
%50 = getelementptr inbounds i8, i8* %34, i64 5242880
store i8 1, i8* %50
%51 = call i32 @isal_zero_detect(i8* %34, i64 10485760)
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %48
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.17, i64 0, i64 0))
br label %254
55: ; preds = %48
store i8 0, i8* %50
%56 = call i32 @putchar(i8 signext 46)
%57 = load i32, i32* @CHAR_BIT
br label %58
58: ; preds = %55, %77
%59 = phi i32 [ %57, %55 ], [ %78, %77 ]
%60 = phi i64 [ 0, %55 ], [ %79, %77 ]
%61 = icmp sgt i32 %59, 0
br i1 %61, label %62, label %77
62: ; preds = %58
%63 = getelementptr inbounds i8, i8* %34, i64 %60
br label %64
64: ; preds = %62, %73
%65 = phi i32 [ 0, %62 ], [ %74, %73 ]
%66 = shl nuw i32 1, %65
%67 = trunc i32 %66 to i8
store i8 %67, i8* %63
%68 = call i32 @isal_zero_detect(i8* %34, i64 10485760)
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %64
%71 = trunc i64 %60 to i32
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i32 %71, i32 %65)
br label %254
73: ; preds = %64
store i8 0, i8* %63
%74 = add nuw nsw i32 %65, 1
%75 = load i32, i32* @CHAR_BIT
%76 = icmp slt i32 %74, %75
br i1 %76, label %64, label %77
77: ; preds = %73, %58
%78 = phi i32 [ %59, %58 ], [ %75, %73 ]
%79 = add nuw nsw i64 %60, 1
%80 = icmp eq i64 %79, 167
br i1 %80, label %81, label %58
81: ; preds = %77
%82 = call i32 @putchar(i8 signext 46)
%83 = call i32 @fflush(i32 0)
br label %84
84: ; preds = %81, %107
%85 = phi i32 [ 0, %81 ], [ %108, %107 ]
%86 = call i32 (...) @rand()
%87 = srem i32 %86, 8
%88 = sext i32 %87 to i64
%89 = shl nsw i64 %88, 10
%90 = and i32 %86, 31
%91 = zext i32 %90 to i64
%92 = or i64 %89, %91
%93 = icmp sgt i64 %92, 8191
br i1 %93, label %107, label %94
94: ; preds = %84
%95 = load i32, i32* @CHAR_BIT
%96 = add nsw i32 %95, -1
%97 = trunc i64 %92 to i32
%98 = and i32 %96, %97
%99 = shl nuw i32 1, %98
%100 = trunc i32 %99 to i8
%101 = getelementptr inbounds i8, i8* %34, i64 %92
store i8 %100, i8* %101
%102 = call i32 @isal_zero_detect(i8* %34, i64 10485760)
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %106
104: ; preds = %94
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i32 %85, i64 %92)
br label %254
106: ; preds = %94
store i8 0, i8* %101
br label %107
107: ; preds = %84, %106
%108 = add nuw nsw i32 %85, 1
%109 = icmp eq i32 %108, 2000
br i1 %109, label %110, label %84
110: ; preds = %107
%111 = call i32 @putchar(i8 signext 46)
%112 = call i32 @fflush(i32 0)
%113 = load i32, i32* @CHAR_BIT
br label %114
114: ; preds = %110, %134
%115 = phi i32 [ %113, %110 ], [ %135, %134 ]
%116 = phi i64 [ 1, %110 ], [ %136, %134 ]
%117 = icmp sgt i32 %115, 0
br i1 %117, label %118, label %134
118: ; preds = %114
%119 = sub nuw nsw i64 10485760, %116
%120 = getelementptr inbounds i8, i8* %34, i64 %119
br label %121
121: ; preds = %118, %130
%122 = phi i32 [ 0, %118 ], [ %131, %130 ]
%123 = shl nuw i32 1, %122
%124 = trunc i32 %123 to i8
store i8 %124, i8* %120
%125 = call i32 @isal_zero_detect(i8* %34, i64 10485760)
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %130
127: ; preds = %121
%128 = trunc i64 %116 to i32
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i32 %128, i32 %122)
br label %254
130: ; preds = %121
store i8 0, i8* %120
%131 = add nuw nsw i32 %122, 1
%132 = load i32, i32* @CHAR_BIT
%133 = icmp slt i32 %131, %132
br i1 %133, label %121, label %134
134: ; preds = %130, %114
%135 = phi i32 [ %115, %114 ], [ %132, %130 ]
%136 = add nuw nsw i64 %116, 1
%137 = icmp eq i64 %136, 167
br i1 %137, label %138, label %114
138: ; preds = %134
%139 = call i32 @putchar(i8 signext 46)
br label %140
140: ; preds = %138, %168
%141 = phi i64 [ 168, %138 ], [ %170, %168 ]
%142 = phi i64 [ 1, %138 ], [ %169, %168 ]
br label %143
143: ; preds = %140, %165
%144 = phi i64 [ 0, %140 ], [ %166, %165 ]
%145 = call i32 @isal_zero_detect(i8* %34, i64 %142)
%146 = icmp eq i32 %145, 0
br i1 %146, label %149, label %147
147: ; preds = %143
%148 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i64 %142)
br label %254
149: ; preds = %143
%150 = getelementptr inbounds i8, i8* %34, i64 %144
store i8 1, i8* %150
%151 = call i32 @isal_zero_detect(i8* %34, i64 %142)
%152 = icmp ugt i64 %142, %144
%153 = icmp eq i32 %151, 0
%154 = select i1 %152, i1 %153, i1 false
br i1 %154, label %155, label %158
155: ; preds = %149
%156 = trunc i64 %144 to i32
%157 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), i64 %142, i32 %156)
br label %254
158: ; preds = %149
%159 = icmp ule i64 %142, %144
%160 = icmp ne i32 %151, 0
%161 = select i1 %159, i1 %160, i1 false
br i1 %161, label %162, label %165
162: ; preds = %158
%163 = trunc i64 %144 to i32
%164 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0), i64 %142, i32 %163)
br label %254
165: ; preds = %158
store i8 0, i8* %150
%166 = add nuw nsw i64 %144, 1
%167 = icmp eq i64 %166, %141
br i1 %167, label %168, label %143
168: ; preds = %165
%169 = add nuw nsw i64 %142, 1
%170 = add nuw nsw i64 %141, 1
%171 = icmp eq i64 %170, 8359
br i1 %171, label %172, label %140
172: ; preds = %168
%173 = call i32 @putchar(i8 signext 46)
br label %174
174: ; preds = %172, %199
%175 = phi i32 [ 0, %172 ], [ %200, %199 ]
%176 = call i32 (...) @rand()
%177 = srem i32 %176, 8
%178 = sext i32 %177 to i64
%179 = shl nsw i64 %178, 10
%180 = and i32 %176, 31
%181 = zext i32 %180 to i64
%182 = or i64 %179, %181
%183 = add nuw nsw i64 %182, 1
%184 = call i32 (...) @rand()
%185 = load i32, i32* @CHAR_BIT
%186 = add nsw i32 %185, -1
%187 = and i32 %186, %184
%188 = sext i32 %187 to i64
%189 = add nsw i64 %183, %188
%190 = trunc i64 %182 to i32
%191 = and i32 %186, %190
%192 = shl nuw i32 1, %191
%193 = trunc i32 %192 to i8
%194 = getelementptr inbounds i8, i8* %34, i64 %182
store i8 %193, i8* %194
%195 = call i32 @isal_zero_detect(i8* %34, i64 %189)
%196 = icmp eq i32 %195, 0
br i1 %196, label %197, label %199
197: ; preds = %174
%198 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.12, i64 0, i64 0), i32 %175, i64 %189, i64 %182)
br label %254
199: ; preds = %174
store i8 0, i8* %194
%200 = add nuw nsw i32 %175, 1
%201 = icmp eq i32 %200, 2000
br i1 %201, label %202, label %174
202: ; preds = %199
%203 = call i32 @putchar(i8 signext 46)
%204 = call i32 @fflush(i32 0)
br label %205
205: ; preds = %202, %247
%206 = phi i32 [ 0, %202 ], [ %248, %247 ]
%207 = call i32 (...) @rand()
%208 = srem i32 %207, 8
%209 = sext i32 %208 to i64
%210 = shl nsw i64 %209, 10
%211 = and i32 %207, 31
%212 = zext i32 %211 to i64
%213 = or i64 %210, %212
%214 = call i32 (...) @rand()
%215 = and i32 %214, 1
%216 = icmp eq i32 %215, 0
%217 = call i32 (...) @rand()
%218 = and i32 %217, 63
%219 = sub nsw i32 0, %218
%220 = select i1 %216, i32 %219, i32 %218
%221 = sext i32 %220 to i64
%222 = add nsw i64 %213, %221
%223 = icmp ugt i64 %222, 8191
%224 = icmp sgt i64 %213, 8191
%225 = or i1 %224, %223
br i1 %225, label %247, label %226
226: ; preds = %205
%227 = load i32, i32* @CHAR_BIT
%228 = add nsw i32 %227, -1
%229 = trunc i64 %213 to i32
%230 = and i32 %228, %229
%231 = shl nuw i32 1, %230
%232 = trunc i32 %231 to i8
%233 = getelementptr inbounds i8, i8* %34, i64 %213
store i8 %232, i8* %233
%234 = call i32 @isal_zero_detect(i8* %34, i64 %222)
%235 = icmp sgt i32 %220, 0
%236 = icmp eq i32 %234, 0
%237 = select i1 %235, i1 %236, i1 false
br i1 %237, label %238, label %240
238: ; preds = %226
%239 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0), i32 %206, i64 %222, i64 %213)
br label %254
240: ; preds = %226
%241 = icmp slt i32 %220, 1
%242 = icmp ne i32 %234, 0
%243 = select i1 %241, i1 %242, i1 false
br i1 %243, label %244, label %246
244: ; preds = %240
%245 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.14, i64 0, i64 0), i32 %206, i64 %222, i64 %213)
br label %254
246: ; preds = %240
store i8 0, i8* %233
br label %247
247: ; preds = %205, %246
%248 = add nuw nsw i32 %206, 1
%249 = icmp eq i32 %248, 2000
br i1 %249, label %250, label %205
250: ; preds = %247
%251 = call i32 @putchar(i8 signext 46)
%252 = call i32 @fflush(i32 0)
%253 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %254
254: ; preds = %250, %244, %238, %197, %162, %155, %147, %127, %104, %70, %53, %46, %26, %17, %8
%255 = phi i32 [ -1, %8 ], [ %15, %17 ], [ %24, %26 ], [ %41, %46 ], [ -1, %53 ], [ -1, %70 ], [ -1, %104 ], [ -1, %127 ], [ -1, %147 ], [ -1, %155 ], [ -1, %162 ], [ -1, %197 ], [ -1, %238 ], [ -1, %244 ], [ 0, %250 ]
ret i32 %255
}