#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 in_addr {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  struct in_addr sin_addr;
  void *sin_port;
  void *sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ caller;

/* Variables and functions */
void *AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
void *htons(int);
int inet_aton(char *, struct in_addr *);
int listen(int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char const *argv[]) {
  int retour = 0;
  int sockServer = socket(PF_INET, SOCK_STREAM, 0);
  struct sockaddr_in address_sock;
  address_sock.sin_family = AF_INET;
  address_sock.sin_port = htons(4202);
  address_sock.sin_addr.s_addr = htonl(INADDR_ANY);
  retour = bind(sockServer, (struct sockaddr *)&address_sock,
                sizeof(struct sockaddr_in));
  if (retour == -1) {
    perror(strerror(errno));
    exit(1);
  }
  retour = listen(sockServer, 0);
  if (retour == -1) {
    perror(strerror(errno));
    exit(1);
  }
  struct sockaddr_in caller;
  socklen_t size = sizeof(caller);
  int descSock = accept(sockServer, (struct sockaddr *)&caller, &size);
  if (retour == -1) {
    perror(strerror(errno));
    exit(1);
  }
  char buff[1024];
  int recu = recv(descSock, buff, 1023 * sizeof(char), 0);
  buff[recu] = '\0';
  printf("Message recu : %s\n", buff);
  int i = 0;
  char ip[1024];
  while (buff[i] != ' ') {
    ip[i] = buff[i];
    i++;
  }
  ip[i] = 0;
  close(descSock);
  close(sockServer);
  struct sockaddr_in adress_sock_client;
  struct in_addr addrIPV4_client;
  retour = inet_aton(ip, &addrIPV4_client);
  if (retour == 0) {
    printf("Adresse IP non valide\n");
    exit(1);
  }
  adress_sock_client.sin_family = AF_INET;
  adress_sock_client.sin_port = htons(atoi(buff + i));
  adress_sock_client.sin_addr = addrIPV4_client;
  int desc_sock_client = socket(PF_INET, SOCK_STREAM, 0);
  retour = connect(desc_sock_client, (struct sockaddr *)&adress_sock_client,
                   sizeof(struct sockaddr_in));
  if (retour == -1) {
    perror(strerror(errno));
    exit(1);
  }
  char *mess = "CONFIRM\n";
  retour = send(desc_sock_client, mess, strlen(mess), 0);
  if (retour == -1) {
    perror(strerror(errno));
    exit(1);
  }
  recu = recv(desc_sock_client, buff, 1023 * sizeof(char), 0);
  buff[recu] = '\0';
  printf("Message recu : %s\n", buff);
  close(desc_sock_client);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
mov    0x2d90(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x18(%rbp)
mov    0x2d95(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x106a,%edi
call   1050 <htons@plt>
mov    %rax,-0x28(%rbp)
mov    0x2d71(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x18,%edx
call   10c0 <bind@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    12b6 <main+0xa6>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %eax,%edi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%edi
xor    %esi,%esi
call   10b0 <listen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    12ec <main+0xdc>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %eax,%edi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
movl   $0x18,-0x4c(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x48(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   10e0 <accept@plt>
mov    %eax,-0x50(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    132f <main+0x11f>
mov    0x2cb1(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %eax,%edi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x50(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x454(%rbp)
movslq -0x454(%rbp),%rax
movb   $0x0,-0x450(%rbp,%rax,1)
lea    -0x450(%rbp),%rsi
lea    0xc98(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x458(%rbp)
movslq -0x458(%rbp),%rax
movsbl -0x450(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
je     13c1 <main+0x1b1>
movslq -0x458(%rbp),%rax
mov    -0x450(%rbp,%rax,1),%cl
movslq -0x458(%rbp),%rax
mov    %cl,-0x860(%rbp,%rax,1)
mov    -0x458(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x458(%rbp)
jmp    1379 <main+0x169>
movslq -0x458(%rbp),%rax
movb   $0x0,-0x860(%rbp,%rax,1)
mov    -0x50(%rbp),%edi
call   1090 <close@plt>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
lea    -0x860(%rbp),%rdi
lea    -0x880(%rbp),%rsi
call   10a0 <inet_aton@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1418 <main+0x208>
lea    0xc0c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    0x2bc9(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x868(%rbp)
lea    -0x450(%rbp),%rdi
movslq -0x458(%rbp),%rax
add    %rax,%rdi
call   10f0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %rax,-0x870(%rbp)
mov    -0x880(%rbp),%eax
mov    %eax,-0x878(%rbp)
mov    0x2b60(%rip),%rax
mov    (%rax),%edi
mov    0x2b67(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x884(%rbp)
mov    -0x884(%rbp),%edi
lea    -0x878(%rbp),%rsi
mov    $0x18,%edx
call   1110 <connect@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    14bb <main+0x2ab>
mov    0x2b25(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %eax,%edi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0xb68(%rip),%rax
mov    %rax,-0x890(%rbp)
mov    -0x884(%rbp),%eax
mov    %eax,-0x89c(%rbp)
mov    -0x890(%rbp),%rax
mov    %rax,-0x898(%rbp)
mov    -0x890(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x89c(%rbp),%edi
mov    -0x898(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1531 <main+0x321>
mov    0x2aaf(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %eax,%edi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x884(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x454(%rbp)
movslq -0x454(%rbp),%rax
movb   $0x0,-0x450(%rbp,%rax,1)
lea    -0x450(%rbp),%rsi
lea    0xa93(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x884(%rbp),%edi
call   1090 <close@plt>
xor    %eax,%eax
add    $0x8a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x858,%rsp
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
mov    0x2d8f(%rip),%r12
mov    (%r12),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,%r14d
mov    0x2d92(%rip),%r13
mov    0x0(%r13),%rax
mov    %rax,0x30(%rsp)
mov    $0x106a,%edi
call   1060 <htons@plt>
mov    %rax,0x28(%rsp)
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,0x20(%rsp)
lea    0x20(%rsp),%rsi
mov    %r14d,%edi
mov    $0x18,%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
je     1417 <main+0x1f7>
mov    %r14d,%edi
xor    %esi,%esi
call   10c0 <listen@plt>
cmp    $0xffffffff,%eax
je     1417 <main+0x1f7>
movl   $0x18,0x4(%rsp)
lea    0x38(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %r14d,%edi
call   10f0 <accept@plt>
mov    %eax,%ebp
lea    0x50(%rsp),%rbx
xor    %r15d,%r15d
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cltq
movb   $0x0,0x50(%rsp,%rax,1)
lea    0xd0f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x50(%rsp),%al
cmp    $0x20,%al
je     1327 <main+0x107>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %al,0x450(%rsp,%rcx,1)
movzbl 0x51(%rsp,%rcx,1),%eax
add    $0x1,%rcx
cmp    $0x20,%al
jne    1310 <main+0xf0>
mov    %ecx,%r15d
movb   $0x0,0x450(%rsp,%r15,1)
mov    %ebp,%edi
call   10a0 <close@plt>
mov    %r14d,%edi
call   10a0 <close@plt>
lea    0x450(%rsp),%rdi
mov    %rsp,%rsi
call   10b0 <inet_aton@plt>
test   %eax,%eax
je     1436 <main+0x216>
lea    (%rsp,%r15,1),%rdi
add    $0x50,%rdi
mov    0x0(%r13),%rax
mov    %rax,0x18(%rsp)
call   1100 <atoi@plt>
mov    %eax,%edi
call   1060 <htons@plt>
mov    %rax,0x10(%rsp)
mov    (%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x2c39(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rsi
mov    %eax,%edi
mov    $0x18,%edx
call   1120 <connect@plt>
cmp    $0xffffffff,%eax
je     1417 <main+0x1f7>
lea    0xc60(%rip),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
je     1417 <main+0x1f7>
lea    0x50(%rsp),%rbp
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cltq
movb   $0x0,0x50(%rsp,%rax,1)
lea    0xc0e(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %ebx,%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x858,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2baa(%rip),%rax
mov    (%rax),%edi
call   1130 <strerror@plt>
mov    %eax,%edi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xbdf(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.in_addr, i8*, i8* }
%struct.in_addr = type { i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET = global i8* null
@INADDR_ANY = global i32 0
@errno = global i32 0
@.str = [19 x i8] c"Message recu : %s\0A\00"
@.str.1 = [23 x i8] c"Adresse IP non valide\0A\00"
@.str.2 = [9 x i8] c"CONFIRM\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
%9 = alloca %struct.sockaddr_in
%10 = alloca i32
%11 = alloca i32
%12 = alloca [1024 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca [1024 x i8]
%16 = alloca %struct.sockaddr_in
%17 = alloca %struct.in_addr
%18 = alloca i32
%19 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%20 = load i32, i32* @PF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = call i32 @socket(i32 %20, i32 %21, i32 0)
store i32 %22, i32* %7
%23 = load i8*, i8** @AF_INET
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i8* %23, i8** %24
%25 = call i8* @htons(i32 4202)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
store i8* %25, i8** %26
%27 = load i32, i32* @INADDR_ANY
%28 = call i32 @htonl(i32 %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%30 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %29, i32 0, i32 0
store i32 %28, i32* %30
%31 = load i32, i32* %7
%32 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%33 = call i32 @bind(i32 %31, %struct.sockaddr* %32, i32 24)
store i32 %33, i32* %6
%34 = load i32, i32* %6
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %41
36: ; preds = %2
%37 = load i32, i32* @errno
%38 = call i32 @strerror(i32 %37)
%39 = call i32 @perror(i32 %38)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %2
%42 = load i32, i32* %7
%43 = call i32 @listen(i32 %42, i32 0)
store i32 %43, i32* %6
%44 = load i32, i32* %6
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %51
46: ; preds = %41
%47 = load i32, i32* @errno
%48 = call i32 @strerror(i32 %47)
%49 = call i32 @perror(i32 %48)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %41
store i32 24, i32* %10
%52 = load i32, i32* %7
%53 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%54 = call i32 @accept(i32 %52, %struct.sockaddr* %53, i32* %10)
store i32 %54, i32* %11
%55 = load i32, i32* %6
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %62
57: ; preds = %51
%58 = load i32, i32* @errno
%59 = call i32 @strerror(i32 %58)
%60 = call i32 @perror(i32 %59)
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %51
%63 = load i32, i32* %11
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%65 = call i32 @recv(i32 %63, i8* %64, i32 1023, i32 0)
store i32 %65, i32* %13
%66 = load i32, i32* %13
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %67
store i8 0, i8* %68
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %69)
store i32 0, i32* %14
br label %71
71: ; preds = %78, %62
%72 = load i32, i32* %14
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp ne i32 %76, 32
br i1 %77, label %78, label %88
78: ; preds = %71
%79 = load i32, i32* %14
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %80
%82 = load i8, i8* %81
%83 = load i32, i32* %14
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 %84
store i8 %82, i8* %85
%86 = load i32, i32* %14
%87 = add nsw i32 %86, 1
store i32 %87, i32* %14
br label %71
88: ; preds = %71
%89 = load i32, i32* %14
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 %90
store i8 0, i8* %91
%92 = load i32, i32* %11
%93 = call i32 @close(i32 %92)
%94 = load i32, i32* %7
%95 = call i32 @close(i32 %94)
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%97 = call i32 @inet_aton(i8* %96, %struct.in_addr* %17)
store i32 %97, i32* %6
%98 = load i32, i32* %6
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %88
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%102 = call i32 @exit(i32 1)
unreachable
103: ; preds = %88
%104 = load i8*, i8** @AF_INET
%105 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %16, i32 0, i32 2
store i8* %104, i8** %105
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%107 = load i32, i32* %14
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8, i8* %106, i64 %108
%110 = call i32 @atoi(i8* %109)
%111 = call i8* @htons(i32 %110)
%112 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %16, i32 0, i32 1
store i8* %111, i8** %112
%113 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %16, i32 0, i32 0
%114 = bitcast %struct.in_addr* %113 to i8*
%115 = bitcast %struct.in_addr* %17 to i8*
%116 = load i32, i32* @PF_INET
%117 = load i32, i32* @SOCK_STREAM
%118 = call i32 @socket(i32 %116, i32 %117, i32 0)
store i32 %118, i32* %18
%119 = load i32, i32* %18
%120 = bitcast %struct.sockaddr_in* %16 to %struct.sockaddr*
%121 = call i32 @connect(i32 %119, %struct.sockaddr* %120, i32 24)
store i32 %121, i32* %6
%122 = load i32, i32* %6
%123 = icmp eq i32 %122, -1
br i1 %123, label %124, label %129
124: ; preds = %103
%125 = load i32, i32* @errno
%126 = call i32 @strerror(i32 %125)
%127 = call i32 @perror(i32 %126)
%128 = call i32 @exit(i32 1)
unreachable
129: ; preds = %103
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %19
%130 = load i32, i32* %18
%131 = load i8*, i8** %19
%132 = load i8*, i8** %19
%133 = call i32 @strlen(i8* %132)
%134 = call i32 @send(i32 %130, i8* %131, i32 %133, i32 0)
store i32 %134, i32* %6
%135 = load i32, i32* %6
%136 = icmp eq i32 %135, -1
br i1 %136, label %137, label %142
137: ; preds = %129
%138 = load i32, i32* @errno
%139 = call i32 @strerror(i32 %138)
%140 = call i32 @perror(i32 %139)
%141 = call i32 @exit(i32 1)
unreachable
142: ; preds = %129
%143 = load i32, i32* %18
%144 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%145 = call i32 @recv(i32 %143, i8* %144, i32 1023, i32 0)
store i32 %145, i32* %13
%146 = load i32, i32* %13
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %147
store i8 0, i8* %148
%149 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %149)
%151 = load i32, i32* %18
%152 = call i32 @close(i32 %151)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.in_addr, i8*, i8* }
%struct.in_addr = type { i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET = global i8* null
@INADDR_ANY = global i32 0
@errno = global i32 0
@.str = [19 x i8] c"Message recu : %s\0A\00"
@.str.2 = [9 x i8] c"CONFIRM\0A\00"
@str = [22 x i8] c"Adresse IP non valide\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca %struct.sockaddr_in
%9 = alloca %struct.in_addr
%10 = load i32, i32* @PF_INET
%11 = load i32, i32* @SOCK_STREAM
%12 = tail call i32 @socket(i32 %10, i32 %11, i32 0)
%13 = bitcast %struct.sockaddr_in* %3 to i8*
%14 = load i8*, i8** @AF_INET
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i8* %14, i8** %15
%16 = tail call i8* @htons(i32 4202)
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i8* %16, i8** %17
%18 = load i32, i32* @INADDR_ANY
%19 = tail call i32 @htonl(i32 %18)
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %19, i32* %20
%21 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%22 = call i32 @bind(i32 %12, %struct.sockaddr* %21, i32 24)
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %29
24: ; preds = %2
%25 = load i32, i32* @errno
%26 = call i32 @strerror(i32 %25)
%27 = call i32 @perror(i32 %26)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %2
%30 = call i32 @listen(i32 %12, i32 0)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load i32, i32* @errno
%34 = call i32 @strerror(i32 %33)
%35 = call i32 @perror(i32 %34)
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %29
%38 = bitcast %struct.sockaddr_in* %4 to i8*
%39 = bitcast i32* %5 to i8*
store i32 24, i32* %5
%40 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%41 = call i32 @accept(i32 %12, %struct.sockaddr* %40, i32* %5)
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%43 = call i32 @recv(i32 %41, i8* %42, i32 1023, i32 0)
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %44
store i8 0, i8* %45
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %42)
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%48 = load i8, i8* %42
%49 = icmp eq i8 %48, 32
br i1 %49, label %60, label %50
50: ; preds = %37, %50
%51 = phi i64 [ %54, %50 ], [ 0, %37 ]
%52 = phi i8 [ %56, %50 ], [ %48, %37 ]
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %51
store i8 %52, i8* %53
%54 = add nuw nsw i64 %51, 1
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = icmp eq i8 %56, 32
br i1 %57, label %58, label %50
58: ; preds = %50
%59 = and i64 %54, 4294967295
br label %60
60: ; preds = %58, %37
%61 = phi i64 [ 0, %37 ], [ %59, %58 ]
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %61
store i8 0, i8* %62
%63 = call i32 @close(i32 %41)
%64 = call i32 @close(i32 %12)
%65 = bitcast %struct.sockaddr_in* %8 to i8*
%66 = bitcast %struct.in_addr* %9 to i8*
%67 = call i32 @inet_aton(i8* %47, %struct.in_addr* %9)
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %60
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %60
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %61
%74 = load i8*, i8** @AF_INET
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 2
store i8* %74, i8** %75
%76 = call i32 @atoi(i8* %73)
%77 = call i8* @htons(i32 %76)
%78 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 1
store i8* %77, i8** %78
%79 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %9, i64 0, i32 0
%80 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 0, i32 0
%81 = load i32, i32* %79
store i32 %81, i32* %80
%82 = load i32, i32* @PF_INET
%83 = load i32, i32* @SOCK_STREAM
%84 = call i32 @socket(i32 %82, i32 %83, i32 0)
%85 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%86 = call i32 @connect(i32 %84, %struct.sockaddr* %85, i32 24)
%87 = icmp eq i32 %86, -1
br i1 %87, label %88, label %93
88: ; preds = %72
%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 = %72
%94 = call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%95 = call i32 @send(i32 %84, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %94, i32 0)
%96 = icmp eq i32 %95, -1
br i1 %96, label %97, label %102
97: ; preds = %93
%98 = load i32, i32* @errno
%99 = call i32 @strerror(i32 %98)
%100 = call i32 @perror(i32 %99)
%101 = call i32 @exit(i32 1)
unreachable
102: ; preds = %93
%103 = call i32 @recv(i32 %84, i8* %42, i32 1023, i32 0)
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %104
store i8 0, i8* %105
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %42)
%107 = call i32 @close(i32 %84)
ret i32 0
}