#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
int /*<<< orphan*/ stderr;
unsigned getRegionOffset(char region) {
  switch (region) {
  case 'E':
    return 0xDE160;
  case 'J':
    return 0x1076A0;
  case 'S':
    return 0xE42C0;
  case 'U':
    return 0x108A10;
  default:
    fprintf(stderr, "Unknown region: '%c'\n", region);
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<getRegionOffset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffbb,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x10,%eax
ja     1188 <getRegionOffset+0x68>
mov    -0x10(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xde160,-0x4(%rbp)
jmp    11ab <getRegionOffset+0x8b>
movl   $0x1076a0,-0x4(%rbp)
jmp    11ab <getRegionOffset+0x8b>
movl   $0xe42c0,-0x4(%rbp)
jmp    11ab <getRegionOffset+0x8b>
movl   $0x108a10,-0x4(%rbp)
jmp    11ab <getRegionOffset+0x8b>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
movsbl -0x5(%rbp),%edx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRegionOffset>:
push   %rax
lea    -0x45(%rdi),%ecx
cmp    $0x10,%ecx
ja     1153 <getRegionOffset+0x33>
mov    $0xde160,%eax
lea    0xecb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x1076a0,%eax
pop    %rcx
ret
mov    $0xe42c0,%eax
pop    %rcx
ret
mov    $0x108a10,%eax
pop    %rcx
ret
mov    0x2e86(%rip),%rax
mov    (%rax),%eax
movsbl %dil,%edx
lea    0xedd(%rip),%rsi
mov    %eax,%edi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Unknown region: '%c'\0A\00"
define i32 @getRegionOffset(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %10 [
i32 69, label %6
i32 74, label %7
i32 83, label %8
i32 85, label %9
]
6: ; preds = %1
store i32 909664, i32* %2
br label %15
7: ; preds = %1
store i32 1078944, i32* %2
br label %15
8: ; preds = %1
store i32 934592, i32* %2
br label %15
9: ; preds = %1
store i32 1083920, i32* %2
br label %15
10: ; preds = %1
%11 = load i32, i32* @stderr
%12 = load i8, i8* %3
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8 signext %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %9, %8, %7, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Unknown region: '%c'\0A\00"
define i32 @getRegionOffset(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %6 [
i32 69, label %10
i32 74, label %3
i32 83, label %4
i32 85, label %5
]
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %1, %5, %4, %3
%11 = phi i32 [ 1083920, %5 ], [ 934592, %4 ], [ 1078944, %3 ], [ 909664, %1 ]
ret i32 %11
}