#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
char **calloc(int, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exec_child(char **, char **, int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ getloadavg(double *, int);
int getopt(int, char **, char *);
char *optarg;
size_t optind;
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
char *strdup(char *);
char *strlen(char *);
double strtod(char *, char **);
int strtoul(char *, char **, int /*<<< orphan*/);
int /*<<< orphan*/ usage();
int wait_for_child(int /*<<< orphan*/);
int main(int argc, char **argv) {
  int maxjobs = -1;
  int curjobs = 0;
  double maxload = -1;
  int argsatonce = 1;
  int opt;
  char **command = calloc(sizeof(char *), argc);
  char **arguments = NULL;
  int argidx = 0;
  int arglen = 0;
  int cidx = 0;
  int returncode = 0;
  int replace_cb = 0;
  char *t;
  while ((argv[optind] && strcmp(argv[optind], "--") != 0) &&
         (opt = getopt(argc, argv, "+hij:l:n:")) != -1) {
    switch (opt) {
    case 'h':
      usage();
      break;
    case 'i':
      replace_cb = 1;
      break;
    case 'j':
      errno = 0;
      maxjobs = strtoul(optarg, &t, 0);
      if (errno != 0 || (t - optarg) != strlen(optarg)) {
        fprintf(stderr, "option '%s' is not a number\n", optarg);
        exit(2);
      }
      break;
    case 'l':
      errno = 0;
      maxload = strtod(optarg, &t);
      if (errno != 0 || (t - optarg) != strlen(optarg)) {
        fprintf(stderr, "option '%s' is not a number\n", optarg);
        exit(2);
      }
      break;
    case 'n':
      errno = 0;
      argsatonce = strtoul(optarg, &t, 0);
      if (errno != 0 || argsatonce < 1 || (t - optarg) != strlen(optarg)) {
        fprintf(stderr, "option '%s' is not a positive number\n", optarg);
        exit(2);
      }
      break;
    default:
      usage();
      break;
    }
  }
  if (replace_cb && argsatonce > 1) {
    fprintf(stderr, "options -i and -n are incomaptible\n");
    exit(2);
  }
  if (maxjobs < 0) {
    maxjobs = 1;
  }
  while (optind < argc) {
    if (strcmp(argv[optind], "--") == 0) {
      int i;
      optind++;
      arglen = argc - optind;
      arguments = calloc(sizeof(char *), arglen);
      if (!arguments) {
        exit(1);
      }
      for (i = 0; i < arglen; i++) {
        arguments[i] = strdup(argv[optind + i]);
      }
      optind += i;
    } else {
      command[cidx] = strdup(argv[optind]);
      cidx++;
    }
    optind++;
  }
  if (argsatonce > 1 && !command[0]) {
    fprintf(stderr, "option -n cannot be used without a command\n");
    exit(2);
  }
  while (argidx < arglen) {
    double load;
    getloadavg(&load, 1);
    if ((maxjobs == 0 || curjobs < maxjobs) &&
        (maxload < 0 || load < maxload)) {
      if (argsatonce > arglen - argidx)
        argsatonce = arglen - argidx;
      exec_child(command, arguments + argidx, replace_cb, argsatonce);
      argidx += argsatonce;
      curjobs++;
    }
    if (maxjobs == 0 || curjobs == maxjobs) {
      returncode |= wait_for_child(0);
      curjobs--;
    }
    if (maxload > 0 && load >= maxload) {
      int r;
      sleep(1);
      r = wait_for_child(WNOHANG);
      if (r > 0)
        returncode |= r;
      if (r != -1)
        curjobs--;
    }
  }
  while (curjobs > 0) {
    returncode |= wait_for_child(0);
    curjobs--;
  }
  return returncode;
}


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   $0xffffffff,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movsd  0xdf1(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x8,%edi
call   1060 <calloc@plt>
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x10(%rbp),%rcx
mov    0x2d76(%rip),%rax
mov    (%rax),%rdx
xor    %eax,%eax
cmpq   $0x0,(%rcx,%rdx,8)
mov    %al,-0x6d(%rbp)
je     12c4 <main+0xe4>
mov    -0x10(%rbp),%rax
mov    0x2d58(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd96(%rip),%rsi
call   1070 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x6d(%rbp)
je     12c4 <main+0xe4>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd74(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
setne  %al
mov    %al,-0x6d(%rbp)
mov    -0x6d(%rbp),%al
test   $0x1,%al
jne    12d4 <main+0xf4>
jmp    1502 <main+0x322>
mov    -0x28(%rbp),%eax
add    $0xffffff98,%eax
mov    %eax,%ecx
mov    %rcx,-0x78(%rbp)
sub    $0x6,%eax
ja     14f6 <main+0x316>
mov    -0x78(%rbp),%rax
lea    0xd14(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10a0 <usage@plt>
jmp    14fd <main+0x31d>
movl   $0x1,-0x4c(%rbp)
jmp    14fd <main+0x31d>
mov    0x2ca4(%rip),%rax
movl   $0x0,(%rax)
mov    0x2ccf(%rip),%rax
mov    (%rax),%rdi
lea    -0x58(%rbp),%rsi
xor    %edx,%edx
call   10c0 <strtoul@plt>
mov    %eax,-0x14(%rbp)
mov    0x2c7f(%rip),%rax
cmpl   $0x0,(%rax)
jne    137e <main+0x19e>
mov    -0x58(%rbp),%rax
mov    0x2ca3(%rip),%rcx
mov    (%rcx),%rcx
sub    %rcx,%rax
mov    %rax,-0x80(%rbp)
mov    0x2c92(%rip),%rax
mov    (%rax),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x80(%rbp),%rax
cmp    %rcx,%rax
je     13a9 <main+0x1c9>
mov    0x2c43(%rip),%rax
mov    (%rax),%edi
mov    0x2c6a(%rip),%rax
mov    (%rax),%rdx
lea    0xc99(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
jmp    14fd <main+0x31d>
mov    0x2c0b(%rip),%rax
movl   $0x0,(%rax)
mov    0x2c36(%rip),%rax
mov    (%rax),%rdi
lea    -0x58(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x20(%rbp)
mov    0x2be6(%rip),%rax
cmpl   $0x0,(%rax)
jne    141d <main+0x23d>
mov    -0x58(%rbp),%rax
mov    0x2c0a(%rip),%rcx
mov    (%rcx),%rcx
sub    %rcx,%rax
mov    %rax,-0x88(%rbp)
mov    0x2bf6(%rip),%rax
mov    (%rax),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x88(%rbp),%rax
cmp    %rcx,%rax
je     1448 <main+0x268>
mov    0x2ba4(%rip),%rax
mov    (%rax),%edi
mov    0x2bcb(%rip),%rax
mov    (%rax),%rdx
lea    0xbfa(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
jmp    14fd <main+0x31d>
mov    0x2b6c(%rip),%rax
movl   $0x0,(%rax)
mov    0x2b97(%rip),%rax
mov    (%rax),%rdi
lea    -0x58(%rbp),%rsi
xor    %edx,%edx
call   10c0 <strtoul@plt>
mov    %eax,-0x24(%rbp)
mov    0x2b47(%rip),%rax
cmpl   $0x0,(%rax)
jne    14c6 <main+0x2e6>
cmpl   $0x1,-0x24(%rbp)
jl     14c6 <main+0x2e6>
mov    -0x58(%rbp),%rax
mov    0x2b61(%rip),%rcx
mov    (%rcx),%rcx
sub    %rcx,%rax
mov    %rax,-0x90(%rbp)
mov    0x2b4d(%rip),%rax
mov    (%rax),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x90(%rbp),%rax
cmp    %rcx,%rax
je     14f1 <main+0x311>
mov    0x2afb(%rip),%rax
mov    (%rax),%edi
mov    0x2b22(%rip),%rax
mov    (%rax),%rdx
lea    0xb6e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
jmp    14fd <main+0x31d>
mov    $0x0,%al
call   10a0 <usage@plt>
jmp    1257 <main+0x77>
cmpl   $0x0,-0x4c(%rbp)
je     1537 <main+0x357>
cmpl   $0x1,-0x24(%rbp)
jle    1537 <main+0x357>
mov    0x2aab(%rip),%rax
mov    (%rax),%edi
lea    0xb4e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
cmpl   $0x0,-0x14(%rbp)
jge    1548 <main+0x368>
movl   $0x1,-0x14(%rbp)
jmp    154d <main+0x36d>
mov    0x2a84(%rip),%rax
mov    (%rax),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jae    1692 <main+0x4b2>
mov    -0x10(%rbp),%rax
mov    0x2a69(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xaa7(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1646 <main+0x466>
mov    0x2a45(%rip),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    0x2a37(%rip),%rax
mov    %rcx,(%rax)
movslq -0x8(%rbp),%rax
mov    0x2a29(%rip),%rcx
sub    (%rcx),%rax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%esi
mov    $0x8,%edi
call   1060 <calloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    15db <main+0x3fb>
mov    $0x1,%edi
call   10d0 <exit@plt>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1629 <main+0x449>
mov    -0x10(%rbp),%rax
mov    0x29df(%rip),%rcx
mov    (%rcx),%rcx
movslq -0x5c(%rbp),%rdx
add    %rdx,%rcx
mov    (%rax,%rcx,8),%rdi
call   10e0 <strdup@plt>
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    15e2 <main+0x402>
movslq -0x5c(%rbp),%rcx
mov    0x29a4(%rip),%rax
add    (%rax),%rcx
mov    0x299a(%rip),%rax
mov    %rcx,(%rax)
jmp    1675 <main+0x495>
mov    -0x10(%rbp),%rax
mov    0x2987(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   10e0 <strdup@plt>
mov    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    0x295c(%rip),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    0x294e(%rip),%rax
mov    %rcx,(%rax)
jmp    154d <main+0x36d>
cmpl   $0x1,-0x24(%rbp)
jle    16cb <main+0x4eb>
mov    -0x30(%rbp),%rax
cmpq   $0x0,(%rax)
jne    16cb <main+0x4eb>
mov    0x2917(%rip),%rax
mov    (%rax),%edi
lea    0x9de(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
jmp    16d0 <main+0x4f0>
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1805 <main+0x625>
lea    -0x68(%rbp),%rdi
mov    $0x1,%esi
call   1040 <getloadavg@plt>
cmpl   $0x0,-0x14(%rbp)
je     1700 <main+0x520>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    176c <main+0x58c>
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
ja     1722 <main+0x542>
movsd  -0x68(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    176c <main+0x58c>
mov    -0x24(%rbp),%eax
mov    -0x40(%rbp),%ecx
sub    -0x3c(%rbp),%ecx
cmp    %ecx,%eax
jle    173c <main+0x55c>
mov    -0x40(%rbp),%eax
sub    -0x3c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x4c(%rbp),%edx
mov    -0x24(%rbp),%ecx
call   1090 <exec_child@plt>
mov    -0x24(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1782 <main+0x5a2>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1798 <main+0x5b8>
xor    %edi,%edi
call   10f0 <wait_for_child@plt>
or     -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1800 <main+0x620>
movsd  -0x68(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     1800 <main+0x620>
mov    $0x1,%edi
call   1100 <sleep@plt>
mov    0x2815(%rip),%rax
mov    (%rax),%edi
call   10f0 <wait_for_child@plt>
mov    %eax,-0x6c(%rbp)
cmpl   $0x0,-0x6c(%rbp)
jle    17e8 <main+0x608>
mov    -0x6c(%rbp),%eax
or     -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
cmpl   $0xffffffff,-0x6c(%rbp)
je     17fb <main+0x61b>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1800 <main+0x620>
jmp    16d0 <main+0x4f0>
jmp    180a <main+0x62a>
cmpl   $0x0,-0x18(%rbp)
jle    182f <main+0x64f>
xor    %edi,%edi
call   10f0 <wait_for_child@plt>
or     -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    180a <main+0x62a>
mov    -0x48(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r12
mov    %edi,%esi
mov    $0x8,%edi
mov    %esi,0x14(%rsp)
call   1060 <calloc@plt>
mov    %rax,%r13
mov    0x2dcd(%rip),%rbp
mov    0x0(%rbp),%rax
mov    (%r12,%rax,8),%rdi
test   %rdi,%rdi
mov    %r13,0x48(%rsp)
mov    %r12,0x30(%rsp)
je     13c4 <main+0x1e4>
mov    $0x1,%r15d
movsd  0xdcc(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    $0xffffffff,%ebx
lea    0xdca(%rip),%r14
mov    0x2d73(%rip),%r13
xor    %ebp,%ebp
jmp    12a3 <main+0xc3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rbx
mov    0x2d8c(%rip),%rax
mov    (%rax),%rdi
sub    %rdi,%rbx
call   1050 <strlen@plt>
cmp    %rbx,%rax
mov    %r12d,%ebx
mov    0x30(%rsp),%r12
mov    %ebp,%edx
jne    1688 <main+0x4a8>
mov    0x2d47(%rip),%rax
mov    (%rax),%rax
mov    (%r12,%rax,8),%rdi
mov    %edx,%ebp
test   %rdi,%rdi
je     13dc <main+0x1fc>
lea    0xd7e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13da <main+0x1fa>
mov    0x14(%rsp),%edi
mov    %r12,%rsi
lea    0xd65(%rip),%rdx
call   10b0 <getopt@plt>
lea    -0x69(%rax),%ecx
cmp    $0x5,%ecx
ja     13b1 <main+0x1d1>
mov    $0x1,%edx
movslq (%r14,%rcx,4),%rax
add    %r14,%rax
jmp    *%rax
movl   $0x0,0x0(%r13)
mov    0x2d04(%rip),%rax
mov    (%rax),%rdi
lea    0x20(%rsp),%rsi
xor    %edx,%edx
call   10c0 <strtoul@plt>
cmpl   $0x0,0x0(%r13)
jne    1688 <main+0x4a8>
mov    %eax,%r12d
jmp    1260 <main+0x80>
movl   $0x0,0x0(%r13)
mov    0x2cd3(%rip),%rax
mov    (%rax),%rdi
lea    0x20(%rsp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,0x18(%rsp)
cmpl   $0x0,0x0(%r13)
jne    1688 <main+0x4a8>
mov    %ebx,%r12d
jmp    1260 <main+0x80>
movl   $0x0,0x0(%r13)
mov    0x2c9e(%rip),%rax
mov    (%rax),%rdi
lea    0x20(%rsp),%rsi
xor    %edx,%edx
call   10c0 <strtoul@plt>
cmpl   $0x0,0x0(%r13)
jne    16ae <main+0x4ce>
mov    %eax,%r15d
test   %eax,%eax
jle    16ae <main+0x4ce>
mov    %ebx,%r12d
mov    0x20(%rsp),%rbx
mov    0x2c6a(%rip),%rax
mov    (%rax),%rdi
sub    %rdi,%rbx
call   1050 <strlen@plt>
cmp    %rbx,%rax
mov    %r12d,%ebx
mov    0x30(%rsp),%r12
mov    %ebp,%edx
je     128a <main+0xaa>
jmp    16ae <main+0x4ce>
cmp    $0xffffffff,%eax
je     13da <main+0x1fa>
xor    %eax,%eax
call   10a0 <usage@plt>
mov    %ebp,%edx
jmp    128a <main+0xaa>
movl   $0x1,0x10(%rsp)
xor    %edx,%edx
movsd  0xc2a(%rip),%xmm0
xor    %eax,%eax
jmp    140c <main+0x22c>
mov    %ebp,%edx
cmp    $0x2,%r15d
setge  %al
test   %edx,%edx
je     13f1 <main+0x211>
cmp    $0x2,%r15d
jge    16d9 <main+0x4f9>
mov    %r15d,0x10(%rsp)
test   %ebx,%ebx
mov    0x48(%rsp),%r13
movsd  0x18(%rsp),%xmm0
mov    0x2bce(%rip),%rbp
jns    1411 <main+0x231>
mov    $0x1,%ebx
mov    %eax,0x38(%rsp)
mov    %edx,0x3c(%rsp)
movsd  %xmm0,0x18(%rsp)
movslq 0x14(%rsp),%rax
mov    0x0(%rbp),%r15
mov    %rax,0x40(%rsp)
cmp    %rax,%r15
mov    %ebx,0x2c(%rsp)
jae    1535 <main+0x355>
lea    0x8(%r12),%rax
mov    %rax,0x60(%rsp)
xor    %eax,%eax
mov    %rax,0x50(%rsp)
movl   $0x0,0xc(%rsp)
xor    %r14d,%r14d
mov    0x40(%rsp),%rbx
jmp    148f <main+0x2af>
nopl   (%rax)
mov    (%r12,%r15,8),%rdi
call   10e0 <strdup@plt>
mov    0x50(%rsp),%rcx
movslq %ecx,%rcx
mov    %rax,0x0(%r13,%rcx,8)
add    $0x1,%ecx
mov    %rcx,0x50(%rsp)
add    $0x1,%r15
mov    %r15,0x0(%rbp)
cmp    %rbx,%r15
jae    1540 <main+0x360>
mov    (%r12,%r15,8),%rdi
lea    0xb8e(%rip),%rsi
call   1070 <strcmp@plt>
mov    0x0(%rbp),%r15
test   %rax,%rax
jne    1460 <main+0x280>
mov    %r12,%rbx
lea    0x1(%r15),%r13
mov    %r13,0x0(%rbp)
mov    0x14(%rsp),%r12d
sub    %r13d,%r12d
mov    $0x8,%edi
mov    %r12d,%esi
call   1060 <calloc@plt>
test   %rax,%rax
je     16a4 <main+0x4c4>
mov    %rax,%r14
test   %r12d,%r12d
mov    %r12d,0xc(%rsp)
jle    1519 <main+0x339>
mov    %r12d,%r12d
mov    0x60(%rsp),%rax
lea    (%rax,%r15,8),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    0x0(%rbp,%rbx,8),%rdi
call   10e0 <strdup@plt>
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    14f0 <main+0x310>
mov    0xc(%rsp),%eax
mov    0x30(%rsp),%r12
mov    0x2ac1(%rip),%rbp
jmp    151e <main+0x33e>
xor    %eax,%eax
mov    %rbx,%r12
mov    %eax,%eax
add    %rax,%r13
mov    %r13,%r15
mov    0x48(%rsp),%r13
mov    0x40(%rsp),%rbx
jmp    147e <main+0x29e>
xor    %r14d,%r14d
movl   $0x0,0xc(%rsp)
cmpb   $0x0,0x38(%rsp)
je     1552 <main+0x372>
cmpq   $0x0,0x0(%r13)
je     16eb <main+0x50b>
cmpl   $0x0,0xc(%rsp)
mov    0x2c(%rsp),%ebx
jle    1675 <main+0x495>
xor    %ebp,%ebp
xor    %r12d,%r12d
xor    %r15d,%r15d
jmp    157b <main+0x39b>
nopl   0x0(%rax,%rax,1)
cmp    %r12d,0xc(%rsp)
jle    164d <main+0x46d>
lea    0x58(%rsp),%rdi
mov    $0x1,%esi
call   1040 <getloadavg@plt>
test   %ebx,%ebx
je     1593 <main+0x3b3>
cmp    %ebx,%r15d
jge    15df <main+0x3ff>
movsd  0x18(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     15ab <main+0x3cb>
ucomisd 0x58(%rsp),%xmm0
jbe    15df <main+0x3ff>
mov    0xc(%rsp),%eax
sub    %r12d,%eax
mov    0x10(%rsp),%ebx
cmp    %eax,%ebx
cmovg  %eax,%ebx
movslq %r12d,%r12
lea    (%r14,%r12,8),%rsi
mov    %r13,%rdi
mov    0x3c(%rsp),%edx
mov    %ebx,%ecx
call   1090 <exec_child@plt>
mov    %ebx,0x10(%rsp)
add    %ebx,%r12d
mov    0x2c(%rsp),%ebx
add    $0x1,%r15d
test   %ebx,%ebx
je     15e8 <main+0x408>
cmp    %ebx,%r15d
jne    15f5 <main+0x415>
xor    %edi,%edi
call   10f0 <wait_for_child@plt>
or     %eax,%ebp
add    $0xffffffff,%r15d
movsd  0x18(%rsp),%xmm1
ucomisd 0xa05(%rip),%xmm1
jbe    1570 <main+0x390>
movsd  0x58(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jb     1570 <main+0x390>
mov    $0x1,%edi
call   1100 <sleep@plt>
mov    0x29b6(%rip),%rax
mov    (%rax),%edi
call   10f0 <wait_for_child@plt>
test   %eax,%eax
mov    $0x0,%ecx
cmovns %eax,%ecx
or     %ecx,%ebp
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
sub    %ecx,%r15d
jmp    1570 <main+0x390>
test   %r15d,%r15d
jle    1677 <main+0x497>
add    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
xor    %edi,%edi
call   10f0 <wait_for_child@plt>
or     %eax,%ebp
add    $0xffffffff,%r15d
cmp    $0x1,%r15d
ja     1660 <main+0x480>
jmp    1677 <main+0x497>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2939(%rip),%rax
mov    (%rax),%edi
mov    0x2960(%rip),%rax
mov    (%rax),%rdx
lea    0x993(%rip),%rsi
jmp    16c8 <main+0x4e8>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2913(%rip),%rax
mov    (%rax),%edi
mov    0x293a(%rip),%rax
mov    (%rax),%rdx
lea    0x98a(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
mov    0x28e8(%rip),%rax
mov    (%rax),%edi
lea    0x98f(%rip),%rsi
jmp    16fb <main+0x51b>
mov    0x28d6(%rip),%rax
mov    (%rax),%edi
lea    0x9a1(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@optind = global i64 0
@.str = [3 x i8] c"--\00"
@.str.1 = [10 x i8] c"+hij:l:n:\00"
@errno = global i32 0
@optarg = global i8* null
@stderr = global i32 0
@.str.2 = [29 x i8] c"option '%s' is not a number\0A\00"
@.str.3 = [38 x i8] c"option '%s' is not a positive number\0A\00"
@.str.4 = [36 x i8] c"options -i and -n are incomaptible\0A\00"
@.str.5 = [44 x i8] c"option -n cannot be used without a command\0A\00"
@WNOHANG = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8**
%12 = alloca i8**
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i32
%20 = alloca double
%21 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
store i32 0, i32* %7
store double -1.000000e+00, double* %8
store i32 1, i32* %9
%22 = load i32, i32* %4
%23 = call i8** @calloc(i32 8, i32 %22)
store i8** %23, i8*** %11
store i8** null, i8*** %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
br label %24
24: ; preds = %117, %2
%25 = load i8**, i8*** %5
%26 = load i64, i64* @optind
%27 = getelementptr inbounds i8*, i8** %25, i64 %26
%28 = load i8*, i8** %27
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %42
30: ; preds = %24
%31 = load i8**, i8*** %5
%32 = load i64, i64* @optind
%33 = getelementptr inbounds i8*, i8** %31, i64 %32
%34 = load i8*, i8** %33
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %42
37: ; preds = %30
%38 = load i32, i32* %4
%39 = load i8**, i8*** %5
%40 = call i32 @getopt(i32 %38, i8** %39, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i32 %40, i32* %10
%41 = icmp ne i32 %40, -1
br label %42
42: ; preds = %37, %30, %24
%43 = phi i1 [ false, %30 ], [ false, %24 ], [ %41, %37 ]
br i1 %43, label %44, label %118
44: ; preds = %42
%45 = load i32, i32* %10
switch i32 %45, label %115 [
i32 104, label %46
i32 105, label %48
i32 106, label %49
i32 108, label %70
i32 110, label %91
]
46: ; preds = %44
%47 = call i32 (...) @usage()
br label %117
48: ; preds = %44
store i32 1, i32* %17
br label %117
49: ; preds = %44
store i32 0, i32* @errno
%50 = load i8*, i8** @optarg
%51 = call i32 @strtoul(i8* %50, i8** %18, i32 0)
store i32 %51, i32* %6
%52 = load i32, i32* @errno
%53 = icmp ne i32 %52, 0
br i1 %53, label %64, label %54
54: ; preds = %49
%55 = load i8*, i8** %18
%56 = load i8*, i8** @optarg
%57 = ptrtoint i8* %55 to i64
%58 = ptrtoint i8* %56 to i64
%59 = sub i64 %57, %58
%60 = inttoptr i64 %59 to i8*
%61 = load i8*, i8** @optarg
%62 = call i8* @strlen(i8* %61)
%63 = icmp ne i8* %60, %62
br i1 %63, label %64, label %69
64: ; preds = %54, %49
%65 = load i32, i32* @stderr
%66 = load i8*, i8** @optarg
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %66)
%68 = call i32 @exit(i32 2)
unreachable
69: ; preds = %54
br label %117
70: ; preds = %44
store i32 0, i32* @errno
%71 = load i8*, i8** @optarg
%72 = call double @strtod(i8* %71, i8** %18)
store double %72, double* %8
%73 = load i32, i32* @errno
%74 = icmp ne i32 %73, 0
br i1 %74, label %85, label %75
75: ; preds = %70
%76 = load i8*, i8** %18
%77 = load i8*, i8** @optarg
%78 = ptrtoint i8* %76 to i64
%79 = ptrtoint i8* %77 to i64
%80 = sub i64 %78, %79
%81 = inttoptr i64 %80 to i8*
%82 = load i8*, i8** @optarg
%83 = call i8* @strlen(i8* %82)
%84 = icmp ne i8* %81, %83
br i1 %84, label %85, label %90
85: ; preds = %75, %70
%86 = load i32, i32* @stderr
%87 = load i8*, i8** @optarg
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %87)
%89 = call i32 @exit(i32 2)
unreachable
90: ; preds = %75
br label %117
91: ; preds = %44
store i32 0, i32* @errno
%92 = load i8*, i8** @optarg
%93 = call i32 @strtoul(i8* %92, i8** %18, i32 0)
store i32 %93, i32* %9
%94 = load i32, i32* @errno
%95 = icmp ne i32 %94, 0
br i1 %95, label %109, label %96
96: ; preds = %91
%97 = load i32, i32* %9
%98 = icmp slt i32 %97, 1
br i1 %98, label %109, label %99
99: ; preds = %96
%100 = load i8*, i8** %18
%101 = load i8*, i8** @optarg
%102 = ptrtoint i8* %100 to i64
%103 = ptrtoint i8* %101 to i64
%104 = sub i64 %102, %103
%105 = inttoptr i64 %104 to i8*
%106 = load i8*, i8** @optarg
%107 = call i8* @strlen(i8* %106)
%108 = icmp ne i8* %105, %107
br i1 %108, label %109, label %114
109: ; preds = %99, %96, %91
%110 = load i32, i32* @stderr
%111 = load i8*, i8** @optarg
%112 = call i32 (i32, i8*, ...) @fprintf(i32 %110, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %111)
%113 = call i32 @exit(i32 2)
unreachable
114: ; preds = %99
br label %117
115: ; preds = %44
%116 = call i32 (...) @usage()
br label %117
117: ; preds = %115, %114, %90, %69, %48, %46
br label %24
118: ; preds = %42
%119 = load i32, i32* %17
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %128
121: ; preds = %118
%122 = load i32, i32* %9
%123 = icmp sgt i32 %122, 1
br i1 %123, label %124, label %128
124: ; preds = %121
%125 = load i32, i32* @stderr
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%127 = call i32 @exit(i32 2)
unreachable
128: ; preds = %121, %118
%129 = load i32, i32* %6
%130 = icmp slt i32 %129, 0
br i1 %130, label %131, label %132
131: ; preds = %128
store i32 1, i32* %6
br label %132
132: ; preds = %131, %128
br label %133
133: ; preds = %197, %132
%134 = load i64, i64* @optind
%135 = load i32, i32* %4
%136 = sext i32 %135 to i64
%137 = icmp ult i64 %134, %136
br i1 %137, label %138, label %200
138: ; preds = %133
%139 = load i8**, i8*** %5
%140 = load i64, i64* @optind
%141 = getelementptr inbounds i8*, i8** %139, i64 %140
%142 = load i8*, i8** %141
%143 = call i64 @strcmp(i8* %142, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%144 = icmp eq i64 %143, 0
br i1 %144, label %145, label %185
145: ; preds = %138
%146 = load i64, i64* @optind
%147 = add i64 %146, 1
store i64 %147, i64* @optind
%148 = load i32, i32* %4
%149 = sext i32 %148 to i64
%150 = load i64, i64* @optind
%151 = sub i64 %149, %150
%152 = trunc i64 %151 to i32
store i32 %152, i32* %14
%153 = load i32, i32* %14
%154 = call i8** @calloc(i32 8, i32 %153)
store i8** %154, i8*** %12
%155 = load i8**, i8*** %12
%156 = icmp ne i8** %155, null
br i1 %156, label %159, label %157
157: ; preds = %145
%158 = call i32 @exit(i32 1)
unreachable
159: ; preds = %145
store i32 0, i32* %19
br label %160
160: ; preds = %177, %159
%161 = load i32, i32* %19
%162 = load i32, i32* %14
%163 = icmp slt i32 %161, %162
br i1 %163, label %164, label %180
164: ; preds = %160
%165 = load i8**, i8*** %5
%166 = load i64, i64* @optind
%167 = load i32, i32* %19
%168 = sext i32 %167 to i64
%169 = add i64 %166, %168
%170 = getelementptr inbounds i8*, i8** %165, i64 %169
%171 = load i8*, i8** %170
%172 = call i8* @strdup(i8* %171)
%173 = load i8**, i8*** %12
%174 = load i32, i32* %19
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds i8*, i8** %173, i64 %175
store i8* %172, i8** %176
br label %177
177: ; preds = %164
%178 = load i32, i32* %19
%179 = add nsw i32 %178, 1
store i32 %179, i32* %19
br label %160
180: ; preds = %160
%181 = load i32, i32* %19
%182 = sext i32 %181 to i64
%183 = load i64, i64* @optind
%184 = add i64 %183, %182
store i64 %184, i64* @optind
br label %197
185: ; preds = %138
%186 = load i8**, i8*** %5
%187 = load i64, i64* @optind
%188 = getelementptr inbounds i8*, i8** %186, i64 %187
%189 = load i8*, i8** %188
%190 = call i8* @strdup(i8* %189)
%191 = load i8**, i8*** %11
%192 = load i32, i32* %15
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds i8*, i8** %191, i64 %193
store i8* %190, i8** %194
%195 = load i32, i32* %15
%196 = add nsw i32 %195, 1
store i32 %196, i32* %15
br label %197
197: ; preds = %185, %180
%198 = load i64, i64* @optind
%199 = add i64 %198, 1
store i64 %199, i64* @optind
br label %133
200: ; preds = %133
%201 = load i32, i32* %9
%202 = icmp sgt i32 %201, 1
br i1 %202, label %203, label %212
203: ; preds = %200
%204 = load i8**, i8*** %11
%205 = getelementptr inbounds i8*, i8** %204, i64 0
%206 = load i8*, i8** %205
%207 = icmp ne i8* %206, null
br i1 %207, label %212, label %208
208: ; preds = %203
%209 = load i32, i32* @stderr
%210 = call i32 (i32, i8*, ...) @fprintf(i32 %209, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%211 = call i32 @exit(i32 2)
unreachable
212: ; preds = %203, %200
br label %213
213: ; preds = %293, %212
%214 = load i32, i32* %13
%215 = load i32, i32* %14
%216 = icmp slt i32 %214, %215
br i1 %216, label %217, label %294
217: ; preds = %213
%218 = call i32 @getloadavg(double* %20, i32 1)
%219 = load i32, i32* %6
%220 = icmp eq i32 %219, 0
br i1 %220, label %225, label %221
221: ; preds = %217
%222 = load i32, i32* %7
%223 = load i32, i32* %6
%224 = icmp slt i32 %222, %223
br i1 %224, label %225, label %256
225: ; preds = %221, %217
%226 = load double, double* %8
%227 = fcmp olt double %226, 0.000000e+00
br i1 %227, label %232, label %228
228: ; preds = %225
%229 = load double, double* %20
%230 = load double, double* %8
%231 = fcmp olt double %229, %230
br i1 %231, label %232, label %256
232: ; preds = %228, %225
%233 = load i32, i32* %9
%234 = load i32, i32* %14
%235 = load i32, i32* %13
%236 = sub nsw i32 %234, %235
%237 = icmp sgt i32 %233, %236
br i1 %237, label %238, label %242
238: ; preds = %232
%239 = load i32, i32* %14
%240 = load i32, i32* %13
%241 = sub nsw i32 %239, %240
store i32 %241, i32* %9
br label %242
242: ; preds = %238, %232
%243 = load i8**, i8*** %11
%244 = load i8**, i8*** %12
%245 = load i32, i32* %13
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds i8*, i8** %244, i64 %246
%248 = load i32, i32* %17
%249 = load i32, i32* %9
%250 = call i32 @exec_child(i8** %243, i8** %247, i32 %248, i32 %249)
%251 = load i32, i32* %9
%252 = load i32, i32* %13
%253 = add nsw i32 %252, %251
store i32 %253, i32* %13
%254 = load i32, i32* %7
%255 = add nsw i32 %254, 1
store i32 %255, i32* %7
br label %256
256: ; preds = %242, %228, %221
%257 = load i32, i32* %6
%258 = icmp eq i32 %257, 0
br i1 %258, label %263, label %259
259: ; preds = %256
%260 = load i32, i32* %7
%261 = load i32, i32* %6
%262 = icmp eq i32 %260, %261
br i1 %262, label %263, label %269
263: ; preds = %259, %256
%264 = call i32 @wait_for_child(i32 0)
%265 = load i32, i32* %16
%266 = or i32 %265, %264
store i32 %266, i32* %16
%267 = load i32, i32* %7
%268 = add nsw i32 %267, -1
store i32 %268, i32* %7
br label %269
269: ; preds = %263, %259
%270 = load double, double* %8
%271 = fcmp ogt double %270, 0.000000e+00
br i1 %271, label %272, label %293
272: ; preds = %269
%273 = load double, double* %20
%274 = load double, double* %8
%275 = fcmp oge double %273, %274
br i1 %275, label %276, label %293
276: ; preds = %272
%277 = call i32 @sleep(i32 1)
%278 = load i32, i32* @WNOHANG
%279 = call i32 @wait_for_child(i32 %278)
store i32 %279, i32* %21
%280 = load i32, i32* %21
%281 = icmp sgt i32 %280, 0
br i1 %281, label %282, label %286
282: ; preds = %276
%283 = load i32, i32* %21
%284 = load i32, i32* %16
%285 = or i32 %284, %283
store i32 %285, i32* %16
br label %286
286: ; preds = %282, %276
%287 = load i32, i32* %21
%288 = icmp ne i32 %287, -1
br i1 %288, label %289, label %292
289: ; preds = %286
%290 = load i32, i32* %7
%291 = add nsw i32 %290, -1
store i32 %291, i32* %7
br label %292
292: ; preds = %289, %286
br label %293
293: ; preds = %292, %272, %269
br label %213
294: ; preds = %213
br label %295
295: ; preds = %298, %294
%296 = load i32, i32* %7
%297 = icmp sgt i32 %296, 0
br i1 %297, label %298, label %304
298: ; preds = %295
%299 = call i32 @wait_for_child(i32 0)
%300 = load i32, i32* %16
%301 = or i32 %300, %299
store i32 %301, i32* %16
%302 = load i32, i32* %7
%303 = add nsw i32 %302, -1
store i32 %303, i32* %7
br label %295
304: ; preds = %295
%305 = load i32, i32* %16
ret i32 %305
}

LLVM IR (-O2):
@optind = global i64 0
@.str = [3 x i8] c"--\00"
@.str.1 = [10 x i8] c"+hij:l:n:\00"
@errno = global i32 0
@optarg = global i8* null
@stderr = global i32 0
@.str.2 = [29 x i8] c"option '%s' is not a number\0A\00"
@.str.3 = [38 x i8] c"option '%s' is not a positive number\0A\00"
@.str.4 = [36 x i8] c"options -i and -n are incomaptible\0A\00"
@.str.5 = [44 x i8] c"option -n cannot be used without a command\0A\00"
@WNOHANG = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca double
%5 = tail call i8** @calloc(i32 8, i32 %0)
%6 = bitcast i8** %3 to i8*
%7 = load i64, i64* @optind
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %105, label %11
11: ; preds = %2, %82
%12 = phi i8* [ %89, %82 ], [ %9, %2 ]
%13 = phi i32 [ %86, %82 ], [ -1, %2 ]
%14 = phi i32 [ %85, %82 ], [ 0, %2 ]
%15 = phi double [ %84, %82 ], [ -1.000000e+00, %2 ]
%16 = phi i32 [ %83, %82 ], [ 1, %2 ]
%17 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %91, label %19
19: ; preds = %11
%20 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
switch i32 %20, label %80 [
i32 -1, label %91
i32 110, label %59
i32 105, label %82
i32 106, label %21
i32 108, label %40
]
21: ; preds = %19
store i32 0, i32* @errno
%22 = load i8*, i8** @optarg
%23 = call i32 @strtoul(i8* %22, i8** %3, i32 0)
%24 = load i32, i32* @errno
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %35
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = load i8*, i8** @optarg
%29 = ptrtoint i8* %27 to i64
%30 = ptrtoint i8* %28 to i64
%31 = sub i64 %29, %30
%32 = inttoptr i64 %31 to i8*
%33 = tail call i8* @strlen(i8* %28)
%34 = icmp eq i8* %33, %32
br i1 %34, label %82, label %35
35: ; preds = %26, %21
%36 = load i32, i32* @stderr
%37 = load i8*, i8** @optarg
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %37)
%39 = tail call i32 @exit(i32 2)
unreachable
40: ; preds = %19
store i32 0, i32* @errno
%41 = load i8*, i8** @optarg
%42 = call double @strtod(i8* %41, i8** %3)
%43 = load i32, i32* @errno
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %54
45: ; preds = %40
%46 = load i8*, i8** %3
%47 = load i8*, i8** @optarg
%48 = ptrtoint i8* %46 to i64
%49 = ptrtoint i8* %47 to i64
%50 = sub i64 %48, %49
%51 = inttoptr i64 %50 to i8*
%52 = tail call i8* @strlen(i8* %47)
%53 = icmp eq i8* %52, %51
br i1 %53, label %82, label %54
54: ; preds = %45, %40
%55 = load i32, i32* @stderr
%56 = load i8*, i8** @optarg
%57 = tail call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %56)
%58 = tail call i32 @exit(i32 2)
unreachable
59: ; preds = %19
store i32 0, i32* @errno
%60 = load i8*, i8** @optarg
%61 = call i32 @strtoul(i8* %60, i8** %3, i32 0)
%62 = load i32, i32* @errno
%63 = icmp ne i32 %62, 0
%64 = icmp slt i32 %61, 1
%65 = select i1 %63, i1 true, i1 %64
br i1 %65, label %75, label %66
66: ; preds = %59
%67 = load i8*, i8** %3
%68 = load i8*, i8** @optarg
%69 = ptrtoint i8* %67 to i64
%70 = ptrtoint i8* %68 to i64
%71 = sub i64 %69, %70
%72 = inttoptr i64 %71 to i8*
%73 = tail call i8* @strlen(i8* %68)
%74 = icmp eq i8* %73, %72
br i1 %74, label %82, label %75
75: ; preds = %66, %59
%76 = load i32, i32* @stderr
%77 = load i8*, i8** @optarg
%78 = tail call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %77)
%79 = tail call i32 @exit(i32 2)
unreachable
80: ; preds = %19
%81 = tail call i32 (...) @usage()
br label %82
82: ; preds = %80, %19, %66, %45, %26
%83 = phi i32 [ %61, %66 ], [ %16, %45 ], [ %16, %26 ], [ %16, %19 ], [ %16, %80 ]
%84 = phi double [ %15, %66 ], [ %42, %45 ], [ %15, %26 ], [ %15, %19 ], [ %15, %80 ]
%85 = phi i32 [ %14, %66 ], [ %14, %45 ], [ %14, %26 ], [ 1, %19 ], [ %14, %80 ]
%86 = phi i32 [ %13, %66 ], [ %13, %45 ], [ %23, %26 ], [ %13, %19 ], [ %13, %80 ]
%87 = load i64, i64* @optind
%88 = getelementptr inbounds i8*, i8** %1, i64 %87
%89 = load i8*, i8** %88
%90 = icmp eq i8* %89, null
br i1 %90, label %91, label %11
91: ; preds = %11, %82, %19
%92 = phi i32 [ %16, %11 ], [ %83, %82 ], [ %16, %19 ]
%93 = phi double [ %15, %11 ], [ %84, %82 ], [ %15, %19 ]
%94 = phi i32 [ %14, %11 ], [ %85, %82 ], [ %14, %19 ]
%95 = phi i32 [ %13, %11 ], [ %86, %82 ], [ %13, %19 ]
%96 = icmp ne i32 %94, 0
%97 = icmp sgt i32 %92, 1
%98 = select i1 %96, i1 %97, i1 false
br i1 %98, label %99, label %103
99: ; preds = %91
%100 = load i32, i32* @stderr
%101 = tail call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%102 = tail call i32 @exit(i32 2)
unreachable
103: ; preds = %91
%104 = icmp slt i32 %95, 0
br i1 %104, label %105, label %110
105: ; preds = %2, %103
%106 = phi i32 [ %92, %103 ], [ 1, %2 ]
%107 = phi double [ %93, %103 ], [ -1.000000e+00, %2 ]
%108 = phi i32 [ %94, %103 ], [ 0, %2 ]
%109 = phi i1 [ %97, %103 ], [ false, %2 ]
br label %110
110: ; preds = %103, %105
%111 = phi i32 [ %106, %105 ], [ %92, %103 ]
%112 = phi double [ %107, %105 ], [ %93, %103 ]
%113 = phi i32 [ %108, %105 ], [ %94, %103 ]
%114 = phi i1 [ %109, %105 ], [ %97, %103 ]
%115 = phi i32 [ 1, %105 ], [ %95, %103 ]
%116 = sext i32 %0 to i64
%117 = load i64, i64* @optind
%118 = icmp ult i64 %117, %116
br i1 %118, label %119, label %168
119: ; preds = %110, %161
%120 = phi i64 [ %166, %161 ], [ %117, %110 ]
%121 = phi i32 [ %165, %161 ], [ 0, %110 ]
%122 = phi i32 [ %164, %161 ], [ 0, %110 ]
%123 = phi i8** [ %163, %161 ], [ null, %110 ]
%124 = getelementptr inbounds i8*, i8** %1, i64 %120
%125 = load i8*, i8** %124
%126 = tail call i64 @strcmp(i8* %125, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%127 = icmp eq i64 %126, 0
%128 = load i64, i64* @optind
br i1 %127, label %129, label %154
129: ; preds = %119
%130 = add i64 %128, 1
store i64 %130, i64* @optind
%131 = trunc i64 %130 to i32
%132 = sub i32 %0, %131
%133 = tail call i8** @calloc(i32 8, i32 %132)
%134 = icmp eq i8** %133, null
br i1 %134, label %139, label %135
135: ; preds = %129
%136 = icmp sgt i32 %132, 0
br i1 %136, label %137, label %150
137: ; preds = %135
%138 = zext i32 %132 to i64
br label %141
139: ; preds = %129
%140 = tail call i32 @exit(i32 1)
unreachable
141: ; preds = %137, %141
%142 = phi i64 [ 0, %137 ], [ %148, %141 ]
%143 = add i64 %130, %142
%144 = getelementptr inbounds i8*, i8** %1, i64 %143
%145 = load i8*, i8** %144
%146 = tail call i8* @strdup(i8* %145)
%147 = getelementptr inbounds i8*, i8** %133, i64 %142
store i8* %146, i8** %147
%148 = add nuw nsw i64 %142, 1
%149 = icmp eq i64 %148, %138
br i1 %149, label %150, label %141
150: ; preds = %141, %135
%151 = phi i32 [ 0, %135 ], [ %132, %141 ]
%152 = zext i32 %151 to i64
%153 = add i64 %130, %152
br label %161
154: ; preds = %119
%155 = getelementptr inbounds i8*, i8** %1, i64 %128
%156 = load i8*, i8** %155
%157 = tail call i8* @strdup(i8* %156)
%158 = sext i32 %121 to i64
%159 = getelementptr inbounds i8*, i8** %5, i64 %158
store i8* %157, i8** %159
%160 = add nsw i32 %121, 1
br label %161
161: ; preds = %154, %150
%162 = phi i64 [ %153, %150 ], [ %128, %154 ]
%163 = phi i8** [ %133, %150 ], [ %123, %154 ]
%164 = phi i32 [ %132, %150 ], [ %122, %154 ]
%165 = phi i32 [ %121, %150 ], [ %160, %154 ]
%166 = add i64 %162, 1
store i64 %166, i64* @optind
%167 = icmp ult i64 %166, %116
br i1 %167, label %119, label %168
168: ; preds = %161, %110
%169 = phi i8** [ null, %110 ], [ %163, %161 ]
%170 = phi i32 [ 0, %110 ], [ %164, %161 ]
br i1 %114, label %171, label %178
171: ; preds = %168
%172 = load i8*, i8** %5
%173 = icmp eq i8* %172, null
br i1 %173, label %174, label %178
174: ; preds = %171
%175 = load i32, i32* @stderr
%176 = tail call i32 (i32, i8*, ...) @fprintf(i32 %175, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%177 = tail call i32 @exit(i32 2)
unreachable
178: ; preds = %171, %168
%179 = icmp sgt i32 %170, 0
br i1 %179, label %180, label %245
180: ; preds = %178
%181 = bitcast double* %4 to i8*
%182 = icmp eq i32 %115, 0
%183 = fcmp olt double %112, 0.000000e+00
%184 = fcmp ule double %112, 0.000000e+00
br label %187
185: ; preds = %234
%186 = icmp sgt i32 %235, 0
br i1 %186, label %238, label %245
187: ; preds = %180, %234
%188 = phi i32 [ 0, %180 ], [ %236, %234 ]
%189 = phi i32 [ 0, %180 ], [ %211, %234 ]
%190 = phi i32 [ 0, %180 ], [ %235, %234 ]
%191 = phi i32 [ %111, %180 ], [ %209, %234 ]
%192 = call i32 @getloadavg(double* %4, i32 1)
%193 = icmp slt i32 %190, %115
%194 = select i1 %182, i1 true, i1 %193
br i1 %194, label %195, label %208
195: ; preds = %187
%196 = load double, double* %4
%197 = fcmp olt double %196, %112
%198 = select i1 %183, i1 true, i1 %197
br i1 %198, label %199, label %208
199: ; preds = %195
%200 = sub nsw i32 %170, %189
%201 = icmp sgt i32 %191, %200
%202 = select i1 %201, i32 %200, i32 %191
%203 = sext i32 %189 to i64
%204 = getelementptr inbounds i8*, i8** %169, i64 %203
%205 = call i32 @exec_child(i8** %5, i8** %204, i32 %113, i32 %202)
%206 = add nsw i32 %202, %189
%207 = add nsw i32 %190, 1
br label %208
208: ; preds = %195, %187, %199
%209 = phi i32 [ %202, %199 ], [ %191, %187 ], [ %191, %195 ]
%210 = phi i32 [ %207, %199 ], [ %190, %187 ], [ %190, %195 ]
%211 = phi i32 [ %206, %199 ], [ %189, %187 ], [ %189, %195 ]
%212 = icmp eq i32 %210, %115
%213 = select i1 %182, i1 true, i1 %212
br i1 %213, label %214, label %218
214: ; preds = %208
%215 = call i32 @wait_for_child(i32 0)
%216 = or i32 %215, %188
%217 = add nsw i32 %210, -1
br label %218
218: ; preds = %208, %214
%219 = phi i32 [ %217, %214 ], [ %210, %208 ]
%220 = phi i32 [ %216, %214 ], [ %188, %208 ]
%221 = load double, double* %4
%222 = fcmp ult double %221, %112
%223 = select i1 %184, i1 true, i1 %222
br i1 %223, label %234, label %224
224: ; preds = %218
%225 = call i32 @sleep(i32 1)
%226 = load i32, i32* @WNOHANG
%227 = call i32 @wait_for_child(i32 %226)
%228 = icmp sgt i32 %227, 0
%229 = select i1 %228, i32 %227, i32 0
%230 = or i32 %229, %220
%231 = icmp ne i32 %227, -1
%232 = sext i1 %231 to i32
%233 = add nsw i32 %219, %232
br label %234
234: ; preds = %224, %218
%235 = phi i32 [ %233, %224 ], [ %219, %218 ]
%236 = phi i32 [ %230, %224 ], [ %220, %218 ]
%237 = icmp sgt i32 %170, %211
br i1 %237, label %187, label %185
238: ; preds = %185, %238
%239 = phi i32 [ %242, %238 ], [ %236, %185 ]
%240 = phi i32 [ %243, %238 ], [ %235, %185 ]
%241 = call i32 @wait_for_child(i32 0)
%242 = or i32 %241, %239
%243 = add nsw i32 %240, -1
%244 = icmp ugt i32 %240, 1
br i1 %244, label %238, label %245
245: ; preds = %238, %178, %185
%246 = phi i32 [ %236, %185 ], [ 0, %178 ], [ %242, %238 ]
ret i32 %246
}