user: Demonstrate the C code that generates the assembly output below:

```asm
<PKCS7_SIGNER_INFO_sign>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x28(%rbp)
  movq   $0x0,-0x18(%rbp)
  mov    -0x48(%rbp),%rax
  mov    0x18(%rax),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <EVP_get_digestbyobj@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L166
  mov    $0x0,%eax
  jmp    L38
L166:
  mov    $0x0,%eax
  call   <EVP_MD_CTX_new@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L160
  mov    D34(%rip),%rax
  mov    (%rax),%edx
  mov    D3(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <PKCS7err@plt>
  jmp    L20
L160:
  mov    -0x48(%rbp),%rax
  mov    0x10(%rax),%ecx
  mov    -0x18(%rbp),%rdx
  lea    -0x30(%rbp),%rsi
  mov    -0x10(%rbp),%rax
  mov    %ecx,%r8d
  mov    $0x0,%ecx
  mov    %rax,%rdi
  call   <EVP_DigestSignInit@plt>
  test   %rax,%rax
  jle    L74
  mov    D75(%rip),%rax
  mov    (%rax),%ecx
  mov    D31(%rip),%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%rax
  mov    -0x48(%rbp),%rsi
  mov    %rsi,%r9
  mov    $0x0,%r8d
  mov    $0xffffffff,%esi
  mov    %rax,%rdi
  call   <EVP_PKEY_CTX_ctrl@plt>
  test   %rax,%rax
  jg     L36
  mov    D40(%rip),%rax
  mov    (%rax),%edx
  mov    D3(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <PKCS7err@plt>
  jmp    L20
L36:
  mov    D50(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <ASN1_ITEM_rptr@plt>
  mov    %eax,%edx
  mov    -0x48(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,%rcx
  lea    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <ASN1_item_i2d@plt>
  mov    %eax,-0x34(%rbp)
  mov    -0x28(%rbp),%rax
  test   %rax,%rax
  je     L206
  mov    -0x28(%rbp),%rcx
  mov    -0x34(%rbp),%edx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestSignUpdate@plt>
  test   %rax,%rax
  jle    L179
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <OPENSSL_free@plt>
  movq   $0x0,-0x28(%rbp)
  lea    -0x20(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <EVP_DigestSignFinal@plt>
  test   %rax,%rax
  jle    L142
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <OPENSSL_malloc@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  test   %rax,%rax
  je     L174
  mov    -0x28(%rbp),%rcx
  lea    -0x20(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestSignFinal@plt>
  test   %rax,%rax
  jle    L9
  mov    D75(%rip),%rax
  mov    (%rax),%ecx
  mov    D31(%rip),%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%rax
  mov    -0x48(%rbp),%rsi
  mov    %rsi,%r9
  mov    $0x1,%r8d
  mov    $0xffffffff,%esi
  mov    %rax,%rdi
  call   <EVP_PKEY_CTX_ctrl@plt>
  test   %rax,%rax
  jg     L62
  mov    D40(%rip),%rax
  mov    (%rax),%edx
  mov    D3(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <PKCS7err@plt>
  jmp    L20
L62:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_MD_CTX_free@plt>
  mov    -0x20(%rbp),%rdx
  mov    -0x28(%rbp),%rcx
  mov    -0x48(%rbp),%rax
  mov    (%rax),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <ASN1_STRING_set0@plt>
  mov    $0x1,%eax
  jmp    L38
L74:
  nop
  jmp    L20
L206:
  nop
  jmp    L20
L179:
  nop
  jmp    L20
L142:
  nop
  jmp    L20
L174:
  nop
  jmp    L20
L9:
  nop
L20:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <OPENSSL_free@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_MD_CTX_free@plt>
  mov    $0x0,%eax
L38:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L175
  call   <__stack_chk_fail@plt>
L175:
  leave
  ret
```

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