#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ si_signo;
};
typedef TYPE_1__ siginfo_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ stderr;
char *strsignal(int /*<<< orphan*/);
void psiginfo(const siginfo_t *si, const char *msg) {
  char *s = strsignal(si->si_signo);
  if (msg)
    fprintf(stderr, "%s: %s\n", msg, s);
  else
    fprintf(stderr, "%s\n", s);
}


x86 assembly (clang, -O0):
<psiginfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1040 <strsignal@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116e <psiginfo+0x4e>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1189 <psiginfo+0x69>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe82(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psiginfo>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%edi
call   1040 <strsignal@plt>
mov    0x2eae(%rip),%rcx
mov    (%rcx),%edi
test   %rbx,%rbx
je     114e <psiginfo+0x2e>
lea    0xec0(%rip),%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>
lea    0xeaf(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

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

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