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

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    D23(%rip),%rdi
  call   <printf@plt>
  lea    0x4(%rsp),%rdx
  mov    %rsp,%rsi
  lea    D17(%rip),%rdi
  call   <scanf@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    (%rsp),%eax
  lea    0x0(,%rax,8),%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L83
L85:
  mov    (%rsp),%edi
  imul   0x4(%rsp),%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L39
L45:
  mov    0x4(%rsp),%eax
  lea    0x0(,%rax,8),%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L127
L97:
  lea    D59(%rip),%rdi
  call   <puts@plt>
  cmpl   $0x0,0x4(%rsp)
  jle    L62
  mov    %rbp,%rdx
  mov    $0x0,%eax
  movsd  D62(%rip),%xmm0
L95:
  movsd  %xmm0,(%rdx)
  add    $0x1,%eax
  add    $0x8,%rdx
  cmp    %eax,0x4(%rsp)
  jg     L95
L62:
  mov    (%rsp),%esi
  mov    $0x0,%ecx
  test   %esi,%esi
  jg     L34
L13:
  mov    0x4(%rsp),%edx
  lea    D41(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %rbp,%r8
  mov    %rbx,%rcx
  mov    %r12,%rdx
  mov    0x4(%rsp),%esi
  mov    (%rsp),%edi
  call   <mxv@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L35
  mov    $0x0,%eax
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L83:
  lea    D79(%rip),%rdi
  call   <perror@plt>
  jmp    L85
L39:
  lea    D57(%rip),%rdi
  call   <perror@plt>
  jmp    L45
L127:
  lea    D1(%rip),%rdi
  call   <perror@plt>
  jmp    L97
L3:
  imul   %ecx,%eax
  add    %edx,%eax
  cltq
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%edx
  mov    0x4(%rsp),%eax
  cmp    %edx,%eax
  jg     L3
L40:
  add    $0x1,%ecx
  mov    (%rsp),%esi
  cmp    %ecx,%esi
  jle    L13
L34:
  mov    0x4(%rsp),%eax
  mov    $0x0,%edx
  test   %eax,%eax
  jle    L40
  pxor   %xmm0,%xmm0
  cvtsi2sd %ecx,%xmm0
  jmp    L3
L35:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D23
data_type: string
name: unpack_data
arguments: data_label: D17
data_type: string
name: unpack_data
arguments: data_label: D59
data_type: string
name: unpack_data
arguments: data_label: D62
data_type: f64
name: unpack_data
arguments: data_label: D41
data_type: string
name: unpack_data
arguments: data_label: D79
data_type: string
name: unpack_data
arguments: data_label: D57
data_type: string
name: unpack_data
arguments: data_label: D1
data_type: string

tool: D23: Please give m and n: 

tool: D17: %d %d

tool: D59: Initializing matrix B and vector c

tool: D62: 2

tool: D41: Executing mxv function for m = %d n = %d


tool: D79: memory allocation for a

tool: D57: memory allocation for b

tool: D1: memory allocation for c

assistant: ```c
int main(int argc, char *argv[]) {
  double *a, *b, *c;
  int i, j, m, n;
  printf("Please give m and n: ");
  scanf("%d %d", &m, &n);
  printf("\n");
  if ((a = (double *)malloc(m * sizeof(double))) == NULL)
    perror("memory allocation for a");
  if ((b = (double *)malloc(m * n * sizeof(double))) == NULL)
    perror("memory allocation for b");
  if ((c = (double *)malloc(n * sizeof(double))) == NULL)
    perror("memory allocation for c");
  printf("Initializing matrix B and vector c\n");
  for (j = 0; j < n; j++)
    c[j] = 2.0;
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      b[i * n + j] = i;
  printf("Executing mxv function for m = %d n = %d\n", m, n);
  (void)mxv(m, n, a, b, c);
  free(a);
  free(b);
  free(c);
  return (0);
}
```