// File: /workspace/github_cpp_makefile_star2_O2/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 $0x108, %rsp            # imm = 0x108
movq %rsi, -0x68(%rbp)
leaq 0x7f0(%rdi), %rax
movq %rax, -0x48(%rbp)
movq %rdi, -0x50(%rbp)
leaq 0x820(%rdi), %rax
movq %rax, -0x60(%rbp)
pushq $0xa
popq %r13
pushq $0x6
popq %r14
leaq -0x88(%rbp), %r15
subl $0x1, %r13d
jb 0x5af9
callq 0x4070
cltd
idivl %r14d
movl %edx, %ebx
movq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x52b4
cmpl $0x5, %ebx
ja 0x5ad8
leaq 0xa93b(%rip), %rcx      # 0x10274
movslq (%rcx,%rbx,4), %rax
addq %rcx, %rax
jmpq *%rax
pushq $0x30
popq %rdi
callq 0x4190
movq %rax, %rbx
movq -0x30(%rbp), %r12
leaq -0x128(%rbp), %r15
movq %r15, %rdi
leaq 0xa92a(%rip), %rsi      # 0x1028c
leaq -0x34(%rbp), %rdx
callq 0x40b0
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xd3e8
jmp 0x5ab8
pushq $0x30
popq %rdi
callq 0x4190
movq %rax, %rbx
movq -0x30(%rbp), %r12
movq %r15, %rdi
leaq 0xa901(%rip), %rsi      # 0x10298
leaq -0x34(%rbp), %rdx
callq 0x40b0
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xd3e8
movq %rbx, -0x40(%rbp)
movq %r15, %rdi
callq 0x40e0
jmp 0x5a7b
pushq $0x30
popq %rdi
callq 0x4190
movq %rax, %rbx
movq -0x30(%rbp), %r12
leaq -0xe8(%rbp), %r15
movq %r15, %rdi
leaq 0xa8b3(%rip), %rsi      # 0x10292
leaq -0x34(%rbp), %rdx
callq 0x40b0
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xd3e8
jmp 0x5a68
pushq $0x30
popq %rdi
callq 0x4190
movq %rax, %rbx
movq -0x30(%rbp), %r12
leaq -0xc8(%rbp), %r15
movq %r15, %rdi
leaq 0xa87d(%rip), %rsi      # 0x10295
leaq -0x34(%rbp), %rdx
callq 0x40b0
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xd3e8
jmp 0x5a68
pushq $0x30
popq %rdi
callq 0x4190
movq %rax, %rbx
movq -0x30(%rbp), %r12
leaq -0x108(%rbp), %r15
movq %r15, %rdi
leaq 0xa83e(%rip), %rsi      # 0x1028f
leaq -0x34(%rbp), %rdx
callq 0x40b0
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xd3e8
movq %rbx, -0x40(%rbp)
movq %r15, %rdi
callq 0x40e0
leaq -0x88(%rbp), %r15
movq -0x48(%rbp), %rdi
jmp 0x5acf
pushq $0x30
popq %rdi
callq 0x4190
movq %rax, %rbx
movq -0x30(%rbp), %r12
leaq -0xa8(%rbp), %r15
movq %r15, %rdi
leaq 0xa7fa(%rip), %rsi      # 0x1029b
leaq -0x34(%rbp), %rdx
callq 0x40b0
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xd3e8
movq %rbx, -0x40(%rbp)
movq %r15, %rdi
callq 0x40e0
movq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %r15
leaq -0x40(%rbp), %rsi
callq 0x8424
movq -0x40(%rbp), %rdi
callq 0xcab4
movslq -0x2c(%rbp), %rcx
movslq -0x30(%rbp), %rdx
imulq $0x4f, %rcx, %rcx
addq -0x60(%rbp), %rcx
movb %al, (%rdx,%rcx)
jmp 0x5903
movq -0x50(%rbp), %rax
leaq 0x7d8(%rax), %r15
addq $0x7c0, %rax            # imm = 0x7C0
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %r12
movq -0x60(%rbp), %r13
callq 0x4070
subl $0x1, %r14d
jb 0x5c3f
cltd
pushq $0x8
popq %rcx
idivl %ecx
movl %edx, %ebx
movq -0x50(%rbp), %rdi
leaq -0x34(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x52b4
pushq $0x38
popq %rdi
cmpl $0x4, %ebx
jg 0x5b6e
callq 0x4190
movq %rax, %rbx
movq -0x30(%rbp), %rsi
movq %rax, %rdi
callq 0xcc9c
movq %rbx, -0x40(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x8448
jmp 0x5c1f
callq 0x4190
movq %rax, %r13
movq -0x30(%rbp), %rsi
cmpl $0x6, %ebx
ja 0x5b9f
movq %r13, %rdi
callq 0xcd0c
movq %r13, -0x40(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x8448
movq -0x60(%rbp), %r13
jmp 0x5c1f
movq %r13, %rdi
callq 0xcd7c
movq %r13, -0x40(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x8448
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0x5386
movq %rax, %r13
pushq $0x60
popq %rdi
callq 0x4190
movq %rax, %rbx
movq -0x40(%rbp), %rdx
movl -0x34(%rbp), %r8d
movq %rax, %rdi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0xce70
movq %rbx, -0x58(%rbp)
movq -0x48(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x8400
movq -0x68(%rbp), %rax
incl (%rax)
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movq %r13, %rcx
sarq $0x20, %rcx
movslq %r13d, %rdx
imulq $0x4f, %rcx, %rcx
movq -0x60(%rbp), %r13
addq %r13, %rcx
movb %al, (%rdx,%rcx)
movq -0x40(%rbp), %rdi
callq 0xcab4
movslq -0x2c(%rbp), %rcx
movslq -0x30(%rbp), %rdx
imulq $0x4f, %rcx, %rcx
addq %r13, %rcx
movb %al, (%rdx,%rcx)
jmp 0x5b16
pushq $0x6
popq %rcx
movq -0x50(%rbp), %r14
subl (%r14), %ecx
cltd
idivl %ecx
testl %edx, %edx
jne 0x5d17
cmpb $0x0, 0x5(%r14)
jne 0x5d17
leaq -0x58(%rbp), %rsi
leaq -0x30(%rbp), %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x52b4
pushq $0x10
popq %rdi
callq 0x4190
movq %rax, %rbx
movq (%r15), %rsi
movq %rax, %rdi
callq 0xce30
movq %rbx, 0xfe8(%r14)
movb $0x1, 0x5(%r14)
movq %rbx, %rdi
callq 0xcab4
movslq -0x2c(%rbp), %rcx
movslq -0x30(%rbp), %rdx
imulq $0x4f, %rcx, %rcx
addq %r13, %rcx
movb %al, (%rdx,%rcx)
movq -0x30(%rbp), %rsi
movq %r14, %rdi
callq 0x5386
movq %rax, %rbx
pushq $0x60
popq %rdi
callq 0x4190
movq %rax, %r15
movq 0xfe8(%r14), %rcx
movl -0x58(%rbp), %r8d
movq %rax, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xce70
leaq -0x40(%rbp), %r14
movq %r15, (%r14)
movq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0x8400
movq -0x68(%rbp), %rax
incl (%rax)
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movq %rbx, %rcx
sarq $0x20, %rcx
movslq %ebx, %rdx
imulq $0x4f, %rcx, %rcx
addq %rcx, %r13
movb %al, (%rdx,%r13)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
pushq $0x60
popq %rsi
movq %r15, %rdi
jmp 0x5db9
movq %rax, %r14
pushq $0x10
jmp 0x5db5
movq %rax, %r14
leaq -0x128(%rbp), %rdi
jmp 0x5d8e
jmp 0x5d95
movq %rax, %r14
leaq -0x108(%rbp), %rdi
jmp 0x5d8e
jmp 0x5d95
movq %rax, %r14
leaq -0xe8(%rbp), %rdi
jmp 0x5d8e
jmp 0x5d95
movq %rax, %r14
leaq -0xc8(%rbp), %rdi
jmp 0x5d8e
jmp 0x5d95
movq %rax, %r14
leaq -0x88(%rbp), %rdi
jmp 0x5d8e
jmp 0x5d95
movq %rax, %r14
leaq -0xa8(%rbp), %rdi
callq 0x40e0
jmp 0x5d98
movq %rax, %r14
pushq $0x30
jmp 0x5db5
jmp 0x5d9e
movq %rax, %r14
pushq $0x38
popq %rsi
movq %r13, %rdi
jmp 0x5db9
movq %rax, %r14
pushq $0x60
jmp 0x5db5
movq %rax, %r14
pushq $0x38
popq %rsi
movq %rbx, %rdi
callq 0x41a0
movq %r14, %rdi
callq 0x4280