user: What is the c source code of the assembly code below?

```asm
<asn1_d2i_ex_primitive>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdx,0x8(%rsp)
  mov    %r9d,0x4(%rsp)
  mov    0xa0(%rsp),%r14d
  mov    0xa8(%rsp),%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  movb   $0x0,0x1b(%rsp)
  movq   $0x0,0x30(%rsp)
  movq   $0x0,0x38(%rsp)
  movq   $0x0,0x40(%rsp)
  movq   $0x0,0x48(%rsp)
  movq   $0x0,0x50(%rsp)
  test   %rdi,%rdi
  je     L192
  mov    %rdi,%r13
  mov    %rsi,%r12
  mov    %rcx,%rbp
  mov    %r8d,%ebx
  mov    D26(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,(%rcx)
  je     L116
  mov    0x8(%rcx),%eax
  mov    %eax,0x1c(%rsp)
  mov    D28(%rip),%rdx
  cmp    (%rdx),%eax
  je     L196
L26:
  cmp    $0xffffffff,%ebx
  je     L263
L269:
  mov    (%r12),%rax
  mov    %rax,0x28(%rsp)
  lea    0x1a(%rsp),%rcx
  lea    0x20(%rsp),%rdi
  sub    $0x8,%rsp
  push   %r15
  movsbl %r14b,%r14d
  push   %r14
  mov    0x1c(%rsp),%eax
  push   %rax
  push   %rbx
  push   0x30(%rsp)
  lea    0x58(%rsp),%r9
  lea    0x49(%rsp),%r8
  mov    $0x0,%edx
  mov    $0x0,%esi
  call   <asn1_check_tlen@plt>
  mov    %eax,%ebx
  add    $0x30,%rsp
  test   %eax,%eax
  je     L317
  cmp    $0xffffffff,%eax
  je     L275
  mov    0x1c(%rsp),%eax
  mov    D47(%rip),%rdx
  cmp    (%rdx),%eax
  je     L441
  mov    D309(%rip),%rdx
  cmp    (%rdx),%eax
  je     L441
  mov    D109(%rip),%rdx
  cmp    (%rdx),%eax
  je     L360
  cmpb   $0x0,0x19(%rsp)
  je     L258
  mov    D66(%rip),%rdx
  cmp    (%rdx),%eax
  je     L449
  mov    D33(%rip),%rdx
  cmp    (%rdx),%eax
  je     L449
  mov    D315(%rip),%rdx
  cmp    (%rdx),%eax
  je     L449
  mov    D256(%rip),%rdx
  cmp    (%rdx),%eax
  je     L449
  mov    D316(%rip),%rdx
  cmp    (%rdx),%eax
  je     L449
  movb   $0x1,0x1b(%rsp)
  mov    D35(%rip),%rax
  movzbl (%rax),%r9d
  movsbl 0x1a(%rsp),%ecx
  lea    0x28(%rsp),%rsi
  lea    0x30(%rsp),%rdi
  sub    $0x8,%rsp
  push   $0x0
  mov    $0xffffffff,%r8d
  mov    0x30(%rsp),%rdx
  call   <asn1_collect@plt>
  mov    %eax,%ebx
  add    $0x10,%rsp
  test   %eax,%eax
  je     L84
  mov    0x30(%rsp),%r14
  lea    0x1(%r14),%rsi
  lea    0x30(%rsp),%rdi
  call   <BUF_MEM_grow_clean@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L18
  mov    0x38(%rsp),%rax
  movq   $0x0,(%rax,%r14,8)
  mov    0x38(%rsp),%r15
  jmp    L106
L192:
  mov    D273(%rip),%rax
  mov    (%rax),%esi
  mov    D226(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  mov    $0x0,%ebx
  jmp    L275
L196:
  test   %r8d,%r8d
  jns    L53
L63:
  test   %r14b,%r14b
  jne    L379
  mov    (%r12),%rax
  mov    %rax,0x28(%rsp)
  lea    0x20(%rsp),%rdx
  lea    0x1c(%rsp),%rsi
  sub    $0x8,%rsp
  push   %r15
  push   $0x0
  push   $0x0
  push   $0xffffffffffffffff
  push   0x30(%rsp)
  lea    0x58(%rsp),%r9
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edi
  call   <asn1_check_tlen@plt>
  add    $0x30,%rsp
  test   %eax,%eax
  je     L450
  mov    D35(%rip),%rax
  movzbl (%rax),%eax
  cmp    %al,0x20(%rsp)
  je     L26
  mov    D109(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x1c(%rsp)
  jmp    L26
L53:
  mov    D155(%rip),%rax
  mov    (%rax),%esi
  mov    D226(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
L310:
  mov    $0x0,%ebx
  jmp    L275
L89:
  mov    $0xffffffff,%ebx
  jmp    L63
L379:
  mov    D192(%rip),%rax
  mov    (%rax),%esi
  mov    D226(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  jmp    L310
L450:
  mov    D300(%rip),%rax
  mov    (%rax),%esi
  mov    D226(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  jmp    L310
L317:
  mov    D300(%rip),%rax
  mov    (%rax),%esi
  mov    D226(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  jmp    L275
L441:
  mov    D109(%rip),%rdx
  cmp    (%rdx),%eax
  je     L360
  cmpb   $0x0,0x19(%rsp)
  je     L90
L168:
  mov    (%r12),%r15
  movzbl 0x1a(%rsp),%edx
  test   %dl,%dl
  jne    L80
  mov    0x28(%rsp),%rax
  mov    %rax,%r14
  sub    %r15,%r14
  add    0x20(%rsp),%r14
  add    0x20(%rsp),%rax
  mov    %rax,0x28(%rsp)
L106:
  mov    %rbp,%r9
  lea    0x1b(%rsp),%r8
  mov    0x1c(%rsp),%ecx
  mov    %r14,%rdx
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <asn1_ex_c2i@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L84
  mov    0x28(%rsp),%rax
  mov    %rax,(%r12)
  mov    $0x1,%ebx
L84:
  cmpb   $0x0,0x1b(%rsp)
  jne    L327
L275:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L38
  mov    %ebx,%eax
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L360:
  test   %r15,%r15
  je     L168
  movq   $0x0,(%r15)
  jmp    L168
L90:
  mov    D247(%rip),%rax
  mov    (%rax),%esi
  mov    D226(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  mov    $0x0,%ebx
  jmp    L275
L80:
  movsbl %dl,%edx
  lea    0x28(%rsp),%rdi
  mov    0x20(%rsp),%rsi
  call   <asn1_find_end@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L84
  mov    0x28(%rsp),%r14
  sub    %r15,%r14
  jmp    L106
L449:
  mov    D16(%rip),%rax
  mov    (%rax),%esi
  mov    D226(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  mov    $0x0,%ebx
  jmp    L275
L18:
  mov    D217(%rip),%rax
  mov    (%rax),%esi
  mov    D226(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  jmp    L84
L258:
  mov    0x28(%rsp),%r15
  mov    0x20(%rsp),%r14
  lea    (%r15,%r14,1),%rax
  mov    %rax,0x28(%rsp)
  jmp    L106
L327:
  mov    0x38(%rsp),%rdi
  call   <OPENSSL_free@plt>
  jmp    L275
L116:
  mov    %r8d,0x1c(%rsp)
  mov    D28(%rip),%rax
  cmp    (%rax),%r8d
  je     L89
L263:
  mov    0x1c(%rsp),%ebx
  mov    D35(%rip),%rax
  movzbl (%rax),%eax
  mov    %eax,0x4(%rsp)
  jmp    L269
L38:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int asn1_d2i_ex_primitive(ASN1_VALUE **pval, const unsigned char **in, long inlen, const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx) {
  int ret = 0, utype;
  long plen;
  char cst, inf, free_cont = 0;
  const unsigned char *p;
  BUF_MEM buf = {0, NULL, 0, 0};
  const unsigned char *cont = NULL;
  long len;
  if (!pval) {
    ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL);
    return 0;
  }
  if (it->itype == ASN1_ITYPE_MSTRING) {
    utype = tag;
    tag = -1;
  } else
    utype = it->utype;
  if (utype == V_ASN1_ANY) {
    unsigned char oclass;
    if (tag >= 0) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_TAGGED_ANY);
      return 0;
    }
    if (opt) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_OPTIONAL_ANY);
      return 0;
    }
    p = *in;
    ret = asn1_check_tlen(NULL, &utype, &oclass, NULL, NULL, &p, inlen, -1, 0, 0, ctx);
    if (!ret) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR);
      return 0;
    }
    if (oclass != V_ASN1_UNIVERSAL)
      utype = V_ASN1_OTHER;
  }
  if (tag == -1) {
    tag = utype;
    aclass = V_ASN1_UNIVERSAL;
  }
  p = *in;
  ret = asn1_check_tlen(&plen, NULL, NULL, &inf, &cst, &p, inlen, tag, aclass, opt, ctx);
  if (!ret) {
    ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR);
    return 0;
  } else if (ret == -1)
    return -1;
  ret = 0;
  if ((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER)) {
    if (utype == V_ASN1_OTHER) {
      if (ctx)
        (ctx)->valid = 0;
    } else if (!cst) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_CONSTRUCTED);
      return 0;
    }
    cont = *in;
    if (inf) {
      if (!asn1_find_end(&p, plen, inf))
        goto err;
      len = p - cont;
    } else {
      len = p - cont + plen;
      p += plen;
    }
  } else if (cst) {
    if (utype == V_ASN1_NULL || utype == V_ASN1_BOOLEAN || utype == V_ASN1_OBJECT || utype == V_ASN1_INTEGER || utype == V_ASN1_ENUMERATED) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_PRIMITIVE);
      return 0;
    }
    free_cont = 1;
    if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL, 0)) {
      goto err;
    }
    len = buf.length;
    if (!BUF_MEM_grow_clean(&buf, len + 1)) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
      goto err;
    }
    buf.data[len] = 0;
    cont = (const unsigned char *)buf.data;
  } else {
    cont = p;
    len = plen;
    p += plen;
  }
  if (!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it))
    goto err;
  *in = p;
  ret = 1;
err:
  if (free_cont)
    OPENSSL_free(buf.data);
  return ret;
}
```