#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*/ EINVAL;
#define SIGABRT 155
#define SIGALRM 154
#define SIGBUS 153
#define SIGCHLD 152
#define SIGCONT 151
#define SIGFPE 150
#define SIGHUP 149
#define SIGILL 148
#define SIGINT 147
#define SIGKILL 146
#define SIGPIPE 145
#define SIGPOLL 144
#define SIGPROF 143
#define SIGQUIT 142
#define SIGSEGV 141
#define SIGSTOP 140
#define SIGSYS 139
#define SIGTERM 138
#define SIGTRAP 137
#define SIGTSTP 136
#define SIGTTIN 135
#define SIGTTOU 134
#define SIGURG 133
#define SIGUSR1 132
#define SIGUSR2 131
#define SIGVTALRM 130
#define SIGXCPU 129
#define SIGXFSZ 128
int /*<<< orphan*/ errno;
char *strsignal(int signum) {
  switch (signum) {
  case SIGABRT:
    return "Process abort signal.";
    ;
  case SIGALRM:
    return "Alarm clock.";
    ;
  case SIGBUS:
    return "Access to an undefined portion of a memory object.";
    ;
  case SIGCHLD:
    return "Child process terminated, stopped, or continued.";
    ;
  case SIGCONT:
    return "Continue executing, if stopped.";
    ;
  case SIGFPE:
    return "Erroneous arithmetic operation.";
    ;
  case SIGHUP:
    return "Hangup.";
    ;
  case SIGILL:
    return "Illegal instruction.";
    ;
  case SIGINT:
    return "Terminal interrupt signal.";
    ;
  case SIGKILL:
    return "Kill (cannot be caught or ignored).";
    ;
  case SIGPIPE:
    return "Write on a pipe with no one to read it.";
    ;
  case SIGQUIT:
    return "Terminal quit signal.";
    ;
  case SIGSEGV:
    return "Invalid memory reference.";
    ;
  case SIGSTOP:
    return "Stop executing (cannot be caught or ignored).";
    ;
  case SIGTERM:
    return "Termination signal.";
    ;
  case SIGTSTP:
    return "Terminal stop signal.";
    ;
  case SIGTTIN:
    return "Background process attempting read.";
    ;
  case SIGTTOU:
    return "Background process attempting write.";
    ;
  case SIGUSR1:
    return "User-defined signal 1.";
    ;
  case SIGUSR2:
    return "User-defined signal 2.";
    ;
  case SIGPOLL:
    return "Pollable event.";
    ;
  case SIGPROF:
    return "Profiling timer expired.";
    ;
  case SIGSYS:
    return "Bad system call.";
    ;
  case SIGTRAP:
    return "Trace/breakpoint trap.";
    ;
  case SIGURG:
    return "High bandwidth data is available at a socket.";
    ;
  case SIGVTALRM:
    return "Virtual timer expired.";
    ;
  case SIGXCPU:
    return "CPU time limit exceeded.";
    ;
  case SIGXFSZ:
    return "File size limit exceeded.";
    ;
  default:
    errno = EINVAL;
    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    $0x1b,%eax
ja     12f0 <strsignal+0x1f0>
mov    -0x18(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf39(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xf3f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xf3c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xf5f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xf80(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xf90(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xfa0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xf98(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xf9d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xfa8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xfbc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xfd4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xfda(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0xfe4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x1002(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x1006(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x100c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x1020(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x1035(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x103c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x1043(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x1043(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x104c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x104d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x1054(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x1072(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x1079(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
lea    0x1082(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130d <strsignal+0x20d>
mov    0x2ce1(%rip),%rax
mov    (%rax),%ecx
mov    0x2ce0(%rip),%rax
mov    %ecx,(%rax)
lea    0x107a(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsignal>:
add    $0xffffff80,%edi
cmp    $0x1c,%edi
jae    111a <strsignal+0x1a>
movslq %edi,%rax
lea    0x1212(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
mov    0x2eb7(%rip),%rax
mov    (%rax),%eax
mov    0x2eb6(%rip),%rcx
mov    %eax,(%rcx)
lea    0x11e0(%rip),%rax
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Process abort signal.\00"
@.str.1 = [13 x i8] c"Alarm clock.\00"
@.str.2 = [51 x i8] c"Access to an undefined portion of a memory object.\00"
@.str.3 = [49 x i8] c"Child process terminated, stopped, or continued.\00"
@.str.4 = [32 x i8] c"Continue executing, if stopped.\00"
@.str.5 = [32 x i8] c"Erroneous arithmetic operation.\00"
@.str.6 = [8 x i8] c"Hangup.\00"
@.str.7 = [21 x i8] c"Illegal instruction.\00"
@.str.8 = [27 x i8] c"Terminal interrupt signal.\00"
@.str.9 = [36 x i8] c"Kill (cannot be caught or ignored).\00"
@.str.10 = [40 x i8] c"Write on a pipe with no one to read it.\00"
@.str.11 = [22 x i8] c"Terminal quit signal.\00"
@.str.12 = [26 x i8] c"Invalid memory reference.\00"
@.str.13 = [46 x i8] c"Stop executing (cannot be caught or ignored).\00"
@.str.14 = [20 x i8] c"Termination signal.\00"
@.str.15 = [22 x i8] c"Terminal stop signal.\00"
@.str.16 = [36 x i8] c"Background process attempting read.\00"
@.str.17 = [37 x i8] c"Background process attempting write.\00"
@.str.18 = [23 x i8] c"User-defined signal 1.\00"
@.str.19 = [23 x i8] c"User-defined signal 2.\00"
@.str.20 = [16 x i8] c"Pollable event.\00"
@.str.21 = [25 x i8] c"Profiling timer expired.\00"
@.str.22 = [17 x i8] c"Bad system call.\00"
@.str.23 = [23 x i8] c"Trace/breakpoint trap.\00"
@.str.24 = [46 x i8] c"High bandwidth data is available at a socket.\00"
@.str.25 = [23 x i8] c"Virtual timer expired.\00"
@.str.26 = [25 x i8] c"CPU time limit exceeded.\00"
@.str.27 = [26 x i8] c"File size limit exceeded.\00"
@EINVAL = global i32 0
@errno = global i32 0
@.str.28 = [16 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 %33 [
i32 155, label %5
i32 154, label %6
i32 153, label %7
i32 152, label %8
i32 151, label %9
i32 150, label %10
i32 149, label %11
i32 148, label %12
i32 147, label %13
i32 146, label %14
i32 145, label %15
i32 142, label %16
i32 141, label %17
i32 140, label %18
i32 138, label %19
i32 136, label %20
i32 135, label %21
i32 134, label %22
i32 132, label %23
i32 131, label %24
i32 144, label %25
i32 143, label %26
i32 139, label %27
i32 137, label %28
i32 133, label %29
i32 130, label %30
i32 129, label %31
i32 128, label %32
]
5: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8** %2
br label %35
6: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %35
7: ; preds = %1
store i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %35
8: ; preds = %1
store i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %35
9: ; preds = %1
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %35
10: ; preds = %1
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %35
11: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %35
12: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %35
13: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %35
14: ; preds = %1
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %35
15: ; preds = %1
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %35
16: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %35
17: ; preds = %1
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %35
18: ; preds = %1
store i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %35
19: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %35
20: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %35
21: ; preds = %1
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %35
22: ; preds = %1
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %35
23: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i8** %2
br label %35
24: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.19, i64 0, i64 0), i8** %2
br label %35
25: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i8** %2
br label %35
26: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.21, i64 0, i64 0), i8** %2
br label %35
27: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i64 0, i64 0), i8** %2
br label %35
28: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.23, i64 0, i64 0), i8** %2
br label %35
29: ; preds = %1
store i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.24, i64 0, i64 0), i8** %2
br label %35
30: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.25, i64 0, i64 0), i8** %2
br label %35
31: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.26, i64 0, i64 0), i8** %2
br label %35
32: ; preds = %1
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.27, i64 0, i64 0), i8** %2
br label %35
33: ; preds = %1
%34 = load i32, i32* @EINVAL
store i32 %34, i32* @errno
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i64 0, i64 0), i8** %2
br label %35
35: ; preds = %33, %32, %31, %30, %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
%36 = load i8*, i8** %2
ret i8* %36
}

LLVM IR (-O2):
@.str = [22 x i8] c"Process abort signal.\00"
@.str.1 = [13 x i8] c"Alarm clock.\00"
@.str.2 = [51 x i8] c"Access to an undefined portion of a memory object.\00"
@.str.3 = [49 x i8] c"Child process terminated, stopped, or continued.\00"
@.str.4 = [32 x i8] c"Continue executing, if stopped.\00"
@.str.5 = [32 x i8] c"Erroneous arithmetic operation.\00"
@.str.6 = [8 x i8] c"Hangup.\00"
@.str.7 = [21 x i8] c"Illegal instruction.\00"
@.str.8 = [27 x i8] c"Terminal interrupt signal.\00"
@.str.9 = [36 x i8] c"Kill (cannot be caught or ignored).\00"
@.str.10 = [40 x i8] c"Write on a pipe with no one to read it.\00"
@.str.11 = [22 x i8] c"Terminal quit signal.\00"
@.str.12 = [26 x i8] c"Invalid memory reference.\00"
@.str.13 = [46 x i8] c"Stop executing (cannot be caught or ignored).\00"
@.str.14 = [20 x i8] c"Termination signal.\00"
@.str.15 = [22 x i8] c"Terminal stop signal.\00"
@.str.16 = [36 x i8] c"Background process attempting read.\00"
@.str.17 = [37 x i8] c"Background process attempting write.\00"
@.str.18 = [23 x i8] c"User-defined signal 1.\00"
@.str.19 = [23 x i8] c"User-defined signal 2.\00"
@.str.20 = [16 x i8] c"Pollable event.\00"
@.str.21 = [25 x i8] c"Profiling timer expired.\00"
@.str.22 = [17 x i8] c"Bad system call.\00"
@.str.23 = [23 x i8] c"Trace/breakpoint trap.\00"
@.str.24 = [46 x i8] c"High bandwidth data is available at a socket.\00"
@.str.25 = [23 x i8] c"Virtual timer expired.\00"
@.str.26 = [25 x i8] c"CPU time limit exceeded.\00"
@.str.27 = [26 x i8] c"File size limit exceeded.\00"
@EINVAL = global i32 0
@errno = global i32 0
@.str.28 = [16 x i8] c"Unknown signal.\00"
@reltable.strsignal = [28 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.27 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @.str.26 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.25 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.19 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.18 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([46 x i8]* @.str.24 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([37 x i8]* @.str.17 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([36 x i8]* @.str.16 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.15 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.23 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.14 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.22 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([46 x i8]* @.str.13 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.12 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.11 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @.str.21 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.20 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([40 x i8]* @.str.10 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([36 x i8]* @.str.9 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.8 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.7 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.6 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([32 x i8]* @.str.5 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([32 x i8]* @.str.4 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([49 x i8]* @.str.3 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([51 x i8]* @.str.2 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.1 to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str to i64), i64 ptrtoint ([28 x i32]* @reltable.strsignal to i64)) to i32)]
define i8* @strsignal(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 28
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = load i32, i32* @EINVAL
store i32 %5, i32* @errno
br label %10
6: ; preds = %1
%7 = sext i32 %2 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([28 x i32]* @reltable.strsignal to i8*), i64 %8)
br label %10
10: ; preds = %6, %4
%11 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i64 0, i64 0), %4 ], [ %9, %6 ]
ret i8* %11
}