// File: matallui[P]nibble-curses/src/CObstacle.cpp
// Function: CObstacle::Intersection(CPoint const&) const
bool CObstacle::Intersection ( CPoint const & p ) const
{
  int px = p.getX();
  int py = p.getY();
  int ox = m_orig.getX();
  int oy = m_orig.getY();
  bool res;
  
  switch ( m_mode )
  {
    case 'V':
      res = ( (py == oy) && (px >= ox) && (px < (ox+m_length)) );
      break;
    case 'H':
      res = ( (px == ox) && (py >= oy) && (py < (oy+m_length)) );
      break;
    case 'D':
      res = ( (px >= ox) && (px < (ox+m_length)) && (py >= oy) && (py < (oy+m_length)) && ((py-px) == (oy-ox)) );
      break;
    case 'I':
      res = ( (py == oy) && (px >= ox) && (px < (ox+m_length)) && ((px%2) == (ox%2)) );
  }
  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3c50
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3c60
movq -0x38(%rbp), %rdi
movl %eax, -0x18(%rbp)
callq 0x3c50
movq -0x38(%rbp), %rdi
movl %eax, -0x1c(%rbp)
callq 0x3c60
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, -0x20(%rbp)
movsbl 0xc(%rax), %eax
addl $-0x44, %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x12, %eax
ja 0x4302
movq -0x30(%rbp), %rax
leaq 0x7ebd(%rip), %rcx      # 0xc07c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x18(%rbp), %ecx
xorl %eax, %eax
cmpl -0x20(%rbp), %ecx
movb %al, -0x39(%rbp)
jne 0x41f7
movl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl -0x1c(%rbp), %ecx
movb %al, -0x39(%rbp)
jl 0x41f7
movq -0x38(%rbp), %rdx
movl -0x14(%rbp), %eax
movl -0x1c(%rbp), %ecx
addl 0x8(%rdx), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
andb $0x1, %al
movb %al, -0x21(%rbp)
jmp 0x4302
movl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl -0x1c(%rbp), %ecx
movb %al, -0x3a(%rbp)
jne 0x4233
movl -0x18(%rbp), %ecx
xorl %eax, %eax
cmpl -0x20(%rbp), %ecx
movb %al, -0x3a(%rbp)
jl 0x4233
movq -0x38(%rbp), %rdx
movl -0x18(%rbp), %eax
movl -0x20(%rbp), %ecx
addl 0x8(%rdx), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0x3a(%rbp)
movb -0x3a(%rbp), %al
andb $0x1, %al
movb %al, -0x21(%rbp)
jmp 0x4302
movl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl -0x1c(%rbp), %ecx
movb %al, -0x3b(%rbp)
jl 0x429a
movq -0x38(%rbp), %rax
movl -0x14(%rbp), %ecx
movl -0x1c(%rbp), %edx
addl 0x8(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x3b(%rbp)
jge 0x429a
movl -0x18(%rbp), %ecx
xorl %eax, %eax
cmpl -0x20(%rbp), %ecx
movb %al, -0x3b(%rbp)
jl 0x429a
movq -0x38(%rbp), %rax
movl -0x18(%rbp), %ecx
movl -0x20(%rbp), %edx
addl 0x8(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x3b(%rbp)
jge 0x429a
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
movl -0x20(%rbp), %ecx
subl -0x1c(%rbp), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x3b(%rbp)
movb -0x3b(%rbp), %al
andb $0x1, %al
movb %al, -0x21(%rbp)
jmp 0x4302
movl -0x18(%rbp), %ecx
xorl %eax, %eax
cmpl -0x20(%rbp), %ecx
movb %al, -0x3c(%rbp)
jne 0x42fa
movl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl -0x1c(%rbp), %ecx
movb %al, -0x3c(%rbp)
jl 0x42fa
movq -0x38(%rbp), %rax
movl -0x14(%rbp), %ecx
movl -0x1c(%rbp), %edx
addl 0x8(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x3c(%rbp)
jge 0x42fa
movl -0x14(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %edx, -0x40(%rbp)
movl -0x1c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl -0x40(%rbp), %edx
cmpl %eax, %edx
sete %al
movb %al, -0x3c(%rbp)
movb -0x3c(%rbp), %al
andb $0x1, %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)