#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*/ AF_LOCAL;
int /*<<< orphan*/ SOCK_STREAM;
int WEXITSTATUS(int);
int atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int socketpair(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
               int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ wait(int *);
int main(int argc, char **argv) {
  int i;
  if (argc < 3)
    return 1;
  char buf[80];
  printf("\x1b[1;32m*\x1b[0m %s...", argv[1]);
  char cbuf[4096];
  argc -= 2;
  argv += 1;
  for (i = 0; i < argc; i++)
    argv[i] = argv[i + 1];
  argv[argc] = NULL;
  int fd[2];
  if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fd) == -1) {
    printf("\n");
    execvp(argv[0], argv);
  }
  int pid;
  if ((pid = fork()) == -1) {
    printf("\n");
    execvp(argv[0], argv);
  } else if (pid == 0) {
    printf("Child");
    close(fd[1]);
    dup2(fd[0], 0);
    dup2(0, 1);
    dup2(0, 2);
    execvp(argv[0], argv);
  } else {
    char *cols1 = getenv("COLUMNS");
    int cols;
    if (cols1) {
      cols = atoi(cols1);
    } else {
      cols = 80;
    }
    close(fd[0]);
    int delta = 1;
    int ct = 0;
    while (delta != 0) {
      delta = read(fd[1], cbuf + ct, 4096 - ct);
      ct += delta;
    }
    cbuf[ct] = 0;
    int status;
    wait(&status);
    fflush(NULL);
    if (status) {
      fprintf(stderr, "\x1b[%dG\x1b[1;34m[\x1b[1;31m!!\x1b[1;34m]\x1b[0m\n",
              cols - 4);
    } else if (ct) {
      fprintf(stderr, "\x1b[%dG\x1b[1;34m[\x1b[0;33mWW\x1b[1;34m]\x1b[0m\n",
              cols - 4);
    } else {
      fprintf(stderr, "\x1b[%dG\x1b[1;34m[\x1b[1;32mOK\x1b[1;34m]\x1b[0m\n",
              cols - 4);
    }
    fflush(NULL);
    printf("%s", cbuf);
    fflush(NULL);
    return WEXITSTATUS(status);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11ff <main+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    14f0 <main+0x320>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1268 <main+0x98>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1231 <main+0x61>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
mov    0x2d48(%rip),%rax
mov    (%rax),%esi
lea    -0x1078(%rbp),%rcx
xor    %edx,%edx
call   1090 <socketpair@plt>
cmp    $0xffffffff,%eax
jne    12bf <main+0xef>
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   10c0 <execvp@plt>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x107c(%rbp)
cmp    $0xffffffff,%eax
jne    12f8 <main+0x128>
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   10c0 <execvp@plt>
jmp    14f0 <main+0x320>
cmpl   $0x0,-0x107c(%rbp)
jne    1358 <main+0x188>
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1074(%rbp),%edi
call   1060 <close@plt>
mov    -0x1078(%rbp),%edi
xor    %esi,%esi
call   1040 <dup2@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <dup2@plt>
xor    %edi,%edi
mov    $0x2,%esi
call   1040 <dup2@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   10c0 <execvp@plt>
jmp    14eb <main+0x31b>
lea    0xcba(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x1088(%rbp)
cmpq   $0x0,-0x1088(%rbp)
je     1390 <main+0x1c0>
mov    -0x1088(%rbp),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x108c(%rbp)
jmp    139a <main+0x1ca>
movl   $0x50,-0x108c(%rbp)
mov    -0x1078(%rbp),%edi
call   1060 <close@plt>
movl   $0x1,-0x1090(%rbp)
movl   $0x0,-0x1094(%rbp)
cmpl   $0x0,-0x1090(%rbp)
je     140a <main+0x23a>
mov    -0x1074(%rbp),%edi
lea    -0x1070(%rbp),%rsi
movslq -0x1094(%rbp),%rax
add    %rax,%rsi
mov    $0x1000,%edx
sub    -0x1094(%rbp),%edx
call   1070 <read@plt>
mov    %eax,-0x1090(%rbp)
mov    -0x1090(%rbp),%eax
add    -0x1094(%rbp),%eax
mov    %eax,-0x1094(%rbp)
jmp    13b9 <main+0x1e9>
movslq -0x1094(%rbp),%rax
movb   $0x0,-0x1070(%rbp,%rax,1)
lea    -0x1098(%rbp),%rdi
call   10e0 <wait@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
cmpl   $0x0,-0x1098(%rbp)
je     145e <main+0x28e>
mov    0x2b96(%rip),%rax
mov    (%rax),%edi
mov    -0x108c(%rbp),%edx
sub    $0x4,%edx
lea    0xbcd(%rip),%rsi
call   1080 <fprintf@plt>
jmp    14b1 <main+0x2e1>
cmpl   $0x0,-0x1094(%rbp)
je     148e <main+0x2be>
mov    0x2b66(%rip),%rax
mov    (%rax),%edi
mov    -0x108c(%rbp),%edx
sub    $0x4,%edx
lea    0xbc1(%rip),%rsi
call   1080 <fprintf@plt>
jmp    14ac <main+0x2dc>
mov    0x2b43(%rip),%rax
mov    (%rax),%edi
mov    -0x108c(%rbp),%edx
sub    $0x4,%edx
lea    0xbc2(%rip),%rsi
call   1080 <fprintf@plt>
jmp    14b1 <main+0x2e1>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
lea    -0x1070(%rbp),%rsi
lea    0xbc5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
mov    -0x1098(%rbp),%edi
call   10b0 <WEXITSTATUS@plt>
mov    %eax,-0x4(%rbp)
jmp    14f0 <main+0x320>
jmp    14f0 <main+0x320>
mov    -0x4(%rbp),%eax
add    $0x10a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1018,%rsp
mov    $0x1,%r15d
cmp    $0x3,%edi
jl     13d4 <main+0x1e4>
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x8(%rsi),%r14
mov    0x8(%rsi),%rsi
lea    0xde0(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0xfffffffe,%ebp
lea    0x10(%rbx),%rsi
lea    0x0(,%rbp,8),%rdx
mov    %r14,%rdi
call   10c0 <memmove@plt>
movq   $0x0,0x8(%rbx,%rbp,8)
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
mov    0x2d79(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rcx
xor    %edx,%edx
call   10a0 <socketpair@plt>
cmp    $0xffffffff,%eax
jne    127f <main+0x8f>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    (%r14),%rdi
mov    %r14,%rsi
call   10e0 <execvp@plt>
xor    %r15d,%r15d
xor    %eax,%eax
call   1110 <fork@plt>
test   %eax,%eax
je     12af <main+0xbf>
cmp    $0xffffffff,%eax
jne    12f9 <main+0x109>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    (%r14),%rdi
mov    %r14,%rsi
call   10e0 <execvp@plt>
xor    %r15d,%r15d
jmp    13d4 <main+0x1e4>
lea    0xd5d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%edi
call   1070 <close@plt>
mov    0x8(%rsp),%edi
xor    %esi,%esi
call   1050 <dup2@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <dup2@plt>
xor    %edi,%edi
mov    $0x2,%esi
call   1050 <dup2@plt>
mov    (%r14),%rdi
mov    %r14,%rsi
call   10e0 <execvp@plt>
jmp    13d4 <main+0x1e4>
lea    0xd19(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1319 <main+0x129>
mov    %rax,%rdi
call   10f0 <atoi@plt>
mov    %eax,%ebx
add    $0xfffffffc,%ebx
jmp    131e <main+0x12e>
mov    $0x4c,%ebx
mov    0x8(%rsp),%edi
call   1070 <close@plt>
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    0xc(%rsp),%edi
movslq %ebp,%rbp
lea    (%rsp,%rbp,1),%rsi
add    $0x10,%rsi
mov    $0x1000,%edx
sub    %ebp,%edx
call   1080 <read@plt>
add    %eax,%ebp
test   %eax,%eax
jne    1330 <main+0x140>
movslq %ebp,%rax
movb   $0x0,0x10(%rsp,%rax,1)
lea    0x4(%rsp),%rdi
call   1100 <wait@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
cmpl   $0x0,0x4(%rsp)
je     1383 <main+0x193>
mov    0x2c60(%rip),%rax
mov    (%rax),%edi
lea    0xca0(%rip),%rsi
jmp    13a0 <main+0x1b0>
mov    0x2c4e(%rip),%rax
mov    (%rax),%edi
test   %ebp,%ebp
je     1399 <main+0x1a9>
lea    0xcae(%rip),%rsi
jmp    13a0 <main+0x1b0>
lea    0xcc9(%rip),%rsi
mov    %ebx,%edx
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
lea    0xcd8(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    0x4(%rsp),%edi
call   10d0 <WEXITSTATUS@plt>
mov    %eax,%r15d
mov    %r15d,%eax
add    $0x1018,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\1B[1;32m*\1B[0m %s...\00"
@AF_LOCAL = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [6 x i8] c"Child\00"
@.str.3 = [8 x i8] c"COLUMNS\00"
@stderr = global i32 0
@.str.4 = [36 x i8] c"\1B[%dG\1B[1;34m[\1B[1;31m!!\1B[1;34m]\1B[0m\0A\00"
@.str.5 = [36 x i8] c"\1B[%dG\1B[1;34m[\1B[0;33mWW\1B[1;34m]\1B[0m\0A\00"
@.str.6 = [36 x i8] c"\1B[%dG\1B[1;34m[\1B[1;32mOK\1B[1;34m]\1B[0m\0A\00"
@.str.7 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [80 x i8]
%8 = alloca [4096 x i8]
%9 = alloca [2 x i32]
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 3
br i1 %17, label %18, label %19
18: ; preds = %2
store i32 1, i32* %3
br label %154
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 2
store i32 %25, i32* %4
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
store i8** %27, i8*** %5
store i32 0, i32* %6
br label %28
28: ; preds = %43, %19
%29 = load i32, i32* %6
%30 = load i32, i32* %4
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %46
32: ; preds = %28
%33 = load i8**, i8*** %5
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %33, i64 %36
%38 = load i8*, i8** %37
%39 = load i8**, i8*** %5
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
store i8* %38, i8** %42
br label %43
43: ; preds = %32
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %28
46: ; preds = %28
%47 = load i8**, i8*** %5
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
store i8* null, i8** %50
%51 = load i32, i32* @AF_LOCAL
%52 = load i32, i32* @SOCK_STREAM
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%54 = call i32 @socketpair(i32 %51, i32 %52, i32 0, i32* %53)
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %63
56: ; preds = %46
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 0
%60 = load i8*, i8** %59
%61 = load i8**, i8*** %5
%62 = call i32 @execvp(i8* %60, i8** %61)
br label %63
63: ; preds = %56, %46
%64 = call i32 (...) @fork()
store i32 %64, i32* %10
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %73
66: ; preds = %63
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 0
%70 = load i8*, i8** %69
%71 = load i8**, i8*** %5
%72 = call i32 @execvp(i8* %70, i8** %71)
br label %154
73: ; preds = %63
%74 = load i32, i32* %10
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %91
76: ; preds = %73
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%78 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%79 = load i32, i32* %78
%80 = call i32 @close(i32 %79)
%81 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%82 = load i32, i32* %81
%83 = call i32 @dup2(i32 %82, i32 0)
%84 = call i32 @dup2(i32 0, i32 1)
%85 = call i32 @dup2(i32 0, i32 2)
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 0
%88 = load i8*, i8** %87
%89 = load i8**, i8*** %5
%90 = call i32 @execvp(i8* %88, i8** %89)
br label %153
91: ; preds = %73
%92 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i8* %92, i8** %11
%93 = load i8*, i8** %11
%94 = icmp ne i8* %93, null
br i1 %94, label %95, label %98
95: ; preds = %91
%96 = load i8*, i8** %11
%97 = call i32 @atoi(i8* %96)
store i32 %97, i32* %12
br label %99
98: ; preds = %91
store i32 80, i32* %12
br label %99
99: ; preds = %98, %95
%100 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%101 = load i32, i32* %100
%102 = call i32 @close(i32 %101)
store i32 1, i32* %13
store i32 0, i32* %14
br label %103
103: ; preds = %106, %99
%104 = load i32, i32* %13
%105 = icmp ne i32 %104, 0
br i1 %105, label %106, label %119
106: ; preds = %103
%107 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%108 = load i32, i32* %107
%109 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%110 = load i32, i32* %14
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %109, i64 %111
%113 = load i32, i32* %14
%114 = sub nsw i32 4096, %113
%115 = call i32 @read(i32 %108, i8* %112, i32 %114)
store i32 %115, i32* %13
%116 = load i32, i32* %13
%117 = load i32, i32* %14
%118 = add nsw i32 %117, %116
store i32 %118, i32* %14
br label %103
119: ; preds = %103
%120 = load i32, i32* %14
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 %121
store i8 0, i8* %122
%123 = call i32 @wait(i32* %15)
%124 = call i32 @fflush(i32* null)
%125 = load i32, i32* %15
%126 = icmp ne i32 %125, 0
br i1 %126, label %127, label %132
127: ; preds = %119
%128 = load i32, i32* @stderr
%129 = load i32, i32* %12
%130 = sub nsw i32 %129, 4
%131 = call i32 @fprintf(i32 %128, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %130)
br label %146
132: ; preds = %119
%133 = load i32, i32* %14
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %140
135: ; preds = %132
%136 = load i32, i32* @stderr
%137 = load i32, i32* %12
%138 = sub nsw i32 %137, 4
%139 = call i32 @fprintf(i32 %136, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %138)
br label %145
140: ; preds = %132
%141 = load i32, i32* @stderr
%142 = load i32, i32* %12
%143 = sub nsw i32 %142, 4
%144 = call i32 @fprintf(i32 %141, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i32 %143)
br label %145
145: ; preds = %140, %135
br label %146
146: ; preds = %145, %127
%147 = call i32 @fflush(i32* null)
%148 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %148)
%150 = call i32 @fflush(i32* null)
%151 = load i32, i32* %15
%152 = call i32 @WEXITSTATUS(i32 %151)
store i32 %152, i32* %3
br label %154
153: ; preds = %76
br label %154
154: ; preds = %18, %146, %153, %66
%155 = load i32, i32* %3
ret i32 %155
}

LLVM IR (-O2):
@.str = [19 x i8] c"\1B[1;32m*\1B[0m %s...\00"
@AF_LOCAL = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [6 x i8] c"Child\00"
@.str.3 = [8 x i8] c"COLUMNS\00"
@stderr = global i32 0
@.str.4 = [36 x i8] c"\1B[%dG\1B[1;34m[\1B[1;31m!!\1B[1;34m]\1B[0m\0A\00"
@.str.5 = [36 x i8] c"\1B[%dG\1B[1;34m[\1B[0;33mWW\1B[1;34m]\1B[0m\0A\00"
@.str.6 = [36 x i8] c"\1B[%dG\1B[1;34m[\1B[1;32mOK\1B[1;34m]\1B[0m\0A\00"
@.str.7 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [4096 x i8]
%4 = alloca [2 x i32]
%5 = alloca i32
%6 = icmp slt i32 %0, 3
br i1 %6, label %93, label %7
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%12 = add nsw i32 %0, -2
%13 = bitcast i8** %8 to i8*
%14 = getelementptr i8*, i8** %1, i64 2
%15 = bitcast i8** %14 to i8*
%16 = zext i32 %12 to i64
%17 = shl nuw nsw i64 %16, 3
%18 = zext i32 %12 to i64
%19 = getelementptr inbounds i8*, i8** %8, i64 %18
store i8* null, i8** %19
%20 = bitcast [2 x i32]* %4 to i8*
%21 = load i32, i32* @AF_LOCAL
%22 = load i32, i32* @SOCK_STREAM
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%24 = call i32 @socketpair(i32 %21, i32 %22, i32 0, i32* %23)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %30
26: ; preds = %7
%27 = call i32 @putchar(i32 10)
%28 = load i8*, i8** %8
%29 = call i32 @execvp(i8* %28, i8** %8)
br label %30
30: ; preds = %26, %7
%31 = call i32 (...) @fork()
switch i32 %31, label %47 [
i32 -1, label %32
i32 0, label %36
]
32: ; preds = %30
%33 = call i32 @putchar(i32 10)
%34 = load i8*, i8** %8
%35 = call i32 @execvp(i8* %34, i8** %8)
br label %91
36: ; preds = %30
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%39 = load i32, i32* %38
%40 = call i32 @close(i32 %39)
%41 = load i32, i32* %23
%42 = call i32 @dup2(i32 %41, i32 0)
%43 = call i32 @dup2(i32 0, i32 1)
%44 = call i32 @dup2(i32 0, i32 2)
%45 = load i8*, i8** %8
%46 = call i32 @execvp(i8* %45, i8** %8)
br label %91
47: ; preds = %30
%48 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%49 = icmp eq i8* %48, null
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = call i32 @atoi(i8* %48)
%52 = add i32 %51, -4
br label %53
53: ; preds = %47, %50
%54 = phi i32 [ %52, %50 ], [ 76, %47 ]
%55 = load i32, i32* %23
%56 = call i32 @close(i32 %55)
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
br label %58
58: ; preds = %53, %58
%59 = phi i32 [ 0, %53 ], [ %65, %58 ]
%60 = load i32, i32* %57
%61 = sext i32 %59 to i64
%62 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %61
%63 = sub nsw i32 4096, %59
%64 = call i32 @read(i32 %60, i8* %62, i32 %63)
%65 = add nsw i32 %64, %59
%66 = icmp eq i32 %64, 0
br i1 %66, label %67, label %58
67: ; preds = %58
%68 = sext i32 %65 to i64
%69 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %68
store i8 0, i8* %69
%70 = bitcast i32* %5 to i8*
%71 = call i32 @wait(i32* %5)
%72 = call i32 @fflush(i32* null)
%73 = load i32, i32* %5
%74 = icmp eq i32 %73, 0
br i1 %74, label %78, label %75
75: ; preds = %67
%76 = load i32, i32* @stderr
%77 = call i32 @fprintf(i32 %76, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %54)
br label %85
78: ; preds = %67
%79 = icmp eq i32 %65, 0
%80 = load i32, i32* @stderr
br i1 %79, label %83, label %81
81: ; preds = %78
%82 = call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %54)
br label %85
83: ; preds = %78
%84 = call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i32 %54)
br label %85
85: ; preds = %81, %83, %75
%86 = call i32 @fflush(i32* null)
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %11)
%88 = call i32 @fflush(i32* null)
%89 = load i32, i32* %5
%90 = call i32 @WEXITSTATUS(i32 %89)
br label %91
91: ; preds = %32, %36, %85
%92 = phi i32 [ %90, %85 ], [ 0, %36 ], [ 0, %32 ]
br label %93
93: ; preds = %2, %91
%94 = phi i32 [ %92, %91 ], [ 1, %2 ]
ret i32 %94
}