#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int fabs(int);
int /*<<< orphan*/ free_imatrix(int **, int, int, int, int);
int **imatrix(int, int, int, int);
int /*<<< orphan*/ printf(char *, int, ...);
int remove_overlaps_v2(int **, int **, int *, int, int);
void dist_3v_unordered_v3(int **ovdi12_p, int *m3_p, char *m3_s, int n12,
                          int n3, int **ovdi, int *n, int min_dist,
                          int max_dist, int max_n_ovdi, int *ml,
                          int get_positions, int verbose) {
  int i, j;
  int p1, p2, p3;
  char s1, s2, s3;
  int ad13, ad23;
  int d13, d23;
  int index1, index2;
  int d;
  int n_ovdi = 0;
  int **all_ovdi;
  int n_cooc;
  float r;
  if (get_positions == 1)
    all_ovdi = imatrix(1, max_n_ovdi, 1, 9);
  if (verbose)
    printf("\tdist_3v_unordered_v3\tmax_dist=%d\tmin_dist=%d\tn12=%d\tn3=%"
           "d\tmax_n_ovdi=%d\n",
           max_dist, min_dist, n12, n3, max_n_ovdi);
  i = 0;
  while ((i < n12) & (n_ovdi < max_n_ovdi)) {
    i++;
    j = 0;
    p1 = ovdi12_p[i][1];
    p2 = ovdi12_p[i][2];
    s1 = ovdi12_p[i][5];
    s2 = ovdi12_p[i][6];
    d13 = 0;
    d23 = 0;
    if (verbose)
      printf("\ni=%d\tp1=%d\tp2=%d\ts1=%d\ts2=%d\tn_ovdi=%d\n", i, p1, p2, s1,
             s2, n_ovdi);
    while ((j < n3) & (n_ovdi < max_n_ovdi) & (d13 < max_dist) &
           (d23 < max_dist)) {
      j++;
      p3 = m3_p[j];
      s3 = m3_s[j];
      if (verbose)
        printf("\tj=%d\tp3=%d\ts3=%d\t", j, p3, s3);
      d13 = 0;
      d23 = 0;
      if (((s2 == 1) & (s3 == 1)) | ((s2 == 0) & (s3 == 0)))
        d13 = p3 - p1;
      ad13 = fabs(d13);
      if (verbose)
        printf("d13=%d\tad13=%d\t", d13, ad13);
      if ((ad13 > min_dist) & (ad13 < max_dist)) {
        d23 = p3 - p2;
        ad23 = fabs(d23);
        if (verbose)
          printf("d23=%d\tad23=%d\n", d23, ad23);
        if ((ad23 > min_dist) & (ad23 < 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] = ovdi12_p[i][3];
            all_ovdi[n_ovdi][5] = ovdi12_p[i][4];
            all_ovdi[n_ovdi][6] = j;
            all_ovdi[n_ovdi][7] = s1;
            all_ovdi[n_ovdi][8] = s2;
            all_ovdi[n_ovdi][9] = s3;
          }
        }
      }
      if ((d13 > max_dist) | (d23 > max_dist))
        j = n3 + 1;
    }
  }
  if ((n_ovdi > 0) & (get_positions == 1)) {
    if (verbose)
      printf("\tn_ovdi=%d\tcalling remove_overlaps_v2\n", n_ovdi);
    n_cooc = remove_overlaps_v2(all_ovdi, ovdi, ml, n_ovdi, 3);
    if (verbose)
      printf("\tn_cooc=%d\n", n_cooc);
  } else {
    n_cooc = n_ovdi;
  }
  if (i < n12) {
    n[1] = -1;
    if (verbose)
      printf("dist_3v_unordered_v3\ti=%d\tn12=%d\tn_ovdi=%d\tmax_n_ovdi=%d\n",
             i, n12, n_ovdi, max_n_ovdi);
  } else {
    n[1] = 0;
  }
  n[0] = n_cooc;
  if (get_positions == 1)
    free_imatrix(all_ovdi, 1, max_n_ovdi, 1, 9);
}


