#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*/ printf(char *, double);
void mp2_report_memory(double nByte) {
  if (nByte > 1.0E12)
    printf("The number of memory required (in terabytes):  %4.1f\n",
           nByte / 1.0E12);
  else if (nByte > 1.0E9)
    printf("The number of memory required (in gigabytes):  %4.1f\n",
           nByte / 1.0E9);
  else if (nByte > 1.0E6)
    printf("The number of memory required (in megabytes):  %4.1f\n",
           nByte / 1.0E6);
  else
    printf("The number of memory required (in kilobytes):  %4.1f\n",
           nByte / 1.0E3);
}


x86 assembly (clang, -O0):
<mp2_report_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1156 <mp2_report_memory+0x46>
movsd  -0x8(%rbp),%xmm0
movsd  0xebf(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
jmp    11ef <mp2_report_memory+0xdf>
movsd  -0x8(%rbp),%xmm0
movsd  0xea5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    118f <mp2_report_memory+0x7f>
movsd  -0x8(%rbp),%xmm0
movsd  0xe8e(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
jmp    11ea <mp2_report_memory+0xda>
movsd  -0x8(%rbp),%xmm0
movsd  0xe74(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c8 <mp2_report_memory+0xb8>
movsd  -0x8(%rbp),%xmm0
movsd  0xe5d(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
jmp    11e5 <mp2_report_memory+0xd5>
movsd  -0x8(%rbp),%xmm0
movsd  0xe43(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
jmp    11ea <mp2_report_memory+0xda>
jmp    11ef <mp2_report_memory+0xdf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2_report_memory>:
movsd  0xee8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    112e <mp2_report_memory+0x1e>
lea    0xf03(%rip),%rdi
divsd  %xmm1,%xmm0
jmp    1030 <printf@plt>
movsd  0xed2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    114c <mp2_report_memory+0x3c>
lea    0xf1b(%rip),%rdi
divsd  %xmm1,%xmm0
jmp    1030 <printf@plt>
xor    %eax,%eax
ucomisd 0xeba(%rip),%xmm0
seta   %al
lea    0xeb8(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm1
lea    0xf28(%rip),%rax
lea    0xf57(%rip),%rdi
cmova  %rax,%rdi
divsd  %xmm1,%xmm0
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"The number of memory required (in terabytes): %4.1f\0A\00"
@.str.1 = [54 x i8] c"The number of memory required (in gigabytes): %4.1f\0A\00"
@.str.2 = [54 x i8] c"The number of memory required (in megabytes): %4.1f\0A\00"
@.str.3 = [54 x i8] c"The number of memory required (in kilobytes): %4.1f\0A\00"
define void @mp2_report_memory(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 1.000000e+12
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load double, double* %2
%7 = fdiv double %6, 1.000000e+12
%8 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), double %7)
br label %29
9: ; preds = %1
%10 = load double, double* %2
%11 = fcmp ogt double %10, 1.000000e+09
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load double, double* %2
%14 = fdiv double %13, 1.000000e+09
%15 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), double %14)
br label %28
16: ; preds = %9
%17 = load double, double* %2
%18 = fcmp ogt double %17, 1.000000e+06
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load double, double* %2
%21 = fdiv double %20, 1.000000e+06
%22 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), double %21)
br label %27
23: ; preds = %16
%24 = load double, double* %2
%25 = fdiv double %24, 1.000000e+03
%26 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), double %25)
br label %27
27: ; preds = %23, %19
br label %28
28: ; preds = %27, %12
br label %29
29: ; preds = %28, %5
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"The number of memory required (in terabytes): %4.1f\0A\00"
@.str.1 = [54 x i8] c"The number of memory required (in gigabytes): %4.1f\0A\00"
@.str.2 = [54 x i8] c"The number of memory required (in megabytes): %4.1f\0A\00"
@.str.3 = [54 x i8] c"The number of memory required (in kilobytes): %4.1f\0A\00"
define void @mp2_report_memory(double %0) {
%2 = fcmp ogt double %0, 1.000000e+12
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = fcmp ogt double %0, 1.000000e+09
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = fcmp ogt double %0, 1.000000e+06
%7 = select i1 %6, double 1.000000e+06, double 1.000000e+03
%8 = select i1 %6, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0)
br label %9
9: ; preds = %5, %3, %1
%10 = phi double [ 1.000000e+12, %1 ], [ 1.000000e+09, %3 ], [ %7, %5 ]
%11 = phi i8* [ getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), %3 ], [ %8, %5 ]
%12 = fdiv double %0, %10
%13 = tail call i32 @printf(i8* %11, double %12)
ret void
}