#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*/ listFiles();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ runInternalClient(int);
scalar_t__ strcmp(char *, char *);
int processCommand(char buffer[1024]) {
  if (strcmp(buffer, "exit") == 0) {
    printf("\n\tExiting.....:\n");
    return 0;
  } else if (strcmp(buffer, "get") == 0) {
    runInternalClient(0);
    return 1;
  } else if (strcmp(buffer, "send") == 0) {
    runInternalClient(1);
    return 1;
  } else if (strcmp(buffer, "list") == 0) {
    listFiles();
    return 1;
  } else {
    printf("\n\tUnknown 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    0xea9(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    117e <processCommand+0x3e>
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    121b <processCommand+0xdb>
mov    -0x10(%rbp),%rdi
lea    0xe8d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ab <processCommand+0x6b>
xor    %edi,%edi
call   1060 <runInternalClient@plt>
movl   $0x1,-0x4(%rbp)
jmp    121b <processCommand+0xdb>
mov    -0x10(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11db <processCommand+0x9b>
mov    $0x1,%edi
call   1060 <runInternalClient@plt>
movl   $0x1,-0x4(%rbp)
jmp    121b <processCommand+0xdb>
mov    -0x10(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1208 <processCommand+0xc8>
mov    $0x0,%al
call   1030 <listFiles@plt>
movl   $0x1,-0x4(%rbp)
jmp    121b <processCommand+0xdb>
lea    0xe15(%rip),%rdi
call   1040 <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    0xeb5(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11a4 <processCommand+0x64>
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11b4 <processCommand+0x74>
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11bd <processCommand+0x7d>
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11ce <processCommand+0x8e>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
jmp    11da <processCommand+0x9a>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
jmp    11da <processCommand+0x9a>
xor    %edi,%edi
call   1060 <runInternalClient@plt>
jmp    11d5 <processCommand+0x95>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1060 <runInternalClient@plt>
jmp    11da <processCommand+0x9a>
xor    %eax,%eax
call   1040 <listFiles@plt>
mov    $0x1,%ebx
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"\0A\09Unknown 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 %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %29
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @runInternalClient(i32 0)
store i32 1, i32* %2
br label %29
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @runInternalClient(i32 1)
store i32 1, i32* %2
br label %29
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 (...) @listFiles()
store i32 1, i32* %2
br label %29
27: ; preds = %21
%28 = 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 %29
29: ; preds = %27, %25, %19, %13, %7
%30 = load i32, i32* %2
ret i32 %30
}

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"\0A\09Unknown 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 %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.6, i64 0, i64 0))
br label %23
6: ; preds = %1
%7 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @runInternalClient(i32 0)
br label %23
11: ; preds = %6
%12 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @runInternalClient(i32 1)
br label %23
16: ; preds = %11
%17 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 (...) @listFiles()
br label %23
21: ; preds = %16
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %23
23: ; preds = %21, %19, %14, %9, %4
%24 = phi i32 [ 0, %4 ], [ 1, %9 ], [ 1, %14 ], [ 1, %19 ], [ -1, %21 ]
ret i32 %24
}