#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 SIGCONT;
int SIGHUP;
int SIGINT;
int SIGKILL;
int SIGQUIT;
int SIGSTOP;
int SIGTERM;
int SIGTSTP;
int SIGUSR1;
int SIGUSR2;
scalar_t__ strcmp(char const *, char *);
int get_signal_name(const char *signame) {
  if (strcmp(signame, "SIGCONT") == 0)
    return SIGCONT;
  if (strcmp(signame, "SIGINT") == 0)
    return SIGINT;
  if (strcmp(signame, "SIGHUP") == 0)
    return SIGHUP;
  if (strcmp(signame, "SIGKILL") == 0)
    return SIGKILL;
  if (strcmp(signame, "SIGQUIT") == 0)
    return SIGQUIT;
  if (strcmp(signame, "SIGTERM") == 0)
    return SIGTERM;
  if (strcmp(signame, "SIGSTOP") == 0)
    return SIGSTOP;
  if (strcmp(signame, "SIGTSTP") == 0)
    return SIGTSTP;
  if (strcmp(signame, "SIGUSR1") == 0)
    return SIGUSR1;
  if (strcmp(signame, "SIGUSR2") == 0)
    return SIGUSR2;
  return -1;
}


x86 assembly (clang, -O0):
<get_signal_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1147 <get_signal_name+0x37>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <get_signal_name+0x1c1>
mov    -0x10(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1172 <get_signal_name+0x62>
mov    0x2e68(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <get_signal_name+0x1c1>
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    119d <get_signal_name+0x8d>
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <get_signal_name+0x1c1>
mov    -0x10(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11c8 <get_signal_name+0xb8>
mov    0x2de2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <get_signal_name+0x1c1>
mov    -0x10(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11f3 <get_signal_name+0xe3>
mov    0x2dd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <get_signal_name+0x1c1>
mov    -0x10(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    121e <get_signal_name+0x10e>
mov    0x2db4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <get_signal_name+0x1c1>
mov    -0x10(%rbp),%rdi
lea    0xe05(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1249 <get_signal_name+0x139>
mov    0x2d59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <get_signal_name+0x1c1>
mov    -0x10(%rbp),%rdi
lea    0xde2(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1274 <get_signal_name+0x164>
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <get_signal_name+0x1c1>
mov    -0x10(%rbp),%rdi
lea    0xdbf(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    129f <get_signal_name+0x18f>
mov    0x2d4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <get_signal_name+0x1c1>
mov    -0x10(%rbp),%rdi
lea    0xd9c(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12ca <get_signal_name+0x1ba>
mov    0x2ce8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <get_signal_name+0x1c1>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_signal_name>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11fc <get_signal_name+0xec>
lea    0xed8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1205 <get_signal_name+0xf5>
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     120e <get_signal_name+0xfe>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1217 <get_signal_name+0x107>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1220 <get_signal_name+0x110>
lea    0xe96(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1229 <get_signal_name+0x119>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1232 <get_signal_name+0x122>
lea    0xe7a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     123b <get_signal_name+0x12b>
lea    0xe6e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1244 <get_signal_name+0x134>
lea    0xe62(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    0x2db5(%rip),%rcx
neg    %rax
sbb    %eax,%eax
or     (%rcx),%eax
pop    %rbx
ret
mov    0x2dd5(%rip),%rax
jmp    124b <get_signal_name+0x13b>
mov    0x2dc4(%rip),%rax
jmp    124b <get_signal_name+0x13b>
mov    0x2ddb(%rip),%rax
jmp    124b <get_signal_name+0x13b>
mov    0x2d82(%rip),%rax
jmp    124b <get_signal_name+0x13b>
mov    0x2d99(%rip),%rax
jmp    124b <get_signal_name+0x13b>
mov    0x2d98(%rip),%rax
jmp    124b <get_signal_name+0x13b>
mov    0x2d5f(%rip),%rax
jmp    124b <get_signal_name+0x13b>
mov    0x2d76(%rip),%rax
jmp    124b <get_signal_name+0x13b>
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"SIGCONT\00"
@SIGCONT = global i32 0
@.str.1 = [7 x i8] c"SIGINT\00"
@SIGINT = global i32 0
@.str.2 = [7 x i8] c"SIGHUP\00"
@SIGHUP = global i32 0
@.str.3 = [8 x i8] c"SIGKILL\00"
@SIGKILL = global i32 0
@.str.4 = [8 x i8] c"SIGQUIT\00"
@SIGQUIT = global i32 0
@.str.5 = [8 x i8] c"SIGTERM\00"
@SIGTERM = global i32 0
@.str.6 = [8 x i8] c"SIGSTOP\00"
@SIGSTOP = global i32 0
@.str.7 = [8 x i8] c"SIGTSTP\00"
@SIGTSTP = global i32 0
@.str.8 = [8 x i8] c"SIGUSR1\00"
@SIGUSR1 = global i32 0
@.str.9 = [8 x i8] c"SIGUSR2\00"
@SIGUSR2 = global i32 0
define i32 @get_signal_name(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* @SIGCONT
store i32 %8, i32* %2
br label %64
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load i32, i32* @SIGINT
store i32 %14, i32* %2
br label %64
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load i32, i32* @SIGHUP
store i32 %20, i32* %2
br label %64
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* @SIGKILL
store i32 %26, i32* %2
br label %64
27: ; preds = %21
%28 = load i8*, i8** %3
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = load i32, i32* @SIGQUIT
store i32 %32, i32* %2
br label %64
33: ; preds = %27
%34 = load i8*, i8** %3
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = load i32, i32* @SIGTERM
store i32 %38, i32* %2
br label %64
39: ; preds = %33
%40 = load i8*, i8** %3
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = load i32, i32* @SIGSTOP
store i32 %44, i32* %2
br label %64
45: ; preds = %39
%46 = load i8*, i8** %3
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = load i32, i32* @SIGTSTP
store i32 %50, i32* %2
br label %64
51: ; preds = %45
%52 = load i8*, i8** %3
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = load i32, i32* @SIGUSR1
store i32 %56, i32* %2
br label %64
57: ; preds = %51
%58 = load i8*, i8** %3
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = load i32, i32* @SIGUSR2
store i32 %62, i32* %2
br label %64
63: ; preds = %57
store i32 -1, i32* %2
br label %64
64: ; preds = %63, %61, %55, %49, %43, %37, %31, %25, %19, %13, %7
%65 = load i32, i32* %2
ret i32 %65
}

LLVM IR (-O2):
@.str = [8 x i8] c"SIGCONT\00"
@SIGCONT = global i32 0
@.str.1 = [7 x i8] c"SIGINT\00"
@SIGINT = global i32 0
@.str.2 = [7 x i8] c"SIGHUP\00"
@SIGHUP = global i32 0
@.str.3 = [8 x i8] c"SIGKILL\00"
@SIGKILL = global i32 0
@.str.4 = [8 x i8] c"SIGQUIT\00"
@SIGQUIT = global i32 0
@.str.5 = [8 x i8] c"SIGTERM\00"
@SIGTERM = global i32 0
@.str.6 = [8 x i8] c"SIGSTOP\00"
@SIGSTOP = global i32 0
@.str.7 = [8 x i8] c"SIGTSTP\00"
@SIGTSTP = global i32 0
@.str.8 = [8 x i8] c"SIGUSR1\00"
@SIGUSR1 = global i32 0
@.str.9 = [8 x i8] c"SIGUSR2\00"
@SIGUSR2 = global i32 0
define i32 @get_signal_name(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = load i32, i32* @SIGCONT
br label %51
6: ; preds = %1
%7 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = load i32, i32* @SIGINT
br label %51
11: ; preds = %6
%12 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = load i32, i32* @SIGHUP
br label %51
16: ; preds = %11
%17 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = load i32, i32* @SIGKILL
br label %51
21: ; preds = %16
%22 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load i32, i32* @SIGQUIT
br label %51
26: ; preds = %21
%27 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = load i32, i32* @SIGTERM
br label %51
31: ; preds = %26
%32 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = load i32, i32* @SIGSTOP
br label %51
36: ; preds = %31
%37 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = load i32, i32* @SIGTSTP
br label %51
41: ; preds = %36
%42 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = load i32, i32* @SIGUSR1
br label %51
46: ; preds = %41
%47 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
%49 = load i32, i32* @SIGUSR2
%50 = select i1 %48, i32 %49, i32 -1
br label %51
51: ; preds = %46, %44, %39, %34, %29, %24, %19, %14, %9, %4
%52 = phi i32 [ %5, %4 ], [ %10, %9 ], [ %15, %14 ], [ %20, %19 ], [ %25, %24 ], [ %30, %29 ], [ %35, %34 ], [ %40, %39 ], [ %45, %44 ], [ %50, %46 ]
ret i32 %52
}