#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;
  scalar_t__ si_errno;
  scalar_t__ si_pid;
  scalar_t__ si_code;
};
typedef TYPE_1__ siginfo_t;

/* Variables and functions */
int SIGUSR1;
int SIGUSR2;
scalar_t__ SI_USER;
int /*<<< orphan*/ assert(int);
scalar_t__ getpid();
int /*<<< orphan*/ printf(char *);
void sigusr_function(int signum, siginfo_t *info, void *arg) {
  assert(signum == SIGUSR1 || signum == SIGUSR2);
  if (signum == SIGUSR1) {
    printf("SIGUSR1\n");
  } else {
    printf("SIGUSR2\n");
  }
  assert(info->si_signo == signum);
  assert(info->si_errno == 0);
  assert(info->si_pid == getpid());
  assert(info->si_code == SI_USER);
}


x86 assembly (clang, -O0):
<sigusr_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%al
mov    0x2e99(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x19(%rbp)
je     116c <sigusr_function+0x3c>
mov    -0x4(%rbp),%eax
mov    0x2e6c(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%eax
mov    0x2e65(%rip),%rcx
cmp    (%rcx),%eax
jne    119c <sigusr_function+0x6c>
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
jmp    11a8 <sigusr_function+0x78>
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    0x2dcb(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigusr_function>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    0x2eab(%rip),%r14
cmp    %edi,(%r14)
sete   %al
mov    0x2e86(%rip),%rcx
cmp    %edi,(%rcx)
mov    %rsi,%rbx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1050 <assert@plt>
cmp    %ebp,(%r14)
lea    0xea2(%rip),%rax
lea    0xe93(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
cmp    %ebp,(%rbx)
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,0x8(%rbx)
sete   %dil
call   1050 <assert@plt>
mov    0x10(%rbx),%rbp
xor    %eax,%eax
call   1040 <getpid@plt>
xor    %edi,%edi
cmp    %rax,%rbp
sete   %dil
call   1050 <assert@plt>
mov    0x18(%rbx),%rax
mov    0x2e21(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <assert@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i64, i64, i64 }
@SIGUSR1 = global i32 0
@SIGUSR2 = global i32 0
@.str = [9 x i8] c"SIGUSR1\0A\00"
@.str.1 = [9 x i8] c"SIGUSR2\0A\00"
@SI_USER = global i64 0
define void @sigusr_function(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 i32, i32* %4
%8 = load i32, i32* @SIGUSR1
%9 = icmp eq i32 %7, %8
br i1 %9, label %14, label %10
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* @SIGUSR2
%13 = icmp eq i32 %11, %12
br label %14
14: ; preds = %10, %3
%15 = phi i1 [ true, %3 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32, i32* %4
%19 = load i32, i32* @SIGUSR1
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %25
23: ; preds = %14
%24 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
%26 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%27 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = load i32, i32* %4
%30 = icmp eq i32 %28, %29
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%34 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %33, i32 0, i32 1
%35 = load i64, i64* %34
%36 = icmp eq i64 %35, 0
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%40 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %39, i32 0, i32 2
%41 = load i64, i64* %40
%42 = call i64 (...) @getpid()
%43 = icmp eq i64 %41, %42
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%47 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %46, i32 0, i32 3
%48 = load i64, i64* %47
%49 = load i64, i64* @SI_USER
%50 = icmp eq i64 %48, %49
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i64, i64, i64 }
@SIGUSR1 = global i32 0
@SIGUSR2 = global i32 0
@SI_USER = global i64 0
@str = [8 x i8] c"SIGUSR2\00"
@str.2 = [8 x i8] c"SIGUSR1\00"
define void @sigusr_function(i32 %0, %struct.TYPE_3__* nocapture %1, i8* nocapture readnone %2) {
%4 = load i32, i32* @SIGUSR1
%5 = icmp eq i32 %4, %0
%6 = load i32, i32* @SIGUSR2
%7 = icmp eq i32 %6, %0
%8 = select i1 %5, i1 true, i1 %7
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = load i32, i32* @SIGUSR1
%12 = icmp eq i32 %11, %0
%13 = select i1 %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0)
%14 = tail call i32 @puts(i8* dereferenceable(1) %13)
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, %0
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 1
%21 = load i64, i64* %20
%22 = icmp eq i64 %21, 0
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 2
%26 = load i64, i64* %25
%27 = tail call i64 (...) @getpid()
%28 = icmp eq i64 %26, %27
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 3
%32 = load i64, i64* %31
%33 = load i64, i64* @SI_USER
%34 = icmp eq i64 %32, %33
%35 = zext i1 %34 to i32
%36 = tail call i32 @assert(i32 %35)
ret void
}