#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 si_signo;
  int si_errno;
  int si_code;
  int si_pid;
  int si_uid;
  int si_status;
  int si_utime;
  int si_stime;
  int si_addr;
};
typedef TYPE_1__ siginfo_t;

/* Variables and functions */
#define SIGBUS 132
#define SIGCHLD 131
#define SIGFPE 130
#define SIGILL 129
#define SIGSEGV 128
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *sigstr(int);
int /*<<< orphan*/ stderr;
void dump_siginfo(siginfo_t const *info) {
  fprintf(stderr, "SIGNAL: %s(%d), ERRNO : %d, CODE: %d\n",
          sigstr(info->si_signo), info->si_signo, info->si_errno,
          info->si_code);
  switch (info->si_signo) {
  case SIGCHLD:
    fprintf(stderr, "pid:    %d\n", info->si_pid);
    fprintf(stderr, "uid:    %d\n", info->si_uid);
    fprintf(stderr, "status: %x\n", info->si_status);
    fprintf(stderr, "utime:  %u\n", info->si_utime);
    fprintf(stderr, "stime:  %u\n", info->si_stime);
    break;
  case SIGILL:
  case SIGFPE:
  case SIGSEGV:
  case SIGBUS:
    fprintf(stderr, "address: %p\n", info->si_addr);
    break;
  }
}


x86 assembly (clang, -O0):
<dump_siginfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <sigstr@plt>
mov    -0x10(%rbp),%edi
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    0x4(%rax),%r8d
mov    0x8(%rax),%r9d
lea    0xea2(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffff80,%eax
sub    $0x3,%eax
jb     1240 <dump_siginfo+0x120>
jmp    117f <dump_siginfo+0x5f>
mov    -0xc(%rbp),%eax
sub    $0x83,%eax
je     11a5 <dump_siginfo+0x85>
jmp    1192 <dump_siginfo+0x72>
mov    -0xc(%rbp),%eax
sub    $0x84,%eax
je     1240 <dump_siginfo+0x120>
jmp    125e <dump_siginfo+0x13e>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edx
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xe58(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%edx
lea    0xe46(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%edx
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%edx
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    125e <dump_siginfo+0x13e>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%edx
lea    0xe0b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_siginfo>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%ebp
mov    (%rdi),%edi
call   1030 <sigstr@plt>
mov    (%rbx),%ecx
mov    0x4(%rbx),%r8d
mov    0x8(%rbx),%r9d
lea    0xeb7(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%eax
lea    -0x80(%rax),%ecx
cmp    $0x3,%ecx
jb     11cc <dump_siginfo+0xac>
cmp    $0x84,%eax
je     11cc <dump_siginfo+0xac>
cmp    $0x83,%eax
jne    11e4 <dump_siginfo+0xc4>
mov    (%r14),%edi
mov    0xc(%rbx),%edx
lea    0xeac(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
mov    0x10(%rbx),%edx
lea    0xea4(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
mov    0x14(%rbx),%edx
lea    0xe9c(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
mov    0x18(%rbx),%edx
lea    0xe94(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
mov    0x1c(%rbx),%edx
lea    0xe8c(%rip),%rsi
jmp    11d9 <dump_siginfo+0xb9>
mov    (%r14),%edi
mov    0x20(%rbx),%edx
lea    0xe89(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fprintf@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [38 x i8] c"SIGNAL: %s(%d), ERRNO : %d, CODE: %d\0A\00"
@.str.1 = [12 x i8] c"pid: %d\0A\00"
@.str.2 = [12 x i8] c"uid: %d\0A\00"
@.str.3 = [12 x i8] c"status: %x\0A\00"
@.str.4 = [12 x i8] c"utime: %u\0A\00"
@.str.5 = [12 x i8] c"stime: %u\0A\00"
@.str.6 = [13 x i8] c"address: %p\0A\00"
define void @dump_siginfo(%struct.TYPE_3__* %0) {
%2 = alloca %struct.TYPE_3__*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %2
%3 = load i32, i32* @stderr
%4 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%5 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 0
%6 = load i32, i32* %5
%7 = call i8* @sigstr(i32 %6)
%8 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 1
%13 = load i32, i32* %12
%14 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i32 0, i32 2
%16 = load i32, i32* %15
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %10, i32 %13, i32 %16)
%18 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%19 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %18, i32 0, i32 0
%20 = load i32, i32* %19
switch i32 %20, label %53 [
i32 131, label %21
i32 129, label %47
i32 130, label %47
i32 128, label %47
i32 132, label %47
]
21: ; preds = %1
%22 = load i32, i32* @stderr
%23 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %23, i32 0, i32 3
%25 = load i32, i32* %24
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* @stderr
%28 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%29 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %28, i32 0, i32 4
%30 = load i32, i32* %29
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i32, i32* @stderr
%33 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%34 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %33, i32 0, i32 5
%35 = load i32, i32* %34
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%37 = load i32, i32* @stderr
%38 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%39 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %38, i32 0, i32 6
%40 = load i32, i32* %39
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %40)
%42 = load i32, i32* @stderr
%43 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%44 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %43, i32 0, i32 7
%45 = load i32, i32* %44
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %45)
br label %53
47: ; preds = %1, %1, %1, %1
%48 = load i32, i32* @stderr
%49 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%50 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %49, i32 0, i32 8
%51 = load i32, i32* %50
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %1, %47, %21
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [38 x i8] c"SIGNAL: %s(%d), ERRNO : %d, CODE: %d\0A\00"
@.str.1 = [12 x i8] c"pid: %d\0A\00"
@.str.2 = [12 x i8] c"uid: %d\0A\00"
@.str.3 = [12 x i8] c"status: %x\0A\00"
@.str.4 = [12 x i8] c"utime: %u\0A\00"
@.str.5 = [12 x i8] c"stime: %u\0A\00"
@.str.6 = [13 x i8] c"address: %p\0A\00"
define void @dump_siginfo(%struct.TYPE_3__* nocapture %0) {
%2 = load i32, i32* @stderr
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%4 = load i32, i32* %3
%5 = tail call i8* @sigstr(i32 %4)
%6 = load i32, i32* %3
%7 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 2
%10 = load i32, i32* %9
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6, i32 %8, i32 %10)
%12 = load i32, i32* %3
switch i32 %12, label %39 [
i32 131, label %13
i32 129, label %34
i32 130, label %34
i32 128, label %34
i32 132, label %34
]
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 3
%16 = load i32, i32* %15
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @stderr
%19 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 4
%20 = load i32, i32* %19
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = load i32, i32* @stderr
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 5
%24 = load i32, i32* %23
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i32, i32* @stderr
%27 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 6
%28 = load i32, i32* %27
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = load i32, i32* @stderr
%31 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 7
%32 = load i32, i32* %31
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %32)
br label %39
34: ; preds = %1, %1, %1, %1
%35 = load i32, i32* @stderr
%36 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 8
%37 = load i32, i32* %36
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %1, %34, %13
ret void
}