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

```asm
<LMSpostproc2_64>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  setg   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L79
L67:
  notq   -0x18(%rbp)
  mov    -0x30(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jg     L104
  addq   $0x1,-0x8(%rbp)
L104:
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x18(%rbp),%rax
  mov    %rax,(%rdx)
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  cmp    %rax,-0x30(%rbp)
  setg   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  addq   $0x1,-0x20(%rbp)
L79:
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  js     L67
  mov    -0x20(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jge    L143
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  addq   $0x1,-0x20(%rbp)
L85:
  mov    -0x20(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  setl   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jns    L49
  notq   -0x18(%rbp)
  mov    -0x30(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jg     L82
  addq   $0x1,-0x8(%rbp)
L82:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x18(%rbp),%rax
  mov    %rax,(%rdx)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movq   $0x0,(%rax)
  mov    -0x10(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  je     L48
L49:
  addq   $0x1,-0x20(%rbp)
  jmp    L85
L48:
  nop
L143:
  mov    -0x8(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jge    L98
  mov    -0x38(%rbp),%rax
  sub    $0x1,%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
  jmp    L71
L115:
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  jl     L56
  mov    -0x30(%rbp),%rax
  sub    %rax,-0x18(%rbp)
  subq   $0x1,-0x10(%rbp)
L56:
  mov    -0x18(%rbp),%rax
  sar    %rax
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%rax
  mov    %rax,(%rdx)
  subq   $0x1,-0x20(%rbp)
L71:
  cmpq   $0x0,-0x20(%rbp)
  jns    L115
  jmp    L97
L98:
  movq   $0x0,-0x20(%rbp)
  jmp    L157
L114:
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  jl     L78
  mov    -0x30(%rbp),%rax
  sub    %rax,-0x18(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x18(%rbp),%rax
  mov    %rax,(%rdx)
L78:
  addq   $0x1,-0x20(%rbp)
L157:
  mov    -0x20(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jl     L114
L97:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
long long LMSpostproc2_64(long long *SA, long long n, long long m) {
  long long i, j, d, name;
  assert(0 < n);
  for (i = 0, name = 0; (j = SA[i]) < 0; ++i) {
    j = ~j;
    if (n <= j) {
      name += 1;
    }
    SA[i] = j;
    assert((i + 1) < n);
  }
  if (i < m) {
    for (d = i, ++i;; ++i) {
      assert(i < n);
      if ((j = SA[i]) < 0) {
        j = ~j;
        if (n <= j) {
          name += 1;
        }
        SA[d++] = j;
        SA[i] = 0;
        if (d == m) {
          break;
        }
      }
    }
  }
  if (name < m) {
    for (i = m - 1, d = name + 1; 0 <= i; --i) {
      if (n <= (j = SA[i])) {
        j -= n;
        --d;
      }
      SA[m + (j >> 1)] = d;
    }
  } else {
    for (i = 0; i < m; ++i) {
      if (n <= (j = SA[i])) {
        j -= n;
        SA[i] = j;
      }
    }
  }
  return name;
}
```