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

/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ err_sys(char *);
scalar_t__ fork();
int getpid();
scalar_t__ pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, char, char);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int ret = 0, i = 0;
  char buf[3] = {0};
  int fd[2] = {0};
  if (pipe(fd) < 0)
    err_sys("pipe");
  printf("parent %lu start\n", getpid());
  for (i = 0; i < 3; ++i) {
    pid_t pid = fork();
    if (pid == 0) {
      close(fd[1]);
      ret = read(fd[0], buf, 1);
      if (ret == 0) {
        printf("reach end\n");
        return 0;
      }
      printf("child %ld read %c\n", getpid(), buf[0]);
      sleep(1);
      ret = read(fd[0], buf, 1);
      if (ret == 0) {
        printf("reach end\n");
        return 0;
      }
      printf("child %ld read %c\n", getpid(), buf[0]);
      sleep(i);
      printf("child %ld exit\n", getpid());
      return 0;
    } else if (pid > 0) {
      printf("start child %lu\n", pid);
    } else
      err_sys("fork");
  }
  close(fd[0]);
  for (i = 0; i < 3 + 1; ++i) {
    sprintf(buf, "%c%c", 'a' + i, 'A' + i);
    ret = write(fd[1], buf, 2);
    sleep(2);
    printf("parent write %d with %c\n", ret, 'a' + i);
  }
  sleep(20);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x1b(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1070 <memset@plt>
lea    -0x24(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1070 <memset@plt>
lea    -0x24(%rbp),%rdi
call   1090 <pipe@plt>
cmp    $0x0,%rax
jge    1213 <main+0x63>
lea    0xdf2(%rip),%rdi
call   1030 <err_sys@plt>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,%esi
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    137a <main+0x1ca>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1334 <main+0x184>
mov    -0x20(%rbp),%edi
call   1080 <close@plt>
mov    -0x24(%rbp),%edi
lea    -0x1b(%rbp),%rsi
mov    $0x1,%edx
call   10a0 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1291 <main+0xe1>
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    140b <main+0x25b>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,%esi
movsbl -0x1b(%rbp),%edx
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    -0x24(%rbp),%edi
lea    -0x1b(%rbp),%rsi
mov    $0x1,%edx
call   10a0 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    12ee <main+0x13e>
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    140b <main+0x25b>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,%esi
movsbl -0x1b(%rbp),%edx
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%edi
call   10c0 <sleep@plt>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,%esi
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    140b <main+0x25b>
cmpq   $0x0,-0x30(%rbp)
jle    1356 <main+0x1a6>
mov    -0x30(%rbp),%rsi
lea    0xcfb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1362 <main+0x1b2>
lea    0xcf9(%rip),%rdi
call   1030 <err_sys@plt>
jmp    1367 <main+0x1b7>
jmp    136c <main+0x1bc>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1231 <main+0x81>
mov    -0x24(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    13fa <main+0x24a>
lea    -0x1b(%rbp),%rdi
mov    -0x18(%rbp),%eax
add    $0x61,%eax
mov    %al,%cl
mov    -0x18(%rbp),%eax
add    $0x41,%eax
lea    0xcaf(%rip),%rsi
movsbl %cl,%edx
movsbl %al,%ecx
call   10b0 <sprintf@plt>
mov    -0x20(%rbp),%edi
lea    -0x1b(%rbp),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    %eax,-0x14(%rbp)
mov    $0x2,%edi
call   10c0 <sleep@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
add    $0x61,%edx
lea    0xc7b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1389 <main+0x1d9>
mov    $0x14,%edi
call   10c0 <sleep@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
movb   $0x0,0xe(%rsp)
movw   $0x0,0xc(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x10(%rsp),%rdi
call   1090 <pipe@plt>
test   %rax,%rax
jns    11ea <main+0x3a>
lea    0xe1b(%rip),%rdi
call   1040 <err_sys@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xe0b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   10d0 <fork@plt>
test   %rax,%rax
je     1295 <main+0xe5>
jle    1228 <main+0x78>
lea    0xe1e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1234 <main+0x84>
lea    0xe1c(%rip),%rdi
call   1040 <err_sys@plt>
xor    %eax,%eax
call   10d0 <fork@plt>
test   %rax,%rax
je     1255 <main+0xa5>
jle    125c <main+0xac>
lea    0xdf1(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1268 <main+0xb8>
mov    $0x1,%ebx
jmp    1295 <main+0xe5>
lea    0xde8(%rip),%rdi
call   1040 <err_sys@plt>
xor    %eax,%eax
call   10d0 <fork@plt>
test   %rax,%rax
je     1290 <main+0xe0>
jle    1342 <main+0x192>
lea    0xdb9(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    134e <main+0x19e>
mov    $0x2,%ebx
mov    0x14(%rsp),%edi
call   1080 <close@plt>
mov    0x10(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x1,%edx
call   10a0 <read@plt>
test   %eax,%eax
je     1331 <main+0x181>
xor    %eax,%eax
call   1060 <getpid@plt>
movsbl 0xc(%rsp),%edx
lea    0xd4f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    0x10(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x1,%edx
call   10a0 <read@plt>
test   %eax,%eax
je     1331 <main+0x181>
xor    %eax,%eax
call   1060 <getpid@plt>
movsbl 0xc(%rsp),%edx
lea    0xd12(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebx,%edi
call   10c0 <sleep@plt>
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xd07(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1480 <main+0x2d0>
lea    0xd36(%rip),%rdi
call   1030 <puts@plt>
jmp    1480 <main+0x2d0>
lea    0xd02(%rip),%rdi
call   1040 <err_sys@plt>
mov    0x10(%rsp),%edi
call   1080 <close@plt>
lea    0xcf2(%rip),%r14
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x61,%edx
mov    $0x41,%ecx
call   10b0 <sprintf@plt>
mov    0x14(%rsp),%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1050 <write@plt>
mov    %eax,%ebp
mov    $0x2,%edi
call   10c0 <sleep@plt>
lea    0xcb9(%rip),%r15
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x61,%edx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x62,%edx
mov    $0x42,%ecx
call   10b0 <sprintf@plt>
mov    0x14(%rsp),%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1050 <write@plt>
mov    %eax,%ebp
mov    $0x2,%edi
call   10c0 <sleep@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x62,%edx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x63,%edx
mov    $0x43,%ecx
call   10b0 <sprintf@plt>
mov    0x14(%rsp),%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1050 <write@plt>
mov    %eax,%ebp
mov    $0x2,%edi
call   10c0 <sleep@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x63,%edx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x64,%edx
mov    $0x44,%ecx
call   10b0 <sprintf@plt>
mov    0x14(%rsp),%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1050 <write@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   10c0 <sleep@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x64,%edx
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x14,%edi
call   10c0 <sleep@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"pipe\00"
@.str.1 = [18 x i8] c"parent %lu start\0A\00"
@.str.2 = [11 x i8] c"reach end\0A\00"
@.str.3 = [19 x i8] c"child %ld read %c\0A\00"
@.str.4 = [16 x i8] c"child %ld exit\0A\00"
@.str.5 = [17 x i8] c"start child %lu\0A\00"
@.str.6 = [5 x i8] c"fork\00"
@.str.7 = [5 x i8] c"%c%c\00"
@.str.8 = [25 x i8] c"parent write %d with %c\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 [3 x i8]
%9 = alloca [2 x i32]
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%11 = bitcast [3 x i8]* %8 to i8*
%12 = bitcast [2 x i32]* %9 to i8*
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%14 = call i64 @pipe(i32* %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
%19 = call i32 (...) @getpid()
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %19)
store i32 0, i32* %7
br label %21
21: ; preds = %75, %18
%22 = load i32, i32* %7
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %78
24: ; preds = %21
%25 = call i64 (...) @fork()
store i64 %25, i64* %10
%26 = load i64, i64* %10
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %65
28: ; preds = %24
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%30 = load i32, i32* %29
%31 = call i32 @close(i32 %30)
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%33 = load i32, i32* %32
%34 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%35 = call i32 @read(i32 %33, i8* %34, i32 1)
store i32 %35, i32* %6
%36 = load i32, i32* %6
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %28
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %108
40: ; preds = %28
%41 = call i32 (...) @getpid()
%42 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 %44)
%46 = call i32 @sleep(i32 1)
%47 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%48 = load i32, i32* %47
%49 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%50 = call i32 @read(i32 %48, i8* %49, i32 1)
store i32 %50, i32* %6
%51 = load i32, i32* %6
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %40
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %108
55: ; preds = %40
%56 = call i32 (...) @getpid()
%57 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %56, i32 %59)
%61 = load i32, i32* %7
%62 = call i32 @sleep(i32 %61)
%63 = call i32 (...) @getpid()
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %63)
store i32 0, i32* %3
br label %108
65: ; preds = %24
%66 = load i64, i64* %10
%67 = icmp sgt i64 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = load i64, i64* %10
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i64 %69)
br label %73
71: ; preds = %65
%72 = call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %73
73: ; preds = %71, %68
br label %74
74: ; preds = %73
br label %75
75: ; preds = %74
%76 = load i32, i32* %7
%77 = add nsw i32 %76, 1
store i32 %77, i32* %7
br label %21
78: ; preds = %21
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%80 = load i32, i32* %79
%81 = call i32 @close(i32 %80)
store i32 0, i32* %7
br label %82
82: ; preds = %103, %78
%83 = load i32, i32* %7
%84 = icmp slt i32 %83, 4
br i1 %84, label %85, label %106
85: ; preds = %82
%86 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%87 = load i32, i32* %7
%88 = add nsw i32 97, %87
%89 = trunc i32 %88 to i8
%90 = load i32, i32* %7
%91 = add nsw i32 65, %90
%92 = trunc i32 %91 to i8
%93 = call i32 @sprintf(i8* %86, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8 signext %89, i8 signext %92)
%94 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%95 = load i32, i32* %94
%96 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%97 = call i32 @write(i32 %95, i8* %96, i32 2)
store i32 %97, i32* %6
%98 = call i32 @sleep(i32 2)
%99 = load i32, i32* %6
%100 = load i32, i32* %7
%101 = add nsw i32 97, %100
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %99, i32 %101)
br label %103
103: ; preds = %85
%104 = load i32, i32* %7
%105 = add nsw i32 %104, 1
store i32 %105, i32* %7
br label %82
106: ; preds = %82
%107 = call i32 @sleep(i32 20)
store i32 0, i32* %3
br label %108
108: ; preds = %106, %55, %53, %38
%109 = load i32, i32* %3
ret i32 %109
}

LLVM IR (-O2):
@.str = [5 x i8] c"pipe\00"
@.str.1 = [18 x i8] c"parent %lu start\0A\00"
@.str.3 = [19 x i8] c"child %ld read %c\0A\00"
@.str.4 = [16 x i8] c"child %ld exit\0A\00"
@.str.5 = [17 x i8] c"start child %lu\0A\00"
@.str.6 = [5 x i8] c"fork\00"
@.str.7 = [5 x i8] c"%c%c\00"
@.str.8 = [25 x i8] c"parent write %d with %c\0A\00"
@str.9 = [10 x i8] c"reach end\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i8]
%4 = alloca i64
%5 = bitcast i64* %4 to [2 x i32]*
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%7 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%8 = bitcast i64* %4 to i32*
%9 = call i64 @pipe(i32* %8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = call i32 (...) @getpid()
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = call i64 (...) @fork()
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %47
18: ; preds = %62, %53, %13
%19 = phi i32 [ 0, %13 ], [ 1, %53 ], [ 2, %62 ]
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%21 = load i32, i32* %20
%22 = call i32 @close(i32 %21)
%23 = load i32, i32* %8
%24 = call i32 @read(i32 %23, i8* %6, i32 1)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %18
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.9, i64 0, i64 0))
br label %96
28: ; preds = %18
%29 = call i32 (...) @getpid()
%30 = load i8, i8* %6
%31 = sext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %31)
%33 = call i32 @sleep(i32 1)
%34 = load i32, i32* %8
%35 = call i32 @read(i32 %34, i8* %6, i32 1)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %28
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.9, i64 0, i64 0))
br label %96
39: ; preds = %28
%40 = call i32 (...) @getpid()
%41 = load i8, i8* %6
%42 = sext i8 %41 to i32
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %40, i32 %42)
%44 = call i32 @sleep(i32 %19)
%45 = call i32 (...) @getpid()
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %45)
br label %96
47: ; preds = %13
%48 = icmp sgt i64 %16, 0
br i1 %48, label %49, label %51
49: ; preds = %47
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i64 %16)
br label %53
51: ; preds = %47
%52 = call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %53
53: ; preds = %49, %51
%54 = call i64 (...) @fork()
%55 = icmp eq i64 %54, 0
br i1 %55, label %18, label %56
56: ; preds = %53
%57 = icmp sgt i64 %54, 0
br i1 %57, label %60, label %58
58: ; preds = %56
%59 = call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %62
60: ; preds = %56
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i64 %54)
br label %62
62: ; preds = %60, %58
%63 = call i64 (...) @fork()
%64 = icmp eq i64 %63, 0
br i1 %64, label %18, label %65
65: ; preds = %62
%66 = icmp sgt i64 %63, 0
br i1 %66, label %69, label %67
67: ; preds = %65
%68 = call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %71
69: ; preds = %65
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i64 %63)
br label %71
71: ; preds = %69, %67
%72 = load i32, i32* %8
%73 = call i32 @close(i32 %72)
%74 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%75 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8 signext 97, i8 signext 65)
%76 = load i32, i32* %74
%77 = call i32 @write(i32 %76, i8* %6, i32 2)
%78 = call i32 @sleep(i32 2)
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %77, i32 97)
%80 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8 signext 98, i8 signext 66)
%81 = load i32, i32* %74
%82 = call i32 @write(i32 %81, i8* %6, i32 2)
%83 = call i32 @sleep(i32 2)
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %82, i32 98)
%85 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8 signext 99, i8 signext 67)
%86 = load i32, i32* %74
%87 = call i32 @write(i32 %86, i8* %6, i32 2)
%88 = call i32 @sleep(i32 2)
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %87, i32 99)
%90 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8 signext 100, i8 signext 68)
%91 = load i32, i32* %74
%92 = call i32 @write(i32 %91, i8* %6, i32 2)
%93 = call i32 @sleep(i32 2)
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %92, i32 100)
%95 = call i32 @sleep(i32 20)
br label %96
96: ; preds = %26, %37, %39, %71
ret i32 0
}