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

```asm
<inv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  movslq %esi,%r13
  push   %r12
  lea    0x1(%r13),%eax
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  cmp    %edx,%eax
  je     L32
  lea    0x0(%r13,%rdx,1),%eax
  mov    %edx,%ebx
  mov    %rdi,%r12
  mov    %r13d,%esi
  mov    %eax,%ebp
  mov    %ebx,%r15d
  shr    $0x1f,%ebp
  sub    %r13d,%r15d
  add    %eax,%ebp
  sar    %ebp
  mov    %ebp,%edx
  call   <inv>
  mov    %ebx,%edx
  mov    %ebp,%esi
  mov    %r12,%rdi
  call   <inv>
  lea    0x0(,%r15,4),%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  test   %r15d,%r15d
  jle    L10
  mov    0x8(%rsp),%rax
  mov    %rax,%r14
  lea    (%rax,%r15,8),%r15
  nopl   0x0(%rax,%rax,1)
L30:
  mov    $0x8,%edi
  add    $0x8,%r14
  call   <malloc@plt>
  mov    %rax,-0x8(%r14)
  cmp    %r14,%r15
  jne    L30
L10:
  cmp    %ebp,%ebx
  jg     L90
  cmp    %ebp,%r13d
  jge    L32
L90:
  mov    0x8(%rsp),%rdi
  mov    %ebp,%r8d
  mov    %r13d,%edx
  mov    $0x1,%esi
  mov    %rdi,%rax
  jmp    L164
  nopl   0x0(%rax)
L99:
  movslq %edx,%r9
  add    $0x1,%edx
  mov    (%r12,%r9,8),%r9
  mov    (%r9),%r11d
  mov    %r11d,(%rcx)
  mov    0x4(%r9),%r9d
L33:
  mov    %r9d,0x4(%rcx)
  cmp    %ebp,%edx
  jl     L171
  cmp    %ebx,%r8d
  jge    L28
L171:
  add    $0x8,%rdi
  add    $0x1,%esi
L164:
  mov    (%rdi),%rcx
  lea    -0x1(%rsi),%r10d
  cmp    %r8d,%ebx
  jle    L99
  movslq %r8d,%r9
  mov    (%r12,%r9,8),%r9
  cmp    %edx,%ebp
  jg     L114
  mov    (%r9),%r11d
  add    $0x1,%r8d
  mov    %r11d,(%rcx)
  mov    0x4(%r9),%r9d
  jmp    L33
  nopw   0x0(%rax,%rax,1)
L114:
  movslq %edx,%r10
  mov    0x4(%r9),%r11d
  mov    (%r12,%r10,8),%r10
  cmp    %r11d,0x4(%r10)
  jle    L85
  mov    (%r10),%r9d
  add    $0x1,%edx
  mov    %r9d,(%rcx)
  mov    0x4(%r10),%r9d
L4:
  mov    %r9d,0x4(%rcx)
  jmp    L171
  nopl   0x0(%rax)
L28:
  mov    0x8(%rsp),%rbx
  lea    (%r12,%r13,8),%rdi
  lea    0x8(%rbx,%r10,8),%r8
  sub    %rbx,%rdi
  nopl   0x0(%rax)
L67:
  mov    (%rax),%rcx
  mov    (%rdi,%rax,1),%rdx
  add    $0x8,%rax
  mov    (%rcx),%esi
  mov    %esi,(%rdx)
  mov    0x4(%rcx),%ecx
  mov    %ecx,0x4(%rdx)
  cmp    %r8,%rax
  jne    L67
L32:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L85:
  mov    (%r9),%r11d
  jge    L8
L169:
  mov    %r11d,(%rcx)
  add    $0x1,%r8d
  mov    0x4(%r9),%r9d
  jmp    L4
  nopw   0x0(%rax,%rax,1)
L8:
  mov    (%r10),%r15d
  cmp    %r11d,%r15d
  jge    L169
  mov    %r15d,(%rcx)
  add    $0x1,%edx
  mov    0x4(%r10),%r9d
  jmp    L4
```

assistant: ```c
void inv(int **arr, int a, int b) {
  if (b == a + 1) {
    return;
  }
  int m = (a + b) / 2;
  inv(arr, a, m);
  inv(arr, m, b);
  int i, j, k = 0;
  int **temp = (int **)malloc((b - a) * sizeof(int));
  for (i = 0; i < (b - a); i++) {
    temp[i] = (int *)malloc(2 * sizeof(int));
  }
  for (i = a, j = m; i < m || j < b;) {
    if (j >= b) {
      temp[k][0] = arr[i][0];
      temp[k][1] = arr[i][1];
      i++;
    } else if (i >= m) {
      temp[k][0] = arr[j][0];
      temp[k][1] = arr[j][1];
      j++;
    } else {
      if (arr[i][1] > arr[j][1]) {
        temp[k][0] = arr[i][0];
        temp[k][1] = arr[i][1];
        i++;
      } else if (arr[i][1] < arr[j][1]) {
        temp[k][0] = arr[j][0];
        temp[k][1] = arr[j][1];
        j++;
      } else {
        if (arr[i][0] < arr[j][0]) {
          temp[k][0] = arr[i][0];
          temp[k][1] = arr[i][1];
          i++;
        } else {
          temp[k][0] = arr[j][0];
          temp[k][1] = arr[j][1];
          j++;
        }
      }
    }
    k++;
  }
  for (i = 0; i < k; i++) {
    arr[a + i][0] = temp[i][0];
    arr[a + i][1] = temp[i][1];
  }
}
```