// File: /workspace/github_cpp_makefile_star2_O1/XxAdi101xX[P]ChamberCrawler/Floor/Floor.cc
// Function: operator>>(std::istream&, Floor&)
std::istream &operator>>(std::istream &in, Floor &f) {

    f.theFloor = std::vector<std::vector<std::shared_ptr<Cell>>>();

    bool endFloor = false;

    while (!in.eof()) {
        std::string row;
        std::getline(in, row);
        if (row == "") break;

        f.theFloor.push_back(std::vector<std::shared_ptr<Cell>>());
        int horizontalWallCount = 0;
        for (auto r: row) {
            std::shared_ptr<Cell> cell = std::make_shared<Cell>();
            cell->setCoords(std::vector<int>{static_cast<int>(f.theFloor.size()) - 1, static_cast<int>(f.theFloor.back().size())});
            switch (r) {
                case '|':
                    cell->setCellType(CellType::Wall);
                    break;
                case '-':
                    horizontalWallCount++;
                    cell->setCellType(CellType::Wall);
                    break;
                case '+':
                    cell->setCellType(CellType::DoorWay);
                    break;
                case '#':
                    cell->setCellType(CellType::Passage);
                    break;
                case ' ':
                    cell->setCellType(CellType::Null);
                    break;
				case '\\':
                    cell->setCellType(CellType::Stairs);
                    break;
                default:
                    cell->setCellType(CellType::FloorTile);
                    break;
            }

            f.theFloor.back().push_back(std::move(cell));
        }

        if (horizontalWallCount == static_cast<int>(row.size()) - 2 && endFloor == false) {
            endFloor = true;
        }
        else if (horizontalWallCount == static_cast<int>(row.size()) - 2 && endFloor == true) {
            break;
        }
    }

    f.floorDimensions = std::vector<int>{static_cast<int>(f.theFloor.size()), static_cast<int>(f.theFloor[0].size())};
/*
    for (int i = 0; i < f.floorDimensions[0]; ++i) {
            std::cout << "Size: " << i << " " << f.theFloor[i].size() << endl;
            for (int j = 0; j < f.floorDimensions[1]; ++j) {
                std::cout << f.theFloor[i][j]->getCoords().size() << endl;
                std::cout << f.theFloor[i][j].use_count() << endl;
            }
    }
    */
    f.initialize();

    return in;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r12
movaps %xmm0, (%r12)
xorl %r13d, %r13d
movq %r13, 0x10(%r12)
leaq 0x10(%rsp), %rbp
movq %r13, 0x10(%rbp)
movaps %xmm0, (%rbp)
movq (%rsi), %rax
movups 0x8(%rsi), %xmm0
movq (%r12), %rcx
movq %rcx, (%rsi)
movq 0x8(%r12), %rcx
movq %rcx, 0x8(%rsi)
movq 0x10(%r12), %rcx
movq %rsi, 0x8(%rsp)
movq %rcx, 0x10(%rsi)
movq (%rbp), %rcx
movq 0x8(%rbp), %rdx
movq 0x10(%rbp), %rsi
movq %rax, (%rbp)
movups %xmm0, 0x8(%rbp)
movq %rcx, (%r12)
movq %rdx, 0x8(%r12)
movq %rsi, 0x10(%r12)
movq %rbp, %rdi
callq 0x13bc6
movq %r12, %rdi
callq 0x13bc6
movq %r15, 0x50(%rsp)
movq (%r15), %rax
movq -0x18(%rax), %rcx
testb $0x2, 0x20(%r15,%rcx)
jne 0x1e01c
leaq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x5260
movsbl %al, %edx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x5410
movq %rbp, %rdi
leaq 0x2499(%rip), %rsi      # 0x202b1
callq 0x50f0
testl %eax, %eax
je 0x1dfb6
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x1e6ca
movq %r13, 0x58(%rsp)
movq %r12, %rdi
callq 0x1212c
movq 0x18(%rsp), %rax
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0x1dfba
movq 0x10(%rsp), %rax
movq %rax, 0x60(%rsp)
xorl %ebp, %ebp
movl $0x0, (%rsp)
leaq 0x70(%rsp), %r14
movq %r12, %rsi
movq 0x60(%rsp), %rax
movzbl (%rax,%rbp), %r12d
movq $0x0, 0x30(%rsp)
leaq 0x38(%rsp), %rdi
movq %rsi, %r15
leaq 0x48(%rsp), %rbx
movq %rbx, %rdx
callq 0x1e202
movq 0x30(%rsp), %r13
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rax
movq %rax, %rcx
subq (%rdx), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
decl %ecx
movl %ecx, 0x48(%rsp)
movq -0x10(%rax), %rcx
subq -0x18(%rax), %rcx
shrq $0x4, %rcx
movl %ecx, 0x4c(%rsp)
movl $0x2, %edx
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x7(%rsp), %rcx
callq 0x11f84
movq %r13, %rdi
movq %r14, %rsi
callq 0x14dae
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x1df14
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
cmpl $0x2c, %r12d
jg 0x1df33
cmpl $0x20, %r12d
je 0x1df4e
cmpl $0x23, %r12d
je 0x1df69
cmpl $0x2b, %r12d
jne 0x1df47
movl $0x2, %esi
jmp 0x1df75
cmpl $0x2d, %r12d
je 0x1df55
cmpl $0x5c, %r12d
je 0x1df70
xorl %esi, %esi
cmpl $0x7c, %r12d
je 0x1df75
movl $0x1, %esi
jmp 0x1df75
movl $0x5, %esi
jmp 0x1df75
movq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x14da6
movq %r15, %r12
incl (%rsp)
jmp 0x1df82
movl $0x3, %esi
jmp 0x1df75
movl $0x4, %esi
movq 0x30(%rsp), %rdi
callq 0x14da6
movq %r15, %r12
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
addq $-0x18, %rdi
movq %r12, %rsi
callq 0x1e908
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x1dfa6
callq 0x12250
incq %rbp
cmpq %rbp, 0x68(%rsp)
jne 0x1de7b
jmp 0x1dfc1
xorl %ebx, %ebx
jmp 0x1dff8
movl $0x0, (%rsp)
movl 0x18(%rsp), %eax
addl $-0x2, %eax
movq 0x58(%rsp), %rdx
testb $0x1, %dl
sete %cl
movzbl %dl, %edx
movl %edx, %r13d
movl $0x1, %esi
cmovel %esi, %r13d
cmpl %eax, (%rsp)
setne %bl
cmovnel %edx, %r13d
orb %cl, %bl
movq 0x50(%rsp), %r15
leaq 0x10(%rsp), %rbp
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1e014
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5280
testb %bl, %bl
jne 0x1ddc4
movq 0x8(%rsp), %r14
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
leaq 0x30(%rsp), %rsi
movl %ecx, (%rsi)
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x4, %rcx
movl %ecx, 0x4(%rsi)
leaq 0x10(%rsp), %rbx
leaq 0x48(%rsp), %rcx
movl $0x2, %edx
movq %rbx, %rdi
callq 0x11f84
leaq 0x20(%r14), %rdi
movq %rbx, %rsi
callq 0x1243c
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1e082
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x8(%rsp), %rdi
callq 0x1cdbc
movq %r15, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x1212c
jmp 0x1e0ea
jmp 0x1e0d3
jmp 0x1e0d8
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x1e0db
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
jmp 0x1e0db
movq %rax, %rbx
jmp 0x1e0ea
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x1e0ea
callq 0x12250
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1e106
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5280
movq %rbx, %rdi
callq 0x53e0