#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 EINVAL;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int MAP_ANONYMOUS;
int MAP_PRIVATE;
int MAP_SHARED;
int PROT_READ;
int PROT_WRITE;
int errno;
void *mmap(int /*<<< orphan*/ *, int, int, int, int, int /*<<< orphan*/);
scalar_t__ munmap(unsigned long *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[], char *envp[]) {
  int i;
  int exitStatus = EXIT_SUCCESS;
  unsigned long *mappedA;
  printf("test1: ");
  if ((mmap(NULL, 4096 * 10, PROT_READ, MAP_ANONYMOUS, -1, 0) !=
       ((void *)-1)) &&
      (errno != EINVAL)) {
    printf("ERR: %i\n", errno);
    exitStatus = EXIT_FAILURE;
  } else {
    printf("OK\n");
  }
  printf("test2: ");
  if ((mmap(NULL, 4096 * 10, PROT_READ,
            MAP_ANONYMOUS | MAP_SHARED | MAP_PRIVATE, -1, 0) != ((void *)-1)) &&
      (errno != EINVAL)) {
    printf("ERR: %i\n", errno);
    exitStatus = EXIT_FAILURE;
  } else {
    printf("OK\n");
  }
  printf("test3: ");
  mappedA = mmap(NULL, 4096 * 15, PROT_READ | PROT_WRITE,
                 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
  if (mappedA == (unsigned long *)-1) {
    printf("ERR: %i\n", errno);
    exitStatus = EXIT_FAILURE;
  } else {
    printf("OK\n");
  }
  printf("test4: ");
  for (i = 0; i < 4096 * 15 / sizeof(unsigned long); i++) {
    mappedA[i] = i;
  }
  for (i = 0; i < 4096 * 15 / sizeof(unsigned long); i++) {
    if (mappedA[i] != i) {
      printf("ERR: %i\n", (int)mappedA[i]);
      exitStatus = EXIT_FAILURE;
    }
  }
  printf("OK\n");
  printf("test5: ");
  if (munmap(mappedA, 4096 * 15) != 0) {
    printf("ERR: %i\n", errno);
    exitStatus = EXIT_FAILURE;
  } else {
    printf("OK\n");
  }
  printf("test6: ");
  mappedA =
      mmap(NULL, 4096 * 15, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
  if (mappedA == (unsigned long *)-1) {
    printf("ERR: %i\n", errno);
    exitStatus = EXIT_FAILURE;
  } else {
    printf("OK\n");
  }
  printf("test7: ");
  for (i = 0; i < 4096 * 15 / sizeof(unsigned long); i++) {
    if (mappedA[i] != 0) {
      printf("ERR: %i\n", (int)mappedA[i]);
      exitStatus = EXIT_FAILURE;
    }
  }
  printf("OK\n");
  printf("test8: ");
  if (munmap(mappedA - 2048, 4096 * 20) != 0) {
    printf("ERR: %i\n", errno);
    exitStatus = EXIT_FAILURE;
  } else {
    printf("OK\n");
  }
  return exitStatus;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e57(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edx
mov    0x2e64(%rip),%rax
mov    (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xa000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    $0xffffffffffffffff,%rcx
cmp    %rcx,%rax
je     11dd <main+0xad>
mov    0x2e24(%rip),%rax
mov    (%rax),%eax
mov    0x2e03(%rip),%rcx
cmp    (%rcx),%eax
je     11dd <main+0xad>
mov    0x2e0c(%rip),%rax
mov    (%rax),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
jmp    11eb <main+0xbb>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edx
mov    0x2dcf(%rip),%rax
mov    (%rax),%ecx
mov    0x2dd6(%rip),%rax
or     (%rax),%ecx
mov    0x2d85(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xa000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    $0xffffffffffffffff,%rcx
cmp    %rcx,%rax
je     1284 <main+0x154>
mov    0x2d7d(%rip),%rax
mov    (%rax),%eax
mov    0x2d5c(%rip),%rcx
cmp    (%rcx),%eax
je     1284 <main+0x154>
mov    0x2d65(%rip),%rax
mov    (%rax),%esi
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d46(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
jmp    1292 <main+0x162>
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%edx
mov    0x2d08(%rip),%rax
or     (%rax),%edx
mov    0x2d1f(%rip),%rax
mov    (%rax),%ecx
mov    0x2cde(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xf000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x28(%rbp)
jne    1318 <main+0x1e8>
mov    0x2cd1(%rip),%rax
mov    (%rax),%esi
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2cb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
jmp    1326 <main+0x1f6>
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x1e00,%rax
jae    1369 <main+0x239>
movslq -0x1c(%rbp),%rdx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    133b <main+0x20b>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x1e00,%rax
jae    13d4 <main+0x2a4>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
cmp    %rcx,%rax
je     13c1 <main+0x291>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
lea    0xc5a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c04(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
jmp    13c6 <main+0x296>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1370 <main+0x240>
lea    0xc36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    $0xf000,%esi
call   1050 <munmap@plt>
cmp    $0x0,%rax
je     1430 <main+0x300>
mov    0x2bb9(%rip),%rax
mov    (%rax),%esi
lea    0xbf0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2b9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
jmp    143e <main+0x30e>
lea    0xbda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbf0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2ba5(%rip),%rax
mov    (%rax),%edx
mov    0x2b7c(%rip),%rax
mov    (%rax),%ecx
mov    0x2b3b(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xf000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x28(%rbp)
jne    14bb <main+0x38b>
mov    0x2b2e(%rip),%rax
mov    (%rax),%esi
lea    0xb65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2b0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
jmp    14c9 <main+0x399>
lea    0xb4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x1e00,%rax
jae    153c <main+0x40c>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1529 <main+0x3f9>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
lea    0xaf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2a9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
jmp    152e <main+0x3fe>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    14de <main+0x3ae>
lea    0xace(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xaf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
add    $0xffffffffffffc000,%rdi
mov    $0x14000,%esi
call   1050 <munmap@plt>
cmp    $0x0,%rax
je     159f <main+0x46f>
mov    0x2a4a(%rip),%rax
mov    (%rax),%esi
lea    0xa81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2a2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
jmp    15ad <main+0x47d>
lea    0xa6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e56(%rip),%rax
mov    (%rax),%r14d
lea    0xf54(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e8e(%rip),%r12
mov    (%r12),%edx
mov    0x2e63(%rip),%rbx
mov    (%rbx),%ecx
xor    %edi,%edi
mov    $0xa000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
cmp    $0xffffffffffffffff,%rax
je     11a6 <main+0x66>
mov    0x2e2f(%rip),%rax
mov    (%rax),%esi
mov    0x2e0e(%rip),%rax
cmp    (%rax),%esi
jne    11b4 <main+0x74>
lea    0xf4c(%rip),%rdi
call   1030 <puts@plt>
jmp    11cc <main+0x8c>
lea    0xefd(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%r14d
lea    0xeee(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%ecx
or     (%rbx),%ecx
mov    (%r12),%edx
mov    0x2db0(%rip),%rbp
or     0x0(%rbp),%ecx
xor    %edi,%edi
mov    $0xa000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
cmp    $0xffffffffffffffff,%rax
je     1222 <main+0xe2>
mov    0x2db3(%rip),%rax
mov    (%rax),%esi
mov    0x2d92(%rip),%rax
cmp    (%rax),%esi
jne    1230 <main+0xf0>
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
jmp    1248 <main+0x108>
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d7b(%rip),%rax
mov    (%rax),%r14d
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%edx
or     (%r12),%edx
mov    0x0(%rbp),%ecx
or     (%rbx),%ecx
xor    %edi,%edi
mov    $0xf000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%rbx
cmp    $0xffffffffffffffff,%rax
je     1294 <main+0x154>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
jmp    12b5 <main+0x175>
mov    0x2d2d(%rip),%rax
mov    (%rax),%esi
lea    0xe14(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d0e(%rip),%rax
mov    (%rax),%r14d
lea    0xe15(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movdqa 0xd35(%rip),%xmm0
mov    $0x12,%eax
movdqa 0xd37(%rip),%xmm8
movdqa 0xd3e(%rip),%xmm9
movdqa 0xd45(%rip),%xmm10
movdqa 0xd4c(%rip),%xmm11
movdqa 0xd53(%rip),%xmm12
movdqa 0xd5b(%rip),%xmm6
movdqa 0xd63(%rip),%xmm7
movdqa 0xd6b(%rip),%xmm1
movdqa 0xd73(%rip),%xmm2
movdqa 0xd7b(%rip),%xmm3
cs nopw 0x0(%rax,%rax,1)
nop
movdqa %xmm0,%xmm4
paddq  %xmm8,%xmm4
movdqu %xmm0,-0x90(%rbx,%rax,8)
ff ff
movdqu %xmm4,-0x80(%rbx,%rax,8)
movdqa %xmm0,%xmm4
paddq  %xmm9,%xmm4
movdqa %xmm0,%xmm5
paddq  %xmm10,%xmm5
movdqu %xmm4,-0x70(%rbx,%rax,8)
movdqu %xmm5,-0x60(%rbx,%rax,8)
movdqa %xmm0,%xmm4
paddq  %xmm11,%xmm4
movdqa %xmm0,%xmm5
paddq  %xmm12,%xmm5
movdqu %xmm4,-0x50(%rbx,%rax,8)
movdqu %xmm5,-0x40(%rbx,%rax,8)
movdqa %xmm0,%xmm4
paddq  %xmm6,%xmm4
movdqa %xmm0,%xmm5
paddq  %xmm7,%xmm5
movdqu %xmm4,-0x30(%rbx,%rax,8)
movdqu %xmm5,-0x20(%rbx,%rax,8)
movdqa %xmm0,%xmm4
paddq  %xmm1,%xmm4
movdqa %xmm0,%xmm5
paddq  %xmm2,%xmm5
movdqu %xmm4,-0x10(%rbx,%rax,8)
movdqu %xmm5,(%rbx,%rax,8)
paddq  %xmm3,%xmm0
add    $0x14,%rax
cmp    $0x1e12,%rax
jne    1330 <main+0x1f0>
lea    0xce2(%rip),%rbp
mov    0x2be3(%rip),%r13
xor    %r15d,%r15d
jmp    13fd <main+0x2bd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r15
cmp    $0x1e00,%r15
je     1416 <main+0x2d6>
mov    (%rbx,%r15,8),%rsi
cmp    %rsi,%r15
je     13f0 <main+0x2b0>
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%r14d
jmp    13f0 <main+0x2b0>
lea    0xcdc(%rip),%rdi
call   1030 <puts@plt>
lea    0xcb0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0xf000,%esi
call   1060 <munmap@plt>
test   %rax,%rax
je     145f <main+0x31f>
mov    0x2b7f(%rip),%rax
mov    (%rax),%esi
lea    0xc66(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%r14d
jmp    146b <main+0x32b>
lea    0xc93(%rip),%rdi
call   1030 <puts@plt>
mov    0x2b66(%rip),%rbx
mov    0x2b27(%rip),%rbp
lea    0xc61(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r12),%edx
mov    0x0(%rbp),%ecx
or     (%rbx),%ecx
xor    %edi,%edi
mov    $0xf000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%rbx
cmp    $0xffffffffffffffff,%rax
je     14bc <main+0x37c>
lea    0xc44(%rip),%rdi
call   1030 <puts@plt>
jmp    14d7 <main+0x397>
mov    0x2b05(%rip),%rax
mov    (%rax),%esi
lea    0xbec(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%r14d
lea    0xc0b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbcc(%rip),%r15
xor    %ebp,%ebp
jmp    14fd <main+0x3bd>
add    $0x1,%rbp
cmp    $0x1e00,%rbp
je     1516 <main+0x3d6>
mov    (%rbx,%rbp,8),%rsi
test   %rsi,%rsi
je     14f0 <main+0x3b0>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%r14d
jmp    14f0 <main+0x3b0>
lea    0xbdc(%rip),%rdi
call   1030 <puts@plt>
lea    0xbc8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffffffffc000,%rbx
mov    %rbx,%rdi
mov    $0x14000,%esi
call   1060 <munmap@plt>
test   %rax,%rax
je     1566 <main+0x426>
mov    0x2a78(%rip),%rax
mov    (%rax),%esi
lea    0xb5f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%r14d
jmp    1572 <main+0x432>
lea    0xb8c(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@.str = [8 x i8] c"test1: \00"
@PROT_READ = global i32 0
@MAP_ANONYMOUS = global i32 0
@errno = global i32 0
@EINVAL = global i32 0
@.str.1 = [9 x i8] c"ERR: %i\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [4 x i8] c"OK\0A\00"
@.str.3 = [8 x i8] c"test2: \00"
@MAP_SHARED = global i32 0
@MAP_PRIVATE = global i32 0
@.str.4 = [8 x i8] c"test3: \00"
@PROT_WRITE = global i32 0
@.str.5 = [8 x i8] c"test4: \00"
@.str.6 = [8 x i8] c"test5: \00"
@.str.7 = [8 x i8] c"test6: \00"
@.str.8 = [8 x i8] c"test7: \00"
@.str.9 = [8 x i8] c"test8: \00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64*
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%11 = load i32, i32* @EXIT_SUCCESS
store i32 %11, i32* %9
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @PROT_READ
%14 = load i32, i32* @MAP_ANONYMOUS
%15 = call i8* @mmap(i32* null, i32 40960, i32 %13, i32 %14, i32 -1, i32 0)
%16 = icmp ne i8* %15, inttoptr (i64 -1 to i8*)
br i1 %16, label %17, label %25
17: ; preds = %3
%18 = load i32, i32* @errno
%19 = load i32, i32* @EINVAL
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32, i32* @errno
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = load i32, i32* @EXIT_FAILURE
store i32 %24, i32* %9
br label %27
25: ; preds = %17, %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %21
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%29 = load i32, i32* @PROT_READ
%30 = load i32, i32* @MAP_ANONYMOUS
%31 = load i32, i32* @MAP_SHARED
%32 = or i32 %30, %31
%33 = load i32, i32* @MAP_PRIVATE
%34 = or i32 %32, %33
%35 = call i8* @mmap(i32* null, i32 40960, i32 %29, i32 %34, i32 -1, i32 0)
%36 = icmp ne i8* %35, inttoptr (i64 -1 to i8*)
br i1 %36, label %37, label %45
37: ; preds = %27
%38 = load i32, i32* @errno
%39 = load i32, i32* @EINVAL
%40 = icmp ne i32 %38, %39
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i32, i32* @errno
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = load i32, i32* @EXIT_FAILURE
store i32 %44, i32* %9
br label %47
45: ; preds = %37, %27
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45, %41
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%49 = load i32, i32* @PROT_READ
%50 = load i32, i32* @PROT_WRITE
%51 = or i32 %49, %50
%52 = load i32, i32* @MAP_ANONYMOUS
%53 = load i32, i32* @MAP_PRIVATE
%54 = or i32 %52, %53
%55 = call i8* @mmap(i32* null, i32 61440, i32 %51, i32 %54, i32 -1, i32 0)
%56 = bitcast i8* %55 to i64*
store i64* %56, i64** %10
%57 = load i64*, i64** %10
%58 = icmp eq i64* %57, inttoptr (i64 -1 to i64*)
br i1 %58, label %59, label %63
59: ; preds = %47
%60 = load i32, i32* @errno
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %60)
%62 = load i32, i32* @EXIT_FAILURE
store i32 %62, i32* %9
br label %65
63: ; preds = %47
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %65
65: ; preds = %63, %59
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %8
br label %67
67: ; preds = %78, %65
%68 = load i32, i32* %8
%69 = sext i32 %68 to i64
%70 = icmp ult i64 %69, 7680
br i1 %70, label %71, label %81
71: ; preds = %67
%72 = load i32, i32* %8
%73 = sext i32 %72 to i64
%74 = load i64*, i64** %10
%75 = load i32, i32* %8
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i64, i64* %74, i64 %76
store i64 %73, i64* %77
br label %78
78: ; preds = %71
%79 = load i32, i32* %8
%80 = add nsw i32 %79, 1
store i32 %80, i32* %8
br label %67
81: ; preds = %67
store i32 0, i32* %8
br label %82
82: ; preds = %105, %81
%83 = load i32, i32* %8
%84 = sext i32 %83 to i64
%85 = icmp ult i64 %84, 7680
br i1 %85, label %86, label %108
86: ; preds = %82
%87 = load i64*, i64** %10
%88 = load i32, i32* %8
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i64, i64* %87, i64 %89
%91 = load i64, i64* %90
%92 = load i32, i32* %8
%93 = sext i32 %92 to i64
%94 = icmp ne i64 %91, %93
br i1 %94, label %95, label %104
95: ; preds = %86
%96 = load i64*, i64** %10
%97 = load i32, i32* %8
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i64, i64* %96, i64 %98
%100 = load i64, i64* %99
%101 = trunc i64 %100 to i32
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %101)
%103 = load i32, i32* @EXIT_FAILURE
store i32 %103, i32* %9
br label %104
104: ; preds = %95, %86
br label %105
105: ; preds = %104
%106 = load i32, i32* %8
%107 = add nsw i32 %106, 1
store i32 %107, i32* %8
br label %82
108: ; preds = %82
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%111 = load i64*, i64** %10
%112 = call i64 @munmap(i64* %111, i32 61440)
%113 = icmp ne i64 %112, 0
br i1 %113, label %114, label %118
114: ; preds = %108
%115 = load i32, i32* @errno
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %115)
%117 = load i32, i32* @EXIT_FAILURE
store i32 %117, i32* %9
br label %120
118: ; preds = %108
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %120
120: ; preds = %118, %114
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%122 = load i32, i32* @PROT_READ
%123 = load i32, i32* @MAP_ANONYMOUS
%124 = load i32, i32* @MAP_PRIVATE
%125 = or i32 %123, %124
%126 = call i8* @mmap(i32* null, i32 61440, i32 %122, i32 %125, i32 -1, i32 0)
%127 = bitcast i8* %126 to i64*
store i64* %127, i64** %10
%128 = load i64*, i64** %10
%129 = icmp eq i64* %128, inttoptr (i64 -1 to i64*)
br i1 %129, label %130, label %134
130: ; preds = %120
%131 = load i32, i32* @errno
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %131)
%133 = load i32, i32* @EXIT_FAILURE
store i32 %133, i32* %9
br label %136
134: ; preds = %120
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %136
136: ; preds = %134, %130
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %8
br label %138
138: ; preds = %159, %136
%139 = load i32, i32* %8
%140 = sext i32 %139 to i64
%141 = icmp ult i64 %140, 7680
br i1 %141, label %142, label %162
142: ; preds = %138
%143 = load i64*, i64** %10
%144 = load i32, i32* %8
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i64, i64* %143, i64 %145
%147 = load i64, i64* %146
%148 = icmp ne i64 %147, 0
br i1 %148, label %149, label %158
149: ; preds = %142
%150 = load i64*, i64** %10
%151 = load i32, i32* %8
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i64, i64* %150, i64 %152
%154 = load i64, i64* %153
%155 = trunc i64 %154 to i32
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %155)
%157 = load i32, i32* @EXIT_FAILURE
store i32 %157, i32* %9
br label %158
158: ; preds = %149, %142
br label %159
159: ; preds = %158
%160 = load i32, i32* %8
%161 = add nsw i32 %160, 1
store i32 %161, i32* %8
br label %138
162: ; preds = %138
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%165 = load i64*, i64** %10
%166 = getelementptr inbounds i64, i64* %165, i64 -2048
%167 = call i64 @munmap(i64* %166, i32 81920)
%168 = icmp ne i64 %167, 0
br i1 %168, label %169, label %173
169: ; preds = %162
%170 = load i32, i32* @errno
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %170)
%172 = load i32, i32* @EXIT_FAILURE
store i32 %172, i32* %9
br label %175
173: ; preds = %162
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %175
175: ; preds = %173, %169
%176 = load i32, i32* %9
ret i32 %176
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@.str = [8 x i8] c"test1: \00"
@PROT_READ = global i32 0
@MAP_ANONYMOUS = global i32 0
@errno = global i32 0
@EINVAL = global i32 0
@.str.1 = [9 x i8] c"ERR: %i\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [8 x i8] c"test2: \00"
@MAP_SHARED = global i32 0
@MAP_PRIVATE = global i32 0
@.str.4 = [8 x i8] c"test3: \00"
@PROT_WRITE = global i32 0
@.str.5 = [8 x i8] c"test4: \00"
@.str.6 = [8 x i8] c"test5: \00"
@.str.7 = [8 x i8] c"test6: \00"
@.str.8 = [8 x i8] c"test7: \00"
@.str.9 = [8 x i8] c"test8: \00"
@str.16 = [3 x i8] c"OK\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = load i32, i32* @EXIT_SUCCESS
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @PROT_READ
%7 = load i32, i32* @MAP_ANONYMOUS
%8 = tail call i8* @mmap(i32* null, i32 40960, i32 %6, i32 %7, i32 -1, i32 0)
%9 = icmp eq i8* %8, inttoptr (i64 -1 to i8*)
br i1 %9, label %17, label %10
10: ; preds = %3
%11 = load i32, i32* @errno
%12 = load i32, i32* @EINVAL
%13 = icmp eq i32 %11, %12
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%16 = load i32, i32* @EXIT_FAILURE
br label %19
17: ; preds = %10, %3
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.16, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = phi i32 [ %16, %14 ], [ %4, %17 ]
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* @PROT_READ
%23 = load i32, i32* @MAP_ANONYMOUS
%24 = load i32, i32* @MAP_SHARED
%25 = or i32 %24, %23
%26 = load i32, i32* @MAP_PRIVATE
%27 = or i32 %25, %26
%28 = tail call i8* @mmap(i32* null, i32 40960, i32 %22, i32 %27, i32 -1, i32 0)
%29 = icmp eq i8* %28, inttoptr (i64 -1 to i8*)
br i1 %29, label %37, label %30
30: ; preds = %19
%31 = load i32, i32* @errno
%32 = load i32, i32* @EINVAL
%33 = icmp eq i32 %31, %32
br i1 %33, label %37, label %34
34: ; preds = %30
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%36 = load i32, i32* @EXIT_FAILURE
br label %39
37: ; preds = %30, %19
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.16, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = phi i32 [ %36, %34 ], [ %20, %37 ]
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%42 = load i32, i32* @PROT_READ
%43 = load i32, i32* @PROT_WRITE
%44 = or i32 %43, %42
%45 = load i32, i32* @MAP_ANONYMOUS
%46 = load i32, i32* @MAP_PRIVATE
%47 = or i32 %46, %45
%48 = tail call i8* @mmap(i32* null, i32 61440, i32 %44, i32 %47, i32 -1, i32 0)
%49 = bitcast i8* %48 to i64*
%50 = icmp eq i8* %48, inttoptr (i64 -1 to i8*)
br i1 %50, label %51, label %55
51: ; preds = %39
%52 = load i32, i32* @errno
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = load i32, i32* @EXIT_FAILURE
br label %57
55: ; preds = %39
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.16, i64 0, i64 0))
br label %57
57: ; preds = %55, %51
%58 = phi i32 [ %54, %51 ], [ %40, %55 ]
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %60
60: ; preds = %60, %57
%61 = phi i64 [ 0, %57 ], [ %96, %60 ]
%62 = phi <2 x i64> [ <i64 0, i64 1>, %57 ], [ %97, %60 ]
%63 = add <2 x i64> %62, <i64 2, i64 2>
%64 = getelementptr inbounds i64, i64* %49, i64 %61
%65 = bitcast i64* %64 to <2 x i64>*
store <2 x i64> %62, <2 x i64>* %65
%66 = getelementptr inbounds i64, i64* %64, i64 2
%67 = bitcast i64* %66 to <2 x i64>*
store <2 x i64> %63, <2 x i64>* %67
%68 = add nuw nsw i64 %61, 4
%69 = add <2 x i64> %62, <i64 4, i64 4>
%70 = add <2 x i64> %62, <i64 6, i64 6>
%71 = getelementptr inbounds i64, i64* %49, i64 %68
%72 = bitcast i64* %71 to <2 x i64>*
store <2 x i64> %69, <2 x i64>* %72
%73 = getelementptr inbounds i64, i64* %71, i64 2
%74 = bitcast i64* %73 to <2 x i64>*
store <2 x i64> %70, <2 x i64>* %74
%75 = add nuw nsw i64 %61, 8
%76 = add <2 x i64> %62, <i64 8, i64 8>
%77 = add <2 x i64> %62, <i64 10, i64 10>
%78 = getelementptr inbounds i64, i64* %49, i64 %75
%79 = bitcast i64* %78 to <2 x i64>*
store <2 x i64> %76, <2 x i64>* %79
%80 = getelementptr inbounds i64, i64* %78, i64 2
%81 = bitcast i64* %80 to <2 x i64>*
store <2 x i64> %77, <2 x i64>* %81
%82 = add nuw nsw i64 %61, 12
%83 = add <2 x i64> %62, <i64 12, i64 12>
%84 = add <2 x i64> %62, <i64 14, i64 14>
%85 = getelementptr inbounds i64, i64* %49, i64 %82
%86 = bitcast i64* %85 to <2 x i64>*
store <2 x i64> %83, <2 x i64>* %86
%87 = getelementptr inbounds i64, i64* %85, i64 2
%88 = bitcast i64* %87 to <2 x i64>*
store <2 x i64> %84, <2 x i64>* %88
%89 = add nuw nsw i64 %61, 16
%90 = add <2 x i64> %62, <i64 16, i64 16>
%91 = add <2 x i64> %62, <i64 18, i64 18>
%92 = getelementptr inbounds i64, i64* %49, i64 %89
%93 = bitcast i64* %92 to <2 x i64>*
store <2 x i64> %90, <2 x i64>* %93
%94 = getelementptr inbounds i64, i64* %92, i64 2
%95 = bitcast i64* %94 to <2 x i64>*
store <2 x i64> %91, <2 x i64>* %95
%96 = add nuw nsw i64 %61, 20
%97 = add <2 x i64> %62, <i64 20, i64 20>
%98 = icmp eq i64 %96, 7680
br i1 %98, label %99, label %60
99: ; preds = %60, %109
%100 = phi i64 [ %111, %109 ], [ 0, %60 ]
%101 = phi i32 [ %110, %109 ], [ %58, %60 ]
%102 = getelementptr inbounds i64, i64* %49, i64 %100
%103 = load i64, i64* %102
%104 = icmp eq i64 %103, %100
br i1 %104, label %109, label %105
105: ; preds = %99
%106 = trunc i64 %103 to i32
%107 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %106)
%108 = load i32, i32* @EXIT_FAILURE
br label %109
109: ; preds = %99, %105
%110 = phi i32 [ %108, %105 ], [ %101, %99 ]
%111 = add nuw nsw i64 %100, 1
%112 = icmp eq i64 %111, 7680
br i1 %112, label %113, label %99
113: ; preds = %109
%114 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.16, i64 0, i64 0))
%115 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%116 = tail call i64 @munmap(i64* %49, i32 61440)
%117 = icmp eq i64 %116, 0
br i1 %117, label %122, label %118
118: ; preds = %113
%119 = load i32, i32* @errno
%120 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %119)
%121 = load i32, i32* @EXIT_FAILURE
br label %124
122: ; preds = %113
%123 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.16, i64 0, i64 0))
br label %124
124: ; preds = %122, %118
%125 = phi i32 [ %121, %118 ], [ %110, %122 ]
%126 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%127 = load i32, i32* @PROT_READ
%128 = load i32, i32* @MAP_ANONYMOUS
%129 = load i32, i32* @MAP_PRIVATE
%130 = or i32 %129, %128
%131 = tail call i8* @mmap(i32* null, i32 61440, i32 %127, i32 %130, i32 -1, i32 0)
%132 = bitcast i8* %131 to i64*
%133 = icmp eq i8* %131, inttoptr (i64 -1 to i8*)
br i1 %133, label %134, label %138
134: ; preds = %124
%135 = load i32, i32* @errno
%136 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %135)
%137 = load i32, i32* @EXIT_FAILURE
br label %140
138: ; preds = %124
%139 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.16, i64 0, i64 0))
br label %140
140: ; preds = %138, %134
%141 = phi i32 [ %137, %134 ], [ %125, %138 ]
%142 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %143
143: ; preds = %140, %153
%144 = phi i64 [ 0, %140 ], [ %155, %153 ]
%145 = phi i32 [ %141, %140 ], [ %154, %153 ]
%146 = getelementptr inbounds i64, i64* %132, i64 %144
%147 = load i64, i64* %146
%148 = icmp eq i64 %147, 0
br i1 %148, label %153, label %149
149: ; preds = %143
%150 = trunc i64 %147 to i32
%151 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %150)
%152 = load i32, i32* @EXIT_FAILURE
br label %153
153: ; preds = %143, %149
%154 = phi i32 [ %152, %149 ], [ %145, %143 ]
%155 = add nuw nsw i64 %144, 1
%156 = icmp eq i64 %155, 7680
br i1 %156, label %157, label %143
157: ; preds = %153
%158 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.16, i64 0, i64 0))
%159 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%160 = getelementptr inbounds i8, i8* %131, i64 -16384
%161 = bitcast i8* %160 to i64*
%162 = tail call i64 @munmap(i64* %161, i32 81920)
%163 = icmp eq i64 %162, 0
br i1 %163, label %168, label %164
164: ; preds = %157
%165 = load i32, i32* @errno
%166 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %165)
%167 = load i32, i32* @EXIT_FAILURE
br label %170
168: ; preds = %157
%169 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.16, i64 0, i64 0))
br label %170
170: ; preds = %168, %164
%171 = phi i32 [ %167, %164 ], [ %154, %168 ]
ret i32 %171
}