user: Converte this assembly snippet into its equivalent C code:

```asm
<dist_4v_unordered_nostrand_v2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %edx,-0x64(%rbp)
  mov    %ecx,-0x68(%rbp)
  mov    %r8,-0x70(%rbp)
  mov    %r9,-0x78(%rbp)
  movl   $0x0,-0x24(%rbp)
  mov    -0x68(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x60(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  sub    0x18(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,0x40(%rbp)
  je     L78
  mov    0x20(%rbp),%edi
  mov    0x18(%rbp),%esi
  mov    -0x68(%rbp),%edx
  mov    -0x64(%rbp),%eax
  mov    -0x18(%rbp),%ecx
  push   %rcx
  mov    -0x14(%rbp),%ecx
  push   %rcx
  mov    %edi,%r9d
  mov    %esi,%r8d
  mov    0x10(%rbp),%ecx
  mov    %eax,%esi
  lea    D99(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
  mov    -0x64(%rbp),%eax
  mov    %eax,%esi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x1,-0x44(%rbp)
  jmp    L184
L216:
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0xc,%rax
  mov    (%rax),%esi
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x8,%rax
  mov    (%rax),%ecx
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x4,%rax
  mov    (%rax),%edx
  mov    -0x44(%rbp),%eax
  mov    %esi,%r8d
  mov    %eax,%esi
  lea    D93(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x44(%rbp)
L184:
  mov    -0x44(%rbp),%eax
  cmp    -0x64(%rbp),%eax
  jle    L216
  mov    -0x68(%rbp),%eax
  mov    %eax,%esi
  lea    D94(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x1,-0x44(%rbp)
  jmp    L189
L58:
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x44(%rbp),%eax
  mov    %eax,%esi
  lea    D64(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x44(%rbp)
L189:
  mov    -0x44(%rbp),%eax
  cmp    -0x68(%rbp),%eax
  jle    L58
  mov    $0xa,%edi
  call   <putchar@plt>
L78:
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x4,%rax
  mov    (%rax),%edx
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x58(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  add    $0x8,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  cmovg  %eax,%edx
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x58(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  add    $0xc,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  cmp    %eax,-0x14(%rbp)
  jle    L77
  mov    -0x64(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L119
L77:
  movl   $0x1,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    0x4(%rax),%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    0x8(%rax),%eax
  mov    %eax,-0x38(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    0xc(%rax),%eax
  mov    %eax,-0x34(%rbp)
  jmp    L104
L141:
  addl   $0x1,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    0x4(%rax),%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    0x8(%rax),%eax
  mov    %eax,-0x38(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    0xc(%rax),%eax
  mov    %eax,-0x34(%rbp)
L104:
  mov    -0x3c(%rbp),%edx
  mov    -0x38(%rbp),%eax
  cmp    %eax,%edx
  cmovg  %eax,%edx
  mov    -0x34(%rbp),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  cmp    %eax,-0x14(%rbp)
  setg   %dl
  mov    -0x1c(%rbp),%eax
  cmp    -0x64(%rbp),%eax
  setl   %al
  and    %edx,%eax
  test   %al,%al
  jne    L141
L119:
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x44(%rbp)
  mov    -0x58(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    0x4(%rax),%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x58(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    0x8(%rax),%eax
  mov    %eax,-0x38(%rbp)
  mov    -0x58(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    0xc(%rax),%eax
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,0x40(%rbp)
  je     L27
  mov    -0x34(%rbp),%esi
  mov    -0x38(%rbp),%ecx
  mov    -0x3c(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  mov    %esi,%r8d
  mov    %eax,%esi
  lea    D52(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L27
L126:
  addl   $0x1,-0x44(%rbp)
  movl   $0x0,-0x40(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    0x4(%rax),%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    0x8(%rax),%eax
  mov    %eax,-0x38(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    0xc(%rax),%eax
  mov    %eax,-0x34(%rbp)
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  cmpl   $0x0,0x40(%rbp)
  je     L22
  mov    -0x34(%rbp),%esi
  mov    -0x38(%rbp),%ecx
  mov    -0x3c(%rbp),%edx
  mov    -0x44(%rbp),%eax
  mov    %esi,%r8d
  mov    %eax,%esi
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L22
L79:
  addl   $0x1,-0x40(%rbp)
  mov    -0x40(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  mov    -0x10(%rbp),%eax
  sub    -0x3c(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x30(%rbp),%xmm0
  movq   D59(%rip),%xmm1
  andpd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  cmp    0x10(%rbp),%eax
  setg   %dl
  mov    -0xc(%rbp),%eax
  cmp    0x18(%rbp),%eax
  setl   %al
  and    %edx,%eax
  test   %al,%al
  je     L128
  mov    -0x10(%rbp),%eax
  sub    -0x38(%rbp),%eax
  mov    %eax,-0x2c(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x2c(%rbp),%xmm0
  movq   D59(%rip),%xmm1
  andpd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  cmp    0x10(%rbp),%eax
  setg   %dl
  mov    -0x8(%rbp),%eax
  cmp    0x18(%rbp),%eax
  setl   %al
  and    %edx,%eax
  test   %al,%al
  je     L128
  mov    -0x10(%rbp),%eax
  sub    -0x34(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x28(%rbp),%xmm0
  movq   D59(%rip),%xmm1
  andpd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    0x10(%rbp),%eax
  setg   %dl
  mov    -0x4(%rbp),%eax
  cmp    0x18(%rbp),%eax
  setl   %al
  and    %edx,%eax
  test   %al,%al
  je     L128
  addl   $0x1,-0x24(%rbp)
  cmpl   $0x1,0x30(%rbp)
  jne    L128
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    0x4(%rax),%rdx
  mov    -0x3c(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    0x8(%rax),%rdx
  mov    -0x38(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    0xc(%rax),%rdx
  mov    -0x34(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    0x10(%rax),%rdx
  mov    -0x10(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rdx
  add    $0x14,%rdx
  mov    0x10(%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rdx
  add    $0x18,%rdx
  mov    0x14(%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rdx
  add    $0x1c,%rdx
  mov    0x18(%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    0x20(%rax),%rdx
  mov    -0x40(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x24,%rax
  movl   $0xffffffff,(%rax)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x28,%rax
  movl   $0xffffffff,(%rax)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x2c,%rax
  movl   $0xffffffff,(%rax)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x30,%rax
  movl   $0xffffffff,(%rax)
L128:
  mov    -0x30(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  cmp    %eax,%edx
  cmovl  %eax,%edx
  mov    -0x28(%rbp),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  cmp    %eax,0x18(%rbp)
  jge    L22
  mov    -0x68(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x40(%rbp)
L22:
  mov    -0x40(%rbp),%eax
  cmp    -0x68(%rbp),%eax
  setl   %dl
  mov    -0x24(%rbp),%eax
  cmp    0x20(%rbp),%eax
  setl   %al
  and    %edx,%eax
  movzbl %al,%edx
  mov    -0x30(%rbp),%eax
  cmp    0x18(%rbp),%eax
  setl   %al
  movzbl %al,%eax
  and    %eax,%edx
  mov    -0x2c(%rbp),%eax
  cmp    0x18(%rbp),%eax
  setl   %al
  movzbl %al,%eax
  and    %eax,%edx
  mov    -0x28(%rbp),%eax
  cmp    0x18(%rbp),%eax
  setl   %al
  movzbl %al,%eax
  and    %edx,%eax
  test   %eax,%eax
  jne    L79
L27:
  mov    -0x44(%rbp),%eax
  cmp    -0x64(%rbp),%eax
  setl   %dl
  mov    -0x24(%rbp),%eax
  cmp    0x20(%rbp),%eax
  setl   %al
  and    %edx,%eax
  movzbl %al,%edx
  mov    -0x3c(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  setl   %al
  movzbl %al,%eax
  and    %eax,%edx
  mov    -0x38(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  setl   %al
  movzbl %al,%eax
  and    %eax,%edx
  mov    -0x34(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  setl   %al
  movzbl %al,%eax
  and    %edx,%eax
  test   %eax,%eax
  jne    L126
  cmpl   $0x0,-0x24(%rbp)
  setg   %dl
  cmpl   $0x1,0x30(%rbp)
  sete   %al
  and    %edx,%eax
  test   %al,%al
  je     L108
  mov    -0x24(%rbp),%ecx
  mov    0x28(%rbp),%rdx
  mov    -0x70(%rbp),%rsi
  mov    0x38(%rbp),%rax
  mov    $0x4,%r8d
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <remove_overlaps_v2@plt>
  mov    %eax,-0x20(%rbp)
  jmp    L4
L108:
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x20(%rbp)
L4:
  mov    -0x78(%rbp),%rax
  add    $0x4,%rax
  movl   $0x0,(%rax)
  mov    -0x24(%rbp),%eax
  cmp    0x20(%rbp),%eax
  jl     L89
  mov    -0x78(%rbp),%rax
  add    $0x4,%rax
  movl   $0xffffffff,(%rax)
L89:
  mov    -0x78(%rbp),%rax
  mov    -0x20(%rbp),%edx
  mov    %edx,(%rax)
  nop
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D99
type_guessed: string
name: read_data
arguments: data_label: D2
type_guessed: string
name: read_data
arguments: data_label: D93
type_guessed: string
name: read_data
arguments: data_label: D94
type_guessed: string
name: read_data
arguments: data_label: D64
type_guessed: string
name: read_data
arguments: data_label: D52
type_guessed: string
name: read_data
arguments: data_label: D87
type_guessed: string
name: read_data
arguments: data_label: D59
type_guessed: qword

tool: D99: dist_4v_unordered_nostrand_v1	n123=%d	n4=%d
min_dist=%d	max_dist=%d	max_n_ovdi=%d	min_p4=%d	max_p4=%d


tool: D2: ovdi123_p (n123=%d)


tool: D93: %d	%d	%d	%d


tool: D94: m4 (n4=%d)


tool: D64: %d %d,

tool: D52: 	init_i=%d	p1=%d	p2=%d	p3=%d


tool: D87: 		i=%d	p1=%d	p2=%d	p3=%d	

tool: D59: 9223372036854775807

assistant: ```c
void dist_4v_unordered_nostrand_v2(int **ovdi123_p, int *m4_p, int n123, int n4, int **ovdi, int *n, int min_dist, int max_dist, int max_n_ovdi, int *ml, int get_positions, int **all_ovdi, int verbose) {
  int i, j;
  int p1, p2, p3, p4;
  int d14, d24, d34;
  int ad14, ad24, ad34;
  int n_ovdi = 0;
  int n_cooc;
  int max_p4;
  int min_p4;
  int init_i;
  max_p4 = m4_p[n4] + max_dist;
  min_p4 = m4_p[1] - max_dist;
  if (verbose) {
    printf("dist_4v_unordered_nostrand_v1\tn123=%d\tn4=%d\nmin_dist=%d\tmax_dist=%d\tmax_n_ovdi=%d\tmin_p4=%d\tmax_p4=%d\n", n123, n4, min_dist, max_dist, max_n_ovdi, min_p4, max_p4);
    printf("ovdi123_p (n123=%d)\n", n123);
    for (i = 1; i <= n123; i++)
      printf("%d\t%d\t%d\t%d\n", i, ovdi123_p[i][1], ovdi123_p[i][2], ovdi123_p[i][3]);
    printf("m4 (n4=%d)\n", n4);
    for (i = 1; i <= n4; i++)
      printf("%d %d,", i, m4_p[i]);
    printf("\n");
  }
  if ((ovdi123_p[n123][1] < min_p4) | (ovdi123_p[n123][2] < min_p4) | (ovdi123_p[n123][3] < min_p4)) {
    init_i = n123 + 1;
  } else {
    init_i = 1;
    p1 = ovdi123_p[init_i][1];
    p2 = ovdi123_p[init_i][2];
    p3 = ovdi123_p[init_i][3];
    while (((p1 < min_p4) | (p2 < min_p4) | (p3 < min_p4)) & (init_i < n123)) {
      init_i++;
      p1 = ovdi123_p[init_i][1];
      p2 = ovdi123_p[init_i][2];
      p3 = ovdi123_p[init_i][3];
    }
  }
  i = init_i - 1;
  p1 = ovdi123_p[1][1];
  p2 = ovdi123_p[1][2];
  p3 = ovdi123_p[1][3];
  if (verbose)
    printf("\tinit_i=%d\tp1=%d\tp2=%d\tp3=%d\n", init_i, p1, p2, p3);
  while ((i < n123) & (n_ovdi < max_n_ovdi) & (p1 < max_p4) & (p2 < max_p4) & (p3 < max_p4)) {
    i++;
    j = 0;
    p1 = ovdi123_p[i][1];
    p2 = ovdi123_p[i][2];
    p3 = ovdi123_p[i][3];
    d14 = 0;
    d24 = 0;
    d34 = 0;
    if (verbose)
      printf("\t\ti=%d\tp1=%d\tp2=%d\tp3=%d\t", i, p1, p2, p3);
    while ((j < n4) & (n_ovdi < max_n_ovdi) & (d14 < max_dist) & (d24 < max_dist) & (d34 < max_dist)) {
      j++;
      p4 = m4_p[j];
      d24 = 0;
      d34 = 0;
      d14 = p4 - p1;
      ad14 = fabs(d14);
      if ((ad14 > min_dist) & (ad14 < max_dist)) {
        d24 = p4 - p2;
        ad24 = fabs(d24);
        if ((ad24 > min_dist) & (ad24 < max_dist)) {
          d34 = p4 - p3;
          ad34 = fabs(d34);
          if ((ad34 > min_dist) & (ad34 < max_dist)) {
            n_ovdi++;
            if (get_positions == 1) {
              all_ovdi[n_ovdi][1] = p1;
              all_ovdi[n_ovdi][2] = p2;
              all_ovdi[n_ovdi][3] = p3;
              all_ovdi[n_ovdi][4] = p4;
              all_ovdi[n_ovdi][5] = ovdi123_p[i][4];
              all_ovdi[n_ovdi][6] = ovdi123_p[i][5];
              all_ovdi[n_ovdi][7] = ovdi123_p[i][6];
              all_ovdi[n_ovdi][8] = j;
              all_ovdi[n_ovdi][9] = -1;
              all_ovdi[n_ovdi][10] = -1;
              all_ovdi[n_ovdi][11] = -1;
              all_ovdi[n_ovdi][12] = -1;
            }
          }
        }
      }
      if ((d14 > max_dist) | (d24 > max_dist) | (d34 > max_dist))
        j = n4 + 1;
    }
  }
  if ((n_ovdi > 0) & (get_positions == 1)) {
    n_cooc = remove_overlaps_v2(all_ovdi, ovdi, ml, n_ovdi, 4);
  } else {
    n_cooc = n_ovdi;
  }
  n[1] = 0;
  if (n_ovdi >= max_n_ovdi)
    n[1] = -1;
  n[0] = n_cooc;
}
```