// File: /workspace/github_cpp_makefile_star2_O1/kaiming[P]Chamber-Crawler-3k/TextDisplay/textdisplay.cc
// Function: TextDisplay::drawFloor(std::ostream&, Board&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void TextDisplay::drawFloor(std::ostream& out, Board& board, std::string action) {
    // Print out floor diagram

    // Iterate through the current floor
    for(auto it_i = board.floors[board.getFloorNum() - 1].begin(); it_i != board.floors[board.getFloorNum() - 1].end(); ++ it_i) {
        for (auto it_j = it_i->begin(); it_j != it_i->end(); ++ it_j) {
            
            // Determine if Walkable Tile
            if (std::dynamic_pointer_cast<WalkableTile>(*it_j)) {
                // Walkable Tile 
                // Determine symbol to print
                
                // Check for Exit, Gold, Potion, or Character
                
                if (std::static_pointer_cast<WalkableTile>(*it_j)->getOccupant() != nullptr) {
                    // Determine Player or Enemy
                    
                    // Check if player
                    if ((*it_j) == board.player) {
                        // Print "@" for player
                        out << "@";
                        continue;
                    }

                    // Determine enemy type 
                    std::string enemy = std::static_pointer_cast<WalkableTile>(*it_j)->getOccupant()->getRace();

                    if (enemy == "Human") {
                        // Print "H" for Human
                        out << "H";
                    } else if (enemy == "Dwarf") {
                        // Print "W" for Dwarf
                        out << "W";
                    } else if (enemy == "Elf") {
                        // Print "E" for Elf
                        out << "E";
                    } else if (enemy == "Orc") {
                        // Print "O" for Orc
                        out << "O";
                    } else if (enemy == "Merchant") {
                        // Print "M" for Merchant
                        out << "M";
                    } else if (enemy == "Dragon") {
                        // Print "D" for Dragon
                        out << "D";
                    } else if (enemy == "Halfling") {
                        // Print "L" for Halfling
                        out << "L";
                    }

                } else if (std::static_pointer_cast<WalkableTile>(*it_j)->isExit()) {
                    // Print "\" for stairs
                    out << "\\";
                } else if (std::static_pointer_cast<WalkableTile>(*it_j)->getPotion() != nullptr) {
                    // Print "P" for potion
                    out << "P";
                } else if (std::static_pointer_cast<WalkableTile>(*it_j)->getGold() != nullptr) {
                    // Print "G" for gold
                    out << "G";
                } else {
                    // Not occupied, print type
                    out << (std::static_pointer_cast<WalkableTile>(*it_j)->getType());
                }

            } else {
                // Regular Tile, print type
                out << (*it_j)->getType();
            }

        } // End of inner loop

        // Print new line
        out << std::endl;

    } // End of outer loop


    // Print status

    // Print Status format
    // Race: XXXXX  Gold: XXX             Floor: XX
    // HP: XXX
    // Atk: XXX
    // Def: XXX
    // Action:

    // Race: XXXXX  Gold: XXX             Floor: XX
    // 24 chars Race + Gold & 9 Chars for Floor: XX
    out << "Race: " << std::left << std::setw(7) << board.playerPtr->getRace() << "  Gold: " << std::setw(3) << board.playerPtr->getGold() << std::right << std::setw(board.floors[board.floorNum -1][1].size() - 33) << "Floor: " << std::setw(2) << board.floorNum << std::endl; 
    // HP: XXX
    out << "HP: " << board.playerPtr->getHP() << std::endl;
    // Atk: XXX
    out << "Atk: " << board.playerPtr->getAtk() << std::endl;
    // Def: XXX
    out << "Def: " << board.playerPtr->getDef() << std::endl;
    // Action:
    out << "Action: " << action << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, 0x30(%rsp)
