#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*/ qprintf(char *, ...);
int GlobUsage(char *szItem, int itemstorage, int maxstorage) {
  float percentage = maxstorage ? itemstorage * 100.0 / maxstorage : 0.0;
  qprintf("%-12s     [variable]    %7i/%-7i  (%4.1f%%)", szItem, itemstorage,
          maxstorage, percentage);
  if (percentage > 80.0) {
    qprintf("VERY FULL!\n");
  } else if (percentage > 95.0) {
    qprintf("SIZE DANGER!\n");
  } else if (percentage > 99.9) {
    qprintf("SIZE OVERFLOW!!!\n");
  } else {
    qprintf("\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 <qprintf@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 <qprintf@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 <qprintf@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 <qprintf@plt>
jmp    1224 <GlobUsage+0x114>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <qprintf@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     1170 <GlobUsage+0x60>
mov    %edx,%ecx
cvtsi2sd %ebx,%xmm0
mulsd  0xed4(%rip),%xmm0
cvtsi2sd %edx,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xecf(%rip),%rdi
mov    %ebx,%edx
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%al
call   1030 <qprintf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xeab(%rip),%xmm0
jbe    118f <GlobUsage+0x7f>
lea    0xed6(%rip),%rdi
jmp    11b8 <GlobUsage+0xa8>
lea    0xea1(%rip),%rdi
xorpd  %xmm0,%xmm0
mov    %ebx,%edx
xor    %ecx,%ecx
mov    $0x1,%al
call   1030 <qprintf@plt>
lea    0xee1(%rip),%rdi
jmp    11b8 <GlobUsage+0xa8>
ucomiss 0xe7e(%rip),%xmm0
jbe    11a1 <GlobUsage+0x91>
lea    0xeb1(%rip),%rdi
jmp    11b8 <GlobUsage+0xa8>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe59(%rip),%xmm0
jbe    1186 <GlobUsage+0x76>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1030 <qprintf@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*, ...) @qprintf(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*, ...) @qprintf(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*, ...) @qprintf(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*, ...) @qprintf(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*, ...) @qprintf(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.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 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*, ...) @qprintf(i8* 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 %20
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*, ...) @qprintf(i8* 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 %21, label %16
16: ; preds = %7
%17 = fcmp ogt float %12, 9.500000e+01
br i1 %17, label %21, label %18
18: ; preds = %16
%19 = fcmp ogt double %13, 9.990000e+01
br i1 %19, label %21, label %20
20: ; preds = %5, %18
br label %21
21: ; preds = %18, %16, %7, %20
%22 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), %20 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %7 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), %16 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), %18 ]
%23 = tail call i32 (i8*, ...) @qprintf(i8* %22)
ret i32 %1
}