#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 fork();
int getpid();
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
long syscall(int, int, int, char *, ...);
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int status;
  int parent_pid = getpid();
  int child_pid = fork();
  long returnval;
  if (!child_pid) {
    char *send_buffer;
    send_buffer = (char *)malloc(6 * sizeof(char));
    send_buffer = "Hello";
    printf("1st Child sending now\n");
    returnval = syscall(292, parent_pid, 6 * sizeof(char), send_buffer);
    printf("Child: return val %d\n", returnval);
    printf("Child: Message sent.\n");
    char *send_buffer2;
    send_buffer2 = (char *)malloc(6 * sizeof(char));
    send_buffer2 = "hello";
    printf("2nd Child sending now\n");
    returnval = syscall(292, parent_pid, 6 * sizeof(char), send_buffer2);
    printf("Child: return val %d\n", returnval);
    printf("Child: Message sent.\n");
    return 0;
  } else {
    if (!fork()) {
      long int i;
      printf("Child is learning to count...\n");
      for (i = 0; i < 1000000000; i++) {
      }
      char *send_buffer3;
      send_buffer3 = (char *)malloc(6 * sizeof(char));
      send_buffer3 = "h3llo";
      printf("3rd Child sending now\n");
      returnval = syscall(292, parent_pid, 6 * sizeof(char), send_buffer3);
      printf("Child: return val %d\n", returnval);
      printf("Child: Message sent.\n");
      return 0;
    } else {
      printf("Parent waiting on original child\n");
      waitpid(child_pid, &status, 0);
      char *recv_buffer;
      recv_buffer = (char *)malloc(6 * sizeof(char));
      printf("Parent receiving now 1\n");
      long returnval = syscall(293, child_pid, 6 * sizeof(char), recv_buffer);
      printf("Parent: return val %d\n", returnval);
      if (returnval == (6 * sizeof(char))) {
        printf("Parent: Message received - %s\n", recv_buffer);
      } else {
        printf("Message size incorrect\n");
      }
      char *recv_buffer2;
      recv_buffer2 = (char *)malloc(6 * sizeof(char));
      printf("Parent receiving now 2\n");
      returnval = syscall(293, child_pid, 6 * sizeof(char), recv_buffer2);
      printf("Parent: return val %d\n", returnval);
      if (returnval == (6 * sizeof(char))) {
        printf("Parent: Message received - %s\n", recv_buffer2);
      } else {
        printf("Message size incorrect\n");
      }
      char *recv_buffer3;
      recv_buffer3 = (char *)malloc(6 * sizeof(char));
      printf("Parent receiving now3\n");
      returnval = syscall(293, child_pid, 6 * sizeof(char), recv_buffer3);
      printf("Parent: return val %d\n", returnval);
      if (returnval == (6 * sizeof(char))) {
        printf("Parent: Message received - %s\n", recv_buffer2);
      } else {
        printf("Message size incorrect\n");
      }
      char *recv_buffer4;
      recv_buffer4 = (char *)malloc(6 * sizeof(char));
      printf("Parent receiving now4\n");
      returnval = syscall(294, -1, 6 * sizeof(char), recv_buffer4, 1);
      printf("Parent: return val %d\n", returnval);
      if (returnval == (6 * sizeof(char))) {
        printf("Parent: Message received - %s\n", recv_buffer2);
      } else {
        printf("Message size incorrect\n");
      }
    }
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1080 <fork@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1266 <main+0x106>
mov    $0x6,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
lea    0xe57(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x30(%rbp),%rcx
mov    $0x124,%edi
mov    $0x6,%edx
mov    $0x0,%al
call   1050 <syscall@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x6,%edi
call   1060 <malloc@plt>
mov    %rax,-0x38(%rbp)
lea    0xe3d(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x38(%rbp),%rcx
mov    $0x124,%edi
mov    $0x6,%edx
mov    $0x0,%al
call   1050 <syscall@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1537 <main+0x3d7>
mov    $0x0,%al
call   1080 <fork@plt>
cmp    $0x0,%eax
jne    131f <main+0x1bf>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x40(%rbp)
cmpq   $0x3b9aca00,-0x40(%rbp)
3b
jge    12b0 <main+0x150>
jmp    129f <main+0x13f>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    128c <main+0x12c>
mov    $0x6,%edi
call   1060 <malloc@plt>
mov    %rax,-0x48(%rbp)
lea    0xdc0(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x48(%rbp),%rcx
mov    $0x124,%edi
mov    $0x6,%edx
mov    $0x0,%al
call   1050 <syscall@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd27(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1537 <main+0x3d7>
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
lea    -0x14(%rbp),%rsi
xor    %edx,%edx
call   1070 <waitpid@plt>
mov    $0x6,%edi
call   1060 <malloc@plt>
mov    %rax,-0x50(%rbp)
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x50(%rbp),%rcx
mov    $0x125,%edi
mov    $0x6,%edx
mov    $0x0,%al
call   1050 <syscall@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x6,-0x58(%rbp)
jne    13a7 <main+0x247>
mov    -0x50(%rbp),%rsi
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13b5 <main+0x255>
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x6,%edi
call   1060 <malloc@plt>
mov    %rax,-0x60(%rbp)
lea    0xd60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x60(%rbp),%rcx
mov    $0x125,%edi
mov    $0x6,%edx
mov    $0x0,%al
call   1050 <syscall@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xce4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x6,-0x58(%rbp)
jne    1421 <main+0x2c1>
mov    -0x60(%rbp),%rsi
lea    0xcde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    142f <main+0x2cf>
lea    0xcea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x6,%edi
call   1060 <malloc@plt>
mov    %rax,-0x68(%rbp)
lea    0xcfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x68(%rbp),%rcx
mov    $0x125,%edi
mov    $0x6,%edx
mov    $0x0,%al
call   1050 <syscall@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xc6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x6,-0x58(%rbp)
jne    149b <main+0x33b>
mov    -0x60(%rbp),%rsi
lea    0xc64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14a9 <main+0x349>
lea    0xc70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x6,%edi
call   1060 <malloc@plt>
mov    %rax,-0x70(%rbp)
lea    0xc9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x70(%rbp),%rcx
mov    $0x126,%edi
mov    $0xffffffff,%esi
mov    $0x6,%edx
mov    $0x1,%r8d
mov    $0x0,%al
call   1050 <syscall@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xbe8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x6,-0x58(%rbp)
jne    151d <main+0x3bd>
mov    -0x60(%rbp),%rsi
lea    0xbe2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    152b <main+0x3cb>
lea    0xbee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1530 <main+0x3d0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1090 <fork@plt>
test   %eax,%eax
je     121e <main+0xae>
mov    %eax,%ebx
xor    %eax,%eax
call   1090 <fork@plt>
test   %eax,%eax
je     12b6 <main+0x146>
lea    0xf2b(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    $0x6,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
lea    0xf25(%rip),%rdi
call   1030 <puts@plt>
mov    $0x125,%edi
mov    %ebx,%esi
mov    $0x6,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1060 <syscall@plt>
mov    %rax,%rbp
lea    0xe34(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x6,%rbp
jne    130f <main+0x19f>
lea    0xe30(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    131b <main+0x1ab>
mov    $0x6,%edi
call   1070 <malloc@plt>
lea    0xe2f(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc5(%rip),%rcx
mov    $0x124,%edi
mov    %ebp,%esi
mov    $0x6,%edx
xor    %eax,%eax
call   1060 <syscall@plt>
lea    0xdb1(%rip),%r14
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe55(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x6,%edi
call   1070 <malloc@plt>
lea    0xdf2(%rip),%rdi
call   1030 <puts@plt>
lea    0xd8e(%rip),%rcx
mov    $0x124,%edi
mov    %ebp,%esi
mov    $0x6,%edx
xor    %eax,%eax
call   1060 <syscall@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
jmp    1457 <main+0x2e7>
lea    0xdcd(%rip),%rdi
call   1030 <puts@plt>
mov    $0x6,%edi
call   1070 <malloc@plt>
lea    0xdd5(%rip),%rdi
call   1030 <puts@plt>
lea    0xd43(%rip),%rcx
mov    $0x124,%edi
mov    %ebp,%esi
mov    $0x6,%edx
xor    %eax,%eax
call   1060 <syscall@plt>
lea    0xd0d(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdb4(%rip),%rdi
jmp    1457 <main+0x2e7>
lea    0xe38(%rip),%rdi
call   1030 <puts@plt>
mov    $0x6,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
lea    0xddc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x125,%edi
mov    %ebx,%esi
mov    $0x6,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1060 <syscall@plt>
mov    %rax,%rbp
lea    0xcd4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x6,%rbp
jne    1377 <main+0x207>
lea    0xcd4(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1383 <main+0x213>
lea    0xdd0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x6,%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
lea    0xd8b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x125,%edi
mov    %ebx,%esi
mov    $0x6,%edx
mov    %rbp,%rcx
xor    %eax,%eax
call   1060 <syscall@plt>
mov    %rax,%rbx
lea    0xc6c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x6,%rbx
jne    13df <main+0x26f>
lea    0xc6c(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    13eb <main+0x27b>
lea    0xd68(%rip),%rdi
call   1030 <puts@plt>
mov    $0x6,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xd39(%rip),%rdi
call   1030 <puts@plt>
mov    $0x126,%edi
mov    $0xffffffff,%esi
mov    $0x6,%edx
mov    %rbx,%rcx
mov    $0x1,%r8d
xor    %eax,%eax
call   1060 <syscall@plt>
mov    %rax,%rbx
lea    0xbfb(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x6,%rbx
jne    1450 <main+0x2e0>
lea    0xbfb(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    145c <main+0x2ec>
lea    0xcf7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [23 x i8] c"1st Child sending now\0A\00"
@.str.2 = [22 x i8] c"Child: return val %d\0A\00"
@.str.3 = [22 x i8] c"Child: Message sent.\0A\00"
@.str.4 = [6 x i8] c"hello\00"
@.str.5 = [23 x i8] c"2nd Child sending now\0A\00"
@.str.6 = [31 x i8] c"Child is learning to count...\0A\00"
@.str.7 = [6 x i8] c"h3llo\00"
@.str.8 = [23 x i8] c"3rd Child sending now\0A\00"
@.str.9 = [34 x i8] c"Parent waiting on original child\0A\00"
@.str.10 = [24 x i8] c"Parent receiving now 1\0A\00"
@.str.11 = [23 x i8] c"Parent: return val %d\0A\00"
@.str.12 = [31 x i8] c"Parent: Message received - %s\0A\00"
@.str.13 = [24 x i8] c"Message size incorrect\0A\00"
@.str.14 = [24 x i8] c"Parent receiving now 2\0A\00"
@.str.15 = [23 x i8] c"Parent receiving now3\0A\00"
@.str.16 = [23 x i8] c"Parent receiving now4\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = call i32 (...) @getpid()
store i32 %19, i32* %7
%20 = call i32 (...) @fork()
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = icmp ne i32 %21, 0
br i1 %22, label %42, label %23
23: ; preds = %2
%24 = call i64 @malloc(i32 6)
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %10
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %10
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* %7
%28 = load i8*, i8** %10
%29 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 292, i32 %27, i32 6, i8* %28)
store i64 %29, i64* %9
%30 = load i64, i64* %9
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%33 = call i64 @malloc(i32 6)
%34 = inttoptr i64 %33 to i8*
store i8* %34, i8** %11
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %11
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%36 = load i32, i32* %7
%37 = load i8*, i8** %11
%38 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 292, i32 %36, i32 6, i8* %37)
store i64 %38, i64* %9
%39 = load i64, i64* %9
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %132
42: ; preds = %2
%43 = call i32 (...) @fork()
%44 = icmp ne i32 %43, 0
br i1 %44, label %64, label %45
45: ; preds = %42
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
store i64 0, i64* %12
br label %47
47: ; preds = %51, %45
%48 = load i64, i64* %12
%49 = icmp slt i64 %48, 1000000000
br i1 %49, label %50, label %54
50: ; preds = %47
br label %51
51: ; preds = %50
%52 = load i64, i64* %12
%53 = add nsw i64 %52, 1
store i64 %53, i64* %12
br label %47
54: ; preds = %47
%55 = call i64 @malloc(i32 6)
%56 = inttoptr i64 %55 to i8*
store i8* %56, i8** %13
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8** %13
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%58 = load i32, i32* %7
%59 = load i8*, i8** %13
%60 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 292, i32 %58, i32 6, i8* %59)
store i64 %60, i64* %9
%61 = load i64, i64* %9
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 %61)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %132
64: ; preds = %42
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0))
%66 = load i32, i32* %8
%67 = call i32 @waitpid(i32 %66, i32* %6, i32 0)
%68 = call i64 @malloc(i32 6)
%69 = inttoptr i64 %68 to i8*
store i8* %69, i8** %14
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%71 = load i32, i32* %8
%72 = load i8*, i8** %14
%73 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 293, i32 %71, i32 6, i8* %72)
store i64 %73, i64* %15
%74 = load i64, i64* %15
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i64 %74)
%76 = load i64, i64* %15
%77 = icmp eq i64 %76, 6
br i1 %77, label %78, label %81
78: ; preds = %64
%79 = load i8*, i8** %14
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i8* %79)
br label %83
81: ; preds = %64
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
br label %83
83: ; preds = %81, %78
%84 = call i64 @malloc(i32 6)
%85 = inttoptr i64 %84 to i8*
store i8* %85, i8** %16
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0))
%87 = load i32, i32* %8
%88 = load i8*, i8** %16
%89 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 293, i32 %87, i32 6, i8* %88)
store i64 %89, i64* %15
%90 = load i64, i64* %15
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i64 %90)
%92 = load i64, i64* %15
%93 = icmp eq i64 %92, 6
br i1 %93, label %94, label %97
94: ; preds = %83
%95 = load i8*, i8** %16
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i8* %95)
br label %99
97: ; preds = %83
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
br label %99
99: ; preds = %97, %94
%100 = call i64 @malloc(i32 6)
%101 = inttoptr i64 %100 to i8*
store i8* %101, i8** %17
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0))
%103 = load i32, i32* %8
%104 = load i8*, i8** %17
%105 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 293, i32 %103, i32 6, i8* %104)
store i64 %105, i64* %15
%106 = load i64, i64* %15
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i64 %106)
%108 = load i64, i64* %15
%109 = icmp eq i64 %108, 6
br i1 %109, label %110, label %113
110: ; preds = %99
%111 = load i8*, i8** %16
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i8* %111)
br label %115
113: ; preds = %99
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
br label %115
115: ; preds = %113, %110
%116 = call i64 @malloc(i32 6)
%117 = inttoptr i64 %116 to i8*
store i8* %117, i8** %18
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0))
%119 = load i8*, i8** %18
%120 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 294, i32 -1, i32 6, i8* %119, i32 1)
store i64 %120, i64* %15
%121 = load i64, i64* %15
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i64 %121)
%123 = load i64, i64* %15
%124 = icmp eq i64 %123, 6
br i1 %124, label %125, label %128
125: ; preds = %115
%126 = load i8*, i8** %16
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i8* %126)
br label %130
128: ; preds = %115
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
br label %130
130: ; preds = %128, %125
br label %131
131: ; preds = %130
store i32 0, i32* %3
br label %132
132: ; preds = %131, %54, %23
%133 = load i32, i32* %3
ret i32 %133
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
@.str.2 = [22 x i8] c"Child: return val %d\0A\00"
@.str.4 = [6 x i8] c"hello\00"
@.str.7 = [6 x i8] c"h3llo\00"
@.str.11 = [23 x i8] c"Parent: return val %d\0A\00"
@.str.12 = [31 x i8] c"Parent: Message received - %s\0A\00"
@str = [22 x i8] c"1st Child sending now\00"
@str.18 = [22 x i8] c"2nd Child sending now\00"
@str.20 = [30 x i8] c"Child is learning to count...\00"
@str.21 = [22 x i8] c"3rd Child sending now\00"
@str.22 = [21 x i8] c"Child: Message sent.\00"
@str.23 = [33 x i8] c"Parent waiting on original child\00"
@str.24 = [23 x i8] c"Parent receiving now 1\00"
@str.26 = [23 x i8] c"Parent receiving now 2\00"
@str.28 = [22 x i8] c"Parent receiving now3\00"
@str.30 = [22 x i8] c"Parent receiving now4\00"
@str.31 = [23 x i8] c"Message size incorrect\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (...) @getpid()
%6 = tail call i32 (...) @fork()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %2
%9 = tail call i64 @malloc(i32 6)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%11 = tail call i64 (i32, i32, i32, i8*, ...) @syscall(i32 292, i32 %5, i32 6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 %11)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.22, i64 0, i64 0))
%14 = tail call i64 @malloc(i32 6)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.18, i64 0, i64 0))
%16 = tail call i64 (i32, i32, i32, i8*, ...) @syscall(i32 292, i32 %5, i32 6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 %16)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.22, i64 0, i64 0))
br label %75
19: ; preds = %2
%20 = tail call i32 (...) @fork()
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.20, i64 0, i64 0))
%24 = tail call i64 @malloc(i32 6)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.21, i64 0, i64 0))
%26 = tail call i64 (i32, i32, i32, i8*, ...) @syscall(i32 292, i32 %5, i32 6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 %26)
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.22, i64 0, i64 0))
br label %75
29: ; preds = %19
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.23, i64 0, i64 0))
%31 = call i32 @waitpid(i32 %6, i32* %3, i32 0)
%32 = call i64 @malloc(i32 6)
%33 = inttoptr i64 %32 to i8*
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.24, i64 0, i64 0))
%35 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 293, i32 %6, i32 6, i8* %33)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i64 %35)
%37 = icmp eq i64 %35, 6
br i1 %37, label %38, label %40
38: ; preds = %29
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i8* %33)
br label %42
40: ; preds = %29
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.31, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
%43 = call i64 @malloc(i32 6)
%44 = inttoptr i64 %43 to i8*
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.26, i64 0, i64 0))
%46 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 293, i32 %6, i32 6, i8* %44)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i64 %46)
%48 = icmp eq i64 %46, 6
br i1 %48, label %49, label %51
49: ; preds = %42
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i8* %44)
br label %53
51: ; preds = %42
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.31, i64 0, i64 0))
br label %53
53: ; preds = %51, %49
%54 = call i64 @malloc(i32 6)
%55 = inttoptr i64 %54 to i8*
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.28, i64 0, i64 0))
%57 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 293, i32 %6, i32 6, i8* %55)
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i64 %57)
%59 = icmp eq i64 %57, 6
br i1 %59, label %60, label %62
60: ; preds = %53
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i8* %44)
br label %64
62: ; preds = %53
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.31, i64 0, i64 0))
br label %64
64: ; preds = %62, %60
%65 = call i64 @malloc(i32 6)
%66 = inttoptr i64 %65 to i8*
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.30, i64 0, i64 0))
%68 = call i64 (i32, i32, i32, i8*, ...) @syscall(i32 294, i32 -1, i32 6, i8* %66, i32 1)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i64 %68)
%70 = icmp eq i64 %68, 6
br i1 %70, label %71, label %73
71: ; preds = %64
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i8* %44)
br label %75
73: ; preds = %64
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.31, i64 0, i64 0))
br label %75
75: ; preds = %71, %73, %22, %8
ret i32 0
}