#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_DOWNWARD;
int /*<<< orphan*/ FE_TONEAREST;
int /*<<< orphan*/ FE_TOWARDZERO;
int /*<<< orphan*/ FE_UPWARD;
int FLT_ROUNDS;
scalar_t__ fesetround(int /*<<< orphan*/);
int main(void) {
  if (fesetround(FE_TONEAREST) >= 0 && FLT_ROUNDS != 1)
    return 1;
  if (fesetround(FE_TOWARDZERO) >= 0 && FLT_ROUNDS != 0)
    return 1;
  if (fesetround(FE_UPWARD) >= 0 && FLT_ROUNDS != 2)
    return 1;
  if (fesetround(FE_DOWNWARD) >= 0 && FLT_ROUNDS != 3)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
call   1030 <fesetround@plt>
cmp    $0x0,%rax
jl     1153 <main+0x43>
mov    0x2eaa(%rip),%rax
cmpl   $0x1,(%rax)
je     1153 <main+0x43>
movl   $0x1,-0x4(%rbp)
jmp    11f6 <main+0xe6>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1030 <fesetround@plt>
cmp    $0x0,%rax
jl     1187 <main+0x77>
mov    0x2e76(%rip),%rax
cmpl   $0x0,(%rax)
je     1187 <main+0x77>
movl   $0x1,-0x4(%rbp)
jmp    11f6 <main+0xe6>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
call   1030 <fesetround@plt>
cmp    $0x0,%rax
jl     11bb <main+0xab>
mov    0x2e42(%rip),%rax
cmpl   $0x2,(%rax)
je     11bb <main+0xab>
movl   $0x1,-0x4(%rbp)
jmp    11f6 <main+0xe6>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
call   1030 <fesetround@plt>
cmp    $0x0,%rax
jl     11ef <main+0xdf>
mov    0x2e0e(%rip),%rax
cmpl   $0x3,(%rax)
je     11ef <main+0xdf>
movl   $0x1,-0x4(%rbp)
jmp    11f6 <main+0xe6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
call   1030 <fesetround@plt>
mov    0x2ebf(%rip),%r14
mov    $0x1,%ebx
test   %rax,%rax
js     1139 <main+0x29>
cmpl   $0x1,(%r14)
jne    118b <main+0x7b>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1030 <fesetround@plt>
test   %rax,%rax
js     1152 <main+0x42>
cmpl   $0x0,(%r14)
jne    118b <main+0x7b>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1030 <fesetround@plt>
test   %rax,%rax
js     116b <main+0x5b>
cmpl   $0x2,(%r14)
jne    118b <main+0x7b>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
call   1030 <fesetround@plt>
test   %rax,%rax
setns  %al
cmpl   $0x3,(%r14)
setne  %cl
and    %al,%cl
movzbl %cl,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@FE_TONEAREST = global i32 0
@FLT_ROUNDS = global i32 0
@FE_TOWARDZERO = global i32 0
@FE_UPWARD = global i32 0
@FE_DOWNWARD = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @FE_TONEAREST
%3 = call i64 @fesetround(i32 %2)
%4 = icmp sge i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i32, i32* @FLT_ROUNDS
%7 = icmp ne i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %5
store i32 1, i32* %1
br label %34
9: ; preds = %5, %0
%10 = load i32, i32* @FE_TOWARDZERO
%11 = call i64 @fesetround(i32 %10)
%12 = icmp sge i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* @FLT_ROUNDS
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 1, i32* %1
br label %34
17: ; preds = %13, %9
%18 = load i32, i32* @FE_UPWARD
%19 = call i64 @fesetround(i32 %18)
%20 = icmp sge i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32, i32* @FLT_ROUNDS
%23 = icmp ne i32 %22, 2
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 1, i32* %1
br label %34
25: ; preds = %21, %17
%26 = load i32, i32* @FE_DOWNWARD
%27 = call i64 @fesetround(i32 %26)
%28 = icmp sge i64 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = load i32, i32* @FLT_ROUNDS
%31 = icmp ne i32 %30, 3
br i1 %31, label %32, label %33
32: ; preds = %29
store i32 1, i32* %1
br label %34
33: ; preds = %29, %25
store i32 0, i32* %1
br label %34
34: ; preds = %33, %32, %24, %16, %8
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@FE_TONEAREST = global i32 0
@FLT_ROUNDS = global i32 0
@FE_TOWARDZERO = global i32 0
@FE_UPWARD = global i32 0
@FE_DOWNWARD = global i32 0
define i32 @main() {
%1 = load i32, i32* @FE_TONEAREST
%2 = tail call i64 @fesetround(i32 %1)
%3 = icmp sgt i64 %2, -1
%4 = load i32, i32* @FLT_ROUNDS
%5 = icmp ne i32 %4, 1
%6 = select i1 %3, i1 %5, i1 false
br i1 %6, label %29, label %7
7: ; preds = %0
%8 = load i32, i32* @FE_TOWARDZERO
%9 = tail call i64 @fesetround(i32 %8)
%10 = icmp sgt i64 %9, -1
%11 = load i32, i32* @FLT_ROUNDS
%12 = icmp ne i32 %11, 0
%13 = select i1 %10, i1 %12, i1 false
br i1 %13, label %29, label %14
14: ; preds = %7
%15 = load i32, i32* @FE_UPWARD
%16 = tail call i64 @fesetround(i32 %15)
%17 = icmp sgt i64 %16, -1
%18 = load i32, i32* @FLT_ROUNDS
%19 = icmp ne i32 %18, 2
%20 = select i1 %17, i1 %19, i1 false
br i1 %20, label %29, label %21
21: ; preds = %14
%22 = load i32, i32* @FE_DOWNWARD
%23 = tail call i64 @fesetround(i32 %22)
%24 = icmp sgt i64 %23, -1
%25 = load i32, i32* @FLT_ROUNDS
%26 = icmp ne i32 %25, 3
%27 = select i1 %24, i1 %26, i1 false
%28 = zext i1 %27 to i32
br label %29
29: ; preds = %21, %14, %7, %0
%30 = phi i32 [ 1, %0 ], [ 1, %7 ], [ 1, %14 ], [ %28, %21 ]
ret i32 %30
}