user: 请将以下的汇编代码转换成C语言代码：

```asm
<addrow_imatrix>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %r8,-0x48(%rbp)
  mov    %r9,-0x50(%rbp)
  mov    -0x38(%rbp),%rax
  sub    -0x30(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x48(%rbp),%rax
  sub    -0x40(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x30(%rbp),%rax
  shl    $0x3,%rax
  add    %rax,-0x28(%rbp)
  mov    -0x10(%rbp),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  jne    L34
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <nrerror@plt>
L34:
  mov    -0x30(%rbp),%rax
  shl    $0x3,%rax
  neg    %rax
  add    %rax,-0x28(%rbp)
  mov    -0x50(%rbp),%rax
  imul   -0x8(%rbp),%rax
  shl    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    -0x38(%rbp),%rdx
  add    $0x1,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  mov    %rax,(%rdx)
  mov    -0x38(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L16
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <nrerror@plt>
L16:
  mov    -0x38(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x38(%rbp),%rdx
  add    $0x1,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  mov    -0x38(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%rax
  shl    $0x2,%rax
  neg    %rax
  mov    %rax,%rcx
  mov    -0x38(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rsi
  mov    -0x28(%rbp),%rax
  add    %rsi,%rax
  add    %rcx,%rdx
  mov    %rdx,(%rax)
  mov    -0x38(%rbp),%rax
  add    $0x2,%rax
  mov    %rax,-0x18(%rbp)
  jmp    L10
L1:
  mov    -0x18(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rsi
  mov    -0x28(%rbp),%rax
  add    %rsi,%rax
  add    %rcx,%rdx
  mov    %rdx,(%rax)
  addq   $0x1,-0x18(%rbp)
L10:
  mov    -0x38(%rbp),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x18(%rbp)
  jle    L1
  mov    -0x28(%rbp),%rax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D12
type: string
name: unpack_data
arguments: tag: D7
type: string

tool: D12: allocation failure 1 in realloc imatrix()

tool: D7: allocation failure 2 in realloc imatrix()

assistant: ```c
int **addrow_imatrix(int **m, long nrl, long nrh, long ncl, long nch, long nr) {
  long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
  m += nrl;
  m -= 0;
  m = (int **)realloc(m, (size_t)((nrow + nr + 0) * sizeof(int *)));
  if (!m)
    nrerror("allocation failure 1 in realloc imatrix()");
  m += 0;
  m -= nrl;
  m[nrh + 1] = (int *)malloc((size_t)((nr * ncol + 0) * sizeof(int)));
  if (!m[nrh + 1])
    nrerror("allocation failure 2 in realloc imatrix()");
  m[nrh + 1] += 0;
  m[nrh + 1] -= ncl;
  for (i = nrh + 2; i <= nrh + nr; i++)
    m[i] = m[i - 1] + ncol;
  return m;
}
```