#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 */
typedef int /*<<< orphan*/ chaine;

/* Variables and functions */
scalar_t__ MessageValide(char *);
int /*<<< orphan*/ RobbyClose();
int /*<<< orphan*/ RobbyDown();
int /*<<< orphan*/ RobbyLeft();
int /*<<< orphan*/ RobbyOpen();
int /*<<< orphan*/ RobbyRight();
int /*<<< orphan*/ RobbyUp();
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
scalar_t__ strcmp(char *, char *);
int TraiteMessage(char *message) {
  char chaine[9];
  memset(chaine, 0, sizeof(chaine));
  if (MessageValide(message) == 0) {
    if ((strcmp(message, "quit") != 0) && (strcmp(message, "exit") != 0)) {
      if (strcmp(message, "up") == 0) {
        RobbyUp();
      }
      if (strcmp(message, "down") == 0) {
        RobbyDown();
      }
      if (strcmp(message, "left") == 0) {
        RobbyLeft();
      }
      if (strcmp(message, "right") == 0) {
        RobbyRight();
      }
      if (strcmp(message, "open") == 0) {
        RobbyOpen();
      }
      if (strcmp(message, "close") == 0) {
        RobbyClose();
      }
    }
  } else {
    return (-1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<TraiteMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x19(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <MessageValide@plt>
cmp    $0x0,%rax
jne    12c3 <TraiteMessage+0x133>
mov    -0x10(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12be <TraiteMessage+0x12e>
mov    -0x10(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12be <TraiteMessage+0x12e>
mov    -0x10(%rbp),%rdi
lea    0xe0c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1214 <TraiteMessage+0x84>
mov    $0x0,%al
call   10a0 <RobbyUp@plt>
mov    -0x10(%rbp),%rdi
lea    0xdee(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1235 <TraiteMessage+0xa5>
mov    $0x0,%al
call   1080 <RobbyDown@plt>
mov    -0x10(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1256 <TraiteMessage+0xc6>
mov    $0x0,%al
call   1090 <RobbyLeft@plt>
mov    -0x10(%rbp),%rdi
lea    0xdb6(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1277 <TraiteMessage+0xe7>
mov    $0x0,%al
call   1030 <RobbyRight@plt>
mov    -0x10(%rbp),%rdi
lea    0xd9b(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1298 <TraiteMessage+0x108>
mov    $0x0,%al
call   1070 <RobbyOpen@plt>
mov    -0x10(%rbp),%rdi
lea    0xd7f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12b9 <TraiteMessage+0x129>
mov    $0x0,%al
call   1050 <RobbyClose@plt>
jmp    12be <TraiteMessage+0x12e>
jmp    12cf <TraiteMessage+0x13f>
movl   $0xffffffff,-0x4(%rbp)
jmp    12d6 <TraiteMessage+0x146>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TraiteMessage>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0xf(%rsp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
call   10b0 <MessageValide@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
jne    129d <TraiteMessage+0x10d>
lea    0xe39(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     129b <TraiteMessage+0x10b>
lea    0xe26(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     129b <TraiteMessage+0x10b>
lea    0xe13(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    120b <TraiteMessage+0x7b>
xor    %eax,%eax
call   10a0 <RobbyUp@plt>
lea    0xdfb(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1226 <TraiteMessage+0x96>
xor    %eax,%eax
call   1080 <RobbyDown@plt>
lea    0xde5(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1241 <TraiteMessage+0xb1>
xor    %eax,%eax
call   1090 <RobbyLeft@plt>
lea    0xdcf(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    125c <TraiteMessage+0xcc>
xor    %eax,%eax
call   1030 <RobbyRight@plt>
lea    0xdba(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1277 <TraiteMessage+0xe7>
xor    %eax,%eax
call   1070 <RobbyOpen@plt>
lea    0xda4(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
mov    $0x0,%ebp
test   %rax,%rax
jne    129d <TraiteMessage+0x10d>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <RobbyClose@plt>
jmp    129d <TraiteMessage+0x10d>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"quit\00"
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [3 x i8] c"up\00"
@.str.3 = [5 x i8] c"down\00"
@.str.4 = [5 x i8] c"left\00"
@.str.5 = [6 x i8] c"right\00"
@.str.6 = [5 x i8] c"open\00"
@.str.7 = [6 x i8] c"close\00"
define i32 @TraiteMessage(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [9 x i8]
store i8* %0, i8** %3
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 9)
%7 = load i8*, i8** %3
%8 = call i64 @MessageValide(i8* %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %56
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %55
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %55
18: ; preds = %14
%19 = load i8*, i8** %3
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 (...) @RobbyUp()
br label %24
24: ; preds = %22, %18
%25 = load i8*, i8** %3
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 (...) @RobbyDown()
br label %30
30: ; preds = %28, %24
%31 = load i8*, i8** %3
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 (...) @RobbyLeft()
br label %36
36: ; preds = %34, %30
%37 = load i8*, i8** %3
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 (...) @RobbyRight()
br label %42
42: ; preds = %40, %36
%43 = load i8*, i8** %3
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 (...) @RobbyOpen()
br label %48
48: ; preds = %46, %42
%49 = load i8*, i8** %3
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = call i32 (...) @RobbyClose()
br label %54
54: ; preds = %52, %48
br label %55
55: ; preds = %54, %14, %10
br label %57
56: ; preds = %1
store i32 -1, i32* %2
br label %58
57: ; preds = %55
store i32 0, i32* %2
br label %58
58: ; preds = %57, %56
%59 = load i32, i32* %2
ret i32 %59
}

LLVM IR (-O2):
@.str = [5 x i8] c"quit\00"
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [3 x i8] c"up\00"
@.str.3 = [5 x i8] c"down\00"
@.str.4 = [5 x i8] c"left\00"
@.str.5 = [6 x i8] c"right\00"
@.str.6 = [5 x i8] c"open\00"
@.str.7 = [6 x i8] c"close\00"
define i32 @TraiteMessage(i8* %0) {
%2 = alloca [9 x i8]
%3 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 9)
%5 = call i64 @MessageValide(i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %43
7: ; preds = %1
%8 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %43, label %10
10: ; preds = %7
%11 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %43, label %13
13: ; preds = %10
%14 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (...) @RobbyUp()
br label %18
18: ; preds = %16, %13
%19 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (...) @RobbyDown()
br label %23
23: ; preds = %21, %18
%24 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (...) @RobbyLeft()
br label %28
28: ; preds = %26, %23
%29 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 (...) @RobbyRight()
br label %33
33: ; preds = %31, %28
%34 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 (...) @RobbyOpen()
br label %38
38: ; preds = %36, %33
%39 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 (...) @RobbyClose()
br label %43
43: ; preds = %38, %41, %10, %7, %1
%44 = phi i32 [ -1, %1 ], [ 0, %7 ], [ 0, %10 ], [ 0, %41 ], [ 0, %38 ]
ret i32 %44
}