user: Converte this assembly snippet into its equivalent C code:

```asm
<mp_toom_mul>:
  endbr64
  movabs $0xaaaaaaaaaaaaaaab,%r9
  push   %r15
  lea    (%rcx,%r8,1),%rax
  mov    %rdi,%r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x98,%rsp
  mov    %rdx,0x28(%rsp)
  lea    0x4(%rax),%rdx
  mov    %rax,0x70(%rsp)
  mov    %rdx,%rax
  mul    %r9
  mov    %rsi,0x20(%rsp)
  mov    %rdx,%rbx
  shr    $0x2,%rbx
  lea    (%rbx,%rbx,1),%r13
  lea    0x4(%rbx,%rbx,1),%ebp
  sub    %r13,%r8
  sub    %r13,%r14
  lea    0x2(%rbx,%rbx,1),%r12d
  mov    %ebp,%edi
  mov    %r8,0x18(%rsp)
  mov    %r14,0x38(%rsp)
  call   <mp_malloc@plt>
  mov    %ebp,%edi
  mov    %rax,(%rsp)
  call   <mp_malloc@plt>
  mov    %r12d,%edi
  mov    %rax,0x68(%rsp)
  call   <mp_malloc@plt>
  mov    %r12d,%edi
  mov    %rax,%r14
  call   <mp_malloc@plt>
  mov    %ebp,%edi
  mov    %rax,%r12
  call   <mp_malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x30(%rsp)
  call   <mp_malloc@plt>
  mov    0x20(%rsp),%rsi
  mov    %r14,%rdi
  mov    %rbx,%rdx
  mov    $0x1,%ecx
  mov    %r13,0x8(%rsp)
  add    %r13,%rsi
  mov    %rax,0x10(%rsp)
  mov    %rsi,%r13
  call   <mp_lshift@plt>
  mov    0x20(%rsp),%rsi
  mov    (%rsp),%rdi
  mov    %rbx,%rdx
  mov    $0x2,%ecx
  mov    %rax,%rbp
  call   <mp_lshift@plt>
  mov    (%rsp),%r11
  mov    %rbp,%r8
  mov    %r14,%rdx
  mov    %rax,%rcx
  mov    %r11,%rsi
  mov    %r11,%rdi
  call   <mp_add@plt>
  mov    0x8(%rsp),%rdi
  mov    0x38(%rsp),%r8
  lea    0x0(,%rbx,4),%r10
  mov    %rax,%rcx
  mov    %r10,0x48(%rsp)
  lea    0x0(%r13,%rdi,1),%r11
  mov    %r11,%rdx
  mov    %r11,0x40(%rsp)
  mov    (%rsp),%r11
  mov    %r11,%rsi
  mov    %r11,%rdi
  mov    %r11,0x88(%rsp)
  call   <mp_add@plt>
  mov    0x38(%rsp),%rdx
  mov    0x40(%rsp),%rsi
  mov    $0x2,%ecx
  mov    0x30(%rsp),%rdi
  mov    %rax,(%rsp)
  call   <mp_lshift@plt>
  mov    %rbp,%r8
  mov    0x30(%rsp),%rbp
  mov    %r14,%rdx
  mov    %rax,%rcx
  mov    %rbp,%rsi
  mov    %rbp,%rdi
  call   <mp_add@plt>
  mov    0x20(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rcx
  mov    %rbx,%r8
  mov    %rbp,0x30(%rsp)
  call   <mp_add@plt>
  mov    0x20(%rsp),%rsi
  mov    %r13,%rdx
  mov    %r14,%rdi
  mov    %rbx,%r8
  mov    %rbx,%rcx
  mov    %rax,0x50(%rsp)
  call   <mp_add@plt>
  mov    0x38(%rsp),%r8
  mov    %r14,%rsi
  mov    %r14,%rdi
  mov    0x40(%rsp),%rdx
  mov    %rax,%rcx
  call   <mp_add@plt>
  mov    0x8(%rsp),%r13
  mov    %r12,%rdi
  mov    %rbx,%rdx
  mov    0x28(%rsp),%rbp
  mov    $0x1,%ecx
  mov    %rax,0x58(%rsp)
  add    %r13,%rbp
  mov    %rbp,%rsi
  add    %rbp,%r13
  call   <mp_lshift@plt>
  mov    0x28(%rsp),%rsi
  mov    0x68(%rsp),%rdi
  mov    %rbx,%rdx
  mov    $0x2,%ecx
  mov    %rax,0x60(%rsp)
  call   <mp_lshift@plt>
  mov    0x68(%rsp),%r10
  mov    0x60(%rsp),%r8
  mov    %r12,%rdx
  mov    %rax,%rcx
  mov    %r10,%rsi
  mov    %r10,%rdi
  call   <mp_add@plt>
  mov    0x68(%rsp),%r10
  mov    0x18(%rsp),%r8
  mov    %r13,%rdx
  mov    %rax,%rcx
  mov    %r10,%rsi
  mov    %r10,%rdi
  mov    %r10,0x80(%rsp)
  call   <mp_add@plt>
  mov    0x18(%rsp),%rdx
  mov    0x10(%rsp),%rdi
  mov    %r13,%rsi
  mov    $0x2,%ecx
  mov    %rax,0x68(%rsp)
  call   <mp_lshift@plt>
  mov    0x10(%rsp),%r9
  mov    0x60(%rsp),%r8
  mov    %r12,%rdx
  mov    %rax,%rcx
  mov    %r9,%rsi
  mov    %r9,%rdi
  call   <mp_add@plt>
  mov    0x10(%rsp),%r9
  mov    0x28(%rsp),%rdx
  mov    %rbx,%r8
  mov    %rax,%rcx
  mov    %r9,%rsi
  mov    %r9,%rdi
  call   <mp_add@plt>
  mov    0x28(%rsp),%rsi
  mov    %rbp,%rdx
  mov    %r12,%rdi
  mov    %rbx,%r8
  mov    %rbx,%rcx
  mov    %rax,0x78(%rsp)
  call   <mp_add@plt>
  mov    0x18(%rsp),%r8
  mov    %r13,%rdx
  mov    %r12,%rsi
  mov    %rax,%rcx
  mov    %r12,%rdi
  call   <mp_add@plt>
  mov    (%rsp),%r10d
  imul   0x68(%rsp),%r10d
  mov    $0x1,%edi
  mov    %rax,0x60(%rsp)
  mov    %r10d,%esi
  add    %esi,%esi
  call   <mp_calloc@plt>
  mov    (%rsp),%rcx
  mov    0x88(%rsp),%r11
  mov    0x68(%rsp),%r8
  mov    0x80(%rsp),%rdx
  mov    %rax,%rdi
  mov    %rax,%rbp
  mov    %r11,%rsi
  mov    %r11,(%rsp)
  call   <mp_mul@plt>
  mov    (%rsp),%rdi
  mov    %rax,0x68(%rsp)
  call   <mp_free@plt>
  mov    0x80(%rsp),%rdi
  call   <mp_free@plt>
  mov    0x58(%rsp),%r10d
  imul   0x60(%rsp),%r10d
  mov    $0x1,%edi
  mov    %r10d,%esi
  add    %esi,%esi
  call   <mp_calloc@plt>
  mov    0x60(%rsp),%r8
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    0x58(%rsp),%rcx
  mov    %rax,%rdi
  mov    %rax,(%rsp)
  call   <mp_mul@plt>
  mov    %r14,%rdi
  mov    %rax,0x58(%rsp)
  call   <mp_free@plt>
  mov    %r12,%rdi
  call   <mp_free@plt>
  mov    0x78(%rsp),%r14
  mov    0x50(%rsp),%r11d
  mov    $0x1,%edi
  imul   %r14d,%r11d
  mov    %r11d,%esi
  add    %esi,%esi
  call   <mp_calloc@plt>
  mov    %r14,%r8
  mov    0x30(%rsp),%r14
  mov    0x50(%rsp),%rcx
  mov    0x10(%rsp),%rdx
  mov    %rax,%rdi
  mov    %rax,%r12
  mov    %r14,%rsi
  call   <mp_mul@plt>
  mov    %r14,%rdi
  mov    %rax,0x50(%rsp)
  call   <mp_free@plt>
  mov    0x10(%rsp),%rdi
  call   <mp_free@plt>
  lea    0x0(,%rbx,4),%esi
  mov    $0x1,%edi
  call   <mp_calloc@plt>
  mov    0x28(%rsp),%rdx
  mov    %rbx,%r8
  mov    %rbx,%rcx
  mov    0x20(%rsp),%rsi
  mov    %rax,%rdi
  mov    %rax,0x10(%rsp)
  call   <mp_mul@plt>
  mov    0x38(%rsp),%r14
  mov    0x18(%rsp),%r9
  mov    $0x1,%edi
  mov    %rax,0x20(%rsp)
  add    %r14,%r9
  mov    %r9,%rsi
  add    %esi,%esi
  call   <mp_calloc@plt>
  mov    0x18(%rsp),%r8
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    0x40(%rsp),%rsi
  mov    %rax,%rdi
  mov    %rax,%r13
  call   <mp_mul@plt>
  mov    0x10(%rsp),%r14
  mov    0x20(%rsp),%rdx
  mov    %r15,%rdi
  mov    $0x4,%ecx
  mov    %rax,0x18(%rsp)
  mov    %r14,%rsi
  call   <mp_lshift@plt>
  mov    0x68(%rsp),%rcx
  mov    %r15,%rdx
  mov    %rbp,%rsi
  mov    %rax,%r8
  mov    %rbp,%rdi
  call   <mp_sub@plt>
  mov    0x18(%rsp),%r8
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %rax,%rcx
  mov    %rbp,%rdi
  call   <mp_sub@plt>
  mov    %r14,%rdx
  mov    %r14,0x10(%rsp)
  mov    (%rsp),%r14
  mov    0x20(%rsp),%r8
  mov    0x58(%rsp),%rcx
  mov    %rax,0x30(%rsp)
  mov    %r14,%rsi
  mov    %r14,%rdi
  call   <mp_sub@plt>
  mov    0x18(%rsp),%r8
  mov    %r13,%rdx
  mov    %r14,%rsi
  mov    %r14,%rdi
  mov    %rax,%rcx
  mov    %r13,0x28(%rsp)
  mov    %r14,(%rsp)
  call   <mp_sub@plt>
  mov    0x20(%rsp),%r8
  mov    %r12,%rsi
  mov    %r12,%rdi
  mov    0x50(%rsp),%rcx
  mov    0x10(%rsp),%rdx
  mov    %rax,%r14
  call   <mp_sub@plt>
  mov    0x18(%rsp),%rdx
  mov    0x28(%rsp),%rsi
  mov    %r15,%rdi
  mov    $0x4,%ecx
  mov    %rax,%r13
  call   <mp_lshift@plt>
  mov    %r13,%rcx
  mov    %r15,%rdx
  mov    %r12,%rsi
  mov    %rax,%r8
  mov    %r12,%rdi
  call   <mp_sub@plt>
  mov    0x30(%rsp),%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rax,%r8
  mov    %r15,%rdi
  mov    %rax,0x40(%rsp)
  call   <mp_add@plt>
  mov    (%rsp),%rsi
  mov    %r14,%rdx
  mov    $0x3,%ecx
  lea    (%r15,%rax,2),%r11
  mov    %rax,%r13
  mov    %r11,%rdi
  mov    %r11,0x38(%rsp)
  call   <mp_lshift@plt>
  mov    0x38(%rsp),%rdx
  mov    %r13,%rcx
  mov    %r15,%rsi
  mov    %rax,%r8
  mov    %r15,%rdi
  call   <mp_sub@plt>
  mov    (%rsp),%rsi
  mov    %r14,%rdx
  mov    $0x1,%ecx
  lea    (%r15,%rax,2),%r13
  mov    %rax,0x38(%rsp)
  mov    %r13,%rdi
  call   <mp_lshift@plt>
  mov    0x38(%rsp),%r8
  mov    %r13,%rsi
  mov    %r15,%rdx
  mov    %rax,%rcx
  mov    %r15,%rdi
  call   <mp_sub@plt>
  mov    0x30(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbp,%rdi
  mov    $0x1,%ecx
  mov    %rax,%r13
  call   <mp_rshift@plt>
  mov    (%rsp),%rdx
  mov    %r14,%r8
  mov    %rbp,%rsi
  mov    %rax,%rcx
  mov    %rbp,%rdi
  call   <mp_sub@plt>
  mov    (%rsp),%rdi
  mov    %r13,%rdx
  mov    %r15,%rsi
  mov    $0x1,%ecx
  mov    %rax,%r14
  call   <mp_rshift@plt>
  mov    (%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbp,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r8
  mov    %rax,0x30(%rsp)
  call   <mp_sub@plt>
  mov    0x30(%rsp),%r11
  mov    0x40(%rsp),%r10
  movabs $0xaaaaaaaaaaaaaaab,%r9
  lea    -0x2(%rax,%rax,1),%rsi
  mov    %rax,%r14
  lea    0x0(%rbp,%rsi,1),%rdi
  movzwl (%rdi),%ecx
  mov    %rcx,%rax
  mul    %r9
  shr    %rdx
  mov    %dx,(%rdi)
  mov    %r14,%rdi
  sub    $0x2,%rdi
  js     L18
  lea    -0x2(%rbp,%rsi,1),%rsi
  nopl   0x0(%rax,%rax,1)
L25:
  mov    %rcx,%rax
  sub    $0x1,%rdi
  sub    $0x2,%rsi
  mul    %r9
  mov    %rdx,%rax
  and    $0xfffffffffffffffe,%rdx
  shr    %rax
  add    %rax,%rdx
  movzwl 0x2(%rsi),%eax
  sub    %rdx,%rcx
  shl    $0x10,%rcx
  add    %rax,%rcx
  mov    %rcx,%rax
  mul    %r9
  shr    %rdx
  mov    %dx,0x2(%rsi)
  cmp    $0xffffffffffffffff,%rdi
  jne    L25
L18:
  mov    %r10,%rdx
  mov    $0x1,%ecx
  mov    %r12,%rsi
  mov    %r12,%rdi
  mov    %r11,0x40(%rsp)
  call   <mp_rshift@plt>
  mov    %r14,%r8
  mov    %rbp,%rdx
  mov    %r12,%rsi
  mov    %rax,%rcx
  mov    %r12,%rdi
  call   <mp_sub@plt>
  mov    %r13,%r8
  mov    %r15,%rdx
  mov    %r12,%rsi
  mov    %rax,%rcx
  mov    %r12,%rdi
  call   <mp_sub@plt>
  mov    $0x2,%ecx
  mov    %r12,%rsi
  mov    %r12,%rdi
  mov    %rax,%rdx
  call   <mp_rshift@plt>
  mov    0x70(%rsp),%r13
  xor    %esi,%esi
  mov    %r15,%rdi
  mov    %rax,0x38(%rsp)
  lea    0x0(%r13,%r13,1),%edx
  call   <memset@plt>
  lea    (%r15,%rbx,8),%rsi
  mov    0x18(%rsp),%r8
  mov    %r13,%rcx
  mov    0x28(%rsp),%rdx
  sub    0x48(%rsp),%rcx
  mov    %rsi,%rdi
  mov    %rsi,0x18(%rsp)
  call   <mp_add@plt>
  mov    0x8(%rsp),%rcx
  mov    0x18(%rsp),%rsi
  mov    %r12,%rdx
  lea    (%rbx,%rbx,2),%r10
  mov    0x38(%rsp),%r8
  sub    %rcx,%rsi
  mov    %rcx,%r13
  mov    0x48(%rsp),%rcx
  mov    %r10,0x30(%rsp)
  mov    %rsi,%rdi
  mov    %rsi,0x18(%rsp)
  neg    %r13
  add    %rax,%rcx
  sub    %r10,%rcx
  call   <mp_add@plt>
  mov    0x18(%rsp),%rsi
  mov    0x30(%rsp),%r10
  mov    0x40(%rsp),%r8
  mov    (%rsp),%rdx
  add    %r13,%rsi
  lea    (%rax,%r10,1),%rcx
  sub    0x8(%rsp),%rcx
  mov    %rsi,%rdi
  mov    %rsi,0x18(%rsp)
  call   <mp_add@plt>
  mov    0x18(%rsp),%rsi
  mov    %r14,%r8
  mov    %rbp,%rdx
  mov    0x8(%rsp),%rcx
  lea    (%rsi,%r13,1),%rdi
  add    %rax,%rcx
  mov    %rdi,%rsi
  sub    %rbx,%rcx
  call   <mp_add@plt>
  mov    0x20(%rsp),%r8
  mov    %r15,%rsi
  mov    %r15,%rdi
  lea    (%rbx,%rax,1),%rcx
  mov    0x10(%rsp),%rbx
  mov    %rbx,%rdx
  call   <mp_add@plt>
  mov    0x28(%rsp),%rdi
  mov    %rax,%r13
  call   <mp_free@plt>
  mov    %r12,%rdi
  call   <mp_free@plt>
  mov    (%rsp),%rdi
  call   <mp_free@plt>
  mov    %rbp,%rdi
  call   <mp_free@plt>
  mov    %rbx,%rdi
  call   <mp_free@plt>
  cmp    $0x1,%r13
  jle    L21
  cmpw   $0x1,-0x2(%r15,%r13,2)
  sbb    $0x0,%r13
L21:
  add    $0x98,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
long mp_toom_mul(unsigned short *rop, unsigned short *op1, unsigned short *op2, unsigned long len1, unsigned long len2) {
  long size, xsize, i;
  unsigned long value;
  unsigned short carry;
  unsigned long x;
  unsigned long l1, l2;
  unsigned long al, bl, cl, dl, el, Ul[3], Vl[3];
  unsigned short *a, *b, *c, *d, *e, *U[3], *V[3];
  x = (len1 + len2 + 4) / 6;
  l1 = len1 - (x << 1);
  l2 = len2 - (x << 1);
  U[0] = mp_malloc(sizeof(unsigned short) * (x + 2));
  V[0] = mp_malloc(sizeof(unsigned short) * (x + 2));
  U[1] = mp_malloc(sizeof(unsigned short) * (x + 1));
  V[1] = mp_malloc(sizeof(unsigned short) * (x + 1));
  U[2] = mp_malloc(sizeof(unsigned short) * (x + 2));
  V[2] = mp_malloc(sizeof(unsigned short) * (x + 2));
  Ul[1] = mp_lshift(U[1], op1 + x, x, 1);
  Ul[0] = mp_lshift(U[0], op1, x, 2);
  Ul[0] = mp_add(U[0], U[0], U[1], Ul[0], Ul[1]);
  Ul[0] = mp_add(U[0], U[0], op1 + x + x, Ul[0], l1);
  Ul[2] = mp_lshift(U[2], op1 + x + x, l1, 2);
  Ul[2] = mp_add(U[2], U[2], U[1], Ul[2], Ul[1]);
  Ul[2] = mp_add(U[2], U[2], op1, Ul[2], x);
  Ul[1] = mp_add(U[1], op1, op1 + x, x, x);
  Ul[1] = mp_add(U[1], U[1], op1 + x + x, Ul[1], l1);
  Vl[1] = mp_lshift(V[1], op2 + x, x, 1);
  Vl[0] = mp_lshift(V[0], op2, x, 2);
  Vl[0] = mp_add(V[0], V[0], V[1], Vl[0], Vl[1]);
  Vl[0] = mp_add(V[0], V[0], op2 + x + x, Vl[0], l2);
  Vl[2] = mp_lshift(V[2], op2 + x + x, l2, 2);
  Vl[2] = mp_add(V[2], V[2], V[1], Vl[2], Vl[1]);
  Vl[2] = mp_add(V[2], V[2], op2, Vl[2], x);
  Vl[1] = mp_add(V[1], op2, op2 + x, x, x);
  Vl[1] = mp_add(V[1], V[1], op2 + x + x, Vl[1], l2);
  b = mp_calloc(1, sizeof(unsigned short) * (Ul[0] * Vl[0]));
  bl = mp_mul(b, U[0], V[0], Ul[0], Vl[0]);
  mp_free(U[0]);
  mp_free(V[0]);
  c = mp_calloc(1, sizeof(unsigned short) * (Ul[1] * Vl[1]));
  cl = mp_mul(c, U[1], V[1], Ul[1], Vl[1]);
  mp_free(U[1]);
  mp_free(V[1]);
  d = mp_calloc(1, sizeof(unsigned short) * (Ul[2] * Vl[2]));
  dl = mp_mul(d, U[2], V[2], Ul[2], Vl[2]);
  mp_free(U[2]);
  mp_free(V[2]);
  a = mp_calloc(1, sizeof(unsigned short) * (x + x));
  al = mp_mul(a, op1, op2, x, x);
  e = mp_calloc(1, sizeof(unsigned short) * (l1 + l2));
  el = mp_mul(e, op1 + x + x, op2 + x + x, l1, l2);
  size = mp_lshift(rop, a, al, 4);
  bl = mp_sub(b, b, rop, bl, size);
  bl = mp_sub(b, b, e, bl, el);
  cl = mp_sub(c, c, a, cl, al);
  cl = mp_sub(c, c, e, cl, el);
  dl = mp_sub(d, d, a, dl, al);
  size = mp_lshift(rop, e, el, 4);
  dl = mp_sub(d, d, rop, dl, size);
  size = mp_add(rop, b, d, bl, dl);
  xsize = mp_lshift(rop + size, c, cl, 3);
  size = mp_sub(rop, rop, rop + size, size, xsize);
  xsize = mp_lshift(rop + size, c, cl, 1);
  size = mp_sub(rop, rop + size, rop, xsize, size);
  bl = mp_rshift(b, b, bl, 1);
  bl = mp_sub(b, b, c, bl, cl);
  cl = mp_rshift(c, rop, size, 1);
  bl = mp_sub(b, b, c, bl, cl);
  i = bl - 1;
  value = b[i];
  b[i] = value / 3;
  for (--i; i >= 0; i--) {
    carry = value % 3;
    value = ((unsigned long)carry << 16) + b[i];
    b[i] = (unsigned short)(value / 3);
  }
  dl = mp_rshift(d, d, dl, 1);
  dl = mp_sub(d, d, b, dl, bl);
  dl = mp_sub(d, d, rop, dl, size);
  dl = mp_rshift(d, d, dl, 2);
  memset(rop, '\0', sizeof(unsigned short) * (len1 + len2));
  i = x * 4;
  xsize = (len1 + len2) - i;
  size = mp_add(rop + i, rop + i, e, xsize, el) + i;
  i = x * 3;
  xsize = size - i;
  size = mp_add(rop + i, rop + i, d, xsize, dl) + i;
  i = x * 2;
  xsize = size - i;
  size = mp_add(rop + i, rop + i, c, xsize, cl) + i;
  i = x;
  xsize = size - i;
  size = mp_add(rop + i, rop + i, b, xsize, bl) + i;
  size = mp_add(rop, rop, a, size, al);
  mp_free(e);
  mp_free(d);
  mp_free(c);
  mp_free(b);
  mp_free(a);
  if (size > 1 && rop[size - 1] == 0)
    --size;
  return (size);
}
```