#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*/ close(int);
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ printf(char *, char *);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int strlen(char *);
void *fonctionThread(void *descSockP) {
  int descSock = *(int *)descSockP;
  char *mess = "Yeah!\n";
  send(descSock, mess, strlen(mess) * sizeof(char), 0);
  char buff[1024];
  int recu = recv(descSock, buff, 1023 * sizeof(char), 0);
  buff[recu] = '\0';
  printf("Message recu : %s\n", buff);
  close(descSock);
  free(descSockP);
  return NULL;
}


x86 assembly (clang, -O0):
<fonctionThread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
lea    0xe81(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x434(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x430(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x434(%rbp),%edi
mov    -0x430(%rbp),%rsi
cltq
shl    $0x0,%rax
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    -0xc(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
mov    %eax,-0x424(%rbp)
movslq -0x424(%rbp),%rax
movb   $0x0,-0x420(%rbp,%rax,1)
lea    -0x420(%rbp),%rsi
lea    0xe12(%rip),%rdi
call   1070 <printf@plt>
mov    -0xc(%rbp),%edi
call   1080 <close@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fonctionThread>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rbx
mov    (%rdi),%ebp
lea    0xe89(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %rsp,%r14
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
cltq
movb   $0x0,(%rsp,%rax,1)
lea    0xe59(%rip),%rdi
mov    %r14,%rsi
call   1070 <printf@plt>
mov    %ebp,%edi
call   1080 <close@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Yeah!\0A\00"
@.str.1 = [19 x i8] c"Message recu : %s\0A\00"
define i8* @fonctionThread(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [1024 x i8]
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
store i32 %9, i32* %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %4
%10 = load i32, i32* %3
%11 = load i8*, i8** %4
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 1
%16 = trunc i64 %15 to i32
%17 = call i32 @send(i32 %10, i8* %11, i32 %16, i32 0)
%18 = load i32, i32* %3
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%20 = call i32 @recv(i32 %18, i8* %19, i32 1023, i32 0)
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %22
store i8 0, i8* %23
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %24)
%26 = load i32, i32* %3
%27 = call i32 @close(i32 %26)
%28 = load i8*, i8** %2
%29 = call i32 @free(i8* %28)
ret i8* null
}

LLVM IR (-O2):
@.str = [7 x i8] c"Yeah!\0A\00"
@.str.1 = [19 x i8] c"Message recu : %s\0A\00"
define noalias i8* @fonctionThread(i8* nocapture %0) {
%2 = alloca [1024 x i8]
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @send(i32 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5, i32 0)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%8 = call i32 @recv(i32 %4, i8* %7, i32 1023, i32 0)
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %9
store i8 0, i8* %10
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%12 = call i32 @close(i32 %4)
%13 = call i32 @free(i8* %0)
ret i8* null
}