#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;
};
struct addrinfo {
  scalar_t__ ai_addr;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ O_NONBLOCK;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ bzero(struct addrinfo *, int);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int fcntl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int /*<<< orphan*/ perror(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int recv(int, char *, int, int /*<<< orphan*/);
int send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
void fonctionThread(void *descSockP) {
  int retour = 0;
  struct sockaddr_in adress_sock;
  struct addrinfo *first_info;
  struct addrinfo hints;
  bzero(&hints, sizeof(struct addrinfo));
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_STREAM;
  retour = getaddrinfo("lucien", "2628", &hints, &first_info);
  if (retour != 0) {
    printf("%s\n", gai_strerror(retour));
    exit(1);
  }
  if (first_info != NULL) {
    adress_sock = *(struct sockaddr_in *)first_info->ai_addr;
  }
  int desc_sock = socket(PF_INET, SOCK_STREAM, 0);
  retour = connect(desc_sock, (struct sockaddr *)&adress_sock,
                   sizeof(struct sockaddr_in));
  if (retour == -1) {
    perror(strerror(errno));
    exit(1);
  }
  int descSock = *(int *)descSockP;
  char buf2[1024];
  int recu = recv(descSock, buf2, 1023 * sizeof(char), 0);
  buf2[recu] = '\0';
  printf("%s", buf2);
  retour = send(desc_sock, buf2, strlen(buf2), 0);
  if (retour == -1) {
    perror(strerror(errno));
    exit(1);
  }
  char buff[1024];
  int size_rec = 0;
  sleep(1);
  size_rec = recv(desc_sock, buff, 1023 * sizeof(char), 0);
  buff[size_rec] = '\0';
  printf("%s", buff);
  retour = send(descSock, buff, strlen(buff), 0);
  fflush(stdout);
  if (fcntl(desc_sock, F_SETFL, O_NONBLOCK) == -1) {
    perror(strerror(errno));
    exit(1);
  }
  while ((size_rec = recv(desc_sock, buff, 1023 * sizeof(char), 0)) != -1) {
    buff[size_rec] = '\0';
    printf("%s", buff);
    retour = send(descSock, buff, strlen(buff), 0);
    if (retour == -1) {
      perror(strerror(errno));
      exit(1);
    }
  }
  close(desc_sock);
  freeaddrinfo(first_info);
  exit(0);
}


x86 assembly (clang, -O0):
<fonctionThread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x880,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x28(%rbp),%rdi
mov    $0x10,%esi
call   10c0 <bzero@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
lea    0xdad(%rip),%rdi
lea    0xdad(%rip),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   10f0 <getaddrinfo@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1295 <fonctionThread+0x85>
mov    -0xc(%rbp),%edi
call   1080 <gai_strerror@plt>
mov    %rax,%rsi
lea    0xd86(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
cmpq   $0x0,-0x18(%rbp)
je     12ac <fonctionThread+0x9c>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
mov    0x2d0c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   10e0 <connect@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1305 <fonctionThread+0xf5>
mov    0x2cd3(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %eax,%edi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x434(%rbp)
movslq -0x434(%rbp),%rax
movb   $0x0,-0x430(%rbp,%rax,1)
lea    -0x430(%rbp),%rsi
lea    0xcc9(%rip),%rdi
call   1070 <printf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x854(%rbp)
lea    -0x430(%rbp),%rax
mov    %rax,-0x850(%rbp)
lea    -0x430(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x854(%rbp),%edi
mov    -0x850(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    13b1 <fonctionThread+0x1a1>
mov    0x2c27(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %eax,%edi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
movl   $0x0,-0x844(%rbp)
mov    $0x1,%edi
call   1110 <sleep@plt>
mov    -0x2c(%rbp),%edi
lea    -0x840(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x844(%rbp)
movslq -0x844(%rbp),%rax
movb   $0x0,-0x840(%rbp,%rax,1)
lea    -0x840(%rbp),%rsi
lea    0xc12(%rip),%rdi
call   1070 <printf@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x864(%rbp)
lea    -0x840(%rbp),%rax
mov    %rax,-0x860(%rbp)
lea    -0x840(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x864(%rbp),%edi
mov    -0x860(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %eax,-0xc(%rbp)
mov    0x2b6a(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    -0x2c(%rbp),%edi
mov    0x2b79(%rip),%rax
mov    (%rax),%esi
mov    0x2b80(%rip),%rax
mov    (%rax),%edx
call   1040 <fcntl@plt>
cmp    $0xffffffff,%eax
jne    148f <fonctionThread+0x27f>
mov    0x2b49(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %eax,%edi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1494 <fonctionThread+0x284>
mov    -0x2c(%rbp),%edi
lea    -0x840(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x844(%rbp)
cmp    $0xffffffff,%eax
je     1545 <fonctionThread+0x335>
movslq -0x844(%rbp),%rax
movb   $0x0,-0x840(%rbp,%rax,1)
lea    -0x840(%rbp),%rsi
lea    0xb3a(%rip),%rdi
call   1070 <printf@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x874(%rbp)
lea    -0x840(%rbp),%rax
mov    %rax,-0x870(%rbp)
lea    -0x840(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x874(%rbp),%edi
mov    -0x870(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1540 <fonctionThread+0x330>
mov    0x2a98(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %eax,%edi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1494 <fonctionThread+0x284>
mov    -0x2c(%rbp),%edi
call   1090 <close@plt>
mov    -0x18(%rbp),%rdi
call   1120 <freeaddrinfo@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<fonctionThread>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x828,%rsp
mov    %rdi,%r15
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
call   10c0 <bzero@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    0x2d82(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
lea    0xdac(%rip),%rdi
lea    0xdac(%rip),%rsi
lea    0x8(%rsp),%rcx
mov    %rbx,%rdx
call   10f0 <getaddrinfo@plt>
test   %eax,%eax
jne    13f4 <fonctionThread+0x1e4>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     1282 <fonctionThread+0x72>
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    0x2d2f(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,%r14d
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   10e0 <connect@plt>
cmp    $0xffffffff,%eax
je     13d5 <fonctionThread+0x1c5>
mov    (%r15),%r15d
lea    0x420(%rsp),%rbx
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cltq
movb   $0x0,0x420(%rsp,%rax,1)
lea    0xd32(%rip),%rdi
mov    %rbx,%rsi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
je     13d5 <fonctionThread+0x1c5>
mov    $0x1,%edi
call   1110 <sleep@plt>
lea    0x20(%rsp),%rbx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cltq
movb   $0x0,0x20(%rsp,%rax,1)
lea    0xcdb(%rip),%rdi
mov    %rbx,%rsi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    0x2c67(%rip),%rax
mov    (%rax),%esi
mov    0x2c6e(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
call   1040 <fcntl@plt>
cmp    $0xffffffff,%eax
je     13d5 <fonctionThread+0x1c5>
lea    0x20(%rsp),%rbx
lea    0xc83(%rip),%rbp
nopl   (%rax)
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0xffffffff,%eax
je     1414 <fonctionThread+0x204>
cltq
movb   $0x0,0x20(%rsp,%rax,1)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
jne    1390 <fonctionThread+0x180>
mov    0x2be4(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %eax,%edi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    %eax,%edi
call   1080 <gai_strerror@plt>
lea    0xc0a(%rip),%rdi
mov    %rax,%rsi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    %r14d,%edi
call   1090 <close@plt>
mov    0x8(%rsp),%rdi
call   1120 <freeaddrinfo@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.addrinfo = type { i64, i32, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"lucien\00"
@.str.1 = [5 x i8] c"2628\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@PF_INET = global i32 0
@errno = global i32 0
@.str.3 = [3 x i8] c"%s\00"
@stdout = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define void @fonctionThread(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.addrinfo*
%6 = alloca %struct.addrinfo
%7 = alloca i32
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca i32
%11 = alloca [1024 x i8]
%12 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%13 = call i32 @bzero(%struct.addrinfo* %6, i32 16)
%14 = load i32, i32* @AF_INET
%15 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 2
store i32 %14, i32* %15
%16 = load i32, i32* @SOCK_STREAM
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 1
store i32 %16, i32* %17
%18 = call i32 @getaddrinfo(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %6, %struct.addrinfo** %5)
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %1
%22 = load i32, i32* %3
%23 = call i8* @gai_strerror(i32 %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %1
%27 = load %struct.addrinfo*, %struct.addrinfo** %5
%28 = icmp ne %struct.addrinfo* %27, null
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load %struct.addrinfo*, %struct.addrinfo** %5
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %30, i32 0, i32 0
%32 = load i64, i64* %31
%33 = inttoptr i64 %32 to %struct.sockaddr_in*
%34 = bitcast %struct.sockaddr_in* %4 to i8*
%35 = bitcast %struct.sockaddr_in* %33 to i8*
br label %36
36: ; preds = %29, %26
%37 = load i32, i32* @PF_INET
%38 = load i32, i32* @SOCK_STREAM
%39 = call i32 @socket(i32 %37, i32 %38, i32 0)
store i32 %39, i32* %7
%40 = load i32, i32* %7
%41 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%42 = call i32 @connect(i32 %40, %struct.sockaddr* %41, i32 4)
store i32 %42, i32* %3
%43 = load i32, i32* %3
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %50
45: ; preds = %36
%46 = load i32, i32* @errno
%47 = call i32 @strerror(i32 %46)
%48 = call i32 @perror(i32 %47)
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %36
%51 = load i8*, i8** %2
%52 = bitcast i8* %51 to i32*
%53 = load i32, i32* %52
store i32 %53, i32* %8
%54 = load i32, i32* %8
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%56 = call i32 @recv(i32 %54, i8* %55, i32 1023, i32 0)
store i32 %56, i32* %10
%57 = load i32, i32* %10
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %58
store i8 0, i8* %59
%60 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%61 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %60)
%62 = load i32, i32* %7
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%65 = call i32 @strlen(i8* %64)
%66 = call i32 @send(i32 %62, i8* %63, i32 %65, i32 0)
store i32 %66, i32* %3
%67 = load i32, i32* %3
%68 = icmp eq i32 %67, -1
br i1 %68, label %69, label %74
69: ; preds = %50
%70 = load i32, i32* @errno
%71 = call i32 @strerror(i32 %70)
%72 = call i32 @perror(i32 %71)
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %50
store i32 0, i32* %12
%75 = call i32 @sleep(i32 1)
%76 = load i32, i32* %7
%77 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%78 = call i32 @recv(i32 %76, i8* %77, i32 1023, i32 0)
store i32 %78, i32* %12
%79 = load i32, i32* %12
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %80
store i8 0, i8* %81
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%83 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %82)
%84 = load i32, i32* %8
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%87 = call i32 @strlen(i8* %86)
%88 = call i32 @send(i32 %84, i8* %85, i32 %87, i32 0)
store i32 %88, i32* %3
%89 = load i32, i32* @stdout
%90 = call i32 @fflush(i32 %89)
%91 = load i32, i32* %7
%92 = load i32, i32* @F_SETFL
%93 = load i32, i32* @O_NONBLOCK
%94 = call i32 @fcntl(i32 %91, i32 %92, i32 %93)
%95 = icmp eq i32 %94, -1
br i1 %95, label %96, label %101
96: ; preds = %74
%97 = load i32, i32* @errno
%98 = call i32 @strerror(i32 %97)
%99 = call i32 @perror(i32 %98)
%100 = call i32 @exit(i32 1)
unreachable
101: ; preds = %74
br label %102
102: ; preds = %125, %101
%103 = load i32, i32* %7
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%105 = call i32 @recv(i32 %103, i8* %104, i32 1023, i32 0)
store i32 %105, i32* %12
%106 = icmp ne i32 %105, -1
br i1 %106, label %107, label %126
107: ; preds = %102
%108 = load i32, i32* %12
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %109
store i8 0, i8* %110
%111 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%112 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %111)
%113 = load i32, i32* %8
%114 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%115 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%116 = call i32 @strlen(i8* %115)
%117 = call i32 @send(i32 %113, i8* %114, i32 %116, i32 0)
store i32 %117, i32* %3
%118 = load i32, i32* %3
%119 = icmp eq i32 %118, -1
br i1 %119, label %120, label %125
120: ; preds = %107
%121 = load i32, i32* @errno
%122 = call i32 @strerror(i32 %121)
%123 = call i32 @perror(i32 %122)
%124 = call i32 @exit(i32 1)
unreachable
125: ; preds = %107
br label %102
126: ; preds = %102
%127 = load i32, i32* %7
%128 = call i32 @close(i32 %127)
%129 = load %struct.addrinfo*, %struct.addrinfo** %5
%130 = call i32 @freeaddrinfo(%struct.addrinfo* %129)
%131 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.addrinfo = type { i64, i32, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"lucien\00"
@.str.1 = [5 x i8] c"2628\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@PF_INET = global i32 0
@errno = global i32 0
@.str.3 = [3 x i8] c"%s\00"
@stdout = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define void @fonctionThread(i8* nocapture %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca %struct.addrinfo*
%4 = alloca %struct.addrinfo
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = bitcast %struct.sockaddr_in* %2 to i8*
%8 = bitcast %struct.addrinfo** %3 to i8*
%9 = bitcast %struct.addrinfo* %4 to i8*
%10 = call i32 @bzero(%struct.addrinfo* %4, i32 16)
%11 = load i32, i32* @AF_INET
%12 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 2
store i32 %11, i32* %12
%13 = load i32, i32* @SOCK_STREAM
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 1
store i32 %13, i32* %14
%15 = call i32 @getaddrinfo(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %4, %struct.addrinfo** %3)
%16 = icmp eq i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %1
%18 = call i8* @gai_strerror(i32 %15)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %1
%22 = load %struct.addrinfo*, %struct.addrinfo** %3
%23 = icmp eq %struct.addrinfo* %22, null
br i1 %23, label %30, label %24
24: ; preds = %21
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %22, i64 0, i32 0
%26 = load i64, i64* %25
%27 = inttoptr i64 %26 to i32*
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%29 = load i32, i32* %27
store i32 %29, i32* %28
br label %30
30: ; preds = %24, %21
%31 = load i32, i32* @PF_INET
%32 = load i32, i32* @SOCK_STREAM
%33 = call i32 @socket(i32 %31, i32 %32, i32 0)
%34 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%35 = call i32 @connect(i32 %33, %struct.sockaddr* %34, i32 4)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %42
37: ; preds = %30
%38 = load i32, i32* @errno
%39 = call i32 @strerror(i32 %38)
%40 = call i32 @perror(i32 %39)
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %30
%43 = bitcast i8* %0 to i32*
%44 = load i32, i32* %43
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%46 = call i32 @recv(i32 %44, i8* %45, i32 1023, i32 0)
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %47
store i8 0, i8* %48
%49 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %45)
%50 = call i32 @strlen(i8* %45)
%51 = call i32 @send(i32 %33, i8* %45, i32 %50, i32 0)
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %58
53: ; preds = %42
%54 = load i32, i32* @errno
%55 = call i32 @strerror(i32 %54)
%56 = call i32 @perror(i32 %55)
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %42
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%60 = call i32 @sleep(i32 1)
%61 = call i32 @recv(i32 %33, i8* %59, i32 1023, i32 0)
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %62
store i8 0, i8* %63
%64 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %59)
%65 = call i32 @strlen(i8* %59)
%66 = call i32 @send(i32 %44, i8* %59, i32 %65, i32 0)
%67 = load i32, i32* @stdout
%68 = call i32 @fflush(i32 %67)
%69 = load i32, i32* @F_SETFL
%70 = load i32, i32* @O_NONBLOCK
%71 = call i32 @fcntl(i32 %33, i32 %69, i32 %70)
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %78
73: ; preds = %58
%74 = load i32, i32* @errno
%75 = call i32 @strerror(i32 %74)
%76 = call i32 @perror(i32 %75)
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %58, %81
%79 = call i32 @recv(i32 %33, i8* %59, i32 1023, i32 0)
%80 = icmp eq i32 %79, -1
br i1 %80, label %93, label %81
81: ; preds = %78
%82 = sext i32 %79 to i64
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %82
store i8 0, i8* %83
%84 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %59)
%85 = call i32 @strlen(i8* %59)
%86 = call i32 @send(i32 %44, i8* %59, i32 %85, i32 0)
%87 = icmp eq i32 %86, -1
br i1 %87, label %88, label %78
88: ; preds = %81
%89 = load i32, i32* @errno
%90 = call i32 @strerror(i32 %89)
%91 = call i32 @perror(i32 %90)
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %78
%94 = call i32 @close(i32 %33)
%95 = load %struct.addrinfo*, %struct.addrinfo** %3
%96 = call i32 @freeaddrinfo(%struct.addrinfo* %95)
%97 = call i32 @exit(i32 0)
unreachable
}