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

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ recvfrom(int, char *, int, int /*<<< orphan*/,
                            int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sendto(int, char *, int, int /*<<< orphan*/,
                          struct sockaddr *, int);
int conectarToServidor(int s, int n1, int n2, struct sockaddr_in *se) {
  int res, num[2];
  num[0] = n1;
  num[1] = n2;
  sendto(s, (char *)num, 2 * sizeof(int), 0, (struct sockaddr *)se,
         sizeof(*se));
  perror("\tSendto: ");
  recvfrom(s, (char *)&res, sizeof(int), 0, NULL, NULL);
  perror("\tRecvfrom: ");
  printf("\nTamanios int:\n\t%d bytes (cliente)\n\t%d bytes (servidor)\n",
         sizeof(int), sizeof(res));
  return res;
}


x86 assembly (clang, -O0):
<conectarToServidor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x24(%rbp),%rsi
mov    -0x18(%rbp),%r8
mov    $0x8,%edx
xor    %ecx,%ecx
mov    $0x4,%r9d
call   1040 <sendto@plt>
lea    0xe7b(%rip),%rdi
call   1060 <perror@plt>
mov    -0x4(%rbp),%edi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%r8
call   1050 <recvfrom@plt>
lea    0xe5e(%rip),%rdi
call   1060 <perror@plt>
lea    0xe5e(%rip),%rdi
mov    $0x4,%edx
mov    %edx,%esi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conectarToServidor>:
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r8
mov    %edi,%ebx
mov    %esi,0x8(%rsp)
mov    %edx,0xc(%rsp)
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
xor    %ecx,%ecx
mov    $0x4,%r9d
call   1040 <sendto@plt>
lea    0xe90(%rip),%rdi
call   1060 <perror@plt>
lea    0x4(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1050 <recvfrom@plt>
lea    0xe75(%rip),%rdi
call   1060 <perror@plt>
lea    0xe75(%rip),%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [10 x i8] c"\09Sendto: \00"
@.str.1 = [12 x i8] c"\09Recvfrom: \00"
@.str.2 = [57 x i8] c"\0ATamanios int:\0A\09%d bytes (cliente)\0A\09%d bytes (servidor)\0A\00"
define i32 @conectarToServidor(i32 %0, i32 %1, i32 %2, %struct.sockaddr_in* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_in*
%9 = alloca i32
%10 = alloca [2 x i32]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store %struct.sockaddr_in* %3, %struct.sockaddr_in** %8
%11 = load i32, i32* %6
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
store i32 %11, i32* %12
%13 = load i32, i32* %7
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 1
store i32 %13, i32* %14
%15 = load i32, i32* %5
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%17 = bitcast i32* %16 to i8*
%18 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%19 = bitcast %struct.sockaddr_in* %18 to %struct.sockaddr*
%20 = call i32 @sendto(i32 %15, i8* %17, i32 8, i32 0, %struct.sockaddr* %19, i32 4)
%21 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* %5
%23 = bitcast i32* %9 to i8*
%24 = call i32 @recvfrom(i32 %22, i8* %23, i32 4, i32 0, i32* null, i32* null)
%25 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 4)
%27 = load i32, i32* %9
ret i32 %27
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [10 x i8] c"\09Sendto: \00"
@.str.1 = [12 x i8] c"\09Recvfrom: \00"
@.str.2 = [57 x i8] c"\0ATamanios int:\0A\09%d bytes (cliente)\0A\09%d bytes (servidor)\0A\00"
define i32 @conectarToServidor(i32 %0, i32 %1, i32 %2, %struct.sockaddr_in* %3) {
%5 = alloca i32
%6 = alloca [2 x i32]
%7 = bitcast i32* %5 to i8*
%8 = bitcast [2 x i32]* %6 to i8*
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 %1, i32* %9
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 %2, i32* %10
%11 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%12 = call i32 @sendto(i32 %0, i8* %8, i32 8, i32 0, %struct.sockaddr* %11, i32 4)
%13 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @recvfrom(i32 %0, i8* %7, i32 4, i32 0, i32* null, i32* null)
%15 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 4)
%17 = load i32, i32* %5
ret i32 %17
}