#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 */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ FE_ALL_EXCEPT;
int /*<<< orphan*/ FE_DIVBYZERO;
int /*<<< orphan*/ FE_INEXACT;
int /*<<< orphan*/ FE_INVALID;
int /*<<< orphan*/ FE_OVERFLOW;
int /*<<< orphan*/ FE_UNDERFLOW;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fetestexcept(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void show_fe_exceptions(void) {
  if (fetestexcept(FE_DIVBYZERO))
    printf(" FE_DIVBYZERO");
  if (fetestexcept(FE_INVALID))
    printf(" FE_INVALID");
  if (fetestexcept(FE_OVERFLOW))
    printf(" FE_OVERFLOW");
  if (fetestexcept(FE_UNDERFLOW))
    printf(" FE_UNDERFLOW");
  if (fetestexcept(FE_INEXACT))
    return;
  if (fetestexcept(FE_ALL_EXCEPT) == 0)
    return;
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<show_fe_exceptions>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     1158 <show_fe_exceptions+0x28>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     117c <show_fe_exceptions+0x4c>
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     11a0 <show_fe_exceptions+0x70>
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     11c4 <show_fe_exceptions+0x94>
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     11e1 <show_fe_exceptions+0xb1>
jmp    120c <show_fe_exceptions+0xdc>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
jne    11fe <show_fe_exceptions+0xce>
jmp    120c <show_fe_exceptions+0xdc>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_fe_exceptions>:
push   %rax
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
je     1150 <show_fe_exceptions+0x20>
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
je     116f <show_fe_exceptions+0x3f>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
je     118e <show_fe_exceptions+0x5e>
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
je     11ad <show_fe_exceptions+0x7d>
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
jne    11d3 <show_fe_exceptions+0xa3>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
jne    11d5 <show_fe_exceptions+0xa5>
pop    %rax
ret
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@FE_DIVBYZERO = global i32 0
@.str = [14 x i8] c" FE_DIVBYZERO\00"
@FE_INVALID = global i32 0
@.str.1 = [12 x i8] c" FE_INVALID\00"
@FE_OVERFLOW = global i32 0
@.str.2 = [13 x i8] c" FE_OVERFLOW\00"
@FE_UNDERFLOW = global i32 0
@.str.3 = [14 x i8] c" FE_UNDERFLOW\00"
@FE_INEXACT = global i32 0
@FE_ALL_EXCEPT = global i32 0
@EXIT_FAILURE = global i32 0
define void @show_fe_exceptions() {
%1 = load i32, i32* @FE_DIVBYZERO
%2 = call i64 @fetestexcept(i32 %1)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = load i32, i32* @FE_INVALID
%8 = call i64 @fetestexcept(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
%13 = load i32, i32* @FE_OVERFLOW
%14 = call i64 @fetestexcept(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* @FE_UNDERFLOW
%20 = call i64 @fetestexcept(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %18
%25 = load i32, i32* @FE_INEXACT
%26 = call i64 @fetestexcept(i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %24
br label %37
29: ; preds = %24
%30 = load i32, i32* @FE_ALL_EXCEPT
%31 = call i64 @fetestexcept(i32 %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %29
br label %37
34: ; preds = %29
%35 = load i32, i32* @EXIT_FAILURE
%36 = call i32 @exit(i32 %35)
unreachable
37: ; preds = %33, %28
ret void
}

LLVM IR (-O2):
@FE_DIVBYZERO = global i32 0
@.str = [14 x i8] c" FE_DIVBYZERO\00"
@FE_INVALID = global i32 0
@.str.1 = [12 x i8] c" FE_INVALID\00"
@FE_OVERFLOW = global i32 0
@.str.2 = [13 x i8] c" FE_OVERFLOW\00"
@FE_UNDERFLOW = global i32 0
@.str.3 = [14 x i8] c" FE_UNDERFLOW\00"
@FE_INEXACT = global i32 0
@FE_ALL_EXCEPT = global i32 0
@EXIT_FAILURE = global i32 0
define void @show_fe_exceptions() {
%1 = load i32, i32* @FE_DIVBYZERO
%2 = tail call i64 @fetestexcept(i32 %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = load i32, i32* @FE_INVALID
%8 = tail call i64 @fetestexcept(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
%13 = load i32, i32* @FE_OVERFLOW
%14 = tail call i64 @fetestexcept(i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* @FE_UNDERFLOW
%20 = tail call i64 @fetestexcept(i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %18
%25 = load i32, i32* @FE_INEXACT
%26 = tail call i64 @fetestexcept(i32 %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %24
%29 = load i32, i32* @FE_ALL_EXCEPT
%30 = tail call i64 @fetestexcept(i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %28
%33 = load i32, i32* @EXIT_FAILURE
%34 = tail call i32 @exit(i32 %33)
unreachable
35: ; preds = %28, %24
ret void
}