char *_get_snes_rom_mode(int mode) {
  if (mode == 0)
    return "\"LoROM\"";
  else if (mode == 2)
    return "\"HiROM\"";
  else if (mode == 32)
    return "\"ExHiROM\"";
  else if (mode == 64)
    return "\"ExLoROM\"";
  else
    return "\"???\"";
}


x86 assembly (clang, -O0):
<_get_snes_rom_mode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1121 <_get_snes_rom_mode+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <_get_snes_rom_mode+0x7a>
cmpl   $0x2,-0xc(%rbp)
jne    113b <_get_snes_rom_mode+0x3b>
lea    0xed6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <_get_snes_rom_mode+0x7a>
cmpl   $0x20,-0xc(%rbp)
jne    1155 <_get_snes_rom_mode+0x55>
lea    0xec4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <_get_snes_rom_mode+0x7a>
cmpl   $0x40,-0xc(%rbp)
jne    116f <_get_snes_rom_mode+0x6f>
lea    0xeb4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <_get_snes_rom_mode+0x7a>
lea    0xeae(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_get_snes_rom_mode>:
cmp    $0x1f,%edi
jg     1116 <_get_snes_rom_mode+0x16>
test   %edi,%edi
je     1130 <_get_snes_rom_mode+0x30>
cmp    $0x2,%edi
jne    1128 <_get_snes_rom_mode+0x28>
lea    0xef3(%rip),%rax
ret
cmp    $0x20,%edi
je     1138 <_get_snes_rom_mode+0x38>
cmp    $0x40,%edi
jne    1128 <_get_snes_rom_mode+0x28>
lea    0xef3(%rip),%rax
ret
lea    0xef5(%rip),%rax
ret
lea    0xec9(%rip),%rax
ret
lea    0xed1(%rip),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\22LoROM\22\00"
@.str.1 = [8 x i8] c"\22HiROM\22\00"
@.str.2 = [10 x i8] c"\22ExHiROM\22\00"
@.str.3 = [10 x i8] c"\22ExLoROM\22\00"
@.str.4 = [6 x i8] c"\22???\22\00"
define i8* @_get_snes_rom_mode(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %20
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %7
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %20
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 32
br i1 %13, label %14, label %15
14: ; preds = %11
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %20
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 64
br i1 %17, label %18, label %19
18: ; preds = %15
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %20
19: ; preds = %15
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %20
20: ; preds = %19, %18, %14, %10, %6
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [8 x i8] c"\22LoROM\22\00"
@.str.1 = [8 x i8] c"\22HiROM\22\00"
@.str.2 = [10 x i8] c"\22ExHiROM\22\00"
@.str.3 = [10 x i8] c"\22ExLoROM\22\00"
@.str.4 = [6 x i8] c"\22???\22\00"
define i8* @_get_snes_rom_mode(i32 %0) {
switch i32 %0, label %5 [
i32 0, label %6
i32 2, label %2
i32 32, label %3
i32 64, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3, %2
%7 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %7
}