user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<ler_ficheiro>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  sub    $0x450,%rsp
  mov    %rdi,-0x448(%rbp)
  mov    %esi,-0x44c(%rbp)
  mov    %edx,-0x450(%rbp)
  mov    %rcx,-0x458(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    -0x450(%rbp),%ebx
  movslq %ebx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x428(%rbp)
  movslq %ebx,%rax
  mov    %rax,%r8
  mov    $0x0,%r9d
  movl   $0x0,-0x42c(%rbp)
  mov    -0x448(%rbp),%rdx
  lea    -0x420(%rbp),%rax
  mov    $0x400,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  movl   $0x0,-0x438(%rbp)
  jmp    L79
L0:
  movl   $0x0,-0x434(%rbp)
  lea    -0x43c(%rbp),%rdx
  lea    -0x420(%rbp),%rax
  lea    D3(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L50
  mov    -0x438(%rbp),%eax
  movslq %eax,%rdx
  movslq %ebx,%rax
  imul   %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x458(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x43c(%rbp),%edx
  mov    -0x434(%rbp),%eax
  cltq
  mov    %edx,(%rcx,%rax,4)
  addl   $0x1,-0x434(%rbp)
  movl   $0x0,-0x430(%rbp)
  jmp    L19
L25:
  lea    -0x420(%rbp),%rdx
  mov    -0x430(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%r12
  lea    -0x420(%rbp),%rdx
  mov    -0x430(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    $0x3a,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%rdx
  mov    %r12,%rax
  sub    %rdx,%rax
  mov    %eax,%edx
  mov    -0x430(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x430(%rbp)
  lea    -0x420(%rbp),%rdx
  mov    -0x430(%rbp),%eax
  cltq
  lea    (%rdx,%rax,1),%rcx
  lea    -0x43c(%rbp),%rax
  mov    %rax,%rdx
  lea    D3(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L49
  mov    -0x438(%rbp),%eax
  movslq %eax,%rdx
  movslq %ebx,%rax
  imul   %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x458(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x43c(%rbp),%edx
  mov    -0x434(%rbp),%eax
  cltq
  mov    %edx,(%rcx,%rax,4)
  jmp    L18
L49:
  mov    -0x438(%rbp),%eax
  movslq %eax,%rdx
  movslq %ebx,%rax
  imul   %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x458(%rbp),%rax
  add    %rax,%rdx
  mov    -0x434(%rbp),%eax
  cltq
  movl   $0xffffffff,(%rdx,%rax,4)
L18:
  addl   $0x1,-0x434(%rbp)
L19:
  mov    -0x434(%rbp),%eax
  cmp    -0x450(%rbp),%eax
  jl     L25
  addl   $0x1,-0x438(%rbp)
  jmp    L79
L50:
  addl   $0x1,-0x42c(%rbp)
L79:
  mov    -0x448(%rbp),%rdx
  lea    -0x420(%rbp),%rax
  mov    $0x400,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L13
  cmpl   $0x0,-0x42c(%rbp)
  je     L0
  nop
L13:
  nop
  mov    -0x18(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L31
  call   <__stack_chk_fail@plt>
L31:
  add    $0x450,%rsp
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D3
type_infered: string

tool: D3: %d

assistant: ```c
void ler_ficheiro(FILE *fpin, int altura, int largura, int matriz[altura][largura]) {
  char linha[1024];
  int temp;
  int i, j, k;
  int linhas_em_branco = 0;
  fgets(linha, 1024, fpin);
  i = 0;
  while (fgets(linha, 1024, fpin) != NULL && linhas_em_branco == 0) {
    j = 0;
    if (sscanf(linha, "%d", &temp) == 1) {
      matriz[i][j] = temp;
      j++;
      k = 0;
      while (j < largura) {
        k += strlen(&linha[k]) - strlen(strchr(&linha[k], ':') + 1);
        if (sscanf(&linha[k], "%d", &temp) == 1) {
          matriz[i][j] = temp;
        } else {
          matriz[i][j] = -1;
        }
        j++;
      }
      i++;
    } else {
      linhas_em_branco++;
    }
  }
  return;
}
```