// File: /workspace/github_cpp_makefile_star2_O3/bonetblai[P]mdp-engine/race/./parsing.h
// Function: grid_t::valid_path(short, short, short, short, short&, short&) const
int valid_path(short x1, short y1, short x2, short y2, short &ox, short &oy) const {
        assert(valid_pos(x1, y1));
        int rv = 0, ix = 0, lx = 0, iy = 0, ly = 0;

        if( (x1 != x2) && (y1 != y2) ) {
            float m = (float)(y2 - y1) / (float)(x2 - x1);
            float b = (float)(y1*x2 - y2*x1) / (float)(x2 - x1);
            int inc = (x2 - x1 > 0 ? 1 : -1);
            for( float x = x1; (x != x2 + inc) && (rv == 0); x += inc ) {
                float y = m*x + b;
                lx = ix;
                ly = iy;
                ix = (int)x;
                iy = (int)floor(y + 0.5);
                if( !valid_pos(ix, iy) )
                    rv = 1;
                else if( goal_pos(ix, iy) )
                    rv = 2;
            }
        } else if( (x1 != x2) && (y1 == y2) ) {
            ly = iy = (int)y1;
            int inc = (x2 - x1 > 0 ? 1 : -1);
            for( float x = x1; (x != x2 + inc) && (rv == 0); x += inc ) {
                lx = ix;
                ix = (int)x;
                if( !valid_pos(ix, iy) )
                    rv = 1;
                else if( goal_pos(ix, iy) )
                    rv = 2;
            }
        } else if( (x1 == x2) && (y1 != y2) ) {
            lx = ix = (int)x1;
            int inc = (y2 - y1 > 0 ? 1 : -1);
            for( float y = y1; (y != y2 + inc) && (rv == 0); y += inc ) {
                ly = iy;
                iy = (int)y;
                if( !valid_pos(ix, iy) )
                    rv = 1;
                else if( goal_pos(ix, iy) )
                    rv = 2;
            }
        }

        if( rv == 1 ) {
            ox = lx;
            oy = ly;
        } else if( rv == 2 ) {
            ox = ix;
            oy = iy;
        }
        return rv;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebx
testw %bx, %bx
js 0x9934
movl %edx, %ebp
testw %bp, %bp
js 0x9934
movl 0x10(%rdi), %r13d
cmpl %ebx, %r13d
jle 0x9934
movl 0x14(%rdi), %r15d
cmpl %ebp, %r15d
jle 0x9934
movq 0x8(%rdi), %r12
movl %r15d, %edi
imull %ebx, %edi
movl %ebp, %esi
leaq (%rsi,%rdi), %rax
testb $0x1, (%r12,%rax)
je 0x9934
movswl %cx, %eax
cmpw %ax, %bx
sete %dl
cmpw %r8w, %bp
sete %r10b
orb %dl, %r10b
je 0x9733
cmpw %r8w, %bp
setne %dl
cmpw %cx, %bx
sete %r10b
orb %dl, %r10b
jne 0x985b
xorl %edx, %edx
cmpw %bx, %cx
setg %dl
movswl %bx, %ecx
cvtsi2ss %ecx, %xmm0
leal (%rax,%rdx,2), %eax
decl %eax
cvtsi2ss %eax, %xmm1
ucomiss %xmm1, %xmm0
je 0x991c
movq %r9, 0x8(%rsp)
leal -0x1(,%rdx,2), %eax
cvtsi2ss %eax, %xmm2
xorl %r14d, %r14d
movl $0x1, %eax
movl %r14d, %ebx
cvttss2si %xmm0, %r14d
testl %r14d, %r14d
js 0x9904
cmpl %r14d, %r13d
jle 0x9904
movl %r15d, %ecx
imull %r14d, %ecx
addq %rsi, %rcx
movb (%r12,%rcx), %dl
testb $0x1, %dl
je 0x9904
shrb %dl
andb $0x2, %dl
addss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
je 0x972c
testb %dl, %dl
je 0x96e9
movl %ebp, %ecx
jmp 0x98f1
xorl %edx, %edx
movl %eax, %ecx
subl %ebx, %ecx
setg %dl
movswl %bx, %esi
cvtsi2ss %esi, %xmm1
leal (%rax,%rdx,2), %esi
decl %esi
cvtsi2ss %esi, %xmm0
movss %xmm0, 0x14(%rsp)
ucomiss %xmm0, %xmm1
je 0x991c
movq %r9, 0x8(%rsp)
movswl %r8w, %esi
imull %esi, %ebx
subl %ebp, %esi
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
movss %xmm0, 0x20(%rsp)
imull %ebp, %eax
subl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x1c(%rsp)
leal -0x1(,%rdx,2), %eax
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
cvtsi2ss %eax, %xmm2
movss %xmm2, 0x10(%rsp)
movss 0x1d860(%rip), %xmm2    # 0x27008
divss %xmm0, %xmm2
movss %xmm2, 0x18(%rsp)
xorl %r14d, %r14d
xorl %ecx, %ecx
movl %ecx, %ebp
movl %r14d, %ebx
movaps %xmm1, %xmm0
mulss 0x20(%rsp), %xmm0
addss 0x1c(%rsp), %xmm0
mulss 0x18(%rsp), %xmm0
movss %xmm1, 0x24(%rsp)
cvttss2si %xmm1, %r14d
cvtss2sd %xmm0, %xmm0
addsd 0x1d8e8(%rip), %xmm0    # 0x270d0
callq 0x5400
movl $0x1, %eax
testl %r14d, %r14d
js 0x9904
cvttsd2si %xmm0, %ecx
testl %ecx, %ecx
js 0x9904
cmpl %r14d, %r13d
jle 0x9904
cmpl %ecx, %r15d
jle 0x9904
movl %r15d, %edx
imull %r14d, %edx
movl %ecx, %esi
addq %rdx, %rsi
movb (%r12,%rsi), %dl
testb $0x1, %dl
je 0x9904
shrb %dl
andb $0x2, %dl
movss 0x24(%rsp), %xmm1
addss 0x10(%rsp), %xmm1
ucomiss 0x14(%rsp), %xmm1
je 0x98f1
testb %dl, %dl
je 0x97b7
jmp 0x98f1
cmpw %r8w, %bp
sete %dl
cmpw %cx, %bx
setne %cl
xorl %eax, %eax
orb %dl, %cl
jne 0x991e
movswl %r8w, %edx
xorl %ecx, %ecx
cmpw %bp, %r8w
setg %cl
movswl %bp, %esi
cvtsi2ss %esi, %xmm0
leal (%rdx,%rcx,2), %edx
decl %edx
cvtsi2ss %edx, %xmm1
ucomiss %xmm1, %xmm0
je 0x991e
movzwl %bp, %esi
movb $0x1, %dl
xorl %ebp, %ebp
cmpl %esi, %r15d
movq %r9, 0x8(%rsp)
jle 0x98ec
leal -0x1(,%rcx,2), %eax
cvtsi2ss %eax, %xmm2
xorl %ebp, %ebp
movl %edi, %eax
movl %esi, %ecx
movl %esi, %esi
addq %rax, %rsi
movb (%r12,%rsi), %sil
testb $0x1, %sil
je 0x98ee
shrb %sil
andb $0x2, %sil
jne 0x992d
addss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
je 0x992d
cvttss2si %xmm0, %esi
testl %esi, %esi
js 0x98ea
movl %ecx, %ebp
cmpl %esi, %r15d
jg 0x98b8
movl %ecx, %ebp
movl %esi, %ecx
movl %ebx, %r14d
movzbl %dl, %eax
cmpb $0x1, %al
je 0x9904
cmpl $0x2, %eax
jne 0x991c
movl $0x2, %eax
jmp 0x9909
movl %ebx, %r14d
movl %ebp, %ecx
movq 0x60(%rsp), %rdx
movq 0x8(%rsp), %rsi
movw %r14w, (%rsi)
movw %cx, (%rdx)
jmp 0x991e
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebx, %r14d
movl %esi, %edx
jmp 0x98f1
leaq 0x1da9e(%rip), %rdi     # 0x273d9
leaq 0x1daa9(%rip), %rsi     # 0x273eb
leaq 0x1daae(%rip), %rcx     # 0x273f7
movl $0x36, %edx
callq 0x5190
nop