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

```asm
<asn1_template_ex_d2i>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %r8d,%eax
  mov    %r9,-0x60(%rbp)
  mov    %al,-0x54(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x38(%rbp)
  jne    L91
  mov    $0x0,%eax
  jmp    L102
L91:
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x2c(%rbp)
  mov    D3(%rip),%rax
  mov    (%rax),%eax
  and    -0x2c(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    D105(%rip),%rax
  mov    (%rax),%eax
  and    -0x2c(%rbp),%eax
  test   %eax,%eax
  je     L55
  movsbl -0x54(%rbp),%esi
  mov    -0x50(%rbp),%rax
  mov    0x4(%rax),%ecx
  lea    -0x18(%rbp),%r8
  lea    -0x2d(%rbp),%rdi
  lea    -0x2e(%rbp),%rdx
  lea    -0x20(%rbp),%rax
  sub    $0x8,%rsp
  push   -0x60(%rbp)
  push   %rsi
  mov    -0x28(%rbp),%esi
  push   %rsi
  push   %rcx
  push   -0x48(%rbp)
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rdx,%rcx
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <asn1_check_tlen@plt>
  add    $0x30,%rsp
  mov    %eax,-0x24(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jne    L106
  mov    D87(%rip),%rax
  mov    (%rax),%edx
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  mov    $0x0,%eax
  jmp    L102
L106:
  cmpl   $0xffffffff,-0x24(%rbp)
  jne    L134
  mov    $0xffffffff,%eax
  jmp    L102
L134:
  movzbl -0x2d(%rbp),%eax
  test   %al,%al
  jne    L155
  mov    D23(%rip),%rax
  mov    (%rax),%edx
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  mov    $0x0,%eax
  jmp    L102
L155:
  mov    -0x20(%rbp),%rdx
  mov    -0x60(%rbp),%rdi
  mov    -0x50(%rbp),%rcx
  lea    -0x18(%rbp),%rsi
  mov    -0x38(%rbp),%rax
  mov    %rdi,%r9
  mov    $0x0,%r8d
  mov    %rax,%rdi
  call   <asn1_template_noexp_d2i@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jne    L166
  mov    D87(%rip),%rax
  mov    (%rax),%edx
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  mov    $0x0,%eax
  jmp    L102
L166:
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  sub    -0x10(%rbp),%rax
  mov    %rax,%rcx
  mov    %rdx,%rax
  sub    %rcx,%rax
  mov    %rax,-0x20(%rbp)
  movzbl -0x2e(%rbp),%eax
  test   %al,%al
  je     L93
  mov    -0x20(%rbp),%rdx
  lea    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <asn1_check_eoc@plt>
  test   %eax,%eax
  jne    L146
  mov    D50(%rip),%rax
  mov    (%rax),%edx
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  jmp    L163
L93:
  mov    -0x20(%rbp),%rax
  test   %rax,%rax
  je     L146
  mov    D75(%rip),%rax
  mov    (%rax),%edx
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  jmp    L163
L55:
  movsbl -0x54(%rbp),%edi
  mov    -0x60(%rbp),%r8
  mov    -0x50(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x40(%rbp),%rsi
  mov    -0x38(%rbp),%rax
  mov    %r8,%r9
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <asn1_template_noexp_d2i@plt>
  jmp    L102
L146:
  mov    -0x18(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,(%rax)
  mov    $0x1,%eax
  jmp    L102
L163:
  mov    -0x50(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <ASN1_template_free@plt>
  mov    -0x38(%rbp),%rax
  movq   $0x0,(%rax)
  mov    $0x0,%eax
L102:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L80
  call   <__stack_chk_fail@plt>
L80:
  leave
  ret
```

assistant: ```c
int asn1_template_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long inlen, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx) {
  int flags, aclass;
  int ret;
  long len;
  const unsigned char *p, *q;
  char exp_eoc;
  if (!val)
    return 0;
  flags = tt->flags;
  aclass = flags & ASN1_TFLG_TAG_CLASS;
  p = *in;
  if (flags & ASN1_TFLG_EXPTAG) {
    char cst;
    ret = asn1_check_tlen(&len, NULL, NULL, &exp_eoc, &cst, &p, inlen, tt->tag, aclass, opt, ctx);
    q = p;
    if (!ret) {
      ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
      return 0;
    } else if (ret == -1)
      return -1;
    if (!cst) {
      ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED);
      return 0;
    }
    ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx);
    if (!ret) {
      ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
      return 0;
    }
    len -= p - q;
    if (exp_eoc) {
      if (!asn1_check_eoc(&p, len)) {
        ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ASN1_R_MISSING_EOC);
        goto err;
      }
    } else {
      if (len) {
        ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ASN1_R_EXPLICIT_LENGTH_MISMATCH);
        goto err;
      }
    }
  } else
    return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx);
  *in = p;
  return 1;
err:
  ASN1_template_free(val, tt);
  *val = NULL;
  return 0;
}
```