#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*/ WNOHANG;
int /*<<< orphan*/ close(int);
int errno;
scalar_t__ execl(char *, char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int fork();
scalar_t__ pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int toChild[2], toParent[2], status, n;
  pid_t pid, return_pid;
  char line[200], str1[10], str2[10];
  if (pipe(toChild) < 0 || pipe(toParent) < 0)
    printf("pipe error: %d/n", errno);
  printf("Input command:\n");
  if ((pid = fork()) < 0) {
    printf("fork error: %d\n", errno);
  } else if (pid > 0) {
    close(toChild[0]);
    close(toParent[1]);
  } else {
    close(toChild[1]);
    close(toParent[0]);
    sprintf(str1, "%d", toChild[0]);
    sprintf(str2, "%d", toParent[1]);
    if (execl("./Server", "Server", str1, str2, NULL) < 0)
      printf("execl error: %d/n", errno);
  }
  while (1) {
    if (fgets(line, 200, stdin) == NULL) {
      printf("fgets error\n");
      printf("Input command(exit to quit):\n");
    } else {
      n = strlen(line);
      if (write(toChild[1], line, n) != n)
        printf("write error to pipe: %d/n", errno);
    }
    if ((n = read(toParent[0], line, 200)) < 0)
      printf("read error from pipe: %d/n", errno);
    line[n] = 0;
    printf("response: %s", line);
    if (strcmp(line, "Server complete.\n") == 0) {
      printf("Interface: child process (%d) completed.\n", pid);
      break;
    }
    printf("Input command:\n");
  }
  waitpid(pid, &status, WNOHANG);
  printf("Interface: child process exit status = %d.\n", status);
  printf("Interface: Complete.\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1070 <pipe@plt>
cmp    $0x0,%rax
jl     120f <main+0x3f>
lea    -0x20(%rbp),%rdi
call   1070 <pipe@plt>
cmp    $0x0,%rax
jge    1226 <main+0x56>
mov    0x2dba(%rip),%rax
mov    (%rax),%esi
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
jge    1263 <main+0x93>
mov    0x2d82(%rip),%rax
mov    (%rax),%esi
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    130f <main+0x13f>
cmpl   $0x0,-0x2c(%rbp)
jle    1282 <main+0xb2>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
jmp    130a <main+0x13a>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
lea    -0x10a(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xd8e(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x114(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xd78(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x10a(%rbp),%rdx
lea    -0x114(%rbp),%rcx
lea    0xd61(%rip),%rdi
lea    0xd5c(%rip),%rsi
xor    %eax,%eax
mov    %eax,%r8d
call   10e0 <execl@plt>
cmp    $0x0,%rax
jge    1305 <main+0x135>
mov    0x2cdb(%rip),%rax
mov    (%rax),%esi
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    130a <main+0x13a>
jmp    130f <main+0x13f>
jmp    1314 <main+0x144>
lea    -0x100(%rbp),%rdi
mov    0x2cc6(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
jne    1359 <main+0x189>
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd0f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    139f <main+0x1cf>
lea    -0x100(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x100(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   1030 <write@plt>
cmp    -0x28(%rbp),%eax
je     139a <main+0x1ca>
mov    0x2c46(%rip),%rax
mov    (%rax),%esi
lea    0xce7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    139f <main+0x1cf>
mov    -0x20(%rbp),%edi
lea    -0x100(%rbp),%rsi
mov    $0xc8,%edx
call   1080 <read@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jge    13d6 <main+0x206>
mov    0x2c0a(%rip),%rax
mov    (%rax),%esi
lea    0xcc5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x28(%rbp),%rax
movb   $0x0,-0x100(%rbp,%rax,1)
lea    -0x100(%rbp),%rsi
lea    0xcbf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x100(%rbp),%rdi
lea    0xcb7(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    142a <main+0x25a>
mov    -0x2c(%rbp),%esi
lea    0xcb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    143d <main+0x26d>
lea    0xbe0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1314 <main+0x144>
mov    -0x2c(%rbp),%edi
mov    0x2b99(%rip),%rax
mov    (%rax),%edx
lea    -0x24(%rbp),%rsi
call   10b0 <waitpid@plt>
mov    -0x24(%rbp),%esi
lea    0xc9c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
lea    0xc(%rsp),%rdi
call   1080 <pipe@plt>
test   %rax,%rax
js     120f <main+0x2f>
lea    0x4(%rsp),%rdi
call   1080 <pipe@plt>
test   %rax,%rax
jns    1226 <main+0x46>
mov    0x2dba(%rip),%rax
mov    (%rax),%esi
lea    0xde1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1100 <fork@plt>
test   %eax,%eax
mov    %eax,0x14(%rsp)
jns    1253 <main+0x73>
mov    0x2d88(%rip),%rax
mov    (%rax),%esi
lea    0xdc0(%rip),%rdi
jmp    12c7 <main+0xe7>
jne    12d0 <main+0xf0>
mov    0x10(%rsp),%edi
call   1070 <close@plt>
mov    0x4(%rsp),%edi
call   1070 <close@plt>
mov    0xc(%rsp),%edx
lea    0xdaf(%rip),%rbx
lea    0x26(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   10d0 <sprintf@plt>
mov    0x8(%rsp),%edx
lea    0x1c(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10d0 <sprintf@plt>
lea    0xd87(%rip),%rdi
lea    0xd82(%rip),%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
xor    %r8d,%r8d
call   10f0 <execl@plt>
test   %rax,%rax
jns    12e2 <main+0x102>
mov    0x2d12(%rip),%rax
mov    (%rax),%esi
lea    0xd66(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12e2 <main+0x102>
mov    0xc(%rsp),%edi
call   1070 <close@plt>
mov    0x8(%rsp),%edi
call   1070 <close@plt>
lea    0x30(%rsp),%rbx
lea    0xd86(%rip),%r13
lea    0xd8c(%rip),%r14
lea    0xded(%rip),%r15
nopl   0x0(%rax)
mov    0x2ce1(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   10a0 <fgets@plt>
test   %rax,%rax
je     1350 <main+0x170>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    0x10(%rsp),%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
cmp    %ebp,%eax
je     1368 <main+0x188>
mov    0x2c92(%rip),%rax
mov    (%rax),%esi
lea    0xcf8(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1368 <main+0x188>
lea    0xdb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xdb6(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
mov    $0xc8,%edx
call   1090 <read@plt>
mov    %eax,%r12d
test   %eax,%eax
jns    1397 <main+0x1b7>
mov    0x2c49(%rip),%rax
mov    (%rax),%esi
lea    0xcc9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movslq %r12d,%rax
movb   $0x0,0x30(%rsp,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     13c9 <main+0x1e9>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    1300 <main+0x120>
lea    0xcc3(%rip),%rdi
mov    0x14(%rsp),%ebx
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2bfc(%rip),%rax
mov    (%rax),%edx
lea    0x18(%rsp),%rsi
mov    %ebx,%edi
call   10c0 <waitpid@plt>
mov    0x18(%rsp),%esi
lea    0xcc0(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xced(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"pipe error: %d/n\00"
@errno = global i32 0
@.str.1 = [16 x i8] c"Input command:\0A\00"
@.str.2 = [16 x i8] c"fork error: %d\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [9 x i8] c"./Server\00"
@.str.5 = [7 x i8] c"Server\00"
@.str.6 = [18 x i8] c"execl error: %d/n\00"
@stdin = global i32 0
@.str.7 = [13 x i8] c"fgets error\0A\00"
@.str.8 = [30 x i8] c"Input command(exit to quit):\0A\00"
@.str.9 = [26 x i8] c"write error to pipe: %d/n\00"
@.str.10 = [27 x i8] c"read error from pipe: %d/n\00"
@.str.11 = [13 x i8] c"response: %s\00"
@.str.12 = [18 x i8] c"Server complete.\0A\00"
@.str.13 = [42 x i8] c"Interface: child process (%d) completed.\0A\00"
@WNOHANG = global i32 0
@.str.14 = [44 x i8] c"Interface: child process exit status = %d.\0A\00"
@.str.15 = [22 x i8] c"Interface: Complete.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i32]
%7 = alloca [2 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [200 x i8]
%13 = alloca [10 x i8]
%14 = alloca [10 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%16 = call i64 @pipe(i32* %15)
%17 = icmp slt i64 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %2
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%20 = call i64 @pipe(i32* %19)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18, %2
%23 = load i32, i32* @errno
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %18
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 (...) @fork()
store i32 %27, i32* %10
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i32, i32* @errno
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %66
32: ; preds = %25
%33 = load i32, i32* %10
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %42
35: ; preds = %32
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%37 = load i32, i32* %36
%38 = call i32 @close(i32 %37)
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%40 = load i32, i32* %39
%41 = call i32 @close(i32 %40)
br label %65
42: ; preds = %32
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%44 = load i32, i32* %43
%45 = call i32 @close(i32 %44)
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%47 = load i32, i32* %46
%48 = call i32 @close(i32 %47)
%49 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%51 = load i32, i32* %50
%52 = call i32 @sprintf(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%55 = load i32, i32* %54
%56 = call i32 @sprintf(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%58 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%59 = call i64 @execl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %57, i8* %58, i32* null)
%60 = icmp slt i64 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %42
%62 = load i32, i32* @errno
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %62)
br label %64
64: ; preds = %61, %42
br label %65
65: ; preds = %64, %35
br label %66
66: ; preds = %65, %29
br label %67
67: ; preds = %66, %110
%68 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%69 = load i32, i32* @stdin
%70 = call i32* @fgets(i8* %68, i32 200, i32 %69)
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %75
72: ; preds = %67
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
br label %89
75: ; preds = %67
%76 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%77 = call i32 @strlen(i8* %76)
store i32 %77, i32* %9
%78 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%79 = load i32, i32* %78
%80 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%81 = load i32, i32* %9
%82 = call i32 @write(i32 %79, i8* %80, i32 %81)
%83 = load i32, i32* %9
%84 = icmp ne i32 %82, %83
br i1 %84, label %85, label %88
85: ; preds = %75
%86 = load i32, i32* @errno
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %86)
br label %88
88: ; preds = %85, %75
br label %89
89: ; preds = %88, %72
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%91 = load i32, i32* %90
%92 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%93 = call i32 @read(i32 %91, i8* %92, i32 200)
store i32 %93, i32* %9
%94 = icmp slt i32 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %89
%96 = load i32, i32* @errno
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i32 %96)
br label %98
98: ; preds = %95, %89
%99 = load i32, i32* %9
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 %100
store i8 0, i8* %101
%102 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i8* %102)
%104 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%105 = call i64 @strcmp(i8* %104, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0))
%106 = icmp eq i64 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %98
%108 = load i32, i32* %10
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i32 %108)
br label %112
110: ; preds = %98
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %67
112: ; preds = %107
%113 = load i32, i32* %10
%114 = load i32, i32* @WNOHANG
%115 = call i32 @waitpid(i32 %113, i32* %8, i32 %114)
%116 = load i32, i32* %8
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.14, i64 0, i64 0), i32 %116)
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0))
%119 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [17 x i8] c"pipe error: %d/n\00"
@errno = global i32 0
@.str.2 = [16 x i8] c"fork error: %d\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [9 x i8] c"./Server\00"
@.str.5 = [7 x i8] c"Server\00"
@.str.6 = [18 x i8] c"execl error: %d/n\00"
@stdin = global i32 0
@.str.9 = [26 x i8] c"write error to pipe: %d/n\00"
@.str.10 = [27 x i8] c"read error from pipe: %d/n\00"
@.str.11 = [13 x i8] c"response: %s\00"
@.str.12 = [18 x i8] c"Server complete.\0A\00"
@.str.13 = [42 x i8] c"Interface: child process (%d) completed.\0A\00"
@WNOHANG = global i32 0
@.str.14 = [44 x i8] c"Interface: child process exit status = %d.\0A\00"
@str.16 = [15 x i8] c"Input command:\00"
@str.17 = [21 x i8] c"Interface: Complete.\00"
@str.18 = [12 x i8] c"fgets error\00"
@str.19 = [29 x i8] c"Input command(exit to quit):\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x i32]
%4 = alloca [2 x i32]
%5 = alloca i32
%6 = alloca [200 x i8]
%7 = alloca [10 x i8]
%8 = alloca [10 x i8]
%9 = bitcast [2 x i32]* %3 to i8*
%10 = bitcast [2 x i32]* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%16 = call i64 @pipe(i32* %15)
%17 = icmp slt i64 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %2
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%20 = call i64 @pipe(i32* %19)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18, %2
%23 = load i32, i32* @errno
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %18
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.16, i64 0, i64 0))
%27 = call i32 (...) @fork()
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i32, i32* @errno
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %57
32: ; preds = %25
%33 = icmp eq i32 %27, 0
br i1 %33, label %40, label %34
34: ; preds = %32
%35 = load i32, i32* %15
%36 = call i32 @close(i32 %35)
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%38 = load i32, i32* %37
%39 = call i32 @close(i32 %38)
br label %57
40: ; preds = %32
%41 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%42 = load i32, i32* %41
%43 = call i32 @close(i32 %42)
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%45 = load i32, i32* %44
%46 = call i32 @close(i32 %45)
%47 = load i32, i32* %15
%48 = call i32 @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%50 = load i32, i32* %49
%51 = call i32 @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %50)
%52 = call i64 @execl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %13, i8* %14, i32* null)
%53 = icmp slt i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %40
%55 = load i32, i32* @errno
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %34, %54, %40, %29
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%59 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
br label %60
60: ; preds = %96, %57
%61 = load i32, i32* @stdin
%62 = call i32* @fgets(i8* %12, i32 200, i32 %61)
%63 = icmp eq i32* %62, null
br i1 %63, label %64, label %67
64: ; preds = %60
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.18, i64 0, i64 0))
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.19, i64 0, i64 0))
br label %75
67: ; preds = %60
%68 = call i32 @strlen(i8* %12)
%69 = load i32, i32* %58
%70 = call i32 @write(i32 %69, i8* %12, i32 %68)
%71 = icmp eq i32 %70, %68
br i1 %71, label %75, label %72
72: ; preds = %67
%73 = load i32, i32* @errno
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %73)
br label %75
75: ; preds = %67, %72, %64
%76 = load i32, i32* %59
%77 = call i32 @read(i32 %76, i8* %12, i32 200)
%78 = icmp slt i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %75
%80 = load i32, i32* @errno
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i32 %80)
br label %82
82: ; preds = %79, %75
%83 = sext i32 %77 to i64
%84 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 %83
store i8 0, i8* %84
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i8* %12)
%86 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0))
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %96
88: ; preds = %82
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i32 %27)
%90 = load i32, i32* @WNOHANG
%91 = call i32 @waitpid(i32 %27, i32* %5, i32 %90)
%92 = load i32, i32* %5
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.14, i64 0, i64 0), i32 %92)
%94 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.17, i64 0, i64 0))
%95 = call i32 @exit(i32 0)
unreachable
96: ; preds = %82
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.16, i64 0, i64 0))
br label %60
}