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

```asm
<pkcs7_decrypt_rinfo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x18(%rbp)
  movl   $0xffffffff,-0x24(%rbp)
  mov    -0x50(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <EVP_PKEY_CTX_new@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L60
  mov    $0xffffffff,%eax
  jmp    L122
L60:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_PKEY_decrypt_init@plt>
  test   %rax,%rax
  jle    L57
  mov    D11(%rip),%rax
  mov    (%rax),%ecx
  mov    D33(%rip),%rax
  mov    (%rax),%edx
  mov    -0x48(%rbp),%rsi
  mov    -0x10(%rbp),%rax
  mov    %rsi,%r9
  mov    $0x0,%r8d
  mov    $0xffffffff,%esi
  mov    %rax,%rdi
  call   <EVP_PKEY_CTX_ctrl@plt>
  test   %rax,%rax
  jg     L22
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <PKCS7error@plt>
  jmp    L138
L22:
  mov    -0x48(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%esi
  mov    -0x48(%rbp),%rax
  mov    (%rax),%rax
  mov    0x4(%rax),%ecx
  lea    -0x20(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %esi,%r8d
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <EVP_PKEY_decrypt@plt>
  test   %rax,%rax
  jle    L6
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L66
  mov    D19(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <PKCS7error@plt>
  jmp    L138
L66:
  mov    -0x48(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%edi
  mov    -0x48(%rbp),%rax
  mov    (%rax),%rax
  mov    0x4(%rax),%ecx
  lea    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rsi
  mov    -0x10(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <EVP_PKEY_decrypt@plt>
  test   %rax,%rax
  jg     L9
  movl   $0x0,-0x24(%rbp)
  mov    D42(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <PKCS7error@plt>
  jmp    L138
L9:
  movl   $0x1,-0x24(%rbp)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <freezero@plt>
  mov    -0x38(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x20(%rbp),%rax
  mov    %eax,%edx
  mov    -0x40(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L138
L57:
  nop
  jmp    L138
L6:
  nop
L138:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_PKEY_CTX_free@plt>
  cmpl   $0x0,-0x24(%rbp)
  jne    L88
  cmpq   $0x0,-0x18(%rbp)
  je     L88
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L88:
  mov    -0x24(%rbp),%eax
L122:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L33
  call   <__stack_chk_fail@plt>
L33:
  leave
  ret
```

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