#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 FE_ALL_EXCEPT;
int FE_DIVBYZERO;
int FE_INEXACT;
int FE_INVALID;
int FE_OVERFLOW;
int FE_UNDERFLOW;
int fetestexcept(int);
int /*<<< orphan*/ printf(char *);
void show_fe_exceptions(void) {
  int raised;
  printf("Current exceptions raised: ");
  raised = fetestexcept(FE_DIVBYZERO);
  if (raised & FE_DIVBYZERO)
    printf("FE_DIVBYZERO");
  raised = fetestexcept(FE_INEXACT);
  if (raised & FE_INEXACT)
    printf("FE_INEXACT");
  raised = fetestexcept(FE_INVALID);
  if (raised & FE_INVALID)
    printf("FE_INVALID");
  raised = fetestexcept(FE_OVERFLOW);
  if (raised & FE_OVERFLOW)
    printf("FE_OVERFLOW");
  raised = fetestexcept(FE_UNDERFLOW);
  if (raised & FE_UNDERFLOW)
    printf("FE_UNDERFLOW");
  raised = fetestexcept(FE_ALL_EXCEPT);
  if ((raised & FE_ALL_EXCEPT) == 0)
    printf("None exceptions");
  printf("\n");
}


x86 assembly (clang, -O0):
<show_fe_exceptions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e81(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1166 <show_fe_exceptions+0x46>
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e5f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1198 <show_fe_exceptions+0x78>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e3d(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11ca <show_fe_exceptions+0xaa>
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2dd3(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11fc <show_fe_exceptions+0xdc>
lea    0xe48(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2dc1(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     122e <show_fe_exceptions+0x10e>
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2d77(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1260 <show_fe_exceptions+0x140>
lea    0xdfd(%rip),%rdi
call   1040 <printf@plt>
lea    0xe01(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_fe_exceptions>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e8c(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fetestexcept@plt>
test   %eax,(%rbx)
je     115b <show_fe_exceptions+0x2b>
lea    0xec6(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e7e(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fetestexcept@plt>
test   %eax,(%rbx)
je     1179 <show_fe_exceptions+0x49>
lea    0xeb5(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e70(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fetestexcept@plt>
test   %eax,(%rbx)
je     1197 <show_fe_exceptions+0x67>
lea    0xea2(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e1a(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fetestexcept@plt>
test   %eax,(%rbx)
je     11b5 <show_fe_exceptions+0x85>
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e1c(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fetestexcept@plt>
test   %eax,(%rbx)
je     11d3 <show_fe_exceptions+0xa3>
lea    0xe7d(%rip),%rdi
call   1050 <printf@plt>
mov    0x2de6(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fetestexcept@plt>
test   %eax,(%rbx)
jne    11f1 <show_fe_exceptions+0xc1>
lea    0xe6c(%rip),%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1040 <putchar@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Current exceptions raised: \00"
@FE_DIVBYZERO = global i32 0
@.str.1 = [13 x i8] c"FE_DIVBYZERO\00"
@FE_INEXACT = global i32 0
@.str.2 = [11 x i8] c"FE_INEXACT\00"
@FE_INVALID = global i32 0
@.str.3 = [11 x i8] c"FE_INVALID\00"
@FE_OVERFLOW = global i32 0
@.str.4 = [12 x i8] c"FE_OVERFLOW\00"
@FE_UNDERFLOW = global i32 0
@.str.5 = [13 x i8] c"FE_UNDERFLOW\00"
@FE_ALL_EXCEPT = global i32 0
@.str.6 = [16 x i8] c"None exceptions\00"
@.str.7 = [2 x i8] c"\0A\00"
define void @show_fe_exceptions() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @FE_DIVBYZERO
%4 = call i32 @fetestexcept(i32 %3)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = load i32, i32* @FE_DIVBYZERO
%7 = and i32 %5, %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
%12 = load i32, i32* @FE_INEXACT
%13 = call i32 @fetestexcept(i32 %12)
store i32 %13, i32* %1
%14 = load i32, i32* %1
%15 = load i32, i32* @FE_INEXACT
%16 = and i32 %14, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %11
%21 = load i32, i32* @FE_INVALID
%22 = call i32 @fetestexcept(i32 %21)
store i32 %22, i32* %1
%23 = load i32, i32* %1
%24 = load i32, i32* @FE_INVALID
%25 = and i32 %23, %24
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %20
%30 = load i32, i32* @FE_OVERFLOW
%31 = call i32 @fetestexcept(i32 %30)
store i32 %31, i32* %1
%32 = load i32, i32* %1
%33 = load i32, i32* @FE_OVERFLOW
%34 = and i32 %32, %33
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %29
%37 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36, %29
%39 = load i32, i32* @FE_UNDERFLOW
%40 = call i32 @fetestexcept(i32 %39)
store i32 %40, i32* %1
%41 = load i32, i32* %1
%42 = load i32, i32* @FE_UNDERFLOW
%43 = and i32 %41, %42
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %38
%46 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %45, %38
%48 = load i32, i32* @FE_ALL_EXCEPT
%49 = call i32 @fetestexcept(i32 %48)
store i32 %49, i32* %1
%50 = load i32, i32* %1
%51 = load i32, i32* @FE_ALL_EXCEPT
%52 = and i32 %50, %51
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %47
%55 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %56
56: ; preds = %54, %47
%57 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Current exceptions raised: \00"
@FE_DIVBYZERO = global i32 0
@.str.1 = [13 x i8] c"FE_DIVBYZERO\00"
@FE_INEXACT = global i32 0
@.str.2 = [11 x i8] c"FE_INEXACT\00"
@FE_INVALID = global i32 0
@.str.3 = [11 x i8] c"FE_INVALID\00"
@FE_OVERFLOW = global i32 0
@.str.4 = [12 x i8] c"FE_OVERFLOW\00"
@FE_UNDERFLOW = global i32 0
@.str.5 = [13 x i8] c"FE_UNDERFLOW\00"
@FE_ALL_EXCEPT = global i32 0
@.str.6 = [16 x i8] c"None exceptions\00"
define void @show_fe_exceptions() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @FE_DIVBYZERO
%3 = tail call i32 @fetestexcept(i32 %2)
%4 = load i32, i32* @FE_DIVBYZERO
%5 = and i32 %4, %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = load i32, i32* @FE_INEXACT
%11 = tail call i32 @fetestexcept(i32 %10)
%12 = load i32, i32* @FE_INEXACT
%13 = and i32 %12, %11
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %9
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %9
%18 = load i32, i32* @FE_INVALID
%19 = tail call i32 @fetestexcept(i32 %18)
%20 = load i32, i32* @FE_INVALID
%21 = and i32 %20, %19
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %17
%24 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %23, %17
%26 = load i32, i32* @FE_OVERFLOW
%27 = tail call i32 @fetestexcept(i32 %26)
%28 = load i32, i32* @FE_OVERFLOW
%29 = and i32 %28, %27
%30 = icmp eq i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %25
%32 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %31, %25
%34 = load i32, i32* @FE_UNDERFLOW
%35 = tail call i32 @fetestexcept(i32 %34)
%36 = load i32, i32* @FE_UNDERFLOW
%37 = and i32 %36, %35
%38 = icmp eq i32 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %33
%40 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %41
41: ; preds = %39, %33
%42 = load i32, i32* @FE_ALL_EXCEPT
%43 = tail call i32 @fetestexcept(i32 %42)
%44 = load i32, i32* @FE_ALL_EXCEPT
%45 = and i32 %44, %43
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %41
%48 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %49
49: ; preds = %47, %41
%50 = tail call i32 @putchar(i32 10)
ret void
}