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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
void display(int const unit, int const divisor, double b, int const warning,
             int const critical) {
  char fmtstr[7];
  if (critical != 0 && b > critical) {
    printf("<span fallback='true' color='%s'>", "#FF7373");
  } else if (warning != 0 && b > warning) {
    printf("<span fallback='true' color='%s'>", "#FFA500");
  } else {
    printf("<span fallback='true'>");
  }
  if (unit == 'b')
    b = b * 8;
  snprintf(fmtstr, sizeof(fmtstr), "%%%d.1lf ", divisor > 1000 ? 6 : 5);
  if (b < divisor) {
    printf(fmtstr, b);
    printf(" %c/s", unit);
  } else if (b < divisor * divisor) {
    printf(fmtstr, b / divisor);
    printf("K%c/s", unit);
  } else if (b < divisor * divisor * divisor) {
    printf(fmtstr, b / (divisor * divisor));
    printf("M%c/s", unit);
  } else {
    printf(fmtstr, b / (divisor * divisor * divisor));
    printf("G%c/s", unit);
  }
  printf("</span>");
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1171 <display+0x51>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1171 <display+0x51>
lea    0xeaa(%rip),%rdi
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bc <display+0x9c>
cmpl   $0x0,-0x14(%rbp)
je     11a9 <display+0x89>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    11a9 <display+0x89>
lea    0xe72(%rip),%rdi
lea    0xe95(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b7 <display+0x97>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bc <display+0x9c>
cmpl   $0x62,-0x4(%rbp)
jne    11d8 <display+0xb8>
movsd  0xe32(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x1f(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    $0x5,%ecx
mov    $0x6,%eax
cmp    $0x3e8,%edx
cmovg  %eax,%ecx
mov    $0x7,%esi
lea    0xe53(%rip),%rdx
call   1040 <snprintf@plt>
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    123d <display+0x11d>
lea    -0x1f(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1317 <display+0x1f7>
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
ucomisd %xmm1,%xmm0
jbe    1286 <display+0x166>
lea    -0x1f(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1312 <display+0x1f2>
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
ucomisd %xmm1,%xmm0
jbe    12d9 <display+0x1b9>
lea    -0x1f(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130d <display+0x1ed>
lea    -0x1f(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1312 <display+0x1f2>
jmp    1317 <display+0x1f7>
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %edi,%ebx
test   %ecx,%ecx
movsd  %xmm0,0x8(%rsp)
je     114e <display+0x2e>
cvtsi2sd %ecx,%xmm1
ucomisd %xmm1,%xmm0
jbe    114e <display+0x2e>
lea    0xec3(%rip),%rdi
lea    0xede(%rip),%rsi
jmp    116d <display+0x4d>
test   %edx,%edx
je     1176 <display+0x56>
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
ucomisd %xmm1,%xmm0
jbe    1176 <display+0x56>
lea    0xea2(%rip),%rdi
lea    0xec5(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1184 <display+0x64>
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
cmp    $0x62,%ebx
jne    119d <display+0x7d>
mulsd  0xe69(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %ecx,%ecx
cmp    $0x3e9,%ebp
setge  %cl
add    $0x5,%ecx
lea    0xe9f(%rip),%rdx
lea    0x11(%rsp),%rdi
mov    $0x7,%esi
call   1040 <snprintf@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
movsd  0x8(%rsp),%xmm0
ucomisd %xmm0,%xmm1
jbe    11dd <display+0xbd>
lea    0xe80(%rip),%rbp
jmp    1221 <display+0x101>
mov    %ebp,%eax
imul   %ebp,%eax
cvtsi2sd %eax,%xmm2
ucomisd %xmm0,%xmm2
jbe    11f9 <display+0xd9>
divsd  %xmm1,%xmm0
lea    0xe6a(%rip),%rbp
jmp    1221 <display+0x101>
imul   %ebp,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
ucomisd %xmm0,%xmm1
jbe    1216 <display+0xf6>
divsd  %xmm2,%xmm0
lea    0xe53(%rip),%rbp
jmp    1221 <display+0x101>
divsd  %xmm1,%xmm0
lea    0xe4c(%rip),%rbp
lea    0x11(%rsp),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe33(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"<span fallback='true' color='%s'>\00"
@.str.1 = [8 x i8] c"#FF7373\00"
@.str.2 = [8 x i8] c"#FFA500\00"
@.str.3 = [23 x i8] c"<span fallback='true'>\00"
@.str.4 = [10 x i8] c"%%%d.1lf \00"
@.str.5 = [6 x i8] c" %c/s\00"
@.str.6 = [6 x i8] c"K%c/s\00"
@.str.7 = [6 x i8] c"M%c/s\00"
@.str.8 = [6 x i8] c"G%c/s\00"
@.str.9 = [8 x i8] c"</span>\00"
define void @display(i32 %0, i32 %1, double %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca [7 x i8]
store i32 %0, i32* %6
store i32 %1, i32* %7
store double %2, double* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load i32, i32* %10
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %5
%15 = load double, double* %8
%16 = load i32, i32* %10
%17 = sitofp i32 %16 to double
%18 = fcmp ogt double %15, %17
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %34
21: ; preds = %14, %5
%22 = load i32, i32* %9
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = load double, double* %8
%26 = load i32, i32* %9
%27 = sitofp i32 %26 to double
%28 = fcmp ogt double %25, %27
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %33
31: ; preds = %24, %21
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %33, %19
%35 = load i32, i32* %6
%36 = icmp eq i32 %35, 98
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load double, double* %8
%39 = fmul double %38, 8.000000e+00
store double %39, double* %8
br label %40
40: ; preds = %37, %34
%41 = getelementptr inbounds [7 x i8], [7 x i8]* %11, i64 0, i64 0
%42 = load i32, i32* %7
%43 = icmp sgt i32 %42, 1000
%44 = zext i1 %43 to i64
%45 = select i1 %43, i32 6, i32 5
%46 = call i32 @snprintf(i8* %41, i32 7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %45)
%47 = load double, double* %8
%48 = load i32, i32* %7
%49 = sitofp i32 %48 to double
%50 = fcmp olt double %47, %49
br i1 %50, label %51, label %57
51: ; preds = %40
%52 = getelementptr inbounds [7 x i8], [7 x i8]* %11, i64 0, i64 0
%53 = load double, double* %8
%54 = call i32 (i8*, ...) @printf(i8* %52, double %53)
%55 = load i32, i32* %6
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %55)
br label %108
57: ; preds = %40
%58 = load double, double* %8
%59 = load i32, i32* %7
%60 = load i32, i32* %7
%61 = mul nsw i32 %59, %60
%62 = sitofp i32 %61 to double
%63 = fcmp olt double %58, %62
br i1 %63, label %64, label %73
64: ; preds = %57
%65 = getelementptr inbounds [7 x i8], [7 x i8]* %11, i64 0, i64 0
%66 = load double, double* %8
%67 = load i32, i32* %7
%68 = sitofp i32 %67 to double
%69 = fdiv double %66, %68
%70 = call i32 (i8*, ...) @printf(i8* %65, double %69)
%71 = load i32, i32* %6
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %71)
br label %107
73: ; preds = %57
%74 = load double, double* %8
%75 = load i32, i32* %7
%76 = load i32, i32* %7
%77 = mul nsw i32 %75, %76
%78 = load i32, i32* %7
%79 = mul nsw i32 %77, %78
%80 = sitofp i32 %79 to double
%81 = fcmp olt double %74, %80
br i1 %81, label %82, label %93
82: ; preds = %73
%83 = getelementptr inbounds [7 x i8], [7 x i8]* %11, i64 0, i64 0
%84 = load double, double* %8
%85 = load i32, i32* %7
%86 = load i32, i32* %7
%87 = mul nsw i32 %85, %86
%88 = sitofp i32 %87 to double
%89 = fdiv double %84, %88
%90 = call i32 (i8*, ...) @printf(i8* %83, double %89)
%91 = load i32, i32* %6
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %91)
br label %106
93: ; preds = %73
%94 = getelementptr inbounds [7 x i8], [7 x i8]* %11, i64 0, i64 0
%95 = load double, double* %8
%96 = load i32, i32* %7
%97 = load i32, i32* %7
%98 = mul nsw i32 %96, %97
%99 = load i32, i32* %7
%100 = mul nsw i32 %98, %99
%101 = sitofp i32 %100 to double
%102 = fdiv double %95, %101
%103 = call i32 (i8*, ...) @printf(i8* %94, double %102)
%104 = load i32, i32* %6
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %104)
br label %106
106: ; preds = %93, %82
br label %107
107: ; preds = %106, %64
br label %108
108: ; preds = %107, %51
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"<span fallback='true' color='%s'>\00"
@.str.1 = [8 x i8] c"#FF7373\00"
@.str.2 = [8 x i8] c"#FFA500\00"
@.str.3 = [23 x i8] c"<span fallback='true'>\00"
@.str.4 = [10 x i8] c"%%%d.1lf \00"
@.str.5 = [6 x i8] c" %c/s\00"
@.str.6 = [6 x i8] c"K%c/s\00"
@.str.7 = [6 x i8] c"M%c/s\00"
@.str.8 = [6 x i8] c"G%c/s\00"
@.str.9 = [8 x i8] c"</span>\00"
define void @display(i32 %0, i32 %1, double %2, i32 %3, i32 %4) {
%6 = alloca [7 x i8]
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%8 = icmp ne i32 %4, 0
%9 = sitofp i32 %4 to double
%10 = fcmp olt double %9, %2
%11 = and i1 %8, %10
br i1 %11, label %12, label %14
12: ; preds = %5
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %23
14: ; preds = %5
%15 = icmp ne i32 %3, 0
%16 = sitofp i32 %3 to double
%17 = fcmp olt double %16, %2
%18 = and i1 %15, %17
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %23
21: ; preds = %14
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %23
23: ; preds = %19, %21, %12
%24 = icmp eq i32 %0, 98
%25 = fmul double %2, 8.000000e+00
%26 = select i1 %24, double %25, double %2
%27 = icmp sgt i32 %1, 1000
%28 = select i1 %27, i32 6, i32 5
%29 = call i32 @snprintf(i8* %7, i32 7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = sitofp i32 %1 to double
%31 = fcmp olt double %26, %30
br i1 %31, label %46, label %32
32: ; preds = %23
%33 = mul nsw i32 %1, %1
%34 = sitofp i32 %33 to double
%35 = fcmp olt double %26, %34
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = fdiv double %26, %30
br label %46
38: ; preds = %32
%39 = mul nsw i32 %33, %1
%40 = sitofp i32 %39 to double
%41 = fcmp olt double %26, %40
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = fdiv double %26, %34
br label %46
44: ; preds = %38
%45 = fdiv double %26, %40
br label %46
46: ; preds = %23, %36, %44, %42
%47 = phi double [ %37, %36 ], [ %45, %44 ], [ %43, %42 ], [ %26, %23 ]
%48 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %36 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), %44 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), %42 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %23 ]
%49 = call i32 (i8*, ...) @printf(i8* %7, double %47)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %48, i32 %0)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
ret void
}