#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 uint8_t;

/* Variables and functions */
const char *command_name(uint8_t command) {
  switch (command) {
  case 0:
    return "SOFT_RESET";
  case 1:
    return "READ";
  case 2:
    return "WRITE";
  case 0xFD:
    return "HARD_RESET";
  case 0xFE:
    return "SWIM_ENTRY";
  case 0xFF:
    return "GET_VERSION";
  default:
    return "unknown (invalid)";
  }
}


x86 assembly (clang, -O0):
<command_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1175 <command_name+0x75>
jmp    111a <command_name+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     1185 <command_name+0x85>
jmp    112b <command_name+0x2b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1195 <command_name+0x95>
jmp    113c <command_name+0x3c>
mov    -0x10(%rbp),%eax
sub    $0xfd,%eax
je     11a5 <command_name+0xa5>
jmp    114f <command_name+0x4f>
mov    -0x10(%rbp),%eax
sub    $0xfe,%eax
je     11b5 <command_name+0xb5>
jmp    1162 <command_name+0x62>
mov    -0x10(%rbp),%eax
sub    $0xff,%eax
je     11c5 <command_name+0xc5>
jmp    11d5 <command_name+0xd5>
lea    0xe84(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <command_name+0xe0>
lea    0xe7f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <command_name+0xe0>
lea    0xe74(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <command_name+0xe0>
lea    0xe6a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <command_name+0xe0>
lea    0xe65(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <command_name+0xe0>
lea    0xe60(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <command_name+0xe0>
lea    0xe5c(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<command_name>:
cmp    $0xfc,%edi
jg     111e <command_name+0x1e>
test   %edi,%edi
je     113e <command_name+0x3e>
cmp    $0x1,%edi
je     1146 <command_name+0x46>
cmp    $0x2,%edi
jne    115e <command_name+0x5e>
lea    0xef3(%rip),%rax
ret
cmp    $0xfd,%edi
je     114e <command_name+0x4e>
cmp    $0xfe,%edi
je     1156 <command_name+0x56>
cmp    $0xff,%edi
jne    115e <command_name+0x5e>
lea    0xeef(%rip),%rax
ret
lea    0xebb(%rip),%rax
ret
lea    0xebe(%rip),%rax
ret
lea    0xec1(%rip),%rax
ret
lea    0xec4(%rip),%rax
ret
lea    0xed3(%rip),%rax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"SOFT_RESET\00"
@.str.1 = [5 x i8] c"READ\00"
@.str.2 = [6 x i8] c"WRITE\00"
@.str.3 = [11 x i8] c"HARD_RESET\00"
@.str.4 = [11 x i8] c"SWIM_ENTRY\00"
@.str.5 = [12 x i8] c"GET_VERSION\00"
@.str.6 = [18 x i8] c"unknown (invalid)\00"
define i8* @command_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 253, label %8
i32 254, label %9
i32 255, label %10
]
5: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %2
br label %12
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %12
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %12
8: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %12
9: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %12
10: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %12
11: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %12
12: ; preds = %11, %10, %9, %8, %7, %6, %5
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [11 x i8] c"SOFT_RESET\00"
@.str.1 = [5 x i8] c"READ\00"
@.str.2 = [6 x i8] c"WRITE\00"
@.str.3 = [11 x i8] c"HARD_RESET\00"
@.str.4 = [11 x i8] c"SWIM_ENTRY\00"
@.str.5 = [12 x i8] c"GET_VERSION\00"
@.str.6 = [18 x i8] c"unknown (invalid)\00"
define i8* @command_name(i32 %0) {
switch i32 %0, label %7 [
i32 0, label %8
i32 1, label %2
i32 2, label %3
i32 253, label %4
i32 254, label %5
i32 255, label %6
]
2: ; preds = %1
br label %8
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %5, %4, %3, %2
%9 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %9
}