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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void print_mxcsr_exception_flags(FILE *f, const uint32_t mxcsr) {
  fprintf(f, "Exception flags\n");
  fprintf(f, "* precision         : %s\n", ((mxcsr & (0x0020)) ? "yes" : "no"));
  fprintf(f, "* underflow         : %s\n", ((mxcsr & (0x0010)) ? "yes" : "no"));
  fprintf(f, "* overflow          : %s\n", ((mxcsr & (0x0008)) ? "yes" : "no"));
  fprintf(f, "* divide by zero    : %s\n", ((mxcsr & (0x0004)) ? "yes" : "no"));
  fprintf(f, "* denormal          : %s\n", ((mxcsr & (0x0002)) ? "yes" : "no"));
  fprintf(f, "* invalid operation : %s\n", ((mxcsr & (0x0001)) ? "yes" : "no"));
}


x86 assembly (clang, -O0):
<print_mxcsr_exception_flags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
and    $0x20,%ecx
lea    0xeed(%rip),%rdx
lea    0xee2(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
and    $0x10,%ecx
lea    0xec0(%rip),%rdx
lea    0xeb5(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
and    $0x8,%ecx
lea    0xe93(%rip),%rdx
lea    0xe88(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe9b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
and    $0x4,%ecx
lea    0xe66(%rip),%rdx
lea    0xe5b(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe88(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
and    $0x2,%ecx
lea    0xe39(%rip),%rdx
lea    0xe2e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe75(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
and    $0x1,%ecx
lea    0xe0c(%rip),%rdx
lea    0xe01(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mxcsr_exception_flags>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xecc(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
test   $0x20,%r14b
lea    0xede(%rip),%r15
lea    0xed3(%rip),%rbp
mov    %rbp,%rdx
cmove  %r15,%rdx
lea    0xeab(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   $0x10,%r14b
mov    %rbp,%rdx
cmove  %r15,%rdx
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   $0x8,%r14b
mov    %rbp,%rdx
cmove  %r15,%rdx
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   $0x4,%r14b
mov    %rbp,%rdx
cmove  %r15,%rdx
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   $0x2,%r14b
mov    %rbp,%rdx
cmove  %r15,%rdx
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   $0x1,%r14b
cmove  %r15,%rbp
lea    0xeab(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Exception flags\0A\00"
@.str.1 = [26 x i8] c"* precision : %s\0A\00"
@.str.2 = [4 x i8] c"yes\00"
@.str.3 = [3 x i8] c"no\00"
@.str.4 = [26 x i8] c"* underflow : %s\0A\00"
@.str.5 = [26 x i8] c"* overflow : %s\0A\00"
@.str.6 = [26 x i8] c"* divide by zero : %s\0A\00"
@.str.7 = [26 x i8] c"* denormal : %s\0A\00"
@.str.8 = [26 x i8] c"* invalid operation : %s\0A\00"
define void @print_mxcsr_exception_flags(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
%9 = and i32 %8, 32
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i32*, i32** %3
%15 = load i32, i32* %4
%16 = and i32 %15, 16
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%21 = load i32*, i32** %3
%22 = load i32, i32* %4
%23 = and i32 %22, 8
%24 = icmp ne i32 %23, 0
%25 = zext i1 %24 to i64
%26 = select i1 %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %26)
%28 = load i32*, i32** %3
%29 = load i32, i32* %4
%30 = and i32 %29, 4
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %33)
%35 = load i32*, i32** %3
%36 = load i32, i32* %4
%37 = and i32 %36, 2
%38 = icmp ne i32 %37, 0
%39 = zext i1 %38 to i64
%40 = select i1 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %40)
%42 = load i32*, i32** %3
%43 = load i32, i32* %4
%44 = and i32 %43, 1
%45 = icmp ne i32 %44, 0
%46 = zext i1 %45 to i64
%47 = select i1 %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %47)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Exception flags\0A\00"
@.str.1 = [26 x i8] c"* precision : %s\0A\00"
@.str.2 = [4 x i8] c"yes\00"
@.str.3 = [3 x i8] c"no\00"
@.str.4 = [26 x i8] c"* underflow : %s\0A\00"
@.str.5 = [26 x i8] c"* overflow : %s\0A\00"
@.str.6 = [26 x i8] c"* divide by zero : %s\0A\00"
@.str.7 = [26 x i8] c"* denormal : %s\0A\00"
@.str.8 = [26 x i8] c"* invalid operation : %s\0A\00"
define void @print_mxcsr_exception_flags(i32* nocapture %0, i32 %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 16, i64 1, i32* %0)
%4 = and i32 %1, 32
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = and i32 %1, 16
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%12 = and i32 %1, 8
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%15 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %14)
%16 = and i32 %1, 4
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%19 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %18)
%20 = and i32 %1, 2
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %22)
%24 = and i32 %1, 1
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%27 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %26)
ret void
}