extern char *gaisler_device_str(int id) {
  switch (id) {
  case 0x003:
    return "GAISLER_LEON3";
  case 0x004:
    return "GAISLER_LEON3DSU";
  case 0x005:
    return "GAISLER_ETHAHB";
  case 0x006:
    return "GAISLER_APBMST";
  case 0x007:
    return "GAISLER_AHBUART";
  case 0x008:
    return "GAISLER_SRCTRL";
  case 0x009:
    return "GAISLER_SDCTRL";
  case 0x00c:
    return "GAISLER_APBUART";
  case 0x00d:
    return "GAISLER_IRQMP";
  case 0x00e:
    return "GAISLER_AHBRAM";
  case 0x011:
    return "GAISLER_GPTIMER";
  case 0x012:
    return "GAISLER_PCITRG";
  case 0x013:
    return "GAISLER_PCISBRG";
  case 0x014:
    return "GAISLER_PCIFBRG";
  case 0x015:
    return "GAISLER_PCITRACE";
  case 0x017:
    return "GAISLER_AHBTRACE";
  case 0x018:
    return "GAISLER_ETHDSU";
  case 0x01A:
    return "GAISLER_PIOPORT";
  case 0x01f:
    return "GAISLER_SPACEWIRE";
  case 0xffd:
    return "GAISLER_L2TIME";
  case 0xffe:
    return "GAISLER_L2C";
  case 0xfff:
    return "GAISLER_PLUGPLAY";
  default:
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<gaisler_device_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x3,%eax
je     1286 <gaisler_device_str+0x186>
jmp    111b <gaisler_device_str+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     1296 <gaisler_device_str+0x196>
jmp    112c <gaisler_device_str+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x5,%eax
je     12a6 <gaisler_device_str+0x1a6>
jmp    113d <gaisler_device_str+0x3d>
mov    -0x10(%rbp),%eax
sub    $0x6,%eax
je     12b6 <gaisler_device_str+0x1b6>
jmp    114e <gaisler_device_str+0x4e>
mov    -0x10(%rbp),%eax
sub    $0x7,%eax
je     12c6 <gaisler_device_str+0x1c6>
jmp    115f <gaisler_device_str+0x5f>
mov    -0x10(%rbp),%eax
sub    $0x8,%eax
je     12d6 <gaisler_device_str+0x1d6>
jmp    1170 <gaisler_device_str+0x70>
mov    -0x10(%rbp),%eax
sub    $0x9,%eax
je     12e6 <gaisler_device_str+0x1e6>
jmp    1181 <gaisler_device_str+0x81>
mov    -0x10(%rbp),%eax
sub    $0xc,%eax
je     12f6 <gaisler_device_str+0x1f6>
jmp    1192 <gaisler_device_str+0x92>
mov    -0x10(%rbp),%eax
sub    $0xd,%eax
je     1306 <gaisler_device_str+0x206>
jmp    11a3 <gaisler_device_str+0xa3>
mov    -0x10(%rbp),%eax
sub    $0xe,%eax
je     1316 <gaisler_device_str+0x216>
jmp    11b4 <gaisler_device_str+0xb4>
mov    -0x10(%rbp),%eax
sub    $0x11,%eax
je     1326 <gaisler_device_str+0x226>
jmp    11c5 <gaisler_device_str+0xc5>
mov    -0x10(%rbp),%eax
sub    $0x12,%eax
je     1336 <gaisler_device_str+0x236>
jmp    11d6 <gaisler_device_str+0xd6>
mov    -0x10(%rbp),%eax
sub    $0x13,%eax
je     1346 <gaisler_device_str+0x246>
jmp    11e7 <gaisler_device_str+0xe7>
mov    -0x10(%rbp),%eax
sub    $0x14,%eax
je     1356 <gaisler_device_str+0x256>
jmp    11f8 <gaisler_device_str+0xf8>
mov    -0x10(%rbp),%eax
sub    $0x15,%eax
je     1366 <gaisler_device_str+0x266>
jmp    1209 <gaisler_device_str+0x109>
mov    -0x10(%rbp),%eax
sub    $0x17,%eax
je     1376 <gaisler_device_str+0x276>
jmp    121a <gaisler_device_str+0x11a>
mov    -0x10(%rbp),%eax
sub    $0x18,%eax
je     1386 <gaisler_device_str+0x286>
jmp    122b <gaisler_device_str+0x12b>
mov    -0x10(%rbp),%eax
sub    $0x1a,%eax
je     1396 <gaisler_device_str+0x296>
jmp    123c <gaisler_device_str+0x13c>
mov    -0x10(%rbp),%eax
sub    $0x1f,%eax
je     13a6 <gaisler_device_str+0x2a6>
jmp    124d <gaisler_device_str+0x14d>
mov    -0x10(%rbp),%eax
sub    $0xffd,%eax
je     13b6 <gaisler_device_str+0x2b6>
jmp    1260 <gaisler_device_str+0x160>
mov    -0x10(%rbp),%eax
sub    $0xffe,%eax
je     13c6 <gaisler_device_str+0x2c6>
jmp    1273 <gaisler_device_str+0x173>
mov    -0x10(%rbp),%eax
sub    $0xfff,%eax
je     13d6 <gaisler_device_str+0x2d6>
jmp    13e6 <gaisler_device_str+0x2e6>
lea    0xd73(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd71(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd72(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd71(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd70(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd70(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd6c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
lea    0xd68(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13f3 <gaisler_device_str+0x2f3>
jmp    13eb <gaisler_device_str+0x2eb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gaisler_device_str>:
cmp    $0xffc,%edi
jg     1133 <gaisler_device_str+0x33>
add    $0xfffffffd,%edi
cmp    $0x1c,%edi
ja     11f7 <gaisler_device_str+0xf7>
lea    0xf59(%rip),%rax
lea    0xede(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xf50(%rip),%rax
ret
cmp    $0xffd,%edi
je     11e7 <gaisler_device_str+0xe7>
cmp    $0xffe,%edi
je     11ef <gaisler_device_str+0xef>
cmp    $0xfff,%edi
jne    11f7 <gaisler_device_str+0xf7>
lea    0x105b(%rip),%rax
ret
lea    0xf2d(%rip),%rax
ret
lea    0xf34(%rip),%rax
ret
lea    0xf3b(%rip),%rax
ret
lea    0xf43(%rip),%rax
ret
lea    0xf4a(%rip),%rax
ret
lea    0xf51(%rip),%rax
ret
lea    0xf59(%rip),%rax
ret
lea    0xf5f(%rip),%rax
ret
lea    0xf66(%rip),%rax
ret
lea    0xf6e(%rip),%rax
ret
lea    0xf75(%rip),%rax
ret
lea    0xf7d(%rip),%rax
ret
lea    0xf85(%rip),%rax
ret
lea    0xf8e(%rip),%rax
ret
lea    0xf97(%rip),%rax
ret
lea    0xf9e(%rip),%rax
ret
lea    0xfa6(%rip),%rax
ret
lea    0xfb0(%rip),%rax
ret
lea    0xfb7(%rip),%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"GAISLER_LEON3\00"
@.str.1 = [17 x i8] c"GAISLER_LEON3DSU\00"
@.str.2 = [15 x i8] c"GAISLER_ETHAHB\00"
@.str.3 = [15 x i8] c"GAISLER_APBMST\00"
@.str.4 = [16 x i8] c"GAISLER_AHBUART\00"
@.str.5 = [15 x i8] c"GAISLER_SRCTRL\00"
@.str.6 = [15 x i8] c"GAISLER_SDCTRL\00"
@.str.7 = [16 x i8] c"GAISLER_APBUART\00"
@.str.8 = [14 x i8] c"GAISLER_IRQMP\00"
@.str.9 = [15 x i8] c"GAISLER_AHBRAM\00"
@.str.10 = [16 x i8] c"GAISLER_GPTIMER\00"
@.str.11 = [15 x i8] c"GAISLER_PCITRG\00"
@.str.12 = [16 x i8] c"GAISLER_PCISBRG\00"
@.str.13 = [16 x i8] c"GAISLER_PCIFBRG\00"
@.str.14 = [17 x i8] c"GAISLER_PCITRACE\00"
@.str.15 = [17 x i8] c"GAISLER_AHBTRACE\00"
@.str.16 = [15 x i8] c"GAISLER_ETHDSU\00"
@.str.17 = [16 x i8] c"GAISLER_PIOPORT\00"
@.str.18 = [18 x i8] c"GAISLER_SPACEWIRE\00"
@.str.19 = [15 x i8] c"GAISLER_L2TIME\00"
@.str.20 = [12 x i8] c"GAISLER_L2C\00"
@.str.21 = [17 x i8] c"GAISLER_PLUGPLAY\00"
define i8* @gaisler_device_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %27 [
i32 3, label %5
i32 4, label %6
i32 5, label %7
i32 6, label %8
i32 7, label %9
i32 8, label %10
i32 9, label %11
i32 12, label %12
i32 13, label %13
i32 14, label %14
i32 17, label %15
i32 18, label %16
i32 19, label %17
i32 20, label %18
i32 21, label %19
i32 23, label %20
i32 24, label %21
i32 26, label %22
i32 31, label %23
i32 4093, label %24
i32 4094, label %25
i32 4095, label %26
]
5: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
br label %29
6: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %29
7: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %29
8: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %29
9: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %29
10: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %29
11: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %29
12: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %29
13: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %29
14: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %29
15: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %29
16: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %29
17: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %29
18: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %29
19: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %29
20: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %29
21: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %29
22: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %29
23: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i8** %2
br label %29
24: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0), i8** %2
br label %29
25: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0), i8** %2
br label %29
26: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.21, i64 0, i64 0), i8** %2
br label %29
27: ; preds = %1
br label %28
28: ; preds = %27
store i8* null, i8** %2
br label %29
29: ; preds = %28, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%30 = load i8*, i8** %2
ret i8* %30
}

LLVM IR (-O2):
@.str = [14 x i8] c"GAISLER_LEON3\00"
@.str.1 = [17 x i8] c"GAISLER_LEON3DSU\00"
@.str.2 = [15 x i8] c"GAISLER_ETHAHB\00"
@.str.3 = [15 x i8] c"GAISLER_APBMST\00"
@.str.4 = [16 x i8] c"GAISLER_AHBUART\00"
@.str.5 = [15 x i8] c"GAISLER_SRCTRL\00"
@.str.6 = [15 x i8] c"GAISLER_SDCTRL\00"
@.str.7 = [16 x i8] c"GAISLER_APBUART\00"
@.str.8 = [14 x i8] c"GAISLER_IRQMP\00"
@.str.9 = [15 x i8] c"GAISLER_AHBRAM\00"
@.str.10 = [16 x i8] c"GAISLER_GPTIMER\00"
@.str.11 = [15 x i8] c"GAISLER_PCITRG\00"
@.str.12 = [16 x i8] c"GAISLER_PCISBRG\00"
@.str.13 = [16 x i8] c"GAISLER_PCIFBRG\00"
@.str.14 = [17 x i8] c"GAISLER_PCITRACE\00"
@.str.15 = [17 x i8] c"GAISLER_AHBTRACE\00"
@.str.16 = [15 x i8] c"GAISLER_ETHDSU\00"
@.str.17 = [16 x i8] c"GAISLER_PIOPORT\00"
@.str.18 = [18 x i8] c"GAISLER_SPACEWIRE\00"
@.str.19 = [15 x i8] c"GAISLER_L2TIME\00"
@.str.20 = [12 x i8] c"GAISLER_L2C\00"
@.str.21 = [17 x i8] c"GAISLER_PLUGPLAY\00"
define i8* @gaisler_device_str(i32 %0) {
switch i32 %0, label %23 [
i32 3, label %24
i32 4, label %2
i32 5, label %3
i32 6, label %4
i32 7, label %5
i32 8, label %6
i32 9, label %7
i32 12, label %8
i32 13, label %9
i32 14, label %10
i32 17, label %11
i32 18, label %12
i32 19, label %13
i32 20, label %14
i32 21, label %15
i32 23, label %16
i32 24, label %17
i32 26, label %18
i32 31, label %19
i32 4093, label %20
i32 4094, label %21
i32 4095, label %22
]
2: ; preds = %1
br label %24
3: ; preds = %1
br label %24
4: ; preds = %1
br label %24
5: ; preds = %1
br label %24
6: ; preds = %1
br label %24
7: ; preds = %1
br label %24
8: ; preds = %1
br label %24
9: ; preds = %1
br label %24
10: ; preds = %1
br label %24
11: ; preds = %1
br label %24
12: ; preds = %1
br label %24
13: ; preds = %1
br label %24
14: ; preds = %1
br label %24
15: ; preds = %1
br label %24
16: ; preds = %1
br label %24
17: ; preds = %1
br label %24
18: ; preds = %1
br label %24
19: ; preds = %1
br label %24
20: ; preds = %1
br label %24
21: ; preds = %1
br label %24
22: ; preds = %1
br label %24
23: ; preds = %1
br label %24
24: ; preds = %1, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%25 = phi i8* [ null, %23 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.21, i64 0, i64 0), %22 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0), %21 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0), %20 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), %19 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0), %18 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), %17 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), %16 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), %15 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %25
}