// File: /workspace/github_cpp_makefile_star2_O1/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 $0x408, %rsp            # imm = 0x408
movq %r8, -0x98(%rbp)
movq %rcx, -0x90(%rbp)
movq %rsi, -0x88(%rbp)
movq %rdi, -0x40(%rbp)
movq %rdx, -0x80(%rbp)
cmpl $0x0, (%rdx)
je 0x321e
movq -0x40(%rbp), %rax
leaq 0xc0(%rax), %r15
leaq -0x1a0(%rbp), %r13
addq $0x90, %rax
movq %rax, -0x70(%rbp)
xorl %r14d, %r14d
xorps %xmm2, %xmm2
leaq 0x4e2f(%rip), %rax      # 0x7d10
addq $0x10, %rax
movq %rax, -0x68(%rbp)
movq %r15, -0x78(%rbp)
movq -0x90(%rbp), %rax
movss (%rax), %xmm0
ucomiss %xmm2, %xmm0
movq -0x98(%rbp), %rax
movss (%rax), %xmm1
jne 0x2fbf
jp 0x2fbf
ucomiss %xmm2, %xmm1
jne 0x2fbf
jp 0x2fbf
callq 0x2110
cltq
imulq $0x5d9f7391, %rax, %rcx # imm = 0x5D9F7391
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x28, %rcx
addl %edx, %ecx
imull $0x2bc, %ecx, %ecx      # imm = 0x2BC
movl %eax, %r15d
subl %ecx, %r15d
negl %ecx
leal (%rax,%rcx), %ebx
addl $0x64, %ebx
callq 0x2110
cltq
imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
imull $0x1f4, %ecx, %ecx      # imm = 0x1F4
subl %ecx, %eax
movq -0x40(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl %ecx, %r15d
setl %dl
leal -0x64(%rcx), %esi
movl %ebx, -0x2c(%rbp)
cmpl %esi, %ebx
setg %sil
orb %dl, %sil
jne 0x2fad
leal 0x64(%rax), %ebx
shrq $0x20, %rcx
cmpl %ecx, %eax
setl %dl
addl $-0x64, %ecx
cmpl %ecx, %ebx
setg %cl
orb %dl, %cl
cmpb $0x1, %cl
jne 0x2fca
addl $0x12c, %r15d           # imm = 0x12C
addl $-0x64, %eax
movl %r15d, -0x2c(%rbp)
movl %eax, %ebx
jmp 0x2fca
cvttss2si %xmm0, %eax
movl %eax, -0x2c(%rbp)
cvttss2si %xmm1, %ebx
callq 0x2110
movl %eax, %r15d
movl $0x80000001, %r12d      # imm = 0x80000001
andl %r12d, %r15d
callq 0x2110
cltq
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x23, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
leal (%rcx,%rcx,4), %ecx
movl %eax, %edx
subl %ecx, %edx
movl $0xfffffff1, %esi       # imm = 0xFFFFFFF1
subl %edx, %esi
negl %ecx
cmpl $0x1, %r15d
leal 0xf(%rax,%rcx), %eax
cmovnel %esi, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x34(%rbp)
callq 0x2110
movl %eax, %r15d
andl %r12d, %r15d
callq 0x2110
cltq
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x23, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
leal (%rcx,%rcx,4), %ecx
movl %eax, %edx
subl %ecx, %edx
movl $0xfffffff1, %esi       # imm = 0xFFFFFFF1
subl %edx, %esi
negl %ecx
cmpl $0x1, %r15d
leal 0xf(%rax,%rcx), %eax
cmovnel %esi, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x30(%rbp)
leaq -0x430(%rbp), %rdi
callq 0x21d0
movq -0x78(%rbp), %r15
movl (%r15), %esi
leaq -0x420(%rbp), %rdi
callq 0x23a0
leaq -0x1b0(%rbp), %r12
movq %r12, %rdi
leaq -0x418(%rbp), %rsi
callq 0x2360
movl $0x4, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x200b(%rip), %rcx      # 0x50c4
callq 0x22f0
leaq -0x50(%rbp), %rsi
movq %rsi, -0x60(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x30e2
movq %rdx, -0x60(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x50(%rbp)
jmp 0x30e8
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x58(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x1b0(%rbp), %rdi
cmpq %r13, %rdi
je 0x3110
callq 0x2290
shlq $0x20, %rbx
movl -0x2c(%rbp), %esi
orq %rbx, %rsi
leaq -0x2a8(%rbp), %rdi
leaq -0x34(%rbp), %rdx
leaq -0x30(%rbp), %rcx
movq -0x88(%rbp), %r8
movq %r15, %r9
callq 0x3b48
movq %r13, -0x1b0(%rbp)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
leaq -0x50(%rbp), %rbx
callq 0x37c0
leaq 0x4b93(%rip), %rax      # 0x7cf0
movq %rax, -0x190(%rbp)
leaq -0x2a0(%rbp), %rcx
movl 0x20(%rcx), %eax
movl %eax, 0x38(%r13)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x28(%r13)
movups %xmm0, 0x18(%r13)
movq -0x68(%rbp), %rax
movq %rax, -0x190(%rbp)
movl $0xc8, %edx
leaq -0x164(%rbp), %rdi
leaq -0x27c(%rbp), %rsi
callq 0x2220
movq -0x70(%rbp), %rdi
movq %r12, %rsi
callq 0x385a
leaq -0x190(%rbp), %rdi
callq 0x3d64
movq -0x1b0(%rbp), %rdi
cmpq %r13, %rdi
je 0x31cf
callq 0x2290
incl (%r15)
leaq -0x2a8(%rbp), %rdi
callq 0x3d64
movq -0x60(%rbp), %rdi
cmpq %rbx, %rdi
je 0x31ec
callq 0x2290
leaq -0x430(%rbp), %rdi
movq 0x4dc6(%rip), %rsi      # 0x7fc0
callq 0x21f0
leaq -0x3b0(%rbp), %rdi
callq 0x2130
incl %r14d
movq -0x80(%rbp), %rax
cmpl (%rax), %r14d
xorps %xmm2, %xmm2
jne 0x2eed
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3232
movq %rax, %r15
jmp 0x327f
movq %rax, %r15
movq -0x1b0(%rbp), %rdi
cmpq %r13, %rdi
jne 0x327a
jmp 0x327f
movq %rax, %r15
jmp 0x326d
movq %rax, %r15
jmp 0x3261
movq %rax, %r15
leaq -0x1b0(%rbp), %rdi
callq 0x3706
leaq -0x2a8(%rbp), %rdi
callq 0x3d64
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x327f
callq 0x2290
movq 0x4d3a(%rip), %rsi      # 0x7fc0
leaq -0x430(%rbp), %rdi
callq 0x21f0
leaq -0x3b0(%rbp), %rdi
callq 0x2130
movq %r15, %rdi
callq 0x23b0