#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*/ snprintf(char *, int, char *);
void technology_get_sub_type_str(char *sub_type_str, int sub_type) {
  switch (sub_type) {
  case 4:
    snprintf(sub_type_str, 128, "NET");
    break;
  case 5:
    snprintf(sub_type_str, 128, "COM");
    break;
  case 6:
    snprintf(sub_type_str, 128, "SAT");
    break;
  case 7:
    snprintf(sub_type_str, 128, "SCI");
    break;
  case 8:
    snprintf(sub_type_str, 128, "SEC");
    break;
  case 9:
    snprintf(sub_type_str, 128, "PRD");
    break;
  case 10:
    snprintf(sub_type_str, 128, "ACO");
    break;
  case 11:
    snprintf(sub_type_str, 128, "VIS");
    break;
  case 12:
    snprintf(sub_type_str, 128, "THO");
    break;
  case 13:
    snprintf(sub_type_str, 128, "MOO");
    break;
  case 14:
    snprintf(sub_type_str, 128, "HAL");
    break;
  case 15:
    snprintf(sub_type_str, 128, "AHA");
    break;
  }
}


x86 assembly (clang, -O0):
<technology_get_sub_type_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffffc,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xb,%eax
ja     127b <technology_get_sub_type_str+0x16b>
mov    -0x18(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xed8(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xec2(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xeac(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xe96(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xe80(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xe6a(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xe54(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xe3e(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xe28(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xe12(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xdfc(%rip),%rdx
call   1030 <snprintf@plt>
jmp    127b <technology_get_sub_type_str+0x16b>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xde6(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<technology_get_sub_type_str>:
add    $0xfffffffc,%esi
cmp    $0xb,%esi
ja     1133 <technology_get_sub_type_str+0x23>
movslq %esi,%rax
lea    0xf0e(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
mov    $0x80,%esi
jmp    1030 <snprintf@plt>
ret

LLVM IR (-O0):
@.str = [4 x i8] c"NET\00"
@.str.1 = [4 x i8] c"COM\00"
@.str.2 = [4 x i8] c"SAT\00"
@.str.3 = [4 x i8] c"SCI\00"
@.str.4 = [4 x i8] c"SEC\00"
@.str.5 = [4 x i8] c"PRD\00"
@.str.6 = [4 x i8] c"ACO\00"
@.str.7 = [4 x i8] c"VIS\00"
@.str.8 = [4 x i8] c"THO\00"
@.str.9 = [4 x i8] c"MOO\00"
@.str.10 = [4 x i8] c"HAL\00"
@.str.11 = [4 x i8] c"AHA\00"
define void @technology_get_sub_type_str(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %42 [
i32 4, label %6
i32 5, label %9
i32 6, label %12
i32 7, label %15
i32 8, label %18
i32 9, label %21
i32 10, label %24
i32 11, label %27
i32 12, label %30
i32 13, label %33
i32 14, label %36
i32 15, label %39
]
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = call i32 @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %42
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @snprintf(i8* %10, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %42
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i32 @snprintf(i8* %13, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %42
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = call i32 @snprintf(i8* %16, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %42
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = call i32 @snprintf(i8* %19, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %42
21: ; preds = %2
%22 = load i8*, i8** %3
%23 = call i32 @snprintf(i8* %22, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %42
24: ; preds = %2
%25 = load i8*, i8** %3
%26 = call i32 @snprintf(i8* %25, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %42
27: ; preds = %2
%28 = load i8*, i8** %3
%29 = call i32 @snprintf(i8* %28, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %42
30: ; preds = %2
%31 = load i8*, i8** %3
%32 = call i32 @snprintf(i8* %31, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %42
33: ; preds = %2
%34 = load i8*, i8** %3
%35 = call i32 @snprintf(i8* %34, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %42
36: ; preds = %2
%37 = load i8*, i8** %3
%38 = call i32 @snprintf(i8* %37, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
br label %42
39: ; preds = %2
%40 = load i8*, i8** %3
%41 = call i32 @snprintf(i8* %40, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %42
42: ; preds = %2, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"NET\00"
@.str.1 = [4 x i8] c"COM\00"
@.str.2 = [4 x i8] c"SAT\00"
@.str.3 = [4 x i8] c"SCI\00"
@.str.4 = [4 x i8] c"SEC\00"
@.str.5 = [4 x i8] c"PRD\00"
@.str.6 = [4 x i8] c"ACO\00"
@.str.7 = [4 x i8] c"VIS\00"
@.str.8 = [4 x i8] c"THO\00"
@.str.9 = [4 x i8] c"MOO\00"
@.str.10 = [4 x i8] c"HAL\00"
@.str.11 = [4 x i8] c"AHA\00"
@reltable.technology_get_sub_type_str = [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.9 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([12 x i32]* @reltable.technology_get_sub_type_str to i64)) to i32)]
define void @technology_get_sub_type_str(i8* %0, i32 %1) {
%3 = add i32 %1, -4
%4 = icmp ult i32 %3, 12
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.technology_get_sub_type_str to i8*), i64 %7)
%9 = tail call i32 @snprintf(i8* %0, i32 128, i8* %8)
br label %10
10: ; preds = %2, %5
ret void
}