// File: /workspace/github_cpp_makefile_star2_O1/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, %r14d
testw %r14w, %r14w
js 0xaaf0
movl %edx, %ebp
testw %bp, %bp
js 0xaaf0
cmpl %r14d, 0x10(%rdi)
jle 0xaaf0
movl 0x14(%rdi), %edx
cmpl %ebp, %edx
jle 0xaaf0
movq 0x8(%rdi), %rsi
imull %r14d, %edx
movl %ebp, %eax
addq %rax, %rdx
testb $0x1, (%rsi,%rdx)
je 0xaaf0
movswl %cx, %edx
cmpw %dx, %r14w
sete %sil
cmpw %r8w, %bp
sete %r10b
orb %sil, %r10b
je 0xa840
cmpw %r8w, %bp
setne %sil
cmpw %cx, %r14w
sete %r10b
orb %sil, %r10b
jne 0xa9b0
xorl %esi, %esi
cmpw %r14w, %cx
setg %sil
movswl %r14w, %ecx
cvtsi2ss %ecx, %xmm0
leal (%rdx,%rsi,2), %ecx
decl %ecx
cvtsi2ss %ecx, %xmm1
ucomiss %xmm1, %xmm0
je 0xaa00
leal -0x1(,%rsi,2), %r8d
movl 0x10(%rdi), %ecx
movl 0x14(%rdi), %edx
movq 0x8(%rdi), %rsi
cvtsi2ss %r8d, %xmm2
xorl %r15d, %r15d
movl %r15d, %r14d
cmpl %ebp, %edx
cvttss2si %xmm0, %r15d
setle %dil
testl %r15d, %r15d
sets %r8b
cmpl %r15d, %ecx
setle %r10b
orb %dil, %r10b
orb %r8b, %r10b
movb $0x1, %dil
je 0xa7f5
addss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
je 0xa9d0
testb %dil, %dil
je 0xa7b7
jmp 0xa9d0
movl %edx, %r8d
imull %r15d, %r8d
leaq (%r8,%rax), %rdi
movb (%rsi,%rdi), %r10b
andb $0x1, %r10b
movl %r10d, %edi
xorb $0x1, %dil
testl %r15d, %r15d
js 0xa7de
testb %r10b, %r10b
je 0xa7de
cmpl %ebp, %edx
setle %dil
cmpl %r15d, %ecx
setle %r10b
orb %dil, %r10b
je 0xa82f
xorl %edi, %edi
jmp 0xa7de
leaq (%rax,%r8), %rdi
movb (%rsi,%rdi), %dil
shrb %dil
andb $0x2, %dil
jmp 0xa7de
movl %edx, %ecx
subl %r14d, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setg %al
movswl %r14w, %esi
cvtsi2ss %esi, %xmm1
leal (%rdx,%rax,2), %esi
decl %esi
cvtsi2ss %esi, %xmm0
movss %xmm0, 0x1c(%rsp)
ucomiss %xmm0, %xmm1
je 0xa9c2
movq %r9, 0x20(%rsp)
movswl %r8w, %esi
imull %esi, %r14d
subl %ebp, %esi
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
movss %xmm0, 0x18(%rsp)
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
imull %ebp, %edx
subl %r14d, %edx
cvtsi2ss %edx, %xmm2
movss %xmm2, 0x14(%rsp)
leal -0x1(,%rax,2), %eax
movl 0x10(%rdi), %r12d
movl 0x14(%rdi), %r13d
movq 0x8(%rdi), %rbx
xorps %xmm2, %xmm2
cvtsi2ss %eax, %xmm2
movss %xmm2, 0x10(%rsp)
movss 0x1d741(%rip), %xmm2    # 0x28008
divss %xmm0, %xmm2
movss %xmm2, 0xc(%rsp)
xorl %r15d, %r15d
xorl %edx, %edx
movl %edx, %ebp
movl %r15d, %r14d
movaps %xmm1, %xmm0
mulss 0x18(%rsp), %xmm0
addss 0x14(%rsp), %xmm0
mulss 0xc(%rsp), %xmm0
movss %xmm1, 0x8(%rsp)
cvttss2si %xmm1, %r15d
cvtss2sd %xmm0, %xmm0
addsd 0x1d7b9(%rip), %xmm0    # 0x280c0
callq 0x6400
cvttsd2si %xmm0, %edx
movb $0x1, %al
testl %r15d, %r15d
js 0xa985
cmpl %r15d, %r12d
setg %cl
testl %edx, %edx
setns %sil
andb %cl, %sil
cmpl %edx, %r13d
setg %cl
andb %sil, %cl
cmpb $0x1, %cl
movss 0x8(%rsp), %xmm1
jne 0xa98b
movl %r13d, %ecx
imull %r15d, %ecx
movl %edx, %esi
leaq (%rsi,%rcx), %rax
movb (%rbx,%rax), %dil
andb $0x1, %dil
movl %edi, %eax
xorb $0x1, %al
testl %r15d, %r15d
js 0xa98b
testb %dil, %dil
je 0xa98b
cmpl %r15d, %r12d
setg %al
testl %edx, %edx
setns %dil
andb %al, %dil
cmpl %edx, %r13d
setg %al
andb %dil, %al
cmpb $0x1, %al
jne 0xa9a2
addq %rcx, %rsi
movb (%rbx,%rsi), %al
shrb %al
andb $0x2, %al
jmp 0xa98b
movss 0x8(%rsp), %xmm1
addss 0x10(%rsp), %xmm1
ucomiss 0x1c(%rsp), %xmm1
je 0xa9a6
testb %al, %al
je 0xa8d6
jmp 0xa9a6
xorl %eax, %eax
jmp 0xa98b
movzbl %al, %eax
movq 0x20(%rsp), %r9
jmp 0xa9d6
xorl %edx, %edx
cmpw %cx, %r14w
jne 0xa9be
cmpw %r8w, %bp
jne 0xaa07
xorl %ebp, %ebp
jmp 0xa9c6
xorl %ebp, %ebp
xorl %edx, %edx
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %eax, %eax
jmp 0xa9d6
movzbl %dil, %eax
movl %ebp, %edx
cmpl $0x1, %eax
je 0xa9e5
cmpl $0x2, %eax
jne 0xa9f1
movl %r15d, %r14d
movl %edx, %ebp
movq 0x60(%rsp), %rcx
movw %r14w, (%r9)
movw %bp, (%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
movl %ebp, %edx
jmp 0xa9c9
movswl %r8w, %ecx
setl %al
movzbl %al, %eax
movswl %bp, %esi
cvtsi2ss %esi, %xmm0
leal (%rcx,%rax,2), %ecx
decl %ecx
cvtsi2ss %ecx, %xmm1
ucomiss %xmm1, %xmm0
je 0xaae6
leal -0x1(,%rax,2), %eax
movl 0x10(%rdi), %ecx
movl 0x14(%rdi), %esi
movq 0x8(%rdi), %rdi
cvtsi2ss %eax, %xmm2
movl %r14d, %eax
imull %esi, %eax
xorl %edx, %edx
movl %eax, %r8d
movl %edx, %ebp
cmpl %r14d, %ecx
setg %al
testw %r14w, %r14w
setns %r11b
cvttss2si %xmm0, %edx
testl %edx, %edx
setns %r10b
andb %al, %r11b
andb %r10b, %r11b
cmpl %edx, %esi
setg %r10b
andb %r11b, %r10b
movl $0x1, %eax
cmpb $0x1, %r10b
jne 0xaacd
testw %r14w, %r14w
sets %r11b
movl %edx, %ebx
leaq (%r8,%rbx), %r10
xorl %eax, %eax
testb $0x1, (%rdi,%r10)
sete %r10b
orb %r10b, %r11b
jne 0xaaca
cmpl %r14d, %ecx
setg %al
testl %edx, %edx
setns %r10b
andb %al, %r10b
cmpl %edx, %esi
setg %r11b
andb %r10b, %r11b
xorl %eax, %eax
cmpb $0x1, %r11b
jne 0xaacd
addq %r8, %rbx
movzbl (%rdi,%rbx), %eax
shrl %eax
andl $0x2, %eax
jmp 0xaacd
movb %r10b, %al
testl %eax, %eax
jne 0xaade
addss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jne 0xaa4a
movl %r14d, %r15d
jmp 0xa9d6
xorl %ebp, %ebp
movl %r14d, %r15d
jmp 0xa9cc
leaq 0x1d8d2(%rip), %rdi     # 0x283c9
leaq 0x1d8dd(%rip), %rsi     # 0x283db
leaq 0x1d8e2(%rip), %rcx     # 0x283e7
movl $0x36, %edx
callq 0x6190
nop