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

```asm
<get_file_info>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    D5(%rip),%rax
  mov    (%rax),%edx
  mov    D11(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    %eax,-0x28(%rbp)
  cmpl   $0x0,-0x28(%rbp)
  jns    L94
  mov    $0x0,%eax
  jmp    L140
L94:
  lea    -0x2c(%rbp),%rdx
  mov    -0x28(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <fstat@plt>
  test   %rax,%rax
  jns    L118
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    $0x0,%eax
  jmp    L140
L118:
  mov    -0x2c(%rbp),%edx
  mov    -0x40(%rbp),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
  call   <EVP_MD_CTX_create@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L22
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    $0x0,%eax
  jmp    L140
L22:
  mov    $0x0,%eax
  call   <EVP_sha1@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L3
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_MD_CTX_destroy@plt>
  mov    $0x0,%eax
  jmp    L140
L3:
  mov    -0x18(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestInit_ex@plt>
  test   %eax,%eax
  jne    L8
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_MD_CTX_destroy@plt>
  mov    $0x0,%eax
  jmp    L140
L8:
  mov    $0x10000,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
L76:
  mov    -0x10(%rbp),%rcx
  mov    -0x28(%rbp),%eax
  mov    $0x10000,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,%edi
  call   <TEMP_FAILURE_RETRY@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jns    L62
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_MD_CTX_destroy@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L140
L62:
  cmpl   $0x0,-0x24(%rbp)
  je     L14
  mov    -0x24(%rbp),%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestUpdate@plt>
  jmp    L76
L14:
  nop
  mov    -0x48(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestFinal_ex@plt>
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_MD_CTX_destroy@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x1,%eax
L140:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L13
  call   <__stack_chk_fail@plt>
L13:
  leave
  ret
```

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;
}
```