#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*/ close(int);
int /*<<< orphan*/ exit(int);
int fork();
scalar_t__ pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
size_t read(int, char *, int);
size_t write(int, char *, int);
int main() {
  int fd1[2], fd2[2], pid;
  int i = 0;
  size_t size;
  char resstring[21];
  char *speaking1[] = {"Hello!", "How are you?", "Do you like coffee?",
                       "Have you got a pet?", "Good bye=*"};
  char *speaking2[] = {"Hello!", "All right=)", "No", "Yes", "BB"};
  if (pipe(fd1) < 0) {
    printf("Can\'t create pipe1\n");
    exit(-1);
  }
  if (pipe(fd2) < 0) {
    printf("Can\'t create pipe2\n");
    exit(-1);
  }
  pid = fork();
  if (pid < 0) {
    printf("Can\'t fork child\n");
    exit(-1);
  } else if (pid > 0) {
    close(fd1[1]);
    close(fd2[0]);
    for (i = 0; i < 5; i++) {
      size = write(fd2[1], speaking1[i], 21);
      if (size != 21) {
        printf("Can\'t write all string 1\n");
        exit(-1);
      }
      size = read(fd1[0], resstring, 21);
      if (size < 0) {
        printf("Can\'t read string\n");
        exit(-1);
      }
      printf("%s\n", resstring);
    }
    close(fd1[0]);
    close(fd2[1]);
  } else {
    close(fd1[0]);
    close(fd2[1]);
    for (i = 0; i < 5; i++) {
      size = write(fd1[1], speaking2[i], 21);
      if (size != 21) {
        printf("Can\'t write all string 2\n");
        exit(-1);
      }
      size = read(fd2[0], resstring, 21);
      if (size < 0) {
        printf("Can\'t read string\n");
        exit(-1);
      }
      printf("%s\n", resstring);
    }
    close(fd1[1]);
    close(fd2[0]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
lea    0xe50(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xe4c(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xe4e(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xe57(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xe60(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
lea    0xe06(%rip),%rax
mov    %rax,-0xa0(%rbp)
lea    0xe3f(%rip),%rax
mov    %rax,-0x98(%rbp)
lea    0xe3d(%rip),%rax
mov    %rax,-0x90(%rbp)
lea    0xe32(%rip),%rax
mov    %rax,-0x88(%rbp)
lea    0xe28(%rip),%rax
mov    %rax,-0x80(%rbp)
lea    -0xc(%rbp),%rdi
call   1070 <pipe@plt>
cmp    $0x0,%rax
jge    1261 <main+0xe1>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
lea    -0x14(%rbp),%rdi
call   1070 <pipe@plt>
cmp    $0x0,%rax
jge    128c <main+0x10c>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    $0x0,%al
call   10a0 <fork@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    12b8 <main+0x138>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
cmpl   $0x0,-0x18(%rbp)
jle    138d <main+0x20d>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    1378 <main+0x1f8>
mov    -0x10(%rbp),%edi
movslq -0x1c(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rsi
mov    $0x15,%edx
call   1030 <write@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x15,-0x28(%rbp)
je     1320 <main+0x1a0>
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0xc(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x15,%edx
call   1080 <read@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jae    1358 <main+0x1d8>
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
lea    -0x40(%rbp),%rsi
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12d9 <main+0x159>
mov    -0xc(%rbp),%edi
call   1060 <close@plt>
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
jmp    1456 <main+0x2d6>
mov    -0xc(%rbp),%edi
call   1060 <close@plt>
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    1446 <main+0x2c6>
mov    -0x8(%rbp),%edi
movslq -0x1c(%rbp),%rax
mov    -0xa0(%rbp,%rax,8),%rsi
ff
mov    $0x15,%edx
call   1030 <write@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x15,-0x28(%rbp)
je     13ee <main+0x26e>
lea    0xceb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x15,%edx
call   1080 <read@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jae    1426 <main+0x2a6>
lea    0xc9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
lea    -0x40(%rbp),%rsi
lea    0xc93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13a4 <main+0x224>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
jmp    145b <main+0x2db>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0x8(%rsp),%rdi
call   1060 <pipe@plt>
test   %rax,%rax
js     1463 <main+0x2f3>
mov    %rsp,%rdi
call   1060 <pipe@plt>
test   %rax,%rax
js     146c <main+0x2fc>
xor    %eax,%eax
call   1090 <fork@plt>
test   %eax,%eax
js     1475 <main+0x305>
je     1302 <main+0x192>
mov    0xc(%rsp),%edi
call   1050 <close@plt>
mov    (%rsp),%edi
call   1050 <close@plt>
mov    0x4(%rsp),%edi
lea    0xe36(%rip),%rsi
mov    $0x15,%edx
call   1040 <write@plt>
cmp    $0x15,%rax
jne    1451 <main+0x2e1>
mov    0x8(%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15,%edx
call   1070 <read@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edi
lea    0xe00(%rip),%rsi
mov    $0x15,%edx
call   1040 <write@plt>
cmp    $0x15,%rax
jne    1451 <main+0x2e1>
mov    0x8(%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15,%edx
call   1070 <read@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edi
lea    0xdd0(%rip),%rsi
mov    $0x15,%edx
call   1040 <write@plt>
cmp    $0x15,%rax
jne    1451 <main+0x2e1>
mov    0x8(%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15,%edx
call   1070 <read@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edi
lea    0xda7(%rip),%rsi
mov    $0x15,%edx
call   1040 <write@plt>
cmp    $0x15,%rax
jne    1451 <main+0x2e1>
mov    0x8(%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15,%edx
call   1070 <read@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edi
lea    0xd7e(%rip),%rsi
mov    $0x15,%edx
call   1040 <write@plt>
cmp    $0x15,%rax
jne    1451 <main+0x2e1>
mov    0x8(%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15,%edx
call   1070 <read@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%edi
call   1050 <close@plt>
mov    0x4(%rsp),%edi
jmp    1444 <main+0x2d4>
mov    0x8(%rsp),%edi
call   1050 <close@plt>
mov    0x4(%rsp),%edi
call   1050 <close@plt>
mov    0xc(%rsp),%edi
lea    0xce1(%rip),%rsi
mov    $0x15,%edx
call   1040 <write@plt>
cmp    $0x15,%rax
jne    145a <main+0x2ea>
mov    (%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15,%edx
call   1070 <read@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
lea    0xcec(%rip),%rsi
mov    $0x15,%edx
call   1040 <write@plt>
cmp    $0x15,%rax
jne    145a <main+0x2ea>
mov    (%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15,%edx
call   1070 <read@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
lea    0xcbc(%rip),%rsi
mov    $0x15,%edx
call   1040 <write@plt>
cmp    $0x15,%rax
jne    145a <main+0x2ea>
mov    (%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15,%edx
call   1070 <read@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
lea    0xc83(%rip),%rsi
mov    $0x15,%edx
call   1040 <write@plt>
cmp    $0x15,%rax
jne    145a <main+0x2ea>
mov    (%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15,%edx
call   1070 <read@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
lea    0xc4f(%rip),%rsi
mov    $0x15,%edx
call   1040 <write@plt>
cmp    $0x15,%rax
jne    145a <main+0x2ea>
mov    (%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15,%edx
call   1070 <read@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
call   1050 <close@plt>
mov    (%rsp),%edi
call   1050 <close@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret
lea    0xc1e(%rip),%rdi
jmp    147c <main+0x30c>
lea    0xbfc(%rip),%rdi
jmp    147c <main+0x30c>
lea    0xc49(%rip),%rdi
jmp    147c <main+0x30c>
lea    0xc2d(%rip),%rdi
jmp    147c <main+0x30c>
lea    0xc13(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"Hello!\00"
@.str.1 = [13 x i8] c"How are you?\00"
@.str.2 = [20 x i8] c"Do you like coffee?\00"
@.str.3 = [20 x i8] c"Have you got a pet?\00"
@.str.4 = [11 x i8] c"Good bye=*\00"
@.str.5 = [12 x i8] c"All right=)\00"
@.str.6 = [3 x i8] c"No\00"
@.str.7 = [4 x i8] c"Yes\00"
@.str.8 = [3 x i8] c"BB\00"
@.str.9 = [20 x i8] c"Can't create pipe1\0A\00"
@.str.10 = [20 x i8] c"Can't create pipe2\0A\00"
@.str.11 = [18 x i8] c"Can't fork child\0A\00"
@.str.12 = [26 x i8] c"Can't write all string 1\0A\00"
@.str.13 = [19 x i8] c"Can't read string\0A\00"
@.str.14 = [4 x i8] c"%s\0A\00"
@.str.15 = [26 x i8] c"Can't write all string 2\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca [21 x i8]
%8 = alloca [5 x i8*]
%9 = alloca [5 x i8*]
store i32 0, i32* %1
store i32 0, i32* %5
%10 = bitcast [5 x i8*]* %8 to i8*
%11 = bitcast i8* %10 to [5 x i8*]*
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i32 0, i32 0), i8** %13
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 2
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 3
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i32 0, i32 0), i8** %15
%16 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i32 0, i32 0), i8** %16
%17 = bitcast [5 x i8*]* %9 to i8*
%18 = bitcast i8* %17 to [5 x i8*]*
%19 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8** %19
%20 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i32 0, i32 0), i8** %20
%21 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8** %21
%22 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8** %22
%23 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8** %23
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%25 = call i64 @pipe(i32* %24)
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%29 = call i32 @exit(i32 -1)
unreachable
30: ; preds = %0
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%32 = call i64 @pipe(i32* %31)
%33 = icmp slt i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%36 = call i32 @exit(i32 -1)
unreachable
37: ; preds = %30
%38 = call i32 (...) @fork()
store i32 %38, i32* %4
%39 = load i32, i32* %4
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
%43 = call i32 @exit(i32 -1)
unreachable
44: ; preds = %37
%45 = load i32, i32* %4
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %93
47: ; preds = %44
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%49 = load i32, i32* %48
%50 = call i32 @close(i32 %49)
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%52 = load i32, i32* %51
%53 = call i32 @close(i32 %52)
store i32 0, i32* %5
br label %54
54: ; preds = %83, %47
%55 = load i32, i32* %5
%56 = icmp slt i32 %55, 5
br i1 %56, label %57, label %86
57: ; preds = %54
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%59 = load i32, i32* %58
%60 = load i32, i32* %5
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 %61
%63 = load i8*, i8** %62
%64 = call i64 @write(i32 %59, i8* %63, i32 21)
store i64 %64, i64* %6
%65 = load i64, i64* %6
%66 = icmp ne i64 %65, 21
br i1 %66, label %67, label %70
67: ; preds = %57
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
%69 = call i32 @exit(i32 -1)
unreachable
70: ; preds = %57
%71 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%72 = load i32, i32* %71
%73 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%74 = call i64 @read(i32 %72, i8* %73, i32 21)
store i64 %74, i64* %6
%75 = load i64, i64* %6
%76 = icmp ult i64 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %70
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
%79 = call i32 @exit(i32 -1)
unreachable
80: ; preds = %70
%81 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* %81)
br label %83
83: ; preds = %80
%84 = load i32, i32* %5
%85 = add nsw i32 %84, 1
store i32 %85, i32* %5
br label %54
86: ; preds = %54
%87 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%88 = load i32, i32* %87
%89 = call i32 @close(i32 %88)
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%91 = load i32, i32* %90
%92 = call i32 @close(i32 %91)
br label %139
93: ; preds = %44
%94 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%95 = load i32, i32* %94
%96 = call i32 @close(i32 %95)
%97 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%98 = load i32, i32* %97
%99 = call i32 @close(i32 %98)
store i32 0, i32* %5
br label %100
100: ; preds = %129, %93
%101 = load i32, i32* %5
%102 = icmp slt i32 %101, 5
br i1 %102, label %103, label %132
103: ; preds = %100
%104 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%105 = load i32, i32* %104
%106 = load i32, i32* %5
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 %107
%109 = load i8*, i8** %108
%110 = call i64 @write(i32 %105, i8* %109, i32 21)
store i64 %110, i64* %6
%111 = load i64, i64* %6
%112 = icmp ne i64 %111, 21
br i1 %112, label %113, label %116
113: ; preds = %103
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.15, i64 0, i64 0))
%115 = call i32 @exit(i32 -1)
unreachable
116: ; preds = %103
%117 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%118 = load i32, i32* %117
%119 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%120 = call i64 @read(i32 %118, i8* %119, i32 21)
store i64 %120, i64* %6
%121 = load i64, i64* %6
%122 = icmp ult i64 %121, 0
br i1 %122, label %123, label %126
123: ; preds = %116
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
%125 = call i32 @exit(i32 -1)
unreachable
126: ; preds = %116
%127 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* %127)
br label %129
129: ; preds = %126
%130 = load i32, i32* %5
%131 = add nsw i32 %130, 1
store i32 %131, i32* %5
br label %100
132: ; preds = %100
%133 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%134 = load i32, i32* %133
%135 = call i32 @close(i32 %134)
%136 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%137 = load i32, i32* %136
%138 = call i32 @close(i32 %137)
br label %139
139: ; preds = %132, %86
br label %140
140: ; preds = %139
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"Hello!\00"
@.str.1 = [13 x i8] c"How are you?\00"
@.str.2 = [20 x i8] c"Do you like coffee?\00"
@.str.3 = [20 x i8] c"Have you got a pet?\00"
@.str.4 = [11 x i8] c"Good bye=*\00"
@.str.5 = [12 x i8] c"All right=)\00"
@.str.6 = [3 x i8] c"No\00"
@.str.7 = [4 x i8] c"Yes\00"
@.str.8 = [3 x i8] c"BB\00"
@str = [25 x i8] c"Can't write all string 2\00"
@str.16 = [25 x i8] c"Can't write all string 1\00"
@str.17 = [17 x i8] c"Can't fork child\00"
@str.18 = [19 x i8] c"Can't create pipe2\00"
@str.19 = [19 x i8] c"Can't create pipe1\00"
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca [2 x i32]
%3 = alloca [21 x i8]
%4 = bitcast [2 x i32]* %1 to i8*
%5 = bitcast [2 x i32]* %2 to i8*
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%8 = call i64 @pipe(i32* %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.19, i64 0, i64 0))
%12 = call i32 @exit(i32 -1)
unreachable
13: ; preds = %0
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%15 = call i64 @pipe(i32* %14)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.18, i64 0, i64 0))
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %13
%21 = call i32 (...) @fork()
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.17, i64 0, i64 0))
%25 = call i32 @exit(i32 -1)
unreachable
26: ; preds = %20
%27 = icmp eq i32 %21, 0
br i1 %27, label %76, label %28
28: ; preds = %26
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%30 = load i32, i32* %29
%31 = call i32 @close(i32 %30)
%32 = load i32, i32* %14
%33 = call i32 @close(i32 %32)
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%35 = load i32, i32* %34
%36 = call i64 @write(i32 %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 21)
%37 = icmp eq i64 %36, 21
br i1 %37, label %41, label %38
38: ; preds = %62, %55, %48, %41, %28
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.16, i64 0, i64 0))
%40 = call i32 @exit(i32 -1)
unreachable
41: ; preds = %28
%42 = load i32, i32* %7
%43 = call i64 @read(i32 %42, i8* %6, i32 21)
%44 = call i32 @puts(i8* %6)
%45 = load i32, i32* %34
%46 = call i64 @write(i32 %45, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 21)
%47 = icmp eq i64 %46, 21
br i1 %47, label %48, label %38
48: ; preds = %41
%49 = load i32, i32* %7
%50 = call i64 @read(i32 %49, i8* %6, i32 21)
%51 = call i32 @puts(i8* %6)
%52 = load i32, i32* %34
%53 = call i64 @write(i32 %52, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 21)
%54 = icmp eq i64 %53, 21
br i1 %54, label %55, label %38
55: ; preds = %48
%56 = load i32, i32* %7
%57 = call i64 @read(i32 %56, i8* %6, i32 21)
%58 = call i32 @puts(i8* %6)
%59 = load i32, i32* %34
%60 = call i64 @write(i32 %59, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 21)
%61 = icmp eq i64 %60, 21
br i1 %61, label %62, label %38
62: ; preds = %55
%63 = load i32, i32* %7
%64 = call i64 @read(i32 %63, i8* %6, i32 21)
%65 = call i32 @puts(i8* %6)
%66 = load i32, i32* %34
%67 = call i64 @write(i32 %66, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 21)
%68 = icmp eq i64 %67, 21
br i1 %68, label %69, label %38
69: ; preds = %62
%70 = load i32, i32* %7
%71 = call i64 @read(i32 %70, i8* %6, i32 21)
%72 = call i32 @puts(i8* %6)
%73 = load i32, i32* %7
%74 = call i32 @close(i32 %73)
%75 = load i32, i32* %34
br label %124
76: ; preds = %26
%77 = load i32, i32* %7
%78 = call i32 @close(i32 %77)
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%80 = load i32, i32* %79
%81 = call i32 @close(i32 %80)
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%83 = load i32, i32* %82
%84 = call i64 @write(i32 %83, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 21)
%85 = icmp eq i64 %84, 21
br i1 %85, label %89, label %86
86: ; preds = %110, %103, %96, %89, %76
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%88 = call i32 @exit(i32 -1)
unreachable
89: ; preds = %76
%90 = load i32, i32* %14
%91 = call i64 @read(i32 %90, i8* %6, i32 21)
%92 = call i32 @puts(i8* %6)
%93 = load i32, i32* %82
%94 = call i64 @write(i32 %93, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 21)
%95 = icmp eq i64 %94, 21
br i1 %95, label %96, label %86
96: ; preds = %89
%97 = load i32, i32* %14
%98 = call i64 @read(i32 %97, i8* %6, i32 21)
%99 = call i32 @puts(i8* %6)
%100 = load i32, i32* %82
%101 = call i64 @write(i32 %100, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 21)
%102 = icmp eq i64 %101, 21
br i1 %102, label %103, label %86
103: ; preds = %96
%104 = load i32, i32* %14
%105 = call i64 @read(i32 %104, i8* %6, i32 21)
%106 = call i32 @puts(i8* %6)
%107 = load i32, i32* %82
%108 = call i64 @write(i32 %107, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 21)
%109 = icmp eq i64 %108, 21
br i1 %109, label %110, label %86
110: ; preds = %103
%111 = load i32, i32* %14
%112 = call i64 @read(i32 %111, i8* %6, i32 21)
%113 = call i32 @puts(i8* %6)
%114 = load i32, i32* %82
%115 = call i64 @write(i32 %114, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 21)
%116 = icmp eq i64 %115, 21
br i1 %116, label %117, label %86
117: ; preds = %110
%118 = load i32, i32* %14
%119 = call i64 @read(i32 %118, i8* %6, i32 21)
%120 = call i32 @puts(i8* %6)
%121 = load i32, i32* %82
%122 = call i32 @close(i32 %121)
%123 = load i32, i32* %14
br label %124
124: ; preds = %69, %117
%125 = phi i32 [ %75, %69 ], [ %123, %117 ]
%126 = call i32 @close(i32 %125)
ret i32 0
}