#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 */
#define SIGABRT 151
#define SIGALRM 150
#define SIGBUS 149
#define SIGCHLD 148
#define SIGCONT 147
#define SIGFPE 146
#define SIGHUP 145
#define SIGILL 144
#define SIGINT 143
#define SIGKILL 142
#define SIGPIPE 141
#define SIGQUIT 140
#define SIGSEGV 139
#define SIGSTOP 138
#define SIGSYS 137
#define SIGTERM 136
#define SIGTRAP 135
#define SIGTSTP 134
#define SIGTTIN 133
#define SIGTTOU 132
#define SIGURG 131
#define SIGUSR1 130
#define SIGUSR2 129
#define SIGWINCH 128
char *strsignal(int signum) {
  switch (signum) {
  case SIGABRT:
    return "Aborted";
  case SIGALRM:
    return "Alarm clock";
  case SIGBUS:
    return "Bus error";
  case SIGCHLD:
    return "Child exited";
  case SIGCONT:
    return "Continued";
  case SIGFPE:
    return "Arithmetic exception";
  case SIGHUP:
    return "Hangup";
  case SIGILL:
    return "Illegal instruction";
  case SIGINT:
    return "Interrupt";
  case SIGKILL:
    return "Killed";
  case SIGPIPE:
    return "Broken pipe";
  case SIGQUIT:
    return "Quit";
  case SIGSEGV:
    return "Segmentation fault";
  case SIGSTOP:
    return "Stopped (signal)";
  case SIGSYS:
    return "Bad system call";
  case SIGTERM:
    return "Terminated";
  case SIGTRAP:
    return "Trace/breakpoint trap";
  case SIGTSTP:
    return "Stopped";
  case SIGTTIN:
    return "Stopped (tty input)";
  case SIGTTOU:
    return "Stopped (tty output)";
  case SIGURG:
    return "Urgent I/O condition";
  case SIGUSR1:
    return "User defined signal 1";
  case SIGUSR2:
    return "User defined signal 2";
  case SIGWINCH:
    return "Terminal window size changed";
  default:
    return "Unknown signal";
  }
}


