#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*/ FE_ALL_EXCEPT;
int FE_DIVBYZERO;
int FE_INVALID;
int FE_OVERFLOW;
int FE_UNDERFLOW;
int fetestexcept(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void dsp_util_print_fp_exceptions() {
  int excepts = fetestexcept(FE_ALL_EXCEPT);
  printf("floating-point exceptions: ");
  if (excepts & FE_DIVBYZERO)
    printf("FE_DIVBYZERO ");
  if (excepts & FE_INVALID)
    printf("FE_INVALID ");
  if (excepts & FE_OVERFLOW)
    printf("FE_OVERFLOW ");
  if (excepts & FE_UNDERFLOW)
    printf("FE_UNDERFLOW ");
  printf("\n");
}


x86 assembly (clang, -O0):
<dsp_util_print_fp_exceptions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
mov    %eax,-0x4(%rbp)
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    0x2e89(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1166 <dsp_util_print_fp_exceptions+0x46>
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    0x2e80(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1187 <dsp_util_print_fp_exceptions+0x67>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    0x2e2f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11a8 <dsp_util_print_fp_exceptions+0x88>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    0x2e2e(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11c9 <dsp_util_print_fp_exceptions+0xa9>
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dsp_util_print_fp_exceptions>:
push   %rbx
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
mov    %eax,%ebx
lea    0xeb8(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e84(%rip),%rax
test   %ebx,(%rax)
je     1164 <dsp_util_print_fp_exceptions+0x34>
lea    0xebd(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e85(%rip),%rax
test   %ebx,(%rax)
je     117b <dsp_util_print_fp_exceptions+0x4b>
lea    0xeb4(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e3e(%rip),%rax
test   %ebx,(%rax)
je     1192 <dsp_util_print_fp_exceptions+0x62>
lea    0xea9(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e47(%rip),%rax
test   %ebx,(%rax)
je     11a9 <dsp_util_print_fp_exceptions+0x79>
lea    0xe9f(%rip),%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1040 <putchar@plt>

LLVM IR (-O0):
@FE_ALL_EXCEPT = global i32 0
@.str = [28 x i8] c"floating-point exceptions: \00"
@FE_DIVBYZERO = global i32 0
@.str.1 = [14 x i8] c"FE_DIVBYZERO \00"
@FE_INVALID = global i32 0
@.str.2 = [12 x i8] c"FE_INVALID \00"
@FE_OVERFLOW = global i32 0
@.str.3 = [13 x i8] c"FE_OVERFLOW \00"
@FE_UNDERFLOW = global i32 0
@.str.4 = [14 x i8] c"FE_UNDERFLOW \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @dsp_util_print_fp_exceptions() {
%1 = alloca i32
%2 = load i32, i32* @FE_ALL_EXCEPT
%3 = call i32 @fetestexcept(i32 %2)
store i32 %3, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
%12 = load i32, i32* %1
%13 = load i32, i32* @FE_INVALID
%14 = and i32 %12, %13
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %11
%19 = load i32, i32* %1
%20 = load i32, i32* @FE_OVERFLOW
%21 = and i32 %19, %20
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %23, %18
%26 = load i32, i32* %1
%27 = load i32, i32* @FE_UNDERFLOW
%28 = and i32 %26, %27
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %30, %25
%33 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@FE_ALL_EXCEPT = global i32 0
@.str = [28 x i8] c"floating-point exceptions: \00"
@FE_DIVBYZERO = global i32 0
@.str.1 = [14 x i8] c"FE_DIVBYZERO \00"
@FE_INVALID = global i32 0
@.str.2 = [12 x i8] c"FE_INVALID \00"
@FE_OVERFLOW = global i32 0
@.str.3 = [13 x i8] c"FE_OVERFLOW \00"
@FE_UNDERFLOW = global i32 0
@.str.4 = [14 x i8] c"FE_UNDERFLOW \00"
define void @dsp_util_print_fp_exceptions() {
%1 = load i32, i32* @FE_ALL_EXCEPT
%2 = tail call i32 @fetestexcept(i32 %1)
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @FE_DIVBYZERO
%5 = and i32 %4, %2
%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 ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = load i32, i32* @FE_INVALID
%11 = and i32 %10, %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
%16 = load i32, i32* @FE_OVERFLOW
%17 = and i32 %16, %2
%18 = icmp eq i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
%22 = load i32, i32* @FE_UNDERFLOW
%23 = and i32 %22, %2
%24 = icmp eq i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %21
%26 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %21
%28 = tail call i32 @putchar(i32 10)
ret void
}