// File: /workspace/github_cpp_makefile_star2_O3/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, -0x90(%rbp)
movq %rcx, -0x88(%rbp)
movq %rsi, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
cmpl $0x0, (%rdx)
je 0x31ca
leaq 0xc0(%rdi), %rax
movq %rax, -0x38(%rbp)
leaq -0x198(%rbp), %r14
addq $0x90, %rdi
movq %rdi, -0x70(%rbp)
xorl %ebx, %ebx
xorps %xmm2, %xmm2
leaq 0x4e26(%rip), %rax      # 0x7d10
addq $0x10, %rax
movq %rax, -0x68(%rbp)
movq -0x88(%rbp), %rax
movss (%rax), %xmm0
ucomiss %xmm2, %xmm0
movq -0x90(%rbp), %rax
movss (%rax), %xmm1
jne 0x2f76
jp 0x2f76
ucomiss %xmm2, %xmm1
jne 0x2f76
jp 0x2f76
callq 0x2110
movslq %eax, %r15
imulq $0x5d9f7391, %r15, %rax # imm = 0x5D9F7391
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x28, %rax
addl %ecx, %eax
imull $0x2bc, %eax, %r12d     # imm = 0x2BC
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
negl %r12d
leal (%r15,%r12), %edx
addl $0x12c, %edx            # imm = 0x12C
movl %edx, -0x2c(%rbp)
negl %ecx
leal (%rax,%rcx), %r12d
addl $-0x64, %r12d
jmp 0x2f82
cvttss2si %xmm0, %eax
movl %eax, -0x2c(%rbp)
cvttss2si %xmm1, %r12d
callq 0x2110
movl %eax, %r15d
movl $0x80000001, %r13d      # imm = 0x80000001
andl %r13d, %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, -0x40(%rbp)
callq 0x2110
movl %eax, %r15d
andl %r13d, %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, -0x3c(%rbp)
leaq -0x428(%rbp), %rdi
callq 0x21d0
movq -0x38(%rbp), %rax
movl (%rax), %esi
leaq -0x418(%rbp), %rdi
callq 0x23a0
leaq -0x1a8(%rbp), %r13
movq %r13, %rdi
leaq -0x410(%rbp), %rsi
callq 0x2360
leaq -0x50(%rbp), %r15
movl $0x4, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x2050(%rip), %rcx      # 0x50c4
callq 0x22f0
movq %r15, -0x60(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3099
movq %rdx, -0x60(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x50(%rbp)
jmp 0x30a0
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x58(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x1a8(%rbp), %rdi
cmpq %r14, %rdi
je 0x30c8
callq 0x2290
shlq $0x20, %r12
movl -0x2c(%rbp), %esi
orq %r12, %rsi
leaq -0x2a0(%rbp), %rdi
leaq -0x40(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
movq -0x80(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x3a70
movq %r14, -0x1a8(%rbp)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1a8(%rbp), %r12
movq %r12, %rdi
callq 0x36fa
leaq -0x298(%rbp), %rcx
movl 0x20(%rcx), %eax
movl %eax, 0x38(%r14)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x28(%r14)
movups %xmm0, 0x18(%r14)
movq -0x68(%rbp), %rax
movq %rax, -0x188(%rbp)
movl $0xc8, %edx
leaq -0x15c(%rbp), %rdi
leaq -0x274(%rbp), %rsi
callq 0x2220
movq -0x70(%rbp), %rdi
movq %r12, %rsi
callq 0x3798
leaq -0x188(%rbp), %rdi
callq 0x3c82
movq -0x1a8(%rbp), %rdi
cmpq %r14, %rdi
je 0x317a
callq 0x2290
movq -0x38(%rbp), %rax
incl (%rax)
leaq -0x2a0(%rbp), %rdi
callq 0x3c82
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x319a
callq 0x2290
leaq -0x428(%rbp), %rdi
movq 0x4e18(%rip), %rsi      # 0x7fc0
callq 0x21f0
leaq -0x3a8(%rbp), %rdi
callq 0x2130
incl %ebx
movq -0x78(%rbp), %rax
cmpl (%rax), %ebx
xorps %xmm2, %xmm2
jne 0x2ef2
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x31de
movq %rax, %rbx
jmp 0x322b
movq %rax, %rbx
movq -0x1a8(%rbp), %rdi
cmpq %r14, %rdi
jne 0x3226
jmp 0x322b
movq %rax, %rbx
jmp 0x3219
movq %rax, %rbx
jmp 0x320d
movq %rax, %rbx
leaq -0x1a8(%rbp), %rdi
callq 0x3640
leaq -0x2a0(%rbp), %rdi
callq 0x3c82
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x322b
callq 0x2290
movq 0x4d8e(%rip), %rsi      # 0x7fc0
leaq -0x428(%rbp), %rdi
callq 0x21f0
leaq -0x3a8(%rbp), %rdi
callq 0x2130
movq %rbx, %rdi
callq 0x23b0