#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_zero;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ authentif(char *, char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ get(int);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
int listen(int, int);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, char, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ put(int);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int main(void) {
  int x, sockfd, new_fd;
  int numbytes;
  char buf[200];
  struct sockaddr_in my_addr;
  struct sockaddr_in their_addr;
  int sin_size;
  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    perror("socket");
    exit(1);
  }
  my_addr.sin_family = AF_INET;
  my_addr.sin_port = htons(3490);
  my_addr.sin_addr.s_addr = INADDR_ANY;
  memset(&(my_addr.sin_zero), '\0', 8);
  if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) ==
      -1) {
    perror("bind");
    exit(1);
  }
  if (listen(sockfd, 10) == -1) {
    perror("listen");
    exit(1);
  }
  while (1) {
    sin_size = sizeof(struct sockaddr_in);
    if ((new_fd = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size)) ==
        -1) {
      perror("accept");
      continue;
    }
    if (fork() == 0) {
      char log[45], pass[45];
      if ((numbytes = recv(new_fd, log, 200, 0)) == -1) {
        perror("recv");
        exit(1);
      }
      if ((numbytes = recv(new_fd, pass, 200, 0)) == -1) {
        perror("recv");
        exit(1);
      }
      char ath[4];
      strcpy(ath, authentif(log, pass));
      send(new_fd, ath, 10, 0);
      if (strcmp(ath, "okb") == 0)
        goto fin;
    deb:
      printf("je suis en attente d'une opération\n");
      if ((numbytes = recv(new_fd, buf, 200, 0)) == -1) {
        perror("operation");
        exit(1);
      }
      printf("il s'agit de l'opération %s\n", buf);
      if (strcmp(buf, "bye") == 0)
        goto fin;
      if (strcmp(buf, "get") == 0)
        get(new_fd);
      else if (strcmp(buf, "put") == 0)
        put(new_fd);
      else if (strcmp(buf, "mget") == 0)
        get(new_fd);
      else if (strcmp(buf, "mput") == 0)
        put(new_fd);
      goto deb;
    fin:
      printf("server: got connection from %s\n",
             inet_ntoa(their_addr.sin_addr));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
mov    0x2d8e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    126d <main+0x4d>
lea    0xda2(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    0x2d74(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xe4(%rbp)
mov    $0xda2,%edi
call   1070 <htons@plt>
mov    %eax,-0xe8(%rbp)
mov    0x2d4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xf0(%rbp)
lea    -0xf0(%rbp),%rdi
add    $0x4,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10a0 <memset@plt>
mov    -0xc(%rbp),%edi
lea    -0xf0(%rbp),%rsi
mov    $0x4,%edx
call   10f0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12e5 <main+0xc5>
lea    0xd31(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0xc(%rbp),%edi
mov    $0xa,%esi
call   10d0 <listen@plt>
cmp    $0xffffffff,%eax
jne    1311 <main+0xf1>
lea    0xd0a(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
jmp    1316 <main+0xf6>
movl   $0x10,-0x104(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x100(%rbp),%rsi
lea    -0x104(%rbp),%rdx
call   1110 <accept@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xffffffff,%eax
jne    1353 <main+0x133>
lea    0xcca(%rip),%rdi
call   1100 <perror@plt>
jmp    1316 <main+0xf6>
mov    $0x0,%al
call   1130 <fork@plt>
cmp    $0x0,%rax
jne    1590 <main+0x370>
mov    -0x10(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0xc8,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    139c <main+0x17c>
lea    0xc8d(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x10(%rbp),%edi
lea    -0x170(%rbp),%rsi
mov    $0xc8,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    13d4 <main+0x1b4>
lea    0xc55(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x174(%rbp),%rax
mov    %rax,-0x180(%rbp)
lea    -0x140(%rbp),%rdi
lea    -0x170(%rbp),%rsi
call   10c0 <authentif@plt>
mov    -0x180(%rbp),%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%edi
lea    -0x174(%rbp),%rsi
mov    $0xa,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
lea    -0x174(%rbp),%rdi
lea    0xbf8(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    143b <main+0x21b>
jmp    1574 <main+0x354>
jmp    1440 <main+0x220>
lea    0xbdc(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%edi
lea    -0xe0(%rbp),%rsi
mov    $0xc8,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1486 <main+0x266>
lea    0xbd1(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0xe0(%rbp),%rsi
lea    0xbbe(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0xe0(%rbp),%rdi
lea    0xbc7(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    14bd <main+0x29d>
jmp    1574 <main+0x354>
lea    -0xe0(%rbp),%rdi
lea    0xbaa(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    14e7 <main+0x2c7>
mov    -0x10(%rbp),%edi
call   10e0 <get@plt>
jmp    156f <main+0x34f>
lea    -0xe0(%rbp),%rdi
lea    0xb85(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1511 <main+0x2f1>
mov    -0x10(%rbp),%edi
call   1060 <put@plt>
jmp    156a <main+0x34a>
lea    -0xe0(%rbp),%rdi
lea    0xb55(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    153b <main+0x31b>
mov    -0x10(%rbp),%edi
call   10e0 <get@plt>
jmp    1565 <main+0x345>
lea    -0xe0(%rbp),%rdi
lea    0xb30(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1560 <main+0x340>
mov    -0x10(%rbp),%edi
call   1060 <put@plt>
jmp    1565 <main+0x345>
jmp    156a <main+0x34a>
jmp    156f <main+0x34f>
jmp    1440 <main+0x220>
mov    -0x100(%rbp),%edi
call   1050 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xaf5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1316 <main+0xf6>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
mov    0x2da0(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d7f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
cmp    $0xffffffff,%eax
jne    126b <main+0x3b>
lea    0xd9a(%rip),%rdi
jmp    14b2 <main+0x282>
mov    %eax,%ebp
mov    (%rbx),%eax
mov    %eax,0x14(%rsp)
mov    $0xda2,%edi
call   1080 <htons@plt>
mov    %eax,0x10(%rsp)
mov    0x2d58(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
lea    0xc(%rsp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10b0 <memset@plt>
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
mov    $0x4,%edx
call   1100 <bind@plt>
cmp    $0xffffffff,%eax
jne    12c1 <main+0x91>
lea    0xd4b(%rip),%rdi
jmp    14b2 <main+0x282>
mov    %ebp,%edi
mov    $0xa,%esi
call   10e0 <listen@plt>
cmp    $0xffffffff,%eax
jne    12de <main+0xae>
lea    0xd33(%rip),%rdi
jmp    14b2 <main+0x282>
mov    %ebp,(%rsp)
lea    0xd91(%rip),%r13
lea    0x90(%rsp),%rbp
lea    0xd36(%rip),%r14
lea    0xd52(%rip),%r12
jmp    131a <main+0xea>
mov    0x20(%rsp),%edi
call   1060 <inet_ntoa@plt>
lea    0xd49(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
movl   $0x10,0x4(%rsp)
mov    (%rsp),%edi
lea    0x20(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1120 <accept@plt>
cmp    $0xffffffff,%eax
je     149a <main+0x26a>
mov    %eax,%ebx
xor    %eax,%eax
call   1140 <fork@plt>
test   %rax,%rax
jne    131a <main+0xea>
mov    %ebx,%edi
lea    0x30(%rsp),%rsi
mov    $0xc8,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0xffffffff,%eax
je     14c1 <main+0x291>
mov    %r14,%r15
mov    %r13,%r14
mov    %r12,%r13
mov    %ebx,%edi
lea    0x60(%rsp),%r12
mov    %r12,%rsi
mov    $0xc8,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0xffffffff,%eax
je     14c1 <main+0x291>
lea    0x30(%rsp),%rdi
mov    %r12,%rsi
call   10d0 <authentif@plt>
lea    0x1c(%rsp),%r12
mov    %r12,%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    $0xa,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
mov    %r12,%rdi
lea    0xc59(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
mov    %r13,%r12
mov    %r14,%r13
mov    %r15,%r14
lea    0xc6d(%rip),%r15
jne    13f7 <main+0x1c7>
jmp    1300 <main+0xd0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   10f0 <get@plt>
mov    %r13,%rdi
call   1050 <puts@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0xc8,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0xffffffff,%eax
je     14ab <main+0x27b>
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1300 <main+0xd0>
mov    %rbp,%rdi
mov    %r12,%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     13f0 <main+0x1c0>
mov    %rbp,%rdi
lea    0xc01(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     148e <main+0x25e>
mov    %rbp,%rdi
lea    0xbe7(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     13f0 <main+0x1c0>
mov    %rbp,%rdi
lea    0xbd4(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    13f7 <main+0x1c7>
mov    %ebx,%edi
call   1070 <put@plt>
jmp    13f7 <main+0x1c7>
lea    0xb72(%rip),%rdi
call   1110 <perror@plt>
jmp    131a <main+0xea>
lea    0xb71(%rip),%rdi
call   1110 <perror@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
lea    0xb52(%rip),%rdi
jmp    14b2 <main+0x282>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"socket\00"
@INADDR_ANY = global i32 0
@.str.1 = [5 x i8] c"bind\00"
@.str.2 = [7 x i8] c"listen\00"
@.str.3 = [7 x i8] c"accept\00"
@.str.4 = [5 x i8] c"recv\00"
@.str.5 = [4 x i8] c"okb\00"
@.str.6 = [37 x i8] c"je suis en attente d'une op\C3\A9ration\0A\00"
@.str.7 = [10 x i8] c"operation\00"
@.str.8 = [30 x i8] c"il s'agit de l'op\C3\A9ration %s\0A\00"
@.str.9 = [4 x i8] c"bye\00"
@.str.10 = [4 x i8] c"get\00"
@.str.11 = [4 x i8] c"put\00"
@.str.12 = [5 x i8] c"mget\00"
@.str.13 = [5 x i8] c"mput\00"
@.str.14 = [32 x i8] c"server: got connection from %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [200 x i8]
%7 = alloca %struct.sockaddr_in
%8 = alloca %struct.sockaddr_in
%9 = alloca i32
%10 = alloca [45 x i8]
%11 = alloca [45 x i8]
%12 = alloca [4 x i8]
store i32 0, i32* %1
%13 = load i32, i32* @AF_INET
%14 = load i32, i32* @SOCK_STREAM
%15 = call i32 @socket(i32 %13, i32 %14, i32 0)
store i32 %15, i32* %3
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %20
17: ; preds = %0
%18 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %0
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 3
store i32 %21, i32* %22
%23 = call i32 @htons(i32 3490)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %23, i32* %24
%25 = load i32, i32* @INADDR_ANY
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%27 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %26, i32 0, i32 0
store i32 %25, i32* %27
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
%29 = call i32 @memset(i32* %28, i8 signext 0, i32 8)
%30 = load i32, i32* %3
%31 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%32 = call i32 @bind(i32 %30, %struct.sockaddr* %31, i32 4)
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %37
34: ; preds = %20
%35 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %20
%38 = load i32, i32* %3
%39 = call i32 @listen(i32 %38, i32 10)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %37
br label %45
45: ; preds = %44, %50, %139
store i32 16, i32* %9
%46 = load i32, i32* %3
%47 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%48 = call i32 @accept(i32 %46, %struct.sockaddr* %47, i32* %9)
store i32 %48, i32* %4
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %52
50: ; preds = %45
%51 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %45
52: ; preds = %45
%53 = call i64 (...) @fork()
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %139
55: ; preds = %52
%56 = load i32, i32* %4
%57 = getelementptr inbounds [45 x i8], [45 x i8]* %10, i64 0, i64 0
%58 = call i32 @recv(i32 %56, i8* %57, i32 200, i32 0)
store i32 %58, i32* %5
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %63
60: ; preds = %55
%61 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %55
%64 = load i32, i32* %4
%65 = getelementptr inbounds [45 x i8], [45 x i8]* %11, i64 0, i64 0
%66 = call i32 @recv(i32 %64, i8* %65, i32 200, i32 0)
store i32 %66, i32* %5
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %71
68: ; preds = %63
%69 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %63
%72 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%73 = getelementptr inbounds [45 x i8], [45 x i8]* %10, i64 0, i64 0
%74 = getelementptr inbounds [45 x i8], [45 x i8]* %11, i64 0, i64 0
%75 = call i32 @authentif(i8* %73, i8* %74)
%76 = call i32 @strcpy(i8* %72, i32 %75)
%77 = load i32, i32* %4
%78 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%79 = call i32 @send(i32 %77, i8* %78, i32 10, i32 0)
%80 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%81 = call i64 @strcmp(i8* %80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %84
83: ; preds = %71
br label %133
84: ; preds = %71
br label %85
85: ; preds = %132, %84
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%87 = load i32, i32* %4
%88 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%89 = call i32 @recv(i32 %87, i8* %88, i32 200, i32 0)
store i32 %89, i32* %5
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %94
91: ; preds = %85
%92 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%93 = call i32 @exit(i32 1)
unreachable
94: ; preds = %85
%95 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %95)
%97 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%98 = call i64 @strcmp(i8* %97, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%99 = icmp eq i64 %98, 0
br i1 %99, label %100, label %101
100: ; preds = %94
br label %133
101: ; preds = %94
%102 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%103 = call i64 @strcmp(i8* %102, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %108
105: ; preds = %101
%106 = load i32, i32* %4
%107 = call i32 @get(i32 %106)
br label %132
108: ; preds = %101
%109 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%110 = call i64 @strcmp(i8* %109, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%111 = icmp eq i64 %110, 0
br i1 %111, label %112, label %115
112: ; preds = %108
%113 = load i32, i32* %4
%114 = call i32 @put(i32 %113)
br label %131
115: ; preds = %108
%116 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%117 = call i64 @strcmp(i8* %116, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %122
119: ; preds = %115
%120 = load i32, i32* %4
%121 = call i32 @get(i32 %120)
br label %130
122: ; preds = %115
%123 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%124 = call i64 @strcmp(i8* %123, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%125 = icmp eq i64 %124, 0
br i1 %125, label %126, label %129
126: ; preds = %122
%127 = load i32, i32* %4
%128 = call i32 @put(i32 %127)
br label %129
129: ; preds = %126, %122
br label %130
130: ; preds = %129, %119
br label %131
131: ; preds = %130, %112
br label %132
132: ; preds = %131, %105
br label %85
133: ; preds = %100, %83
%134 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%135 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %134, i32 0, i32 0
%136 = load i32, i32* %135
%137 = call i8* @inet_ntoa(i32 %136)
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0), i8* %137)
br label %139
139: ; preds = %133, %52
br label %45
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"socket\00"
@INADDR_ANY = global i32 0
@.str.1 = [5 x i8] c"bind\00"
@.str.2 = [7 x i8] c"listen\00"
@.str.3 = [7 x i8] c"accept\00"
@.str.4 = [5 x i8] c"recv\00"
@.str.5 = [4 x i8] c"okb\00"
@.str.7 = [10 x i8] c"operation\00"
@.str.8 = [30 x i8] c"il s'agit de l'op\C3\A9ration %s\0A\00"
@.str.9 = [4 x i8] c"bye\00"
@.str.10 = [4 x i8] c"get\00"
@.str.11 = [4 x i8] c"put\00"
@.str.12 = [5 x i8] c"mget\00"
@.str.13 = [5 x i8] c"mput\00"
@.str.14 = [32 x i8] c"server: got connection from %s\0A\00"
@str = [36 x i8] c"je suis en attente d'une op\C3\A9ration\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = alloca %struct.sockaddr_in
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca [45 x i8]
%6 = alloca [45 x i8]
%7 = alloca [4 x i8]
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%9 = bitcast %struct.sockaddr_in* %2 to i8*
%10 = bitcast %struct.sockaddr_in* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = load i32, i32* @AF_INET
%13 = load i32, i32* @SOCK_STREAM
%14 = tail call i32 @socket(i32 %12, i32 %13, i32 0)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %0
%20 = load i32, i32* @AF_INET
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 3
store i32 %20, i32* %21
%22 = tail call i32 @htons(i32 3490)
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
store i32 %22, i32* %23
%24 = load i32, i32* @INADDR_ANY
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0, i32 0
store i32 %24, i32* %25
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
%27 = call i32 @memset(i32* %26, i8 signext 0, i32 8)
%28 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%29 = call i32 @bind(i32 %14, %struct.sockaddr* %28, i32 4)
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %34
31: ; preds = %19
%32 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %19
%35 = call i32 @listen(i32 %14, i32 10)
%36 = icmp eq i32 %35, -1
br i1 %36, label %43, label %37
37: ; preds = %34
%38 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%39 = getelementptr inbounds [45 x i8], [45 x i8]* %5, i64 0, i64 0
%40 = getelementptr inbounds [45 x i8], [45 x i8]* %6, i64 0, i64 0
%41 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
br label %46
43: ; preds = %34
%44 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %54, %37
store i32 16, i32* %4
%47 = call i32 @accept(i32 %14, %struct.sockaddr* %38, i32* %4)
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %54
51: ; preds = %46
%52 = call i64 (...) @fork()
%53 = icmp eq i64 %52, 0
br i1 %53, label %55, label %54
54: ; preds = %51, %108, %49
br label %46
55: ; preds = %51
%56 = call i32 @recv(i32 %47, i8* %39, i32 200, i32 0)
%57 = icmp eq i32 %56, -1
br i1 %57, label %58, label %61
58: ; preds = %55
%59 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %55
%62 = call i32 @recv(i32 %47, i8* %40, i32 200, i32 0)
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %67
64: ; preds = %61
%65 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %61
%68 = call i32 @authentif(i8* %39, i8* %40)
%69 = call i32 @strcpy(i8* %41, i32 %68)
%70 = call i32 @send(i32 %47, i8* %41, i32 10, i32 0)
%71 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %108, label %73
73: ; preds = %67
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%75 = call i32 @recv(i32 %47, i8* %8, i32 200, i32 0)
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %80
77: ; preds = %73, %104
%78 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %73, %104
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %8)
%82 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%83 = icmp eq i64 %82, 0
br i1 %83, label %108, label %84
84: ; preds = %80
%85 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %89
87: ; preds = %84
%88 = call i32 @get(i32 %47)
br label %104
89: ; preds = %84
%90 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %94
92: ; preds = %89
%93 = call i32 @put(i32 %47)
br label %104
94: ; preds = %89
%95 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %99
97: ; preds = %94
%98 = call i32 @get(i32 %47)
br label %104
99: ; preds = %94
%100 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %104
102: ; preds = %99
%103 = call i32 @put(i32 %47)
br label %104
104: ; preds = %92, %99, %102, %97, %87
%105 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%106 = call i32 @recv(i32 %47, i8* %8, i32 200, i32 0)
%107 = icmp eq i32 %106, -1
br i1 %107, label %77, label %80
108: ; preds = %80, %67
%109 = load i32, i32* %42
%110 = call i8* @inet_ntoa(i32 %109)
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0), i8* %110)
br label %54
}