parseTypeCodeToString(char *to, const char from) {
  switch (from) {
  case '1': {
    strcpy(to, "973 Program");
    break;
  }
  case '2': {
    strcpy(to, "NSFC");
    break;
  }
  case '3': {
    strcpy(to, "863 Program");
    break;
  }
  case '4': {
    strcpy(to, "International Cooperation");
    break;
  }
  case '5': {
    strcpy(to, "Transverse");
    break;
  }
  default: {
    strcpy(to, "---");
    break;
  }
  }
  return to;
}


x86 assembly (clang, -O0):
<parseTypeCodeToString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     11b5 <parseTypeCodeToString+0xa5>
mov    -0x18(%rbp),%rax
lea    0xebd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11c5 <parseTypeCodeToString+0xb5>
mov    -0x8(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11c5 <parseTypeCodeToString+0xb5>
mov    -0x8(%rbp),%rdi
lea    0xea4(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11c5 <parseTypeCodeToString+0xb5>
mov    -0x8(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11c5 <parseTypeCodeToString+0xb5>
mov    -0x8(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11c5 <parseTypeCodeToString+0xb5>
mov    -0x8(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseTypeCodeToString>:
mov    %rdi,%rax
add    $0xffffffcf,%esi
cmp    $0x4,%esi
ja     1127 <parseTypeCodeToString+0x27>
lea    0xeee(%rip),%rcx
movslq (%rcx,%rsi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
movabs $0x676f725020333739,%rcx
72 6f 67
jmp    1143 <parseTypeCodeToString+0x43>
movl   $0x2d2d2d,(%rax)
ret
movb   $0x0,0x4(%rax)
movl   $0x4346534e,(%rax)
ret
movabs $0x676f725020333638,%rcx
72 6f 67
mov    %rcx,(%rax)
movl   $0x6d6172,0x8(%rax)
ret
movups 0xee6(%rip),%xmm0
movups %xmm0,0xa(%rax)
movups 0xed1(%rip),%xmm0
movups %xmm0,(%rax)
ret
movabs $0x726576736e617254,%rcx
76 65 72
mov    %rcx,(%rax)
movl   $0x657372,0x7(%rax)
ret

LLVM IR (-O0):
@.str = [12 x i8] c"973 Program\00"
@.str.1 = [5 x i8] c"NSFC\00"
@.str.2 = [12 x i8] c"863 Program\00"
@.str.3 = [26 x i8] c"International Cooperation\00"
@.str.4 = [11 x i8] c"Transverse\00"
@.str.5 = [4 x i8] c"---\00"
define i32 @parseTypeCodeToString(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %22 [
i32 49, label %7
i32 50, label %10
i32 51, label %13
i32 52, label %16
i32 53, label %19
]
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i8* @strcpy(i8* %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %25
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i8* @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %25
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = call i8* @strcpy(i8* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %25
16: ; preds = %2
%17 = load i8*, i8** %3
%18 = call i8* @strcpy(i8* %17, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %25
19: ; preds = %2
%20 = load i8*, i8** %3
%21 = call i8* @strcpy(i8* %20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %25
22: ; preds = %2
%23 = load i8*, i8** %3
%24 = call i8* @strcpy(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %25
25: ; preds = %22, %19, %16, %13, %10, %7
%26 = load i8*, i8** %3
%27 = ptrtoint i8* %26 to i32
ret i32 %27
}

LLVM IR (-O2):
@.str = [12 x i8] c"973 Program\00"
@.str.1 = [5 x i8] c"NSFC\00"
@.str.2 = [12 x i8] c"863 Program\00"
@.str.3 = [26 x i8] c"International Cooperation\00"
@.str.4 = [11 x i8] c"Transverse\00"
define i32 @parseTypeCodeToString(i8* %0, i8 signext %1) {
%3 = sext i8 %1 to i32
switch i32 %3, label %9 [
i32 49, label %4
i32 50, label %5
i32 51, label %6
i32 52, label %7
i32 53, label %8
]
4: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(12) %0, i8* align 1 dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 12, i1 false)
br label %11
5: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %0, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 5, i1 false)
br label %11
6: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(12) %0, i8* align 1 dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64 12, i1 false)
br label %11
7: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(26) %0, i8* align 1 dereferenceable(26) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 26, i1 false)
br label %11
8: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(11) %0, i8* align 1 dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i64 11, i1 false)
br label %11
9: ; preds = %2
%10 = bitcast i8* %0 to i32*
store i32 2960685, i32* %10
br label %11
11: ; preds = %9, %8, %7, %6, %5, %4
%12 = ptrtoint i8* %0 to i64
%13 = trunc i64 %12 to i32
ret i32 %13
}