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

/* Variables and functions */
int STDIN_FILENO;
int /*<<< orphan*/ close(int);
int dup2(int, int);
scalar_t__ execl(char *, char *, char *);
int /*<<< orphan*/ exit(int);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getenv(char *);
scalar_t__ pipe(int *);
int /*<<< orphan*/ stderr;
int strlen(char *);
char *strrchr(char *, char);
scalar_t__ waitpid(scalar_t__, int /*<<< orphan*/ *, int /*<<< orphan*/);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int n;
  int fd[2];
  pid_t pid;
  char *pager, *argv0;
  char line[4096];
  FILE *fp;
  if (argc != 2) {
    fprintf(stderr, "usage: a.out <pathname>");
    exit(1);
  }
  if ((fp = fopen(argv[1], "r")) == NULL) {
    fprintf(stderr, "can't open %s", argv[1]);
    exit(1);
  }
  if (pipe(fd) < 0) {
    fprintf(stderr, "pipe error");
    exit(1);
  }
  if ((pid = fork()) < 0) {
    fprintf(stderr, "fork error");
    exit(1);
  } else if (pid > 0) {
    close(fd[0]);
    while (fgets(line, 4096, fp) != NULL) {
      n = strlen(line);
      if (write(fd[1], line, n) != n)
        fprintf(stderr, "write error to pipe");
    }
    if (ferror(fp))
      fprintf(stderr, "fgets error");
    close(fd[1]);
    if (waitpid(pid, NULL, 0) < 0) {
      fprintf(stderr, "waitpid error");
      exit(1);
    }
    exit(0);
  } else {
    close(fd[1]);
    if (fd[0] != STDIN_FILENO) {
      if (dup2(fd[0], STDIN_FILENO) != STDIN_FILENO) {
        fprintf(stderr, "dup2 error to stdin");
        exit(1);
      }
      close(fd[0]);
    }
    if ((pager = getenv("PAGER")) == NULL)
      pager = "/usr/bin/more";
    if ((argv0 = strrchr(pager, '/')) != NULL)
      argv0++;
    else
      argv0 = pager;
    if (execl(pager, argv0, (char *)0) < 0) {
      fprintf(stderr, "execl error for %s", pager);
      exit(1);
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1050,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1234 <main+0x44>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
lea    0xddd(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe25(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x1048(%rbp)
cmp    $0x0,%rax
jne    1282 <main+0x92>
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xda7(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    -0x1c(%rbp),%rdi
call   10a0 <pipe@plt>
cmp    $0x0,%rax
jge    12b6 <main+0xc6>
mov    0x2d44(%rip),%rax
mov    (%rax),%edi
lea    0xd81(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    $0x0,%al
call   1110 <fork@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jge    12ec <main+0xfc>
mov    0x2d0e(%rip),%rax
mov    (%rax),%edi
lea    0xd56(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpq   $0x0,-0x28(%rbp)
jle    13dd <main+0x1ed>
mov    -0x1c(%rbp),%edi
call   1090 <close@plt>
lea    -0x1040(%rbp),%rdi
mov    -0x1048(%rbp),%rdx
mov    $0x1000,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
je     1367 <main+0x177>
lea    -0x1040(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x1040(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <write@plt>
cmp    -0x14(%rbp),%eax
je     1362 <main+0x172>
mov    0x2c8e(%rip),%rax
mov    (%rax),%edi
lea    0xce1(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
jmp    12ff <main+0x10f>
mov    -0x1048(%rbp),%rdi
call   1040 <ferror@plt>
cmp    $0x0,%rax
je     1394 <main+0x1a4>
mov    0x2c5c(%rip),%rax
mov    (%rax),%edi
lea    0xcc3(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10d0 <waitpid@plt>
cmp    $0x0,%rax
jge    13d6 <main+0x1e6>
mov    0x2c24(%rip),%rax
mov    (%rax),%edi
lea    0xc97(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
mov    -0x1c(%rbp),%eax
mov    0x2be9(%rip),%rcx
cmp    (%rcx),%eax
je     1440 <main+0x250>
mov    -0x1c(%rbp),%edi
mov    0x2bd7(%rip),%rax
mov    (%rax),%esi
call   1070 <dup2@plt>
mov    0x2bc9(%rip),%rcx
cmp    (%rcx),%eax
je     1438 <main+0x248>
mov    0x2bc2(%rip),%rax
mov    (%rax),%edi
lea    0xc43(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x1c(%rbp),%edi
call   1090 <close@plt>
lea    0xc37(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    1465 <main+0x275>
lea    0xc23(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     1492 <main+0x2a2>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    149a <main+0x2aa>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1100 <execl@plt>
cmp    $0x0,%rax
jge    14da <main+0x2ea>
mov    0x2b24(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xbc9(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    14df <main+0x2ef>
jmp    14e4 <main+0x2f4>
xor    %edi,%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1018,%rsp
cmp    $0x2,%edi
jne    1243 <main+0x53>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe54(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
jne    1264 <main+0x74>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xde6(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
lea    0xdad(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    %rax,%r15
lea    0x8(%rsp),%rdi
call   10a0 <pipe@plt>
test   %rax,%rax
jns    1288 <main+0x98>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
lea    0xda0(%rip),%rsi
jmp    1253 <main+0x63>
xor    %eax,%eax
call   1110 <fork@plt>
test   %rax,%rax
jns    12a6 <main+0xb6>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
lea    0xd8d(%rip),%rsi
jmp    1253 <main+0x63>
jne    1339 <main+0x149>
mov    0xc(%rsp),%edi
call   1090 <close@plt>
mov    0x8(%rsp),%edi
mov    0x2d18(%rip),%rbx
mov    (%rbx),%esi
cmp    %esi,%edi
je     12dc <main+0xec>
call   1070 <dup2@plt>
cmp    (%rbx),%eax
jne    1415 <main+0x225>
mov    0x8(%rsp),%edi
call   1090 <close@plt>
lea    0xd9b(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xd92(%rip),%rbx
cmovne %rax,%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
lea    0x1(%rax),%rsi
test   %rax,%rax
cmove  %rbx,%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   1100 <execl@plt>
test   %rax,%rax
jns    13af <main+0x1bf>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
lea    0xd61(%rip),%rsi
mov    %rbx,%rdx
jmp    1232 <main+0x42>
mov    %rax,%r14
mov    0x8(%rsp),%edi
call   1090 <close@plt>
lea    0x10(%rsp),%rdi
mov    $0x1000,%esi
mov    %r15,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
jne    13b6 <main+0x1c6>
mov    %r15,%rdi
call   1040 <ferror@plt>
test   %rax,%rax
je     1380 <main+0x190>
mov    0x2c70(%rip),%rax
mov    (%rax),%edi
lea    0xcd7(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    0xc(%rsp),%edi
call   1090 <close@plt>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <waitpid@plt>
test   %rax,%rax
jns    13af <main+0x1bf>
mov    0x2c3f(%rip),%rax
mov    (%rax),%edi
lea    0xcb2(%rip),%rsi
jmp    1253 <main+0x63>
xor    %edi,%edi
call   10f0 <exit@plt>
lea    0x10(%rsp),%rbx
mov    0x2c1e(%rip),%r13
lea    0xc73(%rip),%r12
jmp    13e9 <main+0x1f9>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r15,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     135c <main+0x16c>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebp
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <write@plt>
cmp    %ebp,%eax
je     13d0 <main+0x1e0>
mov    0x0(%r13),%edi
mov    %r12,%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
jmp    13d0 <main+0x1e0>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
lea    0xc45(%rip),%rsi
jmp    1253 <main+0x63>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"usage: a.out <pathname>\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"can't open %s\00"
@.str.3 = [11 x i8] c"pipe error\00"
@.str.4 = [11 x i8] c"fork error\00"
@.str.5 = [20 x i8] c"write error to pipe\00"
@.str.6 = [12 x i8] c"fgets error\00"
@.str.7 = [14 x i8] c"waitpid error\00"
@STDIN_FILENO = global i32 0
@.str.8 = [20 x i8] c"dup2 error to stdin\00"
@.str.9 = [6 x i8] c"PAGER\00"
@.str.10 = [14 x i8] c"/usr/bin/more\00"
@.str.11 = [19 x i8] c"execl error for %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [2 x i32]
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [4096 x i8]
%12 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %12
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %32
25: ; preds = %19
%26 = load i32, i32* @stderr
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %19
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%34 = call i64 @pipe(i32* %33)
%35 = icmp slt i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %32
%41 = call i64 (...) @fork()
store i64 %41, i64* %8
%42 = icmp slt i64 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %40
%48 = load i64, i64* %8
%49 = icmp sgt i64 %48, 0
br i1 %49, label %50, label %93
50: ; preds = %47
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%52 = load i32, i32* %51
%53 = call i32 @close(i32 %52)
br label %54
54: ; preds = %72, %50
%55 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%56 = load i32*, i32** %12
%57 = call i32* @fgets(i8* %55, i32 4096, i32* %56)
%58 = icmp ne i32* %57, null
br i1 %58, label %59, label %73
59: ; preds = %54
%60 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%61 = call i32 @strlen(i8* %60)
store i32 %61, i32* %6
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%63 = load i32, i32* %62
%64 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%65 = load i32, i32* %6
%66 = call i32 @write(i32 %63, i8* %64, i32 %65)
%67 = load i32, i32* %6
%68 = icmp ne i32 %66, %67
br i1 %68, label %69, label %72
69: ; preds = %59
%70 = load i32, i32* @stderr
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %72
72: ; preds = %69, %59
br label %54
73: ; preds = %54
%74 = load i32*, i32** %12
%75 = call i64 @ferror(i32* %74)
%76 = icmp ne i64 %75, 0
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 ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %80
80: ; preds = %77, %73
%81 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%82 = load i32, i32* %81
%83 = call i32 @close(i32 %82)
%84 = load i64, i64* %8
%85 = call i64 @waitpid(i64 %84, i32* null, i32 0)
%86 = icmp slt i64 %85, 0
br i1 %86, label %87, label %91
87: ; preds = %80
%88 = load i32, i32* @stderr
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%90 = call i32 @exit(i32 1)
unreachable
91: ; preds = %80
%92 = call i32 @exit(i32 0)
unreachable
93: ; preds = %47
%94 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%95 = load i32, i32* %94
%96 = call i32 @close(i32 %95)
%97 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%98 = load i32, i32* %97
%99 = load i32, i32* @STDIN_FILENO
%100 = icmp ne i32 %98, %99
br i1 %100, label %101, label %116
101: ; preds = %93
%102 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%103 = load i32, i32* %102
%104 = load i32, i32* @STDIN_FILENO
%105 = call i32 @dup2(i32 %103, i32 %104)
%106 = load i32, i32* @STDIN_FILENO
%107 = icmp ne i32 %105, %106
br i1 %107, label %108, label %112
108: ; preds = %101
%109 = load i32, i32* @stderr
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%111 = call i32 @exit(i32 1)
unreachable
112: ; preds = %101
%113 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%114 = load i32, i32* %113
%115 = call i32 @close(i32 %114)
br label %116
116: ; preds = %112, %93
%117 = call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
store i8* %117, i8** %9
%118 = icmp eq i8* %117, null
br i1 %118, label %119, label %120
119: ; preds = %116
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i8** %9
br label %120
120: ; preds = %119, %116
%121 = load i8*, i8** %9
%122 = call i8* @strrchr(i8* %121, i8 signext 47)
store i8* %122, i8** %10
%123 = icmp ne i8* %122, null
br i1 %123, label %124, label %127
124: ; preds = %120
%125 = load i8*, i8** %10
%126 = getelementptr inbounds i8, i8* %125, i32 1
store i8* %126, i8** %10
br label %129
127: ; preds = %120
%128 = load i8*, i8** %9
store i8* %128, i8** %10
br label %129
129: ; preds = %127, %124
%130 = load i8*, i8** %9
%131 = load i8*, i8** %10
%132 = call i64 @execl(i8* %130, i8* %131, i8* null)
%133 = icmp slt i64 %132, 0
br i1 %133, label %134, label %139
134: ; preds = %129
%135 = load i32, i32* @stderr
%136 = load i8*, i8** %9
%137 = call i32 (i32, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i8* %136)
%138 = call i32 @exit(i32 1)
unreachable
139: ; preds = %129
br label %140
140: ; preds = %139
br label %141
141: ; preds = %140
%142 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"usage: a.out <pathname>\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"can't open %s\00"
@.str.3 = [11 x i8] c"pipe error\00"
@.str.4 = [11 x i8] c"fork error\00"
@.str.5 = [20 x i8] c"write error to pipe\00"
@.str.6 = [12 x i8] c"fgets error\00"
@.str.7 = [14 x i8] c"waitpid error\00"
@STDIN_FILENO = global i32 0
@.str.8 = [20 x i8] c"dup2 error to stdin\00"
@.str.9 = [6 x i8] c"PAGER\00"
@.str.10 = [14 x i8] c"/usr/bin/more\00"
@.str.11 = [19 x i8] c"execl error for %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i32]
%4 = alloca [4096 x i8]
%5 = bitcast [2 x i32]* %3 to i8*
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 2
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %13
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %12
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%24 = call i64 @pipe(i32* %23)
%25 = icmp slt i64 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %22
%31 = call i64 (...) @fork()
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %30
%38 = icmp eq i64 %31, 0
br i1 %38, label %75, label %39
39: ; preds = %37
%40 = load i32, i32* %23
%41 = call i32 @close(i32 %40)
%42 = call i32* @fgets(i8* %6, i32 4096, i32* %15)
%43 = icmp eq i32* %42, null
br i1 %43, label %57, label %44
44: ; preds = %39
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
br label %46
46: ; preds = %44, %54
%47 = call i32 @strlen(i8* %6)
%48 = load i32, i32* %45
%49 = call i32 @write(i32 %48, i8* %6, i32 %47)
%50 = icmp eq i32 %49, %47
br i1 %50, label %54, label %51
51: ; preds = %46
%52 = load i32, i32* @stderr
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %54
54: ; preds = %51, %46
%55 = call i32* @fgets(i8* %6, i32 4096, i32* %15)
%56 = icmp eq i32* %55, null
br i1 %56, label %57, label %46
57: ; preds = %54, %39
%58 = call i64 @ferror(i32* %15)
%59 = icmp eq i64 %58, 0
br i1 %59, label %63, label %60
60: ; preds = %57
%61 = load i32, i32* @stderr
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %63
63: ; preds = %60, %57
%64 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%65 = load i32, i32* %64
%66 = call i32 @close(i32 %65)
%67 = call i64 @waitpid(i64 %31, i32* null, i32 0)
%68 = icmp slt i64 %67, 0
br i1 %68, label %69, label %73
69: ; preds = %63
%70 = load i32, i32* @stderr
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %63
%74 = call i32 @exit(i32 0)
unreachable
75: ; preds = %37
%76 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%77 = load i32, i32* %76
%78 = call i32 @close(i32 %77)
%79 = load i32, i32* %23
%80 = load i32, i32* @STDIN_FILENO
%81 = icmp eq i32 %79, %80
br i1 %81, label %93, label %82
82: ; preds = %75
%83 = call i32 @dup2(i32 %79, i32 %80)
%84 = load i32, i32* @STDIN_FILENO
%85 = icmp eq i32 %83, %84
br i1 %85, label %90, label %86
86: ; preds = %82
%87 = load i32, i32* @stderr
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%89 = call i32 @exit(i32 1)
unreachable
90: ; preds = %82
%91 = load i32, i32* %23
%92 = call i32 @close(i32 %91)
br label %93
93: ; preds = %90, %75
%94 = call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%95 = icmp eq i8* %94, null
%96 = select i1 %95, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i8* %94
%97 = call i8* @strrchr(i8* dereferenceable(1) %96, i8 signext 47)
%98 = icmp eq i8* %97, null
%99 = getelementptr inbounds i8, i8* %97, i64 1
%100 = select i1 %98, i8* %96, i8* %99
%101 = call i64 @execl(i8* %96, i8* %100, i8* null)
%102 = icmp slt i64 %101, 0
br i1 %102, label %103, label %107
103: ; preds = %93
%104 = load i32, i32* @stderr
%105 = call i32 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i8* %96)
%106 = call i32 @exit(i32 1)
unreachable
107: ; preds = %93
%108 = call i32 @exit(i32 0)
unreachable
}