user: What would the C source look like for the assembly code provided here?

```asm
<BN_to_ASN1_INTEGER>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L91
  mov    $0x0,%eax
  call   <ASN1_INTEGER_new@plt>
  mov    %rax,-0x10(%rbp)
  jmp    L107
L91:
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x10(%rbp)
L107:
  cmpq   $0x0,-0x10(%rbp)
  jne    L20
  mov    D14(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <ASN1error@plt>
  jmp    L111
L20:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <BN_is_negative@plt>
  test   %rax,%rax
  je     L133
  mov    D25(%rip),%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,0x10(%rax)
  jmp    L61
L133:
  mov    D9(%rip),%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,0x10(%rax)
L61:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <BN_num_bits@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  je     L82
  mov    -0x18(%rbp),%eax
  lea    0x7(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x3,%eax
  add    $0x1,%eax
  jmp    L21
L82:
  mov    $0x0,%eax
L21:
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  lea    0x3(%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jl     L137
  mov    -0x14(%rbp),%eax
  lea    0x4(%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L101
  mov    D29(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <ASN1error@plt>
  jmp    L111
L101:
  mov    -0x10(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,0x8(%rax)
L137:
  mov    -0x10(%rbp),%rax
  mov    0x8(%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <BN_bn2bin@plt>
  mov    -0x10(%rbp),%rdx
  mov    %eax,(%rdx)
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L100
  mov    -0x10(%rbp),%rax
  mov    0x8(%rax),%rax
  movb   $0x0,(%rax)
  mov    -0x10(%rbp),%rax
  movl   $0x1,(%rax)
L100:
  mov    -0x10(%rbp),%rax
  jmp    L122
L111:
  mov    -0x10(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  je     L88
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <ASN1_INTEGER_free@plt>
L88:
  mov    $0x0,%eax
L122:
  leave
  ret
```

assistant: ```c
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) {
  ASN1_INTEGER *ret;
  int len, j;
  if (ai == NULL)
    ret = ASN1_INTEGER_new();
  else
    ret = ai;
  if (ret == NULL) {
    ASN1error(ERR_R_NESTED_ASN1_ERROR);
    goto err;
  }
  if (BN_is_negative(bn))
    ret->type = V_ASN1_NEG_INTEGER;
  else
    ret->type = V_ASN1_INTEGER;
  j = BN_num_bits(bn);
  len = ((j == 0) ? 0 : ((j / 8) + 1));
  if (ret->length < len + 4) {
    unsigned char *new_data = realloc(ret->data, len + 4);
    if (!new_data) {
      ASN1error(ERR_R_MALLOC_FAILURE);
      goto err;
    }
    ret->data = new_data;
  }
  ret->length = BN_bn2bin(bn, ret->data);
  if (!ret->length) {
    ret->data[0] = 0;
    ret->length = 1;
  }
  return (ret);
err:
  if (ret != ai)
    ASN1_INTEGER_free(ret);
  return (NULL);
}
```