user: Converte this assembly snippet into its equivalent C code:

```asm
<asn1_check_tlen>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %r8,-0x58(%rbp)
  mov    %r9,-0x60(%rbp)
  mov    0x28(%rbp),%eax
  mov    %al,-0x64(%rbp)
  mov    0x30(%rbp),%rax
  mov    %rax,-0x70(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x60(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,0x10(%rbp)
  jg     L86
  mov    D49(%rip),%rax
  mov    (%rax),%edx
  mov    D10(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ERR_raise@plt>
  jmp    L237
L86:
  cmpq   $0x0,-0x70(%rbp)
  je     L79
  mov    -0x70(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L79
  mov    -0x70(%rbp),%rax
  mov    0x4(%rax),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x70(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x70(%rbp),%rax
  mov    0x10(%rax),%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x70(%rbp),%rax
  mov    0x14(%rax),%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x70(%rbp),%rax
  mov    0x18(%rax),%eax
  cltq
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  jmp    L105
L79:
  lea    -0x28(%rbp),%rcx
  lea    -0x2c(%rbp),%rdx
  lea    -0x20(%rbp),%rsi
  lea    -0x18(%rbp),%rax
  mov    0x10(%rbp),%r8
  mov    %rax,%rdi
  call   <ASN1_get_object@plt>
  mov    %eax,-0x24(%rbp)
  cmpq   $0x0,-0x70(%rbp)
  je     L105
  mov    -0x70(%rbp),%rax
  mov    -0x24(%rbp),%edx
  mov    %edx,0x4(%rax)
  mov    -0x20(%rbp),%rdx
  mov    -0x70(%rbp),%rax
  mov    %rdx,0x8(%rax)
  mov    -0x28(%rbp),%edx
  mov    -0x70(%rbp),%rax
  mov    %edx,0x10(%rax)
  mov    -0x2c(%rbp),%edx
  mov    -0x70(%rbp),%rax
  mov    %edx,0x14(%rax)
  mov    -0x18(%rbp),%rax
  sub    -0x10(%rbp),%rax
  mov    %eax,%edx
  mov    -0x70(%rbp),%rax
  mov    %edx,0x18(%rax)
  mov    -0x70(%rbp),%rax
  movl   $0x1,(%rax)
  mov    -0x24(%rbp),%eax
  and    $0x81,%eax
  test   %eax,%eax
  jne    L105
  mov    -0x70(%rbp),%rax
  mov    0x18(%rax),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,0x10(%rbp)
  jge    L105
  mov    D73(%rip),%rax
  mov    (%rax),%edx
  mov    D10(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ERR_raise@plt>
  jmp    L237
L105:
  mov    -0x24(%rbp),%eax
  and    $0x80,%eax
  test   %eax,%eax
  je     L173
  mov    D47(%rip),%rax
  mov    (%rax),%edx
  mov    D10(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ERR_raise@plt>
  jmp    L237
L173:
  cmpl   $0x0,0x18(%rbp)
  js     L210
  mov    -0x2c(%rbp),%eax
  cmp    %eax,0x18(%rbp)
  jne    L123
  mov    -0x28(%rbp),%eax
  cmp    %eax,0x20(%rbp)
  je     L51
L123:
  cmpb   $0x0,-0x64(%rbp)
  je     L218
  mov    $0xffffffff,%eax
  jmp    L48
L218:
  mov    D15(%rip),%rax
  mov    (%rax),%edx
  mov    D10(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ERR_raise@plt>
  jmp    L237
L51:
  cmpq   $0x0,-0x70(%rbp)
  je     L210
  mov    -0x70(%rbp),%rax
  movl   $0x0,(%rax)
L210:
  mov    -0x24(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L97
  mov    -0x18(%rbp),%rax
  sub    -0x10(%rbp),%rax
  mov    %rax,%rdx
  mov    0x10(%rbp),%rax
  sub    %rdx,%rax
  mov    %rax,-0x20(%rbp)
L97:
  cmpq   $0x0,-0x50(%rbp)
  je     L151
  mov    -0x24(%rbp),%eax
  and    $0x1,%eax
  mov    %eax,%edx
  mov    -0x50(%rbp),%rax
  mov    %dl,(%rax)
L151:
  cmpq   $0x0,-0x58(%rbp)
  je     L140
  mov    -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    D57(%rip),%rax
  mov    (%rax),%eax
  and    %eax,%edx
  mov    -0x58(%rbp),%rax
  mov    %dl,(%rax)
L140:
  cmpq   $0x0,-0x38(%rbp)
  je     L181
  mov    -0x20(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
L181:
  cmpq   $0x0,-0x48(%rbp)
  je     L195
  mov    -0x28(%rbp),%eax
  mov    %eax,%edx
  mov    -0x48(%rbp),%rax
  mov    %dl,(%rax)
L195:
  cmpq   $0x0,-0x40(%rbp)
  je     L70
  mov    -0x2c(%rbp),%edx
  mov    -0x40(%rbp),%rax
  mov    %edx,(%rax)
L70:
  mov    -0x18(%rbp),%rdx
  mov    -0x60(%rbp),%rax
  mov    %rdx,(%rax)
  mov    $0x1,%eax
  jmp    L48
L237:
  cmpq   $0x0,-0x70(%rbp)
  je     L227
  mov    -0x70(%rbp),%rax
  movl   $0x0,(%rax)
L227:
  mov    $0x0,%eax
L48:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L126
  call   <__stack_chk_fail@plt>
L126:
  leave
  ret
```

assistant: ```c
int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf, char *cst, const unsigned char **in, long len, int exptag, int expclass, char opt, ASN1_TLC *ctx) {
  int i;
  int ptag, pclass;
  long plen;
  const unsigned char *p, *q;
  p = *in;
  q = p;
  if (len <= 0) {
    ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_SMALL);
    goto err;
  }
  if (ctx != NULL && ctx->valid) {
    i = ctx->ret;
    plen = ctx->plen;
    pclass = ctx->pclass;
    ptag = ctx->ptag;
    p += ctx->hdrlen;
  } else {
    i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
    if (ctx != NULL) {
      ctx->ret = i;
      ctx->plen = plen;
      ctx->pclass = pclass;
      ctx->ptag = ptag;
      ctx->hdrlen = p - q;
      ctx->valid = 1;
      if ((i & 0x81) == 0 && (plen + ctx->hdrlen) > len) {
        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LONG);
        goto err;
      }
    }
  }
  if ((i & 0x80) != 0) {
    ERR_raise(ERR_LIB_ASN1, ASN1_R_BAD_OBJECT_HEADER);
    goto err;
  }
  if (exptag >= 0) {
    if (exptag != ptag || expclass != pclass) {
      if (opt != 0)
        return -1;
      ERR_raise(ERR_LIB_ASN1, ASN1_R_WRONG_TAG);
      goto err;
    }
    do {
      if ((ctx) != NULL)
        (ctx)->valid = 0;
    } while (0);
  }
  if ((i & 1) != 0)
    plen = len - (p - q);
  if (inf != NULL)
    *inf = i & 1;
  if (cst != NULL)
    *cst = i & V_ASN1_CONSTRUCTED;
  if (olen != NULL)
    *olen = plen;
  if (oclass != NULL)
    *oclass = pclass;
  if (otag != NULL)
    *otag = ptag;
  *in = p;
  return 1;
err:
  do {
    if ((ctx) != NULL)
      (ctx)->valid = 0;
  } while (0);
  return 0;
}
```