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

```asm
<calloc2d>:
  endbr64
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edi,%ebx
  mov    %esi,%edi
  mov    %edx,%esi
  imul   %ebx,%edi
  call   <calloc@plt>
  test   %rax,%rax
  je     L11
  mov    $0x8,%esi
  mov    %ebx,%edi
  mov    %rax,%r13
  call   <calloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L20
  test   %ebx,%ebx
  jle    L11
  lea    -0x1(%rbx),%eax
  cmp    $0x2,%eax
  jbe    L96
  movd   %ebp,%xmm6
  movd   %r14d,%xmm4
  mov    %ebx,%edx
  mov    %r12,%rax
  pshufd $0x0,%xmm6,%xmm5
  pshufd $0x0,%xmm4,%xmm4
  shr    $0x2,%edx
  movq   %r13,%xmm3
  movdqa %xmm4,%xmm7
  shl    $0x5,%rdx
  punpcklqdq %xmm3,%xmm3
  pxor   %xmm6,%xmm6
  movdqa %xmm5,%xmm8
  movdqa D4(%rip),%xmm2
  psrlq  $0x20,%xmm7
  add    %r12,%rdx
  movdqa D1(%rip),%xmm9
  psrlq  $0x20,%xmm8
  xchg   %ax,%ax
L24:
  movdqa %xmm2,%xmm1
  movdqa %xmm6,%xmm10
  add    $0x20,%rax
  movdqa %xmm1,%xmm0
  psrlq  $0x20,%xmm1
  paddd  %xmm9,%xmm2
  pmuludq %xmm5,%xmm0
  pmuludq %xmm8,%xmm1
  pshufd $0x8,%xmm0,%xmm0
  pshufd $0x8,%xmm1,%xmm1
  punpckldq %xmm1,%xmm0
  movdqa %xmm0,%xmm1
  psrlq  $0x20,%xmm0
  pmuludq %xmm4,%xmm1
  pmuludq %xmm7,%xmm0
  pshufd $0x8,%xmm1,%xmm1
  pshufd $0x8,%xmm0,%xmm0
  punpckldq %xmm0,%xmm1
  pcmpgtd %xmm1,%xmm10
  movdqa %xmm1,%xmm0
  punpckldq %xmm10,%xmm0
  punpckhdq %xmm10,%xmm1
  paddq  %xmm3,%xmm0
  paddq  %xmm3,%xmm1
  movups %xmm0,-0x20(%rax)
  movups %xmm1,-0x10(%rax)
  cmp    %rdx,%rax
  jne    L24
  mov    %ebx,%eax
  and    $0xfffffffc,%eax
  test   $0x3,%bl
  je     L11
L82:
  mov    %ebp,%esi
  movslq %eax,%rdi
  imul   %eax,%esi
  lea    0x0(,%rdi,8),%rcx
  mov    %esi,%edx
  imul   %r14d,%edx
  movslq %edx,%rdx
  add    %r13,%rdx
  mov    %rdx,(%r12,%rdi,8)
  lea    0x1(%rax),%edx
  cmp    %edx,%ebx
  jle    L11
  add    %ebp,%esi
  mov    %r14d,%edx
  add    $0x2,%eax
  imul   %esi,%edx
  movslq %edx,%rdx
  add    %r13,%rdx
  mov    %rdx,0x8(%r12,%rcx,1)
  cmp    %eax,%ebx
  jle    L11
  add    %esi,%ebp
  imul   %r14d,%ebp
  movslq %ebp,%rax
  add    %rax,%r13
  mov    %r13,0x10(%r12,%rcx,1)
L11:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L20:
  mov    %r13,%rdi
  call   <free@plt>
  jmp    L11
L96:
  xor    %eax,%eax
  jmp    L82
```

tool_calls: name: read_data
arguments: data_tag: D4
type: byte[16]
name: read_data
arguments: data_tag: D1
type: byte[16]

tool: {"D4": [0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00]}

tool: {"D1": [0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

assistant: ```c
char **calloc2d(int ndim1, int ndim2, int size) {
  int i;
  unsigned nelem;
  char *p;
  char **pp;
  nelem = (unsigned)ndim1 * ndim2;
  p = (char *)calloc(nelem, (unsigned)size);
  if (p == NULL)
    return (NULL);
  pp = (char **)calloc((unsigned)ndim1, (unsigned)sizeof(char *));
  if (pp == NULL) {
    free(p);
    return (NULL);
  }
  for (i = 0; i < ndim1; i++)
    pp[i] = p + (i * ndim2 * size);
  return ((char **)pp);
}
```