// File: malcolmyeh[P]CC3K/floor.cc
// Function: Floor::generateEnemies(int)
void Floor::generateEnemies(int dragons) {
	for (int i = 0; i < 20 - dragons; i++) {
		int num = rand() % 18 + 1;
		int id;
		Posn pos;
		generatePosition(id, pos);
		Enemy *e;
		if (num <= 4) {
			e = new Werewolf(pos, id);
			this->enemies.push_back(e);
		} else if (num > 4 && num <= 7) {
			e = new Vampire(pos, id);
			this->enemies.push_back(e);
		} else if (num > 7 && num <= 12) {
			e = new Goblin(pos, id);
			this->enemies.push_back(e);
		} else if (num > 12 && num <= 14) {
			e = new Troll(pos, id);
			this->enemies.push_back(e);
		} else if (num > 14 && num <= 16) {
			e = new Phoenix(pos, id);
			this->enemies.push_back(e);
		} else if (num > 16 && num <= 18) {
			e = new Merchant(pos, id);
			this->enemies.push_back(e);
		}
		displayGrid[pos.y][pos.x] = e->getSymbol();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl $0x14, %ecx
subl -0xc(%rbp), %ecx
cmpl %ecx, %eax
jge 0x7e3d
callq 0x4090
movl $0x12, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x54a0
movq -0x70(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0x6320
cmpl $0x4, -0x14(%rbp)
jg 0x7b91
movl $0x50, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x18(%rbp), %edx
movq -0x30(%rbp), %rsi
callq 0x17540
jmp 0x7b51
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x7c0, %rdi            # imm = 0x7C0
leaq -0x28(%rbp), %rsi
callq 0xd8e0
jmp 0x7e07
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x50, %esi
callq 0x41e0
jmp 0x7e46
cmpl $0x4, -0x14(%rbp)
jle 0x7c07
cmpl $0x7, -0x14(%rbp)
jg 0x7c07
movl $0x50, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x18(%rbp), %edx
movq -0x48(%rbp), %rsi
callq 0x16e50
jmp 0x7bc7
movq -0x70(%rbp), %rdi
movq -0x80(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x7c0, %rdi            # imm = 0x7C0
leaq -0x28(%rbp), %rsi
callq 0xd8e0
jmp 0x7e05
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x50, %esi
callq 0x41e0
jmp 0x7e46
cmpl $0x7, -0x14(%rbp)
jle 0x7c86
cmpl $0xc, -0x14(%rbp)
jg 0x7c86
movl $0x50, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x18(%rbp), %edx
movq -0x50(%rbp), %rsi
callq 0x15160
jmp 0x7c40
movq -0x70(%rbp), %rdi
movq -0x88(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x7c0, %rdi            # imm = 0x7C0
leaq -0x28(%rbp), %rsi
callq 0xd8e0
jmp 0x7e03
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x50, %esi
callq 0x41e0
jmp 0x7e46
cmpl $0xc, -0x14(%rbp)
jle 0x7d05
cmpl $0xe, -0x14(%rbp)
jg 0x7d05
movl $0x50, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x18(%rbp), %edx
movq -0x58(%rbp), %rsi
callq 0x16260
jmp 0x7cbf
movq -0x70(%rbp), %rdi
movq -0x90(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x7c0, %rdi            # imm = 0x7C0
leaq -0x28(%rbp), %rsi
callq 0xd8e0
jmp 0x7e01
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x50, %esi
callq 0x41e0
jmp 0x7e46
cmpl $0xe, -0x14(%rbp)
jle 0x7d84
cmpl $0x10, -0x14(%rbp)
jg 0x7d84
movl $0x50, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x18(%rbp), %edx
movq -0x60(%rbp), %rsi
callq 0x15910
jmp 0x7d3e
movq -0x70(%rbp), %rdi
movq -0x98(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x7c0, %rdi            # imm = 0x7C0
leaq -0x28(%rbp), %rsi
callq 0xd8e0
jmp 0x7dff
movq -0x98(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x50, %esi
callq 0x41e0
jmp 0x7e46
cmpl $0x10, -0x14(%rbp)
jle 0x7dfd
cmpl $0x12, -0x14(%rbp)
jg 0x7dfd
movl $0x50, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xa0(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x18(%rbp), %edx
movq -0x68(%rbp), %rsi
callq 0x15810
jmp 0x7dbd
movq -0x70(%rbp), %rdi
movq -0xa0(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x7c0, %rdi            # imm = 0x7C0
leaq -0x28(%rbp), %rsi
callq 0xd8e0
jmp 0x7dfd
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x50, %esi
callq 0x41e0
jmp 0x7e46
jmp 0x7dff
jmp 0x7e01
jmp 0x7e03
jmp 0x7e05
jmp 0x7e07
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movb %al, %dl
movq -0x70(%rbp), %rax
addq $0x820, %rax            # imm = 0x820
movslq -0x1c(%rbp), %rcx
imulq $0x4f, %rcx, %rcx
addq %rcx, %rax
movslq -0x20(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x7ae1
addq $0xa0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x42f0
nop