#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 && s[0]) {
    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     1183 <psignal+0x63>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1183 <psignal+0x63>
mov    0x2e8f(%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    0xe89(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11ab <psignal+0x8b>
mov    0x2e56(%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    0xe60(%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
test   %rsi,%rsi
je     115a <psignal+0x3a>
mov    %rsi,%rbx
cmpb   $0x0,(%rsi)
je     115a <psignal+0x3a>
mov    0x2ea9(%rip),%rax
mov    (%rax),%ebp
call   1040 <strsignal@plt>
lea    0xebb(%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>
mov    0x2e7f(%rip),%rax
mov    (%rax),%ebx
call   1040 <strsignal@plt>
lea    0xe95(%rip),%rsi
mov    %ebx,%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 %19
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %7
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %4
%16 = load i32, i32* %3
%17 = call i8* @strsignal(i32 %16)
%18 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %17)
br label %24
19: ; preds = %7, %2
%20 = load i32, i32* @stderr
%21 = load i32, i32* %3
%22 = call i8* @strsignal(i32 %21)
%23 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %19, %13
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
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i8* @strsignal(i32 %0)
%10 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %9)
br label %15
11: ; preds = %4, %2
%12 = load i32, i32* @stderr
%13 = tail call i8* @strsignal(i32 %0)
%14 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %11, %7
ret void
}