// File: malcolmyeh[P]CC3K/floor.cc
// Function: Floor::generatePlayer(char, int&)
void Floor::generatePlayer(char type, int &id) {


	id = rand() % 5 + 1;

	Chamber *c = chambers.at(id - 1);
	Posn p;
	do {
		p = c->getPosition();
	} while (!(this->displayGrid[p.y][p.x] == '.'));


	if (type == 'h') {
	 	this->player = new Human(140, 0, p);
	} else if (type == 'o') {
		this->player = new Orc(1800, 0, p);
	} else if (type == 'e') {
		this->player = new Elf(1400, 0, p);
	} else if (type == 'd') {
		this->player = new Dwarf(1000, 0, p);
	}
	displayGrid[p.y][p.x] = '@';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
callq 0x4090
movq -0x68(%rbp), %rdi
movl $0x5, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movq -0x18(%rbp), %rax
movl %edx, (%rax)
addq $0x808, %rdi            # imm = 0x808
movq -0x18(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xd590
movq (%rax), %rax
movq %rax, -0x20(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x54a0
movq -0x20(%rbp), %rdi
callq 0x57d0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x5470
movq -0x68(%rbp), %rax
addq $0x820, %rax            # imm = 0x820
movslq -0x24(%rbp), %rcx
imulq $0x4f, %rcx, %rcx
addq %rcx, %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2e, %eax
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x6b63
movsbl -0x9(%rbp), %eax
cmpl $0x68, %eax
jne 0x6c10
movl $0x50, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movl $0x8c, %esi
xorl %edx, %edx
callq 0x12940
jmp 0x6bdd
movq -0x68(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, 0xfe0(%rax)
jmp 0x6d57
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x50, %esi
callq 0x41e0
jmp 0x6d7d
movsbl -0x9(%rbp), %eax
cmpl $0x6f, %eax
jne 0x6c7a
movl $0x50, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movl $0x708, %esi            # imm = 0x708
xorl %edx, %edx
callq 0x12bb0
jmp 0x6c47
movq -0x68(%rbp), %rax
movq -0x78(%rbp), %rcx
movq %rcx, 0xfe0(%rax)
jmp 0x6d55
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x50, %esi
callq 0x41e0
jmp 0x6d7d
movsbl -0x9(%rbp), %eax
cmpl $0x65, %eax
jne 0x6ce4
movl $0x50, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x80(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rcx
movl $0x578, %esi            # imm = 0x578
xorl %edx, %edx
callq 0x13ca0
jmp 0x6cb1
movq -0x68(%rbp), %rax
movq -0x80(%rbp), %rcx
movq %rcx, 0xfe0(%rax)
jmp 0x6d53
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x50, %esi
callq 0x41e0
jmp 0x6d7d
movsbl -0x9(%rbp), %eax
cmpl $0x64, %eax
jne 0x6d51
movl $0x50, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x88(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rcx
movl $0x3e8, %esi            # imm = 0x3E8
xorl %edx, %edx
callq 0x146c0
jmp 0x6d1e
movq -0x68(%rbp), %rax
movq -0x88(%rbp), %rcx
movq %rcx, 0xfe0(%rax)
jmp 0x6d51
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x50, %esi
callq 0x41e0
jmp 0x6d7d
jmp 0x6d53
jmp 0x6d55
jmp 0x6d57
movq -0x68(%rbp), %rax
addq $0x820, %rax            # imm = 0x820
movslq -0x24(%rbp), %rcx
imulq $0x4f, %rcx, %rcx
addq %rcx, %rax
movslq -0x28(%rbp), %rcx
movb $0x40, (%rax,%rcx)
addq $0x90, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x42f0
nopw %cs:(%rax,%rax)