// File: malcolmyeh[P]CC3K/floor.cc
// Function: Floor::generateItems(int&)
void Floor::generateItems(int &dragons) {
	for (int j = 0; j < 10; j++) {

		int num = rand() % 6 + 1;
		int id;
		Posn pos;
		generatePosition(id, pos);

		Potion *i;
		if (num == 1) {
			i = new Potion(pos, "RH");
			this->potions.push_back(i);
		} else if (num == 2) {
			i = new Potion(pos, "BA");
			this->potions.push_back(i);
		} else if (num == 3) {
			i = new Potion(pos, "BD");
			this->potions.push_back(i);
		} else if (num == 4) {
			i = new Potion(pos, "PH");
			this->potions.push_back(i);
		} else if (num == 5) {
			i = new Potion(pos, "WA");
			this->potions.push_back(i);
		} else if (num == 6) {
			i = new Potion(pos, "WD");
			this->potions.push_back(i);		}

		displayGrid[pos.y][pos.x] = i->getSymbol();
	}
	for (int j = 0; j < 6; j++) {

		int num = rand() % 8 + 1;
		int id;
		Posn pos;
		generatePosition(id, pos);
		Gold *i;
		if (num <= 5) {
			i = new normalHoard(pos);
			this->golds.push_back(i);
		} else if (num <= 7) {
			i = new smallHoard(pos);
			this->golds.push_back(i);
		} else if (num == 8) {
			i = new dragonHoard(pos);
			this->golds.push_back(i);
			Posn dpos = dragonPosition(pos);
			Enemy *e = new Dragon(dpos, i, NULL, id);
			this->enemies.push_back(e);
			
			++dragons;
			displayGrid[dpos.y][dpos.x] = e->getSymbol();
		}
		displayGrid[pos.y][pos.x] = i->getSymbol();
	}
	int num = rand() % (6 - this->level);
	if (num == 0 && !this->barrierSpawned) {

		int id;
		Posn pos;
		generatePosition(id, pos);
		this->suit = new barrierSuit(pos);
		this->barrierSpawned = true;
		displayGrid[pos.y][pos.x] = this->suit->getSymbol();
		Posn dpos = dragonPosition(pos);
		Enemy *e = new Dragon(dpos, NULL, this->suit, id);
		this->enemies.push_back(e);
		++dragons;
		displayGrid[dpos.y][dpos.x] = e->getSymbol();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x290, %rsp            # imm = 0x290
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0xa, -0x14(%rbp)
jge 0x756a
callq 0x4090
movl $0x6, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x18(%rbp)
leaq -0x24(%rbp), %rdi
callq 0x54a0
movq -0x1f0(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
leaq -0x24(%rbp), %rdx
callq 0x6320
cmpl $0x1, -0x18(%rbp)
jne 0x6fdc
movl $0x30, %edi
callq 0x41d0
movq %rax, -0x200(%rbp)
movb $0x1, -0x6d(%rbp)
movq -0x24(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x59(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x4300
movq -0x1f8(%rbp), %rdx
leaq 0x172d8(%rip), %rsi     # 0x1e20c
leaq -0x58(%rbp), %rdi
callq 0x4270
jmp 0x6f3f
movq -0x200(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x18d60
jmp 0x6f55
movq -0x200(%rbp), %rax
movb $0x0, -0x6d(%rbp)
movq %rax, -0x30(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4130
leaq -0x59(%rbp), %rdi
callq 0x4200
movq -0x1f0(%rbp), %rdi
addq $0x7f0, %rdi            # imm = 0x7F0
leaq -0x30(%rbp), %rsi
callq 0xd950
jmp 0x7532
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x6fb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4130
leaq -0x59(%rbp), %rdi
callq 0x4200
testb $0x1, -0x6d(%rbp)
jne 0x6fc6
jmp 0x6fd7
movq -0x200(%rbp), %rdi
movl $0x30, %esi
callq 0x41e0
jmp 0x7aac
cmpl $0x2, -0x18(%rbp)
jne 0x70e7
movl $0x30, %edi
callq 0x41d0
movq %rax, -0x210(%rbp)
movb $0x1, -0x9a(%rbp)
movq -0x24(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x4300
movq -0x208(%rbp), %rdx
leaq 0x171e8(%rip), %rsi     # 0x1e20f
leaq -0x98(%rbp), %rdi
callq 0x4270
jmp 0x7035
movq -0x210(%rbp), %rdi
movq -0x78(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x18d60
jmp 0x704e
movq -0x210(%rbp), %rax
movb $0x0, -0x9a(%rbp)
movq %rax, -0x30(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4130
leaq -0x99(%rbp), %rdi
callq 0x4200
movq -0x1f0(%rbp), %rdi
addq $0x7f0, %rdi            # imm = 0x7F0
leaq -0x30(%rbp), %rsi
callq 0xd950
jmp 0x7530
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x70ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4130
leaq -0x99(%rbp), %rdi
callq 0x4200
testb $0x1, -0x9a(%rbp)
jne 0x70d1
jmp 0x70e2
movq -0x210(%rbp), %rdi
movl $0x30, %esi
callq 0x41e0
jmp 0x7aac
cmpl $0x3, -0x18(%rbp)
jne 0x71f8
movl $0x30, %edi
callq 0x41d0
movq %rax, -0x220(%rbp)
movb $0x1, -0xca(%rbp)
movq -0x24(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x4300
movq -0x218(%rbp), %rdx
leaq 0x170dd(%rip), %rsi     # 0x1e212
leaq -0xc8(%rbp), %rdi
callq 0x4270
jmp 0x7143
movq -0x220(%rbp), %rdi
movq -0xa8(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x18d60
jmp 0x715f
movq -0x220(%rbp), %rax
movb $0x0, -0xca(%rbp)
movq %rax, -0x30(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x4130
leaq -0xc9(%rbp), %rdi
callq 0x4200
movq -0x1f0(%rbp), %rdi
addq $0x7f0, %rdi            # imm = 0x7F0
leaq -0x30(%rbp), %rsi
callq 0xd950
jmp 0x752e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x71cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x4130
leaq -0xc9(%rbp), %rdi
callq 0x4200
testb $0x1, -0xca(%rbp)
jne 0x71e2
jmp 0x71f3
movq -0x220(%rbp), %rdi
movl $0x30, %esi
callq 0x41e0
jmp 0x7aac
cmpl $0x4, -0x18(%rbp)
jne 0x7309
movl $0x30, %edi
callq 0x41d0
movq %rax, -0x230(%rbp)
movb $0x1, -0xfa(%rbp)
movq -0x24(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x4300
movq -0x228(%rbp), %rdx
leaq 0x16fcf(%rip), %rsi     # 0x1e215
leaq -0xf8(%rbp), %rdi
callq 0x4270
jmp 0x7254
movq -0x230(%rbp), %rdi
movq -0xd8(%rbp), %rsi
leaq -0xf8(%rbp), %rdx
callq 0x18d60
jmp 0x7270
movq -0x230(%rbp), %rax
movb $0x0, -0xfa(%rbp)
movq %rax, -0x30(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x4130
leaq -0xf9(%rbp), %rdi
callq 0x4200
movq -0x1f0(%rbp), %rdi
addq $0x7f0, %rdi            # imm = 0x7F0
leaq -0x30(%rbp), %rsi
callq 0xd950
jmp 0x752c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x72dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x4130
leaq -0xf9(%rbp), %rdi
callq 0x4200
testb $0x1, -0xfa(%rbp)
jne 0x72f3
jmp 0x7304
movq -0x230(%rbp), %rdi
movl $0x30, %esi
callq 0x41e0
jmp 0x7aac
cmpl $0x5, -0x18(%rbp)
jne 0x741a
movl $0x30, %edi
callq 0x41d0
movq %rax, -0x240(%rbp)
movb $0x1, -0x12a(%rbp)
movq -0x24(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x129(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x4300
movq -0x238(%rbp), %rdx
leaq 0x16ec1(%rip), %rsi     # 0x1e218
leaq -0x128(%rbp), %rdi
callq 0x4270
jmp 0x7365
movq -0x240(%rbp), %rdi
movq -0x108(%rbp), %rsi
leaq -0x128(%rbp), %rdx
callq 0x18d60
jmp 0x7381
movq -0x240(%rbp), %rax
movb $0x0, -0x12a(%rbp)
movq %rax, -0x30(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x4130
leaq -0x129(%rbp), %rdi
callq 0x4200
movq -0x1f0(%rbp), %rdi
addq $0x7f0, %rdi            # imm = 0x7F0
leaq -0x30(%rbp), %rsi
callq 0xd950
jmp 0x752a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x73ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x4130
leaq -0x129(%rbp), %rdi
callq 0x4200
testb $0x1, -0x12a(%rbp)
jne 0x7404
jmp 0x7415
movq -0x240(%rbp), %rdi
movl $0x30, %esi
callq 0x41e0
jmp 0x7aac
cmpl $0x6, -0x18(%rbp)
jne 0x7528
movl $0x30, %edi
callq 0x41d0
movq %rax, -0x250(%rbp)
movb $0x1, -0x15a(%rbp)
movq -0x24(%rbp), %rax
movq %rax, -0x138(%rbp)
leaq -0x159(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x4300
movq -0x248(%rbp), %rdx
leaq 0x16db3(%rip), %rsi     # 0x1e21b
leaq -0x158(%rbp), %rdi
callq 0x4270
jmp 0x7476
movq -0x250(%rbp), %rdi
movq -0x138(%rbp), %rsi
leaq -0x158(%rbp), %rdx
callq 0x18d60
jmp 0x7492
movq -0x250(%rbp), %rax
movb $0x0, -0x15a(%rbp)
movq %rax, -0x30(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x4130
leaq -0x159(%rbp), %rdi
callq 0x4200
movq -0x1f0(%rbp), %rdi
addq $0x7f0, %rdi            # imm = 0x7F0
leaq -0x30(%rbp), %rsi
callq 0xd950
jmp 0x7528
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x74fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x4130
leaq -0x159(%rbp), %rdi
callq 0x4200
testb $0x1, -0x15a(%rbp)
jne 0x7512
jmp 0x7523
movq -0x250(%rbp), %rdi
movl $0x30, %esi
callq 0x41e0
jmp 0x7aac
jmp 0x752a
jmp 0x752c
jmp 0x752e
jmp 0x7530
jmp 0x7532
movq -0x30(%rbp), %rdi
callq 0x17b60
movb %al, %dl
movq -0x1f0(%rbp), %rax
addq $0x820, %rax            # imm = 0x820
movslq -0x20(%rbp), %rcx
imulq $0x4f, %rcx, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6eb5
movl $0x0, -0x160(%rbp)
cmpl $0x6, -0x160(%rbp)
jge 0x78a8
callq 0x4090
movl $0x8, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x164(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x54a0
movq -0x1f0(%rbp), %rdi
leaq -0x168(%rbp), %rsi
leaq -0x170(%rbp), %rdx
callq 0x6320
cmpl $0x5, -0x164(%rbp)
jg 0x764c
movl $0x38, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x258(%rbp)
movq -0x170(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rsi
callq 0x18150
jmp 0x75fd
movq -0x1f0(%rbp), %rdi
movq -0x258(%rbp), %rax
movq %rax, -0x178(%rbp)
addq $0x7d8, %rdi            # imm = 0x7D8
leaq -0x178(%rbp), %rsi
callq 0xd9c0
jmp 0x7861
movq -0x258(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x38, %esi
callq 0x41e0
jmp 0x7aac
cmpl $0x7, -0x164(%rbp)
jg 0x76db
movl $0x38, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x260(%rbp)
movq -0x170(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x188(%rbp), %rsi
callq 0x181d0
jmp 0x768c
movq -0x1f0(%rbp), %rdi
movq -0x260(%rbp), %rax
movq %rax, -0x178(%rbp)
addq $0x7d8, %rdi            # imm = 0x7D8
leaq -0x178(%rbp), %rsi
callq 0xd9c0
jmp 0x785f
movq -0x260(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x38, %esi
callq 0x41e0
jmp 0x7aac
cmpl $0x8, -0x164(%rbp)
jne 0x785d
movl $0x38, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x268(%rbp)
movq -0x170(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rsi
callq 0x18250
jmp 0x771b
movq -0x1f0(%rbp), %rdi
movq -0x268(%rbp), %rax
movq %rax, -0x178(%rbp)
addq $0x7d8, %rdi            # imm = 0x7D8
leaq -0x178(%rbp), %rsi
callq 0xd9c0
movq -0x1f0(%rbp), %rdi
movq -0x170(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rsi
callq 0x6440
movq %rax, -0x198(%rbp)
movl $0x60, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x270(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x178(%rbp), %rdx
movl -0x168(%rbp), %r8d
movq -0x1b0(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
callq 0x18450
jmp 0x77b0
movq -0x1f0(%rbp), %rdi
movq -0x270(%rbp), %rax
movq %rax, -0x1a8(%rbp)
addq $0x7c0, %rdi            # imm = 0x7C0
leaq -0x1a8(%rbp), %rsi
callq 0xd8e0
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x1a8(%rbp), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movb %al, %dl
movq -0x1f0(%rbp), %rax
addq $0x820, %rax            # imm = 0x820
movslq -0x194(%rbp), %rcx
imulq $0x4f, %rcx, %rcx
addq %rcx, %rax
movslq -0x198(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x785d
movq -0x268(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x38, %esi
callq 0x41e0
jmp 0x7aac
movq -0x270(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x60, %esi
callq 0x41e0
jmp 0x7aac
jmp 0x785f
jmp 0x7861
movq -0x178(%rbp), %rdi
callq 0x17b60
movb %al, %dl
movq -0x1f0(%rbp), %rax
addq $0x820, %rax            # imm = 0x820
movslq -0x16c(%rbp), %rcx
imulq $0x4f, %rcx, %rcx
addq %rcx, %rax
movslq -0x170(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x160(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x160(%rbp)
jmp 0x7574
callq 0x4090
movq -0x1f0(%rbp), %rdx
movl $0x6, %ecx
subl (%rdx), %ecx
cltd
idivl %ecx
movl %edx, -0x1b4(%rbp)
cmpl $0x0, -0x1b4(%rbp)
jne 0x7aa3
movq -0x1f0(%rbp), %rax
testb $0x1, 0x5(%rax)
jne 0x7aa3
leaq -0x1c0(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x54a0
movq -0x1f0(%rbp), %rdi
movq -0x280(%rbp), %rdx
leaq -0x1b8(%rbp), %rsi
callq 0x6320
movl $0x10, %edi
callq 0x41d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x278(%rbp)
movq -0x1c0(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rsi
callq 0x183d0
jmp 0x7942
movq -0x1f0(%rbp), %rax
movq -0x278(%rbp), %rcx
movq %rcx, 0xfe8(%rax)
movb $0x1, 0x5(%rax)
movq 0xfe8(%rax), %rdi
callq 0x17b60
movq -0x1f0(%rbp), %rdi
movb %al, %dl
movslq -0x1bc(%rbp), %rax
imulq $0x4f, %rax, %rax
movq %rdi, %rcx
addq %rax, %rcx
movslq -0x1c0(%rbp), %rax
movb %dl, 0x820(%rax,%rcx)
movq -0x1c0(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x1d8(%rbp), %rsi
callq 0x6440
movq %rax, -0x1d0(%rbp)
movl $0x60, %edi
callq 0x41d0
movq %rax, %rdi
movq -0x1f0(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x288(%rbp)
movq -0x1d0(%rbp), %rcx
movq %rcx, -0x1e8(%rbp)
movq 0xfe8(%rax), %rcx
movl -0x1b8(%rbp), %r8d
movq -0x1e8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x18450
jmp 0x79fc
movq -0x1f0(%rbp), %rdi
movq -0x288(%rbp), %rax
movq %rax, -0x1e0(%rbp)
addq $0x7c0, %rdi            # imm = 0x7C0
leaq -0x1e0(%rbp), %rsi
callq 0xd8e0
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x1e0(%rbp), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movb %al, %dl
movq -0x1f0(%rbp), %rax
addq $0x820, %rax            # imm = 0x820
movslq -0x1cc(%rbp), %rcx
imulq $0x4f, %rcx, %rcx
addq %rcx, %rax
movslq -0x1d0(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x7aa3
movq -0x278(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x10, %esi
callq 0x41e0
jmp 0x7aac
movq -0x288(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x60, %esi
callq 0x41e0
jmp 0x7aac
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x42f0
nopw %cs:(%rax,%rax)