char *special_key_str(key)
int key;
{
  static char tbuf[40];
  char *s;
  char *sp = tbuf;
  switch (key) {
  case 1:
    s = ltgetstr("kr", &sp);
    break;
  case 2:
    s = ltgetstr("kl", &sp);
    break;
  case 3:
    s = ltgetstr("ku", &sp);
    break;
  case 4:
    s = ltgetstr("kd", &sp);
    break;
  case 5:
    s = ltgetstr("kP", &sp);
    break;
  case 6:
    s = ltgetstr("kN", &sp);
    break;
  case 7:
    s = ltgetstr("kh", &sp);
    break;
  case 8:
    s = ltgetstr("@7", &sp);
    break;
  case 9:
    s = ltgetstr("kD", &sp);
    if (s == 0) {
      tbuf[0] = '\177';
      tbuf[1] = '\0';
      s = tbuf;
    }
    break;
  case 40:
    tbuf[0] = (('K') & 037);
    tbuf[1] = '\0';
    s = tbuf;
    break;
  default:
    return (0);
  }
  return (s);
}


x86 assembly (clang, -O0):
<special_key_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
lea    0x2f1e(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x27,%eax
ja     1296 <special_key_str+0x186>
mov    -0x28(%rbp),%rax
lea    0xeba(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf4a(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ltgetstr@plt>
cltq
mov    %rax,-0x18(%rbp)
jmp    12a3 <special_key_str+0x193>
lea    0xf30(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ltgetstr@plt>
cltq
mov    %rax,-0x18(%rbp)
jmp    12a3 <special_key_str+0x193>
lea    0xf16(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ltgetstr@plt>
cltq
mov    %rax,-0x18(%rbp)
jmp    12a3 <special_key_str+0x193>
lea    0xefc(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ltgetstr@plt>
cltq
mov    %rax,-0x18(%rbp)
jmp    12a3 <special_key_str+0x193>
lea    0xee2(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ltgetstr@plt>
cltq
mov    %rax,-0x18(%rbp)
jmp    12a3 <special_key_str+0x193>
lea    0xec8(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ltgetstr@plt>
cltq
mov    %rax,-0x18(%rbp)
jmp    12a3 <special_key_str+0x193>
lea    0xeae(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ltgetstr@plt>
cltq
mov    %rax,-0x18(%rbp)
jmp    12a3 <special_key_str+0x193>
lea    0xe94(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ltgetstr@plt>
cltq
mov    %rax,-0x18(%rbp)
jmp    12a3 <special_key_str+0x193>
lea    0xe7a(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ltgetstr@plt>
cltq
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1273 <special_key_str+0x163>
movb   $0x7f,0x2ddf(%rip)
movb   $0x0,0x2dd9(%rip)
lea    0x2dd1(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    12a3 <special_key_str+0x193>
movb   $0xb,0x2dc1(%rip)
movb   $0x0,0x2dbb(%rip)
lea    0x2db3(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    12a3 <special_key_str+0x193>
movq   $0x0,-0x8(%rbp)
jmp    12ab <special_key_str+0x19b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<special_key_str>:
push   %rbx
sub    $0x10,%rsp
lea    0x2f24(%rip),%rbx
mov    %rbx,0x8(%rsp)
xor    %eax,%eax
add    $0xffffffff,%edi
cmp    $0x27,%edi
ja     118f <special_key_str+0x7f>
lea    0xece(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xf5e(%rip),%rdi
jmp    1181 <special_key_str+0x71>
lea    0xf58(%rip),%rdi
jmp    1181 <special_key_str+0x71>
lea    0xf52(%rip),%rdi
jmp    1181 <special_key_str+0x71>
lea    0xf4c(%rip),%rdi
jmp    1181 <special_key_str+0x71>
lea    0xf46(%rip),%rdi
jmp    1181 <special_key_str+0x71>
lea    0xf40(%rip),%rdi
jmp    1181 <special_key_str+0x71>
lea    0xf3a(%rip),%rdi
jmp    1181 <special_key_str+0x71>
lea    0xf34(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1030 <ltgetstr@plt>
cltq
add    $0x10,%rsp
pop    %rbx
ret
lea    0xf1c(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1030 <ltgetstr@plt>
test   %eax,%eax
jne    118d <special_key_str+0x7d>
movw   $0x7f,0x2e8b(%rip)
jmp    11c0 <special_key_str+0xb0>
movw   $0xb,0x2e80(%rip)
mov    %rbx,%rax
jmp    118f <special_key_str+0x7f>

LLVM IR (-O0):
@special_key_str.tbuf = internal global [40 x i8] zeroinitializer
@.str = [3 x i8] c"kr\00"
@.str.1 = [3 x i8] c"kl\00"
@.str.2 = [3 x i8] c"ku\00"
@.str.3 = [3 x i8] c"kd\00"
@.str.4 = [3 x i8] c"kP\00"
@.str.5 = [3 x i8] c"kN\00"
@.str.6 = [3 x i8] c"kh\00"
@.str.7 = [3 x i8] c"@7\00"
@.str.8 = [3 x i8] c"kD\00"
define i8* @special_key_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %3
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 0), i8** %5
%6 = load i32, i32* %3
switch i32 %6, label %48 [
i32 1, label %7
i32 2, label %11
i32 3, label %15
i32 4, label %19
i32 5, label %23
i32 6, label %27
i32 7, label %31
i32 8, label %35
i32 9, label %39
i32 40, label %47
]
7: ; preds = %1
%8 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %5)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %4
br label %49
11: ; preds = %1
%12 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %5)
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %4
br label %49
15: ; preds = %1
%16 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %5)
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %4
br label %49
19: ; preds = %1
%20 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %5)
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %4
br label %49
23: ; preds = %1
%24 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %5)
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to i8*
store i8* %26, i8** %4
br label %49
27: ; preds = %1
%28 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %5)
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i8*
store i8* %30, i8** %4
br label %49
31: ; preds = %1
%32 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %5)
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to i8*
store i8* %34, i8** %4
br label %49
35: ; preds = %1
%36 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %5)
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i8*
store i8* %38, i8** %4
br label %49
39: ; preds = %1
%40 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %5)
%41 = sext i32 %40 to i64
%42 = inttoptr i64 %41 to i8*
store i8* %42, i8** %4
%43 = load i8*, i8** %4
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %46
45: ; preds = %39
store i8 127, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 1)
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 0), i8** %4
br label %46
46: ; preds = %45, %39
br label %49
47: ; preds = %1
store i8 11, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 1)
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 0), i8** %4
br label %49
48: ; preds = %1
store i8* null, i8** %2
br label %51
49: ; preds = %47, %46, %35, %31, %27, %23, %19, %15, %11, %7
%50 = load i8*, i8** %4
store i8* %50, i8** %2
br label %51
51: ; preds = %49, %48
%52 = load i8*, i8** %2
ret i8* %52
}

LLVM IR (-O2):
@special_key_str.tbuf = internal global [40 x i8] zeroinitializer
@.str = [3 x i8] c"kr\00"
@.str.1 = [3 x i8] c"kl\00"
@.str.2 = [3 x i8] c"ku\00"
@.str.3 = [3 x i8] c"kd\00"
@.str.4 = [3 x i8] c"kP\00"
@.str.5 = [3 x i8] c"kN\00"
@.str.6 = [3 x i8] c"kh\00"
@.str.7 = [3 x i8] c"@7\00"
@.str.8 = [3 x i8] c"kD\00"
define i8* @special_key_str(i32 %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 0), i8** %2
switch i32 %0, label %43 [
i32 1, label %4
i32 2, label %8
i32 3, label %12
i32 4, label %16
i32 5, label %20
i32 6, label %24
i32 7, label %28
i32 8, label %32
i32 9, label %36
i32 40, label %42
]
4: ; preds = %1
%5 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
br label %43
8: ; preds = %1
%9 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
br label %43
12: ; preds = %1
%13 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2)
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i8*
br label %43
16: ; preds = %1
%17 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %2)
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i8*
br label %43
20: ; preds = %1
%21 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %2)
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i8*
br label %43
24: ; preds = %1
%25 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %2)
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i8*
br label %43
28: ; preds = %1
%29 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %2)
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to i8*
br label %43
32: ; preds = %1
%33 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %2)
%34 = sext i32 %33 to i64
%35 = inttoptr i64 %34 to i8*
br label %43
36: ; preds = %1
%37 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @ltgetstr to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %2)
%38 = sext i32 %37 to i64
%39 = inttoptr i64 %38 to i8*
%40 = icmp eq i32 %37, 0
br i1 %40, label %41, label %43
41: ; preds = %36
store i8 127, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 1)
br label %43
42: ; preds = %1
store i8 11, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 1)
br label %43
43: ; preds = %4, %8, %12, %16, %20, %24, %28, %32, %42, %41, %36, %1
%44 = phi i8* [ null, %1 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 0), %42 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @special_key_str.tbuf, i64 0, i64 0), %41 ], [ %39, %36 ], [ %35, %32 ], [ %31, %28 ], [ %27, %24 ], [ %23, %20 ], [ %19, %16 ], [ %15, %12 ], [ %11, %8 ], [ %7, %4 ]
ret i8* %44
}