// File: XxAdi101xX[P]ChamberCrawler/Cell/Cell.cc
// Function: Cell::getInfo() const
Info Cell::getInfo() const {

	Info cellInfo;

	cellInfo.coordinates = this->coordinates;
	// check if cell occupies a character
	if (getOccupant() != nullptr) {
		if (occupant->getPlayerState() == true) {
			cellInfo.displayChar = CHAR_PLAYER;
		}
		else {
			string name = occupant->getName();
			if (name == NAME_HUMAN) {
				cellInfo.displayChar = CHAR_HUMAN;
			}
			else if (name == NAME_DWARF) {
				cellInfo.displayChar = CHAR_DWARF;
			}
			else if (name ==  NAME_ELF) {
				cellInfo.displayChar = CHAR_ELF;
			}
			else if (name == NAME_ORC) {
				 cellInfo.displayChar = CHAR_ORC;
			}
			else if (name == NAME_MERCHANT) {
				 cellInfo.displayChar = CHAR_MERCHANT;
			}
			else if (name == NAME_DRAGON) {
				cellInfo.displayChar = CHAR_DRAGON;
			}
			else if (name == NAME_HALFLING) {
				cellInfo.displayChar = CHAR_HALFLING;
			}
		}
	}
	// check if cell occupies an item
	else if (item != nullptr) {
		if (item->getItemType() == ItemType::GoldPile) {
			cellInfo.displayChar = CHAR_ITEM_GOLD_PILE;
		}
		else if (item->getItemType() == ItemType::Potion) {
			cellInfo.displayChar = CHAR_ITEM_POTION;
		}
	}
	// next few statements check for the remaining types of cells
	else if (getCellType() == CellType::Passage){
		cellInfo.displayChar = CHAR_PASSAGE;
	}
	else if (getCellType() == CellType::DoorWay) {
		cellInfo.displayChar = CHAR_DOOR_WAY;
	}
	else if (getCellType() == CellType::FloorTile) {
		cellInfo.displayChar = CHAR_FLOOR_TILE;
	}
	else if (getCellType() == CellType::Stairs) {
		cellInfo.displayChar = CHAR_STAIRS;
	}
	else if (getCellType() == CellType::Wall) {
		// check what type of wall is occupied by cell
		if ((((getNeighbour(Direction::East))->getCellType() != CellType::Null) &&
				((getNeighbour(Direction::West))->getCellType() != CellType::Null) && 
				((getNeighbour(Direction::East))->getCellType() != CellType::FloorTile) &&
        ((getNeighbour(Direction::West))->getCellType() != CellType::FloorTile)) &&
				(((getNeighbour(Direction::East))->getCellType() == CellType::Wall) ||
				((getNeighbour(Direction::West))->getCellType() == CellType::Wall) ||
				((getNeighbour(Direction::West))->getCellType() == CellType::Stairs) ||
				((getNeighbour(Direction::East))->getCellType() == CellType::Stairs)))
																																						{
			cellInfo.displayChar = CHAR_HORIZONTAL_WALL;
		}
		else {
			cellInfo.displayChar = CHAR_VERTICAL_WALL;
		}
	}
	else if (getCellType() == CellType::Null) {
    cellInfo.displayChar = CHAR_NULL;
  }

	cellInfo.isCellInfo = true;

	return cellInfo;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x118(%rbp)
movq %rdi, %rax
movq %rax, -0x128(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x120(%rbp)
movb $0x0, -0x11(%rbp)
callq 0x2db80
movq -0x120(%rbp), %rsi
movq -0x118(%rbp), %rdi
addq $0x28, %rsi
addq $0x18, %rdi
callq 0x2d7f0
jmp 0x2cfb5
movq -0x120(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x2cf30
leaq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2dbc0
movb %al, -0x129(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x19530
movb -0x129(%rbp), %al
testb $0x1, %al
jne 0x2cff0
jmp 0x2d175
movq -0x120(%rbp), %rdi
addq $0x68, %rdi
callq 0x19830
movq %rax, %rdi
callq 0x2f2f0
movb %al, -0x12a(%rbp)
jmp 0x2d010
movb -0x12a(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2d041
movq -0x118(%rbp), %rax
movb $0x40, 0x30(%rax)
jmp 0x2d170
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x2d731
movq -0x120(%rbp), %rdi
addq $0x68, %rdi
callq 0x19830
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
callq 0x2f310
jmp 0x2d05f
leaq -0x58(%rbp), %rdi
leaq 0x3b966(%rip), %rsi     # 0x689d0
callq 0x197a0
testb $0x1, %al
jne 0x2d075
jmp 0x2d085
movq -0x118(%rbp), %rax
movb $0x48, 0x30(%rax)
jmp 0x2d167
leaq -0x58(%rbp), %rdi
leaq 0x3b8c0(%rip), %rsi     # 0x68950
callq 0x197a0
testb $0x1, %al
jne 0x2d09b
jmp 0x2d0ab
movq -0x118(%rbp), %rax
movb $0x57, 0x30(%rax)
jmp 0x2d165
leaq -0x58(%rbp), %rdi
leaq 0x3b8ba(%rip), %rsi     # 0x68970
callq 0x197a0
testb $0x1, %al
jne 0x2d0c1
jmp 0x2d0d1
movq -0x118(%rbp), %rax
movb $0x45, 0x30(%rax)
jmp 0x2d163
leaq -0x58(%rbp), %rdi
leaq 0x3b934(%rip), %rsi     # 0x68a10
callq 0x197a0
testb $0x1, %al
jne 0x2d0e7
jmp 0x2d0f4
movq -0x118(%rbp), %rax
movb $0x4f, 0x30(%rax)
jmp 0x2d161
leaq -0x58(%rbp), %rdi
leaq 0x3b8f1(%rip), %rsi     # 0x689f0
callq 0x197a0
testb $0x1, %al
jne 0x2d10a
jmp 0x2d117
movq -0x118(%rbp), %rax
movb $0x4d, 0x30(%rax)
jmp 0x2d15f
leaq -0x58(%rbp), %rdi
leaq 0x3b7ee(%rip), %rsi     # 0x68910
callq 0x197a0
testb $0x1, %al
jne 0x2d12d
jmp 0x2d13a
movq -0x118(%rbp), %rax
movb $0x44, 0x30(%rax)
jmp 0x2d15d
leaq -0x58(%rbp), %rdi
leaq 0x3b86b(%rip), %rsi     # 0x689b0
callq 0x197a0
testb $0x1, %al
jne 0x2d150
jmp 0x2d15b
movq -0x118(%rbp), %rax
movb $0x4c, 0x30(%rax)
jmp 0x2d15d
jmp 0x2d15f
jmp 0x2d161
jmp 0x2d163
jmp 0x2d165
jmp 0x2d167
leaq -0x58(%rbp), %rdi
callq 0x65e8
jmp 0x2d700
movq -0x120(%rbp), %rdi
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2dbf0
testb $0x1, %al
jne 0x2d18f
jmp 0x2d204
movq -0x120(%rbp), %rdi
addq $0x58, %rdi
callq 0x2dc20
movq %rax, %rdi
callq 0x33d60
movl %eax, -0x130(%rbp)
jmp 0x2d1af
movl -0x130(%rbp), %eax
cmpl $0x0, %eax
jne 0x2d1c7
movq -0x118(%rbp), %rax
movb $0x47, 0x30(%rax)
jmp 0x2d1ff
movq -0x120(%rbp), %rdi
addq $0x58, %rdi
callq 0x2dc20
movq %rax, %rdi
callq 0x33d60
movl %eax, -0x134(%rbp)
jmp 0x2d1e7
movl -0x134(%rbp), %eax
cmpl $0x1, %eax
jne 0x2d1fd
movq -0x118(%rbp), %rax
movb $0x50, 0x30(%rax)
jmp 0x2d1ff
jmp 0x2d6fe
movq -0x120(%rbp), %rdi
callq 0x2cc40
cmpl $0x3, %eax
jne 0x2d225
movq -0x118(%rbp), %rax
movb $0x23, 0x30(%rax)
jmp 0x2d6fc
movq -0x120(%rbp), %rdi
callq 0x2cc40
cmpl $0x2, %eax
jne 0x2d246
movq -0x118(%rbp), %rax
movb $0x2b, 0x30(%rax)
jmp 0x2d6fa
movq -0x120(%rbp), %rdi
callq 0x2cc40
cmpl $0x1, %eax
jne 0x2d267
movq -0x118(%rbp), %rax
movb $0x2e, 0x30(%rax)
jmp 0x2d6f8
movq -0x120(%rbp), %rdi
callq 0x2cc40
cmpl $0x4, %eax
jne 0x2d288
movq -0x118(%rbp), %rax
movb $0x5c, 0x30(%rax)
jmp 0x2d6f6
movq -0x120(%rbp), %rdi
callq 0x2cc40
cmpl $0x0, %eax
jne 0x2d6d6
movq -0x120(%rbp), %rsi
movb $0x0, -0x79(%rbp)
movb $0x0, -0x91(%rbp)
movb $0x0, -0xa9(%rbp)
movb $0x0, -0xc1(%rbp)
movb $0x0, -0xd9(%rbp)
movb $0x0, -0xf1(%rbp)
movb $0x0, -0x109(%rbp)
leaq -0x68(%rbp), %rdi
movl $0x3, %edx
callq 0x2cca0
jmp 0x2d2e2
leaq -0x68(%rbp), %rdi
callq 0x19df0
movq %rax, %rdi
callq 0x2cc40
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x5, %ecx
movb %al, -0x135(%rbp)
je 0x2d4f6
movq -0x120(%rbp), %rsi
leaq -0x78(%rbp), %rdi
movl $0x2, %edx
callq 0x2cca0
jmp 0x2d31d
movb $0x1, -0x79(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x19df0
movq %rax, %rdi
callq 0x2cc40
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x5, %ecx
movb %al, -0x135(%rbp)
je 0x2d4f6
movq -0x120(%rbp), %rsi
leaq -0x90(%rbp), %rdi
movl $0x3, %edx
callq 0x2cca0
jmp 0x2d35f
movb $0x1, -0x91(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x19df0
movq %rax, %rdi
callq 0x2cc40
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x1, %ecx
movb %al, -0x135(%rbp)
je 0x2d4f6
movq -0x120(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
movl $0x2, %edx
callq 0x2cca0
jmp 0x2d3a7
movb $0x1, -0xa9(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x19df0
movq %rax, %rdi
callq 0x2cc40
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x1, %ecx
movb %al, -0x135(%rbp)
je 0x2d4f6
movq -0x120(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
movl $0x3, %edx
callq 0x2cca0
jmp 0x2d3ef
movb $0x1, -0xc1(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x19df0
movq %rax, %rdi
callq 0x2cc40
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x136(%rbp)
je 0x2d4ea
movq -0x120(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
movl $0x2, %edx
callq 0x2cca0
jmp 0x2d437
movb $0x1, -0xd9(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x19df0
movq %rax, %rdi
callq 0x2cc40
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x136(%rbp)
je 0x2d4ea
movq -0x120(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
movl $0x2, %edx
callq 0x2cca0
jmp 0x2d47f
movb $0x1, -0xf1(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x19df0
movq %rax, %rdi
callq 0x2cc40
movl %eax, %ecx
movb $0x1, %al
cmpl $0x4, %ecx
movb %al, -0x136(%rbp)
je 0x2d4ea
movq -0x120(%rbp), %rsi
leaq -0x108(%rbp), %rdi
movl $0x3, %edx
callq 0x2cca0
jmp 0x2d4c3
movb $0x1, -0x109(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x19df0
movq %rax, %rdi
callq 0x2cc40
cmpl $0x4, %eax
sete %al
movb %al, -0x136(%rbp)
movb -0x136(%rbp), %al
movb %al, -0x135(%rbp)
movb -0x135(%rbp), %al
movb %al, -0x137(%rbp)
testb $0x1, -0x109(%rbp)
jne 0x2d50d
jmp 0x2d519
leaq -0x108(%rbp), %rdi
callq 0x199a0
testb $0x1, -0xf1(%rbp)
jne 0x2d524
jmp 0x2d530
leaq -0xf0(%rbp), %rdi
callq 0x199a0
testb $0x1, -0xd9(%rbp)
jne 0x2d53b
jmp 0x2d547
leaq -0xd8(%rbp), %rdi
callq 0x199a0
testb $0x1, -0xc1(%rbp)
jne 0x2d552
jmp 0x2d55e
leaq -0xc0(%rbp), %rdi
callq 0x199a0
testb $0x1, -0xa9(%rbp)
jne 0x2d569
jmp 0x2d575
leaq -0xa8(%rbp), %rdi
callq 0x199a0
testb $0x1, -0x91(%rbp)
jne 0x2d580
jmp 0x2d58c
leaq -0x90(%rbp), %rdi
callq 0x199a0
testb $0x1, -0x79(%rbp)
jne 0x2d594
jmp 0x2d59d
leaq -0x78(%rbp), %rdi
callq 0x199a0
leaq -0x68(%rbp), %rdi
callq 0x199a0
movb -0x137(%rbp), %al
testb $0x1, %al
jne 0x2d5b5
jmp 0x2d6c9
movq -0x118(%rbp), %rax
movb $0x2d, 0x30(%rax)
jmp 0x2d6d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x2d6be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x2d6ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x2d692
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x2d679
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x2d660
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x2d647
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
testb $0x1, -0xf1(%rbp)
jne 0x2d639
jmp 0x2d645
leaq -0xf0(%rbp), %rdi
callq 0x199a0
jmp 0x2d647
testb $0x1, -0xd9(%rbp)
jne 0x2d652
jmp 0x2d65e
leaq -0xd8(%rbp), %rdi
callq 0x199a0
jmp 0x2d660
testb $0x1, -0xc1(%rbp)
jne 0x2d66b
jmp 0x2d677
leaq -0xc0(%rbp), %rdi
callq 0x199a0
jmp 0x2d679
testb $0x1, -0xa9(%rbp)
jne 0x2d684
jmp 0x2d690
leaq -0xa8(%rbp), %rdi
callq 0x199a0
jmp 0x2d692
testb $0x1, -0x91(%rbp)
jne 0x2d69d
jmp 0x2d6a9
leaq -0x90(%rbp), %rdi
callq 0x199a0
jmp 0x2d6ab
testb $0x1, -0x79(%rbp)
jne 0x2d6b3
jmp 0x2d6bc
leaq -0x78(%rbp), %rdi
callq 0x199a0
jmp 0x2d6be
leaq -0x68(%rbp), %rdi
callq 0x199a0
jmp 0x2d731
movq -0x118(%rbp), %rax
movb $0x7c, 0x30(%rax)
jmp 0x2d6f4
movq -0x120(%rbp), %rdi
callq 0x2cc40
cmpl $0x5, %eax
jne 0x2d6f2
movq -0x118(%rbp), %rax
movb $0x20, 0x30(%rax)
jmp 0x2d6f4
jmp 0x2d6f6
jmp 0x2d6f8
jmp 0x2d6fa
jmp 0x2d6fc
jmp 0x2d6fe
jmp 0x2d700
movq -0x118(%rbp), %rax
movb $0x1, 0x58(%rax)
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x2d721
movq -0x118(%rbp), %rdi
callq 0x1a1b0
movq -0x128(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x118(%rbp), %rdi
callq 0x1a1b0
movq -0x20(%rbp), %rdi
callq 0x6550
nopw %cs:(%rax,%rax)