#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 SIGHUP;
int SIGINT;
int SIGPIPE;
int SIGQUIT;
int SIGTERM;
int SIGUSR1;
int SIGUSR2;
const char *sig_name(int sig) {
  return sig == SIGHUP    ? "HUP"
         : sig == SIGINT  ? "INT"
         : sig == SIGQUIT ? "QUIT"
         : sig == SIGPIPE ? "PIPE"
         : sig == SIGTERM ? "TERM"
         : sig == SIGUSR1 ? "USR1"
         : sig == SIGUSR2 ? "USR2"
                          : "UNKNOWN";
}


x86 assembly (clang, -O0):
<sig_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2edf(%rip),%rcx
cmp    (%rcx),%eax
jne    1129 <sig_name+0x29>
lea    0xee0(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    121f <sig_name+0x11f>
mov    -0x4(%rbp),%eax
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%eax
jne    114b <sig_name+0x4b>
lea    0xec2(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1217 <sig_name+0x117>
mov    -0x4(%rbp),%eax
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%eax
jne    116d <sig_name+0x6d>
lea    0xea4(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    120f <sig_name+0x10f>
mov    -0x4(%rbp),%eax
mov    0x2e39(%rip),%rcx
cmp    (%rcx),%eax
jne    118f <sig_name+0x8f>
lea    0xe87(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1207 <sig_name+0x107>
mov    -0x4(%rbp),%eax
mov    0x2e37(%rip),%rcx
cmp    (%rcx),%eax
jne    11b1 <sig_name+0xb1>
lea    0xe6a(%rip),%rax
mov    %rax,-0x30(%rbp)
jmp    11ff <sig_name+0xff>
mov    -0x4(%rbp),%eax
mov    0x2e25(%rip),%rcx
cmp    (%rcx),%eax
jne    11d3 <sig_name+0xd3>
lea    0xe4d(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    11f7 <sig_name+0xf7>
mov    -0x4(%rbp),%edx
mov    0x2ddb(%rip),%rax
mov    (%rax),%esi
lea    0xe3b(%rip),%rax
lea    0xe2f(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_name>:
mov    0x2ee9(%rip),%rax
cmp    %edi,(%rax)
jne    1113 <sig_name+0x13>
lea    0xeee(%rip),%rax
ret
mov    0x2ebe(%rip),%rax
cmp    %edi,(%rax)
jne    1126 <sig_name+0x26>
lea    0xedf(%rip),%rax
ret
mov    0x2e9b(%rip),%rax
cmp    %edi,(%rax)
jne    1139 <sig_name+0x39>
lea    0xed0(%rip),%rax
ret
mov    0x2e70(%rip),%rax
cmp    %edi,(%rax)
jne    114c <sig_name+0x4c>
lea    0xec2(%rip),%rax
ret
mov    0x2e7d(%rip),%rax
cmp    %edi,(%rax)
jne    115f <sig_name+0x5f>
lea    0xeb4(%rip),%rax
ret
mov    0x2e7a(%rip),%rax
cmp    %edi,(%rax)
jne    1172 <sig_name+0x72>
lea    0xea6(%rip),%rax
ret
mov    0x2e3f(%rip),%rax
cmp    %edi,(%rax)
lea    0xe9a(%rip),%rcx
lea    0xe98(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@SIGHUP = global i32 0
@.str = [4 x i8] c"HUP\00"
@SIGINT = global i32 0
@.str.1 = [4 x i8] c"INT\00"
@SIGQUIT = global i32 0
@.str.2 = [5 x i8] c"QUIT\00"
@SIGPIPE = global i32 0
@.str.3 = [5 x i8] c"PIPE\00"
@SIGTERM = global i32 0
@.str.4 = [5 x i8] c"TERM\00"
@SIGUSR1 = global i32 0
@.str.5 = [5 x i8] c"USR1\00"
@SIGUSR2 = global i32 0
@.str.6 = [5 x i8] c"USR2\00"
@.str.7 = [8 x i8] c"UNKNOWN\00"
define i8* @sig_name(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGHUP
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %7
6: ; preds = %1
br label %48
7: ; preds = %1
%8 = load i32, i32* %2
%9 = load i32, i32* @SIGINT
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %7
br label %46
12: ; preds = %7
%13 = load i32, i32* %2
%14 = load i32, i32* @SIGQUIT
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %17
16: ; preds = %12
br label %44
17: ; preds = %12
%18 = load i32, i32* %2
%19 = load i32, i32* @SIGPIPE
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17
br label %42
22: ; preds = %17
%23 = load i32, i32* %2
%24 = load i32, i32* @SIGTERM
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %22
br label %40
27: ; preds = %22
%28 = load i32, i32* %2
%29 = load i32, i32* @SIGUSR1
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %27
br label %38
32: ; preds = %27
%33 = load i32, i32* %2
%34 = load i32, i32* @SIGUSR2
%35 = icmp eq i32 %33, %34
%36 = zext i1 %35 to i64
%37 = select i1 %35, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0)
br label %38
38: ; preds = %32, %31
%39 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %31 ], [ %37, %32 ]
br label %40
40: ; preds = %38, %26
%41 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %26 ], [ %39, %38 ]
br label %42
42: ; preds = %40, %21
%43 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %21 ], [ %41, %40 ]
br label %44
44: ; preds = %42, %16
%45 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %16 ], [ %43, %42 ]
br label %46
46: ; preds = %44, %11
%47 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %11 ], [ %45, %44 ]
br label %48
48: ; preds = %46, %6
%49 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %6 ], [ %47, %46 ]
ret i8* %49
}

LLVM IR (-O2):
@SIGHUP = global i32 0
@.str = [4 x i8] c"HUP\00"
@SIGINT = global i32 0
@.str.1 = [4 x i8] c"INT\00"
@SIGQUIT = global i32 0
@.str.2 = [5 x i8] c"QUIT\00"
@SIGPIPE = global i32 0
@.str.3 = [5 x i8] c"PIPE\00"
@SIGTERM = global i32 0
@.str.4 = [5 x i8] c"TERM\00"
@SIGUSR1 = global i32 0
@.str.5 = [5 x i8] c"USR1\00"
@SIGUSR2 = global i32 0
@.str.6 = [5 x i8] c"USR2\00"
@.str.7 = [8 x i8] c"UNKNOWN\00"
define i8* @sig_name(i32 %0) {
%2 = load i32, i32* @SIGHUP
%3 = icmp eq i32 %2, %0
br i1 %3, label %23, label %4
4: ; preds = %1
%5 = load i32, i32* @SIGINT
%6 = icmp eq i32 %5, %0
br i1 %6, label %23, label %7
7: ; preds = %4
%8 = load i32, i32* @SIGQUIT
%9 = icmp eq i32 %8, %0
br i1 %9, label %23, label %10
10: ; preds = %7
%11 = load i32, i32* @SIGPIPE
%12 = icmp eq i32 %11, %0
br i1 %12, label %23, label %13
13: ; preds = %10
%14 = load i32, i32* @SIGTERM
%15 = icmp eq i32 %14, %0
br i1 %15, label %23, label %16
16: ; preds = %13
%17 = load i32, i32* @SIGUSR1
%18 = icmp eq i32 %17, %0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = load i32, i32* @SIGUSR2
%21 = icmp eq i32 %20, %0
%22 = select i1 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0)
br label %23
23: ; preds = %4, %10, %19, %16, %13, %7, %1
%24 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %10 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %13 ], [ %22, %19 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %16 ]
ret i8* %24
}