// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/race/parsing.cc
// Function: grid_t::dump(std::ostream&, bool) const
void grid_t::dump(ostream &os, bool postscript) const {
    if( postscript ) ps::header(os, rows_, cols_);

    for( size_t y = 0; y < (size_t)rows_; ++y ) {
        for( size_t x = 0; x < (size_t)cols_; ++x ) {
            switch( map_[y*cols_ + x] ) {
                case Valid:
                    if( postscript )
                        ps::draw_filled_rectangle(os, x*BOXW, (rows_-1-y)*BOXW, BOXW, BOXW, 255, 255, 255);
                    else
                        os << '.';
                    break;
                case (Valid | Start):
                    if( postscript )
                        ps::draw_filled_rectangle(os, x*BOXW, (rows_-1-y)*BOXW, BOXW, BOXW, 0, 255, 255);
                    else
                        os << 's';
                    break;
                case (Valid | Goal):
                    if( postscript )
                        ps::draw_filled_rectangle(os, x*BOXW, (rows_-1-y)*BOXW, BOXW, BOXW, 255, 0, 0);
                    else
                        os << 'g';
                    break;
                default:
                    if( !postscript ) os << 'x';
                    break;
            }

#if 0
            if( postscript ) {
                // draw outer thick frame
                if( map_[y*cols_+x] & Valid ) {
                    if( (c == 0) || !(gridMap[r*cols + c - 1] & VALID) ) psDrawThickLine(x,(rows-1)*BOXW-y,0,BOXW);
                    if( c == cols - 1 ) psDrawThickLine(x+BOXW,(rows-1)*BOXW-y,0,BOXW);
                    if( (r == 0) || !(gridMap[(r-1)*cols + c] & VALID) ) psDrawThickLine(x-0.5,(rows-1)*BOXW-y+BOXW,BOXW+1,0);
                    if( r == rows - 1 ) psDrawThickLine(x-0.5,(rows-1)*BOXW-y,BOXW+1,0);
                } else {
                    if( (c != 0) && (gridMap[r*cols + c - 1] & VALID) ) psDrawThickLine(x,(rows-1)*BOXW-y,0,BOXW);
                    if( (r != 0) && (gridMap[(r-1)*cols + c] & VALID) ) psDrawThickLine(x-0.5,(rows-1)*BOXW-y+BOXW,BOXW+1,0);
                }
            }
#endif
        }
        if( !postscript ) os << endl;
    }

    if( postscript ) {
        ps::trailer(os);
    } else {
        os << "Valid positions = { ";
        for( size_t x = 0; x < (size_t)cols_; ++x ) {
            for( size_t y = 0; y < (size_t)rows_; ++y )
                if( valid_pos(x, y) ) os << "(" << x << "," << y << ") ";
        }
        os << "}" << endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testl %edx, %edx
je 0x1cb97
movslq 0x10(%r14), %rsi
movslq 0x14(%r14), %rdx
movq %rbx, %rdi
callq 0x1c480
xorl %r13d, %r13d
movslq 0x10(%r14), %rax
cmpq %rax, %r13
jae 0x1cca4
movl %r13d, %eax
notl %eax
movl %eax, 0x4(%rsp)
xorl %r12d, %r12d
xorl %r15d, %r15d
movslq 0x14(%r14), %rax
cmpq %rax, %r15
jae 0x1cc8f
imulq %r13, %rax
addq 0x8(%r14), %rax
movzbl (%r15,%rax), %eax
cmpl $0x5, %eax
je 0x1cc2f
cmpl $0x3, %eax
je 0x1cc07
cmpl $0x1, %eax
jne 0x1cc5e
testb %bpl, %bpl
je 0x1cc78
movl 0x10(%r14), %eax
addl 0x4(%rsp), %eax
imull $0xa, %eax, %edx
movq %rbx, %rdi
movl %r12d, %esi
pushq $0xa
popq %rcx
movl %ecx, %r8d
movl $0xff, %r9d
jmp 0x1cc26
testb %bpl, %bpl
je 0x1cc6a
movl 0x10(%r14), %eax
addl 0x4(%rsp), %eax
imull $0xa, %eax, %edx
movq %rbx, %rdi
movl %r12d, %esi
pushq $0xa
popq %rcx
movl %ecx, %r8d
xorl %r9d, %r9d
movl $0xff, %eax
pushq %rax
pushq %rax
jmp 0x1cc55
testb %bpl, %bpl
je 0x1cc71
movl 0x10(%r14), %eax
addl 0x4(%rsp), %eax
imull $0xa, %eax, %edx
movq %rbx, %rdi
movl %r12d, %esi
pushq $0xa
popq %rcx
movl %ecx, %r8d
movl $0xff, %r9d
pushq $0x0
pushq $0x0
callq 0x1c5d6
popq %rax
popq %rcx
jmp 0x1cc83
testb %bpl, %bpl
jne 0x1cc83
movq %rbx, %rdi
pushq $0x78
jmp 0x1cc7d
movq %rbx, %rdi
pushq $0x73
jmp 0x1cc7d
movq %rbx, %rdi
pushq $0x67
jmp 0x1cc7d
movq %rbx, %rdi
pushq $0x2e
popq %rsi
callq 0x52e0
incq %r15
addl $0xa, %r12d
jmp 0x1cbb6
testb %bpl, %bpl
jne 0x1cc9c
movq %rbx, %rdi
callq 0x5100
incq %r13
jmp 0x1cb9a
testb %bpl, %bpl
je 0x1ccbf
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1c5c0
leaq 0x41a2(%rip), %rsi      # 0x20e68
movq %rbx, %rdi
callq 0x5270
xorl %r15d, %r15d
leaq 0xf69(%rip), %r13       # 0x1dc41
leaq 0x419e(%rip), %rbp      # 0x20e7d
movslq 0x14(%r14), %rax
cmpq %rax, %r15
jae 0x1cd4b
xorl %r12d, %r12d
movslq 0x10(%r14), %rax
cmpq %rax, %r12
jae 0x1cd46
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x81a4
testb %al, %al
je 0x1cd41
movq %rbx, %rdi
leaq 0x112f(%rip), %rsi      # 0x1de3f
callq 0x5270
movq %rax, %rdi
movq %r15, %rsi
callq 0x5180
movq %rax, %rdi
movq %r13, %rsi
callq 0x5270
movq %rax, %rdi
movq %r12, %rsi
callq 0x5180
movq %rax, %rdi
movq %rbp, %rsi
callq 0x5270
incq %r12
jmp 0x1cceb
incq %r15
jmp 0x1ccdf
leaq 0x412e(%rip), %rsi      # 0x20e80
movq %rbx, %rdi
callq 0x5270
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5100