#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 */
typedef int /*<<< orphan*/ line_buf;

/* Variables and functions */
int atoi(char *);
int *calloc(int, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ execlp(char *, char *, char *, char *, int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
char *strerror(int /*<<< orphan*/);
int wait3(int *, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int num, *procs, i, pid;
  char line_buf[32768];
  char line_buf2[32768];
  int saved_line = 0;
  if (argc != 2) {
    fprintf(stderr, "%s: Error: supply number of processes.\n", argv[0]);
    return 1;
  }
  num = atoi(argv[1]);
  if (num < 1) {
    fprintf(stderr, "%s: Error: silly number of processes.\n", argv[0]);
    return 1;
  }
  procs = calloc(num, sizeof(int));
  for (;;) {
    for (i = 0; i < num; i++)
      if (procs[i] == 0)
        goto not_full;
    pid = wait3(&i, 0, 0);
    for (i = 0; i < num; i++)
      if (procs[i] == pid)
        break;
    if (i == num)
      fprintf(stderr, "b0rk!!\n");
  not_full:
    if (saved_line) {
      memcpy(line_buf, line_buf2, sizeof(line_buf));
      saved_line = 0;
    } else
      fgets(line_buf, sizeof(line_buf), stdin);
    if (feof(stdin))
      break;
    pid = fork();
    if (pid == 0) {
      execlp("bash", "bash", "-c", line_buf, NULL);
      fprintf(stderr, "%s: exec failed: %s\n", argv[0], strerror(errno));
      return -1;
    } else if (pid == -1) {
      fprintf(stderr, "Fork failed with code %s. Sleeping for 1 second.\n",
              strerror(errno));
      memcpy(line_buf2, line_buf, sizeof(line_buf));
      sleep(1);
      saved_line = 1;
    }
    procs[i] = pid;
  }
  while (wait3(&i, 0, 0) != -1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10050,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x10034(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1207 <main+0x57>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe0c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14af <main+0x2ff>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jge    124b <main+0x9b>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf0(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14af <main+0x2ff>
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1299 <main+0xe9>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1286 <main+0xd6>
jmp    1310 <main+0x160>
jmp    128b <main+0xdb>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1263 <main+0xb3>
lea    -0x24(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <wait3@plt>
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12e8 <main+0x138>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x28(%rbp),%eax
jne    12d5 <main+0x125>
jmp    12e8 <main+0x138>
jmp    12da <main+0x12a>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12b0 <main+0x100>
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    130b <main+0x15b>
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
lea    0xd4b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1310 <main+0x160>
cmpl   $0x0,-0x10034(%rbp)
je     1344 <main+0x194>
lea    -0x8030(%rbp),%rdi
lea    -0x10030(%rbp),%rsi
mov    $0x8000,%edx
call   1080 <memcpy@plt>
movl   $0x0,-0x10034(%rbp)
jmp    135e <main+0x1ae>
lea    -0x8030(%rbp),%rdi
mov    0x2c96(%rip),%rax
mov    (%rax),%edx
mov    $0x8000,%esi
call   1040 <fgets@plt>
mov    0x2c83(%rip),%rax
mov    (%rax),%edi
call   1070 <feof@plt>
cmp    $0x0,%rax
je     137b <main+0x1cb>
jmp    1488 <main+0x2d8>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    1406 <main+0x256>
lea    -0x8030(%rbp),%rcx
lea    0xcba(%rip),%rsi
lea    0xcb8(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   10a0 <execlp@plt>
mov    0x2c20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10044(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10040(%rbp)
mov    0x2bfb(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x10044(%rbp),%edi
mov    -0x10040(%rbp),%rdx
mov    %rax,%rcx
lea    0xc6c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14af <main+0x2ff>
cmpl   $0xffffffff,-0x28(%rbp)
jne    1470 <main+0x2c0>
mov    0x2bc1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10048(%rbp)
mov    0x2baa(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x10048(%rbp),%edi
mov    %rax,%rdx
lea    0xc37(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    -0x10030(%rbp),%rdi
lea    -0x8030(%rbp),%rsi
mov    $0x8000,%edx
call   1080 <memcpy@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
movl   $0x1,-0x10034(%rbp)
jmp    1475 <main+0x2c5>
mov    -0x28(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    125c <main+0xac>
jmp    148d <main+0x2dd>
lea    -0x24(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <wait3@plt>
cmp    $0xffffffff,%eax
je     14a8 <main+0x2f8>
jmp    148d <main+0x2dd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10018,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    13ac <main+0x1fc>
mov    0x8(%rbx),%rdi
call   1090 <atoi@plt>
mov    %eax,0x4(%rsp)
test   %eax,%eax
jle    13e3 <main+0x233>
mov    %rbx,0x8(%rsp)
mov    0x4(%rsp),%edi
mov    %edi,%r13d
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
mov    0x2de6(%rip),%r15
xor    %r14d,%r14d
jmp    126b <main+0xbb>
nopw   0x0(%rax,%rax,1)
mov    0x2dc1(%rip),%rax
mov    (%rax),%r14d
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    %r14d,%edi
lea    0xe42(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0x8010(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    $0x8000,%edx
call   1080 <memcpy@plt>
mov    $0x1,%r14d
mov    $0x1,%edi
call   10c0 <sleep@plt>
movslq (%rsp),%rax
mov    %r12d,(%rbx,%rax,4)
xor    %eax,%eax
nopl   (%rax)
cmpl   $0x0,(%rbx,%rax,4)
je     12c0 <main+0x110>
add    $0x1,%rax
cmp    %rax,%r13
jne    1270 <main+0xc0>
mov    0x4(%rsp),%eax
mov    %eax,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <wait3@plt>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %eax,(%rbx,%rcx,4)
je     12d0 <main+0x120>
add    $0x1,%rcx
cmp    %rcx,%r13
jne    12a0 <main+0xf0>
mov    %r13d,(%rsp)
jmp    12d8 <main+0x128>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,(%rsp)
jmp    12ef <main+0x13f>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,(%rsp)
cmp    %ecx,%r13d
jne    12ef <main+0x13f>
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
lea    0xd67(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
test   %r14d,%r14d
je     1310 <main+0x160>
lea    0x10(%rsp),%rdi
lea    0x8010(%rsp),%rsi
mov    $0x8000,%edx
call   1080 <memcpy@plt>
jmp    1322 <main+0x172>
nopl   (%rax)
mov    (%r15),%edx
lea    0x10(%rsp),%rdi
mov    $0x8000,%esi
call   1040 <fgets@plt>
mov    (%r15),%edi
call   1070 <feof@plt>
test   %rax,%rax
jne    13c1 <main+0x211>
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fork@plt>
mov    %eax,%r12d
cmp    $0xffffffff,%eax
je     1210 <main+0x60>
test   %r12d,%r12d
jne    1263 <main+0xb3>
lea    0xcfe(%rip),%rdi
lea    0xcfc(%rip),%rdx
lea    0x10(%rsp),%rcx
mov    %rdi,%rsi
xor    %r8d,%r8d
call   10a0 <execlp@plt>
mov    0x2c61(%rip),%rax
mov    (%rax),%ebx
mov    0x8(%rsp),%rax
mov    (%rax),%rbp
mov    0x2c48(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xcc9(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xffffffff,%ebx
jmp    1402 <main+0x252>
mov    0x2c25(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc41(%rip),%rsi
jmp    13f6 <main+0x246>
mov    %rsp,%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %rbp,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <wait3@plt>
cmp    $0xffffffff,%eax
jne    13d0 <main+0x220>
jmp    1402 <main+0x252>
mov    0x2bee(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc32(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x10018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"%s: Error: supply number of processes.\0A\00"
@.str.1 = [39 x i8] c"%s: Error: silly number of processes.\0A\00"
@.str.2 = [8 x i8] c"b0rk!!\0A\00"
@stdin = global i32 0
@.str.3 = [5 x i8] c"bash\00"
@.str.4 = [3 x i8] c"-c\00"
@.str.5 = [21 x i8] c"%s: exec failed: %s\0A\00"
@errno = global i32 0
@.str.6 = [50 x i8] c"Fork failed with code %s. Sleeping for 1 second.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca [32768 x i8]
%11 = alloca [32768 x i8]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %12
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 1, i32* %3
br label %136
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = icmp slt i32 %26, 1
br i1 %27, label %28, label %34
28: ; preds = %21
%29 = load i32, i32* @stderr
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %32)
store i32 1, i32* %3
br label %136
34: ; preds = %21
%35 = load i32, i32* %6
%36 = call i32* @calloc(i32 %35, i32 4)
store i32* %36, i32** %7
br label %37
37: ; preds = %124, %34
store i32 0, i32* %8
br label %38
38: ; preds = %51, %37
%39 = load i32, i32* %8
%40 = load i32, i32* %6
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %54
42: ; preds = %38
%43 = load i32*, i32** %7
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
%47 = load i32, i32* %46
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %42
br label %81
50: ; preds = %42
br label %51
51: ; preds = %50
%52 = load i32, i32* %8
%53 = add nsw i32 %52, 1
store i32 %53, i32* %8
br label %38
54: ; preds = %38
%55 = call i32 @wait3(i32* %8, i32 0, i32 0)
store i32 %55, i32* %9
store i32 0, i32* %8
br label %56
56: ; preds = %70, %54
%57 = load i32, i32* %8
%58 = load i32, i32* %6
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %73
60: ; preds = %56
%61 = load i32*, i32** %7
%62 = load i32, i32* %8
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i32, i32* %61, i64 %63
%65 = load i32, i32* %64
%66 = load i32, i32* %9
%67 = icmp eq i32 %65, %66
br i1 %67, label %68, label %69
68: ; preds = %60
br label %73
69: ; preds = %60
br label %70
70: ; preds = %69
%71 = load i32, i32* %8
%72 = add nsw i32 %71, 1
store i32 %72, i32* %8
br label %56
73: ; preds = %68, %56
%74 = load i32, i32* %8
%75 = load i32, i32* %6
%76 = icmp eq i32 %74, %75
br i1 %76, label %77, label %80
77: ; preds = %73
%78 = load i32, i32* @stderr
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %80
80: ; preds = %77, %73
br label %81
81: ; preds = %80, %49
%82 = load i32, i32* %12
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %88
84: ; preds = %81
%85 = getelementptr inbounds [32768 x i8], [32768 x i8]* %10, i64 0, i64 0
%86 = getelementptr inbounds [32768 x i8], [32768 x i8]* %11, i64 0, i64 0
%87 = call i32 @memcpy(i8* %85, i8* %86, i32 32768)
store i32 0, i32* %12
br label %92
88: ; preds = %81
%89 = getelementptr inbounds [32768 x i8], [32768 x i8]* %10, i64 0, i64 0
%90 = load i32, i32* @stdin
%91 = call i32 @fgets(i8* %89, i32 32768, i32 %90)
br label %92
92: ; preds = %88, %84
%93 = load i32, i32* @stdin
%94 = call i64 @feof(i32 %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %92
br label %130
97: ; preds = %92
%98 = call i32 (...) @fork()
store i32 %98, i32* %9
%99 = load i32, i32* %9
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %111
101: ; preds = %97
%102 = getelementptr inbounds [32768 x i8], [32768 x i8]* %10, i64 0, i64 0
%103 = call i32 @execlp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %102, i32* null)
%104 = load i32, i32* @stderr
%105 = load i8**, i8*** %5
%106 = getelementptr inbounds i8*, i8** %105, i64 0
%107 = load i8*, i8** %106
%108 = load i32, i32* @errno
%109 = call i8* @strerror(i32 %108)
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %107, i8* %109)
store i32 -1, i32* %3
br label %136
111: ; preds = %97
%112 = load i32, i32* %9
%113 = icmp eq i32 %112, -1
br i1 %113, label %114, label %123
114: ; preds = %111
%115 = load i32, i32* @stderr
%116 = load i32, i32* @errno
%117 = call i8* @strerror(i32 %116)
%118 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i8* %117)
%119 = getelementptr inbounds [32768 x i8], [32768 x i8]* %11, i64 0, i64 0
%120 = getelementptr inbounds [32768 x i8], [32768 x i8]* %10, i64 0, i64 0
%121 = call i32 @memcpy(i8* %119, i8* %120, i32 32768)
%122 = call i32 @sleep(i32 1)
store i32 1, i32* %12
br label %123
123: ; preds = %114, %111
br label %124
124: ; preds = %123
%125 = load i32, i32* %9
%126 = load i32*, i32** %7
%127 = load i32, i32* %8
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i32, i32* %126, i64 %128
store i32 %125, i32* %129
br label %37
130: ; preds = %96
br label %131
131: ; preds = %134, %130
%132 = call i32 @wait3(i32* %8, i32 0, i32 0)
%133 = icmp ne i32 %132, -1
br i1 %133, label %134, label %135
134: ; preds = %131
br label %131
135: ; preds = %131
store i32 0, i32* %3
br label %136
136: ; preds = %135, %101, %28, %15
%137 = load i32, i32* %3
ret i32 %137
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"%s: Error: supply number of processes.\0A\00"
@.str.1 = [39 x i8] c"%s: Error: silly number of processes.\0A\00"
@.str.2 = [8 x i8] c"b0rk!!\0A\00"
@stdin = global i32 0
@.str.3 = [5 x i8] c"bash\00"
@.str.4 = [3 x i8] c"-c\00"
@.str.5 = [21 x i8] c"%s: exec failed: %s\0A\00"
@errno = global i32 0
@.str.6 = [50 x i8] c"Fork failed with code %s. Sleeping for 1 second.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [32768 x i8]
%5 = alloca [32768 x i8]
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds [32768 x i8], [32768 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [32768 x i8], [32768 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 2
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %91
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = icmp slt i32 %17, 1
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %1
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %21)
br label %91
23: ; preds = %14
%24 = tail call i32* @calloc(i32 %17, i32 4)
%25 = zext i32 %17 to i64
%26 = zext i32 %17 to i64
br label %27
27: ; preds = %23, %83
%28 = phi i32 [ 0, %23 ], [ %84, %83 ]
br label %29
29: ; preds = %27, %34
%30 = phi i64 [ 0, %27 ], [ %35, %34 ]
%31 = getelementptr inbounds i32, i32* %24, i64 %30
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %54, label %34
34: ; preds = %29
%35 = add nuw nsw i64 %30, 1
%36 = icmp eq i64 %35, %25
br i1 %36, label %37, label %29
37: ; preds = %34
store i32 %17, i32* %3
%38 = call i32 @wait3(i32* %3, i32 0, i32 0)
br label %39
39: ; preds = %37, %44
%40 = phi i64 [ 0, %37 ], [ %45, %44 ]
%41 = getelementptr inbounds i32, i32* %24, i64 %40
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, %38
br i1 %43, label %48, label %44
44: ; preds = %39
%45 = add nuw nsw i64 %40, 1
%46 = icmp eq i64 %45, %26
br i1 %46, label %47, label %39
47: ; preds = %44
store i32 %17, i32* %3
br label %51
48: ; preds = %39
%49 = trunc i64 %40 to i32
store i32 %49, i32* %3
%50 = icmp eq i32 %17, %49
br i1 %50, label %51, label %56
51: ; preds = %47, %48
%52 = load i32, i32* @stderr
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %56
54: ; preds = %29
%55 = trunc i64 %30 to i32
store i32 %55, i32* %3
br label %56
56: ; preds = %54, %48, %51
%57 = icmp eq i32 %28, 0
br i1 %57, label %60, label %58
58: ; preds = %56
%59 = call i32 @memcpy(i8* %7, i8* %8, i32 32768)
br label %63
60: ; preds = %56
%61 = load i32, i32* @stdin
%62 = call i32 @fgets(i8* %7, i32 32768, i32 %61)
br label %63
63: ; preds = %60, %58
%64 = load i32, i32* @stdin
%65 = call i64 @feof(i32 %64)
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %88
67: ; preds = %63
%68 = call i32 (...) @fork()
switch i32 %68, label %83 [
i32 0, label %69
i32 -1, label %76
]
69: ; preds = %67
%70 = call i32 @execlp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %7, i32* null)
%71 = load i32, i32* @stderr
%72 = load i8*, i8** %1
%73 = load i32, i32* @errno
%74 = call i8* @strerror(i32 %73)
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %72, i8* %74)
br label %91
76: ; preds = %67
%77 = load i32, i32* @stderr
%78 = load i32, i32* @errno
%79 = call i8* @strerror(i32 %78)
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i8* %79)
%81 = call i32 @memcpy(i8* %8, i8* %7, i32 32768)
%82 = call i32 @sleep(i32 1)
br label %83
83: ; preds = %67, %76
%84 = phi i32 [ 1, %76 ], [ 0, %67 ]
%85 = load i32, i32* %3
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32, i32* %24, i64 %86
store i32 %68, i32* %87
br label %27
88: ; preds = %63, %88
%89 = call i32 @wait3(i32* %3, i32 0, i32 0)
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %88
91: ; preds = %88, %69, %19, %10
%92 = phi i32 [ 1, %10 ], [ 1, %19 ], [ -1, %69 ], [ 0, %88 ]
ret i32 %92
}