// File: /workspace/github_cpp_makefile_star2_O3/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 0xe848
movq (%r14), %rcx
cltq
leaq (%rax,%rax,2), %rax
movq -0x18(%rcx,%rax,8), %r13
movq %r14, %rdi
callq 0xe848
movq %r14, (%rsp)
movq (%r14), %rcx
cltq
leaq (%rax,%rax,2), %rax
cmpq -0x10(%rcx,%rax,8), %r13
je 0x1a56d
leaq 0x10(%rsp), %r12
movq %rbx, 0x8(%rsp)
movq (%r13), %rbp
cmpq 0x8(%r13), %rbp
je 0x1a522
movq (%rbp), %r14
testq %r14, %r14
je 0x1a1a3
movq %r14, %rdi
leaq 0xabea(%rip), %rsi      # 0x24d60
leaq 0xa31b(%rip), %rdx      # 0x24498
xorl %ecx, %ecx
callq 0x5230
testq %rax, %rax
je 0x1a1a3
movq 0x8(%rbp), %rdi
testq %rdi, %rdi
je 0x1a1ed
movq 0xae27(%rip), %rax      # 0x24fc0
cmpb $0x0, (%rax)
je 0x1a1c5
incl 0x8(%rdi)
jmp 0x1a1c9
movq %r14, %rdi
callq 0x1a8d2
movb %al, 0x10(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5250
addq $0x10, %rbp
jmp 0x1a159
lock
incl 0x8(%rdi)
callq 0x7828
movq (%rbp), %r14
movq 0x8(%rbp), %r15
testq %r15, %r15
je 0x1a1ed
movq 0xadde(%rip), %rax      # 0x24fc0
cmpb $0x0, (%rax)
je 0x1a1f4
incl 0x8(%r15)
jmp 0x1a1f9
movb $0x1, %bl
xorl %r15d, %r15d
jmp 0x1a1fb
lock
incl 0x8(%r15)
xorl %ebx, %ebx
movq %r12, %rdi
movq %r14, %rsi
callq 0x1a98e
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1a21a
callq 0x7828
testb %bl, %bl
jne 0x1a226
movq %r15, %rdi
callq 0x7828
movq (%rbp), %rsi
testq %r14, %r14
movq 0x8(%rsp), %rbx
je 0x1a25c
movq (%rsp), %rax
cmpq 0xb8(%rax), %rsi
je 0x1a282
movq 0x8(%rbp), %r14
testq %r14, %r14
je 0x1a29b
movq 0xad6f(%rip), %rax      # 0x24fc0
cmpb $0x0, (%rax)
je 0x1a296
incl 0x8(%r14)
jmp 0x1a29b
movq 0x8(%rbp), %r14
testq %r14, %r14
je 0x1a3c3
movq 0xad50(%rip), %rax      # 0x24fc0
cmpb $0x0, (%rax)
je 0x1a3be
incl 0x8(%r14)
jmp 0x1a3c3
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x205b(%rip), %rsi      # 0x1c2ec
jmp 0x1a1ba
lock
incl 0x8(%r14)
leaq 0x38(%rsp), %rdi
callq 0x1a98e
movq 0x38(%rsp), %rsi
movq (%rsi), %rax
movq %r12, %rdi
callq *(%rax)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1a2c1
callq 0x7828
testq %r14, %r14
je 0x1a2ce
movq %r14, %rdi
callq 0x7828
movq %r12, %rdi
leaq 0x1b20(%rip), %rsi      # 0x1bdf8
callq 0x50a0
leaq 0x1fed(%rip), %rsi      # 0x1c2d1
testl %eax, %eax
je 0x1a38c
movq %r12, %rdi
leaq 0x1dba(%rip), %rsi      # 0x1c0b0
callq 0x50a0
leaq 0x1fec(%rip), %rsi      # 0x1c2ee
testl %eax, %eax
je 0x1a38c
movq %r12, %rdi
leaq 0x1dbc(%rip), %rsi      # 0x1c0d0
callq 0x50a0
leaq 0x1fd0(%rip), %rsi      # 0x1c2f0
testl %eax, %eax
je 0x1a38c
movq %r12, %rdi
leaq 0x1e12(%rip), %rsi      # 0x1c140
callq 0x50a0
leaq 0x1fb8(%rip), %rsi      # 0x1c2f2
testl %eax, %eax
je 0x1a38c
movq %r12, %rdi
leaq 0x1acf(%rip), %rsi      # 0x1be17
callq 0x50a0
leaq 0x1fa0(%rip), %rsi      # 0x1c2f4
testl %eax, %eax
je 0x1a38c
movq %r12, %rdi
leaq 0x1a7f(%rip), %rsi      # 0x1bde1
callq 0x50a0
leaq 0x1f53(%rip), %rsi      # 0x1c2c1
testl %eax, %eax
je 0x1a38c
movq %r12, %rdi
leaq 0x1d6c(%rip), %rsi      # 0x1c0e8
callq 0x50a0
leaq 0x1f6e(%rip), %rsi      # 0x1c2f6
testl %eax, %eax
jne 0x1a399
movl $0x1, %edx
movq %rbx, %rdi
callq 0x5250
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1a1bf
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x51f0
jmp 0x1a1bf
lock
incl 0x8(%r14)
movq %rsi, %rdi
callq 0x1aa4e
movl %eax, %r15d
testq %r14, %r14
je 0x1a3db
movq %r14, %rdi
callq 0x7828
testb %r15b, %r15b
je 0x1a3f4
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x1f09(%rip), %rsi      # 0x1c2f8
jmp 0x1a1ba
movq (%rbp), %rsi
movq 0x8(%rbp), %r14
testq %r14, %r14
je 0x1a418
movq 0xabb8(%rip), %rax      # 0x24fc0
cmpb $0x0, (%rax)
je 0x1a413
incl 0x8(%r14)
jmp 0x1a418
lock
incl 0x8(%r14)
movq %r12, %rdi
callq 0x1a9ce
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1a434
callq 0x7828
testq %r14, %r14
je 0x1a441
movq %r14, %rdi
callq 0x7828
testq %rbx, %rbx
je 0x1a45f
movl $0x1, %edx
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x1ea0(%rip), %rsi      # 0x1c2fa
jmp 0x1a1ba
movq (%rbp), %rsi
movq 0x8(%rbp), %r14
testq %r14, %r14
je 0x1a483
movq 0xab4d(%rip), %rax      # 0x24fc0
cmpb $0x0, (%rax)
je 0x1a47e
incl 0x8(%r14)
jmp 0x1a483
lock
incl 0x8(%r14)
movq %r12, %rdi
callq 0x1aa0e
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1a49f
callq 0x7828
testq %r14, %r14
je 0x1a4ac
movq %r14, %rdi
callq 0x7828
testq %rbx, %rbx
je 0x1a4ca
movl $0x1, %edx
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x1e37(%rip), %rsi      # 0x1c2fc
jmp 0x1a1ba
movq (%rbp), %rdi
movq 0x8(%rbp), %r14
testq %r14, %r14
movq 0x8(%rsp), %rbx
je 0x1a4f3
movq 0xaadd(%rip), %rax      # 0x24fc0
cmpb $0x0, (%rax)
je 0x1a4ee
incl 0x8(%r14)
jmp 0x1a4f3
lock
incl 0x8(%r14)
callq 0x1a8d2
movb %al, 0x10(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5250
testq %r14, %r14
je 0x1a1bf
movq %r14, %rdi
callq 0x7828
jmp 0x1a1bf
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x51d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5140
addq $0x18, %r13
movq (%rsp), %r14
movq %r14, %rdi
callq 0xe848
movq (%r14), %rcx
cltq
leaq (%rax,%rax,2), %rax
cmpq -0x10(%rcx,%rax,8), %r13
jne 0x1a155
leaq 0x1d8a(%rip), %rsi      # 0x1c2fe
movl $0x6, %edx
movq %rbx, %rdi
callq 0x5250
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 (%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 0x5250
movq %rax, %r14
leaq 0x1d2f(%rip), %rsi      # 0x1c305
movl $0x8, %edx
movq %rax, %rdi
callq 0x5250
movq (%r14), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x10(%r14,%rax)
movq (%rsp), %rax
movq 0xf8(%rax), %rdi
callq 0x18df8
movq %r14, %rdi
movl %eax, %esi
callq 0x5370
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 (%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 0x1c9e(%rip), %rsi      # 0x1c30e
movl $0x7, %edx
movq %r14, %rdi
callq 0x5250
movq (%r14), %rax
movq -0x18(%rax), %rax
movq $0x2, 0x10(%r14,%rax)
movq (%rsp), %rax
movl 0x108(%rax), %esi
movq %r14, %rdi
callq 0x5370
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x51d0
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 0x1a6e4
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x51f0
leaq 0x1c2b(%rip), %rsi      # 0x1c316
movl $0x4, %edx
movq %rbx, %rdi
callq 0x5250
movq (%rsp), %r15
movq 0xf8(%r15), %rdi
callq 0x167e2
movq %rbx, %rdi
callq 0x5310
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x51d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5140
leaq 0x1bda(%rip), %rsi      # 0x1c31b
movl $0x5, %edx
movq %rbx, %rdi
callq 0x5250
movq 0xf8(%r15), %rdi
callq 0x167e8
movq %rbx, %rdi
callq 0x5310
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x51d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5140
leaq 0x1b8e(%rip), %rsi      # 0x1c321
movl $0x5, %edx
movq %rbx, %rdi
callq 0x5250
movq 0xf8(%r15), %rdi
callq 0x167ee
movq %rbx, %rdi
callq 0x5310
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x51d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5140
leaq 0x1b42(%rip), %rsi      # 0x1c327
movl $0x8, %edx
movq %rbx, %rdi
callq 0x5250
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x5250
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x51d0
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
jmp 0x1a876
movq %rax, %r12
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x1a862
jmp 0x1a876
jmp 0x1a876
jmp 0x1a876
movq %rax, %r12
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1a8a6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x51f0
jmp 0x1a8a6
movq %rax, %r12
testq %r14, %r14
je 0x1a8a6
movq %r14, %rdi
jmp 0x1a8a1
movq %rax, %r12
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1a879
callq 0x7828
jmp 0x1a879
movq %rax, %r12
testb %bl, %bl
jne 0x1a8a6
movq %r15, %rdi
callq 0x7828
movq %r12, %rdi
callq 0x5380
nop