// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DASrealign.c
// Function: good
static inline int good(Finger *cur, int pos)
{ int blen, *map;

  map  = cur->map;
  blen = cur->blen;
  if (blen == 0)
    { while (cur->cidx < cur->lidx && pos >= map[cur->cidx])
        { cur->dist += (map[cur->cidx-2] - cur->last) + map[cur->cidx-1];
          cur->last  = map[cur->cidx];
          cur->cidx += 3; 
        }
      if (pos <= map[cur->cidx-2])
        { if (pos < cur->last)
            return (-1);
          else
            return (cur->dist + (pos-cur->last));
        }
    }
  else
    { while (cur->cidx > cur->lidx && pos >= blen - map[cur->cidx])
        { cur->dist += ((blen - map[cur->cidx+2]) - cur->last) + map[cur->cidx+1];
          cur->last  = blen - map[cur->cidx];
          cur->cidx -= 3; 
        }
      if (pos <= blen - map[cur->cidx+2])
        { if (pos < cur->last)
            return (-1);
          else
            return (cur->dist + (pos-cur->last));
        }
    }
  return (-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x4cdd
jmp 0x4bfd
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rdx
xorl %eax, %eax
cmpl 0x4(%rdx), %ecx
movb %al, -0x21(%rbp)
jge 0x4c28
movl -0x14(%rbp), %eax
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rdx
movslq (%rdx), %rdx
cmpl (%rcx,%rdx,4), %eax
setge %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x4c31
jmp 0x4c8d
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
movq -0x10(%rbp), %rax
subl 0xc(%rax), %ecx
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rdx
movl (%rdx), %edx
subl $0x1, %edx
movslq %edx, %rdx
addl (%rax,%rdx,4), %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x3, %ecx
movl %ecx, (%rax)
jmp 0x4bfd
movl -0x14(%rbp), %eax
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rdx
movl (%rdx), %edx
subl $0x2, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jg 0x4cd8
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x4cbd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4dcd
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rdx
subl 0xc(%rdx), %ecx
addl %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x4dcd
jmp 0x4dc6
jmp 0x4cdf
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rdx
xorl %eax, %eax
cmpl 0x4(%rdx), %ecx
movb %al, -0x22(%rbp)
jle 0x4d0f
movl -0x14(%rbp), %eax
movl -0x18(%rbp), %ecx
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rsi
movslq (%rsi), %rsi
subl (%rdx,%rsi,4), %ecx
cmpl %ecx, %eax
setge %al
movb %al, -0x22(%rbp)
movb -0x22(%rbp), %al
testb $0x1, %al
jne 0x4d18
jmp 0x4d7a
movl -0x18(%rbp), %ecx
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rdx
movl (%rdx), %edx
addl $0x2, %edx
movslq %edx, %rdx
subl (%rax,%rdx,4), %ecx
movq -0x10(%rbp), %rax
subl 0xc(%rax), %ecx
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rdx
movl (%rdx), %edx
addl $0x1, %edx
movslq %edx, %rdx
addl (%rax,%rdx,4), %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movl -0x18(%rbp), %ecx
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rdx
movslq (%rdx), %rdx
subl (%rax,%rdx,4), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
subl $0x3, %ecx
movl %ecx, (%rax)
jmp 0x4cdf
movl -0x14(%rbp), %eax
movl -0x18(%rbp), %ecx
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rsi
movl (%rsi), %esi
addl $0x2, %esi
movslq %esi, %rsi
subl (%rdx,%rsi,4), %ecx
cmpl %ecx, %eax
jg 0x4dc4
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x4dac
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4dcd
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rdx
subl 0xc(%rdx), %ecx
addl %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x4dcd
jmp 0x4dc6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)