#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*/ floats_differ_enough(float, float);
int monitor_check_condition(int op, float cond_value, float value) {
  switch (op) {
  case 0:
    return value > cond_value ? 1 : 0;
  case 1:
    return value >= cond_value ? 1 : 0;
  case 2:
    return value < cond_value ? 1 : 0;
  case 3:
    return value <= cond_value ? 1 : 0;
  case 4:
    return floats_differ_enough(value, cond_value) ? 0 : 1;
  case 5:
    return floats_differ_enough(value, cond_value) ? 1 : 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<monitor_check_condition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x5,%rax
ja     1212 <monitor_check_condition+0x102>
mov    -0x18(%rbp),%rax
lea    0xebf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x10(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
xor    %eax,%eax
mov    $0x1,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <monitor_check_condition+0x109>
movss  -0x10(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
xor    %eax,%eax
mov    $0x1,%ecx
ucomiss %xmm1,%xmm0
cmovae %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <monitor_check_condition+0x109>
movss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
xor    %eax,%eax
mov    $0x1,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <monitor_check_condition+0x109>
movss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
xor    %eax,%eax
mov    $0x1,%ecx
ucomiss %xmm1,%xmm0
cmovae %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <monitor_check_condition+0x109>
movss  -0x10(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <floats_differ_enough@plt>
mov    %eax,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <monitor_check_condition+0x109>
movss  -0x10(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <floats_differ_enough@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <monitor_check_condition+0x109>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<monitor_check_condition>:
push   %rax
cmp    $0x5,%edi
ja     1133 <monitor_check_condition+0x23>
movaps %xmm0,%xmm2
mov    %edi,%eax
lea    0xede(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
ucomiss %xmm2,%xmm1
seta   %al
jmp    1171 <monitor_check_condition+0x61>
xor    %eax,%eax
jmp    1171 <monitor_check_condition+0x61>
ucomiss %xmm2,%xmm1
setae  %al
jmp    1171 <monitor_check_condition+0x61>
ucomiss %xmm1,%xmm2
seta   %al
jmp    1171 <monitor_check_condition+0x61>
ucomiss %xmm1,%xmm2
setae  %al
jmp    1171 <monitor_check_condition+0x61>
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
call   1030 <floats_differ_enough@plt>
test   %eax,%eax
sete   %al
jmp    1171 <monitor_check_condition+0x61>
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
call   1030 <floats_differ_enough@plt>
test   %eax,%eax
setne  %al
movzbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @monitor_check_condition(i32 %0, float %1, float %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store i32 %0, i32* %5
store float %1, float* %6
store float %2, float* %7
%8 = load i32, i32* %5
switch i32 %8, label %47 [
i32 0, label %9
i32 1, label %15
i32 2, label %21
i32 3, label %27
i32 4, label %33
i32 5, label %40
]
9: ; preds = %3
%10 = load float, float* %7
%11 = load float, float* %6
%12 = fcmp ogt float %10, %11
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
store i32 %14, i32* %4
br label %48
15: ; preds = %3
%16 = load float, float* %7
%17 = load float, float* %6
%18 = fcmp oge float %16, %17
%19 = zext i1 %18 to i64
%20 = select i1 %18, i32 1, i32 0
store i32 %20, i32* %4
br label %48
21: ; preds = %3
%22 = load float, float* %7
%23 = load float, float* %6
%24 = fcmp olt float %22, %23
%25 = zext i1 %24 to i64
%26 = select i1 %24, i32 1, i32 0
store i32 %26, i32* %4
br label %48
27: ; preds = %3
%28 = load float, float* %7
%29 = load float, float* %6
%30 = fcmp ole float %28, %29
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 1, i32 0
store i32 %32, i32* %4
br label %48
33: ; preds = %3
%34 = load float, float* %7
%35 = load float, float* %6
%36 = call i32 @floats_differ_enough(float %34, float %35)
%37 = icmp ne i32 %36, 0
%38 = zext i1 %37 to i64
%39 = select i1 %37, i32 0, i32 1
store i32 %39, i32* %4
br label %48
40: ; preds = %3
%41 = load float, float* %7
%42 = load float, float* %6
%43 = call i32 @floats_differ_enough(float %41, float %42)
%44 = icmp ne i32 %43, 0
%45 = zext i1 %44 to i64
%46 = select i1 %44, i32 1, i32 0
store i32 %46, i32* %4
br label %48
47: ; preds = %3
store i32 0, i32* %4
br label %48
48: ; preds = %47, %40, %33, %27, %21, %15, %9
%49 = load i32, i32* %4
ret i32 %49
}

LLVM IR (-O2):
define i32 @monitor_check_condition(i32 %0, float %1, float %2) {
switch i32 %0, label %18 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %15
]
4: ; preds = %3
%5 = fcmp ogt float %2, %1
br label %18
6: ; preds = %3
%7 = fcmp oge float %2, %1
br label %18
8: ; preds = %3
%9 = fcmp olt float %2, %1
br label %18
10: ; preds = %3
%11 = fcmp ole float %2, %1
br label %18
12: ; preds = %3
%13 = tail call i32 @floats_differ_enough(float %2, float %1)
%14 = icmp eq i32 %13, 0
br label %18
15: ; preds = %3
%16 = tail call i32 @floats_differ_enough(float %2, float %1)
%17 = icmp ne i32 %16, 0
br label %18
18: ; preds = %3, %15, %12, %10, %8, %6, %4
%19 = phi i1 [ %17, %15 ], [ %14, %12 ], [ %11, %10 ], [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ false, %3 ]
%20 = zext i1 %19 to i32
ret i32 %20
}