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

```asm
<mp_mul>:
  endbr64
  push   %r15
  mov    %rcx,%r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,(%rsp)
  cmp    %r8,%rcx
  jae    L86
  mov    %r8,%r15
  mov    %rcx,%r13
  mov    %rdx,%r12
  mov    %rsi,%r14
L86:
  cmp    $0x1f,%r15
  jbe    L64
  cmp    $0x1f,%r13
  jbe    L64
  mov    %r15,%rax
  or     %r13,%rax
  cmp    $0x7f,%rax
  jbe    L88
  cmp    $0x7f,%r15
  jbe    L77
  cmp    $0x7f,%r13
  jbe    L77
  lea    0x2(%r13),%rdx
  lea    0x2(%r15),%rcx
  movabs $0xaaaaaaaaaaaaaaab,%rdi
  mov    %rdx,%rax
  mul    %rdi
  mov    %rcx,%rax
  mov    %rdx,%rsi
  mul    %rdi
  shr    %rsi
  shr    %rdx
  cmp    %rdx,%rsi
  je     L10
L77:
  mov    (%rsp),%rdi
  lea    (%r15,%r13,1),%rax
  mov    %r12,%rsi
  mov    %r13,%r8
  mov    %r13,%rcx
  mov    %r14,%rdx
  mov    %r15,%rbx
  mov    %rax,0x18(%rsp)
  mov    %rax,0x10(%rsp)
  sub    %r13,%rbx
  call   <mp_mul>
  lea    0x0(%r13,%r13,1),%rax
  mov    %rax,0x8(%rsp)
  add    %rax,%r12
  cmp    %rbx,%r13
  jae    L169
  lea    0x0(,%r13,4),%rsi
  mov    $0x1,%edi
  xor    %eax,%eax
  call   <mp_calloc@plt>
  movslq %eax,%r15
L124:
  xor    %ebp,%ebp
L35:
  mov    %r12,%rsi
  mov    %r13,%r8
  mov    %r13,%rcx
  mov    %r14,%rdx
  mov    %r15,%rdi
  add    %r13,%rbp
  call   <mp_mul>
  lea    0x0(%r13,%rbx,1),%rcx
  mov    %r15,%rdx
  sub    %r13,%rbx
  mov    %rax,%r8
  mov    (%rsp),%rax
  lea    (%rax,%rbp,2),%rdi
  xor    %eax,%eax
  mov    %rdi,%rsi
  call   <mp_add@plt>
  add    0x8(%rsp),%r12
  mov    %rbx,%rdx
  cmp    %rbx,%r13
  cmovbe %r13,%rdx
  mov    %r15,%rdi
  xor    %esi,%esi
  add    %r13,%rdx
  add    %rdx,%rdx
  call   <memset@plt>
  cmp    %rbx,%r13
  jbe    L35
  test   %rbx,%rbx
  jne    L97
L123:
  mov    (%rsp),%rcx
  mov    0x18(%rsp),%rax
  cmpw   $0x0,-0x2(%rcx,%rax,2)
  jne    L136
  sub    $0x1,%rax
  mov    %rax,0x10(%rsp)
L136:
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <mp_free@plt>
L95:
  mov    0x10(%rsp),%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L88:
  lea    0x1(%r15),%rax
  shr    %rax
  cmp    %r13,%rax
  jae    L77
  mov    (%rsp),%rdi
  mov    %r13,%r8
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  xor    %eax,%eax
  call   <mp_karatsuba_mul@plt>
  cltq
  mov    %rax,0x10(%rsp)
  jmp    L95
L169:
  lea    (%r15,%r15,1),%rsi
  mov    $0x1,%edi
  xor    %eax,%eax
  xor    %ebp,%ebp
  call   <mp_calloc@plt>
  movslq %eax,%r15
  cmp    %rbx,%r13
  jbe    L124
  test   %rbx,%rbx
  je     L123
L97:
  mov    %rbx,%r8
  mov    %r13,%rcx
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  add    %r13,%rbp
  call   <mp_mul>
  mov    0x18(%rsp),%rcx
  mov    %r15,%rdx
  mov    %rax,%r8
  mov    (%rsp),%rax
  lea    (%rax,%rbp,2),%rdi
  xor    %eax,%eax
  mov    %rdi,%rsi
  call   <mp_add@plt>
  jmp    L123
L64:
  mov    (%rsp),%rdi
  mov    %r13,%r8
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  xor    %eax,%eax
  call   <mp_base_mul@plt>
  cltq
  mov    %rax,0x10(%rsp)
  jmp    L95
  nopl   0x0(%rax,%rax,1)
L10:
  mov    (%rsp),%rdi
  mov    %r13,%r8
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  xor    %eax,%eax
  call   <mp_toom_mul@plt>
  cltq
  mov    %rax,0x10(%rsp)
  jmp    L95
```

assistant: ```c
long mp_mul(unsigned short *rop, unsigned short *op1, unsigned short *op2, unsigned long len1, unsigned long len2) {
  if (len1 < len2) {
    unsigned short *top = op1;
    unsigned long tlen = len1;
    op1 = op2;
    len1 = len2;
    op2 = top;
    len2 = tlen;
  };
  if (len1 < 32 || len2 < 32)
    return (mp_base_mul(rop, op1, op2, len1, len2));
  else if (len1 < 128 && len2 < 128 && len2 > ((len1 + 1) >> 1))
    return (mp_karatsuba_mul(rop, op1, op2, len1, len2));
  else if (len1 >= 128 && len2 >= 128 && (len2 + 2) / 3 == (len1 + 2) / 3)
    return (mp_toom_mul(rop, op1, op2, len1, len2));
  else {
    long xsize, psize, isize;
    unsigned short *ptr;
    isize = 0;
    xsize = len1 + len2;
    mp_mul(rop, op1, op2, len2, len2);
    len1 -= len2;
    op1 += len2;
    if (len1 > len2)
      ptr = mp_calloc(1, sizeof(unsigned short) * (len2 + len2));
    else
      ptr = mp_calloc(1, sizeof(unsigned short) * (len1 + len2));
    while (len1 >= len2) {
      isize += len2;
      psize = mp_mul(ptr, op1, op2, len2, len2);
      mp_add(rop + isize, rop + isize, ptr, xsize - isize, psize);
      len1 -= len2;
      op1 += len2;
      memset(ptr, '\0', sizeof(unsigned short) * (((len1) < (len2) ? (len1) : (len2)) + len2));
    }
    if (len1) {
      isize += len2;
      psize = mp_mul(ptr, op2, op1, len2, len1);
      mp_add(rop + isize, rop + isize, ptr, xsize, psize);
    }
    if (rop[xsize - 1] == 0)
      --xsize;
    mp_free(ptr);
    return (xsize);
  }
}
```