user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<get_file_info>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %rsi,%rbp
  mov    %rdx,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    D7(%rip),%rax
  mov    (%rax),%esi
  mov    D8(%rip),%rax
  or     (%rax),%esi
  call   <open@plt>
  mov    $0x0,%r14d
  test   %eax,%eax
  js     L30
  mov    %eax,%ebx
  lea    0x4(%rsp),%rsi
  mov    %eax,%edi
  call   <fstat@plt>
  test   %rax,%rax
  js     L115
  mov    0x4(%rsp),%eax
  mov    %eax,0x0(%rbp)
  mov    $0x0,%eax
  call   <EVP_MD_CTX_create@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L60
  mov    $0x0,%eax
  call   <EVP_sha1@plt>
  mov    %rax,%rsi
  test   %rax,%rax
  je     L70
  mov    $0x0,%edx
  mov    %r12,%rdi
  call   <EVP_DigestInit_ex@plt>
  mov    %eax,%r14d
  test   %eax,%eax
  je     L80
  mov    $0x10000,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
L11:
  mov    $0x10000,%edx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <read@plt>
  mov    %eax,%edi
  call   <TEMP_FAILURE_RETRY@plt>
  mov    %eax,%edx
  test   %eax,%eax
  js     L39
  je     L15
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <EVP_DigestUpdate@plt>
  jmp    L11
L115:
  mov    %ebx,%edi
  call   <close@plt>
L30:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  mov    %r14d,%eax
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L60:
  mov    %ebx,%edi
  call   <close@plt>
  mov    $0x0,%r14d
  jmp    L30
L70:
  mov    %ebx,%edi
  call   <close@plt>
  mov    %r12,%rdi
  call   <EVP_MD_CTX_destroy@plt>
  mov    $0x0,%r14d
  jmp    L30
L80:
  mov    %ebx,%edi
  call   <close@plt>
  mov    %r12,%rdi
  call   <EVP_MD_CTX_destroy@plt>
  jmp    L30
L39:
  mov    %ebx,%edi
  call   <close@plt>
  mov    %r12,%rdi
  call   <EVP_MD_CTX_destroy@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    $0x0,%r14d
  jmp    L30
L15:
  mov    $0x0,%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <EVP_DigestFinal_ex@plt>
  mov    %ebx,%edi
  call   <close@plt>
  mov    %r12,%rdi
  call   <EVP_MD_CTX_destroy@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    $0x1,%r14d
  jmp    L30
L25:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int get_file_info(char *filename, int *size, uint8_t *hash) {
  int fd;
  struct stat stat_buf;
  const EVP_MD *m;
  EVP_MD_CTX *ctx;
  uint8_t *read_buf;
  fd = open(filename, O_RDONLY | O_NOFOLLOW);
  if (fd < 0)
    return 0;
  if (fstat(fd, &stat_buf) < 0) {
    close(fd);
    return 0;
  }
  *size = stat_buf.st_size;
  if (!(ctx = EVP_MD_CTX_create())) {
    close(fd);
    return 0;
  }
  if (!(m = EVP_sha1())) {
    close(fd);
    EVP_MD_CTX_destroy(ctx);
    return 0;
  }
  if (!EVP_DigestInit_ex(ctx, m, NULL)) {
    close(fd);
    EVP_MD_CTX_destroy(ctx);
    return 0;
  }
  read_buf = malloc(65536);
  while (1) {
    int b = TEMP_FAILURE_RETRY(read(fd, read_buf, 65536));
    if (b < 0) {
      close(fd);
      EVP_MD_CTX_destroy(ctx);
      free(read_buf);
      return 0;
    }
    if (b == 0)
      break;
    EVP_DigestUpdate(ctx, read_buf, b);
  }
  EVP_DigestFinal_ex(ctx, hash, NULL);
  close(fd);
  EVP_MD_CTX_destroy(ctx);
  free(read_buf);
  return 1;
}
```