#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*/ buf;

/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int atoi(char *);
int close(int);
int dup2(int, int /*<<< orphan*/);
int /*<<< orphan*/ execl(char *, char *, char *);
int fork();
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int sprintf(char *, char *, char, int);
int /*<<< orphan*/ strtol(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ syserr(char *, ...);
int wait(int /*<<< orphan*/);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int row_number = 1;
  int pipe_dsc_back[2];
  int pipe_dsc_forth[2];
  int buf_len = 0;
  char buf[27];
  char state;
  if (argc < 2) {
    syserr("Too few arguments\n");
  }
  if ((row_number = atoi(argv[1])) <= 0) {
    syserr("You have to give number greater than 0\n");
  }
  if (pipe(pipe_dsc_back) == -1) {
    syserr("Error in creating pipe_forth\n");
  }
  if (pipe(pipe_dsc_forth) == -1)
    syserr("Error in creating pipe_dsc_forth\n");
  switch (fork()) {
  case -1:
    syserr("Error in fork\n");
  case 0:
    if (dup2(pipe_dsc_back[1], STDOUT_FILENO) == -1) {
      syserr("P:Error in dup pipe_dsc_back[1]\n");
    }
    if (dup2(pipe_dsc_forth[0], STDIN_FILENO) == -1) {
      syserr("P:Error in dup pipe_dsc_forth[0]\n");
    }
    if (close(pipe_dsc_back[0]) == -1) {
      syserr("P:Error in close pipe_dsc_back[0]\n");
    }
    if (close(pipe_dsc_back[1]) == -1) {
      syserr("P:Error in close pipe_dsc_back[1]\n");
    }
    if (close(pipe_dsc_forth[0]) == -1) {
      syserr("P:Error in close pipe_dsc_forth[0]\n");
    }
    if (close(pipe_dsc_forth[1]) == -1) {
      syserr("P:Error in close pipe_dsc_forth[1]\n");
    }
    execl("./w", "w", (char *)0);
    syserr("Error in execl(w).\n");
  default:
    if (close(pipe_dsc_back[1]) == -1) {
      syserr("P:Error in close pipe_dsc_back[1]\n");
    }
    if (close(pipe_dsc_forth[0]) == -1) {
      syserr("P:Error in close pipe_dsc_forth[0]\n");
    }
  }
  state = (row_number == 1) ? 'q' : 'a';
  int i = 1;
  int first_value = 0;
  while (i <= row_number) {
    memset(buf, 0, 27);
    if (i == (row_number - 1)) {
      state = 'f';
    }
    buf_len = sprintf(buf, "%d %d", state, first_value);
    if ((buf_len = write(pipe_dsc_forth[1], buf, sizeof(buf))) == -1)
      syserr("Pascal: iteration nr %d. Error in write", i);
    if (i < row_number)
      if ((buf_len = read(pipe_dsc_back[0], buf, sizeof(buf))) == -1)
        syserr("Pascal. Error in read\n");
    i++;
    if (i == row_number)
      state = 'q';
  }
  i = 1;
  while (i <= row_number) {
    if ((buf_len = read(pipe_dsc_back[0], buf, sizeof(buf))) == -1)
      syserr("Pascal. Error in read\n");
    printf("%ld ", strtol(buf + 3, NULL, 10));
    i++;
  }
  printf("\n");
  if (wait(0) == -1) {
    syserr("Error in wait\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    121c <main+0x3c>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jg     1243 <main+0x63>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
lea    -0x1c(%rbp),%rdi
call   1090 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1263 <main+0x83>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
lea    -0x24(%rbp),%rdi
call   1090 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1283 <main+0xa3>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
xor    %eax,%eax
call   1100 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x60(%rbp)
sub    $0xffffffff,%eax
je     12ad <main+0xcd>
jmp    129d <main+0xbd>
mov    -0x60(%rbp),%eax
test   %eax,%eax
je     12bb <main+0xdb>
jmp    13ac <main+0x1cc>
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
mov    -0x18(%rbp),%edi
mov    0x2d2b(%rip),%rax
mov    (%rax),%esi
call   1040 <dup2@plt>
cmp    $0xffffffff,%eax
jne    12e3 <main+0x103>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
mov    -0x24(%rbp),%edi
mov    0x2ceb(%rip),%rax
mov    (%rax),%esi
call   1040 <dup2@plt>
cmp    $0xffffffff,%eax
jne    130b <main+0x12b>
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
mov    -0x1c(%rbp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    132a <main+0x14a>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
mov    -0x18(%rbp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    1349 <main+0x169>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
mov    -0x24(%rbp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    1368 <main+0x188>
lea    0xdb2(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
mov    -0x20(%rbp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    1387 <main+0x1a7>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
lea    0xdcd(%rip),%rdi
lea    0xdc8(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   10e0 <execl@plt>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
mov    -0x18(%rbp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    13cb <main+0x1eb>
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
mov    -0x24(%rbp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    13ea <main+0x20a>
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
jmp    13ef <main+0x20f>
mov    -0x14(%rbp),%edx
mov    $0x61,%eax
mov    $0x71,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
mov    %al,-0x51(%rbp)
movl   $0x1,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     14e8 <main+0x308>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x1b,%edx
call   1070 <memset@plt>
mov    -0x58(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1444 <main+0x264>
movb   $0x66,-0x51(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x51(%rbp),%al
mov    -0x5c(%rbp),%ecx
lea    0xd1e(%rip),%rsi
movsbl %al,%edx
call   10d0 <sprintf@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x1b,%edx
call   1030 <write@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
jne    148e <main+0x2ae>
mov    -0x58(%rbp),%esi
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
mov    -0x58(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    14ca <main+0x2ea>
mov    -0x1c(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x1b,%edx
call   10a0 <read@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
jne    14c5 <main+0x2e5>
lea    0xce3(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
jmp    14ca <main+0x2ea>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    14e3 <main+0x303>
movb   $0x71,-0x51(%rbp)
jmp    1413 <main+0x233>
movl   $0x1,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     155a <main+0x37a>
mov    -0x1c(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x1b,%edx
call   10a0 <read@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
jne    1526 <main+0x346>
lea    0xc82(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
lea    -0x50(%rbp),%rdi
add    $0x3,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10b0 <strtol@plt>
mov    %eax,%esi
lea    0xc73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    14ef <main+0x30f>
lea    0xc10(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10f0 <wait@plt>
cmp    $0xffffffff,%eax
jne    1586 <main+0x3a6>
lea    0xc3e(%rip),%rdi
mov    $0x0,%al
call   1060 <syserr@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     1214 <main+0x24>
lea    0xdf3(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
mov    0x8(%rbx),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
test   %eax,%eax
jg     1231 <main+0x41>
lea    0xde9(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
lea    0xc(%rsp),%rdi
call   10a0 <pipe@plt>
cmp    $0xffffffff,%eax
jne    124e <main+0x5e>
lea    0xdf4(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
lea    0x18(%rsp),%rdi
call   10a0 <pipe@plt>
cmp    $0xffffffff,%eax
jne    126b <main+0x7b>
lea    0xdf5(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
xor    %eax,%eax
call   1110 <fork@plt>
test   %eax,%eax
je     128d <main+0x9d>
cmp    $0xffffffff,%eax
jne    136a <main+0x17a>
lea    0xdf5(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
mov    0x10(%rsp),%edi
mov    0x2d58(%rip),%rax
mov    (%rax),%esi
call   1050 <dup2@plt>
cmp    $0xffffffff,%eax
jne    12b2 <main+0xc2>
lea    0xddf(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
mov    0x18(%rsp),%edi
mov    0x2d1b(%rip),%rax
mov    (%rax),%esi
call   1050 <dup2@plt>
cmp    $0xffffffff,%eax
jne    12d7 <main+0xe7>
lea    0xddb(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
mov    0xc(%rsp),%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    12f3 <main+0x103>
lea    0xde1(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
mov    0x10(%rsp),%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    130f <main+0x11f>
lea    0xde8(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
mov    0x18(%rsp),%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    132b <main+0x13b>
lea    0xdef(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
mov    0x1c(%rsp),%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    1347 <main+0x157>
lea    0xdf7(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
lea    0xe0d(%rip),%rdi
lea    0xe08(%rip),%rsi
xor    %edx,%edx
call   10f0 <execl@plt>
lea    0xdfc(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
mov    0x10(%rsp),%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    1386 <main+0x196>
lea    0xd71(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
mov    0x18(%rsp),%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
je     139d <main+0x1ad>
test   %ebp,%ebp
jg     13b3 <main+0x1c3>
jmp    1512 <main+0x322>
lea    0xd6f(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
test   %ebp,%ebp
jle    1512 <main+0x322>
cmp    $0x1,%ebp
sete   %bl
shl    $0x4,%bl
or     $0x61,%bl
mov    %ebp,0x14(%rsp)
mov    %ebp,%r13d
neg    %r13d
mov    $0x1,%ebp
lea    0x20(%rsp),%r14
jmp    1403 <main+0x213>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%r13,%rbp,1),%eax
lea    0x1(%rbp),%ecx
cmp    $0xffffffff,%r15d
movzbl %r12b,%ebx
mov    $0x71,%edx
cmove  %edx,%ebx
mov    %ecx,%ebp
cmp    $0x1,%eax
je     14a7 <main+0x2b7>
lea    0x0(%r13,%rbp,1),%r15d
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1b,%edx
call   1080 <memset@plt>
cmp    $0xffffffff,%r15d
movzbl %bl,%r12d
mov    $0x66,%eax
cmove  %eax,%r12d
movsbl %r12b,%edx
mov    %r14,%rdi
lea    0xd3d(%rip),%rsi
xor    %ecx,%ecx
call   10e0 <sprintf@plt>
mov    0x1c(%rsp),%edi
mov    %r14,%rsi
mov    $0x1b,%edx
call   1040 <write@plt>
cmp    $0xffffffff,%eax
je     1460 <main+0x270>
cmp    0x14(%rsp),%ebp
jge    13e0 <main+0x1f0>
jmp    147a <main+0x28a>
nopl   0x0(%rax,%rax,1)
lea    0xd12(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <syserr@plt>
cmp    0x14(%rsp),%ebp
jge    13e0 <main+0x1f0>
mov    0xc(%rsp),%edi
mov    %r14,%rsi
mov    $0x1b,%edx
call   10b0 <read@plt>
cmp    $0xffffffff,%eax
jne    13e0 <main+0x1f0>
lea    0xd06(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
jmp    13e0 <main+0x1f0>
mov    0x14(%rsp),%ebp
test   %ebp,%ebp
jle    1512 <main+0x322>
lea    0x23(%rsp),%r12
lea    0x20(%rsp),%r14
lea    0xce1(%rip),%r15
lea    0xcf1(%rip),%rbx
jmp    14f0 <main+0x300>
nopl   0x0(%rax)
mov    %r12,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10c0 <strtol@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0xffffffff,%ebp
je     1512 <main+0x322>
mov    0xc(%rsp),%edi
mov    %r14,%rsi
mov    $0x1b,%edx
call   10b0 <read@plt>
cmp    $0xffffffff,%eax
jne    14d0 <main+0x2e0>
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
jmp    14d0 <main+0x2e0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1100 <wait@plt>
cmp    $0xffffffff,%eax
jne    1536 <main+0x346>
lea    0xc8e(%rip),%rdi
xor    %eax,%eax
call   1070 <syserr@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Too few arguments\0A\00"
@.str.1 = [40 x i8] c"You have to give number greater than 0\0A\00"
@.str.2 = [30 x i8] c"Error in creating pipe_forth\0A\00"
@.str.3 = [34 x i8] c"Error in creating pipe_dsc_forth\0A\00"
@.str.4 = [15 x i8] c"Error in fork\0A\00"
@STDOUT_FILENO = global i32 0
@.str.5 = [33 x i8] c"P:Error in dup pipe_dsc_back[1]\0A\00"
@STDIN_FILENO = global i32 0
@.str.6 = [34 x i8] c"P:Error in dup pipe_dsc_forth[0]\0A\00"
@.str.7 = [35 x i8] c"P:Error in close pipe_dsc_back[0]\0A\00"
@.str.8 = [35 x i8] c"P:Error in close pipe_dsc_back[1]\0A\00"
@.str.9 = [36 x i8] c"P:Error in close pipe_dsc_forth[0]\0A\00"
@.str.10 = [36 x i8] c"P:Error in close pipe_dsc_forth[1]\0A\00"
@.str.11 = [4 x i8] c"./w\00"
@.str.12 = [2 x i8] c"w\00"
@.str.13 = [20 x i8] c"Error in execl(w).\0A\00"
@.str.14 = [6 x i8] c"%d %d\00"
@.str.15 = [40 x i8] c"Pascal: iteration nr %d. Error in write\00"
@.str.16 = [23 x i8] c"Pascal. Error in read\0A\00"
@.str.17 = [5 x i8] c"%ld \00"
@.str.18 = [2 x i8] c"\0A\00"
@.str.19 = [15 x i8] c"Error in wait\0A\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 [2 x i32]
%9 = alloca i32
%10 = alloca [27 x i8]
%11 = alloca i8
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 0, i32* %9
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = icmp sle i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %18
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%28 = call i32 @pipe(i32* %27)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%34 = call i32 @pipe(i32* %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %38
38: ; preds = %36, %32
%39 = call i32 (...) @fork()
switch i32 %39, label %89 [
i32 -1, label %40
i32 0, label %42
]
40: ; preds = %38
%41 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %38, %40
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%44 = load i32, i32* %43
%45 = load i32, i32* @STDOUT_FILENO
%46 = call i32 @dup2(i32 %44, i32 %45)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %50
48: ; preds = %42
%49 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %50
50: ; preds = %48, %42
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%52 = load i32, i32* %51
%53 = load i32, i32* @STDIN_FILENO
%54 = call i32 @dup2(i32 %52, i32 %53)
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %58
56: ; preds = %50
%57 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %58
58: ; preds = %56, %50
%59 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%60 = load i32, i32* %59
%61 = call i32 @close(i32 %60)
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
br label %65
65: ; preds = %63, %58
%66 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%67 = load i32, i32* %66
%68 = call i32 @close(i32 %67)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %72
70: ; preds = %65
%71 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
br label %72
72: ; preds = %70, %65
%73 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%74 = load i32, i32* %73
%75 = call i32 @close(i32 %74)
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %79
77: ; preds = %72
%78 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
br label %79
79: ; preds = %77, %72
%80 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%81 = load i32, i32* %80
%82 = call i32 @close(i32 %81)
%83 = icmp eq i32 %82, -1
br i1 %83, label %84, label %86
84: ; preds = %79
%85 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0))
br label %86
86: ; preds = %84, %79
%87 = call i32 @execl(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i8* null)
%88 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
br label %89
89: ; preds = %38, %86
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%91 = load i32, i32* %90
%92 = call i32 @close(i32 %91)
%93 = icmp eq i32 %92, -1
br i1 %93, label %94, label %96
94: ; preds = %89
%95 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
br label %96
96: ; preds = %94, %89
%97 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%98 = load i32, i32* %97
%99 = call i32 @close(i32 %98)
%100 = icmp eq i32 %99, -1
br i1 %100, label %101, label %103
101: ; preds = %96
%102 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
br label %103
103: ; preds = %101, %96
br label %104
104: ; preds = %103
%105 = load i32, i32* %6
%106 = icmp eq i32 %105, 1
%107 = zext i1 %106 to i64
%108 = select i1 %106, i32 113, i32 97
%109 = trunc i32 %108 to i8
store i8 %109, i8* %11
store i32 1, i32* %12
store i32 0, i32* %13
br label %110
110: ; preds = %155, %104
%111 = load i32, i32* %12
%112 = load i32, i32* %6
%113 = icmp sle i32 %111, %112
br i1 %113, label %114, label %156
114: ; preds = %110
%115 = getelementptr inbounds [27 x i8], [27 x i8]* %10, i64 0, i64 0
%116 = call i32 @memset(i8* %115, i32 0, i32 27)
%117 = load i32, i32* %12
%118 = load i32, i32* %6
%119 = sub nsw i32 %118, 1
%120 = icmp eq i32 %117, %119
br i1 %120, label %121, label %122
121: ; preds = %114
store i8 102, i8* %11
br label %122
122: ; preds = %121, %114
%123 = getelementptr inbounds [27 x i8], [27 x i8]* %10, i64 0, i64 0
%124 = load i8, i8* %11
%125 = load i32, i32* %13
%126 = call i32 @sprintf(i8* %123, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8 signext %124, i32 %125)
store i32 %126, i32* %9
%127 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%128 = load i32, i32* %127
%129 = getelementptr inbounds [27 x i8], [27 x i8]* %10, i64 0, i64 0
%130 = call i32 @write(i32 %128, i8* %129, i32 27)
store i32 %130, i32* %9
%131 = icmp eq i32 %130, -1
br i1 %131, label %132, label %135
132: ; preds = %122
%133 = load i32, i32* %12
%134 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.15, i64 0, i64 0), i32 %133)
br label %135
135: ; preds = %132, %122
%136 = load i32, i32* %12
%137 = load i32, i32* %6
%138 = icmp slt i32 %136, %137
br i1 %138, label %139, label %148
139: ; preds = %135
%140 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%141 = load i32, i32* %140
%142 = getelementptr inbounds [27 x i8], [27 x i8]* %10, i64 0, i64 0
%143 = call i32 @read(i32 %141, i8* %142, i32 27)
store i32 %143, i32* %9
%144 = icmp eq i32 %143, -1
br i1 %144, label %145, label %147
145: ; preds = %139
%146 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0))
br label %147
147: ; preds = %145, %139
br label %148
148: ; preds = %147, %135
%149 = load i32, i32* %12
%150 = add nsw i32 %149, 1
store i32 %150, i32* %12
%151 = load i32, i32* %12
%152 = load i32, i32* %6
%153 = icmp eq i32 %151, %152
br i1 %153, label %154, label %155
154: ; preds = %148
store i8 113, i8* %11
br label %155
155: ; preds = %154, %148
br label %110
156: ; preds = %110
store i32 1, i32* %12
br label %157
157: ; preds = %169, %156
%158 = load i32, i32* %12
%159 = load i32, i32* %6
%160 = icmp sle i32 %158, %159
br i1 %160, label %161, label %176
161: ; preds = %157
%162 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%163 = load i32, i32* %162
%164 = getelementptr inbounds [27 x i8], [27 x i8]* %10, i64 0, i64 0
%165 = call i32 @read(i32 %163, i8* %164, i32 27)
store i32 %165, i32* %9
%166 = icmp eq i32 %165, -1
br i1 %166, label %167, label %169
167: ; preds = %161
%168 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0))
br label %169
169: ; preds = %167, %161
%170 = getelementptr inbounds [27 x i8], [27 x i8]* %10, i64 0, i64 0
%171 = getelementptr inbounds i8, i8* %170, i64 3
%172 = call i32 @strtol(i8* %171, i32* null, i32 10)
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 %172)
%174 = load i32, i32* %12
%175 = add nsw i32 %174, 1
store i32 %175, i32* %12
br label %157
176: ; preds = %157
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
%178 = call i32 @wait(i32 0)
%179 = icmp eq i32 %178, -1
br i1 %179, label %180, label %182
180: ; preds = %176
%181 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0))
br label %182
182: ; preds = %180, %176
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Too few arguments\0A\00"
@.str.1 = [40 x i8] c"You have to give number greater than 0\0A\00"
@.str.2 = [30 x i8] c"Error in creating pipe_forth\0A\00"
@.str.3 = [34 x i8] c"Error in creating pipe_dsc_forth\0A\00"
@.str.4 = [15 x i8] c"Error in fork\0A\00"
@STDOUT_FILENO = global i32 0
@.str.5 = [33 x i8] c"P:Error in dup pipe_dsc_back[1]\0A\00"
@STDIN_FILENO = global i32 0
@.str.6 = [34 x i8] c"P:Error in dup pipe_dsc_forth[0]\0A\00"
@.str.7 = [35 x i8] c"P:Error in close pipe_dsc_back[0]\0A\00"
@.str.8 = [35 x i8] c"P:Error in close pipe_dsc_back[1]\0A\00"
@.str.9 = [36 x i8] c"P:Error in close pipe_dsc_forth[0]\0A\00"
@.str.10 = [36 x i8] c"P:Error in close pipe_dsc_forth[1]\0A\00"
@.str.11 = [4 x i8] c"./w\00"
@.str.12 = [2 x i8] c"w\00"
@.str.13 = [20 x i8] c"Error in execl(w).\0A\00"
@.str.14 = [6 x i8] c"%d %d\00"
@.str.15 = [40 x i8] c"Pascal: iteration nr %d. Error in write\00"
@.str.16 = [23 x i8] c"Pascal. Error in read\0A\00"
@.str.17 = [5 x i8] c"%ld \00"
@.str.19 = [15 x i8] c"Error in wait\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i32]
%4 = alloca [2 x i32]
%5 = alloca [27 x i8]
%6 = bitcast [2 x i32]* %3 to i8*
%7 = bitcast [2 x i32]* %4 to i8*
%8 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%9 = icmp slt i32 %0, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = icmp slt i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = tail call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %12
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%21 = call i32 @pipe(i32* %20)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23, %19
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%27 = call i32 @pipe(i32* %26)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %29, %25
%32 = call i32 (...) @fork()
switch i32 %32, label %78 [
i32 -1, label %33
i32 0, label %35
]
33: ; preds = %31
%34 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %31, %33
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%37 = load i32, i32* %36
%38 = load i32, i32* @STDOUT_FILENO
%39 = call i32 @dup2(i32 %37, i32 %38)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %43
43: ; preds = %41, %35
%44 = load i32, i32* %26
%45 = load i32, i32* @STDIN_FILENO
%46 = call i32 @dup2(i32 %44, i32 %45)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %50
48: ; preds = %43
%49 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %50
50: ; preds = %48, %43
%51 = load i32, i32* %20
%52 = call i32 @close(i32 %51)
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
br label %56
56: ; preds = %54, %50
%57 = load i32, i32* %36
%58 = call i32 @close(i32 %57)
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
br label %62
62: ; preds = %60, %56
%63 = load i32, i32* %26
%64 = call i32 @close(i32 %63)
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %68
66: ; preds = %62
%67 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
br label %68
68: ; preds = %66, %62
%69 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%70 = load i32, i32* %69
%71 = call i32 @close(i32 %70)
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %75
73: ; preds = %68
%74 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0))
br label %75
75: ; preds = %73, %68
%76 = call i32 @execl(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i8* null)
%77 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
br label %78
78: ; preds = %31, %75
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%80 = load i32, i32* %79
%81 = call i32 @close(i32 %80)
%82 = icmp eq i32 %81, -1
br i1 %82, label %83, label %85
83: ; preds = %78
%84 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
br label %85
85: ; preds = %83, %78
%86 = load i32, i32* %26
%87 = call i32 @close(i32 %86)
%88 = icmp eq i32 %87, -1
br i1 %88, label %89, label %91
89: ; preds = %85
%90 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
br label %91
91: ; preds = %85, %89
br i1 %16, label %137, label %92
92: ; preds = %91
%93 = icmp eq i32 %15, 1
%94 = select i1 %93, i8 113, i8 97
%95 = add nsw i32 %15, -1
%96 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
br label %100
97: ; preds = %120
br i1 %16, label %137, label %98
98: ; preds = %97
%99 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 3
br label %125
100: ; preds = %92, %120
%101 = phi i32 [ 1, %92 ], [ %121, %120 ]
%102 = phi i8 [ %94, %92 ], [ %123, %120 ]
%103 = call i32 @memset(i8* %8, i32 0, i32 27)
%104 = icmp eq i32 %101, %95
%105 = select i1 %104, i8 102, i8 %102
%106 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8 signext %105, i32 0)
%107 = load i32, i32* %96
%108 = call i32 @write(i32 %107, i8* %8, i32 27)
%109 = icmp eq i32 %108, -1
br i1 %109, label %110, label %112
110: ; preds = %100
%111 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.15, i64 0, i64 0), i32 %101)
br label %112
112: ; preds = %110, %100
%113 = icmp slt i32 %101, %15
br i1 %113, label %114, label %120
114: ; preds = %112
%115 = load i32, i32* %20
%116 = call i32 @read(i32 %115, i8* %8, i32 27)
%117 = icmp eq i32 %116, -1
br i1 %117, label %118, label %120
118: ; preds = %114
%119 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0))
br label %120
120: ; preds = %114, %118, %112
%121 = add nuw i32 %101, 1
%122 = icmp eq i32 %121, %15
%123 = select i1 %122, i8 113, i8 %105
%124 = icmp eq i32 %101, %15
br i1 %124, label %97, label %100
125: ; preds = %98, %132
%126 = phi i32 [ 1, %98 ], [ %135, %132 ]
%127 = load i32, i32* %20
%128 = call i32 @read(i32 %127, i8* %8, i32 27)
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %132
130: ; preds = %125
%131 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0))
br label %132
132: ; preds = %130, %125
%133 = call i32 @strtol(i8* nocapture %99, i32* null, i32 10)
%134 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 %133)
%135 = add nuw i32 %126, 1
%136 = icmp eq i32 %126, %15
br i1 %136, label %137, label %125
137: ; preds = %132, %91, %97
%138 = call i32 @putchar(i32 10)
%139 = call i32 @wait(i32 0)
%140 = icmp eq i32 %139, -1
br i1 %140, label %141, label %143
141: ; preds = %137
%142 = call i32 (i8*, ...) @syserr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0))
br label %143
143: ; preds = %141, %137
ret i32 0
}