#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*/ Delay(int);
int /*<<< orphan*/ Exit();
int Receive(int *, int);
int /*<<< orphan*/ Reply(int, int, int);
int /*<<< orphan*/ console_xy(int /*<<< orphan*/, int);
int /*<<< orphan*/ cprintf(char *, ...);
main() {
  int EndSequence[9];
  int i;
  int eater;
  int replyToPID;
  cprintf("I am ender\n");
  for (i = 0; i < 9; i++) {
    replyToPID = Receive(&eater, sizeof(int));
    cprintf("GotEater[%d]", eater);
    EndSequence[i] = eater;
    Reply(replyToPID, 9, 9);
  }
  console_xy(0, 6);
  cprintf("Finnished in the following sequence: ");
  for (i = 0; i < 9; i++) {
    cprintf("%d ", EndSequence[i]);
  }
  while (1) {
    Delay(100);
    cprintf("en");
  }
  Exit();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1060 <cprintf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x9,-0x34(%rbp)
jge    11c8 <main+0x78>
lea    -0x38(%rbp),%rdi
mov    $0x4,%esi
call   1040 <Receive@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%esi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1060 <cprintf@plt>
mov    -0x38(%rbp),%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x3c(%rbp),%edi
mov    $0x9,%edx
mov    %edx,%esi
call   1050 <Reply@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1174 <main+0x24>
xor    %edi,%edi
mov    $0x6,%esi
call   1070 <console_xy@plt>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1060 <cprintf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x9,-0x34(%rbp)
jge    1217 <main+0xc7>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1060 <cprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11e9 <main+0x99>
jmp    121c <main+0xcc>
mov    $0x64,%edi
call   1030 <Delay@plt>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1060 <cprintf@plt>
jmp    121c <main+0xcc>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <Receive@plt>
mov    %eax,%ebx
mov    (%rsp),%esi
lea    0xe84(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    (%rsp),%eax
mov    %eax,0x14(%rsp)
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x9,%edx
call   1050 <Reply@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <Receive@plt>
mov    %eax,%ebx
mov    (%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    (%rsp),%eax
mov    %eax,0x10(%rsp)
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x9,%edx
call   1050 <Reply@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <Receive@plt>
mov    %eax,%ebx
mov    (%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    (%rsp),%eax
mov    %eax,0xc(%rsp)
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x9,%edx
call   1050 <Reply@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <Receive@plt>
mov    %eax,%ebx
mov    (%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    (%rsp),%eax
mov    %eax,0x8(%rsp)
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x9,%edx
call   1050 <Reply@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <Receive@plt>
mov    %eax,%ebx
mov    (%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    (%rsp),%eax
mov    %eax,0x4(%rsp)
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x9,%edx
call   1050 <Reply@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <Receive@plt>
mov    %eax,%ebx
mov    (%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    (%rsp),%r15d
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x9,%edx
call   1050 <Reply@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <Receive@plt>
mov    %eax,%ebx
mov    (%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    (%rsp),%r12d
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x9,%edx
call   1050 <Reply@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <Receive@plt>
mov    %eax,%ebx
mov    (%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    (%rsp),%r13d
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x9,%edx
call   1050 <Reply@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <Receive@plt>
mov    %eax,%ebx
mov    (%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    (%rsp),%r14d
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x9,%edx
call   1050 <Reply@plt>
xor    %edi,%edi
mov    $0x6,%esi
call   1070 <console_xy@plt>
lea    0xcc8(%rip),%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
lea    0xce0(%rip),%rbp
mov    %rbp,%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    %rbp,%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    %rbp,%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    %rbp,%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    %rbp,%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    %rbp,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    %rbp,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <cprintf@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <cprintf@plt>
lea    0xc63(%rip),%rbx
mov    $0x64,%edi
call   1030 <Delay@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <cprintf@plt>
jmp    13e0 <main+0x290>

LLVM IR (-O0):
@.str = [12 x i8] c"I am ender\0A\00"
@.str.1 = [13 x i8] c"GotEater[%d]\00"
@.str.2 = [38 x i8] c"Finnished in the following sequence: \00"
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [3 x i8] c"en\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %7
7: ; preds = %20, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 9
br i1 %9, label %10, label %23
10: ; preds = %7
%11 = call i32 @Receive(i32* %4, i32 4)
store i32 %11, i32* %5
%12 = load i32, i32* %4
%13 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 %16
store i32 %14, i32* %17
%18 = load i32, i32* %5
%19 = call i32 @Reply(i32 %18, i32 9, i32 9)
br label %20
20: ; preds = %10
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %7
23: ; preds = %7
%24 = call i32 @console_xy(i32 0, i32 6)
%25 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %26
26: ; preds = %35, %23
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 9
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %29
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %26
38: ; preds = %26
br label %39
39: ; preds = %38, %39
%40 = call i32 @Delay(i32 100)
%41 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %39
}

LLVM IR (-O2):
@.str = [12 x i8] c"I am ender\0A\00"
@.str.1 = [13 x i8] c"GotEater[%d]\00"
@.str.2 = [38 x i8] c"Finnished in the following sequence: \00"
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [3 x i8] c"en\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @Receive(i32* %1, i32 4)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
%8 = call i32 @Reply(i32 %4, i32 9, i32 9)
%9 = call i32 @Receive(i32* %1, i32 4)
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
%13 = call i32 @Reply(i32 %9, i32 9, i32 9)
%14 = call i32 @Receive(i32* %1, i32 4)
%15 = load i32, i32* %1
%16 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %1
%18 = call i32 @Reply(i32 %14, i32 9, i32 9)
%19 = call i32 @Receive(i32* %1, i32 4)
%20 = load i32, i32* %1
%21 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %1
%23 = call i32 @Reply(i32 %19, i32 9, i32 9)
%24 = call i32 @Receive(i32* %1, i32 4)
%25 = load i32, i32* %1
%26 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %1
%28 = call i32 @Reply(i32 %24, i32 9, i32 9)
%29 = call i32 @Receive(i32* %1, i32 4)
%30 = load i32, i32* %1
%31 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %1
%33 = call i32 @Reply(i32 %29, i32 9, i32 9)
%34 = call i32 @Receive(i32* %1, i32 4)
%35 = load i32, i32* %1
%36 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %1
%38 = call i32 @Reply(i32 %34, i32 9, i32 9)
%39 = call i32 @Receive(i32* %1, i32 4)
%40 = load i32, i32* %1
%41 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %1
%43 = call i32 @Reply(i32 %39, i32 9, i32 9)
%44 = call i32 @Receive(i32* %1, i32 4)
%45 = load i32, i32* %1
%46 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = load i32, i32* %1
%48 = call i32 @Reply(i32 %44, i32 9, i32 9)
%49 = call i32 @console_xy(i32 0, i32 6)
%50 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%51 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%52 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%53 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%54 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%55 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%56 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %32)
%57 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%58 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%59 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %47)
br label %60
60: ; preds = %0, %60
%61 = call i32 @Delay(i32 100)
%62 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %60
}