#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 stat {
  int dummy;
};
struct rlimit {
  int rlim_cur;
  int rlim_max;
};
typedef int /*<<< orphan*/ pid_max;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
scalar_t__ EXIT_SUCCESS;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ RLIMIT_NPROC;
int /*<<< orphan*/ RLIMIT_SIGPENDING;
int RLIM_INFINITY;
unsigned long assert(int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, int, int, ...);
double get_la();
int /*<<< orphan*/ getrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ memset(char *, char, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ setrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stdout;
int strlen(char *);
scalar_t__ system;
int chk_fork_prepare() {
  int pid_max = -1;
  {
    {
      char buf[32];
      struct stat s;
      assert(stat("/proc/sys/kernel/"
                  "pid_max",
                  &s) == EXIT_SUCCESS);
      int fh = open("/proc/sys/kernel/"
                    "pid_max",
                    O_RDONLY);
      read(fh, buf, sizeof(buf));
      sscanf(buf, "%i", &pid_max);
      close(fh);
    };
  };
  {
    unsigned long syslim =
        (assert(sizeof(unsigned long) >=
                sizeof((assert(sizeof(unsigned long) >= sizeof(pid_max)),
                        (unsigned long)(pid_max)))),
         (unsigned long)((assert(sizeof(unsigned long) >= sizeof(pid_max)),
                          (unsigned long)(pid_max))));
    int inf = 0;
    int change = 0;
    struct rlimit rlp;
    getrlimit(RLIMIT_NPROC, &rlp);
    {
      int type = 1;
      int fg = 30 + 0;
      int bg = 40 + 0;
      switch (0xFF & 3) {
      case 1:
        fg = 30 + 2;
        break;
      case 2:
        bg = 40 + 5;
        fg = 30 + 7;
        break;
      case 3:
        fg = 30 + 7;
        break;
      case 4:
        fg = 30 + 3;
        break;
      case 5:
        fg = 30 + 1;
        break;
      case 6:
        fg = 30 + 7;
        bg = 40 + 4;
        break;
      }
      if (3 & (1 << 8)) {
        char buf[82];
        memset(buf, ' ', 80);
        snprintf(buf, 70,
                 "I "
                 "NPROC"
                 " syslim:%lu usrlim:%lu:%lu\n",
                 syslim, rlp.rlim_cur, rlp.rlim_max);
        buf[strlen(buf)] = ' ';
        snprintf(buf + 70, 11, "LA:%7.2f", get_la());
        buf[81] = '\0';
        assert(strlen(buf) == 80);
        fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf, 0x1B,
                0);
      } else {
        fprintf(stdout,
                "%c[%d;%d;%dm"
                "I "
                "NPROC"
                " syslim:%lu usrlim:%lu:%lu\n"
                "%c[%dm",
                0x1B, type, fg, bg, syslim, rlp.rlim_cur, rlp.rlim_max, 0x1B,
                0);
      }
      fflush(stdout);
    };
    if (rlp.rlim_cur == RLIM_INFINITY) {
      inf = 1;
      {
        int type = 1;
        int fg = 30 + 0;
        int bg = 40 + 0;
        switch (0xFF & 4) {
        case 1:
          fg = 30 + 2;
          break;
        case 2:
          bg = 40 + 5;
          fg = 30 + 7;
          break;
        case 3:
          fg = 30 + 7;
          break;
        case 4:
          fg = 30 + 3;
          break;
        case 5:
          fg = 30 + 1;
          break;
        case 6:
          fg = 30 + 7;
          bg = 40 + 4;
          break;
        }
        if (4 & (1 << 8)) {
          char buf[82];
          memset(buf, ' ', 80);
          snprintf(buf, 70, "W \\___User limit is unbound!\n");
          buf[strlen(buf)] = ' ';
          snprintf(buf + 70, 11, "LA:%7.2f", get_la());
          buf[81] = '\0';
          assert(strlen(buf) == 80);
          fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf, 0x1B,
                  0);
        } else {
          fprintf(stdout,
                  "%c[%d;%d;%dm"
                  "W \\___User limit is unbound!\n"
                  "%c[%dm",
                  0x1B, type, fg, bg, 0x1B, 0);
        }
        fflush(stdout);
      };
    }
    if (((syslim) > 0) && (rlp.rlim_cur > (syslim))) {
      {
        int type = 1;
        int fg = 30 + 0;
        int bg = 40 + 0;
        switch (0xFF & 4) {
        case 1:
          fg = 30 + 2;
          break;
        case 2:
          bg = 40 + 5;
          fg = 30 + 7;
          break;
        case 3:
          fg = 30 + 7;
          break;
        case 4:
          fg = 30 + 3;
          break;
        case 5:
          fg = 30 + 1;
          break;
        case 6:
          fg = 30 + 7;
          bg = 40 + 4;
          break;
        }
        if (4 & (1 << 8)) {
          char buf[82];
          memset(buf, ' ', 80);
          snprintf(buf, 70, "W \\___ User limit exceeds system limit!\n");
          buf[strlen(buf)] = ' ';
          snprintf(buf + 70, 11, "LA:%7.2f", get_la());
          buf[81] = '\0';
          assert(strlen(buf) == 80);
          fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf, 0x1B,
                  0);
        } else {
          fprintf(stdout,
                  "%c[%d;%d;%dm"
                  "W \\___ User limit exceeds system limit!\n"
                  "%c[%dm",
                  0x1B, type, fg, bg, 0x1B, 0);
        }
        fflush(stdout);
      };
      change = 1;
    }
    if (change) {
      if (inf) {
        {
          int type = 1;
          int fg = 30 + 0;
          int bg = 40 + 0;
          switch (0xFF & 4) {
          case 1:
            fg = 30 + 2;
            break;
          case 2:
            bg = 40 + 5;
            fg = 30 + 7;
            break;
          case 3:
            fg = 30 + 7;
            break;
          case 4:
            fg = 30 + 3;
            break;
          case 5:
            fg = 30 + 1;
            break;
          case 6:
            fg = 30 + 7;
            bg = 40 + 4;
            break;
          }
          if (4 & (1 << 8)) {
            char buf[82];
            memset(buf, ' ', 80);
            snprintf(buf, 70, "W   \\___ Changing %s limit from INFINITY to",
                     "NPROC");
            buf[strlen(buf)] = ' ';
            snprintf(buf + 70, 11, "LA:%7.2f", get_la());
            buf[81] = '\0';
            assert(strlen(buf) == 80);
            fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf,
                    0x1B, 0);
          } else {
            fprintf(stdout,
                    "%c[%d;%d;%dm"
                    "W   \\___ Changing %s limit from INFINITY to"
                    "%c[%dm",
                    0x1B, type, fg, bg, "NPROC", 0x1B, 0);
          }
          fflush(stdout);
        };
      } else {
        {
          int type = 1;
          int fg = 30 + 0;
          int bg = 40 + 0;
          switch (0xFF & 4) {
          case 1:
            fg = 30 + 2;
            break;
          case 2:
            bg = 40 + 5;
            fg = 30 + 7;
            break;
          case 3:
            fg = 30 + 7;
            break;
          case 4:
            fg = 30 + 3;
            break;
          case 5:
            fg = 30 + 1;
            break;
          case 6:
            fg = 30 + 7;
            bg = 40 + 4;
            break;
          }
          if (4 & (1 << 8)) {
            char buf[82];
            memset(buf, ' ', 80);
            snprintf(buf, 70, "W   \\___ Changing %s limit from %lu:%lu to",
                     "NPROC", rlp.rlim_cur, rlp.rlim_max);
            buf[strlen(buf)] = ' ';
            snprintf(buf + 70, 11, "LA:%7.2f", get_la());
            buf[81] = '\0';
            assert(strlen(buf) == 80);
            fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf,
                    0x1B, 0);
          } else {
            fprintf(stdout,
                    "%c[%d;%d;%dm"
                    "W   \\___ Changing %s limit from %lu:%lu to"
                    "%c[%dm",
                    0x1B, type, fg, bg, "NPROC", rlp.rlim_cur, rlp.rlim_max,
                    0x1B, 0);
          }
          fflush(stdout);
        };
      }
      {
        if (((system) > 0) && ((syslim) < (rlp.rlim_cur)))
          rlp.rlim_cur = syslim;
        if (((system) > 0) && ((syslim) < (rlp.rlim_max)))
          rlp.rlim_max = syslim;
        setrlimit(RLIMIT_NPROC, &rlp);
      }
      getrlimit(RLIMIT_NPROC, &rlp);
      {
        int type = 1;
        int fg = 30 + 0;
        int bg = 40 + 0;
        switch (0xFF & 4) {
        case 1:
          fg = 30 + 2;
          break;
        case 2:
          bg = 40 + 5;
          fg = 30 + 7;
          break;
        case 3:
          fg = 30 + 7;
          break;
        case 4:
          fg = 30 + 3;
          break;
        case 5:
          fg = 30 + 1;
          break;
        case 6:
          fg = 30 + 7;
          bg = 40 + 4;
          break;
        }
        if (4 & (1 << 8)) {
          char buf[82];
          memset(buf, ' ', 80);
          snprintf(buf, 70, " %lu:%lu\n", rlp.rlim_cur, rlp.rlim_max);
          buf[strlen(buf)] = ' ';
          snprintf(buf + 70, 11, "LA:%7.2f", get_la());
          buf[81] = '\0';
          assert(strlen(buf) == 80);
          fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf, 0x1B,
                  0);
        } else {
          fprintf(stdout,
                  "%c[%d;%d;%dm"
                  " %lu:%lu\n"
                  "%c[%dm",
                  0x1B, type, fg, bg, rlp.rlim_cur, rlp.rlim_max, 0x1B, 0);
        }
        fflush(stdout);
      };
    }
  };
  {
    unsigned long syslim =
        (assert(sizeof(unsigned long) >=
                sizeof((assert(sizeof(unsigned long) >= sizeof(pid_max)),
                        (unsigned long)(pid_max)))),
         (unsigned long)((assert(sizeof(unsigned long) >= sizeof(pid_max)),
                          (unsigned long)(pid_max))));
    int inf = 0;
    int change = 0;
    struct rlimit rlp;
    getrlimit(RLIMIT_SIGPENDING, &rlp);
    {
      int type = 1;
      int fg = 30 + 0;
      int bg = 40 + 0;
      switch (0xFF & 3) {
      case 1:
        fg = 30 + 2;
        break;
      case 2:
        bg = 40 + 5;
        fg = 30 + 7;
        break;
      case 3:
        fg = 30 + 7;
        break;
      case 4:
        fg = 30 + 3;
        break;
      case 5:
        fg = 30 + 1;
        break;
      case 6:
        fg = 30 + 7;
        bg = 40 + 4;
        break;
      }
      if (3 & (1 << 8)) {
        char buf[82];
        memset(buf, ' ', 80);
        snprintf(buf, 70,
                 "I "
                 "SIGPENDING"
                 " syslim:%lu usrlim:%lu:%lu\n",
                 syslim, rlp.rlim_cur, rlp.rlim_max);
        buf[strlen(buf)] = ' ';
        snprintf(buf + 70, 11, "LA:%7.2f", get_la());
        buf[81] = '\0';
        assert(strlen(buf) == 80);
        fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf, 0x1B,
                0);
      } else {
        fprintf(stdout,
                "%c[%d;%d;%dm"
                "I "
                "SIGPENDING"
                " syslim:%lu usrlim:%lu:%lu\n"
                "%c[%dm",
                0x1B, type, fg, bg, syslim, rlp.rlim_cur, rlp.rlim_max, 0x1B,
                0);
      }
      fflush(stdout);
    };
    if (rlp.rlim_cur == RLIM_INFINITY) {
      inf = 1;
      {
        int type = 1;
        int fg = 30 + 0;
        int bg = 40 + 0;
        switch (0xFF & 4) {
        case 1:
          fg = 30 + 2;
          break;
        case 2:
          bg = 40 + 5;
          fg = 30 + 7;
          break;
        case 3:
          fg = 30 + 7;
          break;
        case 4:
          fg = 30 + 3;
          break;
        case 5:
          fg = 30 + 1;
          break;
        case 6:
          fg = 30 + 7;
          bg = 40 + 4;
          break;
        }
        if (4 & (1 << 8)) {
          char buf[82];
          memset(buf, ' ', 80);
          snprintf(buf, 70, "W \\___User limit is unbound!\n");
          buf[strlen(buf)] = ' ';
          snprintf(buf + 70, 11, "LA:%7.2f", get_la());
          buf[81] = '\0';
          assert(strlen(buf) == 80);
          fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf, 0x1B,
                  0);
        } else {
          fprintf(stdout,
                  "%c[%d;%d;%dm"
                  "W \\___User limit is unbound!\n"
                  "%c[%dm",
                  0x1B, type, fg, bg, 0x1B, 0);
        }
        fflush(stdout);
      };
    }
    if (((syslim) > 0) && (rlp.rlim_cur > (syslim))) {
      {
        int type = 1;
        int fg = 30 + 0;
        int bg = 40 + 0;
        switch (0xFF & 4) {
        case 1:
          fg = 30 + 2;
          break;
        case 2:
          bg = 40 + 5;
          fg = 30 + 7;
          break;
        case 3:
          fg = 30 + 7;
          break;
        case 4:
          fg = 30 + 3;
          break;
        case 5:
          fg = 30 + 1;
          break;
        case 6:
          fg = 30 + 7;
          bg = 40 + 4;
          break;
        }
        if (4 & (1 << 8)) {
          char buf[82];
          memset(buf, ' ', 80);
          snprintf(buf, 70, "W \\___ User limit exceeds system limit!\n");
          buf[strlen(buf)] = ' ';
          snprintf(buf + 70, 11, "LA:%7.2f", get_la());
          buf[81] = '\0';
          assert(strlen(buf) == 80);
          fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf, 0x1B,
                  0);
        } else {
          fprintf(stdout,
                  "%c[%d;%d;%dm"
                  "W \\___ User limit exceeds system limit!\n"
                  "%c[%dm",
                  0x1B, type, fg, bg, 0x1B, 0);
        }
        fflush(stdout);
      };
      change = 1;
    }
    if (change) {
      if (inf) {
        {
          int type = 1;
          int fg = 30 + 0;
          int bg = 40 + 0;
          switch (0xFF & 4) {
          case 1:
            fg = 30 + 2;
            break;
          case 2:
            bg = 40 + 5;
            fg = 30 + 7;
            break;
          case 3:
            fg = 30 + 7;
            break;
          case 4:
            fg = 30 + 3;
            break;
          case 5:
            fg = 30 + 1;
            break;
          case 6:
            fg = 30 + 7;
            bg = 40 + 4;
            break;
          }
          if (4 & (1 << 8)) {
            char buf[82];
            memset(buf, ' ', 80);
            snprintf(buf, 70, "W   \\___ Changing %s limit from INFINITY to",
                     "SIGPENDING");
            buf[strlen(buf)] = ' ';
            snprintf(buf + 70, 11, "LA:%7.2f", get_la());
            buf[81] = '\0';
            assert(strlen(buf) == 80);
            fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf,
                    0x1B, 0);
          } else {
            fprintf(stdout,
                    "%c[%d;%d;%dm"
                    "W   \\___ Changing %s limit from INFINITY to"
                    "%c[%dm",
                    0x1B, type, fg, bg, "SIGPENDING", 0x1B, 0);
          }
          fflush(stdout);
        };
      } else {
        {
          int type = 1;
          int fg = 30 + 0;
          int bg = 40 + 0;
          switch (0xFF & 4) {
          case 1:
            fg = 30 + 2;
            break;
          case 2:
            bg = 40 + 5;
            fg = 30 + 7;
            break;
          case 3:
            fg = 30 + 7;
            break;
          case 4:
            fg = 30 + 3;
            break;
          case 5:
            fg = 30 + 1;
            break;
          case 6:
            fg = 30 + 7;
            bg = 40 + 4;
            break;
          }
          if (4 & (1 << 8)) {
            char buf[82];
            memset(buf, ' ', 80);
            snprintf(buf, 70, "W   \\___ Changing %s limit from %lu:%lu to",
                     "SIGPENDING", rlp.rlim_cur, rlp.rlim_max);
            buf[strlen(buf)] = ' ';
            snprintf(buf + 70, 11, "LA:%7.2f", get_la());
            buf[81] = '\0';
            assert(strlen(buf) == 80);
            fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf,
                    0x1B, 0);
          } else {
            fprintf(stdout,
                    "%c[%d;%d;%dm"
                    "W   \\___ Changing %s limit from %lu:%lu to"
                    "%c[%dm",
                    0x1B, type, fg, bg, "SIGPENDING", rlp.rlim_cur,
                    rlp.rlim_max, 0x1B, 0);
          }
          fflush(stdout);
        };
      }
      {
        if (((system) > 0) && ((syslim) < (rlp.rlim_cur)))
          rlp.rlim_cur = syslim;
        if (((system) > 0) && ((syslim) < (rlp.rlim_max)))
          rlp.rlim_max = syslim;
        setrlimit(RLIMIT_SIGPENDING, &rlp);
      }
      getrlimit(RLIMIT_SIGPENDING, &rlp);
      {
        int type = 1;
        int fg = 30 + 0;
        int bg = 40 + 0;
        switch (0xFF & 4) {
        case 1:
          fg = 30 + 2;
          break;
        case 2:
          bg = 40 + 5;
          fg = 30 + 7;
          break;
        case 3:
          fg = 30 + 7;
          break;
        case 4:
          fg = 30 + 3;
          break;
        case 5:
          fg = 30 + 1;
          break;
        case 6:
          fg = 30 + 7;
          bg = 40 + 4;
          break;
        }
        if (4 & (1 << 8)) {
          char buf[82];
          memset(buf, ' ', 80);
          snprintf(buf, 70, " %lu:%lu\n", rlp.rlim_cur, rlp.rlim_max);
          buf[strlen(buf)] = ' ';
          snprintf(buf + 70, 11, "LA:%7.2f", get_la());
          buf[81] = '\0';
          assert(strlen(buf) == 80);
          fprintf(stdout, "%c[%d;%d;%dm%s%c[%dm", 0x1B, type, fg, bg, buf, 0x1B,
                  0);
        } else {
          fprintf(stdout,
                  "%c[%d;%d;%dm"
                  " %lu:%lu\n"
                  "%c[%dm",
                  0x1B, type, fg, bg, rlp.rlim_cur, rlp.rlim_max, 0x1B, 0);
        }
        fflush(stdout);
      };
    }
  };
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<chk_fork_prepare>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x128,%rsp
movl   $0xffffffff,-0xc(%rbp)
lea    0xe46(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1070 <stat@plt>
mov    0x2de6(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
lea    0xe16(%rip),%rdi
call   10b0 <open@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x20,%edx
call   1040 <read@plt>
lea    -0x30(%rbp),%rdi
lea    0xe0b(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1090 <sscanf@plt>
mov    -0x3c(%rbp),%edi
call   1030 <close@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
movslq -0xc(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   10c0 <getrlimit@plt>
movl   $0x1,-0x5c(%rbp)
movl   $0x1e,-0x60(%rbp)
movl   $0x28,-0x64(%rbp)
movl   $0x25,-0x60(%rbp)
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
mov    -0x5c(%rbp),%ecx
mov    -0x60(%rbp),%r8d
mov    -0x64(%rbp),%r9d
mov    -0x48(%rbp),%r11
mov    -0x58(%rbp),%r10d
mov    -0x54(%rbp),%eax
lea    0xd7f(%rip),%rsi
mov    $0x1b,%edx
xor    %ebx,%ebx
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
movl   $0x1b,0x18(%rsp)
movl   $0x0,0x20(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2cf1(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x58(%rbp),%eax
mov    0x2cd8(%rip),%rcx
cmp    (%rcx),%eax
jne    1351 <chk_fork_prepare+0x1b1>
movl   $0x1,-0x4c(%rbp)
movl   $0x1,-0x68(%rbp)
movl   $0x1e,-0x6c(%rbp)
movl   $0x28,-0x70(%rbp)
movl   $0x21,-0x6c(%rbp)
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
mov    -0x68(%rbp),%ecx
mov    -0x6c(%rbp),%r8d
mov    -0x70(%rbp),%r9d
lea    0xd2b(%rip),%rsi
mov    $0x1b,%edx
xor    %eax,%eax
movl   $0x1b,(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2c76(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
cmpq   $0x0,-0x48(%rbp)
jbe    13d3 <chk_fork_prepare+0x233>
movslq -0x58(%rbp),%rax
cmp    -0x48(%rbp),%rax
jbe    13d3 <chk_fork_prepare+0x233>
movl   $0x1,-0x74(%rbp)
movl   $0x1e,-0x78(%rbp)
movl   $0x28,-0x7c(%rbp)
movl   $0x21,-0x78(%rbp)
mov    0x2c33(%rip),%rax
mov    (%rax),%edi
mov    -0x74(%rbp),%ecx
mov    -0x78(%rbp),%r8d
mov    -0x7c(%rbp),%r9d
lea    0xce0(%rip),%rsi
mov    $0x1b,%edx
xor    %eax,%eax
movl   $0x1b,(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2bfb(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
movl   $0x1,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
je     15fb <chk_fork_prepare+0x45b>
cmpl   $0x0,-0x4c(%rbp)
je     146a <chk_fork_prepare+0x2ca>
movl   $0x1,-0x80(%rbp)
movl   $0x1e,-0x84(%rbp)
movl   $0x28,-0x88(%rbp)
movl   $0x21,-0x84(%rbp)
mov    0x2bad(%rip),%rax
mov    (%rax),%edi
mov    -0x80(%rbp),%ecx
mov    -0x84(%rbp),%r8d
mov    -0x88(%rbp),%r9d
lea    0xc8f(%rip),%rsi
mov    $0x1b,%edx
lea    0xcc1(%rip),%rax
xor    %r10d,%r10d
mov    %rax,(%rsp)
movl   $0x1b,0x8(%rsp)
movl   $0x0,0x10(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2b62(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    14fd <chk_fork_prepare+0x35d>
movl   $0x1,-0x8c(%rbp)
movl   $0x1e,-0x90(%rbp)
movl   $0x28,-0x94(%rbp)
movl   $0x21,-0x90(%rbp)
mov    0x2b27(%rip),%rax
mov    (%rax),%edi
mov    -0x8c(%rbp),%ecx
mov    -0x90(%rbp),%r8d
mov    -0x94(%rbp),%r9d
mov    -0x58(%rbp),%r10d
mov    -0x54(%rbp),%eax
lea    0xc43(%rip),%rsi
mov    $0x1b,%edx
lea    0xc31(%rip),%r11
xor    %ebx,%ebx
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
movl   $0x1b,0x18(%rsp)
movl   $0x0,0x20(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2aca(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    0x2acc(%rip),%rax
cmpq   $0x0,(%rax)
jle    1526 <chk_fork_prepare+0x386>
mov    -0x48(%rbp),%rax
movslq -0x58(%rbp),%rcx
cmp    %rcx,%rax
jae    1526 <chk_fork_prepare+0x386>
mov    -0x48(%rbp),%rax
mov    %eax,-0x58(%rbp)
mov    0x2aa3(%rip),%rax
cmpq   $0x0,(%rax)
jle    154f <chk_fork_prepare+0x3af>
mov    -0x48(%rbp),%rax
movslq -0x54(%rbp),%rcx
cmp    %rcx,%rax
jae    154f <chk_fork_prepare+0x3af>
mov    -0x48(%rbp),%rax
mov    %eax,-0x54(%rbp)
mov    0x2a82(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   10a0 <setrlimit@plt>
mov    0x2a70(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   10c0 <getrlimit@plt>
movl   $0x1,-0x98(%rbp)
movl   $0x1e,-0x9c(%rbp)
movl   $0x28,-0xa0(%rbp)
movl   $0x21,-0x9c(%rbp)
mov    0x2a1e(%rip),%rax
mov    (%rax),%edi
mov    -0x98(%rbp),%ecx
mov    -0x9c(%rbp),%r8d
mov    -0xa0(%rbp),%r9d
mov    -0x58(%rbp),%r10d
mov    -0x54(%rbp),%eax
lea    0xb77(%rip),%rsi
mov    $0x1b,%edx
xor    %r11d,%r11d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
movl   $0x1b,0x10(%rsp)
movl   $0x0,0x18(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x29cc(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
movslq -0xc(%rbp),%rax
mov    %rax,-0xa8(%rbp)
movl   $0x0,-0xac(%rbp)
movl   $0x0,-0xb0(%rbp)
mov    0x29b3(%rip),%rax
mov    (%rax),%edi
lea    -0xb8(%rbp),%rsi
call   10c0 <getrlimit@plt>
movl   $0x1,-0xbc(%rbp)
movl   $0x1e,-0xc0(%rbp)
movl   $0x28,-0xc4(%rbp)
movl   $0x25,-0xc0(%rbp)
mov    0x294e(%rip),%rax
mov    (%rax),%edi
mov    -0xbc(%rbp),%ecx
mov    -0xc0(%rbp),%r8d
mov    -0xc4(%rbp),%r9d
mov    -0xa8(%rbp),%r11
mov    -0xb8(%rbp),%r10d
mov    -0xb4(%rbp),%eax
lea    0xab6(%rip),%rsi
mov    $0x1b,%edx
xor    %ebx,%ebx
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
movl   $0x1b,0x18(%rsp)
movl   $0x0,0x20(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x28eb(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0xb8(%rbp),%eax
mov    0x28cf(%rip),%rcx
cmp    (%rcx),%eax
jne    1772 <chk_fork_prepare+0x5d2>
movl   $0x1,-0xac(%rbp)
movl   $0x1,-0xc8(%rbp)
movl   $0x1e,-0xcc(%rbp)
movl   $0x28,-0xd0(%rbp)
movl   $0x21,-0xcc(%rbp)
mov    0x2896(%rip),%rax
mov    (%rax),%edi
mov    -0xc8(%rbp),%ecx
mov    -0xcc(%rbp),%r8d
mov    -0xd0(%rbp),%r9d
lea    0x90a(%rip),%rsi
mov    $0x1b,%edx
xor    %eax,%eax
movl   $0x1b,(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2855(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
cmpq   $0x0,-0xa8(%rbp)
jbe    1815 <chk_fork_prepare+0x675>
movslq -0xb8(%rbp),%rax
cmp    -0xa8(%rbp),%rax
jbe    1815 <chk_fork_prepare+0x675>
movl   $0x1,-0xd4(%rbp)
movl   $0x1e,-0xd8(%rbp)
movl   $0x28,-0xdc(%rbp)
movl   $0x21,-0xd8(%rbp)
mov    0x27fd(%rip),%rax
mov    (%rax),%edi
mov    -0xd4(%rbp),%ecx
mov    -0xd8(%rbp),%r8d
mov    -0xdc(%rbp),%r9d
lea    0x8a1(%rip),%rsi
mov    $0x1b,%edx
xor    %eax,%eax
movl   $0x1b,(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x27bc(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
movl   $0x1,-0xb0(%rbp)
cmpl   $0x0,-0xb0(%rbp)
je     1a73 <chk_fork_prepare+0x8d3>
cmpl   $0x0,-0xac(%rbp)
je     18b8 <chk_fork_prepare+0x718>
movl   $0x1,-0xe0(%rbp)
movl   $0x1e,-0xe4(%rbp)
movl   $0x28,-0xe8(%rbp)
movl   $0x21,-0xe4(%rbp)
mov    0x2762(%rip),%rax
mov    (%rax),%edi
mov    -0xe0(%rbp),%ecx
mov    -0xe4(%rbp),%r8d
mov    -0xe8(%rbp),%r9d
lea    0x841(%rip),%rsi
mov    $0x1b,%edx
lea    0x90c(%rip),%rax
xor    %r10d,%r10d
mov    %rax,(%rsp)
movl   $0x1b,0x8(%rsp)
movl   $0x0,0x10(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2714(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    1951 <chk_fork_prepare+0x7b1>
movl   $0x1,-0xec(%rbp)
movl   $0x1e,-0xf0(%rbp)
movl   $0x28,-0xf4(%rbp)
movl   $0x21,-0xf0(%rbp)
mov    0x26d9(%rip),%rax
mov    (%rax),%edi
mov    -0xec(%rbp),%ecx
mov    -0xf0(%rbp),%r8d
mov    -0xf4(%rbp),%r9d
mov    -0xb8(%rbp),%r10d
mov    -0xb4(%rbp),%eax
lea    0x7ef(%rip),%rsi
mov    $0x1b,%edx
lea    0x876(%rip),%r11
xor    %ebx,%ebx
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
movl   $0x1b,0x18(%rsp)
movl   $0x0,0x20(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2676(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    0x2678(%rip),%rax
cmpq   $0x0,(%rax)
jle    1986 <chk_fork_prepare+0x7e6>
mov    -0xa8(%rbp),%rax
movslq -0xb8(%rbp),%rcx
cmp    %rcx,%rax
jae    1986 <chk_fork_prepare+0x7e6>
mov    -0xa8(%rbp),%rax
mov    %eax,-0xb8(%rbp)
mov    0x2643(%rip),%rax
cmpq   $0x0,(%rax)
jle    19bb <chk_fork_prepare+0x81b>
mov    -0xa8(%rbp),%rax
movslq -0xb4(%rbp),%rcx
cmp    %rcx,%rax
jae    19bb <chk_fork_prepare+0x81b>
mov    -0xa8(%rbp),%rax
mov    %eax,-0xb4(%rbp)
mov    0x2626(%rip),%rax
mov    (%rax),%edi
lea    -0xb8(%rbp),%rsi
call   10a0 <setrlimit@plt>
mov    0x2611(%rip),%rax
mov    (%rax),%edi
lea    -0xb8(%rbp),%rsi
call   10c0 <getrlimit@plt>
movl   $0x1,-0xf8(%rbp)
movl   $0x1e,-0xfc(%rbp)
movl   $0x28,-0x100(%rbp)
movl   $0x21,-0xfc(%rbp)
mov    0x25ac(%rip),%rax
mov    (%rax),%edi
mov    -0xf8(%rbp),%ecx
mov    -0xfc(%rbp),%r8d
mov    -0x100(%rbp),%r9d
mov    -0xb8(%rbp),%r10d
mov    -0xb4(%rbp),%eax
lea    0x6ff(%rip),%rsi
mov    $0x1b,%edx
xor    %r11d,%r11d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
movl   $0x1b,0x10(%rsp)
movl   $0x0,0x18(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2554(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    0x2536(%rip),%rax
mov    (%rax),%rax
add    $0x128,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<chk_fork_prepare>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movl   $0xffffffff,0xc(%rsp)
ff
lea    0xe43(%rip),%rbx
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <stat@plt>
mov    0x2ddf(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1050 <assert@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10b0 <open@plt>
mov    %eax,%ebx
lea    0x10(%rsp),%r14
mov    %eax,%edi
mov    %r14,%rsi
mov    $0x20,%edx
call   1040 <read@plt>
lea    0xe0c(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
call   1090 <sscanf@plt>
mov    %ebx,%edi
call   1030 <close@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
movslq 0xc(%rsp),%r12
mov    0x2d97(%rip),%r13
mov    0x0(%r13),%edi
lea    0x10(%rsp),%rsi
call   10c0 <getrlimit@plt>
mov    0x2d6a(%rip),%r14
mov    (%r14),%edi
mov    0x10(%rsp),%ebp
mov    0x14(%rsp),%ebx
sub    $0x8,%rsp
lea    0xdb0(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x25,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
push   %rbx
push   %rbp
push   %r12
call   1060 <fprintf@plt>
add    $0x30,%rsp
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    0x10(%rsp),%ebp
mov    0x2d10(%rip),%rax
mov    (%rax),%r15d
mov    %ebp,%eax
cmp    %r15d,%ebp
jne    12ed <chk_fork_prepare+0x14d>
mov    (%r14),%edi
lea    0xd95(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x21,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
call   1060 <fprintf@plt>
add    $0x10,%rsp
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    0x10(%rsp),%eax
test   %r12d,%r12d
je     144d <chk_fork_prepare+0x2ad>
cmp    %r12d,%eax
jbe    144d <chk_fork_prepare+0x2ad>
mov    (%r14),%edi
lea    0xd78(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x21,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
call   1060 <fprintf@plt>
add    $0x10,%rsp
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    (%r14),%edi
cmp    %r15d,%ebp
jne    1378 <chk_fork_prepare+0x1d8>
sub    $0x8,%rsp
lea    0xdb1(%rip),%rbp
lea    0xd6c(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x21,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
push   %rbp
call   1060 <fprintf@plt>
add    $0x20,%rsp
jmp    13bb <chk_fork_prepare+0x21b>
mov    0x10(%rsp),%ebp
mov    0x14(%rsp),%ebx
sub    $0x8,%rsp
lea    0xd6f(%rip),%r10
lea    0xd6e(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x21,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
push   %rbx
push   %rbp
push   %r10
call   1060 <fprintf@plt>
add    $0x30,%rsp
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    0x2c06(%rip),%rax
mov    (%rax),%rax
test   %rax,%rax
jle    13de <chk_fork_prepare+0x23e>
cmp    0x10(%rsp),%r12d
jae    13de <chk_fork_prepare+0x23e>
mov    %r12d,0x10(%rsp)
test   %rax,%rax
jle    13ef <chk_fork_prepare+0x24f>
cmp    0x14(%rsp),%r12d
jae    13ef <chk_fork_prepare+0x24f>
mov    %r12d,0x14(%rsp)
mov    0x0(%r13),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   10a0 <setrlimit@plt>
mov    0x0(%r13),%edi
mov    %rbx,%rsi
call   10c0 <getrlimit@plt>
mov    (%r14),%edi
mov    0x10(%rsp),%ebp
mov    0x14(%rsp),%ebx
lea    0xd1f(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x21,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
push   %rbx
push   %rbp
call   1060 <fprintf@plt>
add    $0x20,%rsp
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
movslq 0xc(%rsp),%r15
mov    0x2b7b(%rip),%r13
mov    0x0(%r13),%edi
lea    0x10(%rsp),%rsi
call   10c0 <getrlimit@plt>
mov    (%r14),%edi
mov    0x10(%rsp),%ebp
mov    0x14(%rsp),%ebx
sub    $0x8,%rsp
lea    0xcc8(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x25,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
push   %rbx
push   %rbp
push   %r15
call   1060 <fprintf@plt>
add    $0x30,%rsp
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    0x10(%rsp),%ebp
mov    0x2aeb(%rip),%rax
mov    (%rax),%ebx
mov    %ebp,%eax
cmp    %ebx,%ebp
jne    1510 <chk_fork_prepare+0x370>
mov    (%r14),%edi
lea    0xb72(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x21,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
call   1060 <fprintf@plt>
add    $0x10,%rsp
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    0x10(%rsp),%eax
test   %r15d,%r15d
je     166f <chk_fork_prepare+0x4cf>
cmp    %r15d,%eax
jbe    166f <chk_fork_prepare+0x4cf>
mov    (%r14),%edi
lea    0xb55(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x21,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
call   1060 <fprintf@plt>
add    $0x10,%rsp
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    (%r14),%edi
cmp    %ebx,%ebp
jne    159a <chk_fork_prepare+0x3fa>
sub    $0x8,%rsp
lea    0xc28(%rip),%rbp
lea    0xb4a(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x21,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
push   %rbp
call   1060 <fprintf@plt>
add    $0x20,%rsp
jmp    15dd <chk_fork_prepare+0x43d>
mov    0x10(%rsp),%ebp
mov    0x14(%rsp),%ebx
sub    $0x8,%rsp
lea    0xbe6(%rip),%r10
lea    0xb4c(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x21,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
push   %rbx
push   %rbp
push   %r10
call   1060 <fprintf@plt>
add    $0x30,%rsp
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    0x29e4(%rip),%rax
mov    (%rax),%rax
test   %rax,%rax
jle    1600 <chk_fork_prepare+0x460>
cmp    0x10(%rsp),%r15d
jae    1600 <chk_fork_prepare+0x460>
mov    %r15d,0x10(%rsp)
test   %rax,%rax
jle    1611 <chk_fork_prepare+0x471>
cmp    0x14(%rsp),%r15d
jae    1611 <chk_fork_prepare+0x471>
mov    %r15d,0x14(%rsp)
mov    0x0(%r13),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   10a0 <setrlimit@plt>
mov    0x0(%r13),%edi
mov    %rbx,%rsi
call   10c0 <getrlimit@plt>
mov    (%r14),%edi
mov    0x10(%rsp),%ebp
mov    0x14(%rsp),%ebx
lea    0xafd(%rip),%rsi
mov    $0x1b,%edx
mov    $0x1,%ecx
mov    $0x21,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
push   $0x0
push   $0x1b
push   %rbx
push   %rbp
call   1060 <fprintf@plt>
add    $0x20,%rsp
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    0x293a(%rip),%rax
mov    (%rax),%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.rlimit = type { i32, i32 }
@.str = [25 x i8] c"/proc/sys/kernel/pid_max\00"
@EXIT_SUCCESS = global i64 0
@O_RDONLY = global i32 0
@.str.1 = [3 x i8] c"%i\00"
@RLIMIT_NPROC = global i32 0
@stdout = global i32 0
@.str.2 = [53 x i8] c"%c[%d;%d;%dmI NPROC syslim:%lu usrlim:%lu:%lu\0A%c[%dm\00"
@RLIM_INFINITY = global i32 0
@.str.3 = [48 x i8] c"%c[%d;%d;%dmW \\___User limit is unbound!\0A%c[%dm\00"
@.str.4 = [59 x i8] c"%c[%d;%d;%dmW \\___ User limit exceeds system limit!\0A%c[%dm\00"
@.str.5 = [62 x i8] c"%c[%d;%d;%dmW \\___ Changing %s limit from INFINITY to%c[%dm\00"
@.str.6 = [6 x i8] c"NPROC\00"
@.str.7 = [61 x i8] c"%c[%d;%d;%dmW \\___ Changing %s limit from %lu:%lu to%c[%dm\00"
@system = global i64 0
@.str.8 = [28 x i8] c"%c[%d;%d;%dm %lu:%lu\0A%c[%dm\00"
@RLIMIT_SIGPENDING = global i32 0
@.str.9 = [58 x i8] c"%c[%d;%d;%dmI SIGPENDING syslim:%lu usrlim:%lu:%lu\0A%c[%dm\00"
@.str.10 = [11 x i8] c"SIGPENDING\00"
define i32 @chk_fork_prepare() {
%1 = alloca i32
%2 = alloca [32 x i8]
%3 = alloca %struct.stat
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.rlimit
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i64
%28 = alloca i32
%29 = alloca i32
%30 = alloca %struct.rlimit
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
%41 = alloca i32
%42 = alloca i32
%43 = alloca i32
%44 = alloca i32
%45 = alloca i32
%46 = alloca i32
%47 = alloca i32
%48 = alloca i32
store i32 -1, i32* %1
%49 = call i64 @stat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), %struct.stat* %3)
%50 = load i64, i64* @EXIT_SUCCESS
%51 = icmp eq i64 %49, %50
%52 = zext i1 %51 to i32
%53 = call i64 @assert(i32 %52)
%54 = load i32, i32* @O_RDONLY
%55 = call i32 @open(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %54)
store i32 %55, i32* %4
%56 = load i32, i32* %4
%57 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%58 = call i32 @read(i32 %56, i8* %57, i32 32)
%59 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%60 = call i32 @sscanf(i8* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%61 = load i32, i32* %4
%62 = call i32 @close(i32 %61)
%63 = call i64 @assert(i32 1)
%64 = call i64 @assert(i32 1)
%65 = load i32, i32* %1
%66 = sext i32 %65 to i64
store i64 %66, i64* %5
store i32 0, i32* %6
store i32 0, i32* %7
%67 = load i32, i32* @RLIMIT_NPROC
%68 = call i32 @getrlimit(i32 %67, %struct.rlimit* %8)
store i32 1, i32* %9
store i32 30, i32* %10
store i32 40, i32* %11
store i32 37, i32* %10
%69 = load i32, i32* @stdout
%70 = load i32, i32* %9
%71 = load i32, i32* %10
%72 = load i32, i32* %11
%73 = load i64, i64* %5
%74 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 0
%75 = load i32, i32* %74
%76 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 1
%77 = load i32, i32* %76
%78 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i32 27, i32 %70, i32 %71, i32 %72, i64 %73, i32 %75, i32 %77, i32 27, i32 0)
%79 = load i32, i32* @stdout
%80 = call i32 @fflush(i32 %79)
%81 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 0
%82 = load i32, i32* %81
%83 = load i32, i32* @RLIM_INFINITY
%84 = icmp eq i32 %82, %83
br i1 %84, label %85, label %93
85: ; preds = %0
store i32 1, i32* %6
store i32 1, i32* %12
store i32 30, i32* %13
store i32 40, i32* %14
store i32 33, i32* %13
%86 = load i32, i32* @stdout
%87 = load i32, i32* %12
%88 = load i32, i32* %13
%89 = load i32, i32* %14
%90 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 27, i32 %87, i32 %88, i32 %89, i32 27, i32 0)
%91 = load i32, i32* @stdout
%92 = call i32 @fflush(i32 %91)
br label %93
93: ; preds = %85, %0
%94 = load i64, i64* %5
%95 = icmp ugt i64 %94, 0
br i1 %95, label %96, label %110
96: ; preds = %93
%97 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 0
%98 = load i32, i32* %97
%99 = sext i32 %98 to i64
%100 = load i64, i64* %5
%101 = icmp ugt i64 %99, %100
br i1 %101, label %102, label %110
102: ; preds = %96
store i32 1, i32* %15
store i32 30, i32* %16
store i32 40, i32* %17
store i32 33, i32* %16
%103 = load i32, i32* @stdout
%104 = load i32, i32* %15
%105 = load i32, i32* %16
%106 = load i32, i32* %17
%107 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i32 27, i32 %104, i32 %105, i32 %106, i32 27, i32 0)
%108 = load i32, i32* @stdout
%109 = call i32 @fflush(i32 %108)
store i32 1, i32* %7
br label %110
110: ; preds = %102, %96, %93
%111 = load i32, i32* %7
%112 = icmp ne i32 %111, 0
br i1 %112, label %113, label %178
113: ; preds = %110
%114 = load i32, i32* %6
%115 = icmp ne i32 %114, 0
br i1 %115, label %116, label %124
116: ; preds = %113
store i32 1, i32* %18
store i32 30, i32* %19
store i32 40, i32* %20
store i32 33, i32* %19
%117 = load i32, i32* @stdout
%118 = load i32, i32* %18
%119 = load i32, i32* %19
%120 = load i32, i32* %20
%121 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i32 27, i32 %118, i32 %119, i32 %120, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 27, i32 0)
%122 = load i32, i32* @stdout
%123 = call i32 @fflush(i32 %122)
br label %136
124: ; preds = %113
store i32 1, i32* %21
store i32 30, i32* %22
store i32 40, i32* %23
store i32 33, i32* %22
%125 = load i32, i32* @stdout
%126 = load i32, i32* %21
%127 = load i32, i32* %22
%128 = load i32, i32* %23
%129 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 0
%130 = load i32, i32* %129
%131 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 1
%132 = load i32, i32* %131
%133 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0), i32 27, i32 %126, i32 %127, i32 %128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %130, i32 %132, i32 27, i32 0)
%134 = load i32, i32* @stdout
%135 = call i32 @fflush(i32 %134)
br label %136
136: ; preds = %124, %116
%137 = load i64, i64* @system
%138 = icmp sgt i64 %137, 0
br i1 %138, label %139, label %149
139: ; preds = %136
%140 = load i64, i64* %5
%141 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 0
%142 = load i32, i32* %141
%143 = sext i32 %142 to i64
%144 = icmp ult i64 %140, %143
br i1 %144, label %145, label %149
145: ; preds = %139
%146 = load i64, i64* %5
%147 = trunc i64 %146 to i32
%148 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 0
store i32 %147, i32* %148
br label %149
149: ; preds = %145, %139, %136
%150 = load i64, i64* @system
%151 = icmp sgt i64 %150, 0
br i1 %151, label %152, label %162
152: ; preds = %149
%153 = load i64, i64* %5
%154 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 1
%155 = load i32, i32* %154
%156 = sext i32 %155 to i64
%157 = icmp ult i64 %153, %156
br i1 %157, label %158, label %162
158: ; preds = %152
%159 = load i64, i64* %5
%160 = trunc i64 %159 to i32
%161 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 1
store i32 %160, i32* %161
br label %162
162: ; preds = %158, %152, %149
%163 = load i32, i32* @RLIMIT_NPROC
%164 = call i32 @setrlimit(i32 %163, %struct.rlimit* %8)
%165 = load i32, i32* @RLIMIT_NPROC
%166 = call i32 @getrlimit(i32 %165, %struct.rlimit* %8)
store i32 1, i32* %24
store i32 30, i32* %25
store i32 40, i32* %26
store i32 33, i32* %25
%167 = load i32, i32* @stdout
%168 = load i32, i32* %24
%169 = load i32, i32* %25
%170 = load i32, i32* %26
%171 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 0
%172 = load i32, i32* %171
%173 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %8, i32 0, i32 1
%174 = load i32, i32* %173
%175 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %167, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 27, i32 %168, i32 %169, i32 %170, i32 %172, i32 %174, i32 27, i32 0)
%176 = load i32, i32* @stdout
%177 = call i32 @fflush(i32 %176)
br label %178
178: ; preds = %162, %110
%179 = call i64 @assert(i32 1)
%180 = call i64 @assert(i32 1)
%181 = load i32, i32* %1
%182 = sext i32 %181 to i64
store i64 %182, i64* %27
store i32 0, i32* %28
store i32 0, i32* %29
%183 = load i32, i32* @RLIMIT_SIGPENDING
%184 = call i32 @getrlimit(i32 %183, %struct.rlimit* %30)
store i32 1, i32* %31
store i32 30, i32* %32
store i32 40, i32* %33
store i32 37, i32* %32
%185 = load i32, i32* @stdout
%186 = load i32, i32* %31
%187 = load i32, i32* %32
%188 = load i32, i32* %33
%189 = load i64, i64* %27
%190 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 0
%191 = load i32, i32* %190
%192 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 1
%193 = load i32, i32* %192
%194 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %185, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i64 0, i64 0), i32 27, i32 %186, i32 %187, i32 %188, i64 %189, i32 %191, i32 %193, i32 27, i32 0)
%195 = load i32, i32* @stdout
%196 = call i32 @fflush(i32 %195)
%197 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 0
%198 = load i32, i32* %197
%199 = load i32, i32* @RLIM_INFINITY
%200 = icmp eq i32 %198, %199
br i1 %200, label %201, label %209
201: ; preds = %178
store i32 1, i32* %28
store i32 1, i32* %34
store i32 30, i32* %35
store i32 40, i32* %36
store i32 33, i32* %35
%202 = load i32, i32* @stdout
%203 = load i32, i32* %34
%204 = load i32, i32* %35
%205 = load i32, i32* %36
%206 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %202, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 27, i32 %203, i32 %204, i32 %205, i32 27, i32 0)
%207 = load i32, i32* @stdout
%208 = call i32 @fflush(i32 %207)
br label %209
209: ; preds = %201, %178
%210 = load i64, i64* %27
%211 = icmp ugt i64 %210, 0
br i1 %211, label %212, label %226
212: ; preds = %209
%213 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 0
%214 = load i32, i32* %213
%215 = sext i32 %214 to i64
%216 = load i64, i64* %27
%217 = icmp ugt i64 %215, %216
br i1 %217, label %218, label %226
218: ; preds = %212
store i32 1, i32* %37
store i32 30, i32* %38
store i32 40, i32* %39
store i32 33, i32* %38
%219 = load i32, i32* @stdout
%220 = load i32, i32* %37
%221 = load i32, i32* %38
%222 = load i32, i32* %39
%223 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %219, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i32 27, i32 %220, i32 %221, i32 %222, i32 27, i32 0)
%224 = load i32, i32* @stdout
%225 = call i32 @fflush(i32 %224)
store i32 1, i32* %29
br label %226
226: ; preds = %218, %212, %209
%227 = load i32, i32* %29
%228 = icmp ne i32 %227, 0
br i1 %228, label %229, label %294
229: ; preds = %226
%230 = load i32, i32* %28
%231 = icmp ne i32 %230, 0
br i1 %231, label %232, label %240
232: ; preds = %229
store i32 1, i32* %40
store i32 30, i32* %41
store i32 40, i32* %42
store i32 33, i32* %41
%233 = load i32, i32* @stdout
%234 = load i32, i32* %40
%235 = load i32, i32* %41
%236 = load i32, i32* %42
%237 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %233, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i32 27, i32 %234, i32 %235, i32 %236, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 27, i32 0)
%238 = load i32, i32* @stdout
%239 = call i32 @fflush(i32 %238)
br label %252
240: ; preds = %229
store i32 1, i32* %43
store i32 30, i32* %44
store i32 40, i32* %45
store i32 33, i32* %44
%241 = load i32, i32* @stdout
%242 = load i32, i32* %43
%243 = load i32, i32* %44
%244 = load i32, i32* %45
%245 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 0
%246 = load i32, i32* %245
%247 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 1
%248 = load i32, i32* %247
%249 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %241, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0), i32 27, i32 %242, i32 %243, i32 %244, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %246, i32 %248, i32 27, i32 0)
%250 = load i32, i32* @stdout
%251 = call i32 @fflush(i32 %250)
br label %252
252: ; preds = %240, %232
%253 = load i64, i64* @system
%254 = icmp sgt i64 %253, 0
br i1 %254, label %255, label %265
255: ; preds = %252
%256 = load i64, i64* %27
%257 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 0
%258 = load i32, i32* %257
%259 = sext i32 %258 to i64
%260 = icmp ult i64 %256, %259
br i1 %260, label %261, label %265
261: ; preds = %255
%262 = load i64, i64* %27
%263 = trunc i64 %262 to i32
%264 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 0
store i32 %263, i32* %264
br label %265
265: ; preds = %261, %255, %252
%266 = load i64, i64* @system
%267 = icmp sgt i64 %266, 0
br i1 %267, label %268, label %278
268: ; preds = %265
%269 = load i64, i64* %27
%270 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 1
%271 = load i32, i32* %270
%272 = sext i32 %271 to i64
%273 = icmp ult i64 %269, %272
br i1 %273, label %274, label %278
274: ; preds = %268
%275 = load i64, i64* %27
%276 = trunc i64 %275 to i32
%277 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 1
store i32 %276, i32* %277
br label %278
278: ; preds = %274, %268, %265
%279 = load i32, i32* @RLIMIT_SIGPENDING
%280 = call i32 @setrlimit(i32 %279, %struct.rlimit* %30)
%281 = load i32, i32* @RLIMIT_SIGPENDING
%282 = call i32 @getrlimit(i32 %281, %struct.rlimit* %30)
store i32 1, i32* %46
store i32 30, i32* %47
store i32 40, i32* %48
store i32 33, i32* %47
%283 = load i32, i32* @stdout
%284 = load i32, i32* %46
%285 = load i32, i32* %47
%286 = load i32, i32* %48
%287 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 0
%288 = load i32, i32* %287
%289 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %30, i32 0, i32 1
%290 = load i32, i32* %289
%291 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %283, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 27, i32 %284, i32 %285, i32 %286, i32 %288, i32 %290, i32 27, i32 0)
%292 = load i32, i32* @stdout
%293 = call i32 @fflush(i32 %292)
br label %294
294: ; preds = %278, %226
%295 = load i64, i64* @EXIT_SUCCESS
%296 = trunc i64 %295 to i32
ret i32 %296
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.rlimit = type { i32, i32 }
@.str = [25 x i8] c"/proc/sys/kernel/pid_max\00"
@EXIT_SUCCESS = global i64 0
@O_RDONLY = global i32 0
@.str.1 = [3 x i8] c"%i\00"
@RLIMIT_NPROC = global i32 0
@stdout = global i32 0
@.str.2 = [53 x i8] c"%c[%d;%d;%dmI NPROC syslim:%lu usrlim:%lu:%lu\0A%c[%dm\00"
@RLIM_INFINITY = global i32 0
@.str.3 = [48 x i8] c"%c[%d;%d;%dmW \\___User limit is unbound!\0A%c[%dm\00"
@.str.4 = [59 x i8] c"%c[%d;%d;%dmW \\___ User limit exceeds system limit!\0A%c[%dm\00"
@.str.5 = [62 x i8] c"%c[%d;%d;%dmW \\___ Changing %s limit from INFINITY to%c[%dm\00"
@.str.6 = [6 x i8] c"NPROC\00"
@.str.7 = [61 x i8] c"%c[%d;%d;%dmW \\___ Changing %s limit from %lu:%lu to%c[%dm\00"
@system = global i64 0
@.str.8 = [28 x i8] c"%c[%d;%d;%dm %lu:%lu\0A%c[%dm\00"
@RLIMIT_SIGPENDING = global i32 0
@.str.9 = [58 x i8] c"%c[%d;%d;%dmI SIGPENDING syslim:%lu usrlim:%lu:%lu\0A%c[%dm\00"
@.str.10 = [11 x i8] c"SIGPENDING\00"
define i32 @chk_fork_prepare() {
%1 = alloca i32
%2 = alloca [32 x i8]
%3 = alloca %struct.stat
%4 = alloca %struct.rlimit
%5 = alloca %struct.rlimit
%6 = bitcast i32* %1 to i8*
store i32 -1, i32* %1
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%8 = bitcast %struct.stat* %3 to i8*
%9 = call i64 @stat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), %struct.stat* %3)
%10 = load i64, i64* @EXIT_SUCCESS
%11 = icmp eq i64 %9, %10
%12 = zext i1 %11 to i32
%13 = call i64 @assert(i32 %12)
%14 = load i32, i32* @O_RDONLY
%15 = call i32 @open(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 @read(i32 %15, i8* %7, i32 32)
%17 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%18 = call i32 @close(i32 %15)
%19 = call i64 @assert(i32 1)
%20 = call i64 @assert(i32 1)
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = bitcast %struct.rlimit* %4 to i8*
%24 = load i32, i32* @RLIMIT_NPROC
%25 = call i32 @getrlimit(i32 %24, %struct.rlimit* %4)
%26 = load i32, i32* @stdout
%27 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %4, i64 0, i32 0
%28 = load i32, i32* %27
%29 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %4, i64 0, i32 1
%30 = load i32, i32* %29
%31 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i32 27, i32 1, i32 37, i32 40, i64 %22, i32 %28, i32 %30, i32 27, i32 0)
%32 = load i32, i32* @stdout
%33 = call i32 @fflush(i32 %32)
%34 = load i32, i32* %27
%35 = load i32, i32* @RLIM_INFINITY
%36 = icmp eq i32 %34, %35
br i1 %36, label %37, label %43
37: ; preds = %0
%38 = load i32, i32* @stdout
%39 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 27, i32 1, i32 33, i32 40, i32 27, i32 0)
%40 = load i32, i32* @stdout
%41 = call i32 @fflush(i32 %40)
%42 = load i32, i32* %27
br label %43
43: ; preds = %37, %0
%44 = phi i32 [ %42, %37 ], [ %34, %0 ]
%45 = icmp ne i32 %21, 0
%46 = icmp ugt i32 %44, %21
%47 = select i1 %45, i1 %46, i1 false
br i1 %47, label %48, label %85
48: ; preds = %43
%49 = load i32, i32* @stdout
%50 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i32 27, i32 1, i32 33, i32 40, i32 27, i32 0)
%51 = load i32, i32* @stdout
%52 = call i32 @fflush(i32 %51)
%53 = load i32, i32* @stdout
br i1 %36, label %54, label %56
54: ; preds = %48
%55 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i32 27, i32 1, i32 33, i32 40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 27, i32 0)
br label %60
56: ; preds = %48
%57 = load i32, i32* %27
%58 = load i32, i32* %29
%59 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0), i32 27, i32 1, i32 33, i32 40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %57, i32 %58, i32 27, i32 0)
br label %60
60: ; preds = %56, %54
%61 = load i32, i32* @stdout
%62 = call i32 @fflush(i32 %61)
%63 = load i64, i64* @system
%64 = icmp sgt i64 %63, 0
%65 = load i32, i32* %27
%66 = icmp ult i32 %21, %65
%67 = select i1 %64, i1 %66, i1 false
br i1 %67, label %68, label %69
68: ; preds = %60
store i32 %21, i32* %27
br label %69
69: ; preds = %68, %60
%70 = load i32, i32* %29
%71 = icmp ult i32 %21, %70
%72 = select i1 %64, i1 %71, i1 false
br i1 %72, label %73, label %74
73: ; preds = %69
store i32 %21, i32* %29
br label %74
74: ; preds = %73, %69
%75 = load i32, i32* @RLIMIT_NPROC
%76 = call i32 @setrlimit(i32 %75, %struct.rlimit* %4)
%77 = load i32, i32* @RLIMIT_NPROC
%78 = call i32 @getrlimit(i32 %77, %struct.rlimit* %4)
%79 = load i32, i32* @stdout
%80 = load i32, i32* %27
%81 = load i32, i32* %29
%82 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 27, i32 1, i32 33, i32 40, i32 %80, i32 %81, i32 27, i32 0)
%83 = load i32, i32* @stdout
%84 = call i32 @fflush(i32 %83)
br label %85
85: ; preds = %43, %74
%86 = call i64 @assert(i32 1)
%87 = call i64 @assert(i32 1)
%88 = load i32, i32* %1
%89 = sext i32 %88 to i64
%90 = bitcast %struct.rlimit* %5 to i8*
%91 = load i32, i32* @RLIMIT_SIGPENDING
%92 = call i32 @getrlimit(i32 %91, %struct.rlimit* %5)
%93 = load i32, i32* @stdout
%94 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %5, i64 0, i32 0
%95 = load i32, i32* %94
%96 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %5, i64 0, i32 1
%97 = load i32, i32* %96
%98 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %93, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i64 0, i64 0), i32 27, i32 1, i32 37, i32 40, i64 %89, i32 %95, i32 %97, i32 27, i32 0)
%99 = load i32, i32* @stdout
%100 = call i32 @fflush(i32 %99)
%101 = load i32, i32* %94
%102 = load i32, i32* @RLIM_INFINITY
%103 = icmp eq i32 %101, %102
br i1 %103, label %104, label %110
104: ; preds = %85
%105 = load i32, i32* @stdout
%106 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %105, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 27, i32 1, i32 33, i32 40, i32 27, i32 0)
%107 = load i32, i32* @stdout
%108 = call i32 @fflush(i32 %107)
%109 = load i32, i32* %94
br label %110
110: ; preds = %104, %85
%111 = phi i32 [ %109, %104 ], [ %101, %85 ]
%112 = icmp ne i32 %88, 0
%113 = icmp ugt i32 %111, %88
%114 = select i1 %112, i1 %113, i1 false
br i1 %114, label %115, label %152
115: ; preds = %110
%116 = load i32, i32* @stdout
%117 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i32 27, i32 1, i32 33, i32 40, i32 27, i32 0)
%118 = load i32, i32* @stdout
%119 = call i32 @fflush(i32 %118)
%120 = load i32, i32* @stdout
br i1 %103, label %121, label %123
121: ; preds = %115
%122 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %120, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i32 27, i32 1, i32 33, i32 40, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 27, i32 0)
br label %127
123: ; preds = %115
%124 = load i32, i32* %94
%125 = load i32, i32* %96
%126 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %120, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0), i32 27, i32 1, i32 33, i32 40, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %124, i32 %125, i32 27, i32 0)
br label %127
127: ; preds = %123, %121
%128 = load i32, i32* @stdout
%129 = call i32 @fflush(i32 %128)
%130 = load i64, i64* @system
%131 = icmp sgt i64 %130, 0
%132 = load i32, i32* %94
%133 = icmp ult i32 %88, %132
%134 = select i1 %131, i1 %133, i1 false
br i1 %134, label %135, label %136
135: ; preds = %127
store i32 %88, i32* %94
br label %136
136: ; preds = %135, %127
%137 = load i32, i32* %96
%138 = icmp ult i32 %88, %137
%139 = select i1 %131, i1 %138, i1 false
br i1 %139, label %140, label %141
140: ; preds = %136
store i32 %88, i32* %96
br label %141
141: ; preds = %140, %136
%142 = load i32, i32* @RLIMIT_SIGPENDING
%143 = call i32 @setrlimit(i32 %142, %struct.rlimit* %5)
%144 = load i32, i32* @RLIMIT_SIGPENDING
%145 = call i32 @getrlimit(i32 %144, %struct.rlimit* %5)
%146 = load i32, i32* @stdout
%147 = load i32, i32* %94
%148 = load i32, i32* %96
%149 = call i32 (i32, i8*, i32, i32, i32, i32, ...) @fprintf(i32 %146, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 27, i32 1, i32 33, i32 40, i32 %147, i32 %148, i32 27, i32 0)
%150 = load i32, i32* @stdout
%151 = call i32 @fflush(i32 %150)
br label %152
152: ; preds = %110, %141
%153 = load i64, i64* @EXIT_SUCCESS
%154 = trunc i64 %153 to i32
ret i32 %154
}