x86 assembly (clang, -O0):
<dist_3v_unordered_v3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x60(%rbp)
cmpl   $0x1,0x38(%rbp)
jne    11b2 <dist_3v_unordered_v3+0x62>
mov    0x28(%rbp),%esi
mov    $0x1,%edx
mov    $0x9,%ecx
mov    %edx,%edi
call   1030 <imatrix@plt>
mov    %rax,-0x68(%rbp)
cmpl   $0x0,0x40(%rbp)
je     11db <dist_3v_unordered_v3+0x8b>
mov    0x20(%rbp),%esi
mov    0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    0x28(%rbp),%r9d
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x60(%rbp),%ecx
cmp    0x28(%rbp),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     155c <dist_3v_unordered_v3+0x40c>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x14(%rax),%eax
mov    %al,-0x3d(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x18(%rax),%eax
mov    %al,-0x3e(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
cmpl   $0x0,0x40(%rbp)
je     12a1 <dist_3v_unordered_v3+0x151>
mov    -0x2c(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
movsbl -0x3d(%rbp),%r8d
movsbl -0x3e(%rbp),%r9d
mov    -0x60(%rbp),%eax
lea    0xdb3(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a6 <dist_3v_unordered_v3+0x156>
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x60(%rbp),%ecx
cmp    0x28(%rbp),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
mov    -0x4c(%rbp),%ecx
cmp    0x20(%rbp),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
mov    -0x50(%rbp),%ecx
cmp    0x20(%rbp),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1557 <dist_3v_unordered_v3+0x407>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x3f(%rbp)
cmpl   $0x0,0x40(%rbp)
je     1337 <dist_3v_unordered_v3+0x1e7>
mov    -0x30(%rbp),%esi
mov    -0x3c(%rbp),%edx
movsbl -0x3f(%rbp),%ecx
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movsbl -0x3e(%rbp),%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movsbl -0x3f(%rbp),%ecx
cmp    $0x1,%ecx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
movsbl -0x3e(%rbp),%ecx
cmp    $0x0,%ecx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
movsbl -0x3f(%rbp),%edx
cmp    $0x0,%edx
sete   %dl
and    $0x1,%dl
movzbl %dl,%edx
and    %edx,%ecx
or     %ecx,%eax
cmp    $0x0,%eax
je     139c <dist_3v_unordered_v3+0x24c>
mov    -0x3c(%rbp),%eax
sub    -0x34(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%edi
call   1050 <fabs@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,0x40(%rbp)
je     13c5 <dist_3v_unordered_v3+0x275>
mov    -0x4c(%rbp),%esi
mov    -0x44(%rbp),%edx
lea    0xcc8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44(%rbp),%eax
cmp    0x18(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x44(%rbp),%ecx
cmp    0x20(%rbp),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1521 <dist_3v_unordered_v3+0x3d1>
mov    -0x3c(%rbp),%eax
sub    -0x38(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
call   1050 <fabs@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,0x40(%rbp)
je     141f <dist_3v_unordered_v3+0x2cf>
mov    -0x50(%rbp),%esi
mov    -0x48(%rbp),%edx
lea    0xc7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%eax
cmp    0x18(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x48(%rbp),%ecx
cmp    0x20(%rbp),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     151c <dist_3v_unordered_v3+0x3cc>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
cmpl   $0x1,0x38(%rbp)
jne    1517 <dist_3v_unordered_v3+0x3c7>
mov    -0x34(%rbp),%ecx
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x4(%rax)
mov    -0x38(%rbp),%ecx
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x8(%rax)
mov    -0x3c(%rbp),%ecx
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0xc(%rax)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0xc(%rax),%ecx
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x10(%rax)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x10(%rax),%ecx
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x14(%rax)
mov    -0x30(%rbp),%ecx
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x18(%rax)
movsbl -0x3d(%rbp),%ecx
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x1c(%rax)
movsbl -0x3e(%rbp),%ecx
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x20(%rax)
movsbl -0x3f(%rbp),%ecx
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x24(%rax)
jmp    151c <dist_3v_unordered_v3+0x3cc>
jmp    1521 <dist_3v_unordered_v3+0x3d1>
mov    -0x4c(%rbp),%eax
cmp    0x20(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x50(%rbp),%ecx
cmp    0x20(%rbp),%ecx
setg   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
cmp    $0x0,%eax
je     1552 <dist_3v_unordered_v3+0x402>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12a6 <dist_3v_unordered_v3+0x156>
jmp    11e2 <dist_3v_unordered_v3+0x92>
cmpl   $0x0,-0x60(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x1,0x38(%rbp)
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     15d8 <dist_3v_unordered_v3+0x488>
cmpl   $0x0,0x40(%rbp)
je     159b <dist_3v_unordered_v3+0x44b>
mov    -0x60(%rbp),%esi
lea    0xb12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x30(%rbp),%rdx
mov    -0x60(%rbp),%ecx
mov    $0x3,%r8d
call   1070 <remove_overlaps_v2@plt>
mov    %eax,-0x6c(%rbp)
cmpl   $0x0,0x40(%rbp)
je     15d3 <dist_3v_unordered_v3+0x483>
mov    -0x6c(%rbp),%esi
lea    0xb01(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    15de <dist_3v_unordered_v3+0x48e>
mov    -0x60(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    161f <dist_3v_unordered_v3+0x4cf>
mov    0x10(%rbp),%rax
movl   $0xffffffff,0x4(%rax)
cmpl   $0x0,0x40(%rbp)
je     161a <dist_3v_unordered_v3+0x4ca>
mov    -0x2c(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x60(%rbp),%ecx
mov    0x28(%rbp),%r8d
lea    0xac6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    162a <dist_3v_unordered_v3+0x4da>
mov    0x10(%rbp),%rax
movl   $0x0,0x4(%rax)
mov    -0x6c(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x1,0x38(%rbp)
jne    1656 <dist_3v_unordered_v3+0x506>
mov    -0x68(%rbp),%rdi
mov    0x28(%rbp),%edx
mov    $0x1,%ecx
mov    $0x9,%r8d
mov    %ecx,%esi
call   1060 <free_imatrix@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist_3v_unordered_v3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %r9,%r14
mov    %r8,0x50(%rsp)
mov    %ecx,0x20(%rsp)
mov    %rdx,0x90(%rsp)
mov    %rsi,0x88(%rsp)
mov    %rdi,0x78(%rsp)
mov    0x100(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0xf8(%rsp),%eax
mov    0xf0(%rsp),%rbx
mov    0xe8(%rsp),%r15d
mov    0xe0(%rsp),%r8d
mov    0xd8(%rsp),%ecx
mov    %ecx,0x28(%rsp)
mov    0xd0(%rsp),%rcx
mov    %rcx,0x18(%rsp)
mov    %eax,0x24(%rsp)
cmp    $0x1,%eax
mov    %r8d,0x14(%rsp)
jne    11f3 <dist_3v_unordered_v3+0xa3>
mov    $0x1,%edi
mov    %r15d,%esi
mov    $0x1,%edx
mov    $0x9,%ecx
call   1030 <imatrix@plt>
mov    0x14(%rsp),%r8d
mov    %rax,0x48(%rsp)
cmpl   $0x0,0xc(%rsp)
je     1220 <dist_3v_unordered_v3+0xd0>
lea    0xdff(%rip),%rdi
mov    %r8d,%esi
mov    0x28(%rsp),%edx
mov    0x20(%rsp),%ecx
mov    0x50(%rsp),%r8
mov    %r15d,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%r8d
test   %r15d,%r15d
mov    0x20(%rsp),%eax
jle    1567 <dist_3v_unordered_v3+0x417>
test   %eax,%eax
jle    1567 <dist_3v_unordered_v3+0x417>
mov    %rbx,0x68(%rsp)
mov    %r14,0x70(%rsp)
mov    0x50(%rsp),%rcx
lea    0x1(%rcx),%ebp
mov    %eax,%eax
mov    %rax,0x40(%rsp)
xor    %eax,%eax
xor    %r13d,%r13d
mov    %r15d,0x8(%rsp)
mov    %ebp,0x10(%rsp)
nopl   0x0(%rax)
mov    0x78(%rsp),%rcx
mov    0x8(%rcx,%rax,8),%rcx
lea    0x1(%rax),%rsi
mov    0x4(%rcx),%r15d
mov    0x8(%rcx),%ebx
mov    0x14(%rcx),%r14d
mov    0x18(%rcx),%r12d
cmpl   $0x0,0xc(%rsp)
mov    %rsi,%rax
mov    %rsi,0x30(%rsp)
je     12b0 <dist_3v_unordered_v3+0x160>
movsbl %r14b,%r8d
movsbl %r12b,%r9d
mov    %r13d,(%rsp)
lea    0xdab(%rip),%rdi
mov    %r15d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%r8d
mov    %ebx,0x3c(%rsp)
test   %r8d,%r8d
jle    14d0 <dist_3v_unordered_v3+0x380>
cmpl   $0x0,0x50(%rsp)
jle    14d0 <dist_3v_unordered_v3+0x380>
cmp    0x8(%rsp),%r13d
jge    14d0 <dist_3v_unordered_v3+0x380>
mov    %r15d,0x38(%rsp)
mov    %r12d,%eax
shl    $0x18,%eax
mov    %eax,0x64(%rsp)
movsbl %r12b,%eax
mov    %eax,0x60(%rsp)
movsbl %r14b,%eax
mov    %eax,0x5c(%rsp)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cltq
lea    0x1(%rax),%rbx
mov    0x88(%rsp),%rcx
mov    0x4(%rcx,%rax,4),%r15d
mov    0x90(%rsp),%rcx
movsbl 0x1(%rcx,%rax,1),%r12d
cmpl   $0x0,0xc(%rsp)
je     133e <dist_3v_unordered_v3+0x1ee>
lea    0xd44(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13d,0x2c(%rsp)
mov    %r15d,%r14d
sub    0x38(%rsp),%r14d
xor    %eax,%eax
mov    %r14d,%ecx
test   %r12b,%r12b
mov    0x3c(%rsp),%ebp
je     135b <dist_3v_unordered_v3+0x20b>
xor    %ecx,%ecx
mov    %rbx,0x80(%rsp)
mov    0x64(%rsp),%edx
test   %edx,%edx
cmove  %ecx,%eax
cmp    $0x1,%r12b
cmovne %eax,%r14d
cmp    $0x1000000,%edx
cmovne %eax,%r14d
mov    %r14d,%edi
call   1050 <fabs@plt>
mov    %eax,%r13d
cmpl   $0x0,0xc(%rsp)
je     13a4 <dist_3v_unordered_v3+0x254>
lea    0xcef(%rip),%rdi
mov    %r14d,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ebx,%ebx
cmp    0x28(%rsp),%r13d
jle    1470 <dist_3v_unordered_v3+0x320>
mov    0x14(%rsp),%r8d
cmp    %r8d,%r13d
jge    1480 <dist_3v_unordered_v3+0x330>
mov    %r15d,%ebx
sub    %ebp,%ebx
mov    %ebx,%edi
call   1050 <fabs@plt>
mov    %eax,%ebp
cmpl   $0x0,0xc(%rsp)
je     13e6 <dist_3v_unordered_v3+0x296>
lea    0xcbb(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    0x28(%rsp),%ebp
mov    0x2c(%rsp),%r13d
mov    0x14(%rsp),%r8d
jle    145b <dist_3v_unordered_v3+0x30b>
cmp    %r8d,%ebp
jge    145b <dist_3v_unordered_v3+0x30b>
add    $0x1,%r13d
cmpl   $0x1,0x24(%rsp)
jne    145b <dist_3v_unordered_v3+0x30b>
movslq %r13d,%rax
mov    0x48(%rsp),%rcx
mov    (%rcx,%rax,8),%rax
mov    0x38(%rsp),%ecx
mov    %ecx,0x4(%rax)
mov    0x3c(%rsp),%ecx
mov    %ecx,0x8(%rax)
mov    %r15d,0xc(%rax)
mov    0x30(%rsp),%rcx
mov    0x78(%rsp),%rdx
mov    (%rdx,%rcx,8),%rcx
mov    0xc(%rcx),%edx
mov    %edx,0x10(%rax)
mov    0x10(%rcx),%ecx
mov    %ecx,0x14(%rax)
mov    0x80(%rsp),%rcx
mov    %ecx,0x18(%rax)
mov    0x5c(%rsp),%ecx
mov    %ecx,0x1c(%rax)
mov    0x60(%rsp),%ecx
mov    %ecx,0x20(%rax)
mov    %r12d,0x24(%rax)
mov    0x8(%rsp),%r15d
mov    0x10(%rsp),%ebp
jmp    148e <dist_3v_unordered_v3+0x33e>
cs nopw 0x0(%rax,%rax,1)
mov    0x2c(%rsp),%r13d
mov    0x14(%rsp),%r8d
jmp    1485 <dist_3v_unordered_v3+0x335>
nopl   0x0(%rax)
mov    0x2c(%rsp),%r13d
mov    0x10(%rsp),%ebp
mov    0x8(%rsp),%r15d
mov    %ebp,%ecx
cmp    %r8d,%ebx
jg     149f <dist_3v_unordered_v3+0x34f>
mov    0x80(%rsp),%rax
mov    %eax,%ecx
mov    %ebp,%eax
cmp    %r8d,%r14d
jg     14a8 <dist_3v_unordered_v3+0x358>
mov    %ecx,%eax
cmp    %r8d,%ebx
jge    14d5 <dist_3v_unordered_v3+0x385>
cmp    %r8d,%r14d
jge    14d5 <dist_3v_unordered_v3+0x385>
cmp    0x50(%rsp),%eax
jge    14d5 <dist_3v_unordered_v3+0x385>
cmp    %r15d,%r13d
jl     1300 <dist_3v_unordered_v3+0x1b0>
jmp    14d5 <dist_3v_unordered_v3+0x385>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x8(%rsp),%r15d
cmp    %r15d,%r13d
mov    0x30(%rsp),%rax
jge    14ea <dist_3v_unordered_v3+0x39a>
cmp    0x40(%rsp),%rax
jb     1260 <dist_3v_unordered_v3+0x110>
cmpl   $0x1,0x24(%rsp)
jne    1582 <dist_3v_unordered_v3+0x432>
test   %r13d,%r13d
jle    1582 <dist_3v_unordered_v3+0x432>
cmpl   $0x0,0xc(%rsp)
je     15c6 <dist_3v_unordered_v3+0x476>
lea    0xb96(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x48(%rsp),%rdi
mov    0x70(%rsp),%rsi
mov    0x68(%rsp),%rdx
mov    %r13d,%ecx
mov    $0x3,%r8d
call   1070 <remove_overlaps_v2@plt>
mov    %eax,%ebx
lea    0xb8d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x40(%rsp),%rax
cmp    %rax,0x30(%rsp)
jae    15fe <dist_3v_unordered_v3+0x4ae>
mov    0x18(%rsp),%rax
movl   $0xffffffff,0x4(%rax)
jmp    159f <dist_3v_unordered_v3+0x44f>
xor    %r13d,%r13d
mov    $0x0,%ecx
mov    %rcx,0x30(%rsp)
test   %eax,%eax
mov    0x18(%rsp),%rax
jg     158e <dist_3v_unordered_v3+0x43e>
jmp    1606 <dist_3v_unordered_v3+0x4b6>
cmp    0x40(%rsp),%rax
mov    0x18(%rsp),%rax
jae    1606 <dist_3v_unordered_v3+0x4b6>
movl   $0xffffffff,0x4(%rax)
mov    %r13d,%ebx
cmpl   $0x0,0xc(%rsp)
je     160d <dist_3v_unordered_v3+0x4bd>
lea    0xb33(%rip),%rdi
mov    0x30(%rsp),%rsi
mov    0x20(%rsp),%edx
mov    %r13d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%rax
mov    %ebx,%r13d
jmp    160d <dist_3v_unordered_v3+0x4bd>
mov    0x48(%rsp),%rdi
mov    0x70(%rsp),%rsi
mov    0x68(%rsp),%rdx
mov    %r13d,%ecx
mov    $0x3,%r8d
mov    %rax,%rbx
call   1070 <remove_overlaps_v2@plt>
mov    %eax,%r13d
cmp    0x40(%rsp),%rbx
jae    1601 <dist_3v_unordered_v3+0x4b1>
mov    0x18(%rsp),%rax
movl   $0xffffffff,0x4(%rax)
jmp    160d <dist_3v_unordered_v3+0x4bd>
mov    %ebx,%r13d
mov    0x18(%rsp),%rax
movl   $0x0,0x4(%rax)
mov    %r13d,(%rax)
cmpl   $0x1,0x24(%rsp)
jne    1645 <dist_3v_unordered_v3+0x4f5>
mov    0x48(%rsp),%rdi
mov    $0x1,%esi
mov    %r15d,%edx
mov    $0x1,%ecx
mov    $0x9,%r8d
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <free_imatrix@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [74 x i8] c"\09dist_3v_unordered_v3\09max_dist=%d\09min_dist=%d\09n12=%d\09n3=%d\09max_n_ovdi=%d\0A\00"
@.str.1 = [41 x i8] c"\0Ai=%d\09p1=%d\09p2=%d\09s1=%d\09s2=%d\09n_ovdi=%d\0A\00"
@.str.2 = [19 x i8] c"\09j=%d\09p3=%d\09s3=%d\09\00"
@.str.3 = [16 x i8] c"d13=%d\09ad13=%d\09\00"
@.str.4 = [16 x i8] c"d23=%d\09ad23=%d\0A\00"
@.str.5 = [39 x i8] c"\09n_ovdi=%d\09calling remove_overlaps_v2\0A\00"
@.str.6 = [12 x i8] c"\09n_cooc=%d\0A\00"
@.str.7 = [58 x i8] c"dist_3v_unordered_v3\09i=%d\09n12=%d\09n_ovdi=%d\09max_n_ovdi=%d\0A\00"
define void @dist_3v_unordered_v3(i32** %0, i32* %1, i8* %2, i32 %3, i32 %4, i32** %5, i32* %6, i32 %7, i32 %8, i32 %9, i32* %10, i32 %11, i32 %12) {
%14 = alloca i32**
%15 = alloca i32*
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32**
%20 = alloca i32*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32*
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i8
%33 = alloca i8
%34 = alloca i8
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
%41 = alloca i32
%42 = alloca i32
%43 = alloca i32**
%44 = alloca i32
%45 = alloca float
store i32** %0, i32*** %14
store i32* %1, i32** %15
store i8* %2, i8** %16
store i32 %3, i32* %17
store i32 %4, i32* %18
store i32** %5, i32*** %19
store i32* %6, i32** %20
store i32 %7, i32* %21
store i32 %8, i32* %22
store i32 %9, i32* %23
store i32* %10, i32** %24
store i32 %11, i32* %25
store i32 %12, i32* %26
store i32 0, i32* %42
%46 = load i32, i32* %25
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %51
48: ; preds = %13
%49 = load i32, i32* %23
%50 = call i32** @imatrix(i32 1, i32 %49, i32 1, i32 9)
store i32** %50, i32*** %43
br label %51
51: ; preds = %48, %13
%52 = load i32, i32* %26
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %61
54: ; preds = %51
%55 = load i32, i32* %22
%56 = load i32, i32* %21
%57 = load i32, i32* %17
%58 = load i32, i32* %18
%59 = load i32, i32* %23
%60 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i32 %55, i32 %56, i32 %57, i32 %58, i32 %59)
br label %61
61: ; preds = %54, %51
store i32 0, i32* %27
br label %62
62: ; preds = %330, %61
%63 = load i32, i32* %27
%64 = load i32, i32* %17
%65 = icmp slt i32 %63, %64
%66 = zext i1 %65 to i32
%67 = load i32, i32* %42
%68 = load i32, i32* %23
%69 = icmp slt i32 %67, %68
%70 = zext i1 %69 to i32
%71 = and i32 %66, %70
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %331
73: ; preds = %62
%74 = load i32, i32* %27
%75 = add nsw i32 %74, 1
store i32 %75, i32* %27
store i32 0, i32* %28
%76 = load i32**, i32*** %14
%77 = load i32, i32* %27
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32*, i32** %76, i64 %78
%80 = load i32*, i32** %79
%81 = getelementptr inbounds i32, i32* %80, i64 1
%82 = load i32, i32* %81
store i32 %82, i32* %29
%83 = load i32**, i32*** %14
%84 = load i32, i32* %27
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i32*, i32** %83, i64 %85
%87 = load i32*, i32** %86
%88 = getelementptr inbounds i32, i32* %87, i64 2
%89 = load i32, i32* %88
store i32 %89, i32* %30
%90 = load i32**, i32*** %14
%91 = load i32, i32* %27
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i32*, i32** %90, i64 %92
%94 = load i32*, i32** %93
%95 = getelementptr inbounds i32, i32* %94, i64 5
%96 = load i32, i32* %95
%97 = trunc i32 %96 to i8
store i8 %97, i8* %32
%98 = load i32**, i32*** %14
%99 = load i32, i32* %27
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i32*, i32** %98, i64 %100
%102 = load i32*, i32** %101
%103 = getelementptr inbounds i32, i32* %102, i64 6
%104 = load i32, i32* %103
%105 = trunc i32 %104 to i8
store i8 %105, i8* %33
store i32 0, i32* %37
store i32 0, i32* %38
%106 = load i32, i32* %26
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %118
108: ; preds = %73
%109 = load i32, i32* %27
%110 = load i32, i32* %29
%111 = load i32, i32* %30
%112 = load i8, i8* %32
%113 = sext i8 %112 to i32
%114 = load i8, i8* %33
%115 = sext i8 %114 to i32
%116 = load i32, i32* %42
%117 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %109, i32 %110, i32 %111, i32 %113, i32 %115, i32 %116)
br label %118
118: ; preds = %108, %73
br label %119
119: ; preds = %329, %118
%120 = load i32, i32* %28
%121 = load i32, i32* %18
%122 = icmp slt i32 %120, %121
%123 = zext i1 %122 to i32
%124 = load i32, i32* %42
%125 = load i32, i32* %23
%126 = icmp slt i32 %124, %125
%127 = zext i1 %126 to i32
%128 = and i32 %123, %127
%129 = load i32, i32* %37
%130 = load i32, i32* %22
%131 = icmp slt i32 %129, %130
%132 = zext i1 %131 to i32
%133 = and i32 %128, %132
%134 = load i32, i32* %38
%135 = load i32, i32* %22
%136 = icmp slt i32 %134, %135
%137 = zext i1 %136 to i32
%138 = and i32 %133, %137
%139 = icmp ne i32 %138, 0
br i1 %139, label %140, label %330
140: ; preds = %119
%141 = load i32, i32* %28
%142 = add nsw i32 %141, 1
store i32 %142, i32* %28
%143 = load i32*, i32** %15
%144 = load i32, i32* %28
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i32, i32* %143, i64 %145
%147 = load i32, i32* %146
store i32 %147, i32* %31
%148 = load i8*, i8** %16
%149 = load i32, i32* %28
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i8, i8* %148, i64 %150
%152 = load i8, i8* %151
store i8 %152, i8* %34
%153 = load i32, i32* %26
%154 = icmp ne i32 %153, 0
br i1 %154, label %155, label %161
155: ; preds = %140
%156 = load i32, i32* %28
%157 = load i32, i32* %31
%158 = load i8, i8* %34
%159 = sext i8 %158 to i32
%160 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %156, i32 %157, i32 %159)
br label %161
161: ; preds = %155, %140
store i32 0, i32* %37
store i32 0, i32* %38
%162 = load i8, i8* %33
%163 = sext i8 %162 to i32
%164 = icmp eq i32 %163, 1
%165 = zext i1 %164 to i32
%166 = load i8, i8* %34
%167 = sext i8 %166 to i32
%168 = icmp eq i32 %167, 1
%169 = zext i1 %168 to i32
%170 = and i32 %165, %169
%171 = load i8, i8* %33
%172 = sext i8 %171 to i32
%173 = icmp eq i32 %172, 0
%174 = zext i1 %173 to i32
%175 = load i8, i8* %34
%176 = sext i8 %175 to i32
%177 = icmp eq i32 %176, 0
%178 = zext i1 %177 to i32
%179 = and i32 %174, %178
%180 = or i32 %170, %179
%181 = icmp ne i32 %180, 0
br i1 %181, label %182, label %186
182: ; preds = %161
%183 = load i32, i32* %31
%184 = load i32, i32* %29
%185 = sub nsw i32 %183, %184
store i32 %185, i32* %37
br label %186
186: ; preds = %182, %161
%187 = load i32, i32* %37
%188 = call i32 @fabs(i32 %187)
store i32 %188, i32* %35
%189 = load i32, i32* %26
%190 = icmp ne i32 %189, 0
br i1 %190, label %191, label %195
191: ; preds = %186
%192 = load i32, i32* %37
%193 = load i32, i32* %35
%194 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %192, i32 %193)
br label %195
195: ; preds = %191, %186
%196 = load i32, i32* %35
%197 = load i32, i32* %21
%198 = icmp sgt i32 %196, %197
%199 = zext i1 %198 to i32
%200 = load i32, i32* %35
%201 = load i32, i32* %22
%202 = icmp slt i32 %200, %201
%203 = zext i1 %202 to i32
%204 = and i32 %199, %203
%205 = icmp ne i32 %204, 0
br i1 %205, label %206, label %315
206: ; preds = %195
%207 = load i32, i32* %31
%208 = load i32, i32* %30
%209 = sub nsw i32 %207, %208
store i32 %209, i32* %38
%210 = load i32, i32* %38
%211 = call i32 @fabs(i32 %210)
store i32 %211, i32* %36
%212 = load i32, i32* %26
%213 = icmp ne i32 %212, 0
br i1 %213, label %214, label %218
214: ; preds = %206
%215 = load i32, i32* %38
%216 = load i32, i32* %36
%217 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %215, i32 %216)
br label %218
218: ; preds = %214, %206
%219 = load i32, i32* %36
%220 = load i32, i32* %21
%221 = icmp sgt i32 %219, %220
%222 = zext i1 %221 to i32
%223 = load i32, i32* %36
%224 = load i32, i32* %22
%225 = icmp slt i32 %223, %224
%226 = zext i1 %225 to i32
%227 = and i32 %222, %226
%228 = icmp ne i32 %227, 0
br i1 %228, label %229, label %314
229: ; preds = %218
%230 = load i32, i32* %42
%231 = add nsw i32 %230, 1
store i32 %231, i32* %42
%232 = load i32, i32* %25
%233 = icmp eq i32 %232, 1
br i1 %233, label %234, label %313
234: ; preds = %229
%235 = load i32, i32* %29
%236 = load i32**, i32*** %43
%237 = load i32, i32* %42
%238 = sext i32 %237 to i64
%239 = getelementptr inbounds i32*, i32** %236, i64 %238
%240 = load i32*, i32** %239
%241 = getelementptr inbounds i32, i32* %240, i64 1
store i32 %235, i32* %241
%242 = load i32, i32* %30
%243 = load i32**, i32*** %43
%244 = load i32, i32* %42
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds i32*, i32** %243, i64 %245
%247 = load i32*, i32** %246
%248 = getelementptr inbounds i32, i32* %247, i64 2
store i32 %242, i32* %248
%249 = load i32, i32* %31
%250 = load i32**, i32*** %43
%251 = load i32, i32* %42
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds i32*, i32** %250, i64 %252
%254 = load i32*, i32** %253
%255 = getelementptr inbounds i32, i32* %254, i64 3
store i32 %249, i32* %255
%256 = load i32**, i32*** %14
%257 = load i32, i32* %27
%258 = sext i32 %257 to i64
%259 = getelementptr inbounds i32*, i32** %256, i64 %258
%260 = load i32*, i32** %259
%261 = getelementptr inbounds i32, i32* %260, i64 3
%262 = load i32, i32* %261
%263 = load i32**, i32*** %43
%264 = load i32, i32* %42
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds i32*, i32** %263, i64 %265
%267 = load i32*, i32** %266
%268 = getelementptr inbounds i32, i32* %267, i64 4
store i32 %262, i32* %268
%269 = load i32**, i32*** %14
%270 = load i32, i32* %27
%271 = sext i32 %270 to i64
%272 = getelementptr inbounds i32*, i32** %269, i64 %271
%273 = load i32*, i32** %272
%274 = getelementptr inbounds i32, i32* %273, i64 4
%275 = load i32, i32* %274
%276 = load i32**, i32*** %43
%277 = load i32, i32* %42
%278 = sext i32 %277 to i64
%279 = getelementptr inbounds i32*, i32** %276, i64 %278
%280 = load i32*, i32** %279
%281 = getelementptr inbounds i32, i32* %280, i64 5
store i32 %275, i32* %281
%282 = load i32, i32* %28
%283 = load i32**, i32*** %43
%284 = load i32, i32* %42
%285 = sext i32 %284 to i64
%286 = getelementptr inbounds i32*, i32** %283, i64 %285
%287 = load i32*, i32** %286
%288 = getelementptr inbounds i32, i32* %287, i64 6
store i32 %282, i32* %288
%289 = load i8, i8* %32
%290 = sext i8 %289 to i32
%291 = load i32**, i32*** %43
%292 = load i32, i32* %42
%293 = sext i32 %292 to i64
%294 = getelementptr inbounds i32*, i32** %291, i64 %293
%295 = load i32*, i32** %294
%296 = getelementptr inbounds i32, i32* %295, i64 7
store i32 %290, i32* %296
%297 = load i8, i8* %33
%298 = sext i8 %297 to i32
%299 = load i32**, i32*** %43
%300 = load i32, i32* %42
%301 = sext i32 %300 to i64
%302 = getelementptr inbounds i32*, i32** %299, i64 %301
%303 = load i32*, i32** %302
%304 = getelementptr inbounds i32, i32* %303, i64 8
store i32 %298, i32* %304
%305 = load i8, i8* %34
%306 = sext i8 %305 to i32
%307 = load i32**, i32*** %43
%308 = load i32, i32* %42
%309 = sext i32 %308 to i64
%310 = getelementptr inbounds i32*, i32** %307, i64 %309
%311 = load i32*, i32** %310
%312 = getelementptr inbounds i32, i32* %311, i64 9
store i32 %306, i32* %312
br label %313
313: ; preds = %234, %229
br label %314
314: ; preds = %313, %218
br label %315
315: ; preds = %314, %195
%316 = load i32, i32* %37
%317 = load i32, i32* %22
%318 = icmp sgt i32 %316, %317
%319 = zext i1 %318 to i32
%320 = load i32, i32* %38
%321 = load i32, i32* %22
%322 = icmp sgt i32 %320, %321
%323 = zext i1 %322 to i32
%324 = or i32 %319, %323
%325 = icmp ne i32 %324, 0
br i1 %325, label %326, label %329
326: ; preds = %315
%327 = load i32, i32* %18
%328 = add nsw i32 %327, 1
store i32 %328, i32* %28
br label %329
329: ; preds = %326, %315
br label %119
330: ; preds = %119
br label %62
331: ; preds = %62
%332 = load i32, i32* %42
%333 = icmp sgt i32 %332, 0
%334 = zext i1 %333 to i32
%335 = load i32, i32* %25
%336 = icmp eq i32 %335, 1
%337 = zext i1 %336 to i32
%338 = and i32 %334, %337
%339 = icmp ne i32 %338, 0
br i1 %339, label %340, label %358
340: ; preds = %331
%341 = load i32, i32* %26
%342 = icmp ne i32 %341, 0
br i1 %342, label %343, label %346
343: ; preds = %340
%344 = load i32, i32* %42
%345 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %344)
br label %346
346: ; preds = %343, %340
%347 = load i32**, i32*** %43
%348 = load i32**, i32*** %19
%349 = load i32*, i32** %24
%350 = load i32, i32* %42
%351 = call i32 @remove_overlaps_v2(i32** %347, i32** %348, i32* %349, i32 %350, i32 3)
store i32 %351, i32* %44
%352 = load i32, i32* %26
%353 = icmp ne i32 %352, 0
br i1 %353, label %354, label %357
354: ; preds = %346
%355 = load i32, i32* %44
%356 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %355)
br label %357
357: ; preds = %354, %346
br label %360
358: ; preds = %331
%359 = load i32, i32* %42
store i32 %359, i32* %44
br label %360
360: ; preds = %358, %357
%361 = load i32, i32* %27
%362 = load i32, i32* %17
%363 = icmp slt i32 %361, %362
br i1 %363, label %364, label %376
364: ; preds = %360
%365 = load i32*, i32** %20
%366 = getelementptr inbounds i32, i32* %365, i64 1
store i32 -1, i32* %366
%367 = load i32, i32* %26
%368 = icmp ne i32 %367, 0
br i1 %368, label %369, label %375
369: ; preds = %364
%370 = load i32, i32* %27
%371 = load i32, i32* %17
%372 = load i32, i32* %42
%373 = load i32, i32* %23
%374 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0), i32 %370, i32 %371, i32 %372, i32 %373)
br label %375
375: ; preds = %369, %364
br label %379
376: ; preds = %360
%377 = load i32*, i32** %20
%378 = getelementptr inbounds i32, i32* %377, i64 1
store i32 0, i32* %378
br label %379
379: ; preds = %376, %375
%380 = load i32, i32* %44
%381 = load i32*, i32** %20
%382 = getelementptr inbounds i32, i32* %381, i64 0
store i32 %380, i32* %382
%383 = load i32, i32* %25
%384 = icmp eq i32 %383, 1
br i1 %384, label %385, label %389
385: ; preds = %379
%386 = load i32**, i32*** %43
%387 = load i32, i32* %23
%388 = call i32 @free_imatrix(i32** %386, i32 1, i32 %387, i32 1, i32 9)
br label %389
389: ; preds = %385, %379
ret void
}

LLVM IR (-O2):
@.str = [74 x i8] c"\09dist_3v_unordered_v3\09max_dist=%d\09min_dist=%d\09n12=%d\09n3=%d\09max_n_ovdi=%d\0A\00"
@.str.1 = [41 x i8] c"\0Ai=%d\09p1=%d\09p2=%d\09s1=%d\09s2=%d\09n_ovdi=%d\0A\00"
@.str.2 = [19 x i8] c"\09j=%d\09p3=%d\09s3=%d\09\00"
@.str.3 = [16 x i8] c"d13=%d\09ad13=%d\09\00"
@.str.4 = [16 x i8] c"d23=%d\09ad23=%d\0A\00"
@.str.5 = [39 x i8] c"\09n_ovdi=%d\09calling remove_overlaps_v2\0A\00"
@.str.6 = [12 x i8] c"\09n_cooc=%d\0A\00"
@.str.7 = [58 x i8] c"dist_3v_unordered_v3\09i=%d\09n12=%d\09n_ovdi=%d\09max_n_ovdi=%d\0A\00"
define void @dist_3v_unordered_v3(i32** nocapture %0, i32* nocapture %1, i8* nocapture %2, i32 %3, i32 %4, i32** %5, i32* nocapture writeonly %6, i32 %7, i32 %8, i32 %9, i32* %10, i32 %11, i32 %12) {
%14 = icmp eq i32 %11, 1
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = tail call i32** @imatrix(i32 1, i32 %9, i32 1, i32 9)
br label %17
17: ; preds = %15, %13
%18 = phi i32** [ %16, %15 ], [ undef, %13 ]
%19 = icmp eq i32 %12, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %7, i32 %3, i32 %4, i32 %9)
br label %22
22: ; preds = %20, %17
%23 = icmp sgt i32 %3, 0
%24 = icmp sgt i32 %9, 0
%25 = and i1 %24, %23
br i1 %25, label %27, label %26
26: ; preds = %22
br i1 %23, label %155, label %164
27: ; preds = %22
%28 = icmp sgt i32 %4, 0
%29 = icmp sgt i32 %8, 0
%30 = add nsw i32 %4, 1
%31 = zext i32 %3 to i64
br label %37
32: ; preds = %125, %58
%33 = phi i32 [ %39, %58 ], [ %127, %125 ]
%34 = icmp ult i64 %40, %31
%35 = icmp slt i32 %33, %9
%36 = and i1 %35, %34
br i1 %36, label %37, label %139
37: ; preds = %27, %32
%38 = phi i64 [ 0, %27 ], [ %40, %32 ]
%39 = phi i32 [ 0, %27 ], [ %33, %32 ]
%40 = add nuw nsw i64 %38, 1
%41 = getelementptr inbounds i32*, i32** %0, i64 %40
%42 = load i32*, i32** %41
%43 = getelementptr inbounds i32, i32* %42, i64 1
%44 = load i32, i32* %43
%45 = getelementptr inbounds i32, i32* %42, i64 2
%46 = load i32, i32* %45
%47 = getelementptr inbounds i32, i32* %42, i64 5
%48 = load i32, i32* %47
%49 = getelementptr inbounds i32, i32* %42, i64 6
%50 = load i32, i32* %49
br i1 %19, label %58, label %51
51: ; preds = %37
%52 = shl i32 %48, 24
%53 = ashr exact i32 %52, 24
%54 = shl i32 %50, 24
%55 = ashr exact i32 %54, 24
%56 = trunc i64 %40 to i32
%57 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %56, i32 %44, i32 %46, i32 %53, i32 %55, i32 %39)
br label %58
58: ; preds = %51, %37
%59 = icmp slt i32 %39, %9
%60 = and i1 %28, %59
%61 = and i1 %29, %60
br i1 %61, label %62, label %32
62: ; preds = %58
%63 = shl i32 %50, 24
%64 = ashr exact i32 %63, 24
%65 = icmp eq i32 %63, 16777216
%66 = icmp eq i32 %63, 0
%67 = shl i32 %48, 24
%68 = ashr exact i32 %67, 24
br label %69
69: ; preds = %62, %125
%70 = phi i32 [ %39, %62 ], [ %127, %125 ]
%71 = phi i32 [ 0, %62 ], [ %131, %125 ]
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i32, i32* %1, i64 %73
%75 = load i32, i32* %74
%76 = getelementptr inbounds i8, i8* %2, i64 %73
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
br i1 %19, label %81, label %79
79: ; preds = %69
%80 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %72, i32 %75, i32 %78)
br label %81
81: ; preds = %69, %79
%82 = icmp eq i8 %77, 1
%83 = and i1 %65, %82
%84 = icmp eq i8 %77, 0
%85 = and i1 %66, %84
%86 = or i1 %83, %85
%87 = sub nsw i32 %75, %44
%88 = select i1 %86, i32 %87, i32 0
%89 = tail call i32 @fabs(i32 %88)
br i1 %19, label %92, label %90
90: ; preds = %81
%91 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %88, i32 %89)
br label %92
92: ; preds = %90, %81
%93 = icmp sgt i32 %89, %7
%94 = icmp slt i32 %89, %8
%95 = and i1 %93, %94
br i1 %95, label %96, label %125
96: ; preds = %92
%97 = sub nsw i32 %75, %46
%98 = tail call i32 @fabs(i32 %97)
br i1 %19, label %101, label %99
99: ; preds = %96
%100 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %97, i32 %98)
br label %101
101: ; preds = %99, %96
%102 = icmp sgt i32 %98, %7
%103 = icmp slt i32 %98, %8
%104 = and i1 %102, %103
br i1 %104, label %105, label %125
105: ; preds = %101
%106 = add nsw i32 %70, 1
br i1 %14, label %107, label %125
107: ; preds = %105
%108 = sext i32 %106 to i64
%109 = getelementptr inbounds i32*, i32** %18, i64 %108
%110 = load i32*, i32** %109
%111 = getelementptr inbounds i32, i32* %110, i64 1
store i32 %44, i32* %111
%112 = getelementptr inbounds i32, i32* %110, i64 2
store i32 %46, i32* %112
%113 = getelementptr inbounds i32, i32* %110, i64 3
store i32 %75, i32* %113
%114 = load i32*, i32** %41
%115 = getelementptr inbounds i32, i32* %114, i64 3
%116 = load i32, i32* %115
%117 = getelementptr inbounds i32, i32* %110, i64 4
store i32 %116, i32* %117
%118 = getelementptr inbounds i32, i32* %114, i64 4
%119 = load i32, i32* %118
%120 = getelementptr inbounds i32, i32* %110, i64 5
store i32 %119, i32* %120
%121 = getelementptr inbounds i32, i32* %110, i64 6
store i32 %72, i32* %121
%122 = getelementptr inbounds i32, i32* %110, i64 7
store i32 %68, i32* %122
%123 = getelementptr inbounds i32, i32* %110, i64 8
store i32 %64, i32* %123
%124 = getelementptr inbounds i32, i32* %110, i64 9
store i32 %78, i32* %124
br label %125
125: ; preds = %101, %107, %105, %92
%126 = phi i32 [ %97, %107 ], [ %97, %105 ], [ %97, %101 ], [ 0, %92 ]
%127 = phi i32 [ %106, %107 ], [ %106, %105 ], [ %70, %101 ], [ %70, %92 ]
%128 = icmp sgt i32 %88, %8
%129 = icmp sgt i32 %126, %8
%130 = or i1 %128, %129
%131 = select i1 %130, i32 %30, i32 %72
%132 = icmp slt i32 %131, %4
%133 = icmp slt i32 %127, %9
%134 = and i1 %132, %133
%135 = icmp slt i32 %88, %8
%136 = and i1 %135, %134
%137 = icmp slt i32 %126, %8
%138 = and i1 %137, %136
br i1 %138, label %69, label %32
139: ; preds = %32
%140 = trunc i64 %40 to i32
%141 = icmp sgt i32 %33, 0
%142 = and i1 %14, %141
br i1 %142, label %143, label %144
143: ; preds = %139
br i1 %19, label %145, label %149
144: ; preds = %139
br i1 %34, label %155, label %164
145: ; preds = %143
%146 = tail call i32 @remove_overlaps_v2(i32** %18, i32** %5, i32* %10, i32 %33, i32 3)
br i1 %34, label %147, label %164
147: ; preds = %145
%148 = getelementptr inbounds i32, i32* %6, i64 1
store i32 -1, i32* %148
br label %167
149: ; preds = %143
%150 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %33)
%151 = tail call i32 @remove_overlaps_v2(i32** %18, i32** %5, i32* %10, i32 %33, i32 3)
%152 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %151)
br i1 %34, label %153, label %164
153: ; preds = %149
%154 = getelementptr inbounds i32, i32* %6, i64 1
store i32 -1, i32* %154
br label %159
155: ; preds = %26, %144
%156 = phi i32 [ 0, %26 ], [ %33, %144 ]
%157 = phi i32 [ 0, %26 ], [ %140, %144 ]
%158 = getelementptr inbounds i32, i32* %6, i64 1
store i32 -1, i32* %158
br i1 %19, label %167, label %159
159: ; preds = %153, %155
%160 = phi i32 [ %140, %153 ], [ %157, %155 ]
%161 = phi i32 [ %33, %153 ], [ %156, %155 ]
%162 = phi i32 [ %151, %153 ], [ %156, %155 ]
%163 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0), i32 %160, i32 %3, i32 %161, i32 %9)
br label %167
164: ; preds = %26, %145, %149, %144
%165 = phi i32 [ %151, %149 ], [ %33, %144 ], [ %146, %145 ], [ 0, %26 ]
%166 = getelementptr inbounds i32, i32* %6, i64 1
store i32 0, i32* %166
br label %167
167: ; preds = %147, %155, %159, %164
%168 = phi i32 [ %156, %155 ], [ %162, %159 ], [ %165, %164 ], [ %146, %147 ]
store i32 %168, i32* %6
br i1 %14, label %169, label %171
169: ; preds = %167
%170 = tail call i32 @free_imatrix(i32** %18, i32 1, i32 %9, i32 1, i32 9)
br label %171
171: ; preds = %169, %167
ret void
}