// File: /workspace/github_c_makefile_star2_O2/Nealsbo[P]C-Software-Renderer/src/application.c
// Function: Application_Run
void Application_Run() {
	printf( "Application Run: Start\n");
    SDL_Event e;

    SetupScene( Scene );
    mainRenderer = Renderer_Init( Scene, RENDER_STATE_LIT, RENDER_TYPE_SOFTWARE );
    
    float frames_slice = 0.0f;
    float delta = 0.0f;
    
    unsigned int frames_slice_count = 0;
    clock_t curr_time, last_time;
    last_time = clock();
    
	printf( "Application Run: Loop\n");
    while ( !quit ) {
        curr_time = clock();
        delta = (float)( curr_time - last_time )/CLOCKS_PER_SEC;
        frames_slice += delta;
        elapsed_time += delta;
        frames_slice_count++;
        
        IH_ProcessInput( e, mainRenderer );
        UpdateScene( mainRenderer, delta );
        Renderer_DrawWorld( mainRenderer, gScreenSurface );
        SDL_UpdateWindowSurface( gWindow );
        
        printf("%f\n", elapsed_time);
        if(frames_slice > 1.0f){
            printf("FPS: %u\n", (unsigned int)(1.0f / frames_slice * (float)frames_slice_count));
            frames_slice = 0.0f;
            frames_slice_count = 0;
        }

        if( quit ) {
            break;
        }
        last_time = curr_time;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
leaq 0x5cc7(%rip), %rdi      # 0x70fd
callq 0x1200
leaq 0x5cfa(%rip), %rdi      # 0x713c
callq 0x1200
movq 0xad12(%rip), %rdi      # 0xc160
callq 0x4c25
movq %rax, %rbx
xorps %xmm0, %xmm0
movss %xmm0, 0x38(%rsp)
movss 0x5b9d(%rip), %xmm2     # 0x7004
xorps %xmm1, %xmm1
callq 0x2911
movq %rbx, %rdi
callq 0x5141
movss 0x5b89(%rip), %xmm0     # 0x7008
callq 0x40f6
movaps %xmm0, %xmm1
addss 0x5b7d(%rip), %xmm1     # 0x700c
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
callq 0x2911
movq %rbx, %rdi
callq 0x5151
movss 0x5b66(%rip), %xmm2     # 0x7010
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x2911
movaps %xmm0, 0x40(%rsp)
movss %xmm1, 0x3c(%rsp)
movss 0x5b4c(%rip), %xmm1     # 0x7014
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
callq 0x2911
movaps %xmm0, %xmm2
movaps %xmm1, %xmm3
movl $0x40a00000, 0x10(%rsp) # imm = 0x40A00000
movl $0x42c80000, 0x8(%rsp)  # imm = 0x42C80000
movl $0x3f000000, (%rsp)     # imm = 0x3F000000
movss 0x5b20(%rip), %xmm4     # 0x7018
movss 0x5b1c(%rip), %xmm6     # 0x701c
movss 0x5b18(%rip), %xmm7     # 0x7020
xorps %xmm5, %xmm5
movaps 0x40(%rsp), %xmm0
movss 0x3c(%rsp), %xmm1
callq 0x18cc
movq %rax, %rdi
callq 0x60e4
movq %rax, %r14
movq %rax, 0xac63(%rip)      # 0xc190
movss 0x5aef(%rip), %xmm1     # 0x7024
movss 0x5aeb(%rip), %xmm2     # 0x7028
xorps %xmm0, %xmm0
callq 0x2911
movaps %xmm0, 0x40(%rsp)
movss %xmm1, 0x3c(%rsp)
movss 0x5ad4(%rip), %xmm1     # 0x702c
xorps %xmm2, %xmm2
movss 0x5ab1(%rip), %xmm0     # 0x7014
callq 0x2911
movaps %xmm0, %xmm2
movaps %xmm1, %xmm3
movq %r14, %rdi
movaps 0x40(%rsp), %xmm0
movss 0x3c(%rsp), %xmm1
callq 0x61ad
movq 0xac08(%rip), %r14      # 0xc190
xorps %xmm0, %xmm0
movss 0x5a99(%rip), %xmm1     # 0x702c
movss 0x5a79(%rip), %xmm2     # 0x7014
callq 0x2911
movq %r14, %rdi
callq 0x61c0
movq 0xabe1(%rip), %rdi      # 0xc190
movq %rbx, %rsi
callq 0x6199
movq 0xabd2(%rip), %rdi      # 0xc190
pushq $0x1
popq %rsi
xorl %ebp, %ebp
xorl %edx, %edx
callq 0x5a64
movq %rax, 0xabc7(%rip)      # 0xc198
callq 0x10d0
movq %rax, %r12
leaq 0x5b34(%rip), %rdi      # 0x7114
callq 0x1200
cmpl $0x0, 0xab84(%rip)      # 0xc170
sete %al
leaq 0x5ba0(%rip), %rbx      # 0x7196
leaq 0x5abe(%rip), %r14      # 0x70bb
testb $0x1, %al
je 0x1710
callq 0x10d0
movq %rax, %r15
subq %r12, %rax
cvtsi2ss %rax, %xmm1
divss 0x5a13(%rip), %xmm1     # 0x7030
movss %xmm1, 0x40(%rsp)
movss 0x38(%rsp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x38(%rsp)
movss 0xab39(%rip), %xmm0     # 0xc174
addss %xmm1, %xmm0
movss %xmm0, 0xab2d(%rip)     # 0xc174
incl %ebp
movq 0xab48(%rip), %rdi      # 0xc198
movq 0x88(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x58(%rsp), %xmm0
movups 0x68(%rsp), %xmm1
movups 0x78(%rsp), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x1720
movq 0xab12(%rip), %rdi      # 0xc198
movss 0x40(%rsp), %xmm0
callq 0x17bd
movq 0xab00(%rip), %rdi      # 0xc198
movq 0xaae9(%rip), %rsi      # 0xc188
callq 0x603d
movq 0xaad5(%rip), %rdi      # 0xc180
callq 0x1180
cvtss2sd 0xaabc(%rip), %xmm0     # 0xc174
movq %rbx, %rdi
movb $0x1, %al
callq 0x1040
movss 0x38(%rsp), %xmm2
movss 0x5944(%rip), %xmm0     # 0x7014
ucomiss %xmm0, %xmm2
jbe 0x16fe
movl %ebp, %eax
cvtsi2ss %rax, %xmm1
divss %xmm2, %xmm0
mulss %xmm0, %xmm1
cvttss2si %xmm1, %rsi
xorl %ebp, %ebp
movq %r14, %rdi
xorl %eax, %eax
callq 0x1040
xorps %xmm0, %xmm0
movss %xmm0, 0x38(%rsp)
movb $0x1, %al
cmpl $0x0, 0xaa69(%rip)      # 0xc170
movq %r15, %r12
je 0x15fd
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq