#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 /*<<< orphan*/ dist_2v_ordered_v4(int *, int *, char *, char *, int, int,
                                      int **, int *, int, int, int, int *, int,
                                      int, int **, int);
int /*<<< orphan*/ printf(char *, ...);
int remove_overlaps_v2(int **, int **, int *, int, int);
void dist_3v_ordered_v4(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 pos_format, int **ovdi123, int **all_ovdi,
                        int **temp_ovdi, int *m12_p, char *m12_s, int verbose) {
  int n123;
  int n_123[2];
  int i;
  int curr_index;
  int n_cooc;
  for (i = 1; i <= n12; i++) {
    m12_p[i] = ovdi12_p[i][2];
    m12_s[i] = ovdi12_p[i][6];
  }
  if (verbose) {
    printf("dist_3v_ordered_v3: motif 2 (%d): ", n12);
    for (i = 1; i <= n12; i++)
      printf("%d %d,", m12_p[i], m12_s[i]);
    printf("\n");
    printf("dist_3v_ordered_v3: motif 3 (%d): ", n3);
    for (i = 1; i <= n3; i++)
      printf("%d %d,", m3_p[i], m3_s[i]);
    printf("\n");
  }
  dist_2v_ordered_v4(m12_p, m3_p, m12_s, m3_s, n12, n3, ovdi123, n_123,
                     min_dist, max_dist, max_n_ovdi, ml, get_positions,
                     pos_format, temp_ovdi, verbose);
  n123 = n_123[0];
  if (verbose)
    printf("\tn123=%d\n", n123);
  if (get_positions == 1) {
    for (i = 1; i <= n123; i++) {
      curr_index = ovdi123[i][3];
      all_ovdi[i][1] = ovdi12_p[curr_index][1];
      all_ovdi[i][2] = ovdi123[i][1];
      all_ovdi[i][3] = ovdi123[i][2];
      all_ovdi[i][4] = ovdi12_p[curr_index][3];
      all_ovdi[i][5] = ovdi12_p[curr_index][4];
      all_ovdi[i][6] = ovdi123[i][4];
      all_ovdi[i][7] = ovdi12_p[curr_index][5];
      all_ovdi[i][8] = ovdi123[i][5];
      all_ovdi[i][9] = ovdi123[i][6];
    }
  }
  if ((n123 > 0) & (get_positions == 1)) {
    n_cooc = remove_overlaps_v2(all_ovdi, ovdi, ml, n123, 3);
  } else {
    n_cooc = n123;
  }
  n[0] = n_cooc;
  n[1] = n_123[1];
}


