// File: /workspace/github_cpp_makefile_star2_O3/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 $0x98, %rsp
movq %rdi, %r15
movq 0x10(%rsi), %rax
movups (%rsi), %xmm0
xorps %xmm1, %xmm1
movups %xmm1, (%rsi)
xorl %r12d, %r12d
movq %rsi, 0x10(%rsp)
movq %r12, 0x10(%rsi)
leaq 0x20(%rsp), %r13
movaps %xmm0, (%r13)
movq %rax, 0x10(%r13)
leaq 0x40(%rsp), %rbp
movaps %xmm1, (%rbp)
movq %r12, 0x10(%rbp)
movq %r13, %rdi
callq 0x13b7c
movq %rbp, %rdi
callq 0x13b7c
movq %r15, 0x60(%rsp)
movq (%r15), %rax
movq -0x18(%rax), %rcx
testb $0x2, 0x20(%r15,%rcx)
jne 0x1de8c
leaq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x5260
movsbl %al, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x5410
movq %r13, %rdi
leaq 0x262e(%rip), %rsi      # 0x202b1
callq 0x50f0
testl %eax, %eax
je 0x1de3b
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x1e560
movq %rbp, %rdi
callq 0x12220
movq 0x28(%rsp), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x1de3f
movq %r12, 0x68(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x70(%rsp)
xorl %r15d, %r15d
movl $0x0, 0x1c(%rsp)
leaq 0x80(%rsp), %r14
movq 0x70(%rsp), %rax
movzbl (%rax,%r15), %r12d
movq $0x0, 0x40(%rsp)
leaq 0x48(%rsp), %rdi
movq %rbp, %rsi
leaq 0x58(%rsp), %rbx
movq %rbx, %rdx
callq 0x1e09e
movq 0x40(%rsp), %r13
movq 0x10(%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, 0x58(%rsp)
movq -0x10(%rax), %rcx
subq -0x18(%rax), %rcx
shrq $0x4, %rcx
movl %ecx, 0x5c(%rsp)
movl $0x2, %edx
movq %r14, %rdi
movq %rbx, %rsi
leaq 0xf(%rsp), %rcx
callq 0x12064
movq %r13, %rdi
movq %r14, %rsi
callq 0x14ec6
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1dd84
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
cmpl $0x2c, %r12d
jg 0x1dda3
cmpl $0x20, %r12d
je 0x1ddbe
cmpl $0x23, %r12d
je 0x1ddd7
cmpl $0x2b, %r12d
jne 0x1ddb7
movl $0x2, %esi
jmp 0x1dde3
cmpl $0x2d, %r12d
je 0x1ddc5
cmpl $0x5c, %r12d
je 0x1ddde
xorl %esi, %esi
cmpl $0x7c, %r12d
je 0x1dde3
movl $0x1, %esi
jmp 0x1dde3
movl $0x5, %esi
jmp 0x1dde3
movq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0x14ebe
incl 0x1c(%rsp)
jmp 0x1dded
movl $0x3, %esi
jmp 0x1dde3
movl $0x4, %esi
movq 0x40(%rsp), %rdi
callq 0x14ebe
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
addq $-0x18, %rdi
movq %rbp, %rsi
callq 0x1e788
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1de11
callq 0x1235a
incq %r15
cmpq %r15, 0x78(%rsp)
jne 0x1dceb
movl 0x28(%rsp), %eax
addl $-0x2, %eax
movq 0x60(%rsp), %r15
movq 0x68(%rsp), %r12
leaq 0x20(%rsp), %r13
movl 0x1c(%rsp), %edi
jmp 0x1de46
xorl %ebx, %ebx
jmp 0x1de68
xorl %edi, %edi
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testb $0x1, %r12b
sete %cl
movzbl %r12b, %edx
movl %edx, %r12d
movl $0x1, %esi
cmovel %esi, %r12d
cmpl %eax, %edi
setne %bl
cmovnel %edx, %r12d
orb %cl, %bl
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1de84
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5280
testb %bl, %bl
jne 0x1dc2f
movq 0x10(%rsp), %r14
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
leaq 0x40(%rsp), %rsi
movl %ecx, (%rsi)
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x4, %rcx
movl %ecx, 0x4(%rsi)
leaq 0x20(%rsp), %rbx
leaq 0x58(%rsp), %rcx
movl $0x2, %edx
movq %rbx, %rdi
callq 0x12064
movq 0x20(%r14), %rdi
movq 0x30(%r14), %rsi
movaps (%rbx), %xmm0
movups %xmm0, 0x20(%r14)
movq 0x10(%rbx), %rax
movq %rax, 0x30(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
testq %rdi, %rdi
je 0x1df1b
subq %rdi, %rsi
callq 0x5280
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1df1b
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x10(%rsp), %rdi
callq 0x1cd0c
movq %r15, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x12220
jmp 0x1df86
jmp 0x1df6f
jmp 0x1df74
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1df77
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
jmp 0x1df77
movq %rax, %rbx
jmp 0x1df86
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1df86
callq 0x1235a
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1dfa2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5280
movq %rbx, %rdi
callq 0x53e0