#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__ uint16_t;
typedef int /*<<< orphan*/ suma;
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ MSG_WAITALL;
int /*<<< orphan*/ close(int);
scalar_t__ htons(scalar_t__);
scalar_t__ ntohs(scalar_t__);
int /*<<< orphan*/ recv(int, scalar_t__ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, scalar_t__ *, int, int /*<<< orphan*/);
void deservire_client(int c) {
  uint16_t a, b, suma;
  recv(c, &a, sizeof(a), MSG_WAITALL);
  recv(c, &b, sizeof(b), MSG_WAITALL);
  a = ntohs(a);
  b = ntohs(b);
  suma = a + b;
  suma = htons(suma);
  send(c, &suma, sizeof(suma), 0);
  close(c);
}


x86 assembly (clang, -O0):
<deservire_client>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e73(%rip),%rax
mov    (%rax),%ecx
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <recv@plt>
mov    -0x4(%rbp),%edi
mov    0x2e59(%rip),%rax
mov    (%rax),%ecx
lea    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1030 <recv@plt>
mov    -0x10(%rbp),%rdi
call   1070 <ntohs@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <ntohs@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <htons@plt>
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x8,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    -0x4(%rbp),%edi
call   1060 <close@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deservire_client>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
mov    0x2e78(%rip),%r14
mov    (%r14),%ecx
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <recv@plt>
mov    (%r14),%ecx
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
mov    $0x8,%edx
call   1030 <recv@plt>
mov    (%rsp),%rdi
call   1070 <ntohs@plt>
mov    %rax,(%rsp)
mov    0x8(%rsp),%rdi
call   1070 <ntohs@plt>
mov    %rax,0x8(%rsp)
add    (%rsp),%rax
mov    %rax,%rdi
call   1040 <htons@plt>
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0x8,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    %ebx,%edi
call   1060 <close@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@MSG_WAITALL = global i32 0
define void @deservire_client(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* @MSG_WAITALL
%8 = call i32 @recv(i32 %6, i64* %3, i32 8, i32 %7)
%9 = load i32, i32* %2
%10 = load i32, i32* @MSG_WAITALL
%11 = call i32 @recv(i32 %9, i64* %4, i32 8, i32 %10)
%12 = load i64, i64* %3
%13 = call i64 @ntohs(i64 %12)
store i64 %13, i64* %3
%14 = load i64, i64* %4
%15 = call i64 @ntohs(i64 %14)
store i64 %15, i64* %4
%16 = load i64, i64* %3
%17 = load i64, i64* %4
%18 = add nsw i64 %16, %17
store i64 %18, i64* %5
%19 = load i64, i64* %5
%20 = call i64 @htons(i64 %19)
store i64 %20, i64* %5
%21 = load i32, i32* %2
%22 = call i32 @send(i32 %21, i64* %5, i32 8, i32 0)
%23 = load i32, i32* %2
%24 = call i32 @close(i32 %23)
ret void
}

LLVM IR (-O2):
@MSG_WAITALL = global i32 0
define void @deservire_client(i32 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %2 to i8*
%6 = bitcast i64* %3 to i8*
%7 = bitcast i64* %4 to i8*
%8 = load i32, i32* @MSG_WAITALL
%9 = call i32 @recv(i32 %0, i64* %2, i32 8, i32 %8)
%10 = load i32, i32* @MSG_WAITALL
%11 = call i32 @recv(i32 %0, i64* %3, i32 8, i32 %10)
%12 = load i64, i64* %2
%13 = call i64 @ntohs(i64 %12)
store i64 %13, i64* %2
%14 = load i64, i64* %3
%15 = call i64 @ntohs(i64 %14)
store i64 %15, i64* %3
%16 = load i64, i64* %2
%17 = add nsw i64 %16, %15
%18 = call i64 @htons(i64 %17)
store i64 %18, i64* %4
%19 = call i32 @send(i32 %0, i64* %4, i32 8, i32 0)
%20 = call i32 @close(i32 %0)
ret void
}