#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_type_str(char *type_str, int type) {
  switch (type) {
  case 0:
    snprintf(type_str, 128, "Hardware");
    break;
  case 1:
    snprintf(type_str, 128, "Software");
    break;
  case 2:
    snprintf(type_str, 128, "Ads");
    break;
  case 3:
    snprintf(type_str, 128, "Drugs");
    break;
  }
}


x86 assembly (clang, -O0):
<technology_get_type_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x3,%rax
ja     11a7 <technology_get_type_str+0x97>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xebc(%rip),%rdx
call   1030 <snprintf@plt>
jmp    11a7 <technology_get_type_str+0x97>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xeab(%rip),%rdx
call   1030 <snprintf@plt>
jmp    11a7 <technology_get_type_str+0x97>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xe9a(%rip),%rdx
call   1030 <snprintf@plt>
jmp    11a7 <technology_get_type_str+0x97>
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xe84(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<technology_get_type_str>:
cmp    $0x3,%esi
ja     1130 <technology_get_type_str+0x20>
movslq %esi,%rax
lea    0xefd(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
mov    $0x80,%esi
jmp    1030 <snprintf@plt>
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Hardware\00"
@.str.1 = [9 x i8] c"Software\00"
@.str.2 = [4 x i8] c"Ads\00"
@.str.3 = [6 x i8] c"Drugs\00"
define void @technology_get_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 %18 [
i32 0, label %6
i32 1, label %9
i32 2, label %12
i32 3, label %15
]
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = call i32 @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %18
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @snprintf(i8* %10, i32 128, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %18
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 %18
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = call i32 @snprintf(i8* %16, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %2, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Hardware\00"
@.str.1 = [9 x i8] c"Software\00"
@.str.2 = [4 x i8] c"Ads\00"
@.str.3 = [6 x i8] c"Drugs\00"
@reltable.technology_get_type_str = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.technology_get_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.technology_get_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.technology_get_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.technology_get_type_str to i64)) to i32)]
define void @technology_get_type_str(i8* %0, i32 %1) {
%3 = icmp ult i32 %1, 4
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = sext i32 %1 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.technology_get_type_str to i8*), i64 %6)
%8 = tail call i32 @snprintf(i8* %0, i32 128, i8* %7)
br label %9
9: ; preds = %2, %4
ret void
}