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

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  lea    D6(%rip),%rbp
  push   %rbx
  mov    %rbp,%rdi
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rdx
  lea    0xc(%rsp),%rsi
  call   <scanf@plt>
  mov    0x8(%rsp),%edi
  imul   0xc(%rsp),%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    0x8(%rsp),%eax
  imul   0xc(%rsp),%eax
  test   %eax,%eax
  jle    L4
  mov    %r13,%r14
  xor    %ebx,%ebx
  lea    D12(%rip),%r12
  cs nopw 0x0(%rax,%rax,1)
L72:
  mov    %r14,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x1,%ebx
  call   <scanf@plt>
  mov    0x8(%rsp),%eax
  imul   0xc(%rsp),%eax
  add    $0x4,%r14
  cmp    %ebx,%eax
  jg     L72
L4:
  lea    0x10(%rsp),%rdx
  lea    0x14(%rsp),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0x10(%rsp),%edi
  imul   0x14(%rsp),%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    0x10(%rsp),%edi
  mov    %rax,%r14
  mov    0x14(%rsp),%eax
  imul   %edi,%eax
  test   %eax,%eax
  jle    L53
  mov    %r14,%rbp
  xor    %ebx,%ebx
  lea    D12(%rip),%r12
  nopl   0x0(%rax)
L29:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x1,%ebx
  call   <scanf@plt>
  mov    0x10(%rsp),%edi
  mov    0x14(%rsp),%eax
  add    $0x4,%rbp
  imul   %edi,%eax
  cmp    %ebx,%eax
  jg     L29
L53:
  imul   0xc(%rsp),%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  sub    $0x8,%rsp
  mov    %r13,%rdx
  mov    %r14,%r9
  push   %rax
  mov    0x20(%rsp),%r8d
  mov    %rax,%rbp
  mov    0x24(%rsp),%ecx
  mov    0x18(%rsp),%esi
  mov    0x1c(%rsp),%edi
  call   <matmul@plt>
  pop    %rdx
  pop    %rcx
  cmp    $0x1,%eax
  je     L61
  mov    0x10(%rsp),%edx
  mov    0xc(%rsp),%esi
  lea    D21(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x10(%rsp),%eax
  imul   0xc(%rsp),%eax
  test   %eax,%eax
  jle    L38
  xor    %ebx,%ebx
  lea    D8(%rip),%r12
  nop
L76:
  mov    0x0(%rbp,%rbx,4),%esi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x1,%rbx
  call   <printf@plt>
  mov    0xc(%rsp),%eax
  imul   0x10(%rsp),%eax
  cmp    %ebx,%eax
  jg     L76
L38:
  mov    $0xa,%edi
  call   <putchar@plt>
  xor    %eax,%eax
L61:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D6
data_type: string
name: disassemble_data
arguments: data_label: D12
data_type: string
name: disassemble_data
arguments: data_label: D21
data_type: string
name: disassemble_data
arguments: data_label: D8
data_type: string

tool: D6: %d %d

tool: D12: %d

tool: D21: %d %d 

tool: D8: %d 

assistant: ```c
int main() {
  int w1, h1, w2, h2;
  int *m1, *m2, *m3;
  int i;
  scanf("%d %d", &h1, &w1);
  m1 = malloc((w1 * h1) * sizeof(m1));
  for (i = 0; i < w1 * h1; i++) {
    scanf("%d", &m1[i]);
  }
  scanf("%d %d", &h2, &w2);
  m2 = malloc((w2 * h2) * sizeof(m2));
  for (i = 0; i < w2 * h2; i++) {
    scanf("%d", &m2[i]);
  }
  m3 = malloc((h1 * w2) * sizeof(m3));
  int ret = matmul(h1, w1, m1, h2, w2, m2, m3);
  if (ret == 1) {
    return 1;
  }
  printf("%d %d ", h1, w2);
  for (i = 0; i < h1 * w2; i++) {
    printf("%d ", m3[i]);
  }
  printf("\n");
  return 0;
}
```