#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ serveur_attente_client();
int /*<<< orphan*/ serveur_auth_user(char *);
int /*<<< orphan*/ serveur_init(char *);
int /*<<< orphan*/ serveur_nouvelUtilisateur(char *);
char *serveur_reception();
int /*<<< orphan*/ serveur_terminaison();
scalar_t__ strlen(char *);
char *strstr(char *, char *);
int main() {
  char *message = NULL;
  int fini = 0;
  serveur_init("5050");
  while (1) {
    fini = 0;
    serveur_attente_client();
    while (!fini) {
      message = serveur_reception();
      if (message != NULL) {
        printf("inc_taille: %d bytes\n", (int)strlen(message));
        printf("inc: %s\n", message);
        if (strstr(message, "ANC") == message)
          serveur_nouvelUtilisateur(message);
        else if (strstr(message, "ACL") == message)
          serveur_auth_user(message);
        else if (strstr(message, "SCL") == message)
          NULL;
        else if (strstr(message, "DME") == message)
          NULL;
      } else {
        fini = 1;
      }
    }
    serveur_terminaison();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe4b(%rip),%rdi
call   1070 <serveur_init@plt>
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <serveur_attente_client@plt>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11de <main+0x4e>
jmp    12cd <main+0x13d>
mov    $0x0,%al
call   1060 <serveur_reception@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     12c1 <main+0x131>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xdfa(%rip),%rsi
call   10a0 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    1247 <main+0xb7>
mov    -0x10(%rbp),%rdi
call   10b0 <serveur_nouvelUtilisateur@plt>
jmp    12bc <main+0x12c>
mov    -0x10(%rbp),%rdi
lea    0xdd6(%rip),%rsi
call   10a0 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    126f <main+0xdf>
mov    -0x10(%rbp),%rdi
call   1090 <serveur_auth_user@plt>
jmp    12b7 <main+0x127>
mov    -0x10(%rbp),%rdi
lea    0xdb2(%rip),%rsi
call   10a0 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    128e <main+0xfe>
jmp    12b2 <main+0x122>
mov    -0x10(%rbp),%rdi
lea    0xd97(%rip),%rsi
call   10a0 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    12ad <main+0x11d>
jmp    12ad <main+0x11d>
jmp    12b2 <main+0x122>
jmp    12b7 <main+0x127>
jmp    12bc <main+0x12c>
jmp    12c8 <main+0x138>
movl   $0x1,-0x14(%rbp)
jmp    11c8 <main+0x38>
mov    $0x0,%al
call   1080 <serveur_terminaison@plt>
jmp    11ba <main+0x2a>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xe60(%rip),%rdi
call   1080 <serveur_init@plt>
lea    0xe59(%rip),%r14
lea    0xe68(%rip),%r15
lea    0xe6a(%rip),%r13
lea    0xe67(%rip),%r12
jmp    11d7 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1090 <serveur_terminaison@plt>
xor    %eax,%eax
call   1030 <serveur_attente_client@plt>
xor    %eax,%eax
call   1070 <serveur_reception@plt>
test   %rax,%rax
je     11d0 <main+0x40>
mov    %rax,%rbx
jmp    1207 <main+0x77>
nop
mov    %rbx,%rdi
call   10b0 <serveur_nouvelUtilisateur@plt>
xor    %eax,%eax
call   1070 <serveur_reception@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11d0 <main+0x40>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x3,%edx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <strncmp@plt>
test   %eax,%eax
je     11f0 <main+0x60>
mov    $0x3,%edx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strncmp@plt>
test   %eax,%eax
jne    11f8 <main+0x68>
mov    %rbx,%rdi
call   10a0 <serveur_auth_user@plt>
jmp    11f8 <main+0x68>

LLVM IR (-O0):
@.str = [5 x i8] c"5050\00"
@.str.1 = [22 x i8] c"inc_taille: %d bytes\0A\00"
@.str.2 = [9 x i8] c"inc: %s\0A\00"
@.str.3 = [4 x i8] c"ANC\00"
@.str.4 = [4 x i8] c"ACL\00"
@.str.5 = [4 x i8] c"SCL\00"
@.str.6 = [4 x i8] c"DME\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* null, i8** %2
store i32 0, i32* %3
%4 = call i32 @serveur_init(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %55
store i32 0, i32* %3
%6 = call i32 (...) @serveur_attente_client()
br label %7
7: ; preds = %54, %5
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %55
11: ; preds = %7
%12 = call i8* (...) @serveur_reception()
store i8* %12, i8** %2
%13 = load i8*, i8** %2
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %53
15: ; preds = %11
%16 = load i8*, i8** %2
%17 = call i64 @strlen(i8* %16)
%18 = trunc i64 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i8*, i8** %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = load i8*, i8** %2
%23 = call i8* @strstr(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%24 = load i8*, i8** %2
%25 = icmp eq i8* %23, %24
br i1 %25, label %26, label %29
26: ; preds = %15
%27 = load i8*, i8** %2
%28 = call i32 @serveur_nouvelUtilisateur(i8* %27)
br label %52
29: ; preds = %15
%30 = load i8*, i8** %2
%31 = call i8* @strstr(i8* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%32 = load i8*, i8** %2
%33 = icmp eq i8* %31, %32
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = load i8*, i8** %2
%36 = call i32 @serveur_auth_user(i8* %35)
br label %51
37: ; preds = %29
%38 = load i8*, i8** %2
%39 = call i8* @strstr(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%40 = load i8*, i8** %2
%41 = icmp eq i8* %39, %40
br i1 %41, label %42, label %43
42: ; preds = %37
br label %50
43: ; preds = %37
%44 = load i8*, i8** %2
%45 = call i8* @strstr(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%46 = load i8*, i8** %2
%47 = icmp eq i8* %45, %46
br i1 %47, label %48, label %49
48: ; preds = %43
br label %49
49: ; preds = %48, %43
br label %50
50: ; preds = %49, %42
br label %51
51: ; preds = %50, %34
br label %52
52: ; preds = %51, %26
br label %54
53: ; preds = %11
store i32 1, i32* %3
br label %54
54: ; preds = %53, %52
br label %7
55: ; preds = %7
%56 = call i32 (...) @serveur_terminaison()
br label %5
}

LLVM IR (-O2):
@.str = [5 x i8] c"5050\00"
@.str.1 = [22 x i8] c"inc_taille: %d bytes\0A\00"
@.str.2 = [9 x i8] c"inc: %s\0A\00"
@.str.3 = [4 x i8] c"ANC\00"
@.str.4 = [4 x i8] c"ACL\00"
define i32 @main() {
%1 = tail call i32 @serveur_init(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %24, %0
%3 = tail call i32 (...) @serveur_attente_client()
%4 = tail call i8* (...) @serveur_reception()
%5 = icmp eq i8* %4, null
br i1 %5, label %24, label %6
6: ; preds = %2, %21
%7 = phi i8* [ %22, %21 ], [ %4, %2 ]
%8 = tail call i64 @strlen(i8* %7)
%9 = trunc i64 %8 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%12 = tail call i32 @strncmp(i8* %7, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 3)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %6
%15 = tail call i32 @serveur_nouvelUtilisateur(i8* %7)
br label %21
16: ; preds = %6
%17 = tail call i32 @strncmp(i8* %7, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64 3)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 @serveur_auth_user(i8* %7)
br label %21
21: ; preds = %16, %14, %19
%22 = tail call i8* (...) @serveur_reception()
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %6
24: ; preds = %21, %2
%25 = tail call i32 (...) @serveur_terminaison()
br label %2
}