#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*/ pp(char *);
scalar_t__ strcmp(char *, char *);
unsigned short cdata_to_op(char *cdata) {
  unsigned short op;
  if (strcmp(cdata, "get") == 0) {
    pp("performing get operation");
    op = 0x0001;
  } else if (strcmp(cdata, "put") == 0) {
    pp("performing put operation");
    op = 0x0002;
  } else if (strcmp(cdata, "rm") == 0) {
    pp("performing rm operation");
    op = 0x0003;
  } else if (strcmp(cdata, "ls") == 0) {
    pp("performing ls operation");
    op = 0x0004;
  } else {
    pp("error!");
    op = 0xFFFF;
  }
  return op;
}


x86 assembly (clang, -O0):
<cdata_to_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    115d <cdata_to_op+0x3d>
lea    0xeb7(%rip),%rdi
call   1030 <pp@plt>
movw   $0x1,-0xa(%rbp)
jmp    1211 <cdata_to_op+0xf1>
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    118e <cdata_to_op+0x6e>
lea    0xea3(%rip),%rdi
call   1030 <pp@plt>
movw   $0x2,-0xa(%rbp)
jmp    120c <cdata_to_op+0xec>
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11bf <cdata_to_op+0x9f>
lea    0xe8e(%rip),%rdi
call   1030 <pp@plt>
movw   $0x3,-0xa(%rbp)
jmp    1207 <cdata_to_op+0xe7>
mov    -0x8(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11f0 <cdata_to_op+0xd0>
lea    0xe78(%rip),%rdi
call   1030 <pp@plt>
movw   $0x4,-0xa(%rbp)
jmp    1202 <cdata_to_op+0xe2>
lea    0xe79(%rip),%rdi
call   1030 <pp@plt>
movw   $0xffff,-0xa(%rbp)
jmp    1207 <cdata_to_op+0xe7>
jmp    120c <cdata_to_op+0xec>
jmp    1211 <cdata_to_op+0xf1>
movzwl -0xa(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdata_to_op>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     118b <cdata_to_op+0x6b>
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1198 <cdata_to_op+0x78>
lea    0xeea(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11a5 <cdata_to_op+0x85>
lea    0xef1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
lea    0xee2(%rip),%rcx
lea    0xef3(%rip),%rdi
cmove  %rcx,%rdi
neg    %rax
sbb    %ebx,%ebx
or     $0x4,%ebx
jmp    11b0 <cdata_to_op+0x90>
mov    $0x1,%bx
lea    0xe6e(%rip),%rdi
jmp    11b0 <cdata_to_op+0x90>
mov    $0x2,%bx
lea    0xe7e(%rip),%rdi
jmp    11b0 <cdata_to_op+0x90>
mov    $0x3,%bx
lea    0xe8d(%rip),%rdi
call   1030 <pp@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"get\00"
@.str.1 = [25 x i8] c"performing get operation\00"
@.str.2 = [4 x i8] c"put\00"
@.str.3 = [25 x i8] c"performing put operation\00"
@.str.4 = [3 x i8] c"rm\00"
@.str.5 = [24 x i8] c"performing rm operation\00"
@.str.6 = [3 x i8] c"ls\00"
@.str.7 = [24 x i8] c"performing ls operation\00"
@.str.8 = [7 x i8] c"error!\00"
define zeroext i16 @cdata_to_op(i8* %0) {
%2 = alloca i8*
%3 = alloca i16
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 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 @pp(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i16 1, i16* %3
br label %32
9: ; preds = %1
%10 = load i8*, i8** %2
%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 @pp(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
store i16 2, i16* %3
br label %31
15: ; preds = %9
%16 = load i8*, i8** %2
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @pp(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
store i16 3, i16* %3
br label %30
21: ; preds = %15
%22 = load i8*, i8** %2
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @pp(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
store i16 4, i16* %3
br label %29
27: ; preds = %21
%28 = call i32 @pp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
store i16 -1, i16* %3
br label %29
29: ; preds = %27, %25
br label %30
30: ; preds = %29, %19
br label %31
31: ; preds = %30, %13
br label %32
32: ; preds = %31, %7
%33 = load i16, i16* %3
ret i16 %33
}

LLVM IR (-O2):
@.str = [4 x i8] c"get\00"
@.str.1 = [25 x i8] c"performing get operation\00"
@.str.2 = [4 x i8] c"put\00"
@.str.3 = [25 x i8] c"performing put operation\00"
@.str.4 = [3 x i8] c"rm\00"
@.str.5 = [24 x i8] c"performing rm operation\00"
@.str.6 = [3 x i8] c"ls\00"
@.str.7 = [24 x i8] c"performing ls operation\00"
@.str.8 = [7 x i8] c"error!\00"
define zeroext i16 @cdata_to_op(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %4
%8 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0)
%14 = select i1 %12, i16 4, i16 -1
br label %15
15: ; preds = %10, %7, %4, %1
%16 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), %7 ], [ %13, %10 ]
%17 = phi i16 [ 1, %1 ], [ 2, %4 ], [ 3, %7 ], [ %14, %10 ]
%18 = tail call i32 @pp(i8* %16)
ret i16 %17
}