#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*/ PSTR(char *);
char const *ccnl_arduino_getPROGMEMstr(int /*<<< orphan*/);
const char *ccnl_matchMode2str(int mode) {
  switch (mode) {
  case 0:
    return ccnl_arduino_getPROGMEMstr(PSTR("CMP_EXACT"));
  case 1:
    return ccnl_arduino_getPROGMEMstr(PSTR("CMP_MATCH"));
  case 2:
    return ccnl_arduino_getPROGMEMstr(PSTR("CMP_LONGEST"));
  }
  return ccnl_arduino_getPROGMEMstr(PSTR("?"));
}


x86 assembly (clang, -O0):
<ccnl_matchMode2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1160 <ccnl_matchMode2str+0x40>
jmp    113e <ccnl_matchMode2str+0x1e>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     117c <ccnl_matchMode2str+0x5c>
jmp    114f <ccnl_matchMode2str+0x2f>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1198 <ccnl_matchMode2str+0x78>
jmp    11b4 <ccnl_matchMode2str+0x94>
lea    0xe99(%rip),%rdi
call   1030 <PSTR@plt>
mov    %eax,%edi
call   1040 <ccnl_arduino_getPROGMEMstr@plt>
mov    %rax,-0x8(%rbp)
jmp    11cb <ccnl_matchMode2str+0xab>
lea    0xe87(%rip),%rdi
call   1030 <PSTR@plt>
mov    %eax,%edi
call   1040 <ccnl_arduino_getPROGMEMstr@plt>
mov    %rax,-0x8(%rbp)
jmp    11cb <ccnl_matchMode2str+0xab>
lea    0xe75(%rip),%rdi
call   1030 <PSTR@plt>
mov    %eax,%edi
call   1040 <ccnl_arduino_getPROGMEMstr@plt>
mov    %rax,-0x8(%rbp)
jmp    11cb <ccnl_matchMode2str+0xab>
lea    0xe65(%rip),%rdi
call   1030 <PSTR@plt>
mov    %eax,%edi
call   1040 <ccnl_arduino_getPROGMEMstr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccnl_matchMode2str>:
push   %rax
cmp    $0x2,%edi
ja     1139 <ccnl_matchMode2str+0x19>
movslq %edi,%rax
lea    0xef4(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1140 <ccnl_matchMode2str+0x20>
lea    0xee0(%rip),%rdi
call   1030 <PSTR@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <ccnl_arduino_getPROGMEMstr@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"CMP_EXACT\00"
@.str.1 = [10 x i8] c"CMP_MATCH\00"
@.str.2 = [12 x i8] c"CMP_LONGEST\00"
@.str.3 = [2 x i8] c"?\00"
define i8* @ccnl_matchMode2str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %14 [
i32 0, label %5
i32 1, label %8
i32 2, label %11
]
5: ; preds = %1
%6 = call i32 @PSTR(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = call i8* @ccnl_arduino_getPROGMEMstr(i32 %6)
store i8* %7, i8** %2
br label %17
8: ; preds = %1
%9 = call i32 @PSTR(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%10 = call i8* @ccnl_arduino_getPROGMEMstr(i32 %9)
store i8* %10, i8** %2
br label %17
11: ; preds = %1
%12 = call i32 @PSTR(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%13 = call i8* @ccnl_arduino_getPROGMEMstr(i32 %12)
store i8* %13, i8** %2
br label %17
14: ; preds = %1
%15 = call i32 @PSTR(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%16 = call i8* @ccnl_arduino_getPROGMEMstr(i32 %15)
store i8* %16, i8** %2
br label %17
17: ; preds = %14, %11, %8, %5
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [10 x i8] c"CMP_EXACT\00"
@.str.1 = [10 x i8] c"CMP_MATCH\00"
@.str.2 = [12 x i8] c"CMP_LONGEST\00"
@.str.3 = [2 x i8] c"?\00"
@reltable.ccnl_matchMode2str = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.ccnl_matchMode2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.ccnl_matchMode2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.ccnl_matchMode2str to i64)) to i32)]
define i8* @ccnl_matchMode2str(i32 %0) {
%2 = icmp ult i32 %0, 3
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.ccnl_matchMode2str to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %1 ]
%9 = tail call i32 @PSTR(i8* %8)
%10 = tail call i8* @ccnl_arduino_getPROGMEMstr(i32 %9)
ret i8* %10
}