x86 assembly (clang, -O0):
<dist_3v_ordered_v4>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    0x70(%rbp),%eax
mov    0x68(%rbp),%rax
mov    0x60(%rbp),%rax
mov    0x58(%rbp),%rax
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%rax
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,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %ecx,-0x44(%rbp)
mov    %r8d,-0x48(%rbp)
mov    %r9,-0x50(%rbp)
movl   $0x1,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     11e0 <dist_3v_ordered_v4+0xb0>
mov    -0x30(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%edx
mov    0x60(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x18(%rax),%eax
mov    %al,%dl
mov    0x68(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1190 <dist_3v_ordered_v4+0x60>
cmpl   $0x0,0x70(%rbp)
je     12b4 <dist_3v_ordered_v4+0x184>
mov    -0x44(%rbp),%esi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     1241 <dist_3v_ordered_v4+0x111>
mov    0x60(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    0x68(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1202 <dist_3v_ordered_v4+0xd2>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x48(%rbp),%eax
jg     12a6 <dist_3v_ordered_v4+0x176>
mov    -0x38(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x40(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1267 <dist_3v_ordered_v4+0x137>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x60(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    0x68(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x44(%rbp),%r8d
mov    -0x48(%rbp),%r9d
mov    0x48(%rbp),%rax
mov    %rax,-0x80(%rbp)
lea    -0x5c(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    0x18(%rbp),%r13d
mov    0x20(%rbp),%r12d
mov    0x28(%rbp),%r15d
mov    0x30(%rbp),%r14
mov    0x38(%rbp),%ebx
mov    0x40(%rbp),%r11d
mov    0x58(%rbp),%r10
mov    0x70(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,(%rsp)
mov    -0x78(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x6c(%rbp),%eax
mov    %r13d,0x10(%rsp)
mov    %r12d,0x18(%rsp)
mov    %r15d,0x20(%rsp)
mov    %r14,0x28(%rsp)
mov    %ebx,0x30(%rsp)
mov    %r11d,0x38(%rsp)
mov    %r10,0x40(%rsp)
mov    %eax,0x48(%rsp)
call   1040 <dist_2v_ordered_v4@plt>
mov    -0x5c(%rbp),%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,0x70(%rbp)
je     135d <dist_3v_ordered_v4+0x22d>
mov    -0x54(%rbp),%esi
lea    0xcf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,0x38(%rbp)
jne    14ad <dist_3v_ordered_v4+0x37d>
movl   $0x1,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x54(%rbp),%eax
jg     14a8 <dist_3v_ordered_v4+0x378>
mov    0x48(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x4(%rax),%ecx
mov    0x50(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x4(%rax)
mov    0x48(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x4(%rax),%ecx
mov    0x50(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x8(%rax)
mov    0x48(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%ecx
mov    0x50(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0xc(%rax)
mov    -0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0xc(%rax),%ecx
mov    0x50(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x10(%rax)
mov    -0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x10(%rax),%ecx
mov    0x50(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x14(%rax)
mov    0x48(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x10(%rax),%ecx
mov    0x50(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x18(%rax)
mov    -0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x14(%rax),%ecx
mov    0x50(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x1c(%rax)
mov    0x48(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x14(%rax),%ecx
mov    0x50(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x20(%rax)
mov    0x48(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x18(%rax),%ecx
mov    0x50(%rbp),%rax
movslq -0x60(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x24(%rax)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    136e <dist_3v_ordered_v4+0x23e>
jmp    14ad <dist_3v_ordered_v4+0x37d>
cmpl   $0x0,-0x54(%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     14f3 <dist_3v_ordered_v4+0x3c3>
mov    0x50(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    0x30(%rbp),%rdx
mov    -0x54(%rbp),%ecx
mov    $0x3,%r8d
call   1050 <remove_overlaps_v2@plt>
mov    %eax,-0x68(%rbp)
jmp    14f9 <dist_3v_ordered_v4+0x3c9>
mov    -0x54(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x58(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist_3v_ordered_v4>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x30(%rsp)
mov    %r8,0x8(%rsp)
mov    %ecx,%r8d
mov    %rdx,%r9
mov    %rdi,%r14
mov    0xd0(%rsp),%r15d
mov    0xc8(%rsp),%rdx
mov    0xc0(%rsp),%rdi
mov    0x98(%rsp),%ebx
mov    0x90(%rsp),%r13
mov    0x80(%rsp),%r11d
mov    0x78(%rsp),%r10d
test   %ecx,%ecx
jle    127e <dist_3v_ordered_v4+0x13e>
mov    %r8d,%ebp
mov    $0x1,%ecx
cmp    $0x1,%r8d
je     11f7 <dist_3v_ordered_v4+0xb7>
mov    %ebp,%r12d
and    $0xfffffffe,%r12d
neg    %r12
mov    $0x1,%ecx
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rcx,8),%rbx
mov    0x8(%rbx),%eax
mov    %eax,(%rdi,%rcx,4)
movzbl 0x18(%rbx),%ebx
mov    %bl,(%rdx,%rcx,1)
mov    0x8(%r14,%rcx,8),%rbx
mov    0x8(%rbx),%eax
mov    %eax,0x4(%rdi,%rcx,4)
movzbl 0x18(%rbx),%ebx
mov    %bl,0x1(%rdx,%rcx,1)
lea    (%r12,%rcx,1),%rax
add    $0x2,%rax
add    $0x2,%rcx
cmp    $0x1,%rax
jne    11c0 <dist_3v_ordered_v4+0x80>
test   $0x1,%bpl
je     120d <dist_3v_ordered_v4+0xcd>
mov    (%r14,%rcx,8),%rax
mov    0x8(%rax),%ebx
mov    %ebx,(%rdi,%rcx,4)
mov    0x18(%rax),%al
mov    %al,(%rdx,%rcx,1)
test   %r15d,%r15d
mov    0x98(%rsp),%ebx
je     13a6 <dist_3v_ordered_v4+0x266>
mov    %rdi,%r15
mov    %rdx,%r12
mov    %rsi,0x28(%rsp)
mov    %r9,0x20(%rsp)
lea    0xdcc(%rip),%rdi
mov    %r8d,%esi
xor    %eax,%eax
mov    %r8,%rbx
call   1040 <printf@plt>
mov    %rbx,0x18(%rsp)
test   %ebx,%ebx
jle    12a7 <dist_3v_ordered_v4+0x167>
mov    0x18(%rsp),%rax
lea    0x1(%rax),%ebp
mov    $0x1,%ebx
lea    0xdc5(%rip),%r13
xchg   %ax,%ax
mov    (%r15,%rbx,4),%esi
movsbl (%r12,%rbx,1),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1260 <dist_3v_ordered_v4+0x120>
jmp    12a7 <dist_3v_ordered_v4+0x167>
test   %r15d,%r15d
je     13a6 <dist_3v_ordered_v4+0x266>
mov    %rsi,0x28(%rsp)
mov    %r9,0x20(%rsp)
lea    0xd68(%rip),%rdi
mov    %r8,0x18(%rsp)
mov    %r8d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd72(%rip),%rdi
mov    0x8(%rsp),%rbx
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
mov    0x20(%rsp),%r15
mov    0x28(%rsp),%r12
jle    130c <dist_3v_ordered_v4+0x1cc>
mov    0x8(%rsp),%rax
lea    0x1(%rax),%ebx
mov    $0x1,%ebp
lea    0xd3b(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbp,4),%esi
movsbl (%r15,%rbp,1),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12f0 <dist_3v_ordered_v4+0x1b0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x10(%rsp),%r10
mov    0xc0(%rsp),%rdi
mov    %r12,%rsi
mov    0xc8(%rsp),%rdx
mov    %r15,%rcx
mov    0x18(%rsp),%r8
mov    0x8(%rsp),%r9
mov    0xd0(%rsp),%eax
push   %rax
push   0xc0(%rsp)
mov    0xb0(%rsp),%eax
push   %rax
mov    0xb0(%rsp),%ebx
push   %rbx
mov    0xb0(%rsp),%r13
push   %r13
mov    0xb0(%rsp),%eax
push   %rax
mov    0xb0(%rsp),%eax
push   %rax
mov    0xb0(%rsp),%eax
push   %rax
push   %r10
push   0xf0(%rsp)
call   1050 <dist_2v_ordered_v4@plt>
add    $0x50,%rsp
mov    0x10(%rsp),%r12d
lea    0xcb3(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13e9 <dist_3v_ordered_v4+0x2a9>
lea    0x10(%rsp),%rbp
mov    %r9,%rcx
mov    0x8(%rsp),%r9
push   $0x0
push   0xc0(%rsp)
mov    0xb0(%rsp),%eax
push   %rax
push   %rbx
push   %r13
mov    0xb0(%rsp),%eax
push   %rax
push   %r11
push   %r10
push   %rbp
push   0xf0(%rsp)
call   1050 <dist_2v_ordered_v4@plt>
add    $0x50,%rsp
mov    0x10(%rsp),%r12d
mov    0x30(%rsp),%rsi
mov    0x70(%rsp),%r15
cmp    $0x1,%ebx
jne    148c <dist_3v_ordered_v4+0x34c>
test   %r12d,%r12d
jle    148c <dist_3v_ordered_v4+0x34c>
mov    0xb0(%rsp),%rdi
lea    0x1(%r12),%r8d
mov    $0x1,%ecx
mov    0xa8(%rsp),%r9
nop
mov    (%r9,%rcx,8),%rax
movslq 0xc(%rax),%rbp
mov    (%r14,%rbp,8),%r10
mov    0x4(%r10),%ebx
mov    (%rdi,%rcx,8),%rbp
mov    %ebx,0x4(%rbp)
mov    0x4(%rax),%ebx
mov    %ebx,0x8(%rbp)
mov    0x8(%rax),%ebx
mov    %ebx,0xc(%rbp)
mov    0xc(%r10),%ebx
mov    %ebx,0x10(%rbp)
mov    0x10(%r10),%ebx
mov    %ebx,0x14(%rbp)
mov    0x10(%rax),%ebx
mov    %ebx,0x18(%rbp)
mov    0x14(%r10),%ebx
mov    %ebx,0x1c(%rbp)
mov    0x14(%rax),%ebx
mov    %ebx,0x20(%rbp)
mov    0x18(%rax),%eax
mov    %eax,0x24(%rbp)
add    $0x1,%rcx
cmp    %rcx,%r8
jne    1420 <dist_3v_ordered_v4+0x2e0>
test   %r12d,%r12d
jle    148c <dist_3v_ordered_v4+0x34c>
mov    %r13,%rdx
mov    %r12d,%ecx
mov    $0x3,%r8d
call   1060 <remove_overlaps_v2@plt>
mov    %eax,%r12d
mov    %r12d,(%r15)
mov    0x14(%rsp),%eax
mov    %eax,0x4(%r15)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"dist_3v_ordered_v3: motif 2 (%d): \00"
@.str.1 = [7 x i8] c"%d %d,\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [35 x i8] c"dist_3v_ordered_v3: motif 3 (%d): \00"
@.str.4 = [10 x i8] c"\09n123=%d\0A\00"
define void @dist_3v_ordered_v4(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, i32** %13, i32** %14, i32** %15, i32* %16, i8* %17, i32 %18) {
%20 = alloca i32**
%21 = alloca i32*
%22 = alloca i8*
%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 i32
%33 = alloca i32**
%34 = alloca i32**
%35 = alloca i32**
%36 = alloca i32*
%37 = alloca i8*
%38 = alloca i32
%39 = alloca i32
%40 = alloca [2 x i32]
%41 = alloca i32
%42 = alloca i32
%43 = alloca i32
store i32** %0, i32*** %20
store i32* %1, i32** %21
store i8* %2, i8** %22
store i32 %3, i32* %23
store i32 %4, i32* %24
store i32** %5, i32*** %25
store i32* %6, i32** %26
store i32 %7, i32* %27
store i32 %8, i32* %28
store i32 %9, i32* %29
store i32* %10, i32** %30
store i32 %11, i32* %31
store i32 %12, i32* %32
store i32** %13, i32*** %33
store i32** %14, i32*** %34
store i32** %15, i32*** %35
store i32* %16, i32** %36
store i8* %17, i8** %37
store i32 %18, i32* %38
store i32 1, i32* %41
br label %44
44: ; preds = %72, %19
%45 = load i32, i32* %41
%46 = load i32, i32* %23
%47 = icmp sle i32 %45, %46
br i1 %47, label %48, label %75
48: ; preds = %44
%49 = load i32**, i32*** %20
%50 = load i32, i32* %41
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32*, i32** %49, i64 %51
%53 = load i32*, i32** %52
%54 = getelementptr inbounds i32, i32* %53, i64 2
%55 = load i32, i32* %54
%56 = load i32*, i32** %36
%57 = load i32, i32* %41
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %56, i64 %58
store i32 %55, i32* %59
%60 = load i32**, i32*** %20
%61 = load i32, i32* %41
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32*, i32** %60, i64 %62
%64 = load i32*, i32** %63
%65 = getelementptr inbounds i32, i32* %64, i64 6
%66 = load i32, i32* %65
%67 = trunc i32 %66 to i8
%68 = load i8*, i8** %37
%69 = load i32, i32* %41
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %68, i64 %70
store i8 %67, i8* %71
br label %72
72: ; preds = %48
%73 = load i32, i32* %41
%74 = add nsw i32 %73, 1
store i32 %74, i32* %41
br label %44
75: ; preds = %44
%76 = load i32, i32* %38
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %127
78: ; preds = %75
%79 = load i32, i32* %23
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %79)
store i32 1, i32* %41
br label %81
81: ; preds = %98, %78
%82 = load i32, i32* %41
%83 = load i32, i32* %23
%84 = icmp sle i32 %82, %83
br i1 %84, label %85, label %101
85: ; preds = %81
%86 = load i32*, i32** %36
%87 = load i32, i32* %41
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i32, i32* %86, i64 %88
%90 = load i32, i32* %89
%91 = load i8*, i8** %37
%92 = load i32, i32* %41
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %91, i64 %93
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %90, i32 %96)
br label %98
98: ; preds = %85
%99 = load i32, i32* %41
%100 = add nsw i32 %99, 1
store i32 %100, i32* %41
br label %81
101: ; preds = %81
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%103 = load i32, i32* %24
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %103)
store i32 1, i32* %41
br label %105
105: ; preds = %122, %101
%106 = load i32, i32* %41
%107 = load i32, i32* %24
%108 = icmp sle i32 %106, %107
br i1 %108, label %109, label %125
109: ; preds = %105
%110 = load i32*, i32** %21
%111 = load i32, i32* %41
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i32, i32* %110, i64 %112
%114 = load i32, i32* %113
%115 = load i8*, i8** %22
%116 = load i32, i32* %41
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8, i8* %115, i64 %117
%119 = load i8, i8* %118
%120 = sext i8 %119 to i32
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %114, i32 %120)
br label %122
122: ; preds = %109
%123 = load i32, i32* %41
%124 = add nsw i32 %123, 1
store i32 %124, i32* %41
br label %105
125: ; preds = %105
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %127
127: ; preds = %125, %75
%128 = load i32*, i32** %36
%129 = load i32*, i32** %21
%130 = load i8*, i8** %37
%131 = load i8*, i8** %22
%132 = load i32, i32* %23
%133 = load i32, i32* %24
%134 = load i32**, i32*** %33
%135 = getelementptr inbounds [2 x i32], [2 x i32]* %40, i64 0, i64 0
%136 = load i32, i32* %27
%137 = load i32, i32* %28
%138 = load i32, i32* %29
%139 = load i32*, i32** %30
%140 = load i32, i32* %31
%141 = load i32, i32* %32
%142 = load i32**, i32*** %35
%143 = load i32, i32* %38
%144 = call i32 @dist_2v_ordered_v4(i32* %128, i32* %129, i8* %130, i8* %131, i32 %132, i32 %133, i32** %134, i32* %135, i32 %136, i32 %137, i32 %138, i32* %139, i32 %140, i32 %141, i32** %142, i32 %143)
%145 = getelementptr inbounds [2 x i32], [2 x i32]* %40, i64 0, i64 0
%146 = load i32, i32* %145
store i32 %146, i32* %39
%147 = load i32, i32* %38
%148 = icmp ne i32 %147, 0
br i1 %148, label %149, label %152
149: ; preds = %127
%150 = load i32, i32* %39
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %150)
br label %152
152: ; preds = %149, %127
%153 = load i32, i32* %31
%154 = icmp eq i32 %153, 1
br i1 %154, label %155, label %289
155: ; preds = %152
store i32 1, i32* %41
br label %156
156: ; preds = %285, %155
%157 = load i32, i32* %41
%158 = load i32, i32* %39
%159 = icmp sle i32 %157, %158
br i1 %159, label %160, label %288
160: ; preds = %156
%161 = load i32**, i32*** %33
%162 = load i32, i32* %41
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds i32*, i32** %161, i64 %163
%165 = load i32*, i32** %164
%166 = getelementptr inbounds i32, i32* %165, i64 3
%167 = load i32, i32* %166
store i32 %167, i32* %42
%168 = load i32**, i32*** %20
%169 = load i32, i32* %42
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds i32*, i32** %168, i64 %170
%172 = load i32*, i32** %171
%173 = getelementptr inbounds i32, i32* %172, i64 1
%174 = load i32, i32* %173
%175 = load i32**, i32*** %34
%176 = load i32, i32* %41
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds i32*, i32** %175, i64 %177
%179 = load i32*, i32** %178
%180 = getelementptr inbounds i32, i32* %179, i64 1
store i32 %174, i32* %180
%181 = load i32**, i32*** %33
%182 = load i32, i32* %41
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds i32*, i32** %181, i64 %183
%185 = load i32*, i32** %184
%186 = getelementptr inbounds i32, i32* %185, i64 1
%187 = load i32, i32* %186
%188 = load i32**, i32*** %34
%189 = load i32, i32* %41
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i32*, i32** %188, i64 %190
%192 = load i32*, i32** %191
%193 = getelementptr inbounds i32, i32* %192, i64 2
store i32 %187, i32* %193
%194 = load i32**, i32*** %33
%195 = load i32, i32* %41
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds i32*, i32** %194, i64 %196
%198 = load i32*, i32** %197
%199 = getelementptr inbounds i32, i32* %198, i64 2
%200 = load i32, i32* %199
%201 = load i32**, i32*** %34
%202 = load i32, i32* %41
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds i32*, i32** %201, i64 %203
%205 = load i32*, i32** %204
%206 = getelementptr inbounds i32, i32* %205, i64 3
store i32 %200, i32* %206
%207 = load i32**, i32*** %20
%208 = load i32, i32* %42
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds i32*, i32** %207, i64 %209
%211 = load i32*, i32** %210
%212 = getelementptr inbounds i32, i32* %211, i64 3
%213 = load i32, i32* %212
%214 = load i32**, i32*** %34
%215 = load i32, i32* %41
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds i32*, i32** %214, i64 %216
%218 = load i32*, i32** %217
%219 = getelementptr inbounds i32, i32* %218, i64 4
store i32 %213, i32* %219
%220 = load i32**, i32*** %20
%221 = load i32, i32* %42
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds i32*, i32** %220, i64 %222
%224 = load i32*, i32** %223
%225 = getelementptr inbounds i32, i32* %224, i64 4
%226 = load i32, i32* %225
%227 = load i32**, i32*** %34
%228 = load i32, i32* %41
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds i32*, i32** %227, i64 %229
%231 = load i32*, i32** %230
%232 = getelementptr inbounds i32, i32* %231, i64 5
store i32 %226, i32* %232
%233 = load i32**, i32*** %33
%234 = load i32, i32* %41
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds i32*, i32** %233, i64 %235
%237 = load i32*, i32** %236
%238 = getelementptr inbounds i32, i32* %237, i64 4
%239 = load i32, i32* %238
%240 = load i32**, i32*** %34
%241 = load i32, i32* %41
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds i32*, i32** %240, i64 %242
%244 = load i32*, i32** %243
%245 = getelementptr inbounds i32, i32* %244, i64 6
store i32 %239, i32* %245
%246 = load i32**, i32*** %20
%247 = load i32, i32* %42
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds i32*, i32** %246, i64 %248
%250 = load i32*, i32** %249
%251 = getelementptr inbounds i32, i32* %250, i64 5
%252 = load i32, i32* %251
%253 = load i32**, i32*** %34
%254 = load i32, i32* %41
%255 = sext i32 %254 to i64
%256 = getelementptr inbounds i32*, i32** %253, i64 %255
%257 = load i32*, i32** %256
%258 = getelementptr inbounds i32, i32* %257, i64 7
store i32 %252, i32* %258
%259 = load i32**, i32*** %33
%260 = load i32, i32* %41
%261 = sext i32 %260 to i64
%262 = getelementptr inbounds i32*, i32** %259, i64 %261
%263 = load i32*, i32** %262
%264 = getelementptr inbounds i32, i32* %263, i64 5
%265 = load i32, i32* %264
%266 = load i32**, i32*** %34
%267 = load i32, i32* %41
%268 = sext i32 %267 to i64
%269 = getelementptr inbounds i32*, i32** %266, i64 %268
%270 = load i32*, i32** %269
%271 = getelementptr inbounds i32, i32* %270, i64 8
store i32 %265, i32* %271
%272 = load i32**, i32*** %33
%273 = load i32, i32* %41
%274 = sext i32 %273 to i64
%275 = getelementptr inbounds i32*, i32** %272, i64 %274
%276 = load i32*, i32** %275
%277 = getelementptr inbounds i32, i32* %276, i64 6
%278 = load i32, i32* %277
%279 = load i32**, i32*** %34
%280 = load i32, i32* %41
%281 = sext i32 %280 to i64
%282 = getelementptr inbounds i32*, i32** %279, i64 %281
%283 = load i32*, i32** %282
%284 = getelementptr inbounds i32, i32* %283, i64 9
store i32 %278, i32* %284
br label %285
285: ; preds = %160
%286 = load i32, i32* %41
%287 = add nsw i32 %286, 1
store i32 %287, i32* %41
br label %156
288: ; preds = %156
br label %289
289: ; preds = %288, %152
%290 = load i32, i32* %39
%291 = icmp sgt i32 %290, 0
%292 = zext i1 %291 to i32
%293 = load i32, i32* %31
%294 = icmp eq i32 %293, 1
%295 = zext i1 %294 to i32
%296 = and i32 %292, %295
%297 = icmp ne i32 %296, 0
br i1 %297, label %298, label %304
298: ; preds = %289
%299 = load i32**, i32*** %34
%300 = load i32**, i32*** %25
%301 = load i32*, i32** %30
%302 = load i32, i32* %39
%303 = call i32 @remove_overlaps_v2(i32** %299, i32** %300, i32* %301, i32 %302, i32 3)
store i32 %303, i32* %43
br label %306
304: ; preds = %289
%305 = load i32, i32* %39
store i32 %305, i32* %43
br label %306
306: ; preds = %304, %298
%307 = load i32, i32* %43
%308 = load i32*, i32** %26
%309 = getelementptr inbounds i32, i32* %308, i64 0
store i32 %307, i32* %309
%310 = getelementptr inbounds [2 x i32], [2 x i32]* %40, i64 0, i64 1
%311 = load i32, i32* %310
%312 = load i32*, i32** %26
%313 = getelementptr inbounds i32, i32* %312, i64 1
store i32 %311, i32* %313
ret void
}

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