#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 *, ...);
void display(int const unit, double b, int const warning, int const critical) {
  if (critical != 0 && b > critical) {
    printf("<span color='%s'>", "#FF7373");
  } else if (warning != 0 && b > warning) {
    printf("<span color='%s'>", "#FFA500");
  } else {
    printf("<span>");
  }
  if (unit == 'b')
    b = b * 8;
  if (b < 1024) {
    printf("%5.1lf %c/s", b, unit);
  } else if (b < 1024 * 1024) {
    printf("%5.1lf K%c/s", b / 1024, unit);
  } else if (b < 1024 * 1024 * 1024) {
    printf("%5.1lf M%c/s", b / (1024 * 1024), unit);
  } else {
    printf("%5.1lf G%c/s", b / (1024 * 1024 * 1024), unit);
  }
  printf("</span>");
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     115e <display+0x4e>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    115e <display+0x4e>
lea    0xed5(%rip),%rdi
lea    0xee0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a9 <display+0x99>
cmpl   $0x0,-0x14(%rbp)
je     1196 <display+0x86>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1196 <display+0x86>
lea    0xe9d(%rip),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a4 <display+0x94>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a9 <display+0x99>
cmpl   $0x62,-0x4(%rbp)
jne    11c5 <display+0xb5>
movsd  0xe45(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe3b(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11f3 <display+0xe3>
movsd  -0x10(%rbp),%xmm0
mov    -0x4(%rbp),%esi
lea    0xe62(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1293 <display+0x183>
movsd  0xe15(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    122d <display+0x11d>
movsd  -0x10(%rbp),%xmm0
movsd  0xdf5(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x4(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    128e <display+0x17e>
movsd  0xde3(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1267 <display+0x157>
movsd  -0x10(%rbp),%xmm0
movsd  0xdc3(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x4(%rbp),%esi
lea    0xe07(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1289 <display+0x179>
movsd  -0x10(%rbp),%xmm0
movsd  0xda4(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x4(%rbp),%esi
lea    0xded(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    128e <display+0x17e>
jmp    1293 <display+0x183>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
test   %edx,%edx
movsd  %xmm0,0x8(%rsp)
je     113b <display+0x2b>
cvtsi2sd %edx,%xmm1
ucomisd %xmm1,%xmm0
jbe    113b <display+0x2b>
lea    0xf06(%rip),%rdi
lea    0xf11(%rip),%rsi
jmp    115a <display+0x4a>
test   %esi,%esi
je     1163 <display+0x53>
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
ucomisd %xmm1,%xmm0
jbe    1163 <display+0x53>
lea    0xee5(%rip),%rdi
lea    0xef8(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1171 <display+0x61>
lea    0xef0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
cmp    $0x62,%ebx
jne    1184 <display+0x74>
mulsd  0xe7c(%rip),%xmm0
movsd  0xe7c(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    119b <display+0x8b>
lea    0xec8(%rip),%rdi
jmp    11e8 <display+0xd8>
movsd  0xe6d(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11ba <display+0xaa>
mulsd  0xe7f(%rip),%xmm0
lea    0xeb5(%rip),%rdi
jmp    11e8 <display+0xd8>
movsd  0xe56(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11d9 <display+0xc9>
mulsd  0xe58(%rip),%xmm0
lea    0xea3(%rip),%rdi
jmp    11e8 <display+0xd8>
mulsd  0xe3f(%rip),%xmm0
lea    0xe9f(%rip),%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"<span color='%s'>\00"
@.str.1 = [8 x i8] c"#FF7373\00"
@.str.2 = [8 x i8] c"#FFA500\00"
@.str.3 = [7 x i8] c"<span>\00"
@.str.4 = [12 x i8] c"%5.1lf %c/s\00"
@.str.5 = [13 x i8] c"%5.1lf K%c/s\00"
@.str.6 = [13 x i8] c"%5.1lf M%c/s\00"
@.str.7 = [13 x i8] c"%5.1lf G%c/s\00"
@.str.8 = [8 x i8] c"</span>\00"
define void @display(i32 %0, double %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store double %1, double* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %4
%12 = load double, double* %6
%13 = load i32, i32* %8
%14 = sitofp i32 %13 to double
%15 = fcmp ogt double %12, %14
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %31
18: ; preds = %11, %4
%19 = load i32, i32* %7
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load double, double* %6
%23 = load i32, i32* %7
%24 = sitofp i32 %23 to double
%25 = fcmp ogt double %22, %24
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %30
28: ; preds = %21, %18
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
br label %31
31: ; preds = %30, %16
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 98
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load double, double* %6
%36 = fmul double %35, 8.000000e+00
store double %36, double* %6
br label %37
37: ; preds = %34, %31
%38 = load double, double* %6
%39 = fcmp olt double %38, 1.024000e+03
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = load double, double* %6
%42 = load i32, i32* %5
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %41, i32 %42)
br label %67
44: ; preds = %37
%45 = load double, double* %6
%46 = fcmp olt double %45, 0x4130000000000000
br i1 %46, label %47, label %52
47: ; preds = %44
%48 = load double, double* %6
%49 = fdiv double %48, 1.024000e+03
%50 = load i32, i32* %5
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %49, i32 %50)
br label %66
52: ; preds = %44
%53 = load double, double* %6
%54 = fcmp olt double %53, 0x41D0000000000000
br i1 %54, label %55, label %60
55: ; preds = %52
%56 = load double, double* %6
%57 = fdiv double %56, 0x4130000000000000
%58 = load i32, i32* %5
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double %57, i32 %58)
br label %65
60: ; preds = %52
%61 = load double, double* %6
%62 = fdiv double %61, 0x41D0000000000000
%63 = load i32, i32* %5
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), double %62, i32 %63)
br label %65
65: ; preds = %60, %55
br label %66
66: ; preds = %65, %47
br label %67
67: ; preds = %66, %40
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"<span color='%s'>\00"
@.str.1 = [8 x i8] c"#FF7373\00"
@.str.2 = [8 x i8] c"#FFA500\00"
@.str.3 = [7 x i8] c"<span>\00"
@.str.4 = [12 x i8] c"%5.1lf %c/s\00"
@.str.5 = [13 x i8] c"%5.1lf K%c/s\00"
@.str.6 = [13 x i8] c"%5.1lf M%c/s\00"
@.str.7 = [13 x i8] c"%5.1lf G%c/s\00"
@.str.8 = [8 x i8] c"</span>\00"
define void @display(i32 %0, double %1, i32 %2, i32 %3) {
%5 = icmp ne i32 %3, 0
%6 = sitofp i32 %3 to double
%7 = fcmp olt double %6, %1
%8 = and i1 %5, %7
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %20
11: ; preds = %4
%12 = icmp ne i32 %2, 0
%13 = sitofp i32 %2 to double
%14 = fcmp olt double %13, %1
%15 = and i1 %12, %14
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %20
18: ; preds = %11
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %16, %18, %9
%21 = icmp eq i32 %0, 98
%22 = fmul double %1, 8.000000e+00
%23 = select i1 %21, double %22, double %1
%24 = fcmp olt double %23, 1.024000e+03
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %23, i32 %0)
br label %40
27: ; preds = %20
%28 = fcmp olt double %23, 0x4130000000000000
br i1 %28, label %29, label %32
29: ; preds = %27
%30 = fmul double %23, 0x3F50000000000000
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %30, i32 %0)
br label %40
32: ; preds = %27
%33 = fcmp olt double %23, 0x41D0000000000000
br i1 %33, label %34, label %37
34: ; preds = %32
%35 = fmul double %23, 0x3EB0000000000000
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double %35, i32 %0)
br label %40
37: ; preds = %32
%38 = fmul double %23, 0x3E10000000000000
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), double %38, i32 %0)
br label %40
40: ; preds = %29, %37, %34, %25
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
ret void
}