#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*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
const char *mem_loading(const double mem_rate) {
  char *verb, *adverb;
  static char buffer[64];
  double rate = mem_rate;
  if ((fabs((rate) - (0.0)) < (0.0000001)))
    return "no change";
  if (rate < 0) {
    verb = "shrinking";
    rate = -mem_rate;
  } else
    verb = "growing";
  if (rate < 1024.0)
    adverb = " slowly";
  else if (rate >= 2.0 * 1024.0 * 1024.0)
    adverb = " very fast";
  else if (rate >= 256.0 * 1024.0)
    adverb = " fast";
  else if (rate >= 8.0 * 1024.0)
    adverb = " moderately fast";
  else
    adverb = "";
  sprintf(buffer, "%s%s", verb, adverb);
  return buffer;
}


x86 assembly (clang, -O0):
<mem_loading>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xea9(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1171 <mem_loading+0x51>
lea    0xec0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1293 <mem_loading+0x173>
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11b0 <mem_loading+0x90>
lea    0xeac(%rip),%rax
mov    %rax,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11bb <mem_loading+0x9b>
lea    0xe85(%rip),%rax
mov    %rax,-0x18(%rbp)
movsd  0xe45(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11de <mem_loading+0xbe>
lea    0xe6f(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    126d <mem_loading+0x14d>
movsd  -0x28(%rbp),%xmm0
movsd  0xe25(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1205 <mem_loading+0xe5>
lea    0xe50(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1268 <mem_loading+0x148>
movsd  -0x28(%rbp),%xmm0
movsd  0xe06(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     122c <mem_loading+0x10c>
lea    0xe3f(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1263 <mem_loading+0x143>
movsd  -0x28(%rbp),%xmm0
movsd  0xde7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1253 <mem_loading+0x133>
lea    0xe0d(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    125e <mem_loading+0x13e>
lea    0xdd7(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1263 <mem_loading+0x143>
jmp    1268 <mem_loading+0x148>
jmp    126d <mem_loading+0x14d>
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0x2dc4(%rip),%rdi
lea    0xde5(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2db1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_loading>:
push   %rbx
sub    $0x10,%rsp
movapd %xmm0,(%rsp)
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
movsd  0xec5(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    114d <mem_loading+0x2d>
lea    0xef8(%rip),%rbx
jmp    11e3 <mem_loading+0xc3>
xorpd  %xmm0,%xmm0
movapd (%rsp),%xmm1
ucomisd %xmm1,%xmm0
lea    0xee9(%rip),%rax
lea    0xeec(%rip),%rdx
cmova  %rax,%rdx
jbe    1176 <mem_loading+0x56>
xorpd  0xeba(%rip),%xmm1
movsd  0xe8a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    118d <mem_loading+0x6d>
lea    0xed1(%rip),%rcx
jmp    11cd <mem_loading+0xad>
ucomisd 0xe7b(%rip),%xmm1
jae    11bd <mem_loading+0x9d>
ucomisd 0xe79(%rip),%xmm1
jae    11c6 <mem_loading+0xa6>
ucomisd 0xe77(%rip),%xmm1
lea    0xe99(%rip),%rax
lea    0xeb8(%rip),%rcx
cmovb  %rax,%rcx
jmp    11cd <mem_loading+0xad>
lea    0xea0(%rip),%rcx
jmp    11cd <mem_loading+0xad>
lea    0xead(%rip),%rcx
lea    0x2e6c(%rip),%rbx
lea    0xea5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@mem_loading.buffer = internal global [64 x i8] zeroinitializer
@.str = [10 x i8] c"no change\00"
@.str.1 = [10 x i8] c"shrinking\00"
@.str.2 = [8 x i8] c"growing\00"
@.str.3 = [8 x i8] c" slowly\00"
@.str.4 = [11 x i8] c" very fast\00"
@.str.5 = [6 x i8] c" fast\00"
@.str.6 = [17 x i8] c" moderately fast\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [5 x i8] c"%s%s\00"
define i8* @mem_loading(double %0) {
%2 = alloca i8*
%3 = alloca double
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
store double %0, double* %3
%7 = load double, double* %3
store double %7, double* %6
%8 = load double, double* %6
%9 = fsub double %8, 0.000000e+00
%10 = fptosi double %9 to i32
%11 = call double @fabs(i32 %10)
%12 = fcmp olt double %11, 0x3E7AD7F29ABCAF48
br i1 %12, label %13, label %14
13: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %45
14: ; preds = %1
%15 = load double, double* %6
%16 = fcmp olt double %15, 0.000000e+00
br i1 %16, label %17, label %20
17: ; preds = %14
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %4
%18 = load double, double* %3
%19 = fneg double %18
store double %19, double* %6
br label %21
20: ; preds = %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %4
br label %21
21: ; preds = %20, %17
%22 = load double, double* %6
%23 = fcmp olt double %22, 1.024000e+03
br i1 %23, label %24, label %25
24: ; preds = %21
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %5
br label %41
25: ; preds = %21
%26 = load double, double* %6
%27 = fcmp oge double %26, 0x4140000000000000
br i1 %27, label %28, label %29
28: ; preds = %25
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %5
br label %40
29: ; preds = %25
%30 = load double, double* %6
%31 = fcmp oge double %30, 2.621440e+05
br i1 %31, label %32, label %33
32: ; preds = %29
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %5
br label %39
33: ; preds = %29
%34 = load double, double* %6
%35 = fcmp oge double %34, 8.192000e+03
br i1 %35, label %36, label %37
36: ; preds = %33
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8** %5
br label %38
37: ; preds = %33
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8** %5
br label %38
38: ; preds = %37, %36
br label %39
39: ; preds = %38, %32
br label %40
40: ; preds = %39, %28
br label %41
41: ; preds = %40, %24
%42 = load i8*, i8** %4
%43 = load i8*, i8** %5
%44 = call i32 @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @mem_loading.buffer, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %42, i8* %43)
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @mem_loading.buffer, i64 0, i64 0), i8** %2
br label %45
45: ; preds = %41, %13
%46 = load i8*, i8** %2
ret i8* %46
}

LLVM IR (-O2):
@mem_loading.buffer = internal global [64 x i8] zeroinitializer
@.str = [10 x i8] c"no change\00"
@.str.1 = [10 x i8] c"shrinking\00"
@.str.2 = [8 x i8] c"growing\00"
@.str.3 = [8 x i8] c" slowly\00"
@.str.4 = [11 x i8] c" very fast\00"
@.str.5 = [6 x i8] c" fast\00"
@.str.6 = [17 x i8] c" moderately fast\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [5 x i8] c"%s%s\00"
define i8* @mem_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 %21, label %5
5: ; preds = %1
%6 = fcmp olt double %0, 0.000000e+00
%7 = fneg double %0
%8 = select i1 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%9 = select i1 %6, double %7, double %0
%10 = fcmp olt double %9, 1.024000e+03
br i1 %10, label %18, label %11
11: ; preds = %5
%12 = fcmp ult double %9, 0x4140000000000000
br i1 %12, label %13, label %18
13: ; preds = %11
%14 = fcmp ult double %9, 2.621440e+05
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = fcmp ult double %9, 8.192000e+03
%17 = select i1 %16, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0)
br label %18
18: ; preds = %15, %13, %11, %5
%19 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %11 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %13 ], [ %17, %15 ]
%20 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @mem_loading.buffer, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %8, i8* %19)
br label %21
21: ; preds = %1, %18
%22 = phi i8* [ getelementptr inbounds ([64 x i8], [64 x i8]* @mem_loading.buffer, i64 0, i64 0), %18 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %22
}