#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 SIGHUP 128
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void vpmnd_signalhandler(const int sig) {
  switch (sig) {
  case SIGHUP: {
    fprintf(stderr, "Received SIGHUP signal.\n");
    fflush(stderr);
  }; break;
  default: {
    fprintf(stderr, "Unhandled signal %d.\n", sig);
    fflush(stderr);
  }; break;
  }
}


x86 assembly (clang, -O0):
<vpmnd_signalhandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x80,%eax
jne    1168 <vpmnd_signalhandler+0x48>
jmp    113e <vpmnd_signalhandler+0x1e>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
jmp    1190 <vpmnd_signalhandler+0x70>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vpmnd_signalhandler>:
push   %rbx
mov    %edi,%edx
mov    0x2eb6(%rip),%rbx
mov    (%rbx),%edi
cmp    $0x80,%edx
jne    1144 <vpmnd_signalhandler+0x24>
lea    0xec5(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1152 <vpmnd_signalhandler+0x32>
lea    0xece(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"Received SIGHUP signal.\0A\00"
@.str.1 = [22 x i8] c"Unhandled signal %d.\0A\00"
define void @vpmnd_signalhandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %9 [
i32 128, label %4
]
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = call i32 @fflush(i32 %7)
br label %15
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = load i32, i32* %2
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @stderr
%14 = call i32 @fflush(i32 %13)
br label %15
15: ; preds = %9, %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Received SIGHUP signal.\0A\00"
@.str.1 = [22 x i8] c"Unhandled signal %d.\0A\00"
define void @vpmnd_signalhandler(i32 %0) {
%2 = icmp eq i32 %0, 128
%3 = load i32, i32* @stderr
br i1 %2, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %6, %4
%9 = load i32, i32* @stderr
%10 = tail call i32 @fflush(i32 %9)
ret void
}