#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*/ msg;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ handleAckNack(int, int /*<<< orphan*/);
int /*<<< orphan*/ handleLogIn(int, char *);
int /*<<< orphan*/ handleUserList(int);
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
void handleMessage(int fd, char *msg) {
  char *nick;
  if (msg[1] == '.') {
    switch (msg[0]) {
    case '1':
      break;
    case '2':
      nick = malloc(sizeof(msg) - 2);
      strcpy(nick, msg + 2);
      handleLogIn(fd, msg + 2);
      free(nick);
      break;
    case '6':
      handleUserList(fd);
      break;
    default:
      handleAckNack(fd, '0');
      break;
    }
  } else
    handleAckNack(fd, '0');
}


x86 assembly (clang, -O0):
<handleMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    121b <handleMessage+0xbb>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x31,%eax
je     11ba <handleMessage+0x5a>
jmp    1198 <handleMessage+0x38>
mov    -0x1c(%rbp),%eax
sub    $0x32,%eax
je     11bf <handleMessage+0x5f>
jmp    11a9 <handleMessage+0x49>
mov    -0x1c(%rbp),%eax
sub    $0x36,%eax
je     11fc <handleMessage+0x9c>
jmp    1209 <handleMessage+0xa9>
jmp    1216 <handleMessage+0xb6>
mov    $0x6,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x2,%rsi
call   1040 <strcpy@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x2,%rsi
call   1080 <handleLogIn@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    1216 <handleMessage+0xb6>
mov    -0x4(%rbp),%edi
call   1060 <handleUserList@plt>
jmp    1216 <handleMessage+0xb6>
mov    -0x4(%rbp),%edi
mov    $0x30,%esi
call   1050 <handleAckNack@plt>
jmp    1228 <handleMessage+0xc8>
mov    -0x4(%rbp),%edi
mov    $0x30,%esi
call   1050 <handleAckNack@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleMessage>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
cmpb   $0x2e,0x1(%rsi)
jne    11b3 <handleMessage+0x53>
mov    %rsi,%rbx
movsbl (%rsi),%eax
cmp    $0x31,%eax
je     11c3 <handleMessage+0x63>
cmp    $0x36,%eax
je     11c8 <handleMessage+0x68>
cmp    $0x32,%eax
jne    11b3 <handleMessage+0x53>
mov    $0x6,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
add    $0x2,%rbx
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1080 <handleLogIn@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>
mov    %ebp,%edi
mov    $0x30,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <handleAckNack@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <handleUserList@plt>

LLVM IR (-O0):
define void @handleMessage(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 46
br i1 %10, label %11, label %36
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
switch i32 %15, label %32 [
i32 49, label %16
i32 50, label %17
i32 54, label %29
]
16: ; preds = %11
br label %35
17: ; preds = %11
%18 = call i8* @malloc(i32 6)
store i8* %18, i8** %5
%19 = load i8*, i8** %5
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = call i32 @strcpy(i8* %19, i8* %21)
%23 = load i32, i32* %3
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = call i32 @handleLogIn(i32 %23, i8* %25)
%27 = load i8*, i8** %5
%28 = call i32 @free(i8* %27)
br label %35
29: ; preds = %11
%30 = load i32, i32* %3
%31 = call i32 @handleUserList(i32 %30)
br label %35
32: ; preds = %11
%33 = load i32, i32* %3
%34 = call i32 @handleAckNack(i32 %33, i32 48)
br label %35
35: ; preds = %32, %29, %17, %16
br label %39
36: ; preds = %2
%37 = load i32, i32* %3
%38 = call i32 @handleAckNack(i32 %37, i32 48)
br label %39
39: ; preds = %36, %35
ret void
}

LLVM IR (-O2):
define void @handleMessage(i32 %0, i8* %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 1
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 46
br i1 %5, label %6, label %19
6: ; preds = %2
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
switch i32 %8, label %17 [
i32 49, label %21
i32 50, label %9
i32 54, label %15
]
9: ; preds = %6
%10 = tail call dereferenceable_or_null(6) i8* @malloc(i32 6)
%11 = getelementptr inbounds i8, i8* %1, i64 2
%12 = tail call i32 @strcpy(i8* %10, i8* %11)
%13 = tail call i32 @handleLogIn(i32 %0, i8* %11)
%14 = tail call i32 @free(i8* %10)
br label %21
15: ; preds = %6
%16 = tail call i32 @handleUserList(i32 %0)
br label %21
17: ; preds = %6
%18 = tail call i32 @handleAckNack(i32 %0, i32 48)
br label %21
19: ; preds = %2
%20 = tail call i32 @handleAckNack(i32 %0, i32 48)
br label %21
21: ; preds = %6, %9, %15, %17, %19
ret void
}