#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 */
struct timeval {
  unsigned int tv_sec;
  scalar_t__ tv_usec;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SETSIZE;
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int MAP_ANONYMOUS;
int MAP_PRIVATE;
int PROT_EXEC;
int PROT_READ;
int PROT_WRITE;
unsigned int atoi(char *);
int errno;
int /*<<< orphan*/ exit(int);
unsigned int mlock(char *, size_t);
scalar_t__ mmap(int /*<<< orphan*/ *, size_t, int, int, int,
                int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ select(int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          struct timeval *);
scalar_t__ strcmp(char *, char *);
char *strerror(int);
int main(int argc, char *argv[]) {
  unsigned int k, ret;
  int j = 2;
  if (argc < 2) {
    printf("usage: %s mem_size(MB) -t sleep_time -i initial size(MB)           "
           "  -g growth size(MB)  -f final sleep time\n",
           argv[0]);
    exit(1);
  }
  unsigned int totalSize = atoi(argv[1]);
  unsigned int initSize = totalSize;
  unsigned int growthSize = 1;
  unsigned int intervalTime = 30;
  unsigned int sleepTime = 60;
  while (j < argc) {
    if (strcmp(argv[j], "-t") == 0)
      intervalTime = atoi(argv[++j]);
    else if (strcmp(argv[j], "-i") == 0)
      initSize = atoi(argv[++j]);
    else if (strcmp(argv[j], "-g") == 0)
      growthSize = atoi(argv[++j]);
    else if (strcmp(argv[j], "-f") == 0)
      sleepTime = atoi(argv[++j]);
    j++;
  }
  size_t currentBytes = (size_t)initSize << 20;
  size_t totalBytes = (size_t)totalSize << 20;
  size_t growthBytes = (size_t)growthSize << 20;
  printf("=================  Setting  ===============\n");
  printf("   Total memory to be mlocked:    %uMB\n", totalSize);
  printf("   Initially touched and mlocked: %uMB\n", initSize);
  printf("   Grow %uMB every %u seconds\n", growthSize, intervalTime);
  printf("   Finally sleep for %u seconds.\n", sleepTime);
  printf("===============================================\n");
  char *array =
      (char *)mmap(NULL, totalBytes, PROT_READ | PROT_WRITE | PROT_EXEC,
                   MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
  if (!array) {
    printf("Allocation of %dMB with mmap failed\n", totalSize);
    exit(1);
  }
  printf("Touching initial %zd bytes...\n", currentBytes);
  for (k = 0; k < currentBytes; k += 4096) {
    array[k] = 1;
  }
  printf("Mlocking initial %zd bytes...\n", currentBytes);
  ret = mlock(array, currentBytes);
  if (ret) {
    printf("mlock failed: %d errno: %d -> %s \n", ret, errno, strerror(errno));
    exit(1);
  }
  printf("Done\n");
  fd_set set;
  struct timeval timeout;
  while (currentBytes < totalBytes) {
    unsigned int i, h;
    FD_ZERO(&set);
    FD_SET(0, &set);
    timeout.tv_sec = intervalTime;
    timeout.tv_usec = 0;
    select(FD_SETSIZE, &set, NULL, NULL, &timeout);
    for (h = 0; h < currentBytes; h += 4096) {
      array[h] = 'm';
    }
    currentBytes += growthBytes;
    currentBytes = (currentBytes <= totalBytes) ? currentBytes : totalBytes;
    for (i = h; i < currentBytes; i += 4096) {
      array[i] = 'm';
    }
    ret = mlock((array + h), growthBytes);
    if (ret) {
      printf("mlock failed: %d errno: %d -> %s ", ret, errno, strerror(errno));
    }
  }
  while (1) {
    unsigned int i;
    FD_ZERO(&set);
    timeout.tv_sec = sleepTime;
    timeout.tv_usec = 0;
    select(0, &set, NULL, NULL, &timeout);
    for (i = 0; i < totalBytes; i += 4096) {
      array[i] = 'm';
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x1c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11e9 <main+0x49>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0x1e,-0x2c(%rbp)
movl   $0x3c,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1344 <main+0x1a4>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe3b(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1263 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x2c(%rbp)
jmp    1336 <main+0x196>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdfb(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12a6 <main+0x106>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
jmp    1331 <main+0x191>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdbb(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12e9 <main+0x149>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x28(%rbp)
jmp    132c <main+0x18c>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd7b(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1327 <main+0x187>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x30(%rbp)
jmp    132c <main+0x18c>
jmp    1331 <main+0x191>
jmp    1336 <main+0x196>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1214 <main+0x74>
mov    -0x24(%rbp),%eax
shl    $0x14,%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x14,%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%eax
shl    $0x14,%rax
mov    %rax,-0x48(%rbp)
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xd63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rsi
mov    0x2c25(%rip),%rax
mov    (%rax),%edx
mov    0x2bdc(%rip),%rax
or     (%rax),%edx
mov    0x2bf3(%rip),%rax
or     (%rax),%edx
mov    0x2bf2(%rip),%rax
mov    (%rax),%ecx
mov    0x2bb9(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1435 <main+0x295>
mov    -0x20(%rbp),%esi
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x38(%rbp),%rsi
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x38(%rbp),%rax
jae    1476 <main+0x2d6>
mov    -0x50(%rbp),%rax
mov    -0x14(%rbp),%ecx
movb   $0x1,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1000,%eax
mov    %eax,-0x14(%rbp)
jmp    144e <main+0x2ae>
mov    -0x38(%rbp),%rsi
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x50(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1030 <mlock@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     14e3 <main+0x343>
mov    -0x18(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    0x2b11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
mov    0x2b05(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x7c(%rbp),%esi
mov    -0x78(%rbp),%edx
mov    %rax,%rcx
lea    0xcfa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xd05(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rax
cmp    -0x40(%rbp),%rax
jae    1643 <main+0x4a3>
lea    -0x54(%rbp),%rdi
call   1070 <FD_ZERO@plt>
xor    %edi,%edi
lea    -0x54(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x68(%rbp)
movq   $0x0,-0x60(%rbp)
mov    0x2aa0(%rip),%rax
mov    (%rax),%edi
lea    -0x54(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x68(%rbp),%r8
mov    %rcx,%rdx
call   1080 <select@plt>
movl   $0x0,-0x70(%rbp)
mov    -0x70(%rbp),%eax
cmp    -0x38(%rbp),%rax
jae    156d <main+0x3cd>
mov    -0x50(%rbp),%rax
mov    -0x70(%rbp),%ecx
movb   $0x6d,(%rax,%rcx,1)
mov    -0x70(%rbp),%eax
add    $0x1000,%eax
mov    %eax,-0x70(%rbp)
jmp    1545 <main+0x3a5>
mov    -0x48(%rbp),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x40(%rbp),%rax
ja     1597 <main+0x3f7>
mov    -0x38(%rbp),%rax
mov    %rax,-0x88(%rbp)
jmp    15a2 <main+0x402>
mov    -0x40(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x70(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x38(%rbp),%rax
jae    15db <main+0x43b>
mov    -0x50(%rbp),%rax
mov    -0x6c(%rbp),%ecx
movb   $0x6d,(%rax,%rcx,1)
mov    -0x6c(%rbp),%eax
add    $0x1000,%eax
mov    %eax,-0x6c(%rbp)
jmp    15b3 <main+0x413>
mov    -0x50(%rbp),%rdi
mov    -0x70(%rbp),%eax
add    %rax,%rdi
mov    -0x48(%rbp),%rsi
call   1030 <mlock@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     163e <main+0x49e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    0x29b5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    0x29a6(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x90(%rbp),%esi
mov    -0x8c(%rbp),%edx
mov    %rax,%rcx
lea    0xbbe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14f1 <main+0x351>
jmp    1648 <main+0x4a8>
lea    -0x54(%rbp),%rdi
call   1070 <FD_ZERO@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x68(%rbp)
movq   $0x0,-0x60(%rbp)
xor    %edi,%edi
lea    -0x54(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x68(%rbp),%r8
mov    %rcx,%rdx
call   1080 <select@plt>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x40(%rbp),%rax
jae    16a4 <main+0x504>
mov    -0x50(%rbp),%rax
mov    -0x74(%rbp),%ecx
movb   $0x6d,(%rax,%rcx,1)
mov    -0x74(%rbp),%eax
add    $0x1000,%eax
mov    %eax,-0x74(%rbp)
jmp    167c <main+0x4dc>
jmp    1648 <main+0x4a8>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jle    156d <main+0x3bd>
mov    %edi,%r15d
mov    0x8(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r12d
cmp    $0x2,%r15d
jne    1481 <main+0x2d1>
mov    $0x3c,%r14d
movl   $0x1e,0x4(%rsp)
movl   $0x1,(%rsp)
mov    %r12d,0x8(%rsp)
mov    %r12d,%ebx
shl    $0x14,%rbx
lea    0xfa8(%rip),%rdi
call   1040 <puts@plt>
lea    0xe63(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    0x8(%rsp),%ebp
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe8e(%rip),%rdi
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe98(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf7d(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d8a(%rip),%rax
mov    0x2d43(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2d58(%rip),%rax
or     (%rax),%edx
mov    0x2d57(%rip),%rax
mov    0x2d20(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
test   %rax,%rax
je     1588 <main+0x3d8>
mov    %rax,%r15
mov    %ebp,%r13d
mov    %ebp,%ebp
shl    $0x14,%rbp
lea    0xe6d(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r13d,%r13d
je     12ef <main+0x13f>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x1,(%r15,%rax,1)
add    $0x1000,%eax
cmp    %rax,%rbp
ja     12e0 <main+0x130>
lea    0xe59(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1030 <mlock@plt>
test   %eax,%eax
jne    15a3 <main+0x3f3>
lea    0xef5(%rip),%rdi
call   1040 <puts@plt>
cmp    %rbx,%rbp
jae    1430 <main+0x280>
mov    (%rsp),%eax
shl    $0x14,%rax
mov    %rax,0x8(%rsp)
jmp    134c <main+0x19c>
cs nopw 0x0(%rax,%rax,1)
cmp    %rbp,%rbx
mov    %r13,%rbp
jbe    1430 <main+0x280>
lea    0x14(%rsp),%r13
mov    %r13,%rdi
call   1080 <FD_ZERO@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   10d0 <FD_SET@plt>
mov    0x4(%rsp),%eax
mov    %eax,0x18(%rsp)
movq   $0x0,0x20(%rsp)
mov    0x2c4d(%rip),%rax
mov    (%rax),%edi
mov    %r13,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
lea    0x18(%rsp),%r8
call   1090 <select@plt>
mov    $0x0,%eax
test   %rbp,%rbp
je     13af <main+0x1ff>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movb   $0x6d,(%r15,%rax,1)
add    $0x1000,%eax
cmp    %rax,%rbp
ja     13a0 <main+0x1f0>
mov    %eax,%edi
add    0x8(%rsp),%rbp
cmp    %rbx,%rbp
mov    %rbp,%r13
cmova  %rbx,%r13
cmp    %rdi,%r13
jbe    13df <main+0x22f>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
movb   $0x6d,(%r15,%rax,1)
add    $0x1000,%eax
cmp    %rax,%r13
ja     13d0 <main+0x220>
add    %r15,%rdi
mov    0x8(%rsp),%rsi
call   1030 <mlock@plt>
test   %eax,%eax
je     1340 <main+0x190>
mov    %eax,(%rsp)
mov    0x2bc2(%rip),%rax
mov    (%rax),%edi
mov    %edi,0x10(%rsp)
call   10c0 <strerror@plt>
lea    0xd81(%rip),%rdi
mov    (%rsp),%esi
mov    0x10(%rsp),%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1340 <main+0x190>
cs nopw 0x0(%rax,%rax,1)
lea    0x14(%rsp),%rbp
mov    %rbp,%rdi
call   1080 <FD_ZERO@plt>
mov    %r14d,0x18(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x18(%rsp),%r8
xor    %edi,%edi
mov    %rbp,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <select@plt>
test   %r12d,%r12d
je     1430 <main+0x280>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x6d,(%r15,%rax,1)
add    $0x1000,%eax
cmp    %rax,%rbx
ja     1470 <main+0x2c0>
jmp    1430 <main+0x280>
movl   $0x1,(%rsp)
movl   $0x1e,0x4(%rsp)
mov    $0x3c,%r14d
mov    $0x2,%ebp
mov    %r12d,0x8(%rsp)
jmp    14ce <main+0x31e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%r13),%ebp
mov    0x8(%rbx,%r13,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,0x4(%rsp)
add    $0x1,%ebp
cmp    %r15d,%ebp
jge    11fd <main+0x4d>
movslq %ebp,%r13
mov    (%rbx,%r13,8),%rdi
lea    0xb92(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     14b0 <main+0x300>
mov    (%rbx,%r13,8),%rdi
lea    0xb80(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1540 <main+0x390>
mov    (%rbx,%r13,8),%rdi
lea    0xb6e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1557 <main+0x3a7>
mov    (%rbx,%r13,8),%rdi
lea    0xb5c(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    14c2 <main+0x312>
lea    0x1(%r13),%ebp
mov    0x8(%rbx,%r13,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r14d
jmp    14c2 <main+0x312>
nopl   0x0(%rax,%rax,1)
lea    0x1(%r13),%ebp
mov    0x8(%rbx,%r13,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,0x8(%rsp)
jmp    14c2 <main+0x312>
lea    0x1(%r13),%ebp
mov    0x8(%rbx,%r13,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,(%rsp)
jmp    14c2 <main+0x312>
mov    (%rbx),%rsi
lea    0xa89(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xb7c(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    %eax,%r13d
mov    0x2a13(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10c0 <strerror@plt>
lea    0xbb1(%rip),%rdi
mov    %r13d,%esi
mov    %ebx,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@.str = [110 x i8] c"usage: %s mem_size(MB) -t sleep_time -i initial size(MB) -g growth size(MB) -f final sleep time\0A\00"
@.str.1 = [3 x i8] c"-t\00"
@.str.2 = [3 x i8] c"-i\00"
@.str.3 = [3 x i8] c"-g\00"
@.str.4 = [3 x i8] c"-f\00"
@.str.5 = [45 x i8] c"================= Setting ===============\0A\00"
@.str.6 = [40 x i8] c" Total memory to be mlocked: %uMB\0A\00"
@.str.7 = [40 x i8] c" Initially touched and mlocked: %uMB\0A\00"
@.str.8 = [31 x i8] c" Grow %uMB every %u seconds\0A\00"
@.str.9 = [34 x i8] c" Finally sleep for %u seconds.\0A\00"
@.str.10 = [49 x i8] c"===============================================\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@PROT_EXEC = global i32 0
@MAP_ANONYMOUS = global i32 0
@MAP_PRIVATE = global i32 0
@.str.11 = [37 x i8] c"Allocation of %dMB with mmap failed\0A\00"
@.str.12 = [31 x i8] c"Touching initial %zd bytes...\0A\00"
@.str.13 = [31 x i8] c"Mlocking initial %zd bytes...\0A\00"
@.str.14 = [35 x i8] c"mlock failed: %d errno: %d -> %s \0A\00"
@errno = global i32 0
@.str.15 = [6 x i8] c"Done\0A\00"
@FD_SETSIZE = global i32 0
@.str.16 = [34 x i8] c"mlock failed: %d errno: %d -> %s \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i32
%19 = alloca %struct.timeval
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 2, i32* %8
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 2
br i1 %24, label %25, label %31
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %2
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
store i32 %35, i32* %9
%36 = load i32, i32* %9
store i32 %36, i32* %10
store i32 1, i32* %11
store i32 30, i32* %12
store i32 60, i32* %13
br label %37
37: ; preds = %108, %31
%38 = load i32, i32* %8
%39 = load i32, i32* %4
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %111
41: ; preds = %37
%42 = load i8**, i8*** %5
%43 = load i32, i32* %8
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %57
49: ; preds = %41
%50 = load i8**, i8*** %5
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 1
store i32 %52, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %50, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @atoi(i8* %55)
store i32 %56, i32* %12
br label %108
57: ; preds = %41
%58 = load i8**, i8*** %5
%59 = load i32, i32* %8
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %58, i64 %60
%62 = load i8*, i8** %61
%63 = call i64 @strcmp(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %73
65: ; preds = %57
%66 = load i8**, i8*** %5
%67 = load i32, i32* %8
%68 = add nsw i32 %67, 1
store i32 %68, i32* %8
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %66, i64 %69
%71 = load i8*, i8** %70
%72 = call i32 @atoi(i8* %71)
store i32 %72, i32* %10
br label %107
73: ; preds = %57
%74 = load i8**, i8*** %5
%75 = load i32, i32* %8
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8*, i8** %74, i64 %76
%78 = load i8*, i8** %77
%79 = call i64 @strcmp(i8* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %89
81: ; preds = %73
%82 = load i8**, i8*** %5
%83 = load i32, i32* %8
%84 = add nsw i32 %83, 1
store i32 %84, i32* %8
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %82, i64 %85
%87 = load i8*, i8** %86
%88 = call i32 @atoi(i8* %87)
store i32 %88, i32* %11
br label %106
89: ; preds = %73
%90 = load i8**, i8*** %5
%91 = load i32, i32* %8
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8*, i8** %90, i64 %92
%94 = load i8*, i8** %93
%95 = call i64 @strcmp(i8* %94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %105
97: ; preds = %89
%98 = load i8**, i8*** %5
%99 = load i32, i32* %8
%100 = add nsw i32 %99, 1
store i32 %100, i32* %8
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8*, i8** %98, i64 %101
%103 = load i8*, i8** %102
%104 = call i32 @atoi(i8* %103)
store i32 %104, i32* %13
br label %105
105: ; preds = %97, %89
br label %106
106: ; preds = %105, %81
br label %107
107: ; preds = %106, %65
br label %108
108: ; preds = %107, %49
%109 = load i32, i32* %8
%110 = add nsw i32 %109, 1
store i32 %110, i32* %8
br label %37
111: ; preds = %37
%112 = load i32, i32* %10
%113 = zext i32 %112 to i64
%114 = shl i64 %113, 20
store i64 %114, i64* %14
%115 = load i32, i32* %9
%116 = zext i32 %115 to i64
%117 = shl i64 %116, 20
store i64 %117, i64* %15
%118 = load i32, i32* %11
%119 = zext i32 %118 to i64
%120 = shl i64 %119, 20
store i64 %120, i64* %16
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%122 = load i32, i32* %9
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %122)
%124 = load i32, i32* %10
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %124)
%126 = load i32, i32* %11
%127 = load i32, i32* %12
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i32 %126, i32 %127)
%129 = load i32, i32* %13
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32 %129)
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.10, i64 0, i64 0))
%132 = load i64, i64* %15
%133 = load i32, i32* @PROT_READ
%134 = load i32, i32* @PROT_WRITE
%135 = or i32 %133, %134
%136 = load i32, i32* @PROT_EXEC
%137 = or i32 %135, %136
%138 = load i32, i32* @MAP_ANONYMOUS
%139 = load i32, i32* @MAP_PRIVATE
%140 = or i32 %138, %139
%141 = call i64 @mmap(i32* null, i64 %132, i32 %137, i32 %140, i32 -1, i32 0)
%142 = inttoptr i64 %141 to i8*
store i8* %142, i8** %17
%143 = load i8*, i8** %17
%144 = icmp ne i8* %143, null
br i1 %144, label %149, label %145
145: ; preds = %111
%146 = load i32, i32* %9
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i32 %146)
%148 = call i32 @exit(i32 1)
unreachable
149: ; preds = %111
%150 = load i64, i64* %14
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i64 %150)
store i32 0, i32* %6
br label %152
152: ; preds = %162, %149
%153 = load i32, i32* %6
%154 = zext i32 %153 to i64
%155 = load i64, i64* %14
%156 = icmp ult i64 %154, %155
br i1 %156, label %157, label %165
157: ; preds = %152
%158 = load i8*, i8** %17
%159 = load i32, i32* %6
%160 = zext i32 %159 to i64
%161 = getelementptr inbounds i8, i8* %158, i64 %160
store i8 1, i8* %161
br label %162
162: ; preds = %157
%163 = load i32, i32* %6
%164 = add i32 %163, 4096
store i32 %164, i32* %6
br label %152
165: ; preds = %152
%166 = load i64, i64* %14
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i64 %166)
%168 = load i8*, i8** %17
%169 = load i64, i64* %14
%170 = call i32 @mlock(i8* %168, i64 %169)
store i32 %170, i32* %7
%171 = load i32, i32* %7
%172 = icmp ne i32 %171, 0
br i1 %172, label %173, label %180
173: ; preds = %165
%174 = load i32, i32* %7
%175 = load i32, i32* @errno
%176 = load i32, i32* @errno
%177 = call i8* @strerror(i32 %176)
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.14, i64 0, i64 0), i32 %174, i32 %175, i8* %177)
%179 = call i32 @exit(i32 1)
unreachable
180: ; preds = %165
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
br label %182
182: ; preds = %249, %180
%183 = load i64, i64* %14
%184 = load i64, i64* %15
%185 = icmp ult i64 %183, %184
br i1 %185, label %186, label %250
186: ; preds = %182
%187 = call i32 @FD_ZERO(i32* %18)
%188 = call i32 @FD_SET(i32 0, i32* %18)
%189 = load i32, i32* %12
%190 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 0
store i32 %189, i32* %190
%191 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 1
store i64 0, i64* %191
%192 = load i32, i32* @FD_SETSIZE
%193 = call i32 @select(i32 %192, i32* %18, i32* null, i32* null, %struct.timeval* %19)
store i32 0, i32* %21
br label %194
194: ; preds = %204, %186
%195 = load i32, i32* %21
%196 = zext i32 %195 to i64
%197 = load i64, i64* %14
%198 = icmp ult i64 %196, %197
br i1 %198, label %199, label %207
199: ; preds = %194
%200 = load i8*, i8** %17
%201 = load i32, i32* %21
%202 = zext i32 %201 to i64
%203 = getelementptr inbounds i8, i8* %200, i64 %202
store i8 109, i8* %203
br label %204
204: ; preds = %199
%205 = load i32, i32* %21
%206 = add i32 %205, 4096
store i32 %206, i32* %21
br label %194
207: ; preds = %194
%208 = load i64, i64* %16
%209 = load i64, i64* %14
%210 = add i64 %209, %208
store i64 %210, i64* %14
%211 = load i64, i64* %14
%212 = load i64, i64* %15
%213 = icmp ule i64 %211, %212
br i1 %213, label %214, label %216
214: ; preds = %207
%215 = load i64, i64* %14
br label %218
216: ; preds = %207
%217 = load i64, i64* %15
br label %218
218: ; preds = %216, %214
%219 = phi i64 [ %215, %214 ], [ %217, %216 ]
store i64 %219, i64* %14
%220 = load i32, i32* %21
store i32 %220, i32* %20
br label %221
221: ; preds = %231, %218
%222 = load i32, i32* %20
%223 = zext i32 %222 to i64
%224 = load i64, i64* %14
%225 = icmp ult i64 %223, %224
br i1 %225, label %226, label %234
226: ; preds = %221
%227 = load i8*, i8** %17
%228 = load i32, i32* %20
%229 = zext i32 %228 to i64
%230 = getelementptr inbounds i8, i8* %227, i64 %229
store i8 109, i8* %230
br label %231
231: ; preds = %226
%232 = load i32, i32* %20
%233 = add i32 %232, 4096
store i32 %233, i32* %20
br label %221
234: ; preds = %221
%235 = load i8*, i8** %17
%236 = load i32, i32* %21
%237 = zext i32 %236 to i64
%238 = getelementptr inbounds i8, i8* %235, i64 %237
%239 = load i64, i64* %16
%240 = call i32 @mlock(i8* %238, i64 %239)
store i32 %240, i32* %7
%241 = load i32, i32* %7
%242 = icmp ne i32 %241, 0
br i1 %242, label %243, label %249
243: ; preds = %234
%244 = load i32, i32* %7
%245 = load i32, i32* @errno
%246 = load i32, i32* @errno
%247 = call i8* @strerror(i32 %246)
%248 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i32 %244, i32 %245, i8* %247)
br label %249
249: ; preds = %243, %234
br label %182
250: ; preds = %182
br label %251
251: ; preds = %250, %270
%252 = call i32 @FD_ZERO(i32* %18)
%253 = load i32, i32* %13
%254 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 0
store i32 %253, i32* %254
%255 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 1
store i64 0, i64* %255
%256 = call i32 @select(i32 0, i32* %18, i32* null, i32* null, %struct.timeval* %19)
store i32 0, i32* %22
br label %257
257: ; preds = %267, %251
%258 = load i32, i32* %22
%259 = zext i32 %258 to i64
%260 = load i64, i64* %15
%261 = icmp ult i64 %259, %260
br i1 %261, label %262, label %270
262: ; preds = %257
%263 = load i8*, i8** %17
%264 = load i32, i32* %22
%265 = zext i32 %264 to i64
%266 = getelementptr inbounds i8, i8* %263, i64 %265
store i8 109, i8* %266
br label %267
267: ; preds = %262
%268 = load i32, i32* %22
%269 = add i32 %268, 4096
store i32 %269, i32* %22
br label %257
270: ; preds = %257
br label %251
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@.str = [110 x i8] c"usage: %s mem_size(MB) -t sleep_time -i initial size(MB) -g growth size(MB) -f final sleep time\0A\00"
@.str.1 = [3 x i8] c"-t\00"
@.str.2 = [3 x i8] c"-i\00"
@.str.3 = [3 x i8] c"-g\00"
@.str.4 = [3 x i8] c"-f\00"
@.str.6 = [40 x i8] c" Total memory to be mlocked: %uMB\0A\00"
@.str.7 = [40 x i8] c" Initially touched and mlocked: %uMB\0A\00"
@.str.8 = [31 x i8] c" Grow %uMB every %u seconds\0A\00"
@.str.9 = [34 x i8] c" Finally sleep for %u seconds.\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@PROT_EXEC = global i32 0
@MAP_ANONYMOUS = global i32 0
@MAP_PRIVATE = global i32 0
@.str.11 = [37 x i8] c"Allocation of %dMB with mmap failed\0A\00"
@.str.12 = [31 x i8] c"Touching initial %zd bytes...\0A\00"
@.str.13 = [31 x i8] c"Mlocking initial %zd bytes...\0A\00"
@.str.14 = [35 x i8] c"mlock failed: %d errno: %d -> %s \0A\00"
@errno = global i32 0
@FD_SETSIZE = global i32 0
@.str.16 = [34 x i8] c"mlock failed: %d errno: %d -> %s \00"
@str = [44 x i8] c"================= Setting ===============\00"
@str.17 = [48 x i8] c"===============================================\00"
@str.18 = [5 x i8] c"Done\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.timeval
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([110 x i8], [110 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = icmp eq i32 %0, 2
br i1 %14, label %70, label %15
15: ; preds = %10, %62
%16 = phi i32 [ %68, %62 ], [ 2, %10 ]
%17 = phi i32 [ %66, %62 ], [ 60, %10 ]
%18 = phi i32 [ %65, %62 ], [ 30, %10 ]
%19 = phi i32 [ %64, %62 ], [ 1, %10 ]
%20 = phi i32 [ %63, %62 ], [ %13, %10 ]
%21 = sext i32 %16 to i64
%22 = getelementptr inbounds i8*, i8** %1, i64 %21
%23 = load i8*, i8** %22
%24 = tail call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %15
%27 = add nsw i32 %16, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %1, i64 %28
%30 = load i8*, i8** %29
%31 = tail call i32 @atoi(i8* %30)
br label %62
32: ; preds = %15
%33 = load i8*, i8** %22
%34 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = add nsw i32 %16, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %1, i64 %38
%40 = load i8*, i8** %39
%41 = tail call i32 @atoi(i8* %40)
br label %62
42: ; preds = %32
%43 = load i8*, i8** %22
%44 = tail call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %52
46: ; preds = %42
%47 = add nsw i32 %16, 1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %1, i64 %48
%50 = load i8*, i8** %49
%51 = tail call i32 @atoi(i8* %50)
br label %62
52: ; preds = %42
%53 = load i8*, i8** %22
%54 = tail call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %62
56: ; preds = %52
%57 = add nsw i32 %16, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8*, i8** %1, i64 %58
%60 = load i8*, i8** %59
%61 = tail call i32 @atoi(i8* %60)
br label %62
62: ; preds = %36, %52, %56, %46, %26
%63 = phi i32 [ %20, %26 ], [ %41, %36 ], [ %20, %46 ], [ %20, %56 ], [ %20, %52 ]
%64 = phi i32 [ %19, %26 ], [ %19, %36 ], [ %51, %46 ], [ %19, %56 ], [ %19, %52 ]
%65 = phi i32 [ %31, %26 ], [ %18, %36 ], [ %18, %46 ], [ %18, %56 ], [ %18, %52 ]
%66 = phi i32 [ %17, %26 ], [ %17, %36 ], [ %17, %46 ], [ %61, %56 ], [ %17, %52 ]
%67 = phi i32 [ %27, %26 ], [ %37, %36 ], [ %47, %46 ], [ %57, %56 ], [ %16, %52 ]
%68 = add nsw i32 %67, 1
%69 = icmp slt i32 %68, %0
br i1 %69, label %15, label %70
70: ; preds = %62, %10
%71 = phi i32 [ %13, %10 ], [ %63, %62 ]
%72 = phi i32 [ 1, %10 ], [ %64, %62 ]
%73 = phi i32 [ 30, %10 ], [ %65, %62 ]
%74 = phi i32 [ 60, %10 ], [ %66, %62 ]
%75 = zext i32 %71 to i64
%76 = shl nuw nsw i64 %75, 20
%77 = zext i32 %13 to i64
%78 = shl nuw nsw i64 %77, 20
%79 = zext i32 %72 to i64
%80 = shl nuw nsw i64 %79, 20
%81 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %71)
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i32 %72, i32 %73)
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32 %74)
%86 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.17, i64 0, i64 0))
%87 = load i32, i32* @PROT_READ
%88 = load i32, i32* @PROT_WRITE
%89 = or i32 %88, %87
%90 = load i32, i32* @PROT_EXEC
%91 = or i32 %89, %90
%92 = load i32, i32* @MAP_ANONYMOUS
%93 = load i32, i32* @MAP_PRIVATE
%94 = or i32 %93, %92
%95 = tail call i64 @mmap(i32* null, i64 %78, i32 %91, i32 %94, i32 -1, i32 0)
%96 = inttoptr i64 %95 to i8*
%97 = icmp eq i64 %95, 0
br i1 %97, label %98, label %101
98: ; preds = %70
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i32 %13)
%100 = tail call i32 @exit(i32 1)
unreachable
101: ; preds = %70
%102 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i64 %76)
%103 = icmp eq i32 %71, 0
br i1 %103, label %110, label %104
104: ; preds = %101, %104
%105 = phi i64 [ %108, %104 ], [ 0, %101 ]
%106 = getelementptr inbounds i8, i8* %96, i64 %105
store i8 1, i8* %106
%107 = add nuw nsw i64 %105, 4096
%108 = and i64 %107, 4294967295
%109 = icmp ugt i64 %76, %108
br i1 %109, label %104, label %110
110: ; preds = %104, %101
%111 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i64 %76)
%112 = tail call i32 @mlock(i8* %96, i64 %76)
%113 = icmp eq i32 %112, 0
br i1 %113, label %119, label %114
114: ; preds = %110
%115 = load i32, i32* @errno
%116 = tail call i8* @strerror(i32 %115)
%117 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.14, i64 0, i64 0), i32 %112, i32 %115, i8* %116)
%118 = tail call i32 @exit(i32 1)
unreachable
119: ; preds = %110
%120 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.18, i64 0, i64 0))
%121 = bitcast i32* %3 to i8*
%122 = bitcast %struct.timeval* %4 to i8*
%123 = icmp ult i64 %76, %78
br i1 %123, label %124, label %127
124: ; preds = %119
%125 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%126 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
br label %131
127: ; preds = %166, %119
%128 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%129 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%130 = icmp eq i32 %13, 0
br label %168
131: ; preds = %124, %166
%132 = phi i64 [ %76, %124 ], [ %150, %166 ]
%133 = call i32 @FD_ZERO(i32* %3)
%134 = call i32 @FD_SET(i32 0, i32* %3)
store i32 %73, i32* %125
store i64 0, i64* %126
%135 = load i32, i32* @FD_SETSIZE
%136 = call i32 @select(i32 %135, i32* %3, i32* null, i32* null, %struct.timeval* %4)
%137 = icmp eq i64 %132, 0
br i1 %137, label %145, label %138
138: ; preds = %131, %138
%139 = phi i64 [ %143, %138 ], [ 0, %131 ]
%140 = trunc i64 %139 to i32
%141 = getelementptr inbounds i8, i8* %96, i64 %139
store i8 109, i8* %141
%142 = add i32 %140, 4096
%143 = zext i32 %142 to i64
%144 = icmp ugt i64 %132, %143
br i1 %144, label %138, label %145
145: ; preds = %138, %131
%146 = phi i32 [ 0, %131 ], [ %142, %138 ]
%147 = zext i32 %146 to i64
%148 = add nsw i64 %132, %80
%149 = icmp ugt i64 %148, %78
%150 = select i1 %149, i64 %78, i64 %148
%151 = icmp ugt i64 %150, %147
br i1 %151, label %152, label %158
152: ; preds = %145, %152
%153 = phi i64 [ %156, %152 ], [ %147, %145 ]
%154 = getelementptr inbounds i8, i8* %96, i64 %153
store i8 109, i8* %154
%155 = add nuw nsw i64 %153, 4096
%156 = and i64 %155, 4294967295
%157 = icmp ugt i64 %150, %156
br i1 %157, label %152, label %158
158: ; preds = %152, %145
%159 = getelementptr inbounds i8, i8* %96, i64 %147
%160 = call i32 @mlock(i8* %159, i64 %80)
%161 = icmp eq i32 %160, 0
br i1 %161, label %166, label %162
162: ; preds = %158
%163 = load i32, i32* @errno
%164 = call i8* @strerror(i32 %163)
%165 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i32 %160, i32 %163, i8* %164)
br label %166
166: ; preds = %162, %158
%167 = icmp ugt i64 %78, %148
br i1 %167, label %131, label %127
168: ; preds = %171, %127
%169 = call i32 @FD_ZERO(i32* %3)
store i32 %74, i32* %128
store i64 0, i64* %129
%170 = call i32 @select(i32 0, i32* %3, i32* null, i32* null, %struct.timeval* %4)
br i1 %130, label %171, label %172
171: ; preds = %172, %168
br label %168
172: ; preds = %168, %172
%173 = phi i64 [ %176, %172 ], [ 0, %168 ]
%174 = getelementptr inbounds i8, i8* %96, i64 %173
store i8 109, i8* %174
%175 = add nuw nsw i64 %173, 4096
%176 = and i64 %175, 4294967295
%177 = icmp ugt i64 %78, %176
br i1 %177, label %172, label %171
}