x86 assembly (clang, -O0):
<strsignal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x17,%eax
ja     12b0 <strsignal+0x1b0>
mov    -0x18(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf29(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf21(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf1d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf17(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf14(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf0e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf13(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf0a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf0e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf08(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xeff(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xefb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xef0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xef3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xef4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xef4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xeef(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xeed(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xef1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xef6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xefb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf01(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf07(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12bb <strsignal+0x1bb>
lea    0xf14(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsignal>:
add    $0xffffff80,%edi
cmp    $0x17,%edi
ja     111a <strsignal+0x1a>
movslq %edi,%rax
lea    0x106a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0x104a(%rip),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Aborted\00"
@.str.1 = [12 x i8] c"Alarm clock\00"
@.str.2 = [10 x i8] c"Bus error\00"
@.str.3 = [13 x i8] c"Child exited\00"
@.str.4 = [10 x i8] c"Continued\00"
@.str.5 = [21 x i8] c"Arithmetic exception\00"
@.str.6 = [7 x i8] c"Hangup\00"
@.str.7 = [20 x i8] c"Illegal instruction\00"
@.str.8 = [10 x i8] c"Interrupt\00"
@.str.9 = [7 x i8] c"Killed\00"
@.str.10 = [12 x i8] c"Broken pipe\00"
@.str.11 = [5 x i8] c"Quit\00"
@.str.12 = [19 x i8] c"Segmentation fault\00"
@.str.13 = [17 x i8] c"Stopped (signal)\00"
@.str.14 = [16 x i8] c"Bad system call\00"
@.str.15 = [11 x i8] c"Terminated\00"
@.str.16 = [22 x i8] c"Trace/breakpoint trap\00"
@.str.17 = [8 x i8] c"Stopped\00"
@.str.18 = [20 x i8] c"Stopped (tty input)\00"
@.str.19 = [21 x i8] c"Stopped (tty output)\00"
@.str.20 = [21 x i8] c"Urgent I/O condition\00"
@.str.21 = [22 x i8] c"User defined signal 1\00"
@.str.22 = [22 x i8] c"User defined signal 2\00"
@.str.23 = [29 x i8] c"Terminal window size changed\00"
@.str.24 = [15 x i8] c"Unknown signal\00"
define i8* @strsignal(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %29 [
i32 151, label %5
i32 150, label %6
i32 149, label %7
i32 148, label %8
i32 147, label %9
i32 146, label %10
i32 145, label %11
i32 144, label %12
i32 143, label %13
i32 142, label %14
i32 141, label %15
i32 140, label %16
i32 139, label %17
i32 138, label %18
i32 137, label %19
i32 136, label %20
i32 135, label %21
i32 134, label %22
i32 133, label %23
i32 132, label %24
i32 131, label %25
i32 130, label %26
i32 129, label %27
i32 128, label %28
]
5: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %30
6: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %30
7: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %30
8: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %30
9: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %30
10: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %30
11: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %30
12: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %30
13: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %30
14: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %30
15: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %30
16: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %30
17: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %30
18: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %30
19: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %30
20: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %30
21: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %30
22: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %30
23: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.18, i64 0, i64 0), i8** %2
br label %30
24: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0), i8** %2
br label %30
25: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), i8** %2
br label %30
26: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.21, i64 0, i64 0), i8** %2
br label %30
27: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.22, i64 0, i64 0), i8** %2
br label %30
28: ; preds = %1
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.23, i64 0, i64 0), i8** %2
br label %30
29: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.24, i64 0, i64 0), i8** %2
br label %30
30: ; preds = %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%31 = load i8*, i8** %2
ret i8* %31
}

LLVM IR (-O2):
@.str = [8 x i8] c"Aborted\00"
@.str.1 = [12 x i8] c"Alarm clock\00"
@.str.2 = [10 x i8] c"Bus error\00"
@.str.3 = [13 x i8] c"Child exited\00"
@.str.4 = [10 x i8] c"Continued\00"
@.str.5 = [21 x i8] c"Arithmetic exception\00"
@.str.6 = [7 x i8] c"Hangup\00"
@.str.7 = [20 x i8] c"Illegal instruction\00"
@.str.8 = [10 x i8] c"Interrupt\00"
@.str.9 = [7 x i8] c"Killed\00"
@.str.10 = [12 x i8] c"Broken pipe\00"
@.str.11 = [5 x i8] c"Quit\00"
@.str.12 = [19 x i8] c"Segmentation fault\00"
@.str.13 = [17 x i8] c"Stopped (signal)\00"
@.str.14 = [16 x i8] c"Bad system call\00"
@.str.15 = [11 x i8] c"Terminated\00"
@.str.16 = [22 x i8] c"Trace/breakpoint trap\00"
@.str.17 = [8 x i8] c"Stopped\00"
@.str.18 = [20 x i8] c"Stopped (tty input)\00"
@.str.19 = [21 x i8] c"Stopped (tty output)\00"
@.str.20 = [21 x i8] c"Urgent I/O condition\00"
@.str.21 = [22 x i8] c"User defined signal 1\00"
@.str.22 = [22 x i8] c"User defined signal 2\00"
@.str.23 = [29 x i8] c"Terminal window size changed\00"
@.str.24 = [15 x i8] c"Unknown signal\00"
@reltable.strsignal = [24 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([29 x i8]* @.str.23 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.22 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.21 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.20 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.19 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.18 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.17 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.16 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.15 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.14 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.13 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.12 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.10 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.9 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.8 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.6 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.5 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.4 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.3 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.2 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.1 to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str to i64), i64 ptrtoint ([24 x i32]* @reltable.strsignal to i64)) to i32)]
define i8* @strsignal(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 24
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([24 x i32]* @reltable.strsignal to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.24, i64 0, i64 0), %1 ]
ret i8* %9
}