#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*/ sprintf(char *, char *, int, int, float, double);
void showFPS(int texw, int texh, float zoom) {
  static double t0 = 0.0;
  static int frames = 0;
  static char titlestr[200];
  double t, fps;
  if ((t - t0) > 1.0 || frames == 0) {
    fps = (double)frames / (t - t0);
    sprintf(titlestr, "%dx%d texture, %.1fx zoom, %.1f FPS", texw, texh, zoom,
            fps);
    t0 = t;
    frames = 0;
  }
  frames++;
}


x86 assembly (clang, -O0):
<showFPS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  0x2f10(%rip),%xmm0
movsd  0xec8(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     114f <showFPS+0x3f>
cmpl   $0x0,0x2eff(%rip)
jne    11a7 <showFPS+0x97>
cvtsi2sdl 0x2ef1(%rip),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  0x2edc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
movss  -0xc(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0x2ecc(%rip),%rdi
lea    0xe7d(%rip),%rsi
call   1030 <sprintf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,0x2ea3(%rip)
movl   $0x0,0x2ea1(%rip)
mov    0x2e9b(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e92(%rip)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showFPS>:
push   %rbx
mov    0x2f29(%rip),%ebx
test   %ebx,%ebx
jne    113a <showFPS+0x2a>
mov    %esi,%ecx
mov    %edi,%edx
lea    0x2f2a(%rip),%rdi
lea    0xedb(%rip),%rsi
movsd  0xecb(%rip),%xmm1
call   1030 <sprintf@plt>
add    $0x1,%ebx
mov    %ebx,0x2efd(%rip)
pop    %rbx
ret

LLVM IR (-O0):
@showFPS.t0 = internal global double 0.000000e+00
@showFPS.frames = internal global i32 0
@showFPS.titlestr = internal global [200 x i8] zeroinitializer
@.str = [36 x i8] c"%dx%d texture, %.1fx zoom, %.1f FPS\00"
define void @showFPS(i32 %0, i32 %1, float %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store float %2, float* %6
%9 = load double, double* %7
%10 = load double, double* @showFPS.t0
%11 = fsub double %9, %10
%12 = fcmp ogt double %11, 1.000000e+00
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = load i32, i32* @showFPS.frames
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %29
16: ; preds = %13, %3
%17 = load i32, i32* @showFPS.frames
%18 = sitofp i32 %17 to double
%19 = load double, double* %7
%20 = load double, double* @showFPS.t0
%21 = fsub double %19, %20
%22 = fdiv double %18, %21
store double %22, double* %8
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = load float, float* %6
%26 = load double, double* %8
%27 = call i32 @sprintf(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @showFPS.titlestr, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %24, float %25, double %26)
%28 = load double, double* %7
store double %28, double* @showFPS.t0
store i32 0, i32* @showFPS.frames
br label %29
29: ; preds = %16, %13
%30 = load i32, i32* @showFPS.frames
%31 = add nsw i32 %30, 1
store i32 %31, i32* @showFPS.frames
ret void
}

LLVM IR (-O2):
@showFPS.frames = internal unnamed_addr global i32 0
@showFPS.titlestr = internal global [200 x i8] zeroinitializer
@.str = [36 x i8] c"%dx%d texture, %.1fx zoom, %.1f FPS\00"
define void @showFPS(i32 %0, i32 %1, float %2) {
%4 = load i32, i32* @showFPS.frames
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([200 x i8], [200 x i8]* @showFPS.titlestr, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, float %2, double 0x7FF8000000000000)
br label %8
8: ; preds = %3, %6
%9 = add nsw i32 %4, 1
store i32 %9, i32* @showFPS.frames
ret void
}