#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 int /*<<< orphan*/ welcome;
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
int /*<<< orphan*/ msg_send(int, char *);
int reception(int fd_listen) {
  int fd_socket;
  char *welcome[] = {
      "Welcome to the land of OrcA.\n",
      "Your id: \n",
  };
  fd_socket = accept(fd_listen, (struct sockaddr *)NULL, NULL);
  for (int i = 0; i < sizeof(welcome) / sizeof(char *); ++i) {
    msg_send(fd_socket, welcome[i]);
  }
  return fd_socket;
}


x86 assembly (clang, -O0):
<reception>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2cde(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cdb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1030 <accept@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    $0x2,%rax
jae    1187 <reception+0x67>
mov    -0x8(%rbp),%edi
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rsi
call   1040 <msg_send@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115a <reception+0x3a>
mov    -0x8(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reception>:
push   %rbx
xor    %esi,%esi
xor    %edx,%edx
call   1030 <accept@plt>
mov    %eax,%ebx
lea    0xecd(%rip),%rsi
mov    %eax,%edi
call   1040 <msg_send@plt>
lea    0xedd(%rip),%rsi
mov    %ebx,%edi
call   1040 <msg_send@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [30 x i8] c"Welcome to the land of OrcA.\0A\00"
@.str.1 = [11 x i8] c"Your id: \0A\00"
@__const.reception.welcome = [2 x i8*] [i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0)]
define i32 @reception(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [2 x i8*]
%5 = alloca i32
store i32 %0, i32* %2
%6 = bitcast [2 x i8*]* %4 to i8*
%7 = load i32, i32* %2
%8 = call i32 @accept(i32 %7, %struct.sockaddr* null, i32* null)
store i32 %8, i32* %3
store i32 0, i32* %5
br label %9
9: ; preds = %20, %1
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = icmp ult i64 %11, 2
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @msg_send(i32 %14, i8* %18)
br label %20
20: ; preds = %13
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %9
23: ; preds = %9
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [30 x i8] c"Welcome to the land of OrcA.\0A\00"
@.str.1 = [11 x i8] c"Your id: \0A\00"
define i32 @reception(i32 %0) {
%2 = tail call i32 @accept(i32 %0, %struct.sockaddr* null, i32* null)
%3 = tail call i32 @msg_send(i32 %2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @msg_send(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret i32 %2
}