user: 请将以下的汇编代码转换成C语言代码:

```asm
<PKCS7_SIGNER_INFO_sign>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    0x18(%rdi),%rax
  movq   $0x0,0x8(%rsp)
  mov    (%rax),%edi
  call   <EVP_get_digestbyobj@plt>
  mov    %rax,%r12
  xor    %eax,%eax
  test   %r12,%r12
  je     L78
  call   <EVP_MD_CTX_new@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L76
  mov    0x10(%rbx),%r8d
  xor    %ecx,%ecx
  mov    %rsp,%rsi
  mov    %r12,%rdx
  mov    %rax,%rdi
  call   <EVP_DigestSignInit@plt>
  test   %rax,%rax
  jle    L15
  mov    (%rsp),%rdi
  xor    %r8d,%r8d
  mov    %rbx,%r9
  mov    $0xffffffff,%esi
  mov    D18(%rip),%r13
  mov    D35(%rip),%r12
  mov    0x0(%r13),%ecx
  mov    (%r12),%edx
  call   <EVP_PKEY_CTX_ctrl@plt>
  test   %rax,%rax
  jle    L87
  mov    D12(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1_ITEM_rptr@plt>
  mov    0x8(%rbx),%rdi
  lea    0x8(%rsp),%rsi
  mov    %eax,%edx
  call   <ASN1_item_i2d@plt>
  mov    0x8(%rsp),%rdi
  mov    %eax,%edx
  test   %rdi,%rdi
  je     L74
  mov    %rdi,%rsi
  mov    %rbp,%rdi
  call   <EVP_DigestSignUpdate@plt>
  mov    0x8(%rsp),%rdi
  test   %rax,%rax
  jle    L74
  call   <OPENSSL_free@plt>
  lea    0x10(%rsp),%r14
  xor    %esi,%esi
  mov    %rbp,%rdi
  movq   $0x0,0x8(%rsp)
  mov    %r14,%rdx
  call   <EVP_DigestSignFinal@plt>
  test   %rax,%rax
  jle    L15
  mov    0x10(%rsp),%rdi
  call   <OPENSSL_malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %rax,%rdi
  test   %rax,%rax
  je     L74
  mov    %r14,%rdx
  mov    %rax,%rsi
  mov    %rbp,%rdi
  call   <EVP_DigestSignFinal@plt>
  test   %rax,%rax
  jle    L15
  mov    0x0(%r13),%ecx
  mov    (%r12),%edx
  mov    %rbx,%r9
  mov    $0xffffffff,%esi
  mov    (%rsp),%rdi
  mov    $0x1,%r8d
  call   <EVP_PKEY_CTX_ctrl@plt>
  test   %rax,%rax
  jle    L87
  mov    %rbp,%rdi
  call   <EVP_MD_CTX_free@plt>
  mov    0x10(%rsp),%rdx
  mov    0x8(%rsp),%rsi
  mov    (%rbx),%edi
  call   <ASN1_STRING_set0@plt>
  mov    $0x1,%eax
  nopw   0x0(%rax,%rax,1)
L78:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L77
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L15:
  mov    0x8(%rsp),%rdi
L74:
  call   <OPENSSL_free@plt>
  mov    %rbp,%rdi
  call   <EVP_MD_CTX_free@plt>
  xor    %eax,%eax
  jmp    L78
  cs nopw 0x0(%rax,%rax,1)
L76:
  mov    D49(%rip),%rax
L27:
  mov    (%rax),%esi
  mov    D1(%rip),%rax
  mov    (%rax),%edi
  call   <PKCS7err@plt>
  mov    0x8(%rsp),%rdi
  jmp    L74
  xchg   %ax,%ax
L87:
  mov    D3(%rip),%rax
  jmp    L27
L77:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) {
  EVP_MD_CTX *mctx;
  EVP_PKEY_CTX *pctx;
  unsigned char *abuf = NULL;
  int alen;
  size_t siglen;
  const EVP_MD *md = NULL;
  md = EVP_get_digestbyobj(si->digest_alg->algorithm);
  if (md == NULL)
    return 0;
  mctx = EVP_MD_CTX_new();
  if (mctx == NULL) {
    PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SIGN, ERR_R_MALLOC_FAILURE);
    goto err;
  }
  if (EVP_DigestSignInit(mctx, &pctx, md, NULL, si->pkey) <= 0)
    goto err;
  if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN, EVP_PKEY_CTRL_PKCS7_SIGN, 0, si) <= 0) {
    PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SIGN, PKCS7_R_CTRL_ERROR);
    goto err;
  }
  alen = ASN1_item_i2d((ASN1_VALUE *)si->auth_attr, &abuf, ASN1_ITEM_rptr(PKCS7_ATTR_SIGN));
  if (!abuf)
    goto err;
  if (EVP_DigestSignUpdate(mctx, abuf, alen) <= 0)
    goto err;
  OPENSSL_free(abuf);
  abuf = NULL;
  if (EVP_DigestSignFinal(mctx, NULL, &siglen) <= 0)
    goto err;
  abuf = OPENSSL_malloc(siglen);
  if (abuf == NULL)
    goto err;
  if (EVP_DigestSignFinal(mctx, abuf, &siglen) <= 0)
    goto err;
  if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN, EVP_PKEY_CTRL_PKCS7_SIGN, 1, si) <= 0) {
    PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SIGN, PKCS7_R_CTRL_ERROR);
    goto err;
  }
  EVP_MD_CTX_free(mctx);
  ASN1_STRING_set0(si->enc_digest, abuf, siglen);
  return 1;
err:
  OPENSSL_free(abuf);
  EVP_MD_CTX_free(mctx);
  return 0;
}
```