#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 scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ fork();
int /*<<< orphan*/ write(int, ...);
int main(int argc, char *argv[], char *envp[]) {
  int fd = 1;
  int arr[100];
  for (int i = 0; i < 100; i++)
    arr[i] = i;
  write(fd, &arr, 1);
  write(fd, "World \0", 6);
  pid_t pid = fork();
  if (pid > 0) {
    while (1) {
      write(fd, "Parent\n\0", 7);
    }
  } else if (pid == 0) {
    while (1) {
      write(fd, "Child\n\0", 6);
    }
  }
  write(fd, "2\0", 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x1b4(%rbp)
cmpl   $0x64,-0x1b4(%rbp)
jge    1183 <main+0x63>
mov    -0x1b4(%rbp),%ecx
movslq -0x1b4(%rbp),%rax
mov    %ecx,-0x1b0(%rbp,%rax,4)
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    114e <main+0x2e>
mov    -0x1c(%rbp),%edi
lea    -0x1b0(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    -0x1c(%rbp),%edi
lea    0xe5d(%rip),%rsi
mov    $0x6,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    $0x0,%al
call   1040 <fork@plt>
mov    %rax,-0x1c0(%rbp)
cmpq   $0x0,-0x1c0(%rbp)
jle    11eb <main+0xcb>
jmp    11d0 <main+0xb0>
mov    -0x1c(%rbp),%edi
lea    0xe36(%rip),%rsi
mov    $0x7,%edx
mov    $0x0,%al
call   1030 <write@plt>
jmp    11d0 <main+0xb0>
cmpq   $0x0,-0x1c0(%rbp)
jne    1219 <main+0xf9>
jmp    11fe <main+0xde>
mov    -0x1c(%rbp),%edi
lea    0xe00(%rip),%rsi
mov    $0x6,%edx
mov    $0x0,%al
call   1030 <write@plt>
jmp    11fe <main+0xde>
jmp    121e <main+0xfe>
mov    -0x1c(%rbp),%edi
lea    0xdf1(%rip),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <write@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x190,%rsp
movaps 0xed1(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeea(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeee(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xef2(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xef3(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xef4(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xef6(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xef7(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xef8(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xefa(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xefb(%rip),%xmm0
movaps %xmm0,0x110(%rsp)
movaps 0xefc(%rip),%xmm0
movaps %xmm0,0x120(%rsp)
movaps 0xefd(%rip),%xmm0
movaps %xmm0,0x130(%rsp)
movaps 0xefe(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movaps 0xeff(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movaps 0xf00(%rip),%xmm0
movaps %xmm0,0x160(%rsp)
movaps 0xf01(%rip),%xmm0
movaps %xmm0,0x170(%rsp)
movaps 0xf02(%rip),%xmm0
movaps %xmm0,0x180(%rsp)
mov    %rsp,%rsi
mov    $0x1,%edi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <write@plt>
lea    0xeef(%rip),%rsi
mov    $0x1,%edi
mov    $0x6,%edx
xor    %eax,%eax
call   1030 <write@plt>
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
jle    12e6 <main+0x1c6>
lea    0xedb(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x7,%edx
xor    %eax,%eax
call   1030 <write@plt>
jmp    12d0 <main+0x1b0>
je     130b <main+0x1eb>
lea    0xeba(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <write@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
ret
lea    0xe86(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x6,%edx
xor    %eax,%eax
call   1030 <write@plt>
jmp    1320 <main+0x200>

LLVM IR (-O0):
@.str = [8 x i8] c"World \00\00"
@.str.1 = [9 x i8] c"Parent\0A\00\00"
@.str.2 = [8 x i8] c"Child\0A\00\00"
@.str.3 = [3 x i8] c"2\00\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca [100 x i32]
%10 = alloca i32
%11 = alloca i64
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 1, i32* %8
store i32 0, i32* %10
br label %12
12: ; preds = %20, %3
%13 = load i32, i32* %10
%14 = icmp slt i32 %13, 100
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %10
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %9, i64 0, i64 %18
store i32 %16, i32* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %10
%22 = add nsw i32 %21, 1
store i32 %22, i32* %10
br label %12
23: ; preds = %12
%24 = load i32, i32* %8
%25 = call i32 (i32, ...) @write(i32 %24, [100 x i32]* %9, i32 1)
%26 = load i32, i32* %8
%27 = call i32 (i32, ...) @write(i32 %26, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 6)
%28 = call i64 (...) @fork()
store i64 %28, i64* %11
%29 = load i64, i64* %11
%30 = icmp sgt i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %23
br label %32
32: ; preds = %31, %32
%33 = load i32, i32* %8
%34 = call i32 (i32, ...) @write(i32 %33, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 7)
br label %32
35: ; preds = %23
%36 = load i64, i64* %11
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %35
br label %39
39: ; preds = %38, %39
%40 = load i32, i32* %8
%41 = call i32 (i32, ...) @write(i32 %40, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 6)
br label %39
42: ; preds = %35
br label %43
43: ; preds = %42
%44 = load i32, i32* %8
%45 = call i32 (i32, ...) @write(i32 %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 1)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"World \00\00"
@.str.1 = [9 x i8] c"Parent\0A\00\00"
@.str.2 = [8 x i8] c"Child\0A\00\00"
@.str.3 = [3 x i8] c"2\00\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca [100 x i32]
%5 = bitcast [100 x i32]* %4 to i8*
%6 = bitcast [100 x i32]* %4 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %6
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 4
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %8
%9 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 8
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, <4 x i32>* %10
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 12
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 12, i32 13, i32 14, i32 15>, <4 x i32>* %12
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 16
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> <i32 16, i32 17, i32 18, i32 19>, <4 x i32>* %14
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 20
%16 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> <i32 20, i32 21, i32 22, i32 23>, <4 x i32>* %16
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 24
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 24, i32 25, i32 26, i32 27>, <4 x i32>* %18
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 28
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> <i32 28, i32 29, i32 30, i32 31>, <4 x i32>* %20
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 32
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> <i32 32, i32 33, i32 34, i32 35>, <4 x i32>* %22
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 36
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> <i32 36, i32 37, i32 38, i32 39>, <4 x i32>* %24
%25 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 40
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> <i32 40, i32 41, i32 42, i32 43>, <4 x i32>* %26
%27 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 44
%28 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> <i32 44, i32 45, i32 46, i32 47>, <4 x i32>* %28
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 48
%30 = bitcast i32* %29 to <4 x i32>*
store <4 x i32> <i32 48, i32 49, i32 50, i32 51>, <4 x i32>* %30
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 52
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> <i32 52, i32 53, i32 54, i32 55>, <4 x i32>* %32
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 56
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> <i32 56, i32 57, i32 58, i32 59>, <4 x i32>* %34
%35 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 60
%36 = bitcast i32* %35 to <4 x i32>*
store <4 x i32> <i32 60, i32 61, i32 62, i32 63>, <4 x i32>* %36
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 64
%38 = bitcast i32* %37 to <4 x i32>*
store <4 x i32> <i32 64, i32 65, i32 66, i32 67>, <4 x i32>* %38
%39 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 68
%40 = bitcast i32* %39 to <4 x i32>*
store <4 x i32> <i32 68, i32 69, i32 70, i32 71>, <4 x i32>* %40
%41 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 72
%42 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> <i32 72, i32 73, i32 74, i32 75>, <4 x i32>* %42
%43 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 76
%44 = bitcast i32* %43 to <4 x i32>*
store <4 x i32> <i32 76, i32 77, i32 78, i32 79>, <4 x i32>* %44
%45 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 80
%46 = bitcast i32* %45 to <4 x i32>*
store <4 x i32> <i32 80, i32 81, i32 82, i32 83>, <4 x i32>* %46
%47 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 84
%48 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> <i32 84, i32 85, i32 86, i32 87>, <4 x i32>* %48
%49 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 88
%50 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> <i32 88, i32 89, i32 90, i32 91>, <4 x i32>* %50
%51 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 92
%52 = bitcast i32* %51 to <4 x i32>*
store <4 x i32> <i32 92, i32 93, i32 94, i32 95>, <4 x i32>* %52
%53 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 96
%54 = bitcast i32* %53 to <4 x i32>*
store <4 x i32> <i32 96, i32 97, i32 98, i32 99>, <4 x i32>* %54
%55 = call i32 (i32, ...) @write(i32 1, [100 x i32]* %4, i32 1)
%56 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 6)
%57 = call i64 (...) @fork()
%58 = icmp sgt i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %3, %59
%60 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 7)
br label %59
61: ; preds = %3
%62 = icmp eq i64 %57, 0
br i1 %62, label %63, label %65
63: ; preds = %61, %63
%64 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 6)
br label %63
65: ; preds = %61
%66 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 1)
ret i32 0
}