// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x18, %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
andq $0x0, 0x28(%rbx)
leaq 0x48(%rbx), %rax
movq %rax, 0x38(%rbx)
andq $0x0, 0x40(%rbx)
xorl %eax, %eax
movb %al, 0x48(%rbx)
movb %al, 0x58(%rbx)
addq $0x28, %rsi
callq 0x10e08
leaq 0x68(%r14), %r15
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xd3ac
movq (%r12), %r12
leaq 0x8(%rsp), %rdi
callq 0xd24a
testq %r12, %r12
je 0x10a85
movq (%r15), %rdi
callq 0x11700
testb %al, %al
je 0x10aba
movb $0x40, 0x30(%rbx)
jmp 0x10bfc
movq 0x58(%r14), %rdi
testq %rdi, %rdi
je 0x10b68
callq 0x13abc
testl %eax, %eax
je 0x10bf8
movq 0x58(%r14), %rdi
callq 0x13abc
cmpl $0x1, %eax
jne 0x10bfc
movb $0x50, 0x30(%rbx)
jmp 0x10bfc
movq (%r15), %rsi
movq %rsp, %rdi
callq 0x11704
leaq 0x14e24(%rip), %rsi     # 0x258f0
movq %rsp, %rdi
callq 0xcec2
movb $0x48, %cl
testb %al, %al
jne 0x10b58
leaq 0x14d8f(%rip), %rsi     # 0x25870
movq %rsp, %rdi
callq 0xcec2
movb $0x57, %cl
testb %al, %al
jne 0x10b58
leaq 0x14d9a(%rip), %rsi     # 0x25890
movq %rsp, %rdi
callq 0xcec2
movb $0x45, %cl
testb %al, %al
jne 0x10b58
leaq 0x14e25(%rip), %rsi     # 0x25930
movq %rsp, %rdi
callq 0xcec2
movb $0x4f, %cl
testb %al, %al
jne 0x10b58
leaq 0x14df0(%rip), %rsi     # 0x25910
movq %rsp, %rdi
callq 0xcec2
movb $0x4d, %cl
testb %al, %al
jne 0x10b58
leaq 0x14cfb(%rip), %rsi     # 0x25830
movq %rsp, %rdi
callq 0xcec2
movb $0x44, %cl
testb %al, %al
jne 0x10b58
leaq 0x14d86(%rip), %rsi     # 0x258d0
movq %rsp, %rdi
callq 0xcec2
movb $0x4c, %cl
testb %al, %al
je 0x10b5b
movb %cl, 0x30(%rbx)
movq %rsp, %rdi
callq 0x5428
jmp 0x10bfc
movl 0x20(%r14), %eax
cmpq $0x5, %rax
ja 0x10bfc
leaq 0x8577(%rip), %rcx      # 0x190f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rsp, %rdi
pushq $0x3
popq %rdx
movq %r14, %rsi
callq 0x10906
movq (%rsp), %rax
cmpl $0x5, 0x20(%rax)
je 0x10be8
leaq 0x20(%rsp), %rdi
pushq $0x2
popq %rdx
movq %r14, %rsi
callq 0x10906
movq 0x20(%rsp), %rax
cmpl $0x5, 0x20(%rax)
je 0x10bde
leaq 0x30(%rsp), %rdi
pushq $0x3
popq %rdx
movq %r14, %rsi
callq 0x10906
movq 0x30(%rsp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x10c31
leaq 0x38(%rsp), %rdi
callq 0xd24a
leaq 0x28(%rsp), %rdi
callq 0xd24a
leaq 0x8(%rsp), %rdi
callq 0xd24a
movb $0x7c, 0x30(%rbx)
jmp 0x10bfc
movb $0x47, 0x30(%rbx)
movb $0x1, 0x58(%rbx)
movq %rbx, %rax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb $0x5c, 0x30(%rbx)
jmp 0x10bfc
movb $0x2b, 0x30(%rbx)
jmp 0x10bfc
movb $0x23, 0x30(%rbx)
jmp 0x10bfc
movb $0x2e, 0x30(%rbx)
jmp 0x10bfc
movb $0x20, 0x30(%rbx)
jmp 0x10bfc
leaq 0x70(%rsp), %rdi
pushq $0x2
popq %rdx
movq %r14, %rsi
callq 0x10906
movq 0x70(%rsp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x10c53
xorl %ebp, %ebp
jmp 0x10cfb
leaq 0x60(%rsp), %rdi
pushq $0x3
popq %rdx
movq %r14, %rsi
callq 0x10906
movq 0x60(%rsp), %rax
cmpl $0x0, 0x20(%rax)
je 0x10cdf
leaq 0x50(%rsp), %rdi
pushq $0x2
popq %rdx
movq %r14, %rsi
callq 0x10906
movq 0x50(%rsp), %rax
cmpl $0x0, 0x20(%rax)
je 0x10ce4
leaq 0x40(%rsp), %rdi
pushq $0x2
popq %rdx
movq %r14, %rsi
callq 0x10906
movq 0x40(%rsp), %rax
movb $0x1, %bpl
cmpl $0x4, 0x20(%rax)
je 0x10cd3
leaq 0x80(%rsp), %rdi
pushq $0x3
popq %rdx
movq %r14, %rsi
callq 0x10906
leaq 0x88(%rsp), %rdi
movq -0x8(%rdi), %rax
cmpl $0x4, 0x20(%rax)
sete %bpl
callq 0xd24a
leaq 0x48(%rsp), %rdi
callq 0xd24a
jmp 0x10ce7
movb $0x1, %bpl
jmp 0x10cf1
movb $0x1, %bpl
leaq 0x58(%rsp), %rdi
callq 0xd24a
leaq 0x68(%rsp), %rdi
callq 0xd24a
leaq 0x78(%rsp), %rdi
callq 0xd24a
leaq 0x38(%rsp), %rdi
callq 0xd24a
leaq 0x28(%rsp), %rdi
callq 0xd24a
leaq 0x8(%rsp), %rdi
callq 0xd24a
testb %bpl, %bpl
je 0x10bf2
movb $0x2d, 0x30(%rbx)
jmp 0x10bfc
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0xd24a
jmp 0x10d47
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0xd24a
jmp 0x10d56
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0xd24a
jmp 0x10d65
movq %rax, %r14
leaq 0x78(%rsp), %rdi
callq 0xd24a
jmp 0x10d74
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0xd24a
jmp 0x10d83
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0xd24a
jmp 0x10d92
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xd24a
jmp 0x10da5
jmp 0x10da2
jmp 0x10da2
movq %rax, %r14
movq %rbx, %rdi
callq 0xd0bc
movq %r14, %rdi
callq 0x53c0
nop