#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*/ MADV_DONTNEED;
int MAP_ANONYMOUS;
char *MAP_FAILED;
int MAP_PRIVATE;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ err(int, char *, ...);
int /*<<< orphan*/ errx(int, char *, size_t, int, int, int, int);
size_t getpagesize();
int madvise(char *, size_t, int /*<<< orphan*/);
scalar_t__ mmap(int /*<<< orphan*/ *, int, int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
int main() {
  size_t page_size = getpagesize();
  char *m = (char *)mmap(NULL, 128 * page_size, PROT_READ | PROT_WRITE,
                         MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
  if (m == MAP_FAILED)
    err(1, "mmap()");
  for (size_t i = 0; i < 128; i++) {
    *(int *)(m + page_size * i) = 0x123;
    *(int *)(m + page_size * i + page_size - sizeof(int)) = 0x321;
  }
  bool cleared[128] = {false};
  for (size_t i = 0; i < 128; i++) {
    size_t perm_idx = ((i + 123) * 51) % 128;
    char *addr = m + page_size * perm_idx;
    size_t size = page_size - (i * 31337 % page_size);
    int res = madvise(addr, size, MADV_DONTNEED);
    if (res)
      err(1, "madvise(%p, 0x%zx, MADV_DONTNEED) failed", addr, size);
    cleared[perm_idx] = true;
    for (size_t j = 0; j < 128; j++) {
      int expected1 = cleared[j] ? 0 : 0x123;
      int expected2 = cleared[j] ? 0 : 0x321;
      int actual1 = *(int *)(m + page_size * j);
      int actual2 = *(int *)(m + page_size * j + page_size - sizeof(int));
      if (actual1 != expected1 || actual2 != expected2) {
        errx(1, "page %zu has wrong contents: 0x%x != 0x%x or 0x%x != 0x%x", j,
             actual1, expected1, actual2, expected2);
      }
    }
  }
  puts("TEST OK");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1090 <getpagesize@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x7,%rax
mov    %eax,%esi
mov    0x2e5a(%rip),%rax
mov    (%rax),%edx
mov    0x2e21(%rip),%rax
or     (%rax),%edx
mov    0x2e10(%rip),%rax
mov    (%rax),%ecx
mov    0x2e27(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2ddc(%rip),%rcx
cmp    (%rcx),%rax
jne    11f8 <main+0x88>
mov    $0x1,%edi
lea    0xe0f(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0x80,-0x20(%rbp)
jae    124f <main+0xdf>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
imul   -0x20(%rbp),%rcx
movl   $0x123,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
imul   -0x20(%rbp),%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
movl   $0x321,-0x4(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1200 <main+0x90>
lea    -0x220(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1060 <memset@plt>
movq   $0x0,-0x228(%rbp)
cmpq   $0x80,-0x228(%rbp)
jae    146c <main+0x2fc>
mov    -0x228(%rbp),%rax
add    $0x7b,%rax
imul   $0x33,%rax,%rax
and    $0x7f,%rax
mov    %rax,-0x230(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
imul   -0x230(%rbp),%rcx
ff
add    %rcx,%rax
mov    %rax,-0x238(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x268(%rbp)
imul   $0x7a69,-0x228(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    -0x268(%rbp),%rax
sub    %rdx,%rax
mov    %rax,-0x240(%rbp)
mov    -0x238(%rbp),%rdi
mov    -0x240(%rbp),%rsi
mov    0x2cda(%rip),%rax
mov    (%rax),%edx
call   1080 <madvise@plt>
mov    %eax,-0x244(%rbp)
cmpl   $0x0,-0x244(%rbp)
je     1331 <main+0x1c1>
mov    -0x238(%rbp),%rdx
mov    -0x240(%rbp),%rcx
mov    $0x1,%edi
lea    0xcdd(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
mov    -0x230(%rbp),%rax
movl   $0x1,-0x220(%rbp,%rax,4)
movq   $0x0,-0x250(%rbp)
cmpq   $0x80,-0x250(%rbp)
jae    1450 <main+0x2e0>
mov    -0x250(%rbp),%rax
mov    -0x220(%rbp,%rax,4),%edx
mov    $0x123,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x254(%rbp)
mov    -0x250(%rbp),%rax
mov    -0x220(%rbp,%rax,4),%edx
mov    $0x321,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x258(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
imul   -0x250(%rbp),%rcx
ff
mov    (%rax,%rcx,1),%eax
mov    %eax,-0x25c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
imul   -0x250(%rbp),%rcx
ff
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
mov    -0x4(%rax,%rcx,1),%eax
mov    %eax,-0x260(%rbp)
mov    -0x25c(%rbp),%eax
cmp    -0x254(%rbp),%eax
jne    13ff <main+0x28f>
mov    -0x260(%rbp),%eax
cmp    -0x258(%rbp),%eax
je     1434 <main+0x2c4>
mov    -0x250(%rbp),%rdx
mov    -0x25c(%rbp),%ecx
mov    -0x254(%rbp),%r8d
mov    -0x260(%rbp),%r9d
mov    -0x258(%rbp),%eax
mov    $0x1,%edi
lea    0xc04(%rip),%rsi
mov    %eax,(%rsp)
call   1050 <errx@plt>
jmp    1439 <main+0x2c9>
mov    -0x250(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x250(%rbp)
jmp    134e <main+0x1de>
jmp    1455 <main+0x2e5>
mov    -0x228(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x228(%rbp)
jmp    126d <main+0xfd>
lea    0xbf7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
xor    %eax,%eax
call   1090 <getpagesize@plt>
mov    %rax,%r15
mov    %r15d,%esi
shl    $0x7,%esi
mov    0x2e60(%rip),%rax
mov    0x2e29(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2e16(%rip),%rax
mov    0x2e2f(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
xor    %edi,%edi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%rbx
mov    0x2de9(%rip),%rax
cmp    %rbx,(%rax)
jne    11e7 <main+0x77>
lea    0xe25(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <err@plt>
lea    0x0(,%r15,4),%rax
lea    -0x4(%r15),%rcx
mov    $0x80,%edx
movabs $0x12300000321,%rsi
mov    %rbx,%rdi
cs nopw 0x0(%rax,%rax,1)
nop
movl   $0x123,(%rdi)
lea    (%rdi,%rcx,1),%rbp
mov    %rsi,-0x4(%rdi,%r15,1)
mov    %rsi,(%r15,%rbp,1)
add    %r15,%rbp
mov    %rsi,(%r15,%rbp,1)
add    %r15,%rbp
movl   $0x321,(%r15,%rbp,1)
add    %rax,%rdi
add    $0xfffffffffffffffc,%rdx
jne    1210 <main+0xa0>
lea    0x20(%rsp),%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    $0x123,%r12d
mov    $0x321,%r14d
xor    %edx,%edx
mov    %rbx,0x10(%rsp)
jmp    128b <main+0x11b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%rsp),%rdx
add    $0x1,%rdx
cmp    $0x80,%rdx
mov    0x10(%rsp),%rbx
je     1373 <main+0x203>
imul   $0x33,%edx,%ebp
add    $0x1,%ebp
and    $0x7f,%ebp
mov    %rbp,%r13
imul   %r15,%r13
add    %rbx,%r13
imul   $0x7a69,%rdx,%rax
mov    %rax,%rcx
or     %r15,%rcx
shr    $0x20,%rcx
mov    %rdx,0x18(%rsp)
je     12c0 <main+0x150>
xor    %edx,%edx
div    %r15
jmp    12c5 <main+0x155>
nopl   (%rax)
xor    %edx,%edx
div    %r15d
mov    %r15,%rbx
sub    %rdx,%rbx
mov    0x2cfe(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    %rbx,%rsi
call   1080 <madvise@plt>
test   %eax,%eax
je     12fc <main+0x18c>
mov    $0x1,%edi
lea    0xd18(%rip),%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <err@plt>
movl   $0x1,0x20(%rsp,%rbp,4)
mov    0x10(%rsp),%rbp
xor    %ebx,%ebx
lea    0xd1e(%rip),%r13
jmp    1347 <main+0x1d7>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,(%rsp)
mov    $0x1,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1050 <errx@plt>
add    $0x1,%rbx
add    %r15,%rbp
cmp    $0x80,%rbx
je     1270 <main+0x100>
cmpl   $0x0,0x20(%rsp,%rbx,4)
mov    $0x0,%r8d
cmove  %r12d,%r8d
mov    $0x0,%eax
cmove  %r14d,%eax
mov    0x0(%rbp),%ecx
mov    -0x4(%rbp,%r15,1),%r9d
cmp    %r8d,%ecx
jne    1320 <main+0x1b0>
cmp    %eax,%r9d
je     1333 <main+0x1c3>
jmp    1320 <main+0x1b0>
lea    0xcf0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANONYMOUS = global i32 0
@MAP_FAILED = global i8* null
@.str = [7 x i8] c"mmap()\00"
@MADV_DONTNEED = global i32 0
@.str.1 = [41 x i8] c"madvise(%p, 0x%zx, MADV_DONTNEED) failed\00"
@.str.2 = [58 x i8] c"page %zu has wrong contents: 0x%x != 0x%x or 0x%x != 0x%x\00"
@.str.3 = [8 x i8] c"TEST OK\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [128 x i32]
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %1
%16 = call i64 (...) @getpagesize()
store i64 %16, i64* %2
%17 = load i64, i64* %2
%18 = mul i64 128, %17
%19 = trunc i64 %18 to i32
%20 = load i32, i32* @PROT_READ
%21 = load i32, i32* @PROT_WRITE
%22 = or i32 %20, %21
%23 = load i32, i32* @MAP_PRIVATE
%24 = load i32, i32* @MAP_ANONYMOUS
%25 = or i32 %23, %24
%26 = call i64 @mmap(i32* null, i32 %19, i32 %22, i32 %25, i32 -1, i32 0)
%27 = inttoptr i64 %26 to i8*
store i8* %27, i8** %3
%28 = load i8*, i8** %3
%29 = load i8*, i8** @MAP_FAILED
%30 = icmp eq i8* %28, %29
br i1 %30, label %31, label %33
31: ; preds = %0
%32 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %33
33: ; preds = %31, %0
store i64 0, i64* %4
br label %34
34: ; preds = %53, %33
%35 = load i64, i64* %4
%36 = icmp ult i64 %35, 128
br i1 %36, label %37, label %56
37: ; preds = %34
%38 = load i8*, i8** %3
%39 = load i64, i64* %2
%40 = load i64, i64* %4
%41 = mul i64 %39, %40
%42 = getelementptr inbounds i8, i8* %38, i64 %41
%43 = bitcast i8* %42 to i32*
store i32 291, i32* %43
%44 = load i8*, i8** %3
%45 = load i64, i64* %2
%46 = load i64, i64* %4
%47 = mul i64 %45, %46
%48 = getelementptr inbounds i8, i8* %44, i64 %47
%49 = load i64, i64* %2
%50 = getelementptr inbounds i8, i8* %48, i64 %49
%51 = getelementptr inbounds i8, i8* %50, i64 -4
%52 = bitcast i8* %51 to i32*
store i32 801, i32* %52
br label %53
53: ; preds = %37
%54 = load i64, i64* %4
%55 = add i64 %54, 1
store i64 %55, i64* %4
br label %34
56: ; preds = %34
%57 = bitcast [128 x i32]* %5 to i8*
store i64 0, i64* %6
br label %58
58: ; preds = %142, %56
%59 = load i64, i64* %6
%60 = icmp ult i64 %59, 128
br i1 %60, label %61, label %145
61: ; preds = %58
%62 = load i64, i64* %6
%63 = add i64 %62, 123
%64 = mul i64 %63, 51
%65 = urem i64 %64, 128
store i64 %65, i64* %7
%66 = load i8*, i8** %3
%67 = load i64, i64* %2
%68 = load i64, i64* %7
%69 = mul i64 %67, %68
%70 = getelementptr inbounds i8, i8* %66, i64 %69
store i8* %70, i8** %8
%71 = load i64, i64* %2
%72 = load i64, i64* %6
%73 = mul i64 %72, 31337
%74 = load i64, i64* %2
%75 = urem i64 %73, %74
%76 = sub i64 %71, %75
store i64 %76, i64* %9
%77 = load i8*, i8** %8
%78 = load i64, i64* %9
%79 = load i32, i32* @MADV_DONTNEED
%80 = call i32 @madvise(i8* %77, i64 %78, i32 %79)
store i32 %80, i32* %10
%81 = load i32, i32* %10
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %87
83: ; preds = %61
%84 = load i8*, i8** %8
%85 = load i64, i64* %9
%86 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %84, i64 %85)
br label %87
87: ; preds = %83, %61
%88 = load i64, i64* %7
%89 = getelementptr inbounds [128 x i32], [128 x i32]* %5, i64 0, i64 %88
store i32 1, i32* %89
store i64 0, i64* %11
br label %90
90: ; preds = %138, %87
%91 = load i64, i64* %11
%92 = icmp ult i64 %91, 128
br i1 %92, label %93, label %141
93: ; preds = %90
%94 = load i64, i64* %11
%95 = getelementptr inbounds [128 x i32], [128 x i32]* %5, i64 0, i64 %94
%96 = load i32, i32* %95
%97 = icmp ne i32 %96, 0
%98 = zext i1 %97 to i64
%99 = select i1 %97, i32 0, i32 291
store i32 %99, i32* %12
%100 = load i64, i64* %11
%101 = getelementptr inbounds [128 x i32], [128 x i32]* %5, i64 0, i64 %100
%102 = load i32, i32* %101
%103 = icmp ne i32 %102, 0
%104 = zext i1 %103 to i64
%105 = select i1 %103, i32 0, i32 801
store i32 %105, i32* %13
%106 = load i8*, i8** %3
%107 = load i64, i64* %2
%108 = load i64, i64* %11
%109 = mul i64 %107, %108
%110 = getelementptr inbounds i8, i8* %106, i64 %109
%111 = bitcast i8* %110 to i32*
%112 = load i32, i32* %111
store i32 %112, i32* %14
%113 = load i8*, i8** %3
%114 = load i64, i64* %2
%115 = load i64, i64* %11
%116 = mul i64 %114, %115
%117 = getelementptr inbounds i8, i8* %113, i64 %116
%118 = load i64, i64* %2
%119 = getelementptr inbounds i8, i8* %117, i64 %118
%120 = getelementptr inbounds i8, i8* %119, i64 -4
%121 = bitcast i8* %120 to i32*
%122 = load i32, i32* %121
store i32 %122, i32* %15
%123 = load i32, i32* %14
%124 = load i32, i32* %12
%125 = icmp ne i32 %123, %124
br i1 %125, label %130, label %126
126: ; preds = %93
%127 = load i32, i32* %15
%128 = load i32, i32* %13
%129 = icmp ne i32 %127, %128
br i1 %129, label %130, label %137
130: ; preds = %126, %93
%131 = load i64, i64* %11
%132 = load i32, i32* %14
%133 = load i32, i32* %12
%134 = load i32, i32* %15
%135 = load i32, i32* %13
%136 = call i32 @errx(i32 1, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i64 %131, i32 %132, i32 %133, i32 %134, i32 %135)
br label %137
137: ; preds = %130, %126
br label %138
138: ; preds = %137
%139 = load i64, i64* %11
%140 = add i64 %139, 1
store i64 %140, i64* %11
br label %90
141: ; preds = %90
br label %142
142: ; preds = %141
%143 = load i64, i64* %6
%144 = add i64 %143, 1
store i64 %144, i64* %6
br label %58
145: ; preds = %58
%146 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANONYMOUS = global i32 0
@MAP_FAILED = global i8* null
@.str = [7 x i8] c"mmap()\00"
@MADV_DONTNEED = global i32 0
@.str.1 = [41 x i8] c"madvise(%p, 0x%zx, MADV_DONTNEED) failed\00"
@.str.2 = [58 x i8] c"page %zu has wrong contents: 0x%x != 0x%x or 0x%x != 0x%x\00"
@.str.3 = [8 x i8] c"TEST OK\00"
define i32 @main() {
%1 = alloca [128 x i32]
%2 = tail call i64 (...) @getpagesize()
%3 = trunc i64 %2 to i32
%4 = shl i32 %3, 7
%5 = load i32, i32* @PROT_READ
%6 = load i32, i32* @PROT_WRITE
%7 = or i32 %6, %5
%8 = load i32, i32* @MAP_PRIVATE
%9 = load i32, i32* @MAP_ANONYMOUS
%10 = or i32 %9, %8
%11 = tail call i64 @mmap(i32* null, i32 %4, i32 %7, i32 %10, i32 -1, i32 0)
%12 = inttoptr i64 %11 to i8*
%13 = load i8*, i8** @MAP_FAILED
%14 = icmp eq i8* %13, %12
br i1 %14, label %16, label %15
15: ; preds = %16, %0
br label %20
16: ; preds = %0
%17 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %15
18: ; preds = %20
%19 = bitcast [128 x i32]* %1 to i8*
br label %53
20: ; preds = %20, %15
%21 = phi i64 [ 0, %15 ], [ %49, %20 ]
%22 = mul i64 %21, %2
%23 = getelementptr inbounds i8, i8* %12, i64 %22
%24 = bitcast i8* %23 to i32*
store i32 291, i32* %24
%25 = getelementptr inbounds i8, i8* %23, i64 %2
%26 = getelementptr inbounds i8, i8* %25, i64 -4
%27 = bitcast i8* %26 to i32*
store i32 801, i32* %27
%28 = or i64 %21, 1
%29 = mul i64 %28, %2
%30 = getelementptr inbounds i8, i8* %12, i64 %29
%31 = bitcast i8* %30 to i32*
store i32 291, i32* %31
%32 = getelementptr inbounds i8, i8* %30, i64 %2
%33 = getelementptr inbounds i8, i8* %32, i64 -4
%34 = bitcast i8* %33 to i32*
store i32 801, i32* %34
%35 = or i64 %21, 2
%36 = mul i64 %35, %2
%37 = getelementptr inbounds i8, i8* %12, i64 %36
%38 = bitcast i8* %37 to i32*
store i32 291, i32* %38
%39 = getelementptr inbounds i8, i8* %37, i64 %2
%40 = getelementptr inbounds i8, i8* %39, i64 -4
%41 = bitcast i8* %40 to i32*
store i32 801, i32* %41
%42 = or i64 %21, 3
%43 = mul i64 %42, %2
%44 = getelementptr inbounds i8, i8* %12, i64 %43
%45 = bitcast i8* %44 to i32*
store i32 291, i32* %45
%46 = getelementptr inbounds i8, i8* %44, i64 %2
%47 = getelementptr inbounds i8, i8* %46, i64 -4
%48 = bitcast i8* %47 to i32*
store i32 801, i32* %48
%49 = add nuw nsw i64 %21, 4
%50 = icmp eq i64 %49, 128
br i1 %50, label %18, label %20
51: ; preds = %70
%52 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
53: ; preds = %18, %70
%54 = phi i64 [ 0, %18 ], [ %71, %70 ]
%55 = mul nuw nsw i64 %54, 51
%56 = add nuw nsw i64 %55, 1
%57 = and i64 %56, 127
%58 = mul i64 %57, %2
%59 = getelementptr inbounds i8, i8* %12, i64 %58
%60 = mul nuw nsw i64 %54, 31337
%61 = urem i64 %60, %2
%62 = sub i64 %2, %61
%63 = load i32, i32* @MADV_DONTNEED
%64 = tail call i32 @madvise(i8* %59, i64 %62, i32 %63)
%65 = icmp eq i32 %64, 0
br i1 %65, label %68, label %66
66: ; preds = %53
%67 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %59, i64 %62)
br label %68
68: ; preds = %66, %53
%69 = getelementptr inbounds [128 x i32], [128 x i32]* %1, i64 0, i64 %57
store i32 1, i32* %69
br label %73
70: ; preds = %93
%71 = add nuw nsw i64 %54, 1
%72 = icmp eq i64 %71, 128
br i1 %72, label %51, label %53
73: ; preds = %68, %93
%74 = phi i64 [ 0, %68 ], [ %94, %93 ]
%75 = getelementptr inbounds [128 x i32], [128 x i32]* %1, i64 0, i64 %74
%76 = load i32, i32* %75
%77 = icmp eq i32 %76, 0
%78 = select i1 %77, i32 291, i32 0
%79 = select i1 %77, i32 801, i32 0
%80 = mul i64 %74, %2
%81 = getelementptr inbounds i8, i8* %12, i64 %80
%82 = bitcast i8* %81 to i32*
%83 = load i32, i32* %82
%84 = getelementptr inbounds i8, i8* %81, i64 %2
%85 = getelementptr inbounds i8, i8* %84, i64 -4
%86 = bitcast i8* %85 to i32*
%87 = load i32, i32* %86
%88 = icmp eq i32 %83, %78
%89 = icmp eq i32 %87, %79
%90 = select i1 %88, i1 %89, i1 false
br i1 %90, label %93, label %91
91: ; preds = %73
%92 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i64 %74, i32 %83, i32 %78, i32 %87, i32 %79)
br label %93
93: ; preds = %73, %91
%94 = add nuw nsw i64 %74, 1
%95 = icmp eq i64 %94, 128
br i1 %95, label %70, label %73
}