#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 /*<<< orphan*/ str;
typedef int pid_t;
typedef int /*<<< orphan*/ new_line_char;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ close(int);
int dup2(int, int);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *const, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int pipe(int *);
int /*<<< orphan*/ printf(char *, size_t, char *);
char *readline();
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char const *const);
int strlen(char const *const);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, char const *, int);
int main() {
  const char *const str[] = {"abcdefghiklmnopqrstuvwxyz",
                             "",
                             "1",
                             "",
                             "234",
                             "",
                             "",
                             "5678939821389217832183721838921893128372189378921"
                             "78932189371289732891738921783921731197981"};
  size_t i;
  const char new_line_char = '\n';
  pid_t pid;
  int pipefd[2];
  if (-1 == pipe(pipefd)) {
    fputs("Error : couldn't pipe", stderr);
    return (EXIT_FAILURE);
  }
  pid = fork();
  if (-1 == pid) {
    fputs("Error: couldn't fork", stderr);
    return (EXIT_FAILURE);
  }
  if (pid) {
    close(pipefd[0]);
    if (-1 == dup2(pipefd[1], 1)) {
      fputs("Error: couldn't dup2", stderr);
      return (EXIT_FAILURE);
    }
    for (i = 0; i < sizeof(str) / sizeof(*str); ++i) {
      write(1, str[i], strlen(str[i]) * sizeof(*str[i]));
      write(1, &new_line_char, sizeof(new_line_char));
    }
    wait(NULL);
  } else {
    if (-1 == dup2(pipefd[0], 0)) {
      fputs("Error: couldn't dup2", stderr);
      return (EXIT_FAILURE);
    }
    for (i = 0; i < sizeof(str) / sizeof(*str); ++i) {
      char *line = readline();
      if (!line) {
        fprintf(stderr, "Awaited result: \"%s\", but got null string\n",
                str[i]);
      } else if (strcmp(line, str[i]) != 0) {
        fprintf(stderr, "Awaited result: \"%s\", but got \"%s\"\n", str[i],
                line);
      } else {
        printf("Test #%u passed: \"%s\"\n", i, line);
      }
      free(line);
    }
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2bc3(%rip),%rsi
mov    $0x40,%edx
call   10e0 <memcpy@plt>
movb   $0xa,-0x59(%rbp)
lea    -0x68(%rbp),%rdi
call   10b0 <pipe@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1249 <main+0x69>
mov    0x2dae(%rip),%rax
mov    (%rax),%esi
lea    0xe46(%rip),%rdi
call   1080 <fputs@plt>
mov    0x2d91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1464 <main+0x284>
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x60(%rbp)
mov    $0xffffffff,%eax
cmp    -0x60(%rbp),%eax
jne    1287 <main+0xa7>
mov    0x2d70(%rip),%rax
mov    (%rax),%esi
lea    0xe1e(%rip),%rdi
call   1080 <fputs@plt>
mov    0x2d53(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1464 <main+0x284>
cmpl   $0x0,-0x60(%rbp)
je     134e <main+0x16e>
mov    -0x68(%rbp),%edi
call   10a0 <close@plt>
mov    -0x64(%rbp),%edi
mov    $0x1,%esi
call   1060 <dup2@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    12db <main+0xfb>
mov    0x2d1c(%rip),%rax
mov    (%rax),%esi
lea    0xddf(%rip),%rdi
call   1080 <fputs@plt>
mov    0x2cff(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1464 <main+0x284>
movq   $0x0,-0x58(%rbp)
cmpq   $0x8,-0x58(%rbp)
jae    1340 <main+0x160>
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    %rax,-0x78(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
call   1050 <strlen@plt>
mov    -0x78(%rbp),%rsi
cltq
shl    $0x0,%rax
mov    %eax,%edx
mov    $0x1,%edi
call   1040 <write@plt>
mov    $0x1,%edx
lea    -0x59(%rbp),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    12e3 <main+0x103>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <wait@plt>
jmp    1458 <main+0x278>
mov    -0x68(%rbp),%edi
xor    %esi,%esi
call   1060 <dup2@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    138d <main+0x1ad>
mov    0x2c6a(%rip),%rax
mov    (%rax),%esi
lea    0xd2d(%rip),%rdi
call   1080 <fputs@plt>
mov    0x2c4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1464 <main+0x284>
movq   $0x0,-0x58(%rbp)
cmpq   $0x8,-0x58(%rbp)
jae    1453 <main+0x273>
mov    $0x0,%al
call   1090 <readline@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    13db <main+0x1fb>
mov    0x2c1b(%rip),%rax
mov    (%rax),%edi
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdx
lea    0xcea(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1439 <main+0x259>
mov    -0x70(%rbp),%rdi
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
je     1420 <main+0x240>
mov    0x2bda(%rip),%rax
mov    (%rax),%edi
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdx
mov    -0x70(%rbp),%rcx
lea    0xcd0(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1434 <main+0x254>
mov    -0x58(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0xcd9(%rip),%rdi
call   1070 <printf@plt>
jmp    1439 <main+0x259>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    1395 <main+0x1b5>
jmp    1458 <main+0x278>
mov    0x2b69(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movb   $0xa,0xf(%rsp)
lea    0x10(%rsp),%rdi
call   10b0 <pipe@plt>
cmp    $0xffffffff,%eax
je     121b <main+0x4b>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %eax,%eax
je     1230 <main+0x60>
cmp    $0xffffffff,%eax
jne    12e4 <main+0x114>
mov    0x2dcb(%rip),%rax
mov    (%rax),%esi
lea    0xe79(%rip),%rdi
jmp    1494 <main+0x2c4>
mov    0x2db6(%rip),%rax
mov    (%rax),%esi
lea    0xe4e(%rip),%rdi
jmp    1494 <main+0x2c4>
mov    0x10(%rsp),%edi
xor    %esi,%esi
call   1060 <dup2@plt>
cmp    $0xffffffff,%eax
je     1484 <main+0x2b4>
lea    0x2b75(%rip),%r15
mov    0x2d86(%rip),%r12
mov    0x2d6f(%rip),%r14
xor    %ebx,%ebx
jmp    128f <main+0xbf>
nopl   (%rax)
mov    (%r12),%edi
mov    (%r15),%rdx
lea    0xe4b(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
add    $0x1,%rbx
add    $0x8,%r15
cmp    $0x8,%rbx
je     14a0 <main+0x2d0>
xor    %eax,%eax
call   1090 <readline@plt>
mov    %rax,%r13
test   %rax,%rax
je     1260 <main+0x90>
mov    (%r15),%rbp
mov    %r13,%rdi
mov    %rbp,%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     12d0 <main+0x100>
mov    (%r12),%edi
lea    0xe28(%rip),%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1275 <main+0xa5>
nopl   0x0(%rax,%rax,1)
lea    0xe31(%rip),%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1070 <printf@plt>
jmp    1275 <main+0xa5>
mov    0x10(%rsp),%edi
call   10a0 <close@plt>
mov    0x14(%rsp),%edi
mov    $0x1,%esi
call   1060 <dup2@plt>
cmp    $0xffffffff,%eax
je     1484 <main+0x2b4>
lea    0xcf5(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
lea    0xf(%rsp),%r14
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
lea    0xdde(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
lea    0xd07(%rip),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
lea    0xc51(%rip),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
lea    0xbd3(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
xor    %edi,%edi
call   10e0 <wait@plt>
mov    0x2b46(%rip),%r14
jmp    14a0 <main+0x2d0>
mov    0x2b4d(%rip),%rax
mov    (%rax),%esi
lea    0xc10(%rip),%rdi
call   1080 <fputs@plt>
mov    0x2b30(%rip),%r14
mov    (%r14),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"abcdefghiklmnopqrstuvwxyz\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [4 x i8] c"234\00"
@.str.4 = [91 x i8] c"567893982138921783218372183892189312837218937892178932189371289732891738921783921731197981\00"
@__const.main.str = [8 x i8*] [i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [22 x i8] c"Error : couldn't pipe\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@.str.6 = [21 x i8] c"Error: couldn't fork\00"
@.str.7 = [21 x i8] c"Error: couldn't dup2\00"
@.str.8 = [43 x i8] c"Awaited result: \22%s\22, but got null string\0A\00"
@.str.9 = [36 x i8] c"Awaited result: \22%s\22, but got \22%s\22\0A\00"
@.str.10 = [23 x i8] c"Test #%u passed: \22%s\22\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8*]
%3 = alloca i64
%4 = alloca i8
%5 = alloca i32
%6 = alloca [2 x i32]
%7 = alloca i8*
store i32 0, i32* %1
%8 = bitcast [8 x i8*]* %2 to i8*
store i8 10, i8* %4
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%10 = call i32 @pipe(i32* %9)
%11 = icmp eq i32 -1, %10
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = load i32, i32* @stderr
%14 = call i32 @fputs(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @EXIT_FAILURE
store i32 %15, i32* %1
br label %112
16: ; preds = %0
%17 = call i32 (...) @fork()
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = icmp eq i32 -1, %18
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @EXIT_FAILURE
store i32 %23, i32* %1
br label %112
24: ; preds = %16
%25 = load i32, i32* %5
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %61
27: ; preds = %24
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%29 = load i32, i32* %28
%30 = call i32 @close(i32 %29)
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%32 = load i32, i32* %31
%33 = call i32 @dup2(i32 %32, i32 1)
%34 = icmp eq i32 -1, %33
br i1 %34, label %35, label %39
35: ; preds = %27
%36 = load i32, i32* @stderr
%37 = call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %36)
%38 = load i32, i32* @EXIT_FAILURE
store i32 %38, i32* %1
br label %112
39: ; preds = %27
store i64 0, i64* %3
br label %40
40: ; preds = %56, %39
%41 = load i64, i64* %3
%42 = icmp ult i64 %41, 8
br i1 %42, label %43, label %59
43: ; preds = %40
%44 = load i64, i64* %3
%45 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 %44
%46 = load i8*, i8** %45
%47 = load i64, i64* %3
%48 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @strlen(i8* %49)
%51 = sext i32 %50 to i64
%52 = mul i64 %51, 1
%53 = trunc i64 %52 to i32
%54 = call i32 @write(i32 1, i8* %46, i32 %53)
%55 = call i32 @write(i32 1, i8* %4, i32 1)
br label %56
56: ; preds = %43
%57 = load i64, i64* %3
%58 = add i64 %57, 1
store i64 %58, i64* %3
br label %40
59: ; preds = %40
%60 = call i32 @wait(i32* null)
br label %110
61: ; preds = %24
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%63 = load i32, i32* %62
%64 = call i32 @dup2(i32 %63, i32 0)
%65 = icmp eq i32 -1, %64
br i1 %65, label %66, label %70
66: ; preds = %61
%67 = load i32, i32* @stderr
%68 = call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %67)
%69 = load i32, i32* @EXIT_FAILURE
store i32 %69, i32* %1
br label %112
70: ; preds = %61
store i64 0, i64* %3
br label %71
71: ; preds = %106, %70
%72 = load i64, i64* %3
%73 = icmp ult i64 %72, 8
br i1 %73, label %74, label %109
74: ; preds = %71
%75 = call i8* (...) @readline()
store i8* %75, i8** %7
%76 = load i8*, i8** %7
%77 = icmp ne i8* %76, null
br i1 %77, label %84, label %78
78: ; preds = %74
%79 = load i32, i32* @stderr
%80 = load i64, i64* %3
%81 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 %80
%82 = load i8*, i8** %81
%83 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i8* %82)
br label %103
84: ; preds = %74
%85 = load i8*, i8** %7
%86 = load i64, i64* %3
%87 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 %86
%88 = load i8*, i8** %87
%89 = call i64 @strcmp(i8* %85, i8* %88)
%90 = icmp ne i64 %89, 0
br i1 %90, label %91, label %98
91: ; preds = %84
%92 = load i32, i32* @stderr
%93 = load i64, i64* %3
%94 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 %93
%95 = load i8*, i8** %94
%96 = load i8*, i8** %7
%97 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %95, i8* %96)
br label %102
98: ; preds = %84
%99 = load i64, i64* %3
%100 = load i8*, i8** %7
%101 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i64 %99, i8* %100)
br label %102
102: ; preds = %98, %91
br label %103
103: ; preds = %102, %78
%104 = load i8*, i8** %7
%105 = call i32 @free(i8* %104)
br label %106
106: ; preds = %103
%107 = load i64, i64* %3
%108 = add i64 %107, 1
store i64 %108, i64* %3
br label %71
109: ; preds = %71
br label %110
110: ; preds = %109, %59
%111 = load i32, i32* @EXIT_SUCCESS
store i32 %111, i32* %1
br label %112
112: ; preds = %110, %66, %35, %20, %12
%113 = load i32, i32* %1
ret i32 %113
}

LLVM IR (-O2):
@.str = [26 x i8] c"abcdefghiklmnopqrstuvwxyz\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [4 x i8] c"234\00"
@.str.4 = [91 x i8] c"567893982138921783218372183892189312837218937892178932189371289732891738921783921731197981\00"
@__const.main.str = [8 x i8*] [i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [22 x i8] c"Error : couldn't pipe\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@.str.6 = [21 x i8] c"Error: couldn't fork\00"
@.str.7 = [21 x i8] c"Error: couldn't dup2\00"
@.str.8 = [43 x i8] c"Awaited result: \22%s\22, but got null string\0A\00"
@.str.9 = [36 x i8] c"Awaited result: \22%s\22, but got \22%s\22\0A\00"
@.str.10 = [23 x i8] c"Test #%u passed: \22%s\22\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i8
%2 = alloca [2 x i32]
store i8 10, i8* %1
%3 = bitcast [2 x i32]* %2 to i8*
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%5 = call i32 @pipe(i32* %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = call i32 @fputs(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %8)
br label %81
10: ; preds = %0
%11 = call i32 (...) @fork()
switch i32 %11, label %15 [
i32 -1, label %12
i32 0, label %51
]
12: ; preds = %10
%13 = load i32, i32* @stderr
%14 = call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %13)
br label %81
15: ; preds = %10
%16 = load i32, i32* %4
%17 = call i32 @close(i32 %16)
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%19 = load i32, i32* %18
%20 = call i32 @dup2(i32 %19, i32 1)
%21 = icmp eq i32 %20, -1
br i1 %21, label %48, label %22
22: ; preds = %15
%23 = call i32 @strlen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @write(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = call i32 @write(i32 1, i8* %1, i32 1)
%26 = call i32 @strlen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @write(i32 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 @write(i32 1, i8* %1, i32 1)
%29 = call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = call i32 @write(i32 1, i8* %1, i32 1)
%32 = call i32 @strlen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @write(i32 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = call i32 @write(i32 1, i8* %1, i32 1)
%35 = call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%36 = call i32 @write(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%37 = call i32 @write(i32 1, i8* %1, i32 1)
%38 = call i32 @strlen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 @write(i32 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = call i32 @write(i32 1, i8* %1, i32 1)
%41 = call i32 @strlen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%42 = call i32 @write(i32 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = call i32 @write(i32 1, i8* %1, i32 1)
%44 = call i32 @strlen(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.4, i64 0, i64 0))
%45 = call i32 @write(i32 1, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%46 = call i32 @write(i32 1, i8* %1, i32 1)
%47 = call i32 @wait(i32* null)
br label %81
48: ; preds = %15
%49 = load i32, i32* @stderr
%50 = call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %49)
br label %81
51: ; preds = %10
%52 = load i32, i32* %4
%53 = call i32 @dup2(i32 %52, i32 0)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = load i32, i32* @stderr
%57 = call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %56)
br label %81
58: ; preds = %51, %77
%59 = phi i64 [ %79, %77 ], [ 0, %51 ]
%60 = call i8* (...) @readline()
%61 = icmp eq i8* %60, null
br i1 %61, label %62, label %67
62: ; preds = %58
%63 = load i32, i32* @stderr
%64 = getelementptr inbounds [8 x i8*], [8 x i8*]* @__const.main.str, i64 0, i64 %59
%65 = load i8*, i8** %64
%66 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i8* %65)
br label %77
67: ; preds = %58
%68 = getelementptr inbounds [8 x i8*], [8 x i8*]* @__const.main.str, i64 0, i64 %59
%69 = load i8*, i8** %68
%70 = call i64 @strcmp(i8* %60, i8* %69)
%71 = icmp eq i64 %70, 0
br i1 %71, label %75, label %72
72: ; preds = %67
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %69, i8* %60)
br label %77
75: ; preds = %67
%76 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i64 %59, i8* %60)
br label %77
77: ; preds = %72, %75, %62
%78 = call i32 @free(i8* %60)
%79 = add nuw nsw i64 %59, 1
%80 = icmp eq i64 %79, 8
br i1 %80, label %81, label %58
81: ; preds = %77, %22, %55, %48, %12, %7
%82 = phi i32* [ @EXIT_FAILURE, %7 ], [ @EXIT_FAILURE, %12 ], [ @EXIT_FAILURE, %48 ], [ @EXIT_FAILURE, %55 ], [ @EXIT_SUCCESS, %22 ], [ @EXIT_SUCCESS, %77 ]
%83 = load i32, i32* %82
ret i32 %83
}