#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*/ MAP_SHARED;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ O_RDWR;
int PROT_EXEC;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SYS_memfd_create;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
void *mmap(int /*<<< orphan*/, int, int, int /*<<< orphan*/, int,
           int /*<<< orphan*/);
int /*<<< orphan*/ mprotect(void *, int, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int syscall(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "TESTING ERROR: memwrexe insufficient params\n");
    usage();
    return 1;
  }
  if (strcmp(argv[1], "mmap") == 0) {
    int fd = open("memwrexe.c", O_RDONLY);
    if (fd == -1) {
      fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n");
      return 1;
    }
    int size = lseek(fd, 0, SEEK_END);
    if (size == -1) {
      fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n");
      return 1;
    }
    void *p =
        mmap(0, size, PROT_WRITE | PROT_READ | PROT_EXEC, MAP_SHARED, fd, 0);
    printf("mmap successful\n");
    sleep(100);
    return 0;
  } else if (strcmp(argv[1], "mprotect") == 0) {
    int fd = open("memwrexe.c", O_RDWR);
    if (fd == -1) {
      fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n");
      return 1;
    }
    int size = lseek(fd, 0, SEEK_END);
    if (size == -1) {
      fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n");
      return 1;
    }
    void *p = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);
    if (!p) {
      fprintf(stderr, "TESTING ERROR: cannot map file for mprotect test\n");
      return 1;
    }
    mprotect(p, size, PROT_READ | PROT_WRITE | PROT_EXEC);
    printf("mprotect successful\n");
    sleep(100);
    return 0;
  } else if (strcmp(argv[1], "memfd_create") == 0) {
    int fd = syscall(SYS_memfd_create, "memfd_create", 0);
    if (fd == -1) {
      fprintf(stderr, "TESTING ERROR: cannot run memfd_create test\n");
      return 1;
    }
    printf("memfd_create successful\n");
    sleep(100);
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11e8 <main+0x48>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
lea    0xe30(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1090 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b4 <main+0x314>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe36(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12e6 <main+0x146>
mov    0x2dbb(%rip),%rax
mov    (%rax),%esi
lea    0xe1c(%rip),%rdi
call   10b0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1249 <main+0xa9>
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
lea    0xe05(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b4 <main+0x314>
mov    -0x14(%rbp),%edi
mov    0x2d7d(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    128a <main+0xea>
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
lea    0xdc4(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b4 <main+0x314>
mov    -0x18(%rbp),%esi
mov    0x2d0c(%rip),%rax
mov    (%rax),%edx
mov    0x2d5b(%rip),%rax
or     (%rax),%edx
mov    0x2d1a(%rip),%rax
or     (%rax),%edx
mov    0x2d39(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%edi
call   1030 <mmap@plt>
mov    %rax,-0x20(%rbp)
lea    0xda7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x64,%edi
call   10c0 <sleep@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b4 <main+0x314>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd8e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1425 <main+0x285>
mov    0x2ccd(%rip),%rax
mov    (%rax),%esi
lea    0xd1e(%rip),%rdi
call   10b0 <open@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    1347 <main+0x1a7>
mov    0x2c7b(%rip),%rax
mov    (%rax),%edi
lea    0xd07(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b4 <main+0x314>
mov    -0x24(%rbp),%edi
mov    0x2c7f(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    1388 <main+0x1e8>
mov    0x2c3a(%rip),%rax
mov    (%rax),%edi
lea    0xcc6(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b4 <main+0x314>
mov    -0x28(%rbp),%esi
mov    0x2c66(%rip),%rax
mov    (%rax),%edx
mov    0x2c4d(%rip),%rax
mov    (%rax),%ecx
mov    -0x24(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%edi
call   1030 <mmap@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    13dc <main+0x23c>
mov    0x2be6(%rip),%rax
mov    (%rax),%edi
lea    0xcc1(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b4 <main+0x314>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    0x2c0e(%rip),%rax
mov    (%rax),%edx
mov    0x2bad(%rip),%rax
or     (%rax),%edx
mov    0x2bc4(%rip),%rax
or     (%rax),%edx
call   10a0 <mprotect@plt>
lea    0xcb4(%rip),%rdi
call   1040 <printf@plt>
mov    $0x64,%edi
call   10c0 <sleep@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b4 <main+0x314>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc9f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    14aa <main+0x30a>
mov    0x2b66(%rip),%rax
mov    (%rax),%edi
lea    0xc80(%rip),%rsi
xor    %edx,%edx
call   1080 <syscall@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    1488 <main+0x2e8>
mov    0x2b3a(%rip),%rax
mov    (%rax),%edi
lea    0xc69(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b4 <main+0x314>
lea    0xc7e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x64,%edi
call   10c0 <sleep@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b4 <main+0x314>
jmp    14af <main+0x30f>
jmp    14b4 <main+0x314>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    122a <main+0x8a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe73(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     124b <main+0xab>
mov    0x8(%rbx),%rdi
lea    0xe9f(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12c7 <main+0x127>
mov    0x8(%rbx),%rdi
lea    0xec1(%rip),%rsi
call   1060 <strcmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    1379 <main+0x1d9>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
lea    0xea1(%rip),%rsi
xor    %ebx,%ebx
xor    %edx,%edx
call   1080 <syscall@plt>
cmp    $0xffffffff,%eax
je     1386 <main+0x1e6>
lea    0xec2(%rip),%rdi
jmp    134e <main+0x1ae>
mov    0x2d77(%rip),%rax
mov    (%rax),%edi
lea    0xdc6(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1090 <usage@plt>
jmp    1374 <main+0x1d4>
mov    0x2d76(%rip),%rax
mov    (%rax),%esi
lea    0xdd7(%rip),%rdi
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
je     135f <main+0x1bf>
mov    %eax,%ebp
mov    0x2d5e(%rip),%rax
mov    (%rax),%edx
xor    %ebx,%ebx
mov    %ebp,%edi
xor    %esi,%esi
call   1050 <lseek@plt>
cmp    $0xffffffff,%eax
je     135f <main+0x1bf>
mov    0x2d11(%rip),%rcx
mov    0x2d62(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2d1f(%rip),%rcx
or     (%rcx),%edx
mov    0x2d3e(%rip),%rcx
mov    (%rcx),%ecx
xor    %edi,%edi
mov    %eax,%esi
mov    %ebp,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
lea    0xe51(%rip),%rdi
jmp    134e <main+0x1ae>
mov    0x2d0a(%rip),%rax
mov    (%rax),%esi
lea    0xd5b(%rip),%rdi
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
je     135f <main+0x1bf>
mov    %eax,%ebp
mov    0x2ce6(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
xor    %esi,%esi
call   1050 <lseek@plt>
cmp    $0xffffffff,%eax
je     135f <main+0x1bf>
mov    %eax,%r14d
mov    0x2cf4(%rip),%r15
mov    (%r15),%edx
mov    0x2cda(%rip),%rax
mov    (%rax),%ecx
xor    %ebx,%ebx
xor    %edi,%edi
mov    %r14d,%esi
mov    %ebp,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
test   %rax,%rax
je     1398 <main+0x1f8>
mov    0x2c72(%rip),%rcx
mov    (%rcx),%edx
or     (%r15),%edx
mov    0x2c86(%rip),%rcx
or     (%rcx),%edx
mov    %rax,%rdi
mov    %r14d,%esi
call   10a0 <mprotect@plt>
lea    0xdb1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x64,%edi
call   10c0 <sleep@plt>
jmp    1379 <main+0x1d9>
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
lea    0xcce(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c1b(%rip),%rax
mov    (%rax),%edi
lea    0xd24(%rip),%rsi
jmp    136f <main+0x1cf>
mov    0x2c09(%rip),%rax
mov    (%rax),%edi
lea    0xcd3(%rip),%rsi
jmp    136f <main+0x1cf>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"TESTING ERROR: memwrexe insufficient params\0A\00"
@.str.1 = [5 x i8] c"mmap\00"
@.str.2 = [11 x i8] c"memwrexe.c\00"
@O_RDONLY = global i32 0
@.str.3 = [53 x i8] c"TESTING ERROR: file not found, cannot run mmap test\0A\00"
@SEEK_END = global i32 0
@PROT_WRITE = global i32 0
@PROT_READ = global i32 0
@PROT_EXEC = global i32 0
@MAP_SHARED = global i32 0
@.str.4 = [17 x i8] c"mmap successful\0A\00"
@.str.5 = [9 x i8] c"mprotect\00"
@O_RDWR = global i32 0
@.str.6 = [50 x i8] c"TESTING ERROR: cannot map file for mprotect test\0A\00"
@.str.7 = [21 x i8] c"mprotect successful\0A\00"
@.str.8 = [13 x i8] c"memfd_create\00"
@SYS_memfd_create = global i32 0
@.str.9 = [45 x i8] c"TESTING ERROR: cannot run memfd_create test\0A\00"
@.str.10 = [25 x i8] c"memfd_create successful\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 i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%18 = call i32 (...) @usage()
store i32 1, i32* %3
br label %118
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %54
25: ; preds = %19
%26 = load i32, i32* @O_RDONLY
%27 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %26)
store i32 %27, i32* %6
%28 = load i32, i32* %6
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %118
33: ; preds = %25
%34 = load i32, i32* %6
%35 = load i32, i32* @SEEK_END
%36 = call i32 @lseek(i32 %34, i32 0, i32 %35)
store i32 %36, i32* %7
%37 = load i32, i32* %7
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %42
39: ; preds = %33
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %118
42: ; preds = %33
%43 = load i32, i32* %7
%44 = load i32, i32* @PROT_WRITE
%45 = load i32, i32* @PROT_READ
%46 = or i32 %44, %45
%47 = load i32, i32* @PROT_EXEC
%48 = or i32 %46, %47
%49 = load i32, i32* @MAP_SHARED
%50 = load i32, i32* %6
%51 = call i8* @mmap(i32 0, i32 %43, i32 %48, i32 %49, i32 %50, i32 0)
store i8* %51, i8** %8
%52 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%53 = call i32 @sleep(i32 100)
store i32 0, i32* %3
br label %118
54: ; preds = %19
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 1
%57 = load i8*, i8** %56
%58 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %99
60: ; preds = %54
%61 = load i32, i32* @O_RDWR
%62 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %61)
store i32 %62, i32* %9
%63 = load i32, i32* %9
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %68
65: ; preds = %60
%66 = load i32, i32* @stderr
%67 = call i32 @fprintf(i32 %66, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %118
68: ; preds = %60
%69 = load i32, i32* %9
%70 = load i32, i32* @SEEK_END
%71 = call i32 @lseek(i32 %69, i32 0, i32 %70)
store i32 %71, i32* %10
%72 = load i32, i32* %10
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %77
74: ; preds = %68
%75 = load i32, i32* @stderr
%76 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %118
77: ; preds = %68
%78 = load i32, i32* %10
%79 = load i32, i32* @PROT_READ
%80 = load i32, i32* @MAP_SHARED
%81 = load i32, i32* %9
%82 = call i8* @mmap(i32 0, i32 %78, i32 %79, i32 %80, i32 %81, i32 0)
store i8* %82, i8** %11
%83 = load i8*, i8** %11
%84 = icmp ne i8* %83, null
br i1 %84, label %88, label %85
85: ; preds = %77
%86 = load i32, i32* @stderr
%87 = call i32 @fprintf(i32 %86, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %118
88: ; preds = %77
%89 = load i8*, i8** %11
%90 = load i32, i32* %10
%91 = load i32, i32* @PROT_READ
%92 = load i32, i32* @PROT_WRITE
%93 = or i32 %91, %92
%94 = load i32, i32* @PROT_EXEC
%95 = or i32 %93, %94
%96 = call i32 @mprotect(i8* %89, i32 %90, i32 %95)
%97 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%98 = call i32 @sleep(i32 100)
store i32 0, i32* %3
br label %118
99: ; preds = %54
%100 = load i8**, i8*** %5
%101 = getelementptr inbounds i8*, i8** %100, i64 1
%102 = load i8*, i8** %101
%103 = call i64 @strcmp(i8* %102, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %116
105: ; preds = %99
%106 = load i32, i32* @SYS_memfd_create
%107 = call i32 @syscall(i32 %106, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 0)
store i32 %107, i32* %12
%108 = load i32, i32* %12
%109 = icmp eq i32 %108, -1
br i1 %109, label %110, label %113
110: ; preds = %105
%111 = load i32, i32* @stderr
%112 = call i32 @fprintf(i32 %111, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %3
br label %118
113: ; preds = %105
%114 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%115 = call i32 @sleep(i32 100)
store i32 0, i32* %3
br label %118
116: ; preds = %99
br label %117
117: ; preds = %116
br label %118
118: ; preds = %15, %30, %39, %42, %65, %74, %85, %88, %110, %113, %117
%119 = load i32, i32* %3
ret i32 %119
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"TESTING ERROR: memwrexe insufficient params\0A\00"
@.str.1 = [5 x i8] c"mmap\00"
@.str.2 = [11 x i8] c"memwrexe.c\00"
@O_RDONLY = global i32 0
@.str.3 = [53 x i8] c"TESTING ERROR: file not found, cannot run mmap test\0A\00"
@SEEK_END = global i32 0
@PROT_WRITE = global i32 0
@PROT_READ = global i32 0
@PROT_EXEC = global i32 0
@MAP_SHARED = global i32 0
@.str.5 = [9 x i8] c"mprotect\00"
@O_RDWR = global i32 0
@.str.6 = [50 x i8] c"TESTING ERROR: cannot map file for mprotect test\0A\00"
@.str.8 = [13 x i8] c"memfd_create\00"
@SYS_memfd_create = global i32 0
@.str.9 = [45 x i8] c"TESTING ERROR: cannot run memfd_create test\0A\00"
@str = [24 x i8] c"memfd_create successful\00"
@str.11 = [20 x i8] c"mprotect successful\00"
@str.12 = [16 x i8] c"mmap successful\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @usage()
br label %86
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %37
13: ; preds = %8
%14 = load i32, i32* @O_RDONLY
%15 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
br label %86
20: ; preds = %13
%21 = load i32, i32* @SEEK_END
%22 = tail call i32 @lseek(i32 %15, i32 0, i32 %21)
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
br label %86
27: ; preds = %20
%28 = load i32, i32* @PROT_WRITE
%29 = load i32, i32* @PROT_READ
%30 = or i32 %29, %28
%31 = load i32, i32* @PROT_EXEC
%32 = or i32 %30, %31
%33 = load i32, i32* @MAP_SHARED
%34 = tail call i8* @mmap(i32 0, i32 %22, i32 %32, i32 %33, i32 %15, i32 0)
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.12, i64 0, i64 0))
%36 = tail call i32 @sleep(i32 100)
br label %86
37: ; preds = %8
%38 = load i8*, i8** %9
%39 = tail call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %72
41: ; preds = %37
%42 = load i32, i32* @O_RDWR
%43 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %42)
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = load i32, i32* @stderr
%47 = tail call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
br label %86
48: ; preds = %41
%49 = load i32, i32* @SEEK_END
%50 = tail call i32 @lseek(i32 %43, i32 0, i32 %49)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i32, i32* @stderr
%54 = tail call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
br label %86
55: ; preds = %48
%56 = load i32, i32* @PROT_READ
%57 = load i32, i32* @MAP_SHARED
%58 = tail call i8* @mmap(i32 0, i32 %50, i32 %56, i32 %57, i32 %43, i32 0)
%59 = icmp eq i8* %58, null
br i1 %59, label %60, label %63
60: ; preds = %55
%61 = load i32, i32* @stderr
%62 = tail call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
br label %86
63: ; preds = %55
%64 = load i32, i32* @PROT_READ
%65 = load i32, i32* @PROT_WRITE
%66 = or i32 %65, %64
%67 = load i32, i32* @PROT_EXEC
%68 = or i32 %66, %67
%69 = tail call i32 @mprotect(i8* %58, i32 %50, i32 %68)
%70 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.11, i64 0, i64 0))
%71 = tail call i32 @sleep(i32 100)
br label %86
72: ; preds = %37
%73 = load i8*, i8** %9
%74 = tail call i64 @strcmp(i8* %73, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %86
76: ; preds = %72
%77 = load i32, i32* @SYS_memfd_create
%78 = tail call i32 @syscall(i32 %77, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 0)
%79 = icmp eq i32 %78, -1
br i1 %79, label %80, label %83
80: ; preds = %76
%81 = load i32, i32* @stderr
%82 = tail call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0))
br label %86
83: ; preds = %76
%84 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%85 = tail call i32 @sleep(i32 100)
br label %86
86: ; preds = %80, %83, %45, %60, %63, %52, %17, %27, %24, %72, %4
%87 = phi i32 [ 1, %4 ], [ 0, %72 ], [ 1, %17 ], [ 1, %24 ], [ 0, %27 ], [ 1, %45 ], [ 1, %52 ], [ 0, %63 ], [ 1, %60 ], [ 1, %80 ], [ 0, %83 ]
ret i32 %87
}