#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_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ sival_int;
};
struct TYPE_5__ {
  int si_signo;
  scalar_t__ si_code;
  TYPE_1__ si_value;
};
typedef TYPE_2__ siginfo_t;

/* Variables and functions */
scalar_t__ SI_QUEUE;
int /*<<< orphan*/ _exit(int);
__attribute__((__noreturn__)) void exiter(int signo __attribute__((__unused__)),
                                          siginfo_t *info,
                                          void *context
                                          __attribute__((__unused__))) {
  int ret = info->si_signo;
  if (info->si_code == SI_QUEUE && info->si_value.sival_int != 0)
    ret = info->si_value.sival_int;
  _exit(ret);
}


x86 assembly (clang, -O0):
<exiter>:
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),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2ead(%rip),%rcx
cmp    (%rcx),%rax
jne    115e <exiter+0x4e>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     115e <exiter+0x4e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<exiter>:
push   %rax
mov    (%rsi),%edi
mov    0x8(%rsi),%rax
mov    0x2eca(%rip),%rcx
cmp    (%rcx),%rax
jne    112f <exiter+0x1f>
mov    0x10(%rsi),%rax
test   %rax,%rax
cmove  %edi,%eax
mov    %eax,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@SI_QUEUE = global i64 0
define void @exiter(i32 %0, %struct.TYPE_5__* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_5__*
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %5
store i8* %2, i8** %6
%8 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i32 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %7
%11 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%12 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %11, i32 0, i32 1
%13 = load i64, i64* %12
%14 = load i64, i64* @SI_QUEUE
%15 = icmp eq i64 %13, %14
br i1 %15, label %16, label %28
16: ; preds = %3
%17 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%18 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %17, i32 0, i32 2
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %18, i32 0, i32 0
%20 = load i64, i64* %19
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %16
%23 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%24 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %23, i32 0, i32 2
%25 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %24, i32 0, i32 0
%26 = load i64, i64* %25
%27 = trunc i64 %26 to i32
store i32 %27, i32* %7
br label %28
28: ; preds = %22, %16, %3
%29 = load i32, i32* %7
%30 = call i32 @_exit(i32 %29)
unreachable
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@SI_QUEUE = global i64 0
define void @exiter(i32 %0, %struct.TYPE_5__* nocapture %1, i8* nocapture readnone %2) {
%4 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = load i64, i64* @SI_QUEUE
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 2, i32 0
%12 = load i64, i64* %11
%13 = icmp eq i64 %12, 0
%14 = trunc i64 %12 to i32
%15 = select i1 %13, i32 %5, i32 %14
br label %16
16: ; preds = %10, %3
%17 = phi i32 [ %5, %3 ], [ %15, %10 ]
%18 = tail call i32 @_exit(i32 %17)
unreachable
}