#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 const *);
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 const *, int /*<<< orphan*/, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
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(atoi(argv[1]));
  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);
  struct sockaddr_in adress_sock_client;
  struct in_addr addrIPV4_client;
  retour = inet_aton("194.254.199.30", &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(4202);
  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 = "194.254.199.30 ";
  retour = send(desc_sock_client, mess, strlen(mess), 0);
  if (retour == -1) {
    perror(strerror(errno));
    exit(1);
  }
  retour = send(desc_sock_client, argv[1], strlen(argv[1]), 0);
  if (retour == -1) {
    perror(strerror(errno));
    exit(1);
  }
  close(desc_sock_client);
  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);
  char *mes2 = "ACKCONFIRM\n";
  retour = send(descSock, mes2, strlen(mes2), 0);
  if (retour == -1) {
    perror(strerror(errno));
    exit(1);
  }
  close(descSock);
  close(sockServer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4d0,%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    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %rax,-0x28(%rbp)
mov    0x2d67(%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    12c0 <main+0xb0>
mov    0x2d20(%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    12f6 <main+0xe6>
mov    0x2cea(%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)
lea    0xcfc(%rip),%rdi
lea    -0x70(%rbp),%rsi
call   10a0 <inet_aton@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1332 <main+0x122>
lea    0xcee(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    0x2caf(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    $0x106a,%edi
call   1050 <htons@plt>
mov    %rax,-0x60(%rbp)
mov    -0x70(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    0x2c65(%rip),%rax
mov    (%rax),%edi
mov    0x2c6c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%edi
lea    -0x68(%rbp),%rsi
mov    $0x18,%edx
call   1110 <connect@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    13ad <main+0x19d>
mov    0x2c33(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %eax,%edi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0xc72(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    -0x74(%rbp),%eax
mov    %eax,-0x4ac(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x4a8(%rbp)
mov    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x4ac(%rbp),%edi
mov    -0x4a8(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1417 <main+0x207>
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %eax,%edi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x74(%rbp),%eax
mov    %eax,-0x4bc(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x4b8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    -0x4bc(%rbp),%edi
mov    -0x4b8(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    147e <main+0x26e>
mov    0x2b62(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %eax,%edi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x74(%rbp),%edi
call   1090 <close@plt>
mov    -0x18(%rbp),%edi
lea    -0x48(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   10e0 <accept@plt>
mov    %eax,-0x84(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    14c5 <main+0x2b5>
mov    0x2b1b(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %eax,%edi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x84(%rbp),%edi
lea    -0x490(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x494(%rbp)
movslq -0x494(%rbp),%rax
movb   $0x0,-0x490(%rbp,%rax,1)
lea    -0x490(%rbp),%rsi
lea    0xb35(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xb3a(%rip),%rax
mov    %rax,-0x4a0(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x4cc(%rbp)
mov    -0x4a0(%rbp),%rax
mov    %rax,-0x4c8(%rbp)
mov    -0x4a0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x4cc(%rbp),%edi
mov    -0x4c8(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    157e <main+0x36e>
mov    0x2a62(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %eax,%edi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x84(%rbp),%edi
call   1090 <close@plt>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
xor    %eax,%eax
add    $0x4d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x450,%rsp
mov    %rsi,%r14
mov    0x2d87(%rip),%r12
mov    (%r12),%edi
mov    0x2d8c(%rip),%rbp
mov    0x0(%rbp),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,%r15d
mov    0x2d90(%rip),%rbx
mov    (%rbx),%rax
mov    %rax,0x30(%rsp)
mov    0x8(%r14),%rdi
call   1100 <atoi@plt>
mov    %eax,%edi
call   1060 <htons@plt>
mov    %rax,0x28(%rsp)
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,0x20(%rsp)
lea    0x20(%rsp),%rsi
mov    %r15d,%edi
mov    $0x18,%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
je     13f1 <main+0x1d1>
mov    %r15d,%edi
xor    %esi,%esi
call   10c0 <listen@plt>
cmp    $0xffffffff,%eax
je     13f1 <main+0x1d1>
movl   $0x18,0x4(%rsp)
lea    0xd3c(%rip),%rdi
mov    %rsp,%rsi
call   10b0 <inet_aton@plt>
test   %eax,%eax
je     1410 <main+0x1f0>
mov    (%rbx),%rax
mov    %rax,0x18(%rsp)
mov    $0x106a,%edi
call   1060 <htons@plt>
mov    %rax,0x10(%rsp)
mov    (%rsp),%eax
mov    %eax,0x8(%rsp)
mov    (%r12),%edi
mov    0x0(%rbp),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%rsi
mov    %eax,%edi
mov    $0x18,%edx
call   1120 <connect@plt>
cmp    $0xffffffff,%eax
je     13f1 <main+0x1d1>
lea    0xcec(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
je     13f1 <main+0x1d1>
mov    0x8(%r14),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
je     13f1 <main+0x1d1>
mov    %ebp,%edi
call   10a0 <close@plt>
lea    0x38(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %r15d,%edi
call   10f0 <accept@plt>
mov    %eax,%ebp
lea    0x50(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cltq
movb   $0x0,0x50(%rsp,%rax,1)
lea    0xc7b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xc7d(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
je     13f1 <main+0x1d1>
mov    %ebp,%edi
call   10a0 <close@plt>
mov    %r15d,%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x450,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bd0(%rip),%rax
mov    (%rax),%edi
call   1130 <strerror@plt>
mov    %eax,%edi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xc27(%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 = [15 x i8] c"194.254.199.30\00"
@.str.1 = [23 x i8] c"Adresse IP non valide\0A\00"
@.str.2 = [16 x i8] c"194.254.199.30 \00"
@.str.3 = [19 x i8] c"Message recu : %s\0A\00"
@.str.4 = [12 x i8] c"ACKCONFIRM\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 %struct.sockaddr_in
%12 = alloca %struct.in_addr
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i32
%16 = alloca [1024 x i8]
%17 = alloca i32
%18 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%19 = load i32, i32* @PF_INET
%20 = load i32, i32* @SOCK_STREAM
%21 = call i32 @socket(i32 %19, i32 %20, i32 0)
store i32 %21, i32* %7
%22 = load i8*, i8** @AF_INET
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i8* %22, i8** %23
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
%28 = call i8* @htons(i32 %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
store i8* %28, i8** %29
%30 = load i32, i32* @INADDR_ANY
%31 = call i32 @htonl(i32 %30)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%33 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %32, i32 0, i32 0
store i32 %31, i32* %33
%34 = load i32, i32* %7
%35 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%36 = call i32 @bind(i32 %34, %struct.sockaddr* %35, i32 24)
store i32 %36, i32* %6
%37 = load i32, i32* %6
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %44
39: ; preds = %2
%40 = load i32, i32* @errno
%41 = call i32 @strerror(i32 %40)
%42 = call i32 @perror(i32 %41)
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %2
%45 = load i32, i32* %7
%46 = call i32 @listen(i32 %45, i32 0)
store i32 %46, i32* %6
%47 = load i32, i32* %6
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %54
49: ; preds = %44
%50 = load i32, i32* @errno
%51 = call i32 @strerror(i32 %50)
%52 = call i32 @perror(i32 %51)
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %44
store i32 24, i32* %10
%55 = call i32 @inet_aton(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.in_addr* %12)
store i32 %55, i32* %6
%56 = load i32, i32* %6
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %54
%62 = load i8*, i8** @AF_INET
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i8* %62, i8** %63
%64 = call i8* @htons(i32 4202)
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
store i8* %64, i8** %65
%66 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%67 = bitcast %struct.in_addr* %66 to i8*
%68 = bitcast %struct.in_addr* %12 to i8*
%69 = load i32, i32* @PF_INET
%70 = load i32, i32* @SOCK_STREAM
%71 = call i32 @socket(i32 %69, i32 %70, i32 0)
store i32 %71, i32* %13
%72 = load i32, i32* %13
%73 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%74 = call i32 @connect(i32 %72, %struct.sockaddr* %73, i32 24)
store i32 %74, i32* %6
%75 = load i32, i32* %6
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %82
77: ; preds = %61
%78 = load i32, i32* @errno
%79 = call i32 @strerror(i32 %78)
%80 = call i32 @perror(i32 %79)
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %61
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8** %14
%83 = load i32, i32* %13
%84 = load i8*, i8** %14
%85 = load i8*, i8** %14
%86 = call i32 @strlen(i8* %85)
%87 = call i32 @send(i32 %83, i8* %84, i32 %86, i32 0)
store i32 %87, i32* %6
%88 = load i32, i32* %6
%89 = icmp eq i32 %88, -1
br i1 %89, label %90, label %95
90: ; preds = %82
%91 = load i32, i32* @errno
%92 = call i32 @strerror(i32 %91)
%93 = call i32 @perror(i32 %92)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %82
%96 = load i32, i32* %13
%97 = load i8**, i8*** %5
%98 = getelementptr inbounds i8*, i8** %97, i64 1
%99 = load i8*, i8** %98
%100 = load i8**, i8*** %5
%101 = getelementptr inbounds i8*, i8** %100, i64 1
%102 = load i8*, i8** %101
%103 = call i32 @strlen(i8* %102)
%104 = call i32 @send(i32 %96, i8* %99, i32 %103, i32 0)
store i32 %104, i32* %6
%105 = load i32, i32* %6
%106 = icmp eq i32 %105, -1
br i1 %106, label %107, label %112
107: ; preds = %95
%108 = load i32, i32* @errno
%109 = call i32 @strerror(i32 %108)
%110 = call i32 @perror(i32 %109)
%111 = call i32 @exit(i32 1)
unreachable
112: ; preds = %95
%113 = load i32, i32* %13
%114 = call i32 @close(i32 %113)
%115 = load i32, i32* %7
%116 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%117 = call i32 @accept(i32 %115, %struct.sockaddr* %116, i32* %10)
store i32 %117, i32* %15
%118 = load i32, i32* %6
%119 = icmp eq i32 %118, -1
br i1 %119, label %120, label %125
120: ; preds = %112
%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 = %112
%126 = load i32, i32* %15
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%128 = call i32 @recv(i32 %126, i8* %127, i32 1023, i32 0)
store i32 %128, i32* %17
%129 = load i32, i32* %17
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 %130
store i8 0, i8* %131
%132 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %132)
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8** %18
%134 = load i32, i32* %15
%135 = load i8*, i8** %18
%136 = load i8*, i8** %18
%137 = call i32 @strlen(i8* %136)
%138 = call i32 @send(i32 %134, i8* %135, i32 %137, i32 0)
store i32 %138, i32* %6
%139 = load i32, i32* %6
%140 = icmp eq i32 %139, -1
br i1 %140, label %141, label %146
141: ; preds = %125
%142 = load i32, i32* @errno
%143 = call i32 @strerror(i32 %142)
%144 = call i32 @perror(i32 %143)
%145 = call i32 @exit(i32 1)
unreachable
146: ; preds = %125
%147 = load i32, i32* %15
%148 = call i32 @close(i32 %147)
%149 = load i32, i32* %7
%150 = call i32 @close(i32 %149)
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 = [15 x i8] c"194.254.199.30\00"
@.str.2 = [16 x i8] c"194.254.199.30 \00"
@.str.3 = [19 x i8] c"Message recu : %s\0A\00"
@.str.4 = [12 x i8] c"ACKCONFIRM\0A\00"
@str = [22 x i8] c"Adresse IP non valide\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.in_addr
%8 = alloca [1024 x i8]
%9 = load i32, i32* @PF_INET
%10 = load i32, i32* @SOCK_STREAM
%11 = tail call i32 @socket(i32 %9, i32 %10, i32 0)
%12 = bitcast %struct.sockaddr_in* %3 to i8*
%13 = load i8*, i8** @AF_INET
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i8* %13, i8** %14
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = tail call i8* @htons(i32 %17)
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i8* %18, i8** %19
%20 = load i32, i32* @INADDR_ANY
%21 = tail call i32 @htonl(i32 %20)
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %21, i32* %22
%23 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%24 = call i32 @bind(i32 %11, %struct.sockaddr* %23, i32 24)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %31
26: ; preds = %2
%27 = load i32, i32* @errno
%28 = call i32 @strerror(i32 %27)
%29 = call i32 @perror(i32 %28)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %2
%32 = call i32 @listen(i32 %11, i32 0)
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = load i32, i32* @errno
%36 = call i32 @strerror(i32 %35)
%37 = call i32 @perror(i32 %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %31
%40 = bitcast %struct.sockaddr_in* %4 to i8*
%41 = bitcast i32* %5 to i8*
store i32 24, i32* %5
%42 = bitcast %struct.sockaddr_in* %6 to i8*
%43 = bitcast %struct.in_addr* %7 to i8*
%44 = call i32 @inet_aton(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.in_addr* %7)
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %39
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %39
%50 = load i8*, i8** @AF_INET
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 2
store i8* %50, i8** %51
%52 = call i8* @htons(i32 4202)
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 1
store i8* %52, i8** %53
%54 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %7, i64 0, i32 0
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 0, i32 0
%56 = load i32, i32* %54
store i32 %56, i32* %55
%57 = load i32, i32* @PF_INET
%58 = load i32, i32* @SOCK_STREAM
%59 = call i32 @socket(i32 %57, i32 %58, i32 0)
%60 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%61 = call i32 @connect(i32 %59, %struct.sockaddr* %60, i32 24)
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %68
63: ; preds = %49
%64 = load i32, i32* @errno
%65 = call i32 @strerror(i32 %64)
%66 = call i32 @perror(i32 %65)
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %49
%69 = call i32 @strlen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%70 = call i32 @send(i32 %59, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %69, i32 0)
%71 = icmp eq i32 %70, -1
br i1 %71, label %72, label %77
72: ; preds = %68
%73 = load i32, i32* @errno
%74 = call i32 @strerror(i32 %73)
%75 = call i32 @perror(i32 %74)
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %68
%78 = load i8*, i8** %15
%79 = call i32 @strlen(i8* %78)
%80 = call i32 @send(i32 %59, i8* %78, i32 %79, i32 0)
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %87
82: ; preds = %77
%83 = load i32, i32* @errno
%84 = call i32 @strerror(i32 %83)
%85 = call i32 @perror(i32 %84)
%86 = call i32 @exit(i32 1)
unreachable
87: ; preds = %77
%88 = call i32 @close(i32 %59)
%89 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%90 = call i32 @accept(i32 %11, %struct.sockaddr* %89, i32* %5)
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%92 = call i32 @recv(i32 %90, i8* %91, i32 1023, i32 0)
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %93
store i8 0, i8* %94
%95 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %91)
%96 = call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%97 = call i32 @send(i32 %90, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %96, i32 0)
%98 = icmp eq i32 %97, -1
br i1 %98, label %99, label %104
99: ; preds = %87
%100 = load i32, i32* @errno
%101 = call i32 @strerror(i32 %100)
%102 = call i32 @perror(i32 %101)
%103 = call i32 @exit(i32 1)
unreachable
104: ; preds = %87
%105 = call i32 @close(i32 %90)
%106 = call i32 @close(i32 %11)
ret i32 0
}