#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*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ GL_MODELVIEW;
double currentSeconds();
int /*<<< orphan*/ drawJulia();
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glutPostRedisplay();
int /*<<< orphan*/ glutSetWindowTitle(char *);
int /*<<< orphan*/ glutSwapBuffers();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, float);
void display() {
  static double t0;
  double t1, elapsedTime;
  static unsigned N;
  float fps;
  char cfps[256];
  glClear(GL_COLOR_BUFFER_BIT);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  drawJulia();
  N++;
  t1 = currentSeconds();
  elapsedTime = t1 - t0;
  if (elapsedTime > 1) {
    fps = (float)N / elapsedTime;
    N = 0;
    t0 = t1;
    sprintf(cfps, "Julia Fractal GL (%d x %d): %3.1f fps", 512, 512, fps);
    printf("%s\n", cfps);
    glutSetWindowTitle(cfps);
  }
  glutPostRedisplay();
  glutSwapBuffers();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
mov    $0x0,%al
call   1090 <glLoadIdentity@plt>
mov    $0x0,%al
call   1040 <drawJulia@plt>
mov    0x2ea5(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e9c(%rip)
mov    $0x0,%al
call   10b0 <currentSeconds@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  0x2e7b(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xdf1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    128b <display+0xeb>
mov    0x2e61(%rip),%eax
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,0x2e40(%rip)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,0x2e2b(%rip)
lea    -0x120(%rbp),%rdi
movss  -0x14(%rbp),%xmm0
lea    0xda8(%rip),%rsi
mov    $0x200,%ecx
mov    %ecx,%edx
call   10c0 <sprintf@plt>
lea    -0x120(%rbp),%rsi
lea    0xdb4(%rip),%rdi
call   1060 <printf@plt>
lea    -0x120(%rbp),%rdi
call   1080 <glutSetWindowTitle@plt>
mov    $0x0,%al
call   10a0 <glutPostRedisplay@plt>
mov    $0x0,%al
call   1070 <glutSwapBuffers@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbx
sub    $0x100,%rsp
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
xor    %eax,%eax
call   1090 <glLoadIdentity@plt>
xor    %eax,%eax
call   1040 <drawJulia@plt>
addl   $0x1,0x2ea7(%rip)
xor    %eax,%eax
call   10b0 <currentSeconds@plt>
movapd %xmm0,%xmm1
subsd  0x2e8c(%rip),%xmm1
ucomisd 0xe0c(%rip),%xmm1
jbe    1258 <display+0xb8>
mov    0x2e84(%rip),%eax
cvtsi2ss %rax,%xmm2
cvtss2sd %xmm2,%xmm2
divsd  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtsd2ss %xmm2,%xmm1
movl   $0x0,0x2e66(%rip)
movsd  %xmm0,0x2e56(%rip)
lea    0xddf(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x200,%edx
mov    $0x200,%ecx
movaps %xmm1,%xmm0
call   10c0 <sprintf@plt>
lea    0xde6(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1080 <glutSetWindowTitle@plt>
xor    %eax,%eax
call   10a0 <glutPostRedisplay@plt>
xor    %eax,%eax
call   1070 <glutSwapBuffers@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@display.t0 = internal global double 0.000000e+00
@display.N = internal global i32 0
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_MODELVIEW = global i32 0
@.str = [38 x i8] c"Julia Fractal GL (%d x %d): %3.1f fps\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @display() {
%1 = alloca double
%2 = alloca double
%3 = alloca float
%4 = alloca [256 x i8]
%5 = load i32, i32* @GL_COLOR_BUFFER_BIT
%6 = call i32 @glClear(i32 %5)
%7 = load i32, i32* @GL_MODELVIEW
%8 = call i32 @glMatrixMode(i32 %7)
%9 = call i32 (...) @glLoadIdentity()
%10 = call i32 (...) @drawJulia()
%11 = load i32, i32* @display.N
%12 = add i32 %11, 1
store i32 %12, i32* @display.N
%13 = call double (...) @currentSeconds()
store double %13, double* %1
%14 = load double, double* %1
%15 = load double, double* @display.t0
%16 = fsub double %14, %15
store double %16, double* %2
%17 = load double, double* %2
%18 = fcmp ogt double %17, 1.000000e+00
br i1 %18, label %19, label %34
19: ; preds = %0
%20 = load i32, i32* @display.N
%21 = uitofp i32 %20 to float
%22 = fpext float %21 to double
%23 = load double, double* %2
%24 = fdiv double %22, %23
%25 = fptrunc double %24 to float
store float %25, float* %3
store i32 0, i32* @display.N
%26 = load double, double* %1
store double %26, double* @display.t0
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%28 = load float, float* %3
%29 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 512, i32 512, float %28)
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%33 = call i32 @glutSetWindowTitle(i8* %32)
br label %34
34: ; preds = %19, %0
%35 = call i32 (...) @glutPostRedisplay()
%36 = call i32 (...) @glutSwapBuffers()
ret void
}

LLVM IR (-O2):
@display.t0 = internal unnamed_addr global double 0.000000e+00
@display.N = internal unnamed_addr global i32 0
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_MODELVIEW = global i32 0
@.str = [38 x i8] c"Julia Fractal GL (%d x %d): %3.1f fps\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @display() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @GL_COLOR_BUFFER_BIT
%4 = tail call i32 @glClear(i32 %3)
%5 = load i32, i32* @GL_MODELVIEW
%6 = tail call i32 @glMatrixMode(i32 %5)
%7 = tail call i32 (...) @glLoadIdentity()
%8 = tail call i32 (...) @drawJulia()
%9 = load i32, i32* @display.N
%10 = add i32 %9, 1
store i32 %10, i32* @display.N
%11 = tail call double (...) @currentSeconds()
%12 = load double, double* @display.t0
%13 = fsub double %11, %12
%14 = fcmp ogt double %13, 1.000000e+00
br i1 %14, label %15, label %24
15: ; preds = %0
%16 = load i32, i32* @display.N
%17 = uitofp i32 %16 to float
%18 = fpext float %17 to double
%19 = fdiv double %18, %13
%20 = fptrunc double %19 to float
store i32 0, i32* @display.N
store double %11, double* @display.t0
%21 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 512, i32 512, float %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%23 = call i32 @glutSetWindowTitle(i8* %2)
br label %24
24: ; preds = %15, %0
%25 = call i32 (...) @glutPostRedisplay()
%26 = call i32 (...) @glutSwapBuffers()
ret void
}