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

```asm
<matexp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,-0x48(%rbp)
  movsd  %xmm0,-0x50(%rbp)
  mov    %esi,-0x54(%rbp)
  mov    %edx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  cmpl   $0x1,-0x58(%rbp)
  jle    L112
  cmpl   $0x1f,-0x58(%rbp)
  jle    L111
L112:
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  call   <error2@plt>
L111:
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  movl   $0x0,-0x34(%rbp)
  jmp    L123
L138:
  mov    -0x58(%rbp),%eax
  neg    %eax
  mov    %eax,%edx
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x48(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x50(%rbp),%xmm0
  movq   %xmm0,%rax
  mov    -0x30(%rbp),%rsi
  mov    -0x34(%rbp),%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  lea    (%rsi,%rcx,1),%rbx
  mov    %edx,%edi
  movq   %rax,%xmm0
  call   <ldexp@plt>
  movq   %xmm0,%rax
  mov    %rax,(%rbx)
  addl   $0x1,-0x34(%rbp)
L123:
  mov    -0x54(%rbp),%eax
  imul   %eax,%eax
  cmp    %eax,-0x34(%rbp)
  jl     L138
  mov    -0x28(%rbp),%rdx
  mov    -0x30(%rbp),%rsi
  mov    -0x30(%rbp),%rax
  mov    -0x54(%rbp),%r8d
  mov    -0x54(%rbp),%edi
  mov    -0x54(%rbp),%ecx
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <matby@plt>
  movl   $0x0,-0x34(%rbp)
  jmp    L32
L89:
  mov    -0x30(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x28(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  D27(%rip),%xmm2
  divsd  %xmm2,%xmm0
  mov    -0x30(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x34(%rbp)
L32:
  mov    -0x54(%rbp),%eax
  imul   %eax,%eax
  cmp    %eax,-0x34(%rbp)
  jl     L89
  movl   $0x0,-0x34(%rbp)
  jmp    L77
L31:
  mov    -0x30(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  imul   -0x54(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x34(%rbp),%eax
  add    %ecx,%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  D15(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x34(%rbp)
L77:
  mov    -0x34(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L31
  movl   $0x0,-0x34(%rbp)
  movl   $0x0,-0x38(%rbp)
  jmp    L97
L39:
  cmpl   $0x0,-0x38(%rbp)
  sete   %al
  movzbl %al,%eax
  mov    %eax,-0x38(%rbp)
  mov    -0x38(%rbp),%eax
  cltq
  mov    -0x30(%rbp,%rax,8),%rdx
  mov    $0x1,%eax
  sub    -0x38(%rbp),%eax
  cltq
  mov    -0x30(%rbp,%rax,8),%rsi
  mov    $0x1,%eax
  sub    -0x38(%rbp),%eax
  cltq
  mov    -0x30(%rbp,%rax,8),%rax
  mov    -0x54(%rbp),%r8d
  mov    -0x54(%rbp),%edi
  mov    -0x54(%rbp),%ecx
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <matby@plt>
  addl   $0x1,-0x34(%rbp)
L97:
  mov    -0x34(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L39
  cmpl   $0x1,-0x38(%rbp)
  jne    L86
  movl   $0x0,-0x34(%rbp)
  jmp    L60
L45:
  mov    -0x28(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x48(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x34(%rbp)
L60:
  mov    -0x54(%rbp),%eax
  imul   %eax,%eax
  cmp    %eax,-0x34(%rbp)
  jl     L45
L86:
  mov    $0x0,%eax
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L109
  call   <__stack_chk_fail@plt>
L109:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D21
data_type: string
name: read_data
arguments: tag: D27
data_type: byte[8]
name: read_data
arguments: tag: D15
data_type: byte[8]

tool: D21: TimeSquare not good

tool: {"D27": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40]}

tool: {"D15": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
int matexp(double Q[], double t, int n, int TimeSquare, double space[]) {
  int it, i;
  double *T[2];
  if (TimeSquare < 2 || TimeSquare > 31)
    error2("TimeSquare not good");
  T[0] = Q;
  T[1] = space;
  for (i = 0; i < n * n; i++)
    T[0][i] = ldexp(Q[i] * t, -TimeSquare);
  matby(T[0], T[0], T[1], n, n, n);
  for (i = 0; i < n * n; i++)
    T[0][i] += T[1][i] / 2;
  for (i = 0; i < n; i++)
    T[0][i * n + i]++;
  for (i = 0, it = 0; i < TimeSquare; i++) {
    it = !it;
    matby(T[1 - it], T[1 - it], T[it], n, n, n);
  }
  if (it == 1)
    for (i = 0; i < n * n; i++)
      Q[i] = T[1][i];
  return (0);
}
```