#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 pid_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSIGNALED(int);
int WTERMSIG(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
scalar_t__ getpid();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
long strtol(char *, char **, int);
int wait(int *);
int main(int argc, char *argv[]) {
  const long MAX_COUNT = 2000;
  long count;
  int status;
  char *end;
  pid_t pid;
  if (argc != 2) {
    printf("Error - usage: %s (integer)count\n", argv[0]);
    exit(EXIT_FAILURE);
  } else {
    int j;
    for (j = 1; j < argc; j++) {
      char *end;
      count = strtol(argv[j], &end, 10);
      if (argc == 2 && !end[0] && count >= 0 && count <= MAX_COUNT) {
        printf("%s is valid, good to go!\n", argv[j]);
      } else {
        printf("%s is invalid input, argument 2 must be a integer and less "
               "than or equal to 2000, exiting program\n",
               argv[j]);
        exit(EXIT_FAILURE);
      }
    }
  }
  printf("This is testforkwait.c\n");
  pid = fork();
  if (pid == -1) {
    printf("The child process was not created successfully. Exiting program");
    exit(EXIT_FAILURE);
  } else if (pid == 0) {
    int i;
    printf("Child process started \n");
    for (i = 1; i <= count; i++) {
      printf("I am the child process and my process id is...(%d) count = %d\n",
             (int)getpid(), i);
    }
    printf("Child process ended \n");
    exit(EXIT_SUCCESS);
  } else {
    if ((pid = wait(&status)) == -1) {
      perror("wait error");
    } else {
      if (WIFSIGNALED(status) != 0) {
        printf("Child process ended because of signal %d \n", WTERMSIG(status));
      } else if (WIFEXITED(status) != 0) {
        printf("Child process ended normally; status = %d \n",
               WEXITSTATUS(status));
        printf("Parent process started \n");
      } else {
        printf("Child process did not end normally \n");
      }
    }
    int i;
    for (i = 1; i <= count; i++) {
      printf("I am the parent process and my process id is...(%d) count = %d\n",
             (int)getpid(), i);
    }
    printf("Parent process ended\n");
    printf("This was testforkwait.c\n");
    exit(EXIT_SUCCESS);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x7d0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11fb <main+0x4b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12b6 <main+0x106>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x40(%rbp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    127b <main+0xcb>
mov    -0x40(%rbp),%rax
cmpb   $0x0,(%rax)
jne    127b <main+0xcb>
cmpq   $0x0,-0x20(%rbp)
jl     127b <main+0xcb>
cmpq   $0x7d0,-0x20(%rbp)
jg     127b <main+0xcb>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a3 <main+0xf3>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d44(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    12a8 <main+0xf8>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1202 <main+0x52>
jmp    12bb <main+0x10b>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    12f9 <main+0x149>
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    136a <main+0x1ba>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x44(%rbp)
movslq -0x44(%rbp),%rax
cmp    -0x20(%rbp),%rax
jg     134e <main+0x19e>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
mov    -0x44(%rbp),%edx
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1318 <main+0x168>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c75(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    -0x24(%rbp),%rdi
call   10c0 <wait@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
jne    1390 <main+0x1e0>
lea    0xdde(%rip),%rdi
call   1090 <perror@plt>
jmp    1414 <main+0x264>
mov    -0x24(%rbp),%edi
call   1050 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     13bf <main+0x20f>
mov    -0x24(%rbp),%edi
call   1070 <WTERMSIG@plt>
mov    %eax,%esi
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    140f <main+0x25f>
mov    -0x24(%rbp),%edi
call   10a0 <WIFEXITED@plt>
cmp    $0x0,%rax
je     13fc <main+0x24c>
mov    -0x24(%rbp),%edi
call   1080 <WEXITSTATUS@plt>
mov    %eax,%esi
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    140a <main+0x25a>
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    140f <main+0x25f>
jmp    1414 <main+0x264>
movl   $0x1,-0x48(%rbp)
movslq -0x48(%rbp),%rax
cmp    -0x20(%rbp),%rax
jg     1451 <main+0x2a1>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
mov    -0x48(%rbp),%edx
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    141b <main+0x26b>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2b64(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    128a <main+0xca>
mov    0x8(%rbx),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%r14
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
mov    0x8(%rbx),%rsi
jne    1296 <main+0xd6>
test   %r14,%r14
js     1296 <main+0xd6>
cmp    $0x7d1,%r14
jge    1296 <main+0xd6>
lea    0xe08(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf98(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   10e0 <fork@plt>
cmp    $0xffffffff,%eax
je     12b2 <main+0xf2>
test   %eax,%eax
jne    12c2 <main+0x102>
lea    0xff8(%rip),%rdi
call   1030 <puts@plt>
test   %r14,%r14
je     127e <main+0xbe>
mov    $0x1,%ebx
lea    0xe81(%rip),%r15
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r15,%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jge    1260 <main+0xa0>
lea    0xfd2(%rip),%rdi
jmp    1321 <main+0x161>
mov    (%rbx),%rsi
lea    0xd6c(%rip),%rdi
jmp    129d <main+0xdd>
lea    0xd9f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
lea    0xde6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12a4 <main+0xe4>
lea    0x4(%rsp),%rdi
call   10d0 <wait@plt>
cmp    $0xffffffff,%eax
jne    1334 <main+0x174>
lea    0xe46(%rip),%rdi
call   10a0 <perror@plt>
test   %r14,%r14
je     130e <main+0x14e>
mov    $0x1,%ebx
lea    0xe92(%rip),%r15
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r15,%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jge    12f0 <main+0x130>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    0x4(%rsp),%edi
call   1060 <WIFSIGNALED@plt>
mov    0x4(%rsp),%edi
test   %rax,%rax
jne    1359 <main+0x199>
call   10b0 <WIFEXITED@plt>
test   %rax,%rax
jne    1373 <main+0x1b3>
lea    0xe80(%rip),%rdi
jmp    1393 <main+0x1d3>
call   1080 <WTERMSIG@plt>
lea    0xdc4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12dd <main+0x11d>
mov    0x4(%rsp),%edi
call   1090 <WEXITSTATUS@plt>
lea    0xdd1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
jmp    12dd <main+0x11d>

LLVM IR (-O0):
@.str = [34 x i8] c"Error - usage: %s (integer)count\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [26 x i8] c"%s is valid, good to go!\0A\00"
@.str.2 = [99 x i8] c"%s is invalid input, argument 2 must be a integer and less than or equal to 2000, exiting program\0A\00"
@.str.3 = [24 x i8] c"This is testforkwait.c\0A\00"
@.str.4 = [64 x i8] c"The child process was not created successfully. Exiting program\00"
@.str.5 = [24 x i8] c"Child process started \0A\00"
@.str.6 = [63 x i8] c"I am the child process and my process id is...(%d) count = %d\0A\00"
@.str.7 = [22 x i8] c"Child process ended \0A\00"
@EXIT_SUCCESS = global i32 0
@.str.8 = [11 x i8] c"wait error\00"
@.str.9 = [43 x i8] c"Child process ended because of signal %d \0A\00"
@.str.10 = [44 x i8] c"Child process ended normally; status = %d \0A\00"
@.str.11 = [25 x i8] c"Parent process started \0A\00"
@.str.12 = [37 x i8] c"Child process did not end normally \0A\00"
@.str.13 = [64 x i8] c"I am the parent process and my process id is...(%d) count = %d\0A\00"
@.str.14 = [22 x i8] c"Parent process ended\0A\00"
@.str.15 = [25 x i8] c"This was testforkwait.c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 2000, i64* %6
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %17, label %24
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %2
store i32 1, i32* %11
br label %25
25: ; preds = %66, %24
%26 = load i32, i32* %11
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %69
29: ; preds = %25
%30 = load i8**, i8*** %5
%31 = load i32, i32* %11
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = call i64 @strtol(i8* %34, i8** %12, i32 10)
store i64 %35, i64* %7
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 2
br i1 %37, label %38, label %56
38: ; preds = %29
%39 = load i8*, i8** %12
%40 = getelementptr inbounds i8, i8* %39, i64 0
%41 = load i8, i8* %40
%42 = icmp ne i8 %41, 0
br i1 %42, label %56, label %43
43: ; preds = %38
%44 = load i64, i64* %7
%45 = icmp sge i64 %44, 0
br i1 %45, label %46, label %56
46: ; preds = %43
%47 = load i64, i64* %7
%48 = icmp sle i64 %47, 2000
br i1 %48, label %49, label %56
49: ; preds = %46
%50 = load i8**, i8*** %5
%51 = load i32, i32* %11
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %50, i64 %52
%54 = load i8*, i8** %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %54)
br label %65
56: ; preds = %46, %43, %38, %29
%57 = load i8**, i8*** %5
%58 = load i32, i32* %11
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8*, i8** %57, i64 %59
%61 = load i8*, i8** %60
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.2, i64 0, i64 0), i8* %61)
%63 = load i32, i32* @EXIT_FAILURE
%64 = call i32 @exit(i32 %63)
unreachable
65: ; preds = %49
br label %66
66: ; preds = %65
%67 = load i32, i32* %11
%68 = add nsw i32 %67, 1
store i32 %68, i32* %11
br label %25
69: ; preds = %25
br label %70
70: ; preds = %69
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%72 = call i32 (...) @fork()
store i32 %72, i32* %10
%73 = load i32, i32* %10
%74 = icmp eq i32 %73, -1
br i1 %74, label %75, label %79
75: ; preds = %70
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0))
%77 = load i32, i32* @EXIT_FAILURE
%78 = call i32 @exit(i32 %77)
unreachable
79: ; preds = %70
%80 = load i32, i32* %10
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %101
82: ; preds = %79
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %13
br label %84
84: ; preds = %94, %82
%85 = load i32, i32* %13
%86 = sext i32 %85 to i64
%87 = load i64, i64* %7
%88 = icmp sle i64 %86, %87
br i1 %88, label %89, label %97
89: ; preds = %84
%90 = call i64 (...) @getpid()
%91 = trunc i64 %90 to i32
%92 = load i32, i32* %13
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i32 %91, i32 %92)
br label %94
94: ; preds = %89
%95 = load i32, i32* %13
%96 = add nsw i32 %95, 1
store i32 %96, i32* %13
br label %84
97: ; preds = %84
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%99 = load i32, i32* @EXIT_SUCCESS
%100 = call i32 @exit(i32 %99)
unreachable
101: ; preds = %79
%102 = call i32 @wait(i32* %8)
store i32 %102, i32* %10
%103 = icmp eq i32 %102, -1
br i1 %103, label %104, label %106
104: ; preds = %101
%105 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
br label %127
106: ; preds = %101
%107 = load i32, i32* %8
%108 = call i64 @WIFSIGNALED(i32 %107)
%109 = icmp ne i64 %108, 0
br i1 %109, label %110, label %114
110: ; preds = %106
%111 = load i32, i32* %8
%112 = call i32 @WTERMSIG(i32 %111)
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), i32 %112)
br label %126
114: ; preds = %106
%115 = load i32, i32* %8
%116 = call i64 @WIFEXITED(i32 %115)
%117 = icmp ne i64 %116, 0
br i1 %117, label %118, label %123
118: ; preds = %114
%119 = load i32, i32* %8
%120 = call i32 @WEXITSTATUS(i32 %119)
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0), i32 %120)
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
br label %125
123: ; preds = %114
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0))
br label %125
125: ; preds = %123, %118
br label %126
126: ; preds = %125, %110
br label %127
127: ; preds = %126, %104
store i32 1, i32* %14
br label %128
128: ; preds = %138, %127
%129 = load i32, i32* %14
%130 = sext i32 %129 to i64
%131 = load i64, i64* %7
%132 = icmp sle i64 %130, %131
br i1 %132, label %133, label %141
133: ; preds = %128
%134 = call i64 (...) @getpid()
%135 = trunc i64 %134 to i32
%136 = load i32, i32* %14
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.13, i64 0, i64 0), i32 %135, i32 %136)
br label %138
138: ; preds = %133
%139 = load i32, i32* %14
%140 = add nsw i32 %139, 1
store i32 %140, i32* %14
br label %128
141: ; preds = %128
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0))
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0))
%144 = load i32, i32* @EXIT_SUCCESS
%145 = call i32 @exit(i32 %144)
unreachable
}

