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

```asm
<pkcs7_decrypt_rinfo>:
  endbr64
  push   %r15
  push   %r14
  mov    $0xffffffff,%r14d
  push   %r13
  mov    %rdi,%r13
  mov    %rcx,%rdi
  push   %r12
  mov    %rsi,%r12
  xor    %esi,%esi
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <EVP_PKEY_CTX_new@plt>
  test   %rax,%rax
  je     L8
  mov    %rax,%rdi
  mov    %rax,%rbp
  call   <EVP_PKEY_decrypt_init@plt>
  test   %rax,%rax
  jle    L34
  mov    D0(%rip),%rax
  xor    %r8d,%r8d
  mov    %rbx,%r9
  mov    %rbp,%rdi
  mov    $0xffffffff,%esi
  mov    (%rax),%ecx
  mov    D37(%rip),%rax
  mov    (%rax),%edx
  call   <EVP_PKEY_CTX_ctrl@plt>
  test   %rax,%rax
  jle    L35
  mov    (%rbx),%rax
  lea    0x10(%rsp),%rdx
  xor    %esi,%esi
  mov    %rbp,%rdi
  mov    %rdx,0x8(%rsp)
  mov    0x4(%rax),%ecx
  mov    (%rax),%r8d
  call   <EVP_PKEY_decrypt@plt>
  test   %rax,%rax
  jle    L34
  mov    0x10(%rsp),%rdi
  call   <malloc@plt>
  mov    0x8(%rsp),%rdx
  test   %rax,%rax
  mov    %rax,%r15
  je     L84
  mov    (%rbx),%rax
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    0x4(%rax),%ecx
  mov    (%rax),%r8d
  call   <EVP_PKEY_decrypt@plt>
  test   %rax,%rax
  jle    L28
  mov    0x0(%r13),%rdi
  mov    (%r12),%esi
  mov    $0x1,%r14d
  call   <freezero@plt>
  mov    0x10(%rsp),%rax
  mov    %r15,0x0(%r13)
  mov    %rbp,%rdi
  mov    %eax,(%r12)
  call   <EVP_PKEY_CTX_free@plt>
  nopl   0x0(%rax,%rax,1)
L8:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L37
  add    $0x28,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L34:
  mov    $0xffffffff,%r14d
L54:
  mov    %rbp,%rdi
  call   <EVP_PKEY_CTX_free@plt>
  jmp    L8
  nopl   0x0(%rax,%rax,1)
L28:
  mov    D25(%rip),%rax
  xor    %r14d,%r14d
  mov    (%rax),%edi
  call   <PKCS7error@plt>
  mov    %rbp,%rdi
  call   <EVP_PKEY_CTX_free@plt>
  mov    %r15,%rdi
  call   <free@plt>
  jmp    L8
  nopl   0x0(%rax,%rax,1)
L35:
  mov    D22(%rip),%rax
  mov    (%rax),%edi
  call   <PKCS7error@plt>
  jmp    L54
L37:
  call   <__stack_chk_fail@plt>
L84:
  mov    D42(%rip),%rax
  mov    (%rax),%edi
  call   <PKCS7error@plt>
  jmp    L54
```

assistant: ```c
int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen, PKCS7_RECIP_INFO *ri, EVP_PKEY *pkey) {
  EVP_PKEY_CTX *pctx = NULL;
  unsigned char *ek = NULL;
  size_t eklen;
  int ret = -1;
  pctx = EVP_PKEY_CTX_new(pkey, NULL);
  if (!pctx)
    return -1;
  if (EVP_PKEY_decrypt_init(pctx) <= 0)
    goto err;
  if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DECRYPT, EVP_PKEY_CTRL_PKCS7_DECRYPT, 0, ri) <= 0) {
    PKCS7error(PKCS7_R_CTRL_ERROR);
    goto err;
  }
  if (EVP_PKEY_decrypt(pctx, NULL, &eklen, ri->enc_key->data, ri->enc_key->length) <= 0)
    goto err;
  ek = malloc(eklen);
  if (ek == NULL) {
    PKCS7error(ERR_R_MALLOC_FAILURE);
    goto err;
  }
  if (EVP_PKEY_decrypt(pctx, ek, &eklen, ri->enc_key->data, ri->enc_key->length) <= 0) {
    ret = 0;
    PKCS7error(ERR_R_EVP_LIB);
    goto err;
  }
  ret = 1;
  freezero(*pek, *peklen);
  *pek = ek;
  *peklen = eklen;
err:
  EVP_PKEY_CTX_free(pctx);
  if (!ret && ek)
    free(ek);
  return ret;
}
```