#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 */

/* Type definitions */

/* Variables and functions */
double volatile DBL_MAX;
double DBL_MIN;
int FE_DIVBYZERO;
int FE_INEXACT;
int FE_INVALID;
int FE_OVERFLOW;
int FE_UNDERFLOW;
void raiseexcept(int excepts) {
  volatile double d;
  if (excepts & FE_INVALID) {
    d = 0.0;
    d = 0.0 / d;
  }
  if (excepts & FE_DIVBYZERO) {
    d = 0.0;
    d = 1.0 / d;
  }
  if (excepts & FE_OVERFLOW) {
    d = DBL_MAX;
    d *= 2.0;
  }
  if (excepts & FE_UNDERFLOW) {
    d = DBL_MIN;
    d /= DBL_MAX;
  }
  if (excepts & FE_INEXACT) {
    d = DBL_MIN;
    d += 1.0;
  }
  d = 1.0;
  d += 1.0;
}


x86 assembly (clang, -O0):
<raiseexcept>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2edf(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1135 <raiseexcept+0x35>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
xorps  %xmm0,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e91(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1168 <raiseexcept+0x68>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xea1(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e4e(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11a3 <raiseexcept+0xa3>
mov    0x2e34(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e2b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11e1 <raiseexcept+0xe1>
mov    0x2df1(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2de9(%rip),%rax
movsd  (%rax),%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2df5(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     121c <raiseexcept+0x11c>
mov    0x2db3(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xded(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xddc(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xdca(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<raiseexcept>:
mov    0x2ee9(%rip),%rax
test   %edi,(%rax)
je     1124 <raiseexcept+0x24>
movq   $0x0,-0x8(%rsp)
xorpd  %xmm0,%xmm0
divsd  -0x8(%rsp),%xmm0
movsd  %xmm0,-0x8(%rsp)
mov    0x2ea5(%rip),%rax
test   %edi,(%rax)
je     114c <raiseexcept+0x4c>
movq   $0x0,-0x8(%rsp)
movsd  0xec0(%rip),%xmm0
divsd  -0x8(%rsp),%xmm0
movsd  %xmm0,-0x8(%rsp)
mov    0x2e6d(%rip),%rax
test   %edi,(%rax)
je     1178 <raiseexcept+0x78>
mov    0x2e5a(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rsp)
mov    0x2e59(%rip),%rax
test   %edi,(%rax)
je     11af <raiseexcept+0xaf>
mov    0x2e26(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rsp)
mov    0x2e1d(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,-0x8(%rsp)
mov    0x2e2a(%rip),%rax
test   %edi,(%rax)
je     11df <raiseexcept+0xdf>
mov    0x2def(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
addsd  0xe27(%rip),%xmm0
movsd  %xmm0,-0x8(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,-0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
addsd  0xe04(%rip),%xmm0
movsd  %xmm0,-0x8(%rsp)
ret

LLVM IR (-O0):
@FE_INVALID = global i32 0
@FE_DIVBYZERO = global i32 0
@FE_OVERFLOW = global i32 0
@DBL_MAX = global double 0.000000e+00
@FE_UNDERFLOW = global i32 0
@DBL_MIN = global double 0.000000e+00
@FE_INEXACT = global i32 0
define void @raiseexcept(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @FE_INVALID
%6 = and i32 %4, %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
store volatile double 0.000000e+00, double* %3
%9 = load volatile double, double* %3
%10 = fdiv double 0.000000e+00, %9
store volatile double %10, double* %3
br label %11
11: ; preds = %8, %1
%12 = load i32, i32* %2
%13 = load i32, i32* @FE_DIVBYZERO
%14 = and i32 %12, %13
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
store volatile double 0.000000e+00, double* %3
%17 = load volatile double, double* %3
%18 = fdiv double 1.000000e+00, %17
store volatile double %18, double* %3
br label %19
19: ; preds = %16, %11
%20 = load i32, i32* %2
%21 = load i32, i32* @FE_OVERFLOW
%22 = and i32 %20, %21
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load volatile double, double* @DBL_MAX
store volatile double %25, double* %3
%26 = load volatile double, double* %3
%27 = fmul double %26, 2.000000e+00
store volatile double %27, double* %3
br label %28
28: ; preds = %24, %19
%29 = load i32, i32* %2
%30 = load i32, i32* @FE_UNDERFLOW
%31 = and i32 %29, %30
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %28
%34 = load double, double* @DBL_MIN
store volatile double %34, double* %3
%35 = load volatile double, double* @DBL_MAX
%36 = load volatile double, double* %3
%37 = fdiv double %36, %35
store volatile double %37, double* %3
br label %38
38: ; preds = %33, %28
%39 = load i32, i32* %2
%40 = load i32, i32* @FE_INEXACT
%41 = and i32 %39, %40
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %38
%44 = load double, double* @DBL_MIN
store volatile double %44, double* %3
%45 = load volatile double, double* %3
%46 = fadd double %45, 1.000000e+00
store volatile double %46, double* %3
br label %47
47: ; preds = %43, %38
store volatile double 1.000000e+00, double* %3
%48 = load volatile double, double* %3
%49 = fadd double %48, 1.000000e+00
store volatile double %49, double* %3
ret void
}

LLVM IR (-O2):
@FE_INVALID = global i32 0
@FE_DIVBYZERO = global i32 0
@FE_OVERFLOW = global i32 0
@DBL_MAX = global double 0.000000e+00
@FE_UNDERFLOW = global i32 0
@DBL_MIN = global double 0.000000e+00
@FE_INEXACT = global i32 0
define void @raiseexcept(i32 %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = load i32, i32* @FE_INVALID
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
store volatile double 0.000000e+00, double* %2
%8 = load volatile double, double* %2
%9 = fdiv double 0.000000e+00, %8
store volatile double %9, double* %2
br label %10
10: ; preds = %7, %1
%11 = load i32, i32* @FE_DIVBYZERO
%12 = and i32 %11, %0
%13 = icmp eq i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
store volatile double 0.000000e+00, double* %2
%15 = load volatile double, double* %2
%16 = fdiv double 1.000000e+00, %15
store volatile double %16, double* %2
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* @FE_OVERFLOW
%19 = and i32 %18, %0
%20 = icmp eq i32 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load volatile double, double* @DBL_MAX
store volatile double %22, double* %2
%23 = load volatile double, double* %2
%24 = fmul double %23, 2.000000e+00
store volatile double %24, double* %2
br label %25
25: ; preds = %21, %17
%26 = load i32, i32* @FE_UNDERFLOW
%27 = and i32 %26, %0
%28 = icmp eq i32 %27, 0
br i1 %28, label %34, label %29
29: ; preds = %25
%30 = load double, double* @DBL_MIN
store volatile double %30, double* %2
%31 = load volatile double, double* @DBL_MAX
%32 = load volatile double, double* %2
%33 = fdiv double %32, %31
store volatile double %33, double* %2
br label %34
34: ; preds = %29, %25
%35 = load i32, i32* @FE_INEXACT
%36 = and i32 %35, %0
%37 = icmp eq i32 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %34
%39 = load double, double* @DBL_MIN
store volatile double %39, double* %2
%40 = load volatile double, double* %2
%41 = fadd double %40, 1.000000e+00
store volatile double %41, double* %2
br label %42
42: ; preds = %38, %34
store volatile double 1.000000e+00, double* %2
%43 = load volatile double, double* %2
%44 = fadd double %43, 1.000000e+00
store volatile double %44, double* %2
ret void
}