#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*/ EXIT_FAILURE;
int SIGABRT;
int SIGINT;
int SIGTERM;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void sigHand(int signo) {
  if (signo == SIGINT) {
    fprintf(stderr,
            "\nReceived signal %d (Interrupt).\n"
            "Interactive attention request sent to the program.\n",
            signo);
    fprintf(stderr, "Impossible to deallocate memory.\n"
                    "Possible Memory Leak.\n\n");
    fprintf(stderr, "Exiting...\n");
    exit(EXIT_FAILURE);
  }
  if (signo == SIGABRT) {
    fprintf(stderr,
            "\nReceived signal %d (Abort).\n"
            "Abnormal termination.",
            signo);
    fprintf(stderr, "Impossible to deallocate memory.\n"
                    "Possible Memory Leak.\n\n");
    fprintf(stderr, "Exiting...\n");
    exit(EXIT_FAILURE);
  }
  if (signo == SIGTERM) {
    fprintf(stderr,
            "\nReceived signal %d (Terminate).\n"
            "Termination request sent to the program.\n",
            signo);
    fprintf(stderr, "Impossible to deallocate memory.\n"
                    "Possible Memory Leak.\n\n");
    fprintf(stderr, "Exiting...\n");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<sigHand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
jne    1193 <sigHand+0x73>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xeee(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
lea    0xf10(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
mov    0x2e23(%rip),%rcx
cmp    (%rcx),%eax
jne    11fb <sigHand+0xdb>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xee2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
mov    0x2ddb(%rip),%rcx
cmp    (%rcx),%eax
jne    1263 <sigHand+0x143>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
lea    0xe1e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
lea    0xe40(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigHand>:
push   %rbx
mov    %edi,%edx
mov    0x2ebe(%rip),%rax
cmp    %edi,(%rax)
je     1146 <sigHand+0x26>
mov    0x2e8b(%rip),%rax
cmp    %edx,(%rax)
je     1158 <sigHand+0x38>
mov    0x2ea0(%rip),%rax
cmp    %edx,(%rax)
je     116a <sigHand+0x4a>
pop    %rbx
ret
mov    0x2e83(%rip),%rbx
mov    (%rbx),%edi
lea    0xeaa(%rip),%rsi
jmp    117a <sigHand+0x5a>
mov    0x2e71(%rip),%rbx
mov    (%rbx),%edi
lea    0xf32(%rip),%rsi
jmp    117a <sigHand+0x5a>
mov    0x2e5f(%rip),%rbx
mov    (%rbx),%edi
lea    0xf53(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xecb(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xef4(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@stderr = global i32 0
@.str = [85 x i8] c"\0AReceived signal %d (Interrupt).\0AInteractive attention request sent to the program.\0A\00"
@.str.1 = [57 x i8] c"Impossible to deallocate memory.\0APossible Memory Leak.\0A\0A\00"
@.str.2 = [12 x i8] c"Exiting...\0A\00"
@EXIT_FAILURE = global i32 0
@SIGABRT = global i32 0
@.str.3 = [51 x i8] c"\0AReceived signal %d (Abort).\0AAbnormal termination.\00"
@SIGTERM = global i32 0
@.str.4 = [75 x i8] c"\0AReceived signal %d (Terminate).\0ATermination request sent to the program.\0A\00"
define void @sigHand(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = load i32, i32* %2
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %1
%17 = load i32, i32* %2
%18 = load i32, i32* @SIGABRT
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = load i32, i32* %2
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @exit(i32 %28)
unreachable
30: ; preds = %16
%31 = load i32, i32* %2
%32 = load i32, i32* @SIGTERM
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %44
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = load i32, i32* %2
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%42 = load i32, i32* @EXIT_FAILURE
%43 = call i32 @exit(i32 %42)
unreachable
44: ; preds = %30
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@stderr = global i32 0
@.str = [85 x i8] c"\0AReceived signal %d (Interrupt).\0AInteractive attention request sent to the program.\0A\00"
@.str.1 = [57 x i8] c"Impossible to deallocate memory.\0APossible Memory Leak.\0A\0A\00"
@.str.2 = [12 x i8] c"Exiting...\0A\00"
@EXIT_FAILURE = global i32 0
@SIGABRT = global i32 0
@.str.3 = [51 x i8] c"\0AReceived signal %d (Abort).\0AAbnormal termination.\00"
@SIGTERM = global i32 0
@.str.4 = [75 x i8] c"\0AReceived signal %d (Terminate).\0ATermination request sent to the program.\0A\00"
define void @sigHand(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
%14 = load i32, i32* @SIGABRT
%15 = icmp eq i32 %14, %0
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %0)
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = tail call i32 @exit(i32 %23)
unreachable
25: ; preds = %13
%26 = load i32, i32* @SIGTERM
%27 = icmp eq i32 %26, %0
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = load i32, i32* @stderr
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.4, i64 0, i64 0), i32 %0)
%31 = load i32, i32* @stderr
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%35 = load i32, i32* @EXIT_FAILURE
%36 = tail call i32 @exit(i32 %35)
unreachable
37: ; preds = %25
ret void
}