user: Translate the below assembly code into C programming language:

```asm
<do_generate>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %rsi,%rbx
  mov    %rdx,%r14
  mov    %rcx,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rdx,%rdx
  je     L46
  mov    %rdi,%rbp
  mov    $0x0,%edi
  call   <NCONF_new@plt>
  mov    %rax,%r13
  lea    0x8(%rsp),%rdx
  mov    %r14,%rsi
  mov    %rax,%rdi
  call   <NCONF_load@plt>
  test   %eax,%eax
  je     L73
  test   %rbx,%rbx
  je     L14
L158:
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <ASN1_generate_nconf@plt>
  mov    %rax,%rbx
  mov    %r13,%rdi
  call   <NCONF_free@plt>
  test   %rbx,%rbx
  je     L4
  mov    $0x0,%esi
  mov    %rbx,%rdi
  call   <i2d_ASN1_TYPE@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  jle    L114
  mov    %eax,%esi
  mov    %r12,%rdi
  call   <BUF_MEM_grow@plt>
  test   %eax,%eax
  je     L48
  mov    (%r12),%rax
  mov    %rax,0x10(%rsp)
  lea    0x10(%rsp),%rsi
  mov    %rbx,%rdi
  call   <i2d_ASN1_TYPE@plt>
  mov    %rbx,%rdi
  call   <ASN1_TYPE_free@plt>
L138:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L88
  mov    %ebp,%eax
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L73:
  mov    0x8(%rsp),%rdx
  test   %rdx,%rdx
  jle    L137
  mov    %r14,%rcx
  lea    D44(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <BIO_printf@plt>
  mov    $0x0,%ebx
  jmp    L84
L14:
  lea    D1(%rip),%rdx
  lea    D6(%rip),%rsi
  mov    %r13,%rdi
  call   <NCONF_get_string@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L158
  mov    %r14,%rdx
  lea    D32(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <BIO_printf@plt>
  jmp    L84
L46:
  mov    %rdx,%r13
  jmp    L158
L137:
  mov    %r14,%rdx
  lea    D16(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <BIO_printf@plt>
  mov    $0x0,%ebx
  jmp    L84
L114:
  mov    $0x0,%r13d
  jmp    L84
L48:
  mov    $0x0,%r13d
L84:
  mov    %r13,%rdi
  call   <NCONF_free@plt>
  mov    %rbx,%rdi
  call   <ASN1_TYPE_free@plt>
  mov    $0xffffffff,%ebp
  jmp    L138
L4:
  mov    $0xffffffff,%ebp
  jmp    L138
L88:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D44
type: string
name: read_data
arguments: label: D1
type: string
name: read_data
arguments: label: D6
type: string
name: read_data
arguments: label: D32
type: string
name: read_data
arguments: label: D16
type: string

tool: D44: Error on line %ld of config file '%s'


tool: D1: asn1

tool: D6: default

tool: D32: Can't find 'asn1' in '%s'


tool: D16: Error loading config file '%s'


assistant: ```c
int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf) {
  CONF *cnf = NULL;
  int len;
  long errline;
  unsigned char *p;
  ASN1_TYPE *atyp = NULL;
  if (genconf) {
    cnf = NCONF_new(NULL);
    if (!NCONF_load(cnf, genconf, &errline))
      goto conferr;
    if (!genstr)
      genstr = NCONF_get_string(cnf, "default", "asn1");
    if (!genstr) {
      BIO_printf(bio, "Can't find 'asn1' in '%s'\n", genconf);
      goto err;
    }
  }
  atyp = ASN1_generate_nconf(genstr, cnf);
  NCONF_free(cnf);
  cnf = NULL;
  if (!atyp)
    return -1;
  len = i2d_ASN1_TYPE(atyp, NULL);
  if (len <= 0)
    goto err;
  if (!BUF_MEM_grow(buf, len))
    goto err;
  p = (unsigned char *)buf->data;
  i2d_ASN1_TYPE(atyp, &p);
  ASN1_TYPE_free(atyp);
  return len;
conferr:
  if (errline > 0)
    BIO_printf(bio, "Error on line %ld of config file '%s'\n", errline, genconf);
  else
    BIO_printf(bio, "Error loading config file '%s'\n", genconf);
err:
  NCONF_free(cnf);
  ASN1_TYPE_free(atyp);
  return -1;
}
```