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

/* Variables and functions */
int SIGFPE;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void Handle(int sig, siginfo_t *info, void *ctxt) {
  if (sig != SIGFPE) {
    printf("Got unexpected signal %d\n", sig);
    exit(1);
  }
  if (info->si_code != 0) {
    printf("Expected si_code to be zero, but got %d\n", (int)info->si_code);
    exit(1);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<Handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eab(%rip),%rcx
cmp    (%rcx),%eax
je     115e <Handle+0x3e>
mov    -0x4(%rbp),%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     118b <Handle+0x6b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Handle>:
push   %rax
mov    0x2ec0(%rip),%rcx
cmp    %edi,(%rcx)
jne    113b <Handle+0x1b>
mov    (%rsi),%rsi
test   %rsi,%rsi
jne    1148 <Handle+0x28>
xor    %edi,%edi
call   1040 <exit@plt>
mov    %edi,%eax
lea    0xebc(%rip),%rdi
mov    %eax,%esi
jmp    114f <Handle+0x2f>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
@SIGFPE = global i32 0
@.str = [26 x i8] c"Got unexpected signal %d\0A\00"
@.str.1 = [41 x i8] c"Expected si_code to be zero, but got %d\0A\00"
define void @Handle(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* @SIGFPE
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i32, i32* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %3
%15 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 0
%17 = load i64, i64* %16
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %14
%20 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %20, i32 0, i32 0
%22 = load i64, i64* %21
%23 = trunc i64 %22 to i32
%24 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %14
%27 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
@SIGFPE = global i32 0
@.str = [26 x i8] c"Got unexpected signal %d\0A\00"
@.str.1 = [41 x i8] c"Expected si_code to be zero, but got %d\0A\00"
define void @Handle(i32 %0, %struct.TYPE_3__* nocapture %1, i8* nocapture readnone %2) {
%4 = load i32, i32* @SIGFPE
%5 = icmp eq i32 %4, %0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%11 = load i64, i64* %10
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = trunc i64 %11 to i32
%15 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %9
%18 = tail call i32 @exit(i32 0)
unreachable
}