#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 *, ...);
GlobUsage(char *szItem, int itemstorage, int maxstorage) {
  float percentage = maxstorage ? itemstorage * 100.0 / maxstorage : 0.0;
  printf("%-12s     [variable]    %7i/%-7i  (%4.1f%%)", szItem, itemstorage,
         maxstorage, percentage);
  if (percentage > 80.0)
    printf("VERY FULL!\n");
  else if (percentage > 95.0)
    printf("SIZE DANGER!\n");
  else if (percentage > 99.9)
    printf("SIZE OVERFLOW!!!\n");
  else
    printf("\n");
  return itemstorage;
}


x86 assembly (clang, -O0):
<GlobUsage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1150 <GlobUsage+0x40>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xec7(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    115d <GlobUsage+0x4d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    115d <GlobUsage+0x4d>
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe6b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11ba <GlobUsage+0xaa>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122e <GlobUsage+0x11e>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe45(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e8 <GlobUsage+0xd8>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <GlobUsage+0x119>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe1f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1216 <GlobUsage+0x106>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1224 <GlobUsage+0x114>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <GlobUsage+0x119>
jmp    122e <GlobUsage+0x11e>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GlobUsage>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %rdi,%rsi
test   %edx,%edx
je     1190 <GlobUsage+0x60>
mov    %edx,%ecx
cvtsi2sd %ebx,%xmm0
mulsd  0xeb4(%rip),%xmm0
cvtsi2sd %edx,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xeaf(%rip),%rdi
mov    %ebx,%edx
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xe8b(%rip),%xmm0
jbe    11b2 <GlobUsage+0x82>
lea    0xed4(%rip),%rdi
jmp    11db <GlobUsage+0xab>
lea    0xe81(%rip),%rdi
xorpd  %xmm0,%xmm0
mov    %ebx,%edx
xor    %ecx,%ecx
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11e0 <GlobUsage+0xb0>
ucomiss 0xe5b(%rip),%xmm0
jbe    11c4 <GlobUsage+0x94>
lea    0xe93(%rip),%rdi
jmp    11db <GlobUsage+0xab>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe36(%rip),%xmm0
jbe    11a6 <GlobUsage+0x76>
lea    0xe69(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"%-12s [variable] %7i/%-7i (%4.1f%%)\00"
@.str.1 = [12 x i8] c"VERY FULL!\0A\00"
@.str.2 = [14 x i8] c"SIZE DANGER!\0A\00"
@.str.3 = [18 x i8] c"SIZE OVERFLOW!!!\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @GlobUsage(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %3
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to double
%13 = fmul double %12, 1.000000e+02
%14 = load i32, i32* %6
%15 = sitofp i32 %14 to double
%16 = fdiv double %13, %15
br label %18
17: ; preds = %3
br label %18
18: ; preds = %17, %10
%19 = phi double [ %16, %10 ], [ 0.000000e+00, %17 ]
%20 = fptrunc double %19 to float
store float %20, float* %7
%21 = load i8*, i8** %4
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = load float, float* %7
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %21, i32 %22, i32 %23, double %25)
%27 = load float, float* %7
%28 = fpext float %27 to double
%29 = fcmp ogt double %28, 8.000000e+01
br i1 %29, label %30, label %32
30: ; preds = %18
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %48
32: ; preds = %18
%33 = load float, float* %7
%34 = fpext float %33 to double
%35 = fcmp ogt double %34, 9.500000e+01
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %47
38: ; preds = %32
%39 = load float, float* %7
%40 = fpext float %39 to double
%41 = fcmp ogt double %40, 9.990000e+01
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %46
44: ; preds = %38
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %46
46: ; preds = %44, %42
br label %47
47: ; preds = %46, %36
br label %48
48: ; preds = %47, %30
%49 = load i32, i32* %5
ret i32 %49
}

LLVM IR (-O2):
@.str = [44 x i8] c"%-12s [variable] %7i/%-7i (%4.1f%%)\00"
@str = [17 x i8] c"SIZE OVERFLOW!!!\00"
@str.5 = [13 x i8] c"SIZE DANGER!\00"
@str.6 = [11 x i8] c"VERY FULL!\00"
define i32 @GlobUsage(i8* %0, i32 returned %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32 0, double 0.000000e+00)
br label %26
7: ; preds = %3
%8 = sitofp i32 %1 to double
%9 = fmul double %8, 1.000000e+02
%10 = sitofp i32 %2 to double
%11 = fdiv double %9, %10
%12 = fptrunc double %11 to float
%13 = fpext float %12 to double
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32 %2, double %13)
%15 = fcmp ogt float %12, 8.000000e+01
br i1 %15, label %16, label %18
16: ; preds = %7
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.6, i64 0, i64 0))
br label %28
18: ; preds = %7
%19 = fcmp ogt float %12, 9.500000e+01
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.5, i64 0, i64 0))
br label %28
22: ; preds = %18
%23 = fcmp ogt double %13, 9.990000e+01
br i1 %23, label %24, label %26
24: ; preds = %22
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %28
26: ; preds = %5, %22
%27 = tail call i32 @putchar(i32 10)
br label %28
28: ; preds = %20, %26, %24, %16
ret i32 %1
}