// File: tkaczenko[P]asteroids-clone/src/App.cpp
// Function: App::execute()
int App::execute()
{
    while (running) {
        if (SDL_GetTicks() > dataOutputTimer + 1000) {
            dataOutputTimer = SDL_GetTicks();
        }

        if (SDL_GetTicks() > rockSpawnTimer + 15000) {
            game.spawnRock(BIG_ROCK, 1);
            rockSpawnTimer = SDL_GetTicks();
        }

        this->inputs();

        loops = 0;
        deltaTime = float(SDL_GetTicks() - prevFrameTime) / 1000.0f;

        while (SDL_GetTicks() > nextFrameTime && loops < maxFrameSkip) {
            game.updatePositions(deltaTime);

            nextFrameTime += singleFrameTimeInMS;
            prevFrameTime = SDL_GetTicks();
            loops++;
        }
        interpolation = float(SDL_GetTicks() + singleFrameTimeInMS - nextFrameTime) / float(singleFrameTimeInMS);
        game.collisions();
        if (true) {
            game.interpolate(deltaTime, interpolation);
            game.draw(rend);
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0xd8(%rax)
je 0x3b65
callq 0x3300
movq -0x20(%rbp), %rcx
movl 0x138(%rcx), %ecx
addl $0x3e8, %ecx            # imm = 0x3E8
cmpl %ecx, %eax
jbe 0x39bf
callq 0x3300
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x138(%rax)
callq 0x3300
movq -0x20(%rbp), %rcx
movl 0x13c(%rcx), %ecx
addl $0x3a98, %ecx           # imm = 0x3A98
cmpl %ecx, %eax
jbe 0x3a24
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
movl $0x259, -0xc(%rbp)      # imm = 0x259
movl $0x1, -0x10(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x14(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x18(%rbp)
leaq -0xc(%rbp), %rsi
leaq -0x10(%rbp), %rdx
leaq -0x14(%rbp), %rcx
leaq -0x18(%rbp), %r8
callq 0x4390
callq 0x3300
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x13c(%rax)
movq -0x20(%rbp), %rdi
callq 0x3b70
movq -0x20(%rbp), %rax
movl $0x0, 0x12c(%rax)
callq 0x3300
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl 0x134(%rax), %edx
subl %edx, %ecx
cvtsi2ss %rcx, %xmm0
movss 0x55a9(%rip), %xmm1     # 0x9004
divss %xmm1, %xmm0
movss %xmm0, 0x118(%rax)
callq 0x3300
movq -0x20(%rbp), %rdx
movl %eax, %ecx
xorl %eax, %eax
cmpl 0x130(%rdx), %ecx
movb %al, -0x21(%rbp)
jbe 0x3a95
movq -0x20(%rbp), %rcx
movl 0x12c(%rcx), %eax
cmpl 0x128(%rcx), %eax
setl %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x3a9e
jmp 0x3af0
movq -0x20(%rbp), %rsi
movq %rsi, %rdi
addq $0x10, %rdi
addq $0x118, %rsi            # imm = 0x118
callq 0x4f40
movq -0x20(%rbp), %rax
movl 0x124(%rax), %ecx
addl 0x130(%rax), %ecx
movl %ecx, 0x130(%rax)
callq 0x3300
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x134(%rax)
movl 0x12c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x12c(%rax)
jmp 0x3a67
callq 0x3300
movq -0x20(%rbp), %rdi
movl 0x124(%rdi), %edx
movl 0x130(%rdi), %ecx
addl %edx, %eax
subl %ecx, %eax
cvtsi2ss %rax, %xmm0
cvtsi2ssl 0x124(%rdi), %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0x11c(%rdi)
addq $0x10, %rdi
callq 0x4980
movq -0x20(%rbp), %rdx
movq %rdx, %rdi
addq $0x10, %rdi
movq %rdx, %rsi
addq $0x118, %rsi            # imm = 0x118
addq $0x11c, %rdx            # imm = 0x11C
callq 0x4fe0
movq -0x20(%rbp), %rax
movq %rax, %rdi
addq $0x10, %rdi
movq 0x8(%rax), %rsi
callq 0x5080
jmp 0x3984
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)