#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_int;
  int /*<<< orphan*/ si_pid;
};
typedef TYPE_1__ siginfo_t;

/* Variables and functions */
int /*<<< orphan*/ SIGQUIT;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
void termination(int sig, siginfo_t *info, void *args) {
  printf("from child: %d\n", info->si_int);
  kill(info->si_pid, SIGQUIT);
  wait(NULL);
  exit(0);
}


x86 assembly (clang, -O0):
<termination>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    0x2e75(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <wait@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<termination>:
push   %rbx
mov    %rsi,%rbx
mov    (%rsi),%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rbx),%edi
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
xor    %edi,%edi
call   1060 <wait@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
@.str = [16 x i8] c"from child: %d\0A\00"
@SIGQUIT = global i32 0
define void @termination(i32 %0, %struct.TYPE_3__* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_3__*
%6 = alloca i8*
store i32 %0, i32* %4
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %5
store i8* %2, i8** %6
%7 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 1
%13 = load i32, i32* %12
%14 = load i32, i32* @SIGQUIT
%15 = call i32 @kill(i32 %13, i32 %14)
%16 = call i32 @wait(i32* null)
%17 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
@.str = [16 x i8] c"from child: %d\0A\00"
@SIGQUIT = global i32 0
define void @termination(i32 %0, %struct.TYPE_3__* nocapture %1, i8* nocapture readnone %2) {
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = load i32, i32* @SIGQUIT
%10 = tail call i32 @kill(i32 %8, i32 %9)
%11 = tail call i32 @wait(i32* null)
%12 = tail call i32 @exit(i32 0)
unreachable
}