#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*/ readListResponse();
int /*<<< orphan*/ runInternalServer(int);
int sendCommand();
scalar_t__ strcmp(char *, char *);
int processCommand(char buffer[1024]) {
  if (strcmp(buffer, "exit") == 0) {
    if (sendCommand() != -1)
      printf("\n\tExiting.....:\n");
    return 0;
  } else if (strcmp(buffer, "get") == 0) {
    if (sendCommand() != -1)
      runInternalServer(0);
    return 1;
  } else if (strcmp(buffer, "send") == 0) {
    if (sendCommand() != -1)
      runInternalServer(1);
    return 1;
  } else if (strcmp(buffer, "list") == 0) {
    if (sendCommand() != -1)
      readListResponse();
    return 1;
  }
  printf("\t\nUnknown Command\n\n");
  return -1;
}


x86 assembly (clang, -O0):
<processCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    119e <processCommand+0x4e>
mov    $0x0,%al
call   1030 <sendCommand@plt>
cmp    $0xffffffff,%eax
je     1192 <processCommand+0x42>
lea    0xe78(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    127a <processCommand+0x12a>
mov    -0x10(%rbp),%rdi
lea    0xe6d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11db <processCommand+0x8b>
mov    $0x0,%al
call   1030 <sendCommand@plt>
cmp    $0xffffffff,%eax
je     11cf <processCommand+0x7f>
xor    %edi,%edi
call   1070 <runInternalServer@plt>
movl   $0x1,-0x4(%rbp)
jmp    127a <processCommand+0x12a>
mov    -0x10(%rbp),%rdi
lea    0xe34(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    121b <processCommand+0xcb>
mov    $0x0,%al
call   1030 <sendCommand@plt>
cmp    $0xffffffff,%eax
je     120f <processCommand+0xbf>
mov    $0x1,%edi
call   1070 <runInternalServer@plt>
movl   $0x1,-0x4(%rbp)
jmp    127a <processCommand+0x12a>
mov    -0x10(%rbp),%rdi
lea    0xdf9(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1258 <processCommand+0x108>
mov    $0x0,%al
call   1030 <sendCommand@plt>
cmp    $0xffffffff,%eax
je     124c <processCommand+0xfc>
mov    $0x0,%al
call   1040 <readListResponse@plt>
movl   $0x1,-0x4(%rbp)
jmp    127a <processCommand+0x12a>
jmp    125d <processCommand+0x10d>
jmp    1262 <processCommand+0x112>
jmp    1267 <processCommand+0x117>
lea    0xdb6(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processCommand>:
push   %rbx
mov    %rdi,%rbx
lea    0xea5(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11b4 <processCommand+0x64>
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11d0 <processCommand+0x80>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11ea <processCommand+0x9a>
lea    0xe7a(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1207 <processCommand+0xb7>
lea    0xe6b(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%ebx
jmp    121f <processCommand+0xcf>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <sendCommand@plt>
cmp    $0xffffffff,%eax
je     121f <processCommand+0xcf>
lea    0xe5d(%rip),%rdi
call   1040 <puts@plt>
jmp    121f <processCommand+0xcf>
xor    %eax,%eax
call   1030 <sendCommand@plt>
mov    $0x1,%ebx
cmp    $0xffffffff,%eax
je     121f <processCommand+0xcf>
xor    %edi,%edi
call   1070 <runInternalServer@plt>
jmp    121f <processCommand+0xcf>
xor    %eax,%eax
call   1030 <sendCommand@plt>
mov    $0x1,%ebx
cmp    $0xffffffff,%eax
je     121f <processCommand+0xcf>
mov    $0x1,%edi
call   1070 <runInternalServer@plt>
jmp    121f <processCommand+0xcf>
xor    %eax,%eax
call   1030 <sendCommand@plt>
mov    $0x1,%ebx
cmp    $0xffffffff,%eax
je     121f <processCommand+0xcf>
xor    %eax,%eax
call   1050 <readListResponse@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"exit\00"
@.str.1 = [17 x i8] c"\0A\09Exiting.....:\0A\00"
@.str.2 = [4 x i8] c"get\00"
@.str.3 = [5 x i8] c"send\00"
@.str.4 = [5 x i8] c"list\00"
@.str.5 = [20 x i8] c"\09\0AUnknown Command\0A\0A\00"
define i32 @processCommand(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = call i32 (...) @sendCommand()
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
store i32 0, i32* %2
br label %48
13: ; preds = %1
%14 = load i8*, i8** %3
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = call i32 (...) @sendCommand()
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @runInternalServer(i32 0)
br label %22
22: ; preds = %20, %17
store i32 1, i32* %2
br label %48
23: ; preds = %13
%24 = load i8*, i8** %3
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = call i32 (...) @sendCommand()
%29 = icmp ne i32 %28, -1
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @runInternalServer(i32 1)
br label %32
32: ; preds = %30, %27
store i32 1, i32* %2
br label %48
33: ; preds = %23
%34 = load i8*, i8** %3
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %33
%38 = call i32 (...) @sendCommand()
%39 = icmp ne i32 %38, -1
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (...) @readListResponse()
br label %42
42: ; preds = %40, %37
store i32 1, i32* %2
br label %48
43: ; preds = %33
br label %44
44: ; preds = %43
br label %45
45: ; preds = %44
br label %46
46: ; preds = %45
%47 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %2
br label %48
48: ; preds = %46, %42, %32, %22, %12
%49 = load i32, i32* %2
ret i32 %49
}

LLVM IR (-O2):
@.str = [5 x i8] c"exit\00"
@.str.2 = [4 x i8] c"get\00"
@.str.3 = [5 x i8] c"send\00"
@.str.4 = [5 x i8] c"list\00"
@str = [19 x i8] c"\09\0AUnknown Command\0A\00"
@str.6 = [16 x i8] c"\0A\09Exiting.....:\00"
define i32 @processCommand(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i32 (...) @sendCommand()
%6 = icmp eq i32 %5, -1
br i1 %6, label %35, label %7
7: ; preds = %4
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.6, i64 0, i64 0))
br label %35
9: ; preds = %1
%10 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = tail call i32 (...) @sendCommand()
%14 = icmp eq i32 %13, -1
br i1 %14, label %35, label %15
15: ; preds = %12
%16 = tail call i32 @runInternalServer(i32 0)
br label %35
17: ; preds = %9
%18 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = tail call i32 (...) @sendCommand()
%22 = icmp eq i32 %21, -1
br i1 %22, label %35, label %23
23: ; preds = %20
%24 = tail call i32 @runInternalServer(i32 1)
br label %35
25: ; preds = %17
%26 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = tail call i32 (...) @sendCommand()
%30 = icmp eq i32 %29, -1
br i1 %30, label %35, label %31
31: ; preds = %28
%32 = tail call i32 (...) @readListResponse()
br label %35
33: ; preds = %25
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %35
35: ; preds = %28, %31, %20, %23, %12, %15, %4, %7, %33
%36 = phi i32 [ -1, %33 ], [ 0, %7 ], [ 0, %4 ], [ 1, %15 ], [ 1, %12 ], [ 1, %23 ], [ 1, %20 ], [ 1, %31 ], [ 1, %28 ]
ret i32 %36
}