// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DAStrim.c
// Function: wall_detector
static Wall *wall_detector(int *ev, int b, int e, Wall *next)
{ int idx;

  { int    i, n, max;
    double ave;

    n = e-b;

    if (n < MIN_PNT) return (next);  //  Too small: done

    idx = b;
    max = -1;                        //  Find the position of the largest separation between
    for (i = b+1; i < e; i++)        //     two tips in ev[b..e)
      if (ev[i] - ev[i-1] > max)
        { max = ev[i] - ev[i-1];
          idx = i;
        }

    ave = (ev[e-1] - ev[b]) / (n-1.);        //  Check if the current interval is a wall
    if (ave <= AVE_SEP && max <= MAX_SEP)
      { if (max <= 4.*(ave+1.))              //  Max separation < 4*average separation ?
          { next->beg = b;
            next->end = e;
            next->cnt = n;
            return (next+1);
          }
      }
  }

  next = wall_detector(ev,b,idx,next);    //  If not then split on the largest separation
  next = wall_detector(ev,idx,e,next);    //    and recurse on the two parts
  return (next);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x5, -0x2c(%rbp)
jge 0x7be2
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x7d26
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x7c51
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movl -0x28(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
subl (%rcx,%rdx,4), %eax
cmpl -0x30(%rbp), %eax
jle 0x7c44
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movl -0x28(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
subl (%rcx,%rdx,4), %eax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x7c46
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x7bf8
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
subl (%rcx,%rdx,4), %eax
cvtsi2sd %eax, %xmm0
cvtsi2sdl -0x2c(%rbp), %xmm1
movsd 0x243cb(%rip), %xmm2    # 0x2c048
subsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x243ae(%rip), %xmm0    # 0x2c040
ucomisd -0x38(%rbp), %xmm0
jb 0x7cf0
cmpl $0x19, -0x30(%rbp)
jg 0x7cf0
cvtsi2sdl -0x30(%rbp), %xmm1
movsd 0x2439c(%rip), %xmm2    # 0x2c048
addsd -0x38(%rbp), %xmm2
movsd 0x24397(%rip), %xmm0    # 0x2c050
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x7cee
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x18(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x8(%rbp)
jmp 0x7d26
jmp 0x7cf0
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x24(%rbp), %edx
movq -0x20(%rbp), %rcx
callq 0x7bb0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x18(%rbp), %edx
movq -0x20(%rbp), %rcx
callq 0x7bb0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq