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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    0x8(%rsi),%rdi
  call   <atoi@plt>
  mov    %eax,%ebx
  cltq
  lea    0x0(,%rbx,8),%ebp
  mov    %rax,0x48(%rsp)
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x10(%rsp)
  mov    %rax,%r12
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x40(%rsp)
  mov    %rax,%r14
  call   <malloc@plt>
  mov    %rax,0x18(%rsp)
  test   %ebx,%ebx
  jle    L79
  mov    %rax,%rsi
  lea    -0x1(%rbx),%eax
  mov    %ebx,0x8(%rsp)
  mov    %r12,%rbp
  mov    %eax,0x38(%rsp)
  lea    0x0(,%rbx,4),%r13d
  lea    0x8(%r12,%rax,8),%r15
  sub    %r12,%r14
  mov    %rsi,%rbx
  nopl   0x0(%rax)
L138:
  mov    %r13d,%edi
  call   <malloc@plt>
  mov    %r13d,%edi
  mov    %rax,0x0(%rbp)
  call   <malloc@plt>
  mov    %r13d,%edi
  mov    %rax,(%r14,%rbp,1)
  call   <malloc@plt>
  mov    %rax,%r8
  mov    %rbx,%rax
  sub    %r12,%rax
  mov    %r8,(%rax,%rbp,1)
  add    $0x8,%rbp
  cmp    %r15,%rbp
  jne    L138
  cmpq   $0x0,0x10(%rsp)
  mov    0x8(%rsp),%ebx
  sete   %al
  cmpq   $0x0,0x40(%rsp)
  sete   %dl
  or     %dl,%al
  jne    L30
  cmpq   $0x0,0x18(%rsp)
  je     L30
L131:
  xor    %edi,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    0x38(%rsp),%eax
  mov    0x10(%rsp),%rdi
  movq   $0x0,0x8(%rsp)
  mov    %rax,0x30(%rsp)
  mov    %ebx,%eax
  mov    %rdi,%rbp
  mov    %rax,0x20(%rsp)
  mov    0x40(%rsp),%rax
  sub    %rdi,%rax
  mov    %rax,0x28(%rsp)
  nopl   0x0(%rax)
L6:
  mov    0x8(%rsp),%rax
  mov    0x28(%rsp),%rdi
  mov    0x18(%rsp),%rsi
  sub    0x10(%rsp),%rsi
  mov    %eax,%r12d
  lea    (%rdi,%rbp,1),%r15
  lea    (%rsi,%rbp,1),%r13
  lea    0x0(,%rax,4),%r14
  nop
L86:
  xor    %eax,%eax
  add    $0x1,%r12d
  call   <rand@plt>
  mov    0x0(%rbp),%rcx
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  add    $0x1,%eax
  mov    %eax,(%rcx,%r14,1)
  xor    %eax,%eax
  call   <rand@plt>
  mov    (%r15),%rcx
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  add    $0x1,%eax
  mov    %eax,(%rcx,%r14,1)
  mov    0x0(%r13),%rax
  movl   $0x0,(%rax,%r14,1)
  add    $0x4,%r14
  cmp    %r12d,%ebx
  jg     L86
  addq   $0x1,0x8(%rsp)
  add    $0x8,%rbp
  mov    0x8(%rsp),%rax
  cmp    0x20(%rsp),%rax
  jne    L6
  mov    0x18(%rsp),%rsi
  mov    0x30(%rsp),%rax
  mov    0x10(%rsp),%r12
  mov    0x40(%rsp),%r14
  lea    0x8(%rsi,%rax,8),%rax
  mov    0x20(%rsp),%r15
  mov    %rax,0x8(%rsp)
  mov    %ebx,%eax
  sub    %rsi,%r12
  sub    %rsi,%r14
  shr    $0x2,%eax
  lea    -0x1(%rax),%edi
  mov    %ebx,%eax
  and    $0xfffffffc,%eax
  add    $0x1,%rdi
  mov    %eax,0x28(%rsp)
  lea    0x1(%rax),%r9d
  lea    0x2(%rax),%r10d
  mov    %eax,%r8d
  mov    %r9d,0x30(%rsp)
  shl    $0x4,%rdi
  shl    $0x2,%r8
  mov    %r10d,0x3c(%rsp)
  shl    $0x2,%r9
  shl    $0x2,%r10
  nop
L4:
  mov    (%rsi),%rax
  mov    (%r14,%rsi,1),%rcx
  mov    (%r12,%rsi,1),%rdx
  lea    0x4(%rcx),%rbp
  mov    %rax,%r11
  sub    %rbp,%r11
  lea    0x4(%rdx),%r13
  mov    %rax,%rbp
  cmp    $0x8,%r11
  seta   %r11b
  sub    %r13,%rbp
  cmp    $0x8,%rbp
  seta   %bpl
  test   %bpl,%r11b
  je     L177
  xor    %r11d,%r11d
  cmpl   $0x2,0x38(%rsp)
  jbe    L177
  cs nopw 0x0(%rax,%rax,1)
