#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 /*<<< orphan*/);
scalar_t__ fork();
int getpid();
int /*<<< orphan*/ pipe(int *);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ read(int, int *, int);
int /*<<< orphan*/ wait(int /*<<< orphan*/);
int /*<<< orphan*/ write(int, int *, int);
int main() {
  int c2c[2][2], c2p[2][2], id0, id1, x;
  pipe(c2c[0]);
  pipe(c2c[1]);
  pipe(c2p[0]);
  pipe(c2p[1]);
  if (fork() == 0) {
    close(c2c[0][0]);
    close(c2p[1][0]);
    close(c2p[1][1]);
    close(c2c[1][1]);
    close(c2p[0][0]);
    id0 = getpid();
    write(c2c[0][1], &id0, sizeof(int));
    close(c2c[0][1]);
    read(c2c[1][0], &id1, sizeof(int));
    close(c2c[1][0]);
    x = id0 % id1;
    write(c2p[0][1], &x, sizeof(int));
    close(c2p[0][1]);
    printf("First child: %d %d\n", id0, id1);
    exit(0);
  }
  if (fork() == 0) {
    id1 = getpid();
    close(c2p[0][0]);
    close(c2p[0][1]);
    close(c2p[1][0]);
    close(c2c[0][1]);
    close(c2c[1][0]);
    read(c2c[0][0], &id0, sizeof(int));
    close(c2c[0][0]);
    write(c2c[1][1], &id1, sizeof(int));
    close(c2c[1][1]);
    x = id1 % id0;
    write(c2p[1][1], &x, sizeof(int));
    close(c2p[1][1]);
    printf("Second child: %d %d\n", id0, id1);
    exit(0);
  }
  close(c2c[0][0]);
  close(c2c[0][1]);
  close(c2c[1][0]);
  close(c2c[1][1]);
  close(c2p[0][1]);
  close(c2p[1][1]);
  int c0, c1;
  read(c2p[0][0], &c0, sizeof(int));
  read(c2p[1][0], &c1, sizeof(int));
  printf("Father received from first child: %d and from second child: %d\n", c0,
         c1);
  close(c2p[0][0]);
  close(c2p[1][0]);
  wait(0);
  wait(0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
call   1070 <pipe@plt>
lea    -0x20(%rbp),%rdi
add    $0x8,%rdi
call   1070 <pipe@plt>
lea    -0x30(%rbp),%rdi
call   1070 <pipe@plt>
lea    -0x30(%rbp),%rdi
add    $0x8,%rdi
call   1070 <pipe@plt>
mov    $0x0,%al
call   10b0 <fork@plt>
cmp    $0x0,%rax
jne    127c <main+0xec>
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
mov    -0x28(%rbp),%edi
call   1060 <close@plt>
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x30(%rbp),%edi
call   1060 <close@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0x34(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x34(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    -0x18(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
mov    -0x34(%rbp),%eax
cltd
idivl  -0x38(%rbp)
mov    %edx,-0x3c(%rbp)
mov    -0x2c(%rbp),%edi
lea    -0x3c(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x2c(%rbp),%edi
call   1060 <close@plt>
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    0xd90(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    $0x0,%al
call   10b0 <fork@plt>
cmp    $0x0,%rax
jne    132d <main+0x19d>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%edi
call   1060 <close@plt>
mov    -0x2c(%rbp),%edi
call   1060 <close@plt>
mov    -0x28(%rbp),%edi
call   1060 <close@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
mov    -0x20(%rbp),%edi
lea    -0x34(%rbp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
mov    -0x14(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x38(%rbp),%eax
cltd
idivl  -0x34(%rbp)
mov    %edx,-0x3c(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x3c(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    0xcf3(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x2c(%rbp),%edi
call   1060 <close@plt>
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
mov    -0x30(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    -0x28(%rbp),%edi
lea    -0x44(%rbp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    -0x40(%rbp),%esi
mov    -0x44(%rbp),%edx
lea    0xc9d(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%edi
call   1060 <close@plt>
mov    -0x28(%rbp),%edi
call   1060 <close@plt>
xor    %edi,%edi
call   10a0 <wait@plt>
xor    %edi,%edi
call   10a0 <wait@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
lea    0x20(%rsp),%rdi
call   1070 <pipe@plt>
lea    0x28(%rsp),%rdi
call   1070 <pipe@plt>
lea    0x10(%rsp),%rdi
call   1070 <pipe@plt>
lea    0x18(%rsp),%rdi
call   1070 <pipe@plt>
xor    %eax,%eax
call   10b0 <fork@plt>
test   %rax,%rax
je     1277 <main+0xe7>
xor    %eax,%eax
call   10b0 <fork@plt>
test   %rax,%rax
je     1322 <main+0x192>
mov    0x20(%rsp),%edi
call   1060 <close@plt>
mov    0x24(%rsp),%edi
call   1060 <close@plt>
mov    0x28(%rsp),%edi
call   1060 <close@plt>
mov    0x2c(%rsp),%edi
call   1060 <close@plt>
mov    0x14(%rsp),%edi
call   1060 <close@plt>
mov    0x1c(%rsp),%edi
call   1060 <close@plt>
mov    0x10(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    0x18(%rsp),%edi
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xde0(%rip),%rdi
call   1050 <printf@plt>
mov    0x10(%rsp),%edi
call   1060 <close@plt>
mov    0x18(%rsp),%edi
call   1060 <close@plt>
xor    %edi,%edi
call   10a0 <wait@plt>
xor    %edi,%edi
call   10a0 <wait@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x20(%rsp),%edi
call   1060 <close@plt>
mov    0x18(%rsp),%edi
call   1060 <close@plt>
mov    0x1c(%rsp),%edi
call   1060 <close@plt>
mov    0x2c(%rsp),%edi
call   1060 <close@plt>
mov    0x10(%rsp),%edi
call   1060 <close@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebx
mov    %eax,0xc(%rsp)
mov    0x24(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    0x24(%rsp),%edi
call   1060 <close@plt>
mov    0x28(%rsp),%edi
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    0x28(%rsp),%edi
call   1060 <close@plt>
mov    0x8(%rsp),%ebp
mov    %ebx,%eax
cltd
idiv   %ebp
mov    %edx,0x34(%rsp)
mov    0x14(%rsp),%edi
lea    0x34(%rsp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    0x14(%rsp),%edi
call   1060 <close@plt>
lea    0xce7(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
jmp    13c8 <main+0x238>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebx
mov    %eax,0x8(%rsp)
mov    0x10(%rsp),%edi
call   1060 <close@plt>
mov    0x14(%rsp),%edi
call   1060 <close@plt>
mov    0x18(%rsp),%edi
call   1060 <close@plt>
mov    0x24(%rsp),%edi
call   1060 <close@plt>
mov    0x28(%rsp),%edi
call   1060 <close@plt>
mov    0x20(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    0x20(%rsp),%edi
call   1060 <close@plt>
mov    0x2c(%rsp),%edi
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    0x2c(%rsp),%edi
call   1060 <close@plt>
mov    0xc(%rsp),%ebp
mov    %ebx,%eax
cltd
idiv   %ebp
mov    %edx,0x34(%rsp)
mov    0x1c(%rsp),%edi
lea    0x34(%rsp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    0x1c(%rsp),%edi
call   1060 <close@plt>
lea    0xc50(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"First child: %d %d\0A\00"
@.str.1 = [21 x i8] c"Second child: %d %d\0A\00"
@.str.2 = [64 x i8] c"Father received from first child: %d and from second child: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [2 x i32]]
%3 = alloca [2 x [2 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%11 = call i32 @pipe(i32* %10)
%12 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%14 = call i32 @pipe(i32* %13)
%15 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %15, i64 0, i64 0
%17 = call i32 @pipe(i32* %16)
%18 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 0
%20 = call i32 @pipe(i32* %19)
%21 = call i64 (...) @fork()
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %76
23: ; preds = %0
%24 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %24, i64 0, i64 0
%26 = load i32, i32* %25
%27 = call i32 @close(i32 %26)
%28 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %28, i64 0, i64 0
%30 = load i32, i32* %29
%31 = call i32 @close(i32 %30)
%32 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %32, i64 0, i64 1
%34 = load i32, i32* %33
%35 = call i32 @close(i32 %34)
%36 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %36, i64 0, i64 1
%38 = load i32, i32* %37
%39 = call i32 @close(i32 %38)
%40 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0
%41 = getelementptr inbounds [2 x i32], [2 x i32]* %40, i64 0, i64 0
%42 = load i32, i32* %41
%43 = call i32 @close(i32 %42)
%44 = call i32 (...) @getpid()
store i32 %44, i32* %4
%45 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %45, i64 0, i64 1
%47 = load i32, i32* %46
%48 = call i32 @write(i32 %47, i32* %4, i32 4)
%49 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %49, i64 0, i64 1
%51 = load i32, i32* %50
%52 = call i32 @close(i32 %51)
%53 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %53, i64 0, i64 0
%55 = load i32, i32* %54
%56 = call i32 @read(i32 %55, i32* %5, i32 4)
%57 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %57, i64 0, i64 0
%59 = load i32, i32* %58
%60 = call i32 @close(i32 %59)
%61 = load i32, i32* %4
%62 = load i32, i32* %5
%63 = srem i32 %61, %62
store i32 %63, i32* %6
%64 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0
%65 = getelementptr inbounds [2 x i32], [2 x i32]* %64, i64 0, i64 1
%66 = load i32, i32* %65
%67 = call i32 @write(i32 %66, i32* %6, i32 4)
%68 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0
%69 = getelementptr inbounds [2 x i32], [2 x i32]* %68, i64 0, i64 1
%70 = load i32, i32* %69
%71 = call i32 @close(i32 %70)
%72 = load i32, i32* %4
%73 = load i32, i32* %5
%74 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %72, i32 %73)
%75 = call i32 @exit(i32 0)
unreachable
76: ; preds = %0
%77 = call i64 (...) @fork()
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %132
79: ; preds = %76
%80 = call i32 (...) @getpid()
store i32 %80, i32* %5
%81 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %81, i64 0, i64 0
%83 = load i32, i32* %82
%84 = call i32 @close(i32 %83)
%85 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0
%86 = getelementptr inbounds [2 x i32], [2 x i32]* %85, i64 0, i64 1
%87 = load i32, i32* %86
%88 = call i32 @close(i32 %87)
%89 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %89, i64 0, i64 0
%91 = load i32, i32* %90
%92 = call i32 @close(i32 %91)
%93 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%94 = getelementptr inbounds [2 x i32], [2 x i32]* %93, i64 0, i64 1
%95 = load i32, i32* %94
%96 = call i32 @close(i32 %95)
%97 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%98 = getelementptr inbounds [2 x i32], [2 x i32]* %97, i64 0, i64 0
%99 = load i32, i32* %98
%100 = call i32 @close(i32 %99)
%101 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%102 = getelementptr inbounds [2 x i32], [2 x i32]* %101, i64 0, i64 0
%103 = load i32, i32* %102
%104 = call i32 @read(i32 %103, i32* %4, i32 4)
%105 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%106 = getelementptr inbounds [2 x i32], [2 x i32]* %105, i64 0, i64 0
%107 = load i32, i32* %106
%108 = call i32 @close(i32 %107)
%109 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%110 = getelementptr inbounds [2 x i32], [2 x i32]* %109, i64 0, i64 1
%111 = load i32, i32* %110
%112 = call i32 @write(i32 %111, i32* %5, i32 4)
%113 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%114 = getelementptr inbounds [2 x i32], [2 x i32]* %113, i64 0, i64 1
%115 = load i32, i32* %114
%116 = call i32 @close(i32 %115)
%117 = load i32, i32* %5
%118 = load i32, i32* %4
%119 = srem i32 %117, %118
store i32 %119, i32* %6
%120 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1
%121 = getelementptr inbounds [2 x i32], [2 x i32]* %120, i64 0, i64 1
%122 = load i32, i32* %121
%123 = call i32 @write(i32 %122, i32* %6, i32 4)
%124 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1
%125 = getelementptr inbounds [2 x i32], [2 x i32]* %124, i64 0, i64 1
%126 = load i32, i32* %125
%127 = call i32 @close(i32 %126)
%128 = load i32, i32* %4
%129 = load i32, i32* %5
%130 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %128, i32 %129)
%131 = call i32 @exit(i32 0)
unreachable
132: ; preds = %76
%133 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%134 = getelementptr inbounds [2 x i32], [2 x i32]* %133, i64 0, i64 0
%135 = load i32, i32* %134
%136 = call i32 @close(i32 %135)
%137 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%138 = getelementptr inbounds [2 x i32], [2 x i32]* %137, i64 0, i64 1
%139 = load i32, i32* %138
%140 = call i32 @close(i32 %139)
%141 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%142 = getelementptr inbounds [2 x i32], [2 x i32]* %141, i64 0, i64 0
%143 = load i32, i32* %142
%144 = call i32 @close(i32 %143)
%145 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%146 = getelementptr inbounds [2 x i32], [2 x i32]* %145, i64 0, i64 1
%147 = load i32, i32* %146
%148 = call i32 @close(i32 %147)
%149 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0
%150 = getelementptr inbounds [2 x i32], [2 x i32]* %149, i64 0, i64 1
%151 = load i32, i32* %150
%152 = call i32 @close(i32 %151)
%153 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1
%154 = getelementptr inbounds [2 x i32], [2 x i32]* %153, i64 0, i64 1
%155 = load i32, i32* %154
%156 = call i32 @close(i32 %155)
%157 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0
%158 = getelementptr inbounds [2 x i32], [2 x i32]* %157, i64 0, i64 0
%159 = load i32, i32* %158
%160 = call i32 @read(i32 %159, i32* %7, i32 4)
%161 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1
%162 = getelementptr inbounds [2 x i32], [2 x i32]* %161, i64 0, i64 0
%163 = load i32, i32* %162
%164 = call i32 @read(i32 %163, i32* %8, i32 4)
%165 = load i32, i32* %7
%166 = load i32, i32* %8
%167 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0), i32 %165, i32 %166)
%168 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0
%169 = getelementptr inbounds [2 x i32], [2 x i32]* %168, i64 0, i64 0
%170 = load i32, i32* %169
%171 = call i32 @close(i32 %170)
%172 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1
%173 = getelementptr inbounds [2 x i32], [2 x i32]* %172, i64 0, i64 0
%174 = load i32, i32* %173
%175 = call i32 @close(i32 %174)
%176 = call i32 @wait(i32 0)
%177 = call i32 @wait(i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"First child: %d %d\0A\00"
@.str.1 = [21 x i8] c"Second child: %d %d\0A\00"
@.str.2 = [64 x i8] c"Father received from first child: %d and from second child: %d\0A\00"
define i32 @main() {
%1 = alloca [2 x [2 x i32]]
%2 = alloca [2 x [2 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast [2 x [2 x i32]]* %1 to i8*
%9 = bitcast [2 x [2 x i32]]* %2 to i8*
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0, i64 0
%14 = call i32 @pipe(i32* %13)
%15 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 1, i64 0
%16 = call i32 @pipe(i32* %15)
%17 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0, i64 0
%18 = call i32 @pipe(i32* %17)
%19 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1, i64 0
%20 = call i32 @pipe(i32* %19)
%21 = call i64 (...) @fork()
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %55
23: ; preds = %0
%24 = load i32, i32* %13
%25 = call i32 @close(i32 %24)
%26 = load i32, i32* %19
%27 = call i32 @close(i32 %26)
%28 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1, i64 1
%29 = load i32, i32* %28
%30 = call i32 @close(i32 %29)
%31 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 1, i64 1
%32 = load i32, i32* %31
%33 = call i32 @close(i32 %32)
%34 = load i32, i32* %17
%35 = call i32 @close(i32 %34)
%36 = call i32 (...) @getpid()
store i32 %36, i32* %3
%37 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0, i64 1
%38 = load i32, i32* %37
%39 = call i32 @write(i32 %38, i32* %3, i32 4)
%40 = load i32, i32* %37
%41 = call i32 @close(i32 %40)
%42 = load i32, i32* %15
%43 = call i32 @read(i32 %42, i32* %4, i32 4)
%44 = load i32, i32* %15
%45 = call i32 @close(i32 %44)
%46 = load i32, i32* %4
%47 = srem i32 %36, %46
store i32 %47, i32* %5
%48 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0, i64 1
%49 = load i32, i32* %48
%50 = call i32 @write(i32 %49, i32* %5, i32 4)
%51 = load i32, i32* %48
%52 = call i32 @close(i32 %51)
%53 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %36, i32 %46)
%54 = call i32 @exit(i32 0)
unreachable
55: ; preds = %0
%56 = call i64 (...) @fork()
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %90
58: ; preds = %55
%59 = call i32 (...) @getpid()
store i32 %59, i32* %4
%60 = load i32, i32* %17
%61 = call i32 @close(i32 %60)
%62 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0, i64 1
%63 = load i32, i32* %62
%64 = call i32 @close(i32 %63)
%65 = load i32, i32* %19
%66 = call i32 @close(i32 %65)
%67 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0, i64 1
%68 = load i32, i32* %67
%69 = call i32 @close(i32 %68)
%70 = load i32, i32* %15
%71 = call i32 @close(i32 %70)
%72 = load i32, i32* %13
%73 = call i32 @read(i32 %72, i32* %3, i32 4)
%74 = load i32, i32* %13
%75 = call i32 @close(i32 %74)
%76 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 1, i64 1
%77 = load i32, i32* %76
%78 = call i32 @write(i32 %77, i32* %4, i32 4)
%79 = load i32, i32* %76
%80 = call i32 @close(i32 %79)
%81 = load i32, i32* %3
%82 = srem i32 %59, %81
store i32 %82, i32* %5
%83 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1, i64 1
%84 = load i32, i32* %83
%85 = call i32 @write(i32 %84, i32* %5, i32 4)
%86 = load i32, i32* %83
%87 = call i32 @close(i32 %86)
%88 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %81, i32 %59)
%89 = call i32 @exit(i32 0)
unreachable
90: ; preds = %55
%91 = load i32, i32* %13
%92 = call i32 @close(i32 %91)
%93 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0, i64 1
%94 = load i32, i32* %93
%95 = call i32 @close(i32 %94)
%96 = load i32, i32* %15
%97 = call i32 @close(i32 %96)
%98 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 1, i64 1
%99 = load i32, i32* %98
%100 = call i32 @close(i32 %99)
%101 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0, i64 1
%102 = load i32, i32* %101
%103 = call i32 @close(i32 %102)
%104 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1, i64 1
%105 = load i32, i32* %104
%106 = call i32 @close(i32 %105)
%107 = bitcast i32* %6 to i8*
%108 = bitcast i32* %7 to i8*
%109 = load i32, i32* %17
%110 = call i32 @read(i32 %109, i32* %6, i32 4)
%111 = load i32, i32* %19
%112 = call i32 @read(i32 %111, i32* %7, i32 4)
%113 = load i32, i32* %6
%114 = load i32, i32* %7
%115 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0), i32 %113, i32 %114)
%116 = load i32, i32* %17
%117 = call i32 @close(i32 %116)
%118 = load i32, i32* %19
%119 = call i32 @close(i32 %118)
%120 = call i32 @wait(i32 0)
%121 = call i32 @wait(i32 0)
ret i32 0
}