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

/* Variables and functions */
char *sb_getmode_s(int n) {
  static char *mode_s[] = {"slowmo SP",
                           "slowmo DMSP",
                           "demo",
                           "SP",
                           "DMSP",
                           "ffa/default",
                           "coopedit",
                           "ffa/duel",
                           "teamplay",
                           "instagib",
                           "instagib team",
                           "efficiency",
                           "efficiency team",
                           "insta arena",
                           "insta clan arena",
                           "tactics arena",
                           "tactics clan arena",
                           "capture",
                           "insta capture",
                           "regen capture",
                           "assassin",
                           "insta assassin",
                           "ctf",
                           "insta ctf"};
  n += 6;
  if (n >= 0 && (size_t)n < sizeof(mode_s) / sizeof(mode_s[0])) {
    return mode_s[n];
  }
  return "unknown";
}


x86 assembly (clang, -O0):
<sb_getmode_s>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1140 <sb_getmode_s+0x40>
movslq -0xc(%rbp),%rax
cmp    $0x18,%rax
jae    1140 <sb_getmode_s+0x40>
movslq -0xc(%rbp),%rcx
lea    0x2efd(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    114b <sb_getmode_s+0x4b>
lea    0xfa0(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sb_getmode_s>:
lea    0x1040(%rip),%rax
cmp    $0xfffffffa,%edi
jl     1124 <sb_getmode_s+0x24>
add    $0x6,%edi
cmp    $0x17,%edi
ja     1124 <sb_getmode_s+0x24>
mov    %edi,%eax
lea    0xee3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@sb_getmode_s.mode_s = internal global [24 x i8*] [i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.23, i32 0, i32 0)]
@.str = [10 x i8] c"slowmo SP\00"
@.str.1 = [12 x i8] c"slowmo DMSP\00"
@.str.2 = [5 x i8] c"demo\00"
@.str.3 = [3 x i8] c"SP\00"
@.str.4 = [5 x i8] c"DMSP\00"
@.str.5 = [12 x i8] c"ffa/default\00"
@.str.6 = [9 x i8] c"coopedit\00"
@.str.7 = [9 x i8] c"ffa/duel\00"
@.str.8 = [9 x i8] c"teamplay\00"
@.str.9 = [9 x i8] c"instagib\00"
@.str.10 = [14 x i8] c"instagib team\00"
@.str.11 = [11 x i8] c"efficiency\00"
@.str.12 = [16 x i8] c"efficiency team\00"
@.str.13 = [12 x i8] c"insta arena\00"
@.str.14 = [17 x i8] c"insta clan arena\00"
@.str.15 = [14 x i8] c"tactics arena\00"
@.str.16 = [19 x i8] c"tactics clan arena\00"
@.str.17 = [8 x i8] c"capture\00"
@.str.18 = [14 x i8] c"insta capture\00"
@.str.19 = [14 x i8] c"regen capture\00"
@.str.20 = [9 x i8] c"assassin\00"
@.str.21 = [15 x i8] c"insta assassin\00"
@.str.22 = [4 x i8] c"ctf\00"
@.str.23 = [10 x i8] c"insta ctf\00"
@.str.24 = [8 x i8] c"unknown\00"
define i8* @sb_getmode_s(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 6
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, 24
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [24 x i8*], [24 x i8*]* @sb_getmode_s.mode_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.24, 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_getmode_s = internal unnamed_addr constant [24 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.1 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.5 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.8 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.9 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.10 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.12 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.13 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.14 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.15 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.16 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.17 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.18 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.19 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.20 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.21 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.22 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.23 to i64), i64 ptrtoint ([24 x i32]* @reltable.sb_getmode_s to i64)) to i32)]
@.str = [10 x i8] c"slowmo SP\00"
@.str.1 = [12 x i8] c"slowmo DMSP\00"
@.str.2 = [5 x i8] c"demo\00"
@.str.3 = [3 x i8] c"SP\00"
@.str.4 = [5 x i8] c"DMSP\00"
@.str.5 = [12 x i8] c"ffa/default\00"
@.str.6 = [9 x i8] c"coopedit\00"
@.str.7 = [9 x i8] c"ffa/duel\00"
@.str.8 = [9 x i8] c"teamplay\00"
@.str.9 = [9 x i8] c"instagib\00"
@.str.10 = [14 x i8] c"instagib team\00"
@.str.11 = [11 x i8] c"efficiency\00"
@.str.12 = [16 x i8] c"efficiency team\00"
@.str.13 = [12 x i8] c"insta arena\00"
@.str.14 = [17 x i8] c"insta clan arena\00"
@.str.15 = [14 x i8] c"tactics arena\00"
@.str.16 = [19 x i8] c"tactics clan arena\00"
@.str.17 = [8 x i8] c"capture\00"
@.str.18 = [14 x i8] c"insta capture\00"
@.str.19 = [14 x i8] c"regen capture\00"
@.str.20 = [9 x i8] c"assassin\00"
@.str.21 = [15 x i8] c"insta assassin\00"
@.str.22 = [4 x i8] c"ctf\00"
@.str.23 = [10 x i8] c"insta ctf\00"
@.str.24 = [8 x i8] c"unknown\00"
define i8* @sb_getmode_s(i32 %0) {
%2 = add nsw i32 %0, 6
%3 = icmp sgt i32 %0, -7
%4 = icmp ult i32 %2, 24
%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 ([24 x i32]* @reltable.sb_getmode_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.24, i64 0, i64 0), %1 ]
ret i8* %11
}