#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*/ msg_recv(int, char *, int);
int /*<<< orphan*/ msg_send(int, char *);
int /*<<< orphan*/ printf(char *);
int reception();
int main() {
  char buffer[128];
  char *welcome = "Welcome to the land of Orca.\n";
  int fd_comm;
  printf("Orca server started...\n");
  fd_comm = reception();
  msg_send(fd_comm, welcome);
  while (1) {
    msg_recv(fd_comm, buffer, 128);
    msg_send(fd_comm, buffer);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rax
mov    %rax,-0x98(%rbp)
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <reception@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rsi
call   1060 <msg_send@plt>
mov    -0x9c(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x80,%edx
call   1030 <msg_recv@plt>
mov    -0x9c(%rbp),%edi
lea    -0x90(%rbp),%rsi
call   1060 <msg_send@plt>
jmp    118b <main+0x4b>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
lea    0xecd(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <reception@plt>
mov    %eax,%ebx
lea    0xe9a(%rip),%rsi
mov    %eax,%edi
call   1060 <msg_send@plt>
mov    %rsp,%r14
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x80,%edx
call   1030 <msg_recv@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1060 <msg_send@plt>
jmp    1170 <main+0x30>

LLVM IR (-O0):
@.str = [30 x i8] c"Welcome to the land of Orca.\0A\00"
@.str.1 = [24 x i8] c"Orca server started...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (...) @reception()
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = load i8*, i8** %3
%9 = call i32 @msg_send(i32 %7, i8* %8)
br label %10
10: ; preds = %0, %10
%11 = load i32, i32* %4
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%13 = call i32 @msg_recv(i32 %11, i8* %12, i32 128)
%14 = load i32, i32* %4
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%16 = call i32 @msg_send(i32 %14, i8* %15)
br label %10
}

LLVM IR (-O2):
@.str = [30 x i8] c"Welcome to the land of Orca.\0A\00"
@str = [23 x i8] c"Orca server started...\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @reception()
%5 = tail call i32 @msg_send(i32 %4, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %6, %0
%7 = call i32 @msg_recv(i32 %4, i8* %2, i32 128)
%8 = call i32 @msg_send(i32 %4, i8* %2)
br label %6
}