#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int FE_DIVBYZERO;
int FE_INEXACT;
int FE_INVALID;
int FE_OVERFLOW;
int FE_UNDERFLOW;
int fegetexcept();
scalar_t__ fetestexcept(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void show_fe_exceptions(FILE *file) {
  fprintf(file, "IEEE floating-point exception flags raised:");
  if (fetestexcept(FE_INEXACT))
    fprintf(file, " inexact;");
  if (fetestexcept(FE_DIVBYZERO))
    fprintf(file, " divide by zero;");
  if (fetestexcept(FE_UNDERFLOW))
    fprintf(file, " underflow;");
  if (fetestexcept(FE_OVERFLOW))
    fprintf(file, " overflow;");
  if (fetestexcept(FE_INVALID))
    fprintf(file, " invalid;");
  fprintf(file, "\n");
  fprintf(file, "IEEE floating-point exception traps enabled:");
  int excepts = fegetexcept();
  if (excepts & FE_INEXACT)
    fprintf(file, " inexact;");
  if (excepts & FE_DIVBYZERO)
    fprintf(file, " divide by zero;");
  if (excepts & FE_UNDERFLOW)
    fprintf(file, " underflow;");
  if (excepts & FE_OVERFLOW)
    fprintf(file, " overflow;");
  if (excepts & FE_INVALID)
    fprintf(file, " invalid;");
  fprintf(file, "\n");
}


x86 assembly (clang, -O0):
<show_fe_exceptions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     1174 <show_fe_exceptions+0x44>
mov    -0x8(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     119c <show_fe_exceptions+0x6c>
mov    -0x8(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     11c4 <show_fe_exceptions+0x94>
mov    -0x8(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     11ec <show_fe_exceptions+0xbc>
mov    -0x8(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     1214 <show_fe_exceptions+0xe4>
mov    -0x8(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1050 <fegetexcept@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2d98(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1263 <show_fe_exceptions+0x133>
mov    -0x8(%rbp),%rdi
lea    0xdce(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
mov    0x2d63(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1288 <show_fe_exceptions+0x158>
mov    -0x8(%rbp),%rdi
lea    0xdb3(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
mov    0x2d46(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     12ad <show_fe_exceptions+0x17d>
mov    -0x8(%rbp),%rdi
lea    0xd9f(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
mov    0x2d09(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     12d2 <show_fe_exceptions+0x1a2>
mov    -0x8(%rbp),%rdi
lea    0xd86(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
mov    0x2d14(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     12f7 <show_fe_exceptions+0x1c7>
mov    -0x8(%rbp),%rdi
lea    0xd6c(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd66(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_fe_exceptions>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeab(%rip),%rdi
mov    $0x2b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
je     1193 <show_fe_exceptions+0x53>
lea    0xeab(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    0x2e36(%rip),%r15
mov    (%r15),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
je     11c0 <show_fe_exceptions+0x80>
lea    0xe88(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    0x2e11(%rip),%r12
mov    (%r12),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
je     11ee <show_fe_exceptions+0xae>
lea    0xe6b(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    0x2dcb(%rip),%r13
mov    0x0(%r13),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
je     121c <show_fe_exceptions+0xdc>
lea    0xe49(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    0x2dcd(%rip),%r14
mov    (%r14),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
je     1249 <show_fe_exceptions+0x109>
lea    0xe27(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
lea    0xe0b(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
xor    %eax,%eax
call   1050 <fegetexcept@plt>
mov    %eax,%ebp
mov    0x2d61(%rip),%rax
test   %ebp,(%rax)
je     129c <show_fe_exceptions+0x15c>
lea    0xda2(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
test   %ebp,(%r15)
je     12ba <show_fe_exceptions+0x17a>
lea    0xd8e(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
test   %ebp,(%r12)
je     12d9 <show_fe_exceptions+0x199>
lea    0xd80(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
test   %ebp,0x0(%r13)
je     12f8 <show_fe_exceptions+0x1b8>
lea    0xd6d(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
test   %ebp,(%r14)
je     1316 <show_fe_exceptions+0x1d6>
lea    0xd5a(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fputc@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"IEEE floating-point exception flags raised:\00"
@FE_INEXACT = global i32 0
@.str.1 = [10 x i8] c" inexact;\00"
@FE_DIVBYZERO = global i32 0
@.str.2 = [17 x i8] c" divide by zero;\00"
@FE_UNDERFLOW = global i32 0
@.str.3 = [12 x i8] c" underflow;\00"
@FE_OVERFLOW = global i32 0
@.str.4 = [11 x i8] c" overflow;\00"
@FE_INVALID = global i32 0
@.str.5 = [10 x i8] c" invalid;\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [45 x i8] c"IEEE floating-point exception traps enabled:\00"
define void @show_fe_exceptions(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @FE_INEXACT
%7 = call i64 @fetestexcept(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32*, i32** %2
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* @FE_DIVBYZERO
%14 = call i64 @fetestexcept(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32*, i32** %2
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %16, %12
%20 = load i32, i32* @FE_UNDERFLOW
%21 = call i64 @fetestexcept(i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32*, i32** %2
%25 = call i32 @fprintf(i32* %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %23, %19
%27 = load i32, i32* @FE_OVERFLOW
%28 = call i64 @fetestexcept(i32 %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load i32*, i32** %2
%32 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %30, %26
%34 = load i32, i32* @FE_INVALID
%35 = call i64 @fetestexcept(i32 %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load i32*, i32** %2
%39 = call i32 @fprintf(i32* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %40
40: ; preds = %37, %33
%41 = load i32*, i32** %2
%42 = call i32 @fprintf(i32* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%43 = load i32*, i32** %2
%44 = call i32 @fprintf(i32* %43, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0))
%45 = call i32 (...) @fegetexcept()
store i32 %45, i32* %3
%46 = load i32, i32* %3
%47 = load i32, i32* @FE_INEXACT
%48 = and i32 %46, %47
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %40
%51 = load i32*, i32** %2
%52 = call i32 @fprintf(i32* %51, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %53
53: ; preds = %50, %40
%54 = load i32, i32* %3
%55 = load i32, i32* @FE_DIVBYZERO
%56 = and i32 %54, %55
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %53
%59 = load i32*, i32** %2
%60 = call i32 @fprintf(i32* %59, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %61
61: ; preds = %58, %53
%62 = load i32, i32* %3
%63 = load i32, i32* @FE_UNDERFLOW
%64 = and i32 %62, %63
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %61
%67 = load i32*, i32** %2
%68 = call i32 @fprintf(i32* %67, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %69
69: ; preds = %66, %61
%70 = load i32, i32* %3
%71 = load i32, i32* @FE_OVERFLOW
%72 = and i32 %70, %71
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %69
%75 = load i32*, i32** %2
%76 = call i32 @fprintf(i32* %75, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %77
77: ; preds = %74, %69
%78 = load i32, i32* %3
%79 = load i32, i32* @FE_INVALID
%80 = and i32 %78, %79
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %77
%83 = load i32*, i32** %2
%84 = call i32 @fprintf(i32* %83, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %85
85: ; preds = %82, %77
%86 = load i32*, i32** %2
%87 = call i32 @fprintf(i32* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"IEEE floating-point exception flags raised:\00"
@FE_INEXACT = global i32 0
@.str.1 = [10 x i8] c" inexact;\00"
@FE_DIVBYZERO = global i32 0
@.str.2 = [17 x i8] c" divide by zero;\00"
@FE_UNDERFLOW = global i32 0
@.str.3 = [12 x i8] c" underflow;\00"
@FE_OVERFLOW = global i32 0
@.str.4 = [11 x i8] c" overflow;\00"
@FE_INVALID = global i32 0
@.str.5 = [10 x i8] c" invalid;\00"
@.str.7 = [45 x i8] c"IEEE floating-point exception traps enabled:\00"
define void @show_fe_exceptions(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 43, i64 1, i32* %0)
%3 = load i32, i32* @FE_INEXACT
%4 = tail call i64 @fetestexcept(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 9, i64 1, i32* %0)
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* @FE_DIVBYZERO
%10 = tail call i64 @fetestexcept(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i64 16, i64 1, i32* %0)
br label %14
14: ; preds = %12, %8
%15 = load i32, i32* @FE_UNDERFLOW
%16 = tail call i64 @fetestexcept(i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %0)
br label %20
20: ; preds = %18, %14
%21 = load i32, i32* @FE_OVERFLOW
%22 = tail call i64 @fetestexcept(i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %20
%25 = tail call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i64 10, i64 1, i32* %0)
br label %26
26: ; preds = %24, %20
%27 = load i32, i32* @FE_INVALID
%28 = tail call i64 @fetestexcept(i32 %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %26
%31 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i64 9, i64 1, i32* %0)
br label %32
32: ; preds = %30, %26
%33 = tail call i32 @fputc(i32 10, i32* %0)
%34 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i64 44, i64 1, i32* %0)
%35 = tail call i32 (...) @fegetexcept()
%36 = load i32, i32* @FE_INEXACT
%37 = and i32 %36, %35
%38 = icmp eq i32 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %32
%40 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 9, i64 1, i32* %0)
br label %41
41: ; preds = %39, %32
%42 = load i32, i32* @FE_DIVBYZERO
%43 = and i32 %42, %35
%44 = icmp eq i32 %43, 0
br i1 %44, label %47, label %45
45: ; preds = %41
%46 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i64 16, i64 1, i32* %0)
br label %47
47: ; preds = %45, %41
%48 = load i32, i32* @FE_UNDERFLOW
%49 = and i32 %48, %35
%50 = icmp eq i32 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %47
%52 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %0)
br label %53
53: ; preds = %51, %47
%54 = load i32, i32* @FE_OVERFLOW
%55 = and i32 %54, %35
%56 = icmp eq i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %53
%58 = tail call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i64 10, i64 1, i32* %0)
br label %59
59: ; preds = %57, %53
%60 = load i32, i32* @FE_INVALID
%61 = and i32 %60, %35
%62 = icmp eq i32 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %59
%64 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i64 9, i64 1, i32* %0)
br label %65
65: ; preds = %63, %59
%66 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}