#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*/ sprintf(char *, char *);
void get_category_str(char *output, int category_id) {
  if (category_id == 1) {
    sprintf(output, "Books and proceedings");
  } else if (category_id == 2) {
    sprintf(output, "Thesis");
  } else if (category_id == 3) {
    sprintf(output, "Articles in journal or book's chapters");
  } else if (category_id == 4) {
    sprintf(output, "Conference articles");
  } else if (category_id == 5) {
    sprintf(output, "Internal reports");
  } else if (category_id == 6) {
    sprintf(output, "Manuals, booklets");
  } else if (category_id == 7) {
    sprintf(output, "Miscellaneous");
  }
}


x86 assembly (clang, -O0):
<get_category_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    113e <get_category_str+0x2e>
mov    -0x8(%rbp),%rdi
lea    0xecc(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1211 <get_category_str+0x101>
cmpl   $0x2,-0xc(%rbp)
jne    115d <get_category_str+0x4d>
mov    -0x8(%rbp),%rdi
lea    0xec3(%rip),%rsi
call   1030 <sprintf@plt>
jmp    120c <get_category_str+0xfc>
cmpl   $0x3,-0xc(%rbp)
jne    117c <get_category_str+0x6c>
mov    -0x8(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1207 <get_category_str+0xf7>
cmpl   $0x4,-0xc(%rbp)
jne    119b <get_category_str+0x8b>
mov    -0x8(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1202 <get_category_str+0xf2>
cmpl   $0x5,-0xc(%rbp)
jne    11ba <get_category_str+0xaa>
mov    -0x8(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11fd <get_category_str+0xed>
cmpl   $0x6,-0xc(%rbp)
jne    11d9 <get_category_str+0xc9>
mov    -0x8(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11f8 <get_category_str+0xe8>
cmpl   $0x7,-0xc(%rbp)
jne    11f3 <get_category_str+0xe3>
mov    -0x8(%rbp),%rdi
lea    0xe8d(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11f8 <get_category_str+0xe8>
jmp    11fd <get_category_str+0xed>
jmp    1202 <get_category_str+0xf2>
jmp    1207 <get_category_str+0xf7>
jmp    120c <get_category_str+0xfc>
jmp    1211 <get_category_str+0x101>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_category_str>:
add    $0xffffffff,%esi
cmp    $0x6,%esi
ja     11b4 <get_category_str+0xb4>
lea    0xeed(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movups 0xef9(%rip),%xmm0
movups %xmm0,(%rdi)
movabs $0x73676e69646565,%rax
mov    %rax,0xe(%rdi)
ret
movl   $0x736973,0x3(%rdi)
movl   $0x73656854,(%rdi)
ret
movups 0xeff(%rip),%xmm0
movups %xmm0,0x10(%rdi)
movups 0xee4(%rip),%xmm0
movups %xmm0,(%rdi)
movabs $0x73726574706168,%rax
mov    %rax,0x1f(%rdi)
ret
movups 0xef2(%rip),%xmm0
movups %xmm0,(%rdi)
movl   $0x73656c,0x10(%rdi)
ret
movups 0xef4(%rip),%xmm0
movups %xmm0,(%rdi)
movb   $0x0,0x10(%rdi)
ret
movups 0xef6(%rip),%xmm0
movups %xmm0,(%rdi)
movw   $0x73,0x10(%rdi)
ret
movabs $0x73756f656e616c,%rax
mov    %rax,0x6(%rdi)
movabs $0x616c6c656373694d,%rax
6c 6c 61
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Books and proceedings\00"
@.str.1 = [7 x i8] c"Thesis\00"
@.str.2 = [39 x i8] c"Articles in journal or book's chapters\00"
@.str.3 = [20 x i8] c"Conference articles\00"
@.str.4 = [17 x i8] c"Internal reports\00"
@.str.5 = [18 x i8] c"Manuals, booklets\00"
@.str.6 = [14 x i8] c"Miscellaneous\00"
define void @get_category_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
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %52
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %51
16: ; preds = %10
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 3
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i8*, i8** %3
%21 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %50
22: ; preds = %16
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 4
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i8*, i8** %3
%27 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %49
28: ; preds = %22
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 5
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i8*, i8** %3
%33 = call i32 @sprintf(i8* %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %48
34: ; preds = %28
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 6
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i8*, i8** %3
%39 = call i32 @sprintf(i8* %38, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %47
40: ; preds = %34
%41 = load i32, i32* %4
%42 = icmp eq i32 %41, 7
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i8*, i8** %3
%45 = call i32 @sprintf(i8* %44, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
br label %46
46: ; preds = %43, %40
br label %47
47: ; preds = %46, %37
br label %48
48: ; preds = %47, %31
br label %49
49: ; preds = %48, %25
br label %50
50: ; preds = %49, %19
br label %51
51: ; preds = %50, %13
br label %52
52: ; preds = %51, %7
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Books and proceedings\00"
@.str.1 = [7 x i8] c"Thesis\00"
@.str.2 = [39 x i8] c"Articles in journal or book's chapters\00"
@.str.3 = [20 x i8] c"Conference articles\00"
@.str.4 = [17 x i8] c"Internal reports\00"
@.str.5 = [18 x i8] c"Manuals, booklets\00"
@.str.6 = [14 x i8] c"Miscellaneous\00"
define void @get_category_str(i8* nocapture writeonly %0, i32 %1) {
switch i32 %1, label %10 [
i32 1, label %3
i32 2, label %4
i32 3, label %5
i32 4, label %6
i32 5, label %7
i32 6, label %8
i32 7, label %9
]
3: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(22) %0, i8* align 1 dereferenceable(22) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64 22, i1 false)
br label %10
4: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(7) %0, i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 7, i1 false)
br label %10
5: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(39) %0, i8* align 1 dereferenceable(39) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i64 39, i1 false)
br label %10
6: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(20) %0, i8* align 1 dereferenceable(20) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i64 20, i1 false)
br label %10
7: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(17) %0, i8* align 1 dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i64 17, i1 false)
br label %10
8: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(18) %0, i8* align 1 dereferenceable(18) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 18, i1 false)
br label %10
9: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(14) %0, i8* align 1 dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i64 14, i1 false)
br label %10
10: ; preds = %2, %4, %6, %8, %9, %7, %5, %3
ret void
}