#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*/ rt_ui_message(int, char *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int, float);
void gridstats(int xs, int ys, int zs, int numobj) {
  char t[256];
  int numcells = xs * ys * zs;
  sprintf(t, "Grid:  X:%3d  Y:%3d  Z:%3d  Cells:%9d  Obj:%9d  Obj/Cell: %7.3f",
          xs, ys, zs, numcells, numobj, ((float)numobj) / ((float)numcells));
  rt_ui_message(100, t);
}


x86 assembly (clang, -O0):
<gridstats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x114(%rbp),%r9d
mov    -0x10(%rbp),%eax
cvtsi2ssl -0x10(%rbp),%xmm0
cvtsi2ssl -0x114(%rbp),%xmm1
ff
divss  %xmm1,%xmm0
lea    0xe85(%rip),%rsi
mov    %eax,(%rsp)
call   1040 <sprintf@plt>
lea    -0x110(%rbp),%rsi
mov    $0x64,%edi
call   1030 <rt_ui_message@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gridstats>:
push   %rbx
sub    $0x110,%rsp
mov    %edx,%r8d
mov    %esi,%eax
mov    %edi,%edx
mov    %esi,%r9d
imul   %edi,%r9d
imul   %r8d,%r9d
cvtsi2ss %ecx,%xmm0
cvtsi2ss %r9d,%xmm1
divss  %xmm1,%xmm0
mov    %ecx,(%rsp)
lea    0xeaf(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%ecx
call   1040 <sprintf@plt>
mov    $0x64,%edi
mov    %rbx,%rsi
call   1030 <rt_ui_message@plt>
add    $0x110,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [64 x i8] c"Grid: X:%3d Y:%3d Z:%3d Cells:%9d Obj:%9d Obj/Cell: %7.3f\00"
define void @gridstats(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [256 x i8]
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = mul nsw i32 %11, %12
%14 = load i32, i32* %7
%15 = mul nsw i32 %13, %14
store i32 %15, i32* %10
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = load i32, i32* %10
%21 = load i32, i32* %8
%22 = load i32, i32* %8
%23 = sitofp i32 %22 to float
%24 = load i32, i32* %10
%25 = sitofp i32 %24 to float
%26 = fdiv float %23, %25
%27 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18, i32 %19, i32 %20, i32 %21, float %26)
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%29 = call i32 @rt_ui_message(i32 100, i8* %28)
ret void
}

LLVM IR (-O2):
@.str = [64 x i8] c"Grid: X:%3d Y:%3d Z:%3d Cells:%9d Obj:%9d Obj/Cell: %7.3f\00"
define void @gridstats(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = mul nsw i32 %1, %0
%8 = mul nsw i32 %7, %2
%9 = sitofp i32 %3 to float
%10 = sitofp i32 %8 to float
%11 = fdiv float %9, %10
%12 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %8, i32 %3, float %11)
%13 = call i32 @rt_ui_message(i32 100, i8* %6)
ret void
}