#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 /*<<< orphan*/ rate;

/* Variables and functions */
double fabs(int /*<<< orphan*/);
const char *ctxt_switch_loading(const double rate) {
  if ((fabs((rate) - (0.0)) < (0.0000001)))
    return "idle";
  if (rate > 10000.0)
    return "very high";
  if (rate > 1000.0)
    return "high";
  if (rate > 100.0)
    return "quite high";
  if (rate > 10.0)
    return "moderate";
  if (rate > 1.0)
    return "low";
  return "very low";
}


x86 assembly (clang, -O0):
<ctxt_switch_loading>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xec3(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1157 <ctxt_switch_loading+0x47>
lea    0xee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1225 <ctxt_switch_loading+0x115>
movsd  -0x10(%rbp),%xmm0
movsd  0xea4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    117e <ctxt_switch_loading+0x6e>
lea    0xec0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1225 <ctxt_switch_loading+0x115>
movsd  -0x10(%rbp),%xmm0
movsd  0xe85(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11a5 <ctxt_switch_loading+0x95>
lea    0xea9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1225 <ctxt_switch_loading+0x115>
movsd  -0x10(%rbp),%xmm0
movsd  0xe66(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11cc <ctxt_switch_loading+0xbc>
lea    0xe7c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1225 <ctxt_switch_loading+0x115>
movsd  -0x10(%rbp),%xmm0
movsd  0xe47(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11f3 <ctxt_switch_loading+0xe3>
lea    0xe60(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1225 <ctxt_switch_loading+0x115>
movsd  -0x10(%rbp),%xmm0
movsd  0xe28(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    121a <ctxt_switch_loading+0x10a>
lea    0xe47(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1225 <ctxt_switch_loading+0x115>
lea    0xe32(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctxt_switch_loading>:
push   %rax
movsd  %xmm0,(%rsp)
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
movsd  0xed9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1136 <ctxt_switch_loading+0x26>
lea    0xefc(%rip),%rax
pop    %rcx
ret
movsd  (%rsp),%xmm0
ucomisd 0xec5(%rip),%xmm0
jbe    114e <ctxt_switch_loading+0x3e>
lea    0xee9(%rip),%rax
pop    %rcx
ret
ucomisd 0xeba(%rip),%xmm0
jbe    1161 <ctxt_switch_loading+0x51>
lea    0xee6(%rip),%rax
pop    %rcx
ret
ucomisd 0xeaf(%rip),%xmm0
jbe    1174 <ctxt_switch_loading+0x64>
lea    0xecd(%rip),%rax
pop    %rcx
ret
ucomisd 0xea4(%rip),%xmm0
jbe    1187 <ctxt_switch_loading+0x77>
lea    0xec5(%rip),%rax
pop    %rcx
ret
ucomisd 0xe99(%rip),%xmm0
lea    0xec2(%rip),%rcx
lea    0xeb6(%rip),%rax
cmova  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"idle\00"
@.str.1 = [10 x i8] c"very high\00"
@.str.2 = [5 x i8] c"high\00"
@.str.3 = [11 x i8] c"quite high\00"
@.str.4 = [9 x i8] c"moderate\00"
@.str.5 = [4 x i8] c"low\00"
@.str.6 = [9 x i8] c"very low\00"
define i8* @ctxt_switch_loading(double %0) {
%2 = alloca i8*
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fsub double %4, 0.000000e+00
%6 = fptosi double %5 to i32
%7 = call double @fabs(i32 %6)
%8 = fcmp olt double %7, 0x3E7AD7F29ABCAF48
br i1 %8, label %9, label %10
9: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %31
10: ; preds = %1
%11 = load double, double* %3
%12 = fcmp ogt double %11, 1.000000e+04
br i1 %12, label %13, label %14
13: ; preds = %10
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %31
14: ; preds = %10
%15 = load double, double* %3
%16 = fcmp ogt double %15, 1.000000e+03
br i1 %16, label %17, label %18
17: ; preds = %14
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %31
18: ; preds = %14
%19 = load double, double* %3
%20 = fcmp ogt double %19, 1.000000e+02
br i1 %20, label %21, label %22
21: ; preds = %18
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %31
22: ; preds = %18
%23 = load double, double* %3
%24 = fcmp ogt double %23, 1.000000e+01
br i1 %24, label %25, label %26
25: ; preds = %22
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %31
26: ; preds = %22
%27 = load double, double* %3
%28 = fcmp ogt double %27, 1.000000e+00
br i1 %28, label %29, label %30
29: ; preds = %26
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %31
30: ; preds = %26
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %31
31: ; preds = %30, %29, %25, %21, %17, %13, %9
%32 = load i8*, i8** %2
ret i8* %32
}

LLVM IR (-O2):
@.str = [5 x i8] c"idle\00"
@.str.1 = [10 x i8] c"very high\00"
@.str.2 = [5 x i8] c"high\00"
@.str.3 = [11 x i8] c"quite high\00"
@.str.4 = [9 x i8] c"moderate\00"
@.str.5 = [4 x i8] c"low\00"
@.str.6 = [9 x i8] c"very low\00"
define i8* @ctxt_switch_loading(double %0) {
%2 = fptosi double %0 to i32
%3 = tail call double @fabs(i32 %2)
%4 = fcmp olt double %3, 0x3E7AD7F29ABCAF48
br i1 %4, label %16, label %5
5: ; preds = %1
%6 = fcmp ogt double %0, 1.000000e+04
br i1 %6, label %16, label %7
7: ; preds = %5
%8 = fcmp ogt double %0, 1.000000e+03
br i1 %8, label %16, label %9
9: ; preds = %7
%10 = fcmp ogt double %0, 1.000000e+02
br i1 %10, label %16, label %11
11: ; preds = %9
%12 = fcmp ogt double %0, 1.000000e+01
br i1 %12, label %16, label %13
13: ; preds = %11
%14 = fcmp ogt double %0, 1.000000e+00
%15 = select i1 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0)
br label %16
16: ; preds = %13, %11, %9, %7, %5, %1
%17 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), %9 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), %11 ], [ %15, %13 ]
ret i8* %17
}