// File: /workspace/github_cpp_makefile_star2_O1/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 0x2797f
movslq 0x10(%r14), %rsi
movslq 0x14(%r14), %rdx
movq %rbx, %rdi
callq 0x26e04
cmpl $0x0, 0x10(%r14)
je 0x27b02
xorl %r13d, %r13d
movslq 0x14(%r14), %rax
testq %rax, %rax
je 0x27ac6
movl %r13d, %ecx
notl %ecx
movl %ecx, 0x4(%rsp)
xorl %r12d, %r12d
xorl %r15d, %r15d
imulq %r13, %rax
addq 0x8(%r14), %rax
movzbl (%r15,%rax), %eax
cmpl $0x5, %eax
je 0x27a25
cmpl $0x3, %eax
je 0x279f8
cmpl $0x1, %eax
jne 0x27a5d
testb %bpl, %bpl
je 0x27a9e
movl 0x10(%r14), %eax
addl 0x4(%rsp), %eax
addl %eax, %eax
leal (%rax,%rax,4), %edx
movq %rbx, %rdi
movl %r12d, %esi
movl $0xa, %ecx
movl $0xa, %r8d
movl $0xff, %r9d
jmp 0x27a1e
testb %bpl, %bpl
je 0x27a76
movl 0x10(%r14), %eax
addl 0x4(%rsp), %eax
addl %eax, %eax
leal (%rax,%rax,4), %edx
movq %rbx, %rdi
movl %r12d, %esi
movl $0xa, %ecx
movl $0xa, %r8d
xorl %r9d, %r9d
movl $0xff, %eax
jmp 0x27a50
testb %bpl, %bpl
je 0x27a8a
movl 0x10(%r14), %eax
addl 0x4(%rsp), %eax
addl %eax, %eax
leal (%rax,%rax,4), %edx
movq %rbx, %rdi
movl %r12d, %esi
movl $0xa, %ecx
movl $0xa, %r8d
movl $0xff, %r9d
xorl %eax, %eax
pushq %rax
pushq %rax
callq 0x27105
addq $0x10, %rsp
jmp 0x27ab2
testb %bpl, %bpl
jne 0x27ab2
movb $0x78, 0x3(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x3(%rsp), %rsi
jmp 0x27aad
movb $0x73, 0x1(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x1(%rsp), %rsi
jmp 0x27aad
movb $0x67, 0x2(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x2(%rsp), %rsi
jmp 0x27aad
movb $0x2e, (%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %rsp, %rsi
callq 0x62d0
incq %r15
movslq 0x14(%r14), %rax
addl $0xa, %r12d
cmpq %rax, %r15
jb 0x279a9
testb %bpl, %bpl
jne 0x27af2
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61b0
incq %r13
movslq 0x10(%r14), %rax
cmpq %rax, %r13
jb 0x2798d
testb %bpl, %bpl
je 0x27b14
movq %rbx, %rdi
callq 0x270c8
jmp 0x27c27
leaq 0x43ad(%rip), %rsi      # 0x2bec8
movl $0x14, %edx
movq %rbx, %rdi
callq 0x62d0
cmpl $0x0, 0x14(%r14)
je 0x27bec
xorl %r15d, %r15d
leaq 0x43a0(%rip), %rbp      # 0x2bedd
movl 0x10(%r14), %eax
testl %eax, %eax
je 0x27bdc
xorl %r12d, %r12d
testl %r15d, %r15d
js 0x27bcc
cmpl %r15d, %eax
setle %al
testl %r12d, %r12d
sets %cl
orb %al, %cl
jne 0x27bcc
movl 0x14(%r14), %eax
cmpl %r12d, %eax
jle 0x27bcc
movq 0x8(%r14), %rcx
imull %r15d, %eax
addl %r12d, %eax
testb $0x1, (%rcx,%rax)
je 0x27bcc
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x130b(%rip), %rsi      # 0x28e95
callq 0x62d0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x61a0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10ad(%rip), %rsi      # 0x28c59
callq 0x62d0
movq %r13, %rdi
movq %r12, %rsi
callq 0x61a0
movl $0x2, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x62d0
incq %r12
movslq 0x10(%r14), %rax
cmpq %rax, %r12
jb 0x27b4c
incq %r15
movslq 0x14(%r14), %rax
cmpq %rax, %r15
jb 0x27b3d
leaq 0x42ed(%rip), %rsi      # 0x2bee0
movl $0x1, %edx
movq %rbx, %rdi
callq 0x62d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61b0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq