// File: /workspace/github_cpp_makefile_star2_O2/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 %rsi, %r14
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %r12
movaps %xmm0, (%r12)
andq $0x0, 0x10(%r12)
movq %rsi, %rdi
movq %r12, %rsi
callq 0x1737a
movq %r12, %rdi
callq 0xee62
leaq 0x50(%rsp), %r13
xorl %ebp, %ebp
movq %r15, 0x60(%rsp)
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
jne 0x16c21
movq %r13, 0x40(%rsp)
andq $0x0, 0x48(%rsp)
movb $0x0, 0x50(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x5090
movq %r12, %rdi
leaq 0x289a(%rip), %rsi      # 0x19331
callq 0x16d70
testb %al, %al
je 0x16aa7
xorl %ebx, %ebx
jmp 0x16c11
movl %ebp, 0x34(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq %r14, %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x173cc
movq %rbx, %rdi
callq 0xd100
movq 0x40(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x48(%rsp), %r15
xorl %ebp, %ebp
movl $0x0, 0xc(%rsp)
leaq 0x70(%rsp), %r12
cmpq %rbp, %r15
je 0x16bda
movq 0x68(%rsp), %rax
movzbl (%rax,%rbp), %r13d
leaq 0x10(%rsp), %rdi
callq 0x16cd4
movq 0x8(%r14), %rcx
movq %rcx, %rax
subq (%r14), %rax
movq 0x10(%rsp), %rbx
cqto
pushq $0x18
popq %rsi
idivq %rsi
decl %eax
movl %eax, 0x38(%rsp)
movq -0x10(%rcx), %rax
subq -0x18(%rcx), %rax
shrq $0x4, %rax
movl %eax, 0x3c(%rsp)
movq %r12, %rdi
leaq 0x38(%rsp), %rsi
pushq $0x2
popq %rdx
leaq 0xb(%rsp), %rcx
callq 0xce8c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x107fc
movq %r12, %rdi
callq 0xd484
cmpl $0x20, %r13d
je 0x16ba9
cmpl $0x23, %r13d
je 0x16ba5
cmpl $0x2b, %r13d
je 0x16b8b
cmpl $0x2d, %r13d
je 0x16b93
cmpl $0x5c, %r13d
je 0x16b8f
xorl %esi, %esi
cmpl $0x7c, %r13d
je 0x16bac
pushq $0x1
jmp 0x16bab
pushq $0x2
jmp 0x16bab
pushq $0x4
jmp 0x16bab
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x107f4
incl 0xc(%rsp)
jmp 0x16bb6
pushq $0x3
jmp 0x16bab
pushq $0x5
popq %rsi
movq 0x10(%rsp), %rdi
callq 0x107f4
movq 0x8(%r14), %rdi
addq $-0x18, %rdi
leaq 0x10(%rsp), %rsi
callq 0x175de
leaq 0x18(%rsp), %rdi
callq 0xd24a
incq %rbp
jmp 0x16aef
movl 0x48(%rsp), %eax
addl $-0x2, %eax
movl 0x34(%rsp), %edx
testb $0x1, %dl
sete %cl
movzbl %dl, %edx
movl %edx, %ebp
pushq $0x1
popq %rsi
cmovel %esi, %ebp
cmpl %eax, 0xc(%rsp)
setne %bl
cmovnel %edx, %ebp
orb %cl, %bl
movq 0x60(%rsp), %r15
leaq 0x40(%rsp), %r12
leaq 0x50(%rsp), %r13
movq %r12, %rdi
callq 0x5428
testb %bl, %bl
jne 0x16a5f
movq (%r14), %rcx
movq 0x8(%r14), %rax
subq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
leaq 0x10(%rsp), %rsi
movl %eax, (%rsi)
movq 0x8(%rcx), %rax
subq (%rcx), %rax
shrq $0x4, %rax
movl %eax, 0x4(%rsi)
leaq 0x40(%rsp), %rbx
pushq $0x2
popq %rdx
leaq 0x38(%rsp), %rcx
movq %rbx, %rdi
callq 0xce8c
leaq 0x20(%r14), %rdi
movq %rbx, %rsi
callq 0xd56a
movq %rbx, %rdi
callq 0xd484
movq %r14, %rdi
callq 0x1603c
movq %r15, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xd100
jmp 0x16cc2
jmp 0x16cb0
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xd484
jmp 0x16cb8
jmp 0x16cb5
movq %rax, %rbx
jmp 0x16cc2
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xd24a
leaq 0x40(%rsp), %rdi
callq 0x5428
movq %rbx, %rdi
callq 0x53c0