LLVM IR (-O2):
@.str = [34 x i8] c"Error - usage: %s (integer)count\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [26 x i8] c"%s is valid, good to go!\0A\00"
@.str.2 = [99 x i8] c"%s is invalid input, argument 2 must be a integer and less than or equal to 2000, exiting program\0A\00"
@.str.4 = [64 x i8] c"The child process was not created successfully. Exiting program\00"
@.str.6 = [63 x i8] c"I am the child process and my process id is...(%d) count = %d\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.8 = [11 x i8] c"wait error\00"
@.str.9 = [43 x i8] c"Child process ended because of signal %d \0A\00"
@.str.10 = [44 x i8] c"Child process ended normally; status = %d \0A\00"
@.str.13 = [64 x i8] c"I am the parent process and my process id is...(%d) count = %d\0A\00"
@str = [23 x i8] c"This is testforkwait.c\00"
@str.16 = [36 x i8] c"Child process did not end normally \00"
@str.17 = [21 x i8] c"Parent process ended\00"
@str.18 = [24 x i8] c"This was testforkwait.c\00"
@str.19 = [24 x i8] c"Parent process started \00"
@str.20 = [23 x i8] c"Child process started \00"
@str.21 = [21 x i8] c"Child process ended \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = bitcast i32* %3 to i8*
%6 = icmp eq i32 %0, 2
br i1 %6, label %7, label %20
7: ; preds = %2
%8 = bitcast i8** %4 to i8*
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i64 @strtol(i8* %10, i8** %4, i32 10)
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
%15 = icmp sgt i64 %11, -1
%16 = select i1 %14, i1 %15, i1 false
%17 = icmp slt i64 %11, 2001
%18 = select i1 %16, i1 %17, i1 false
%19 = load i8*, i8** %9
br i1 %18, label %25, label %29
20: ; preds = %2
%21 = load i8*, i8** %1
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @EXIT_FAILURE
%24 = tail call i32 @exit(i32 %23)
unreachable
25: ; preds = %7
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%28 = tail call i32 (...) @fork()
switch i32 %28, label %52 [
i32 -1, label %33
i32 0, label %37
]
29: ; preds = %7
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%31 = load i32, i32* @EXIT_FAILURE
%32 = tail call i32 @exit(i32 %31)
unreachable
33: ; preds = %25
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0))
%35 = load i32, i32* @EXIT_FAILURE
%36 = tail call i32 @exit(i32 %35)
unreachable
37: ; preds = %25
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.20, i64 0, i64 0))
%39 = icmp eq i64 %11, 0
br i1 %39, label %48, label %40
40: ; preds = %37, %40
%41 = phi i64 [ %46, %40 ], [ 1, %37 ]
%42 = tail call i64 (...) @getpid()
%43 = trunc i64 %42 to i32
%44 = trunc i64 %41 to i32
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i32 %43, i32 %44)
%46 = add nuw i64 %41, 1
%47 = icmp slt i64 %11, %46
br i1 %47, label %48, label %40
48: ; preds = %40, %37
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.21, i64 0, i64 0))
%50 = load i32, i32* @EXIT_SUCCESS
%51 = tail call i32 @exit(i32 %50)
unreachable
52: ; preds = %25
%53 = call i32 @wait(i32* %3)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
br label %75
57: ; preds = %52
%58 = load i32, i32* %3
%59 = call i64 @WIFSIGNALED(i32 %58)
%60 = icmp eq i64 %59, 0
%61 = load i32, i32* %3
br i1 %60, label %65, label %62
62: ; preds = %57
%63 = call i32 @WTERMSIG(i32 %61)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), i32 %63)
br label %75
65: ; preds = %57
%66 = call i64 @WIFEXITED(i32 %61)
%67 = icmp eq i64 %66, 0
br i1 %67, label %73, label %68
68: ; preds = %65
%69 = load i32, i32* %3
%70 = call i32 @WEXITSTATUS(i32 %69)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0), i32 %70)
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.19, i64 0, i64 0))
br label %75
73: ; preds = %65
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.16, i64 0, i64 0))
br label %75
75: ; preds = %62, %73, %68, %55
%76 = icmp eq i64 %11, 0
br i1 %76, label %85, label %77
77: ; preds = %75, %77
%78 = phi i64 [ %83, %77 ], [ 1, %75 ]
%79 = call i64 (...) @getpid()
%80 = trunc i64 %79 to i32
%81 = trunc i64 %78 to i32
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.13, i64 0, i64 0), i32 %80, i32 %81)
%83 = add nuw i64 %78, 1
%84 = icmp slt i64 %11, %83
br i1 %84, label %85, label %77
85: ; preds = %77, %75
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.17, i64 0, i64 0))
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.18, i64 0, i64 0))
%88 = load i32, i32* @EXIT_SUCCESS
%89 = call i32 @exit(i32 %88)
unreachable
}