const char *ramtype2str(int type) {
  switch (type) {
  case 0:
  case ((5 << 8) | 0):
  case ((1 << 8) | 0):
    return ".srm";
  case 1:
  case ((6 << 8) | 1):
    return ".rtc";
  case ((2 << 8) | 0):
    return ".pram";
  case ((3 << 8) | 0):
    return ".aram";
  case ((4 << 8) | 0):
    return ".bram";
  default:
    return "";
  }
}


x86 assembly (clang, -O0):
<ramtype2str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     119d <ramtype2str+0x9d>
jmp    111a <ramtype2str+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     11ad <ramtype2str+0xad>
jmp    112b <ramtype2str+0x2b>
mov    -0x10(%rbp),%eax
sub    $0x100,%eax
je     119d <ramtype2str+0x9d>
jmp    113e <ramtype2str+0x3e>
mov    -0x10(%rbp),%eax
sub    $0x200,%eax
je     11bd <ramtype2str+0xbd>
jmp    1151 <ramtype2str+0x51>
mov    -0x10(%rbp),%eax
sub    $0x300,%eax
je     11cd <ramtype2str+0xcd>
jmp    1164 <ramtype2str+0x64>
mov    -0x10(%rbp),%eax
sub    $0x400,%eax
je     11dd <ramtype2str+0xdd>
jmp    1177 <ramtype2str+0x77>
mov    -0x10(%rbp),%eax
sub    $0x500,%eax
je     119d <ramtype2str+0x9d>
jmp    118a <ramtype2str+0x8a>
mov    -0x10(%rbp),%eax
sub    $0x601,%eax
je     11ad <ramtype2str+0xad>
jmp    11ed <ramtype2str+0xed>
lea    0xe5c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <ramtype2str+0xf8>
lea    0xe51(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <ramtype2str+0xf8>
lea    0xe46(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <ramtype2str+0xf8>
lea    0xe3c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <ramtype2str+0xf8>
lea    0xe32(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <ramtype2str+0xf8>
lea    0xe15(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ramtype2str>:
lea    0xef9(%rip),%rax
cmp    $0x2ff,%edi
jg     1122 <ramtype2str+0x22>
cmp    $0xff,%edi
jg     1142 <ramtype2str+0x42>
test   %edi,%edi
je     1179 <ramtype2str+0x79>
cmp    $0x1,%edi
je     116a <ramtype2str+0x6a>
jmp    117a <ramtype2str+0x7a>
cmp    $0x4ff,%edi
jg     115a <ramtype2str+0x5a>
cmp    $0x300,%edi
je     1172 <ramtype2str+0x72>
cmp    $0x400,%edi
jne    117a <ramtype2str+0x7a>
lea    0xed5(%rip),%rax
ret
cmp    $0x100,%edi
je     1179 <ramtype2str+0x79>
cmp    $0x200,%edi
jne    117a <ramtype2str+0x7a>
lea    0xeb1(%rip),%rax
ret
cmp    $0x500,%edi
je     1179 <ramtype2str+0x79>
cmp    $0x601,%edi
jne    117a <ramtype2str+0x7a>
lea    0xe94(%rip),%rax
ret
lea    0xe97(%rip),%rax
ret
lea    0xe88(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c".srm\00"
@.str.1 = [5 x i8] c".rtc\00"
@.str.2 = [6 x i8] c".pram\00"
@.str.3 = [6 x i8] c".aram\00"
@.str.4 = [6 x i8] c".bram\00"
@.str.5 = [1 x i8] zeroinitializer
define i8* @ramtype2str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %10 [
i32 0, label %5
i32 1280, label %5
i32 256, label %5
i32 1, label %6
i32 1537, label %6
i32 512, label %7
i32 768, label %8
i32 1024, label %9
]
5: ; preds = %1, %1, %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %11
6: ; preds = %1, %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %11
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %11
8: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %11
9: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %11
10: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %11
11: ; preds = %10, %9, %8, %7, %6, %5
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
@.str = [5 x i8] c".srm\00"
@.str.1 = [5 x i8] c".rtc\00"
@.str.2 = [6 x i8] c".pram\00"
@.str.3 = [6 x i8] c".aram\00"
@.str.4 = [6 x i8] c".bram\00"
@.str.5 = [1 x i8] zeroinitializer
define i8* @ramtype2str(i32 %0) {
switch i32 %0, label %6 [
i32 0, label %7
i32 1280, label %7
i32 256, label %7
i32 1, label %2
i32 1537, label %2
i32 512, label %3
i32 768, label %4
i32 1024, label %5
]
2: ; preds = %1, %1
br label %7
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %1, %1, %6, %5, %4, %3, %2
%8 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 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 ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %8
}