const char *zje_signal_detail(int signal) {
  char *signal_names[] = {
      "SIGZERO", "SIGHUP",  "SIGINT",    "SIGQUIT", "SIGILL",    "SIGTRAP",
      "SIGABRT", "SIGBUS",  "SIGFPE",    "SIGKILL", "SIGUSR1",   "SIGSEGV",
      "SIGUSR2", "SIGPIPE", "SIGALRM",   "SIGTERM", "SIGSTKFLT", "SIGCHLD",
      "SIGCONT", "SIGSTOP", "SIGTSTP",   "SIGTTIN", "SIGTTOU",   "SIGURG",
      "SIGXCPU", "SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH",  "SIGIO",
      "SIGPWR",  "SIGSYS"};
  if (signal >= sizeof(signal_names) / sizeof(*signal_names) || signal < 0) {
    return "SIG_INVAL";
  }
  return signal_names[signal];
}


x86 assembly (clang, -O0):
<zje_signal_detail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0xc(%rbp)
lea    -0x110(%rbp),%rdi
lea    0x2bf4(%rip),%rsi
mov    $0x100,%edx
call   1030 <memcpy@plt>
movslq -0xc(%rbp),%rax
cmp    $0x20,%rax
jae    114e <zje_signal_detail+0x3e>
cmpl   $0x0,-0xc(%rbp)
jge    115e <zje_signal_detail+0x4e>
lea    0xfa6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    116e <zje_signal_detail+0x5e>
movslq -0xc(%rbp),%rax
mov    -0x110(%rbp,%rax,8),%rax
ff
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zje_signal_detail>:
cmp    $0x1f,%edi
jbe    110d <zje_signal_detail+0xd>
lea    0xfef(%rip),%rax
ret
mov    %edi,%eax
lea    0xff2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"SIGZERO\00"
@.str.1 = [7 x i8] c"SIGHUP\00"
@.str.2 = [7 x i8] c"SIGINT\00"
@.str.3 = [8 x i8] c"SIGQUIT\00"
@.str.4 = [7 x i8] c"SIGILL\00"
@.str.5 = [8 x i8] c"SIGTRAP\00"
@.str.6 = [8 x i8] c"SIGABRT\00"
@.str.7 = [7 x i8] c"SIGBUS\00"
@.str.8 = [7 x i8] c"SIGFPE\00"
@.str.9 = [8 x i8] c"SIGKILL\00"
@.str.10 = [8 x i8] c"SIGUSR1\00"
@.str.11 = [8 x i8] c"SIGSEGV\00"
@.str.12 = [8 x i8] c"SIGUSR2\00"
@.str.13 = [8 x i8] c"SIGPIPE\00"
@.str.14 = [8 x i8] c"SIGALRM\00"
@.str.15 = [8 x i8] c"SIGTERM\00"
@.str.16 = [10 x i8] c"SIGSTKFLT\00"
@.str.17 = [8 x i8] c"SIGCHLD\00"
@.str.18 = [8 x i8] c"SIGCONT\00"
@.str.19 = [8 x i8] c"SIGSTOP\00"
@.str.20 = [8 x i8] c"SIGTSTP\00"
@.str.21 = [8 x i8] c"SIGTTIN\00"
@.str.22 = [8 x i8] c"SIGTTOU\00"
@.str.23 = [7 x i8] c"SIGURG\00"
@.str.24 = [8 x i8] c"SIGXCPU\00"
@.str.25 = [8 x i8] c"SIGXFSZ\00"
@.str.26 = [10 x i8] c"SIGVTALRM\00"
@.str.27 = [8 x i8] c"SIGPROF\00"
@.str.28 = [9 x i8] c"SIGWINCH\00"
@.str.29 = [6 x i8] c"SIGIO\00"
@.str.30 = [7 x i8] c"SIGPWR\00"
@.str.31 = [7 x i8] c"SIGSYS\00"
@__const.zje_signal_detail.signal_names = [32 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.31, i32 0, i32 0)]
@.str.32 = [10 x i8] c"SIG_INVAL\00"
define i8* @zje_signal_detail(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [32 x i8*]
store i32 %0, i32* %3
%5 = bitcast [32 x i8*]* %4 to i8*
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = icmp uge i64 %7, 32
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9, %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.32, i64 0, i64 0), i8** %2
br label %18
13: ; preds = %9
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [32 x i8*], [32 x i8*]* %4, i64 0, i64 %15
%17 = load i8*, i8** %16
store i8* %17, i8** %2
br label %18
18: ; preds = %13, %12
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@.str = [8 x i8] c"SIGZERO\00"
@.str.1 = [7 x i8] c"SIGHUP\00"
@.str.2 = [7 x i8] c"SIGINT\00"
@.str.3 = [8 x i8] c"SIGQUIT\00"
@.str.4 = [7 x i8] c"SIGILL\00"
@.str.5 = [8 x i8] c"SIGTRAP\00"
@.str.6 = [8 x i8] c"SIGABRT\00"
@.str.7 = [7 x i8] c"SIGBUS\00"
@.str.8 = [7 x i8] c"SIGFPE\00"
@.str.9 = [8 x i8] c"SIGKILL\00"
@.str.10 = [8 x i8] c"SIGUSR1\00"
@.str.11 = [8 x i8] c"SIGSEGV\00"
@.str.12 = [8 x i8] c"SIGUSR2\00"
@.str.13 = [8 x i8] c"SIGPIPE\00"
@.str.14 = [8 x i8] c"SIGALRM\00"
@.str.15 = [8 x i8] c"SIGTERM\00"
@.str.16 = [10 x i8] c"SIGSTKFLT\00"
@.str.17 = [8 x i8] c"SIGCHLD\00"
@.str.18 = [8 x i8] c"SIGCONT\00"
@.str.19 = [8 x i8] c"SIGSTOP\00"
@.str.20 = [8 x i8] c"SIGTSTP\00"
@.str.21 = [8 x i8] c"SIGTTIN\00"
@.str.22 = [8 x i8] c"SIGTTOU\00"
@.str.23 = [7 x i8] c"SIGURG\00"
@.str.24 = [8 x i8] c"SIGXCPU\00"
@.str.25 = [8 x i8] c"SIGXFSZ\00"
@.str.26 = [10 x i8] c"SIGVTALRM\00"
@.str.27 = [8 x i8] c"SIGPROF\00"
@.str.28 = [9 x i8] c"SIGWINCH\00"
@.str.29 = [6 x i8] c"SIGIO\00"
@.str.30 = [7 x i8] c"SIGPWR\00"
@.str.31 = [7 x i8] c"SIGSYS\00"
@reltable.zje_signal_detail = [32 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.2 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.3 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.5 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.6 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.7 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.8 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.9 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.11 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.12 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.13 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.14 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.15 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.16 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.17 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.18 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.19 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.20 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.21 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.22 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.23 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.24 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.25 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.26 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.27 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.28 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.29 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.30 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.31 to i64), i64 ptrtoint ([32 x i32]* @reltable.zje_signal_detail to i64)) to i32)]
@.str.32 = [10 x i8] c"SIG_INVAL\00"
define i8* @zje_signal_detail(i32 %0) {
%2 = icmp ugt i32 %0, 31
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = zext i32 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([32 x i32]* @reltable.zje_signal_detail to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.32, i64 0, i64 0), %1 ]
ret i8* %8
}