movq %rdx, %r14
movq %rsi, %rbx
movq %rdx, %rdi
callq 0xeb9c
movq (%r14), %rcx
cltq
leaq (%rax,%rax,2), %rax
movq -0x18(%rcx,%rax,8), %rbp
movq %r14, %rdi
callq 0xeb9c
movq %r14, 0x8(%rsp)
movq (%r14), %rcx
cltq
leaq (%rax,%rax,2), %rax
cmpq -0x10(%rcx,%rax,8), %rbp
je 0x1aa34
leaq 0x10(%rsp), %r12
movq (%rbp), %r14
cmpq 0x8(%rbp), %r14
je 0x1a9e8
movq (%r14), %rdi
testq %rdi, %rdi
je 0x1a659
leaq 0xb71e(%rip), %rsi      # 0x25d60
leaq 0xae4f(%rip), %rdx      # 0x25498
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
sete %r15b
jmp 0x1a65c
movb $0x1, %r15b
testb %r15b, %r15b
je 0x1a665
xorl %edi, %edi
jmp 0x1a683
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x1a683
movq 0xb94b(%rip), %rax      # 0x25fc0
cmpb $0x0, (%rax)
je 0x1a67f
incl 0x8(%rdi)
jmp 0x1a683
lock
incl 0x8(%rdi)
testq %rdi, %rdi
je 0x1a68d
callq 0x78e4
testb %r15b, %r15b
je 0x1a6b7
movq (%r14), %rdi
callq 0x1ad92
movb %al, 0x10(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5260
addq $0x10, %r14
jmp 0x1a629
movq (%r14), %rsi
movq 0x8(%r14), %r13
testq %r13, %r13
je 0x1a6da
movq 0xb8f6(%rip), %rax      # 0x25fc0
cmpb $0x0, (%rax)
je 0x1a6d5
incl 0x8(%r13)
jmp 0x1a6da
lock
incl 0x8(%r13)
movq %r12, %rdi
callq 0x1ae4e
movq 0x10(%rsp), %r15
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1a6f6
callq 0x78e4
testq %r13, %r13
je 0x1a703
movq %r13, %rdi
callq 0x78e4
movq (%r14), %rdi
testq %r15, %r15
je 0x1a737
movq 0x8(%rsp), %rax
cmpq 0xb8(%rax), %rdi
je 0x1a75d
movq (%r14), %rsi
movq 0x8(%r14), %r13
testq %r13, %r13
je 0x1a776
movq 0xb894(%rip), %rax      # 0x25fc0
cmpb $0x0, (%rax)
je 0x1a771
incl 0x8(%r13)
jmp 0x1a776
movq 0x8(%r14), %r13
testq %r13, %r13
je 0x1a89e
movq 0xb875(%rip), %rax      # 0x25fc0
cmpb $0x0, (%rax)
je 0x1a899
incl 0x8(%r13)
jmp 0x1a89e
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x2b40(%rip), %rsi      # 0x1d2ac
jmp 0x1a6a9
lock
incl 0x8(%r13)
leaq 0x38(%rsp), %rdi
callq 0x1ae4e
movq 0x38(%rsp), %rsi
movq (%rsi), %rax
movq %r12, %rdi
callq *(%rax)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1a79c
callq 0x78e4
testq %r13, %r13
je 0x1a7a9
movq %r13, %rdi
callq 0x78e4
movq %r12, %rdi
leaq 0x2605(%rip), %rsi      # 0x1cdb8
callq 0x50a0
leaq 0x2ad2(%rip), %rsi      # 0x1d291
testl %eax, %eax
je 0x1a867
movq %r12, %rdi
leaq 0x289f(%rip), %rsi      # 0x1d070
callq 0x50a0
leaq 0x2ad1(%rip), %rsi      # 0x1d2ae
testl %eax, %eax
je 0x1a867
movq %r12, %rdi
leaq 0x28a1(%rip), %rsi      # 0x1d090
callq 0x50a0
leaq 0x2ab5(%rip), %rsi      # 0x1d2b0
testl %eax, %eax
je 0x1a867
movq %r12, %rdi
leaq 0x28f7(%rip), %rsi      # 0x1d100
callq 0x50a0
leaq 0x2a9d(%rip), %rsi      # 0x1d2b2
testl %eax, %eax
je 0x1a867
movq %r12, %rdi
leaq 0x25b4(%rip), %rsi      # 0x1cdd7
callq 0x50a0
leaq 0x2a85(%rip), %rsi      # 0x1d2b4
testl %eax, %eax
je 0x1a867
movq %r12, %rdi
leaq 0x2564(%rip), %rsi      # 0x1cda1
callq 0x50a0
leaq 0x2a38(%rip), %rsi      # 0x1d281
testl %eax, %eax
je 0x1a867
movq %r12, %rdi
leaq 0x2851(%rip), %rsi      # 0x1d0a8
callq 0x50a0
leaq 0x2a53(%rip), %rsi      # 0x1d2b6
testl %eax, %eax
jne 0x1a874
movl $0x1, %edx
movq %rbx, %rdi
callq 0x5260
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1a6ae
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
jmp 0x1a6ae
lock
incl 0x8(%r13)
callq 0x1af0e
movl %eax, %r15d
testq %r13, %r13
je 0x1a8b3
movq %r13, %rdi
callq 0x78e4
testb %r15b, %r15b
je 0x1a8cc
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x29f1(%rip), %rsi      # 0x1d2b8
jmp 0x1a6a9
movq (%r14), %rsi
movq 0x8(%r14), %r13
testq %r13, %r13
je 0x1a8ef
movq 0xb6e1(%rip), %rax      # 0x25fc0
cmpb $0x0, (%rax)
je 0x1a8ea
incl 0x8(%r13)
jmp 0x1a8ef
lock
incl 0x8(%r13)
movq %r12, %rdi
callq 0x1ae8e
movq 0x10(%rsp), %r15
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1a90b
callq 0x78e4
testq %r13, %r13
je 0x1a918
movq %r13, %rdi
callq 0x78e4
testq %r15, %r15
je 0x1a931
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x298e(%rip), %rsi      # 0x1d2ba
jmp 0x1a6a9
movq (%r14), %rsi
movq 0x8(%r14), %r13
testq %r13, %r13
je 0x1a954
movq 0xb67c(%rip), %rax      # 0x25fc0
cmpb $0x0, (%rax)
je 0x1a94f
incl 0x8(%r13)
jmp 0x1a954
lock
incl 0x8(%r13)
movq %r12, %rdi
callq 0x1aece
movq 0x10(%rsp), %r15
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1a970
callq 0x78e4
testq %r13, %r13
je 0x1a97d
movq %r13, %rdi
callq 0x78e4
testq %r15, %r15
je 0x1a996
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x292b(%rip), %rsi      # 0x1d2bc
jmp 0x1a6a9
movq (%r14), %rdi
movq 0x8(%r14), %r13
testq %r13, %r13
je 0x1a9b9
movq 0xb617(%rip), %rax      # 0x25fc0
cmpb $0x0, (%rax)
je 0x1a9b4
incl 0x8(%r13)
jmp 0x1a9b9
lock
incl 0x8(%r13)
callq 0x1ad92
movb %al, 0x10(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5260
testq %r13, %r13
je 0x1a6ae
movq %r13, %rdi
callq 0x78e4
jmp 0x1a6ae
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x51e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5140
addq $0x18, %rbp
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xeb9c
movq (%r14), %rcx
cltq
leaq (%rax,%rax,2), %rax
cmpq -0x10(%rcx,%rax,8), %rbp
jne 0x1a625
leaq 0x2883(%rip), %rsi      # 0x1d2be
movl $0x6, %edx
movq %rbx, %rdi
callq 0x5260
movq (%rbx), %rax
movq -0x18(%rax), %rcx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl 0x18(%rbx,%rcx), %edx
orl $0x20, %edx
movl %edx, 0x18(%rbx,%rcx)
movq -0x18(%rax), %rax
movq $0x7, 0x10(%rbx,%rax)
movq 0x8(%rsp), %rax
movq 0xf8(%rax), %rsi
movq (%rsi), %rax
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq *(%rax)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x5260
movq %rax, %r14
leaq 0x2827(%rip), %rsi      # 0x1d2c5
movl $0x8, %edx
movq %rax, %rdi
callq 0x5260
movq (%r14), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x10(%r14,%rax)
movq 0x8(%rsp), %rax
movq 0xf8(%rax), %rdi
callq 0x192c0
movq %r14, %rdi
movl %eax, %esi
callq 0x5380
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rcx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl 0x18(%r14,%rcx), %edx
orl $0x80, %edx
movl %edx, 0x18(%r14,%rcx)
movq 0x8(%rsp), %rdx
movslq 0x108(%rdx), %rcx
movq (%rdx), %rdx
leaq (%rcx,%rcx,2), %rcx
movq -0x18(%rdx,%rcx,8), %rcx
movq 0x20(%rcx), %rdx
subq 0x18(%rcx), %rdx
movq -0x18(%rax), %rax
shlq $0x1c, %rdx
movabsq $-0x2100000000, %rcx    # imm = 0xFFFFFFDF00000000
addq %rdx, %rcx
sarq $0x20, %rcx
movq %rcx, 0x10(%r14,%rax)
leaq 0x2794(%rip), %rsi      # 0x1d2ce
movl $0x7, %edx
movq %r14, %rdi
callq 0x5260
movq (%r14), %rax
movq -0x18(%rax), %rax
movq $0x2, 0x10(%r14,%rax)
movq 0x8(%rsp), %rax
movl 0x108(%rax), %esi
movq %r14, %rdi
callq 0x5380
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x51e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5140
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1abaf
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
leaq 0x2720(%rip), %rsi      # 0x1d2d6
movl $0x4, %edx
movq %rbx, %rdi
callq 0x5260
movq 0x8(%rsp), %r15
movq 0xf8(%r15), %rdi
callq 0x16c1a
movq %rbx, %rdi
callq 0x5320
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x51e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5140
leaq 0x26ce(%rip), %rsi      # 0x1d2db
movl $0x5, %edx
movq %rbx, %rdi
callq 0x5260
movq 0xf8(%r15), %rdi
callq 0x16c20
movq %rbx, %rdi
callq 0x5320
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x51e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5140
leaq 0x2682(%rip), %rsi      # 0x1d2e1
movl $0x5, %edx
movq %rbx, %rdi
callq 0x5260
movq 0xf8(%r15), %rdi
callq 0x16c26
movq %rbx, %rdi
callq 0x5320
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x51e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5140
leaq 0x2636(%rip), %rsi      # 0x1d2e7
movl $0x8, %edx
movq %rbx, %rdi
callq 0x5260
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x5260
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x51e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5140
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x1ad2e
jmp 0x1ad58
jmp 0x1ad58
jmp 0x1ad58
jmp 0x1ad58
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1ad68
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
jmp 0x1ad68
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1ad5b
callq 0x78e4
jmp 0x1ad5b
jmp 0x1ad58
movq %rax, %rbx
testq %r13, %r13
je 0x1ad68
movq %r13, %rdi
callq 0x78e4
movq %rbx, %rdi
callq 0x5390