// File: /workspace/github_cpp_makefile_star2_O2/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
movq %r9, %rbx
movl %r8d, %r12d
movl %ecx, %r13d
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r14
callq 0x81a4
testb %al, %al
je 0x84b9
movswl %r13w, %eax
cmpw %ax, %r15w
sete %cl
cmpw %r12w, %bp
sete %dl
orb %cl, %dl
je 0x82c6
cmpw %r12w, %bp
setne %cl
cmpw %r13w, %r15w
sete %dl
orb %cl, %dl
jne 0x83d2
movq %rbx, 0x10(%rsp)
xorl %ecx, %ecx
cmpw %r15w, %r13w
setg %cl
movswl %r15w, %edx
cvtsi2ss %edx, %xmm0
leal -0x1(%rax,%rcx,2), %eax
cvtsi2ss %eax, %xmm1
movss %xmm1, 0x8(%rsp)
leal -0x1(,%rcx,2), %eax
cvtsi2ss %eax, %xmm1
movss %xmm1, 0x4(%rsp)
xorl %r15d, %r15d
pushq $0x1
popq %r13
xorl %ebx, %ebx
xorl %eax, %eax
ucomiss 0x8(%rsp), %xmm0
je 0x847d
testl %eax, %eax
jne 0x847d
movss %xmm0, 0xc(%rsp)
cvttss2si %xmm0, %r12d
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x81a4
movl %eax, %ecx
movl %r13d, %eax
testb %cl, %cl
je 0x82b2
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x80e2
movzbl %al, %eax
addl %eax, %eax
movss 0xc(%rsp), %xmm0
addss 0x4(%rsp), %xmm0
movl %ebx, %r15d
movl %r12d, %ebx
jmp 0x826c
movq %rbx, 0x10(%rsp)
movswl %r12w, %ecx
movl %ecx, %edx
subl %ebp, %edx
cvtsi2ss %edx, %xmm0
movss %xmm0, 0x4(%rsp)
movl %eax, %edx
subl %r15d, %edx
cvtsi2ss %edx, %xmm0
imull %eax, %ebp
imull %r15d, %ecx
subl %ecx, %ebp
cvtsi2ss %ebp, %xmm1
movss %xmm1, 0x24(%rsp)
xorl %ecx, %ecx
testl %edx, %edx
setg %cl
leal -0x1(%rcx,%rcx), %edx
movswl %r15w, %esi
cvtsi2ss %esi, %xmm1
leal -0x1(%rax,%rcx,2), %eax
cvtsi2ss %eax, %xmm2
movss %xmm2, 0x8(%rsp)
cvtsi2ss %edx, %xmm2
movss %xmm2, 0x20(%rsp)
movss 0x14cdc(%rip), %xmm2    # 0x1d008
divss %xmm0, %xmm2
movss %xmm2, 0x1c(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %r15d, %r15d
xorl %ebx, %ebx
xorl %eax, %eax
ucomiss 0x8(%rsp), %xmm1
je 0x8485
testl %eax, %eax
jne 0x8485
movaps %xmm1, %xmm0
mulss 0x4(%rsp), %xmm0
addss 0x24(%rsp), %xmm0
mulss 0x1c(%rsp), %xmm0
movss %xmm1, 0xc(%rsp)
cvttss2si %xmm1, %r12d
cvtss2sd %xmm0, %xmm0
addsd 0x14c9f(%rip), %xmm0    # 0x1d020
callq 0x5400
cvttsd2si %xmm0, %r15d
movq %r14, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x81a4
movl %eax, %ecx
pushq $0x1
popq %rax
testb %cl, %cl
je 0x83b5
movq %r14, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x80e2
movzbl %al, %eax
addl %eax, %eax
movss 0xc(%rsp), %xmm1
addss 0x20(%rsp), %xmm1
movl %r13d, %ebp
movl %r15d, %r13d
movl %ebx, %r15d
movl %r12d, %ebx
jmp 0x8342
cmpw %r12w, %bp
sete %al
cmpw %r13w, %r15w
setne %cl
orb %al, %cl
jne 0x84a8
movq %rbx, 0x10(%rsp)
movswl %r12w, %eax
xorl %ecx, %ecx
cmpw %bp, %r12w
setg %cl
movswl %bp, %edx
cvtsi2ss %edx, %xmm0
leal -0x1(%rax,%rcx,2), %eax
cvtsi2ss %eax, %xmm1
movss %xmm1, 0x8(%rsp)
leal -0x1(,%rcx,2), %eax
cvtsi2ss %eax, %xmm1
movss %xmm1, 0x4(%rsp)
xorl %ebp, %ebp
pushq $0x1
popq %rbx
xorl %r13d, %r13d
xorl %eax, %eax
testl %eax, %eax
jne 0x8482
ucomiss 0x8(%rsp), %xmm0
je 0x8482
movss %xmm0, 0xc(%rsp)
cvttss2si %xmm0, %r12d
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x81a4
movl %eax, %ecx
movl %ebx, %eax
testb %cl, %cl
je 0x8469
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x80e2
movzbl %al, %eax
addl %eax, %eax
movss 0xc(%rsp), %xmm0
addss 0x4(%rsp), %xmm0
movl %r13d, %ebp
movl %r12d, %r13d
jmp 0x842a
movl %ebp, %r13d
jmp 0x8485
movl %r15d, %ebx
cmpl $0x1, %eax
je 0x8495
cmpl $0x2, %eax
jne 0x84a8
movl %ebx, %r15d
movl %r13d, %ebp
movq 0x60(%rsp), %rcx
movq 0x10(%rsp), %rdx
movw %r15w, (%rdx)
movw %bp, (%rcx)
jmp 0x84aa
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14ef1(%rip), %rdi     # 0x1d3b1
leaq 0x14efc(%rip), %rsi     # 0x1d3c3
leaq 0x14f01(%rip), %rcx     # 0x1d3cf
pushq $0x36
popq %rdx
callq 0x5170