#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 */
unsigned int SDL_GetTicks();
int /*<<< orphan*/ glInit();
int /*<<< orphan*/ glRender();
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ sdlCheckEvent();
int /*<<< orphan*/ sdlInit(int, int, int, int);
int main(int argc, char *argv[]) {
  unsigned int to, t;
  unsigned int framecount = 0;
  if (!sdlInit(1366, 768, 24, 1) || !glInit())
    return 0;
  to = SDL_GetTicks();
  while (1) {
    sdlCheckEvent();
    glRender();
    framecount++;
    if (framecount == 1000) {
      t = SDL_GetTicks();
      printf("%f fps \n", 1000000.0f / (t - to));
      to = t;
      framecount = 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x556,%edi
mov    $0x300,%esi
mov    $0x18,%edx
mov    $0x1,%ecx
call   1050 <sdlInit@plt>
cmp    $0x0,%eax
je     11af <main+0x4f>
mov    $0x0,%al
call   1080 <glInit@plt>
cmp    $0x0,%eax
jne    11b7 <main+0x57>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1040 <SDL_GetTicks@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1060 <sdlCheckEvent@plt>
mov    $0x0,%al
call   1070 <glRender@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jne    1221 <main+0xc1>
xor    %eax,%eax
call   1040 <SDL_GetTicks@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    %ecx,%eax
cvtsi2ss %rax,%xmm1
movss  0xdfc(%rip),%xmm0
divss  %xmm1,%xmm0
lea    0xdf5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
jmp    11c1 <main+0x61>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x556,%edi
mov    $0x300,%esi
mov    $0x18,%edx
mov    $0x1,%ecx
call   1050 <sdlInit@plt>
test   %eax,%eax
je     11ee <main+0x8e>
xor    %eax,%eax
call   1080 <glInit@plt>
test   %eax,%eax
je     11ee <main+0x8e>
xor    %eax,%eax
call   1040 <SDL_GetTicks@plt>
mov    %eax,%ebx
lea    0xe68(%rip),%r14
nopl   0x0(%rax)
mov    $0x3e8,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1060 <sdlCheckEvent@plt>
xor    %eax,%eax
call   1070 <glRender@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x50>
xor    %eax,%eax
call   1040 <SDL_GetTicks@plt>
mov    %eax,%ebp
sub    %ebx,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
movss  0xe22(%rip),%xmm0
divss  %xmm1,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %ebp,%ebx
jmp    11a0 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%f fps \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%9 = call i32 @sdlInit(i32 1366, i32 768, i32 24, i32 1)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 (...) @glInit()
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %11, %2
ret i32 0
15: ; preds = %11
%16 = call i32 (...) @SDL_GetTicks()
store i32 %16, i32* %6
br label %17
17: ; preds = %15, %33
%18 = call i32 (...) @sdlCheckEvent()
%19 = call i32 (...) @glRender()
%20 = load i32, i32* %8
%21 = add i32 %20, 1
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = icmp eq i32 %22, 1000
br i1 %23, label %24, label %33
24: ; preds = %17
%25 = call i32 (...) @SDL_GetTicks()
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = load i32, i32* %6
%28 = sub i32 %26, %27
%29 = uitofp i32 %28 to float
%30 = fdiv float 1.000000e+06, %29
%31 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %30)
%32 = load i32, i32* %7
store i32 %32, i32* %6
store i32 0, i32* %8
br label %33
33: ; preds = %24, %17
br label %17
}

LLVM IR (-O2):
@.str = [9 x i8] c"%f fps \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sdlInit(i32 1366, i32 768, i32 24, i32 1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 (...) @glInit()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %5, %2
ret i32 0
9: ; preds = %5
%10 = tail call i32 (...) @SDL_GetTicks()
br label %11
11: ; preds = %19, %9
%12 = phi i32 [ %20, %19 ], [ %10, %9 ]
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ %17, %13 ], [ 0, %11 ]
%15 = tail call i32 (...) @sdlCheckEvent()
%16 = tail call i32 (...) @glRender()
%17 = add i32 %14, 1
%18 = icmp eq i32 %17, 1000
br i1 %18, label %19, label %13
19: ; preds = %13
%20 = tail call i32 (...) @SDL_GetTicks()
%21 = sub i32 %20, %12
%22 = uitofp i32 %21 to float
%23 = fdiv float 1.000000e+06, %22
%24 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %23)
br label %11
}