#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 /*<<< orphan*/ version_s;

/* Variables and functions */
char *sb_getversion_s(int n) {
  static char *version_s[] = {
      "Justice", "CTF",       "Assassin", "Summer",    "Spring",      "Gui",
      "Water",   "Normalmap", "Sp",       "Occlusion", "Shader",      "Physics",
      "Mp",      "",          "Agc",      "Quakecon",  "Independence"};
  n = 258 - n;
  if (n >= 0 && (size_t)n < sizeof(version_s) / sizeof(version_s[0])) {
    return version_s[n];
  }
  return "unknown";
}


x86 assembly (clang, -O0):
<sb_getversion_s>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    $0x102,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1142 <sb_getversion_s+0x42>
movslq -0xc(%rbp),%rax
cmp    $0x11,%rax
jae    1142 <sb_getversion_s+0x42>
movslq -0xc(%rbp),%rcx
lea    0x2efb(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    114d <sb_getversion_s+0x4d>
lea    0xf27(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sb_getversion_s>:
lea    0xfad(%rip),%rax
sub    $0x102,%edi
jg     1126 <sb_getversion_s+0x26>
neg    %edi
cmp    $0x10,%edi
ja     1126 <sb_getversion_s+0x26>
mov    %edi,%eax
lea    0xee1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@sb_getversion_s.version_s = internal global [17 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i32 0, i32 0)]
@.str = [8 x i8] c"Justice\00"
@.str.1 = [4 x i8] c"CTF\00"
@.str.2 = [9 x i8] c"Assassin\00"
@.str.3 = [7 x i8] c"Summer\00"
@.str.4 = [7 x i8] c"Spring\00"
@.str.5 = [4 x i8] c"Gui\00"
@.str.6 = [6 x i8] c"Water\00"
@.str.7 = [10 x i8] c"Normalmap\00"
@.str.8 = [3 x i8] c"Sp\00"
@.str.9 = [10 x i8] c"Occlusion\00"
@.str.10 = [7 x i8] c"Shader\00"
@.str.11 = [8 x i8] c"Physics\00"
@.str.12 = [3 x i8] c"Mp\00"
@.str.13 = [1 x i8] zeroinitializer
@.str.14 = [4 x i8] c"Agc\00"
@.str.15 = [9 x i8] c"Quakecon\00"
@.str.16 = [13 x i8] c"Independence\00"
@.str.17 = [8 x i8] c"unknown\00"
define i8* @sb_getversion_s(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = sub nsw i32 258, %4
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 17
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [17 x i8*], [17 x i8*]* @sb_getversion_s.version_s, i64 0, i64 %14
%16 = load i8*, i8** %15
store i8* %16, i8** %2
br label %18
17: ; preds = %8, %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %18
18: ; preds = %17, %12
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@reltable.sb_getversion_s = internal unnamed_addr constant [17 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.6 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.7 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.8 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.9 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.10 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.11 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.12 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.13 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.14 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.15 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.16 to i64), i64 ptrtoint ([17 x i32]* @reltable.sb_getversion_s to i64)) to i32)]
@.str = [8 x i8] c"Justice\00"
@.str.1 = [4 x i8] c"CTF\00"
@.str.2 = [9 x i8] c"Assassin\00"
@.str.3 = [7 x i8] c"Summer\00"
@.str.4 = [7 x i8] c"Spring\00"
@.str.5 = [4 x i8] c"Gui\00"
@.str.6 = [6 x i8] c"Water\00"
@.str.7 = [10 x i8] c"Normalmap\00"
@.str.8 = [3 x i8] c"Sp\00"
@.str.9 = [10 x i8] c"Occlusion\00"
@.str.10 = [7 x i8] c"Shader\00"
@.str.11 = [8 x i8] c"Physics\00"
@.str.12 = [3 x i8] c"Mp\00"
@.str.13 = [1 x i8] zeroinitializer
@.str.14 = [4 x i8] c"Agc\00"
@.str.15 = [9 x i8] c"Quakecon\00"
@.str.16 = [13 x i8] c"Independence\00"
@.str.17 = [8 x i8] c"unknown\00"
define i8* @sb_getversion_s(i32 %0) {
%2 = sub nsw i32 258, %0
%3 = icmp slt i32 %0, 259
%4 = icmp ult i32 %2, 17
%5 = select i1 %3, i1 %4, i1 false
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = zext i32 %2 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([17 x i32]* @reltable.sb_getversion_s to i8*), i64 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), %1 ]
ret i8* %11
}