user: Please show me the C implementation that matches the assembly code listed below:

```asm
<dist_3v_ordered_v4>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %ecx,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x68,%rsp
  mov    0xa0(%rsp),%rax
  mov    %rdx,0x10(%rsp)
  mov    %r8d,0x40(%rsp)
  mov    0xf0(%rsp),%r14
  mov    %rax,0x18(%rsp)
  mov    0xc0(%rsp),%rax
  mov    %r9,0x30(%rsp)
  mov    0xf8(%rsp),%r12
  mov    %rax,(%rsp)
  mov    0xd8(%rsp),%rax
  mov    %rax,0x8(%rsp)
  mov    0xe0(%rsp),%rax
  mov    %rax,0x28(%rsp)
  mov    0xe8(%rsp),%rax
  mov    %rax,0x20(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  test   %ecx,%ecx
  jle    L22
  lea    0x1(%rcx),%esi
  mov    $0x1,%eax
  nopl   0x0(%rax)
L32:
  mov    (%rbx,%rax,8),%rdx
  mov    0x8(%rdx),%ecx
  mov    %ecx,(%r14,%rax,4)
  mov    0x18(%rdx),%edx
  mov    %dl,(%r12,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L32
  mov    0x100(%rsp),%eax
  test   %eax,%eax
  jne    L111
L123:
  push   $0x0
  mov    %r12,%rdx
  mov    %ebp,%r8d
  mov    %r13,%rsi
  push   0x28(%rsp)
  mov    0xe0(%rsp),%eax
  mov    %r14,%rdi
  push   %rax
  mov    0xe0(%rsp),%eax
  push   %rax
  push   0x20(%rsp)
  mov    0xe0(%rsp),%eax
  push   %rax
  mov    0xe0(%rsp),%eax
  push   %rax
  mov    0xe0(%rsp),%eax
  push   %rax
  lea    0x90(%rsp),%rax
  push   %rax
  push   0x50(%rsp)
  mov    0x90(%rsp),%r9d
  mov    0x60(%rsp),%rcx
  call   <dist_2v_ordered_v4@plt>
  mov    0xa0(%rsp),%r12d
  add    $0x50,%rsp
L50:
  cmpl   $0x1,0xc8(%rsp)
  je     L17
L121:
  mov    0x18(%rsp),%rdi
  mov    0x54(%rsp),%eax
  mov    %r12d,(%rdi)
  mov    %eax,0x4(%rdi)
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L75
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L17:
  test   %r12d,%r12d
  jle    L121
  mov    0x8(%rsp),%r9
  mov    0x28(%rsp),%r10
  lea    0x1(%r12),%edi
  mov    $0x1,%ecx
  nopl   0x0(%rax)
L10:
  mov    (%r9,%rcx,8),%rdx
  movslq 0xc(%rdx),%rax
  mov    (%rbx,%rax,8),%rsi
  mov    (%r10,%rcx,8),%rax
  add    $0x1,%rcx
  mov    0x4(%rsi),%r8d
  mov    %r8d,0x4(%rax)
  mov    0x4(%rdx),%r8d
  mov    %r8d,0x8(%rax)
  mov    0x8(%rdx),%r8d
  mov    %r8d,0xc(%rax)
  mov    0xc(%rsi),%r8d
  mov    %r8d,0x10(%rax)
  mov    0x10(%rsi),%r8d
  mov    %r8d,0x14(%rax)
  mov    0x10(%rdx),%r8d
  mov    %r8d,0x18(%rax)
  mov    0x14(%rsi),%esi
  mov    %esi,0x1c(%rax)
  mov    0x14(%rdx),%esi
  mov    %esi,0x20(%rax)
  mov    0x18(%rdx),%edx
  mov    %edx,0x24(%rax)
  cmp    %rdi,%rcx
  jne    L10
  mov    (%rsp),%rdx
  mov    0x30(%rsp),%rsi
  mov    %r12d,%ecx
  mov    $0x3,%r8d
  mov    0x28(%rsp),%rdi
  call   <remove_overlaps_v2@plt>
  mov    %eax,%r12d
  jmp    L121
  nop
L111:
  mov    %ebp,%esi
  lea    D16(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D43(%rip),%r15
  mov    %r14,%rax
  mov    $0x1,%ecx
  mov    %rbx,0x38(%rsp)
  mov    %r13,%r14
  mov    %r15,%rbx
  mov    %rax,%r13
  mov    %rcx,%r15
L38:
  movsbl (%r12,%r15,1),%edx
  mov    0x0(%r13,%r15,4),%esi
  mov    %rbx,%rdi
  xor    %eax,%eax
  add    $0x1,%r15
  call   <printf@plt>
  cmp    %r15d,%ebp
  jge    L38
  mov    %r13,%rax
  mov    0x38(%rsp),%rbx
  mov    %r14,%r13
  mov    %rax,%r14
L93:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x40(%rsp),%r15d
  lea    D18(%rip),%rdi
  xor    %eax,%eax
  mov    %r15d,%esi
  call   <printf@plt>
  mov    %r15d,%eax
  test   %r15d,%r15d
  jle    L98
  lea    D43(%rip),%r15
  mov    %rbx,0x38(%rsp)
  mov    $0x1,%ecx
  mov    %r15,%rbx
  mov    0x10(%rsp),%r15
  mov    %ebp,0x44(%rsp)
  mov    %rcx,%rbp
  mov    %r12,0x48(%rsp)
  mov    %r13,%r12
  mov    %eax,%r13d
  xchg   %ax,%ax
L74:
  movsbl (%r15,%rbp,1),%edx
  mov    (%r12,%rbp,4),%esi
  mov    %rbx,%rdi
  xor    %eax,%eax
  add    $0x1,%rbp
  call   <printf@plt>
  cmp    %ebp,%r13d
  jge    L74
  mov    %r12,%r13
  mov    0x38(%rsp),%rbx
  mov    0x44(%rsp),%ebp
  mov    0x48(%rsp),%r12
L98:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %r14,%rdi
  mov    0x100(%rsp),%eax
  mov    %ebp,%r8d
  push   %rax
  push   0x28(%rsp)
  mov    0xe0(%rsp),%eax
  push   %rax
  mov    0xe0(%rsp),%eax
  push   %rax
  push   0x20(%rsp)
  mov    0xe0(%rsp),%eax
  push   %rax
  mov    0xe0(%rsp),%eax
  push   %rax
  mov    0xe0(%rsp),%eax
  push   %rax
  lea    0x90(%rsp),%rax
  push   %rax
  push   0x50(%rsp)
  mov    0x90(%rsp),%r9d
  mov    0x60(%rsp),%rcx
  call   <dist_2v_ordered_v4@plt>
  mov    0xa0(%rsp),%r12d
  lea    D31(%rip),%rdi
  xor    %eax,%eax
  add    $0x50,%rsp
  mov    %r12d,%esi
  call   <printf@plt>
  jmp    L50
  nopl   0x0(%rax)
L22:
  mov    0x100(%rsp),%edx
  test   %edx,%edx
  je     L123
  mov    %ebp,%esi
  lea    D16(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L93
L75:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D16
type_guessed: string
name: unpack_data
arguments: data_label: D43
type_guessed: string
name: unpack_data
arguments: data_label: D18
type_guessed: string
name: unpack_data
arguments: data_label: D31
type_guessed: string

tool: D16: dist_3v_ordered_v3: motif 2 (%d): 

tool: D43: %d %d,

tool: D18: dist_3v_ordered_v3: motif 3 (%d): 

tool: D31: 	n123=%d


assistant: ```c
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];
}
```