#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*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ stderr;
char *strsignal(int);
void psignal(int sig, const char *s) {
  if (s != NULL)
    fprintf(stderr, "%s: %s\n", s, strsignal(sig));
  else
    fprintf(stderr, "%s\n", strsignal(sig));
}


x86 assembly (clang, -O0):
<psignal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1173 <psignal+0x53>
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <strsignal@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    %rax,%rcx
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    119b <psignal+0x7b>
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <strsignal@plt>
mov    -0x20(%rbp),%edi
mov    %rax,%rdx
lea    0xe70(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psignal>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x2eb3(%rip),%rax
mov    (%rax),%ebp
call   1040 <strsignal@plt>
test   %rbx,%rbx
je     1155 <psignal+0x35>
lea    0xec0(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>
lea    0xea8(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @psignal(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = load i32, i32* %3
%11 = call i8* @strsignal(i32 %10)
%12 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %11)
br label %18
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i32, i32* %3
%16 = call i8* @strsignal(i32 %15)
%17 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %13, %7
ret void
}

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