#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*/ GLUT_BITMAP_HELVETICA_18;
int /*<<< orphan*/ GLUT_ELAPSED_TIME;
int /*<<< orphan*/ glColor3d(double, double, double);
int /*<<< orphan*/ glWindowPos2i(int, int);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, char);
int glutGet(int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, double);
void ispisFPS() {
  static int t0 = 0, frames = 0, frames0 = 0;
  int t, i;
  static char strFPS[10];
  frames++;
  t = glutGet(GLUT_ELAPSED_TIME);
  if ((t - t0) > 1000) {
    sprintf(strFPS, "FPS %5.0lf",
            1000.0 * (double)(frames - frames0) / (double)(t - t0));
    frames0 = frames;
    t0 = t;
  }
  glColor3d(1.0, 1.0, 1.0);
  glWindowPos2i(20, 20);
  for (i = 0; i < 9; i++)
    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, strFPS[i]);
}


x86 assembly (clang, -O0):
<ispisFPS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ef2(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ee9(%rip)
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1040 <glutGet@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    0x2ecb(%rip),%eax
cmp    $0x3e8,%eax
jle    11e1 <ispisFPS+0x91>
mov    0x2ebe(%rip),%eax
sub    0x2ebc(%rip),%eax
cvtsi2sd %eax,%xmm1
movsd  0xe5c(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x4(%rbp),%eax
sub    0x2e9b(%rip),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
lea    0x2e98(%rip),%rdi
lea    0xe49(%rip),%rsi
call   1070 <sprintf@plt>
mov    0x2e7e(%rip),%eax
mov    %eax,0x2e7c(%rip)
mov    -0x4(%rbp),%eax
mov    %eax,0x2e6b(%rip)
movsd  0xe1f(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1050 <glColor3d@plt>
mov    $0x14,%esi
mov    %esi,%edi
call   1060 <glWindowPos2i@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jge    123c <ispisFPS+0xec>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
movslq -0x8(%rbp),%rcx
lea    0x2e33(%rip),%rax
movsbl (%rax,%rcx,1),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1207 <ispisFPS+0xb7>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ispisFPS>:
push   %rbx
addl   $0x1,0x2ef8(%rip)
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1040 <glutGet@plt>
mov    %eax,%ebx
sub    0x2ede(%rip),%eax
cmp    $0x3e9,%eax
jl     11ba <ispisFPS+0x6a>
mov    0x2ed5(%rip),%ecx
sub    0x2ed3(%rip),%ecx
cvtsi2sd %ecx,%xmm0
mulsd  0xe73(%rip),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
lea    0x2ebc(%rip),%rdi
lea    0xe6d(%rip),%rsi
call   1070 <sprintf@plt>
mov    0x2ea2(%rip),%eax
mov    %eax,0x2ea0(%rip)
mov    %ebx,0x2e92(%rip)
movsd  0xe46(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1050 <glColor3d@plt>
mov    $0x14,%edi
mov    $0x14,%esi
call   1060 <glWindowPos2i@plt>
mov    0x2dfd(%rip),%rbx
mov    (%rbx),%edi
movsbl 0x2e6c(%rip),%esi
call   1030 <glutBitmapCharacter@plt>
mov    (%rbx),%edi
movsbl 0x2e5f(%rip),%esi
call   1030 <glutBitmapCharacter@plt>
mov    (%rbx),%edi
movsbl 0x2e52(%rip),%esi
call   1030 <glutBitmapCharacter@plt>
mov    (%rbx),%edi
movsbl 0x2e45(%rip),%esi
call   1030 <glutBitmapCharacter@plt>
mov    (%rbx),%edi
movsbl 0x2e38(%rip),%esi
call   1030 <glutBitmapCharacter@plt>
mov    (%rbx),%edi
movsbl 0x2e2b(%rip),%esi
call   1030 <glutBitmapCharacter@plt>
mov    (%rbx),%edi
movsbl 0x2e1e(%rip),%esi
call   1030 <glutBitmapCharacter@plt>
mov    (%rbx),%edi
movsbl 0x2e11(%rip),%esi
call   1030 <glutBitmapCharacter@plt>
mov    (%rbx),%edi
movsbl 0x2e04(%rip),%esi
pop    %rbx
jmp    1030 <glutBitmapCharacter@plt>

LLVM IR (-O0):
@ispisFPS.t0 = internal global i32 0
@ispisFPS.frames = internal global i32 0
@ispisFPS.frames0 = internal global i32 0
@ispisFPS.strFPS = internal global [10 x i8] zeroinitializer
@GLUT_ELAPSED_TIME = global i32 0
@.str = [11 x i8] c"FPS %5.0lf\00"
@GLUT_BITMAP_HELVETICA_18 = global i32 0
define void @ispisFPS() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @ispisFPS.frames
%4 = add nsw i32 %3, 1
store i32 %4, i32* @ispisFPS.frames
%5 = load i32, i32* @GLUT_ELAPSED_TIME
%6 = call i32 @glutGet(i32 %5)
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = load i32, i32* @ispisFPS.t0
%9 = sub nsw i32 %7, %8
%10 = icmp sgt i32 %9, 1000
br i1 %10, label %11, label %25
11: ; preds = %0
%12 = load i32, i32* @ispisFPS.frames
%13 = load i32, i32* @ispisFPS.frames0
%14 = sub nsw i32 %12, %13
%15 = sitofp i32 %14 to double
%16 = fmul double 1.000000e+03, %15
%17 = load i32, i32* %1
%18 = load i32, i32* @ispisFPS.t0
%19 = sub nsw i32 %17, %18
%20 = sitofp i32 %19 to double
%21 = fdiv double %16, %20
%22 = call i32 @sprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %21)
%23 = load i32, i32* @ispisFPS.frames
store i32 %23, i32* @ispisFPS.frames0
%24 = load i32, i32* %1
store i32 %24, i32* @ispisFPS.t0
br label %25
25: ; preds = %11, %0
%26 = call i32 @glColor3d(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%27 = call i32 @glWindowPos2i(i32 20, i32 20)
store i32 0, i32* %2
br label %28
28: ; preds = %38, %25
%29 = load i32, i32* %2
%30 = icmp slt i32 %29, 9
br i1 %30, label %31, label %41
31: ; preds = %28
%32 = load i32, i32* @GLUT_BITMAP_HELVETICA_18
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = call i32 @glutBitmapCharacter(i32 %32, i8 signext %36)
br label %38
38: ; preds = %31
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %28
41: ; preds = %28
ret void
}

LLVM IR (-O2):
@ispisFPS.t0 = internal unnamed_addr global i32 0
@ispisFPS.frames = internal unnamed_addr global i32 0
@ispisFPS.frames0 = internal unnamed_addr global i32 0
@ispisFPS.strFPS = internal global [10 x i8] zeroinitializer
@GLUT_ELAPSED_TIME = global i32 0
@.str = [11 x i8] c"FPS %5.0lf\00"
@GLUT_BITMAP_HELVETICA_18 = global i32 0
define void @ispisFPS() {
%1 = load i32, i32* @ispisFPS.frames
%2 = add nsw i32 %1, 1
store i32 %2, i32* @ispisFPS.frames
%3 = load i32, i32* @GLUT_ELAPSED_TIME
%4 = tail call i32 @glutGet(i32 %3)
%5 = load i32, i32* @ispisFPS.t0
%6 = sub nsw i32 %4, %5
%7 = icmp sgt i32 %6, 1000
br i1 %7, label %8, label %18
8: ; preds = %0
%9 = load i32, i32* @ispisFPS.frames
%10 = load i32, i32* @ispisFPS.frames0
%11 = sub nsw i32 %9, %10
%12 = sitofp i32 %11 to double
%13 = fmul double %12, 1.000000e+03
%14 = sitofp i32 %6 to double
%15 = fdiv double %13, %14
%16 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %15)
%17 = load i32, i32* @ispisFPS.frames
store i32 %17, i32* @ispisFPS.frames0
store i32 %4, i32* @ispisFPS.t0
br label %18
18: ; preds = %8, %0
%19 = tail call i32 @glColor3d(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%20 = tail call i32 @glWindowPos2i(i32 20, i32 20)
%21 = load i32, i32* @GLUT_BITMAP_HELVETICA_18
%22 = load i8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 0)
%23 = tail call i32 @glutBitmapCharacter(i32 %21, i8 signext %22)
%24 = load i32, i32* @GLUT_BITMAP_HELVETICA_18
%25 = load i8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 1)
%26 = tail call i32 @glutBitmapCharacter(i32 %24, i8 signext %25)
%27 = load i32, i32* @GLUT_BITMAP_HELVETICA_18
%28 = load i8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 2)
%29 = tail call i32 @glutBitmapCharacter(i32 %27, i8 signext %28)
%30 = load i32, i32* @GLUT_BITMAP_HELVETICA_18
%31 = load i8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 3)
%32 = tail call i32 @glutBitmapCharacter(i32 %30, i8 signext %31)
%33 = load i32, i32* @GLUT_BITMAP_HELVETICA_18
%34 = load i8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 4)
%35 = tail call i32 @glutBitmapCharacter(i32 %33, i8 signext %34)
%36 = load i32, i32* @GLUT_BITMAP_HELVETICA_18
%37 = load i8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 5)
%38 = tail call i32 @glutBitmapCharacter(i32 %36, i8 signext %37)
%39 = load i32, i32* @GLUT_BITMAP_HELVETICA_18
%40 = load i8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 6)
%41 = tail call i32 @glutBitmapCharacter(i32 %39, i8 signext %40)
%42 = load i32, i32* @GLUT_BITMAP_HELVETICA_18
%43 = load i8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 7)
%44 = tail call i32 @glutBitmapCharacter(i32 %42, i8 signext %43)
%45 = load i32, i32* @GLUT_BITMAP_HELVETICA_18
%46 = load i8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @ispisFPS.strFPS, i64 0, i64 8)
%47 = tail call i32 @glutBitmapCharacter(i32 %45, i8 signext %46)
ret void
}