L172:
  movdqu (%rdx,%r11,1),%xmm0
  movdqu (%rcx,%r11,1),%xmm2
  movdqu (%rdx,%r11,1),%xmm1
  movdqu (%rcx,%r11,1),%xmm3
  psrlq  $0x20,%xmm0
  psrlq  $0x20,%xmm2
  pmuludq %xmm3,%xmm1
  pmuludq %xmm2,%xmm0
  pshufd $0x8,%xmm1,%xmm1
  pshufd $0x8,%xmm0,%xmm0
  punpckldq %xmm0,%xmm1
  movdqu (%rax,%r11,1),%xmm0
  paddd  %xmm1,%xmm0
  movups %xmm0,(%rax,%r11,1)
  add    $0x10,%r11
  cmp    %rdi,%r11
  jne    L172
  cmp    %ebx,0x28(%rsp)
  je     L149
  mov    (%rdx,%r8,1),%r11d
  imul   (%rcx,%r8,1),%r11d
  add    %r11d,(%rax,%r8,1)
  cmp    0x30(%rsp),%ebx
  jle    L149
  mov    (%rdx,%r9,1),%r11d
  imul   (%rcx,%r9,1),%r11d
  add    %r11d,(%rax,%r9,1)
  cmp    0x3c(%rsp),%ebx
  jle    L149
  mov    (%rcx,%r10,1),%ecx
  imul   (%rdx,%r10,1),%ecx
  add    %ecx,(%rax,%r10,1)
L149:
  add    $0x8,%rsi
  cmp    0x8(%rsp),%rsi
  jne    L4
L106:
  mov    0x18(%rsp),%rbx
  lea    D31(%rip),%rdi
  mov    (%rbx),%rax
  mov    (%rax),%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x48(%rsp),%rdi
  mov    -0x8(%rbx,%rdi,8),%rax
  mov    -0x4(%rax,%rdi,4),%esi
  lea    D20(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  add    $0x58,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L30:
  lea    D3(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  or     $0xffffffff,%edi
  call   <exit@plt>
  jmp    L131
  nopw   0x0(%rax,%rax,1)
L177:
  xor    %r11d,%r11d
  nopl   0x0(%rax,%rax,1)
L46:
  mov    (%rcx,%r11,4),%ebp
  imul   (%rdx,%r11,4),%ebp
  add    %ebp,(%rax,%r11,4)
  add    $0x1,%r11
  cmp    %r15,%r11
  jne    L46
  jmp    L149
L79:
  cmpq   $0x0,0x10(%rsp)
  sete   %al
  cmpq   $0x0,0x40(%rsp)
  sete   %dl
  or     %dl,%al
  jne    L47
  cmpq   $0x0,0x18(%rsp)
  je     L47
L176:
  xor    %edi,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  jmp    L106
L47:
  lea    D3(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  or     $0xffffffff,%edi
  call   <exit@plt>
  jmp    L176
```

tool_calls: name: disassemble_data
arguments: label: D31
data_type: string
name: disassemble_data
arguments: label: D20
data_type: string
name: disassemble_data
arguments: label: D3
data_type: string

tool: D31: Valor (0,0): %d 


tool: D20: Valor (n-1,n-1): %d 


tool: D3: 
Error en la reserva de memoria.

assistant: ```c
int main(int argc, char **argv) {
  int n, i, j, k;
  struct timespec cgt1, cgt2;
  double ncgt;
  n = atoi(argv[1]);
  int **m1, **m2, **m3;
  m1 = (int **)malloc(n * sizeof(int *));
  m2 = (int **)malloc(n * sizeof(int *));
  m3 = (int **)malloc(n * sizeof(int *));
  for (i = 0; i < n; i++) {
    m1[i] = (int *)malloc(n * sizeof(int));
    m2[i] = (int *)malloc(n * sizeof(int));
    m3[i] = (int *)malloc(n * sizeof(int));
  }
  if ((m1 == NULL) || (m2 == NULL) || (m3 == NULL)) {
    printf("\nError en la reserva de memoria.");
    exit(-1);
  }
  srand(time(NULL));
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      m1[i][j] = ((rand() % 4) + 1);
      m2[i][j] = ((rand() % 4) + 1);
      m3[i][j] = 0;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++)
      m3[i][j] += m1[i][j] * m2[i][j];
  }
  printf("Valor (0,0): %d \n", m3[0][0]);
  printf("Valor (n-1,n-1): %d \n", m3[n - 1][n - 1]);
  printf("\n");
}
```