// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, -0x60(%rbp)
movq %rdi, %r14
leaq 0x7f0(%rdi), %rax
movq %rax, -0x40(%rbp)
leaq 0x820(%rdi), %rax
movq %rax, -0x50(%rbp)
movl $0xa, %r13d
callq 0x4060
movslq %eax, %rbx
imulq $0x2aaaaaab, %rbx, %rax # imm = 0x2AAAAAAB
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
addl %ecx, %eax
addl %eax, %eax
leal (%rax,%rax,2), %eax
subl %eax, %ebx
movq %r14, %rdi
leaq -0x48(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x5a5c
cmpl $0x5, %ebx
ja 0x6563
leaq 0x17000(%rip), %rcx     # 0x1d2a0
movslq (%rcx,%rbx,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x30, %edi
callq 0x4160
movq %rax, %rbx
movq -0x38(%rbp), %r15
leaq -0x110(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x120(%rbp), %r12
movq %r12, %rdi
leaq 0x16fdf(%rip), %rsi     # 0x1d2b8
leaq 0x16fda(%rip), %rdx     # 0x1d2ba
callq 0x501a
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x17270
movq %rbx, -0x30(%rbp)
movq -0x120(%rbp), %rdi
leaq -0x110(%rbp), %rax
cmpq %rax, %rdi
je 0x6535
movq -0x110(%rbp), %rsi
jmp 0x652d
movl $0x30, %edi
callq 0x4160
movq %rax, %rbx
movq -0x38(%rbp), %r15
leaq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0xa0(%rbp), %r12
movq %r12, %rdi
leaq 0x16f7a(%rip), %rsi     # 0x1d2c4
leaq 0x16f75(%rip), %rdx     # 0x1d2c6
callq 0x501a
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x17270
movq %rbx, -0x30(%rbp)
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x6535
movq -0x90(%rbp), %rsi
jmp 0x652d
movl $0x30, %edi
callq 0x4160
movq %rax, %rbx
movq -0x38(%rbp), %r15
leaq -0xd0(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0xe0(%rbp), %r12
movq %r12, %rdi
leaq 0x16f03(%rip), %rsi     # 0x1d2be
leaq 0x16efe(%rip), %rdx     # 0x1d2c0
callq 0x501a
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x17270
movq %rbx, -0x30(%rbp)
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x6535
movq -0xd0(%rbp), %rsi
jmp 0x652d
movl $0x30, %edi
callq 0x4160
movq %rax, %rbx
movq -0x38(%rbp), %r15
leaq -0xb0(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0xc0(%rbp), %r12
movq %r12, %rdi
leaq 0x16e95(%rip), %rsi     # 0x1d2c1
leaq 0x16e90(%rip), %rdx     # 0x1d2c3
callq 0x501a
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x17270
movq %rbx, -0x30(%rbp)
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x6535
movq -0xb0(%rbp), %rsi
jmp 0x652d
movl $0x30, %edi
callq 0x4160
movq %rax, %rbx
movq -0x38(%rbp), %r15
leaq -0xf0(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0x100(%rbp), %r12
movq %r12, %rdi
leaq 0x16e1e(%rip), %rsi     # 0x1d2bb
leaq 0x16e19(%rip), %rdx     # 0x1d2bd
callq 0x501a
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x17270
movq %rbx, -0x30(%rbp)
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0x6535
movq -0xf0(%rbp), %rsi
jmp 0x652d
movl $0x30, %edi
callq 0x4160
movq %rax, %rbx
movq -0x38(%rbp), %r15
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %r12
movq %r12, %rdi
leaq 0x16dc9(%rip), %rsi     # 0x1d2c7
leaq 0x16dc4(%rip), %rdx     # 0x1d2c9
callq 0x501a
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x17270
movq %rbx, -0x30(%rbp)
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x6535
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x4170
movq 0x7f8(%r14), %rsi
cmpq 0x800(%r14), %rsi
je 0x6556
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x7f8(%r14)
jmp 0x6563
movq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0xa89c
movq -0x30(%rbp), %rdi
callq 0x15d80
movslq -0x34(%rbp), %rcx
movslq -0x38(%rbp), %rdx
imulq $0x4f, %rcx, %rcx
addq -0x50(%rbp), %rcx
movb %al, (%rdx,%rcx)
decl %r13d
jne 0x625d
leaq 0x7d8(%r14), %rax
movq %rax, -0x40(%rbp)
leaq 0x7c0(%r14), %r12
movl $0x6, %r13d
callq 0x4060
movl %eax, %r15d
leal 0x7(%r15), %eax
testl %r15d, %r15d
cmovnsl %r15d, %eax
andl $-0x8, %eax
subl %eax, %r15d
movq %r14, %rdi
leaq -0x54(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x5a5c
movl $0x38, %edi
cmpl $0x4, %r15d
jg 0x65ea
callq 0x4160
movq %rax, %rbx
movq -0x38(%rbp), %rsi
movq %rax, %rdi
callq 0x16060
jmp 0x6604
callq 0x4160
movq %rax, %rbx
movq -0x38(%rbp), %rsi
cmpl $0x6, %r15d
jg 0x663a
movq %rbx, %rdi
callq 0x160ea
movq %rbx, -0x30(%rbp)
movq 0x7e0(%r14), %rsi
cmpq 0x7e8(%r14), %rsi
je 0x6628
movq %rbx, (%rsi)
addq $0x8, 0x7e0(%r14)
jmp 0x66f3
movq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0xa9dc
jmp 0x66f3
movq %rbx, %rdi
callq 0x16174
movq %rbx, -0x30(%rbp)
movq 0x7e0(%r14), %rsi
cmpq 0x7e8(%r14), %rsi
je 0x6663
movq %rbx, (%rsi)
addq $0x8, 0x7e0(%r14)
jmp 0x6670
movq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0xa9dc
movq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0x5b64
movq %rax, %rbx
movl $0x60, %edi
callq 0x4160
movq %rax, %r15
movq -0x30(%rbp), %rdx
movl -0x54(%rbp), %r8d
movq %rax, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x16294
movq %r15, -0x48(%rbp)
movq 0x7c8(%r14), %rsi
cmpq 0x7d0(%r14), %rsi
je 0x66c2
movq %r15, (%rsi)
addq $0x8, 0x7c8(%r14)
jmp 0x66ce
movq %r12, %rdi
leaq -0x48(%rbp), %rdx
callq 0xa75c
movq -0x60(%rbp), %rax
incl (%rax)
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movq %rbx, %rcx
sarq $0x20, %rcx
movslq %ebx, %rdx
imulq $0x4f, %rcx, %rcx
addq -0x50(%rbp), %rcx
movb %al, (%rdx,%rcx)
movq -0x30(%rbp), %rdi
callq 0x15d80
movslq -0x34(%rbp), %rcx
movslq -0x38(%rbp), %rdx
imulq $0x4f, %rcx, %rcx
addq -0x50(%rbp), %rcx
movb %al, (%rdx,%rcx)
decl %r13d
jne 0x65a0
callq 0x4060
movl $0x6, %ecx
subl (%r14), %ecx
cltd
idivl %ecx
testl %edx, %edx
jne 0x681c
cmpb $0x0, 0x5(%r14)
jne 0x681c
leaq -0x48(%rbp), %rsi
leaq -0x38(%rbp), %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x5a5c
movl $0x10, %edi
callq 0x4160
movq %rax, %rbx
movq (%r15), %rsi
movq %rax, %rdi
callq 0x16254
movq %rbx, 0xfe8(%r14)
movb $0x1, 0x5(%r14)
movq %rbx, %rdi
callq 0x15d80
movslq -0x34(%rbp), %rcx
movslq -0x38(%rbp), %rdx
imulq $0x4f, %rcx, %rcx
addq %r14, %rcx
addq $0x820, %rcx            # imm = 0x820
movb %al, (%rdx,%rcx)
movq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0x5b64
movq %rax, %rbx
movl $0x60, %edi
callq 0x4160
movq %rax, %r15
movq 0xfe8(%r14), %rcx
movl -0x48(%rbp), %r8d
movq %rax, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x16294
movq %r15, -0x30(%rbp)
movq 0x7c8(%r14), %rsi
cmpq 0x7d0(%r14), %rsi
je 0x67e8
movq %r15, (%rsi)
addq $0x8, 0x7c8(%r14)
jmp 0x67f4
leaq -0x30(%rbp), %rdx
movq %r12, %rdi
callq 0xa75c
movq -0x60(%rbp), %rax
incl (%rax)
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movq %rbx, %rcx
sarq $0x20, %rcx
movslq %ebx, %rdx
imulq $0x4f, %rcx, %rcx
movq -0x50(%rbp), %rsi
addq %rcx, %rsi
movb %al, (%rdx,%rsi)
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6922
movq %rax, %r14
movl $0x10, %esi
jmp 0x6937
movq %rax, %r14
movq -0x120(%rbp), %rdi
leaq -0x110(%rbp), %rax
cmpq %rax, %rdi
je 0x6917
movq -0x110(%rbp), %rsi
jmp 0x690a
jmp 0x6914
movq %rax, %r14
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0x6917
movq -0xf0(%rbp), %rsi
jmp 0x690a
jmp 0x6914
movq %rax, %r14
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x6917
movq -0xd0(%rbp), %rsi
jmp 0x690a
jmp 0x6914
movq %rax, %r14
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x6917
movq -0xb0(%rbp), %rsi
jmp 0x690a
jmp 0x6914
movq %rax, %r14
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x6917
movq -0x90(%rbp), %rsi
jmp 0x690a
jmp 0x6914
movq %rax, %r14
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x6917
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x6917
movq %rax, %r14
movl $0x30, %esi
jmp 0x6937
jmp 0x692f
jmp 0x692f
movq %rax, %r14
movl $0x60, %esi
movq %r15, %rdi
jmp 0x693a
movq %rax, %r14
movl $0x38, %esi
movq %rbx, %rdi
callq 0x4170
movq %r14, %rdi
callq 0x4250
nop