// File: /workspace/github_c_makefile_star2_O0/rroa[P]PUCMM_2D_Asteroids/Asteroids/Game.cpp
// Function: Engine::Game::DestroyEntity(Asteroids::Entity*)
void Game::DestroyEntity(Asteroids::Entity* entity)
	{		
		// Retrieve actor from m_actors list
		//
		auto actorsResult = std::find(m_entities.begin(), m_entities.end(), entity);

		// Retrieve actor from m_asteroids list
		//
		auto asteroidsResult = std::find(m_asteroids.begin(), m_asteroids.end(), entity);

		// Retrieve actor from m_bullets list
		//
		auto bulletsResult = std::find(m_bullets.begin(), m_bullets.end(), entity);

		// Removing the allocated pointer
		//
		delete entity;

		if (m_player == entity)
		{
			//return;
			m_player = nullptr;
		}


		// Deleting actor iterator from lists
		//
		if (m_entities.size() > 0 && actorsResult != m_entities.end())
		{
			m_entities.erase(actorsResult);
		}

		if (m_asteroids.size() > 0 && asteroidsResult != m_asteroids.end())
		{
			m_asteroids.erase(asteroidsResult);
		}

		if (m_bullets.size() > 0 && bulletsResult != m_bullets.end())
		{
			m_bullets.erase(bulletsResult);
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
addq $0x90, %rdi
callq 0x4dc0
movq -0xb0(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x90, %rdi
callq 0x4df0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x10(%rbp), %rdx
callq 0x5050
movq -0xb0(%rbp), %rdi
movq %rax, -0x18(%rbp)
addq $0x60, %rdi
callq 0x4e70
movq -0xb0(%rbp), %rdi
movq %rax, -0x38(%rbp)
addq $0x60, %rdi
callq 0x4ed0
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq -0x10(%rbp), %rdx
callq 0x50a0
movq -0xb0(%rbp), %rdi
movq %rax, -0x30(%rbp)
addq $0x78, %rdi
callq 0x4f40
movq -0xb0(%rbp), %rdi
movq %rax, -0x50(%rbp)
addq $0x78, %rdi
callq 0x4fa0
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq -0x10(%rbp), %rdx
callq 0x50f0
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, %rax
je 0x4436
movq -0xa8(%rbp), %rdi
movl $0x28, %esi
callq 0x30c0
movq -0xb0(%rbp), %rax
movq 0x58(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x4456
movq -0xb0(%rbp), %rax
movq $0x0, 0x58(%rax)
movq -0xb0(%rbp), %rdi
addq $0x90, %rdi
callq 0x5140
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0xb1(%rbp)
jbe 0x44a4
movq -0xb0(%rbp), %rdi
addq $0x90, %rdi
callq 0x4df0
movq %rax, -0x60(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4e20
movb %al, -0xb1(%rbp)
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x44b0
jmp 0x44e5
movq -0xb0(%rbp), %rax
addq $0x90, %rax
movq %rax, -0xc0(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x51c0
movq -0xc0(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x5170
movq %rax, -0x70(%rbp)
movq -0xb0(%rbp), %rdi
addq $0x60, %rdi
callq 0x51e0
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0xc1(%rbp)
jbe 0x452d
movq -0xb0(%rbp), %rdi
addq $0x60, %rdi
callq 0x4ed0
movq %rax, -0x78(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4ea0
movb %al, -0xc1(%rbp)
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0x4539
jmp 0x456f
movq -0xb0(%rbp), %rax
addq $0x60, %rax
movq %rax, -0xd0(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x5260
movq -0xd0(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x5210
movq %rax, -0x88(%rbp)
movq -0xb0(%rbp), %rdi
addq $0x78, %rdi
callq 0x5280
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0xd1(%rbp)
jbe 0x45bd
movq -0xb0(%rbp), %rdi
addq $0x78, %rdi
callq 0x4fa0
movq %rax, -0x90(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x4f70
movb %al, -0xd1(%rbp)
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x45c9
jmp 0x4605
movq -0xb0(%rbp), %rax
addq $0x78, %rax
movq %rax, -0xe0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5300
movq -0xe0(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x52b0
movq %rax, -0xa0(%rbp)
addq $0xe0, %rsp
popq %rbp
retq
nop