// File: /workspace/github_cpp_makefile_star2_O2/tkaczenko[P]asteroids-clone/src/GameEngine.cpp
// Function: GameEngine::spawnRock(int const&, int const&, float const&, float const&)
void GameEngine::spawnRock(const int& type, const int& number, const float& x, const float& y)
{
    for (int numRocks = 0; numRocks != number; numRocks++) {
        SDL_Point tempPos;
        if (x == 0.0 && y == 00) {
            tempPos = {rand() % 700 + 100, rand() % 500 + 100};
            if (tempPos.x < player.getPosition().x + 100 || tempPos.x > player.getPosition().x - 100 ||
                tempPos.y < player.getPosition().y + 100 || tempPos.y > player.getPosition().y - 100) {
                tempPos.x += 200;
                tempPos.y -= 200;
            }
        } else {
            tempPos = {int(x), int(y)};
        }
        float tempVel[2];
        if (rand() % 2 + 1 == 2) {
            tempVel[0] = rand() % 25 + 15;
        } else {
            tempVel[0] = (rand()%25 + 15) * -1;
        }
        if (rand() % 2 + 1 == 2) {
            tempVel[1] = rand() % 25 + 15;
        } else {
            tempVel[1] = (rand() % 25 + 15) * -1;
        }

        std::stringstream number;
        number << rockNum;
        std::string name = "rock" + number.str();
        Rock tempRock = {tempPos, tempVel[0], tempVel[1], type, rockNum};

        rocks.insert(std::pair<std::string, Rock>(name, tempRock));
        rockNum++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
movq %r8, -0x60(%rbp)
movq %rcx, -0x58(%rbp)
movq %rdx, -0x68(%rbp)
movq %rsi, -0x48(%rbp)
leaq 0xc0(%rdi), %rax
movq %rax, -0x50(%rbp)
addq $0x90, %rdi
movq %rdi, -0x40(%rbp)
xorl %ecx, %ecx
xorps %xmm2, %xmm2
movq -0x68(%rbp), %rax
cmpl (%rax), %ecx
je 0x2f64
movq -0x58(%rbp), %rax
movss (%rax), %xmm0
ucomiss %xmm2, %xmm0
movq -0x60(%rbp), %rax
movss (%rax), %xmm1
movl %ecx, -0x30(%rbp)
jne 0x2e2c
jp 0x2e2c
ucomiss %xmm2, %xmm1
jne 0x2e2c
jp 0x2e2c
callq 0x2110
cltd
movl $0x2bc, %ecx            # imm = 0x2BC
idivl %ecx
movl %edx, %ebx
callq 0x2110
cltd
movl $0x1f4, %ecx            # imm = 0x1F4
idivl %ecx
movl %edx, %r15d
addl $0x12c, %ebx            # imm = 0x12C
movl %ebx, -0x2c(%rbp)
addl $-0x64, %r15d
jmp 0x2e38
cvttss2si %xmm0, %eax
movl %eax, -0x2c(%rbp)
cvttss2si %xmm1, %r15d
callq 0x2110
movl %eax, %r14d
movl $0x80000001, %ebx       # imm = 0x80000001
andl %ebx, %r14d
callq 0x2110
cltd
pushq $0x19
popq %r12
idivl %r12d
pushq $-0xf
popq %r13
movl %r13d, %eax
subl %edx, %eax
addl $0xf, %edx
cmpl $0x1, %r14d
cmovnel %eax, %edx
cvtsi2ss %edx, %xmm0
movss %xmm0, -0x38(%rbp)
callq 0x2110
movl %eax, %r14d
andl %ebx, %r14d
callq 0x2110
cltd
idivl %r12d
subl %edx, %r13d
addl $0xf, %edx
cmpl $0x1, %r14d
cmovnel %r13d, %edx
cvtsi2ss %edx, %xmm0
movss %xmm0, -0x34(%rbp)
leaq -0x328(%rbp), %rbx
movq %rbx, %rdi
callq 0x21e0
movq -0x50(%rbp), %r14
movl (%r14), %esi
leaq -0x318(%rbp), %rdi
callq 0x23b0
leaq -0x1a0(%rbp), %r12
movq %r12, %rdi
leaq -0x310(%rbp), %rsi
callq 0x2380
leaq -0x88(%rbp), %r13
movq %r13, %rdi
leaq 0x21b7(%rip), %rsi      # 0x509c
movq %r12, %rdx
callq 0x3371
movq %r12, %rdi
callq 0x2170
shlq $0x20, %r15
movl -0x2c(%rbp), %esi
orq %r15, %rsi
leaq -0x420(%rbp), %r15
movq %r15, %rdi
leaq -0x38(%rbp), %rdx
leaq -0x34(%rbp), %rcx
movq -0x48(%rbp), %r8
movq %r14, %r9
callq 0x3860
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x33a0
movq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0x34f4
movq %r12, %rdi
callq 0x3402
incl (%r14)
movq %r15, %rdi
callq 0x39ae
movq %r13, %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x2210
movl -0x30(%rbp), %ecx
incl %ecx
jmp 0x2dce
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
jmp 0x2fae
movq %rax, %rbx
jmp 0x2fa7
movq %rax, %rbx
jmp 0x2f9b
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x3402
leaq -0x420(%rbp), %rdi
callq 0x39ae
leaq -0x88(%rbp), %rdi
callq 0x2170
jmp 0x2fba
jmp 0x2fb7
movq %rax, %rbx
leaq -0x328(%rbp), %rdi
callq 0x2210
movq %rbx, %rdi
callq 0x23c0