#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 MAP_ANONYMOUS;
void *MAP_FAILED;
int MAP_GROWSDOWN;
int MAP_PRIVATE;
int PROT_EXEC;
int PROT_NONE;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ errno;
void *mmap(void *, int, int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ munmap(void *, size_t);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ test_daemon();
int /*<<< orphan*/ test_init(int, char **);
int /*<<< orphan*/ test_msg(char *, ...);
int /*<<< orphan*/ test_waitsig();
int main(int argc, char *argv[]) {
  void *map[4096 + 2] = {}, *addr;
  size_t i, summary;
  test_init(argc, argv);
  summary = 4096 * 2 * 4096 + (140 << 10) + (8192) + (1 << 20);
  addr = mmap(NULL, summary, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
  if (addr == MAP_FAILED) {
    test_msg("ERR: %s:%d: "
             "Can't mmap"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/maps05.c",
             35, errno, strerror(errno));
    return 1;
  }
  munmap(addr, summary);
  for (i = 0; i < 4096; i++) {
    map[i] = mmap(i > 0 ? map[i - 1] + 8192 : addr, 4096,
                  PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
    if (map[i] == MAP_FAILED) {
      test_msg("ERR: %s:%d: "
               "Can't mmap"
               " (errno = %d (%s))\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/"
               "heads/master/test/zdtm/live/static/maps05.c",
               44, errno, strerror(errno));
      return 1;
    } else {
      int *v = (void *)map[i];
      *v = i;
    }
  }
  map[(4096 + 0)] = mmap(map[(4096 + 0) - 1] + 8192, (140 << 10),
                         PROT_READ | PROT_WRITE | PROT_EXEC,
                         MAP_ANONYMOUS | MAP_PRIVATE | MAP_GROWSDOWN, -1, 0);
  if (map[(4096 + 0)] == MAP_FAILED) {
    test_msg("ERR: %s:%d: "
             "Can't mmap"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/maps05.c",
             56, errno, strerror(errno));
    return 1;
  } else {
    int *v = (void *)map[(4096 + 0)];
    *v = i;
    test_msg("map-1: %p %p\n", map[(4096 + 0)], map[(4096 + 0)] + (140 << 10));
  }
  map[(4096 + 1)] =
      mmap(map[(4096 + 0)] + (140 << 10), (8192), PROT_READ | PROT_WRITE,
           MAP_ANONYMOUS | MAP_PRIVATE | MAP_GROWSDOWN, -1, 0);
  if (map[(4096 + 1)] == MAP_FAILED) {
    test_msg("ERR: %s:%d: "
             "Can't mmap"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/maps05.c",
             68, errno, strerror(errno));
    return 1;
  } else {
    int *v = (void *)map[(4096 + 1)];
    *v = i;
    test_msg("map-2: %p %p\n", map[(4096 + 1)], map[(4096 + 1)] + (8192));
  }
  test_daemon();
  test_waitsig();
  for (i = 0; i < 4096; i++) {
    int *v = (void *)map[i];
    if (*v != i) {
      test_msg("FAIL: %s:%d: "
               "Data corrupted at page %lu"
               " (errno = %d (%s))\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/"
               "heads/master/test/zdtm/live/static/maps05.c",
               84, (unsigned long)i, errno, strerror(errno));
      return 1;
    }
  }
  test_msg("PASS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8080,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x8020(%rbp),%rdi
xor    %esi,%esi
mov    $0x8010,%edx
call   1060 <memset@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_init@plt>
movq   $0x2125000,-0x8038(%rbp)
mov    -0x8038(%rbp),%rax
mov    %eax,%esi
mov    0x2e15(%rip),%rax
mov    (%rax),%edx
mov    0x2dfc(%rip),%rax
mov    (%rax),%ecx
mov    0x2dcb(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x8028(%rbp)
mov    -0x8028(%rbp),%rax
mov    0x2d9a(%rip),%rcx
cmp    (%rcx),%rax
jne    1263 <main+0xe3>
mov    0x2da2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x805c(%rbp)
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x805c(%rbp),%ecx
mov    %eax,%r8d
lea    0xdbc(%rip),%rdi
lea    0xddf(%rip),%rsi
mov    $0x23,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1697 <main+0x517>
mov    -0x8028(%rbp),%rdi
mov    -0x8038(%rbp),%rsi
call   1090 <munmap@plt>
movq   $0x0,-0x8030(%rbp)
cmpq   $0x1000,-0x8030(%rbp)
jae    13d2 <main+0x252>
cmpq   $0x0,-0x8030(%rbp)
jbe    12c5 <main+0x145>
mov    -0x8030(%rbp),%rax
sub    $0x1,%rax
mov    -0x8020(%rbp,%rax,8),%rax
ff
add    $0x2000,%rax
mov    %rax,-0x8068(%rbp)
jmp    12d3 <main+0x153>
mov    -0x8028(%rbp),%rax
mov    %rax,-0x8068(%rbp)
mov    -0x8068(%rbp),%rdi
mov    0x2d17(%rip),%rax
mov    (%rax),%edx
mov    0x2cce(%rip),%rax
or     (%rax),%edx
mov    0x2ce5(%rip),%rax
mov    (%rax),%ecx
mov    0x2cb4(%rip),%rax
or     (%rax),%ecx
mov    $0x1000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%rcx
mov    -0x8030(%rbp),%rax
mov    %rcx,-0x8020(%rbp,%rax,8)
ff
mov    -0x8030(%rbp),%rax
mov    -0x8020(%rbp,%rax,8),%rax
ff
mov    0x2c6f(%rip),%rcx
cmp    (%rcx),%rax
jne    138e <main+0x20e>
mov    0x2c77(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x806c(%rbp)
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x806c(%rbp),%ecx
mov    %eax,%r8d
lea    0xc91(%rip),%rdi
lea    0xcb4(%rip),%rsi
mov    $0x2c,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1697 <main+0x517>
mov    -0x8030(%rbp),%rax
mov    -0x8020(%rbp,%rax,8),%rax
ff
mov    %rax,-0x8040(%rbp)
mov    -0x8030(%rbp),%rax
mov    %eax,%ecx
mov    -0x8040(%rbp),%rax
mov    %ecx,(%rax)
jmp    13bb <main+0x23b>
mov    -0x8030(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8030(%rbp)
jmp    1281 <main+0x101>
mov    -0x28(%rbp),%rdi
add    $0x2000,%rdi
mov    0x2c14(%rip),%rax
mov    (%rax),%edx
mov    0x2bcb(%rip),%rax
or     (%rax),%edx
mov    0x2bda(%rip),%rax
or     (%rax),%edx
mov    0x2bd9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ba8(%rip),%rax
or     (%rax),%ecx
mov    0x2b8f(%rip),%rax
or     (%rax),%ecx
mov    $0x23000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2b73(%rip),%rcx
cmp    (%rcx),%rax
jne    148a <main+0x30a>
mov    0x2b7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8070(%rbp)
mov    0x2b6c(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x8070(%rbp),%ecx
mov    %eax,%r8d
lea    0xb95(%rip),%rdi
lea    0xbb8(%rip),%rsi
mov    $0x38,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1697 <main+0x517>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8048(%rbp)
mov    -0x8030(%rbp),%rax
mov    %eax,%ecx
mov    -0x8048(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rsi
mov    -0x20(%rbp),%rdx
add    $0x23000,%rdx
lea    0xc10(%rip),%rdi
mov    $0x0,%al
call   1070 <test_msg@plt>
mov    -0x20(%rbp),%rdi
add    $0x23000,%rdi
mov    0x2b22(%rip),%rax
mov    (%rax),%edx
mov    0x2ad9(%rip),%rax
or     (%rax),%edx
mov    0x2af0(%rip),%rax
mov    (%rax),%ecx
mov    0x2abf(%rip),%rax
or     (%rax),%ecx
mov    0x2aa6(%rip),%rax
or     (%rax),%ecx
mov    $0x2000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2a8a(%rip),%rcx
cmp    (%rcx),%rax
jne    1573 <main+0x3f3>
mov    0x2a92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8074(%rbp)
mov    0x2a83(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x8074(%rbp),%ecx
mov    %eax,%r8d
lea    0xaac(%rip),%rdi
lea    0xacf(%rip),%rsi
mov    $0x44,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1697 <main+0x517>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8050(%rbp)
mov    -0x8030(%rbp),%rax
mov    %eax,%ecx
mov    -0x8050(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x2000,%rdx
lea    0xb35(%rip),%rdi
mov    $0x0,%al
call   1070 <test_msg@plt>
mov    $0x0,%al
call   1050 <test_daemon@plt>
mov    $0x0,%al
call   1080 <test_waitsig@plt>
movq   $0x0,-0x8030(%rbp)
cmpq   $0x1000,-0x8030(%rbp)
jae    1682 <main+0x502>
mov    -0x8030(%rbp),%rax
mov    -0x8020(%rbp,%rax,8),%rax
ff
mov    %rax,-0x8058(%rbp)
mov    -0x8058(%rbp),%rax
movslq (%rax),%rax
cmp    -0x8030(%rbp),%rax
je     1666 <main+0x4e6>
mov    -0x8030(%rbp),%rax
mov    %rax,-0x8080(%rbp)
mov    0x29a7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8078(%rbp)
mov    0x2998(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x8080(%rbp),%rcx
mov    -0x8078(%rbp),%r8d
mov    %eax,%r9d
lea    0xaa2(%rip),%rdi
lea    0x9dc(%rip),%rsi
mov    $0x54,%edx
mov    $0x0,%al
call   1070 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1697 <main+0x517>
jmp    166b <main+0x4eb>
mov    -0x8030(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8030(%rbp)
jmp    15c6 <main+0x446>
lea    0xa9b(%rip),%rdi
mov    $0x0,%al
call   1070 <test_msg@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8080,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8018,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsp,%rdi
mov    $0x8010,%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <test_init@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%edx
mov    0x2e19(%rip),%r12
mov    0x2dea(%rip),%rbp
mov    0x0(%rbp),%ecx
or     (%r12),%ecx
xor    %edi,%edi
mov    $0x2125000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%rbx
mov    0x2dbc(%rip),%rax
cmp    (%rax),%rbx
je     13f1 <main+0x271>
mov    $0x2125000,%esi
mov    %rbx,%rdi
call   1090 <munmap@plt>
xor    %r14d,%r14d
mov    0x2dec(%rip),%rax
mov    0x2da5(%rip),%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
test   %r14,%r14
je     1235 <main+0xb5>
mov    -0x8(%rsp,%r14,8),%rdi
mov    $0x2000,%edx
add    %rdx,%rdi
mov    %rcx,%r13
mov    (%rcx),%edx
mov    %rax,%r15
or     (%rax),%edx
mov    0x0(%rbp),%ecx
or     (%r12),%ecx
mov    $0x1000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,(%rsp,%r14,8)
mov    0x2d44(%rip),%rcx
cmp    (%rcx),%rax
je     1416 <main+0x296>
mov    %r14d,(%rax)
add    $0x1,%r14
cmp    $0x1000,%r14
mov    %r15,%rax
mov    %r13,%rcx
jne    1220 <main+0xa0>
mov    $0x2000,%edi
add    0x7ff8(%rsp),%rdi
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rax,%r15
mov    0x2d32(%rip),%rax
or     (%rax),%edx
mov    %rcx,%r14
mov    0x0(%rbp),%ecx
or     (%r12),%ecx
mov    0x2cef(%rip),%rax
or     (%rax),%ecx
mov    $0x23000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,0x8000(%rsp)
mov    0x2cd3(%rip),%r13
cmp    0x0(%r13),%rax
je     143b <main+0x2bb>
movl   $0x1000,(%rax)
mov    %rax,%rbx
add    $0x23000,%rbx
lea    0xdd7(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <test_msg@plt>
mov    (%r14),%edx
or     (%r15),%edx
mov    0x0(%rbp),%ecx
or     (%r12),%ecx
mov    0x2c89(%rip),%rax
or     (%rax),%ecx
mov    %rbx,%rdi
mov    $0x2000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,0x8008(%rsp)
cmp    0x0(%r13),%rax
je     1460 <main+0x2e0>
movl   $0x1000,(%rax)
mov    %rax,%rdx
add    $0x2000,%rdx
lea    0xd83(%rip),%rdi
xor    %ebx,%ebx
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <test_msg@plt>
xor    %eax,%eax
call   1050 <test_daemon@plt>
xor    %eax,%eax
call   1080 <test_waitsig@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rsp,%rbx,8),%rax
movslq (%rax),%rax
cmp    %rax,%rbx
jne    14a8 <main+0x328>
lea    0x1(%rbx),%rbp
mov    0x8(%rsp,%rbx,8),%rax
movslq (%rax),%rax
cmp    %rax,%rbp
jne    14ab <main+0x32b>
lea    0x2(%rbx),%rbp
mov    0x10(%rsp,%rbx,8),%rax
movslq (%rax),%rax
cmp    %rax,%rbp
jne    14ab <main+0x32b>
lea    0x3(%rbx),%rbp
mov    0x18(%rsp,%rbx,8),%rax
movslq (%rax),%rax
cmp    %rax,%rbp
jne    14ab <main+0x32b>
add    $0x4,%rbx
cmp    $0x1000,%rbx
jne    1380 <main+0x200>
lea    0xd41(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <test_msg@plt>
jmp    1494 <main+0x314>
mov    0x2bc8(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10a0 <strerror@plt>
lea    0xbf8(%rip),%rdi
lea    0xc1b(%rip),%rsi
mov    $0x23,%edx
jmp    1483 <main+0x303>
mov    0x2ba3(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10a0 <strerror@plt>
lea    0xbd3(%rip),%rdi
lea    0xbf6(%rip),%rsi
mov    $0x2c,%edx
jmp    1483 <main+0x303>
mov    0x2b7e(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10a0 <strerror@plt>
lea    0xbae(%rip),%rdi
lea    0xbd1(%rip),%rsi
mov    $0x38,%edx
jmp    1483 <main+0x303>
mov    0x2b59(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10a0 <strerror@plt>
lea    0xb89(%rip),%rdi
lea    0xbac(%rip),%rsi
mov    $0x44,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <test_msg@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rbp
mov    0x2b0e(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10a0 <strerror@plt>
lea    0xc27(%rip),%rdi
lea    0xb61(%rip),%rsi
mov    $0x54,%edx
mov    %rbp,%rcx
mov    %ebx,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <test_msg@plt>
jmp    148f <main+0x30f>

LLVM IR (-O0):
@PROT_NONE = global i32 0
@MAP_ANONYMOUS = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
@.str = [42 x i8] c"ERR: %s:%d: Can't mmap (errno = %d (%s))\0A\00"
@.str.1 = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/master/test/zdtm/live/static/maps05.c\00"
@errno = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@PROT_EXEC = global i32 0
@MAP_GROWSDOWN = global i32 0
@.str.2 = [14 x i8] c"map-1: %p %p\0A\00"
@.str.3 = [14 x i8] c"map-2: %p %p\0A\00"
@.str.4 = [59 x i8] c"FAIL: %s:%d: Data corrupted at page %lu (errno = %d (%s))\0A\00"
@.str.5 = [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 [4098 x i8*]
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = bitcast [4098 x i8*]* %6 to i8*
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i32 @test_init(i32 %15, i8** %16)
store i64 34754560, i64* %9
%18 = load i64, i64* %9
%19 = trunc i64 %18 to i32
%20 = load i32, i32* @PROT_NONE
%21 = load i32, i32* @MAP_ANONYMOUS
%22 = load i32, i32* @MAP_PRIVATE
%23 = or i32 %21, %22
%24 = call i8* @mmap(i8* null, i32 %19, i32 %20, i32 %23, i32 -1, i32 0)
store i8* %24, i8** %7
%25 = load i8*, i8** %7
%26 = load i8*, i8** @MAP_FAILED
%27 = icmp eq i8* %25, %26
br i1 %27, label %28, label %33
28: ; preds = %2
%29 = load i32, i32* @errno
%30 = load i32, i32* @errno
%31 = call i32 @strerror(i32 %30)
%32 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 35, i32 %29, i32 %31)
store i32 1, i32* %3
br label %186
33: ; preds = %2
%34 = load i8*, i8** %7
%35 = load i64, i64* %9
%36 = call i32 @munmap(i8* %34, i64 %35)
store i64 0, i64* %8
br label %37
37: ; preds = %81, %33
%38 = load i64, i64* %8
%39 = icmp ult i64 %38, 4096
br i1 %39, label %40, label %84
40: ; preds = %37
%41 = load i64, i64* %8
%42 = icmp ugt i64 %41, 0
br i1 %42, label %43, label %49
43: ; preds = %40
%44 = load i64, i64* %8
%45 = sub i64 %44, 1
%46 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 %45
%47 = load i8*, i8** %46
%48 = getelementptr i8, i8* %47, i64 8192
br label %51
49: ; preds = %40
%50 = load i8*, i8** %7
br label %51
51: ; preds = %49, %43
%52 = phi i8* [ %48, %43 ], [ %50, %49 ]
%53 = load i32, i32* @PROT_READ
%54 = load i32, i32* @PROT_WRITE
%55 = or i32 %53, %54
%56 = load i32, i32* @MAP_ANONYMOUS
%57 = load i32, i32* @MAP_PRIVATE
%58 = or i32 %56, %57
%59 = call i8* @mmap(i8* %52, i32 4096, i32 %55, i32 %58, i32 -1, i32 0)
%60 = load i64, i64* %8
%61 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 %60
store i8* %59, i8** %61
%62 = load i64, i64* %8
%63 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 %62
%64 = load i8*, i8** %63
%65 = load i8*, i8** @MAP_FAILED
%66 = icmp eq i8* %64, %65
br i1 %66, label %67, label %72
67: ; preds = %51
%68 = load i32, i32* @errno
%69 = load i32, i32* @errno
%70 = call i32 @strerror(i32 %69)
%71 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 44, i32 %68, i32 %70)
store i32 1, i32* %3
br label %186
72: ; preds = %51
%73 = load i64, i64* %8
%74 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 %73
%75 = load i8*, i8** %74
%76 = bitcast i8* %75 to i32*
store i32* %76, i32** %10
%77 = load i64, i64* %8
%78 = trunc i64 %77 to i32
%79 = load i32*, i32** %10
store i32 %78, i32* %79
br label %80
80: ; preds = %72
br label %81
81: ; preds = %80
%82 = load i64, i64* %8
%83 = add i64 %82, 1
store i64 %83, i64* %8
br label %37
84: ; preds = %37
%85 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4095
%86 = load i8*, i8** %85
%87 = getelementptr i8, i8* %86, i64 8192
%88 = load i32, i32* @PROT_READ
%89 = load i32, i32* @PROT_WRITE
%90 = or i32 %88, %89
%91 = load i32, i32* @PROT_EXEC
%92 = or i32 %90, %91
%93 = load i32, i32* @MAP_ANONYMOUS
%94 = load i32, i32* @MAP_PRIVATE
%95 = or i32 %93, %94
%96 = load i32, i32* @MAP_GROWSDOWN
%97 = or i32 %95, %96
%98 = call i8* @mmap(i8* %87, i32 143360, i32 %92, i32 %97, i32 -1, i32 0)
%99 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4096
store i8* %98, i8** %99
%100 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4096
%101 = load i8*, i8** %100
%102 = load i8*, i8** @MAP_FAILED
%103 = icmp eq i8* %101, %102
br i1 %103, label %104, label %109
104: ; preds = %84
%105 = load i32, i32* @errno
%106 = load i32, i32* @errno
%107 = call i32 @strerror(i32 %106)
%108 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 56, i32 %105, i32 %107)
store i32 1, i32* %3
br label %186
109: ; preds = %84
%110 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4096
%111 = load i8*, i8** %110
%112 = bitcast i8* %111 to i32*
store i32* %112, i32** %11
%113 = load i64, i64* %8
%114 = trunc i64 %113 to i32
%115 = load i32*, i32** %11
store i32 %114, i32* %115
%116 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4096
%117 = load i8*, i8** %116
%118 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4096
%119 = load i8*, i8** %118
%120 = getelementptr i8, i8* %119, i64 143360
%121 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %117, i8* %120)
br label %122
122: ; preds = %109
%123 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4096
%124 = load i8*, i8** %123
%125 = getelementptr i8, i8* %124, i64 143360
%126 = load i32, i32* @PROT_READ
%127 = load i32, i32* @PROT_WRITE
%128 = or i32 %126, %127
%129 = load i32, i32* @MAP_ANONYMOUS
%130 = load i32, i32* @MAP_PRIVATE
%131 = or i32 %129, %130
%132 = load i32, i32* @MAP_GROWSDOWN
%133 = or i32 %131, %132
%134 = call i8* @mmap(i8* %125, i32 8192, i32 %128, i32 %133, i32 -1, i32 0)
%135 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4097
store i8* %134, i8** %135
%136 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4097
%137 = load i8*, i8** %136
%138 = load i8*, i8** @MAP_FAILED
%139 = icmp eq i8* %137, %138
br i1 %139, label %140, label %145
140: ; preds = %122
%141 = load i32, i32* @errno
%142 = load i32, i32* @errno
%143 = call i32 @strerror(i32 %142)
%144 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 68, i32 %141, i32 %143)
store i32 1, i32* %3
br label %186
145: ; preds = %122
%146 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4097
%147 = load i8*, i8** %146
%148 = bitcast i8* %147 to i32*
store i32* %148, i32** %12
%149 = load i64, i64* %8
%150 = trunc i64 %149 to i32
%151 = load i32*, i32** %12
store i32 %150, i32* %151
%152 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4097
%153 = load i8*, i8** %152
%154 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 4097
%155 = load i8*, i8** %154
%156 = getelementptr i8, i8* %155, i64 8192
%157 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %153, i8* %156)
br label %158
158: ; preds = %145
%159 = call i32 (...) @test_daemon()
%160 = call i32 (...) @test_waitsig()
store i64 0, i64* %8
br label %161
161: ; preds = %181, %158
%162 = load i64, i64* %8
%163 = icmp ult i64 %162, 4096
br i1 %163, label %164, label %184
164: ; preds = %161
%165 = load i64, i64* %8
%166 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %6, i64 0, i64 %165
%167 = load i8*, i8** %166
%168 = bitcast i8* %167 to i32*
store i32* %168, i32** %13
%169 = load i32*, i32** %13
%170 = load i32, i32* %169
%171 = sext i32 %170 to i64
%172 = load i64, i64* %8
%173 = icmp ne i64 %171, %172
br i1 %173, label %174, label %180
174: ; preds = %164
%175 = load i64, i64* %8
%176 = load i32, i32* @errno
%177 = load i32, i32* @errno
%178 = call i32 @strerror(i32 %177)
%179 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 84, i64 %175, i32 %176, i32 %178)
store i32 1, i32* %3
br label %186
180: ; preds = %164
br label %181
181: ; preds = %180
%182 = load i64, i64* %8
%183 = add i64 %182, 1
store i64 %183, i64* %8
br label %161
184: ; preds = %161
%185 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %186
186: ; preds = %184, %174, %140, %104, %67, %28
%187 = load i32, i32* %3
ret i32 %187
}

LLVM IR (-O2):
@PROT_NONE = global i32 0
@MAP_ANONYMOUS = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
@.str = [42 x i8] c"ERR: %s:%d: Can't mmap (errno = %d (%s))\0A\00"
@.str.1 = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/master/test/zdtm/live/static/maps05.c\00"
@errno = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@PROT_EXEC = global i32 0
@MAP_GROWSDOWN = global i32 0
@.str.2 = [14 x i8] c"map-1: %p %p\0A\00"
@.str.3 = [14 x i8] c"map-2: %p %p\0A\00"
@.str.4 = [59 x i8] c"FAIL: %s:%d: Data corrupted at page %lu (errno = %d (%s))\0A\00"
@.str.5 = [6 x i8] c"PASS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [4098 x i8*]
%4 = bitcast [4098 x i8*]* %3 to i8*
%5 = tail call i32 @test_init(i32 %0, i8** %1)
%6 = load i32, i32* @PROT_NONE
%7 = load i32, i32* @MAP_ANONYMOUS
%8 = load i32, i32* @MAP_PRIVATE
%9 = or i32 %8, %7
%10 = tail call i8* @mmap(i8* null, i32 34754560, i32 %6, i32 %9, i32 -1, i32 0)
%11 = load i8*, i8** @MAP_FAILED
%12 = icmp eq i8* %10, %11
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i32, i32* @errno
%15 = tail call i32 @strerror(i32 %14)
%16 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 35, i32 %14, i32 %15)
br label %138
17: ; preds = %2
%18 = tail call i32 @munmap(i8* %10, i64 34754560)
br label %19
19: ; preds = %17, %43
%20 = phi i64 [ 0, %17 ], [ %46, %43 ]
%21 = icmp eq i64 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %19
%23 = add nsw i64 %20, -1
%24 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %3, i64 0, i64 %23
%25 = load i8*, i8** %24
%26 = getelementptr i8, i8* %25, i64 8192
br label %27
27: ; preds = %19, %22
%28 = phi i8* [ %26, %22 ], [ %10, %19 ]
%29 = load i32, i32* @PROT_READ
%30 = load i32, i32* @PROT_WRITE
%31 = or i32 %30, %29
%32 = load i32, i32* @MAP_ANONYMOUS
%33 = load i32, i32* @MAP_PRIVATE
%34 = or i32 %33, %32
%35 = tail call i8* @mmap(i8* %28, i32 4096, i32 %31, i32 %34, i32 -1, i32 0)
%36 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %3, i64 0, i64 %20
store i8* %35, i8** %36
%37 = load i8*, i8** @MAP_FAILED
%38 = icmp eq i8* %35, %37
br i1 %38, label %39, label %43
39: ; preds = %27
%40 = load i32, i32* @errno
%41 = tail call i32 @strerror(i32 %40)
%42 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 44, i32 %40, i32 %41)
br label %138
43: ; preds = %27
%44 = bitcast i8* %35 to i32*
%45 = trunc i64 %20 to i32
store i32 %45, i32* %44
%46 = add nuw nsw i64 %20, 1
%47 = icmp eq i64 %46, 4096
br i1 %47, label %48, label %19
48: ; preds = %43
%49 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %3, i64 0, i64 4095
%50 = load i8*, i8** %49
%51 = getelementptr i8, i8* %50, i64 8192
%52 = load i32, i32* @PROT_READ
%53 = load i32, i32* @PROT_WRITE
%54 = or i32 %53, %52
%55 = load i32, i32* @PROT_EXEC
%56 = or i32 %54, %55
%57 = load i32, i32* @MAP_ANONYMOUS
%58 = load i32, i32* @MAP_PRIVATE
%59 = or i32 %58, %57
%60 = load i32, i32* @MAP_GROWSDOWN
%61 = or i32 %59, %60
%62 = tail call i8* @mmap(i8* %51, i32 143360, i32 %56, i32 %61, i32 -1, i32 0)
%63 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %3, i64 0, i64 4096
store i8* %62, i8** %63
%64 = load i8*, i8** @MAP_FAILED
%65 = icmp eq i8* %62, %64
br i1 %65, label %66, label %70
66: ; preds = %48
%67 = load i32, i32* @errno
%68 = tail call i32 @strerror(i32 %67)
%69 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 56, i32 %67, i32 %68)
br label %138
70: ; preds = %48
%71 = bitcast i8* %62 to i32*
store i32 4096, i32* %71
%72 = getelementptr i8, i8* %62, i64 143360
%73 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %62, i8* %72)
%74 = load i32, i32* @PROT_READ
%75 = load i32, i32* @PROT_WRITE
%76 = or i32 %75, %74
%77 = load i32, i32* @MAP_ANONYMOUS
%78 = load i32, i32* @MAP_PRIVATE
%79 = or i32 %78, %77
%80 = load i32, i32* @MAP_GROWSDOWN
%81 = or i32 %79, %80
%82 = tail call i8* @mmap(i8* %72, i32 8192, i32 %76, i32 %81, i32 -1, i32 0)
%83 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %3, i64 0, i64 4097
store i8* %82, i8** %83
%84 = load i8*, i8** @MAP_FAILED
%85 = icmp eq i8* %82, %84
br i1 %85, label %86, label %90
86: ; preds = %70
%87 = load i32, i32* @errno
%88 = tail call i32 @strerror(i32 %87)
%89 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 68, i32 %87, i32 %88)
br label %138
90: ; preds = %70
%91 = bitcast i8* %82 to i32*
store i32 4096, i32* %91
%92 = getelementptr i8, i8* %82, i64 8192
%93 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %82, i8* %92)
%94 = tail call i32 (...) @test_daemon()
%95 = tail call i32 (...) @test_waitsig()
br label %96
96: ; preds = %133, %90
%97 = phi i64 [ 0, %90 ], [ %134, %133 ]
%98 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %3, i64 0, i64 %97
%99 = bitcast i8** %98 to i32**
%100 = load i32*, i32** %99
%101 = load i32, i32* %100
%102 = sext i32 %101 to i64
%103 = icmp eq i64 %97, %102
br i1 %103, label %109, label %104
104: ; preds = %125, %117, %109, %96
%105 = phi i64 [ %97, %96 ], [ %110, %109 ], [ %118, %117 ], [ %126, %125 ]
%106 = load i32, i32* @errno
%107 = tail call i32 @strerror(i32 %106)
%108 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 84, i64 %105, i32 %106, i32 %107)
br label %138
109: ; preds = %96
%110 = or i64 %97, 1
%111 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %3, i64 0, i64 %110
%112 = bitcast i8** %111 to i32**
%113 = load i32*, i32** %112
%114 = load i32, i32* %113
%115 = sext i32 %114 to i64
%116 = icmp eq i64 %110, %115
br i1 %116, label %117, label %104
117: ; preds = %109
%118 = or i64 %97, 2
%119 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %3, i64 0, i64 %118
%120 = bitcast i8** %119 to i32**
%121 = load i32*, i32** %120
%122 = load i32, i32* %121
%123 = sext i32 %122 to i64
%124 = icmp eq i64 %118, %123
br i1 %124, label %125, label %104
125: ; preds = %117
%126 = or i64 %97, 3
%127 = getelementptr inbounds [4098 x i8*], [4098 x i8*]* %3, i64 0, i64 %126
%128 = bitcast i8** %127 to i32**
%129 = load i32*, i32** %128
%130 = load i32, i32* %129
%131 = sext i32 %130 to i64
%132 = icmp eq i64 %126, %131
br i1 %132, label %133, label %104
133: ; preds = %125
%134 = add nuw nsw i64 %97, 4
%135 = icmp eq i64 %134, 4096
br i1 %135, label %136, label %96
136: ; preds = %133
%137 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %138
138: ; preds = %104, %136, %86, %66, %39, %13
%139 = phi i32 [ 1, %13 ], [ 1, %39 ], [ 1, %66 ], [ 1, %86 ], [ 1, %104 ], [ 0, %136 ]
ret i32 %139
}