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

```asm
<asn1_d2i_ex_primitive>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %rdx,-0x68(%rbp)
  mov    %rcx,-0x70(%rbp)
  mov    %r8d,-0x74(%rbp)
  mov    %r9d,-0x78(%rbp)
  mov    0x10(%rbp),%eax
  mov    %al,-0x7c(%rbp)
  mov    0x18(%rbp),%rax
  mov    %rax,-0x88(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x44(%rbp)
  movb   $0x0,-0x49(%rbp)
  movq   $0x0,-0x30(%rbp)
  cmpq   $0x0,-0x58(%rbp)
  jne    L244
  mov    D179(%rip),%rax
  mov    (%rax),%edx
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  mov    $0x0,%eax
  jmp    L165
L244:
  mov    -0x70(%rbp),%rax
  mov    (%rax),%rdx
  mov    D213(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L260
  mov    -0x74(%rbp),%eax
  mov    %eax,-0x48(%rbp)
  movl   $0xffffffff,-0x74(%rbp)
  jmp    L404
L260:
  mov    -0x70(%rbp),%rax
  mov    0x8(%rax),%eax
  mov    %eax,-0x48(%rbp)
L404:
  mov    -0x48(%rbp),%edx
  mov    D130(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L161
  cmpl   $0x0,-0x74(%rbp)
  js     L312
  mov    D61(%rip),%rax
  mov    (%rax),%edx
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  mov    $0x0,%eax
  jmp    L165
L312:
  cmpb   $0x0,-0x7c(%rbp)
  je     L375
  mov    D133(%rip),%rax
  mov    (%rax),%edx
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  mov    $0x0,%eax
  jmp    L165
L375:
  mov    -0x60(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x38(%rbp)
  lea    -0x38(%rbp),%rcx
  lea    -0x20(%rbp),%rdx
  lea    -0x48(%rbp),%rax
  sub    $0x8,%rsp
  push   -0x88(%rbp)
  push   $0x0
  push   $0x0
  push   $0xffffffffffffffff
  push   -0x68(%rbp)
  mov    %rcx,%r9
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <asn1_check_tlen@plt>
  add    $0x30,%rsp
  mov    %eax,-0x44(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  jne    L40
  mov    D153(%rip),%rax
  mov    (%rax),%edx
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  mov    $0x0,%eax
  jmp    L165
L40:
  movzbl -0x20(%rbp),%edx
  mov    D112(%rip),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L161
  mov    D0(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x48(%rbp)
L161:
  cmpl   $0xffffffff,-0x74(%rbp)
  jne    L234
  mov    -0x48(%rbp),%eax
  mov    %eax,-0x74(%rbp)
  mov    D112(%rip),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x78(%rbp)
L234:
  mov    -0x60(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x38(%rbp)
  movsbl -0x7c(%rbp),%ecx
  lea    -0x38(%rbp),%rdi
  lea    -0x4b(%rbp),%rsi
  lea    -0x4a(%rbp),%rdx
  lea    -0x40(%rbp),%rax
  sub    $0x8,%rsp
  push   -0x88(%rbp)
  push   %rcx
  mov    -0x78(%rbp),%ecx
  push   %rcx
  mov    -0x74(%rbp),%ecx
  push   %rcx
  push   -0x68(%rbp)
  mov    %rdi,%r9
  mov    %rsi,%r8
  mov    %rdx,%rcx
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <asn1_check_tlen@plt>
  add    $0x30,%rsp
  mov    %eax,-0x44(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  jne    L28
  mov    D153(%rip),%rax
  mov    (%rax),%edx
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  mov    $0x0,%eax
  jmp    L165
L28:
  cmpl   $0xffffffff,-0x44(%rbp)
  jne    L251
  mov    $0xffffffff,%eax
  jmp    L165
L251:
  movl   $0x0,-0x44(%rbp)
  mov    -0x48(%rbp),%edx
  mov    D139(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L393
  mov    -0x48(%rbp),%edx
  mov    D29(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L393
  mov    -0x48(%rbp),%edx
  mov    D0(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L341
L393:
  mov    -0x48(%rbp),%edx
  mov    D0(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L43
  cmpq   $0x0,-0x88(%rbp)
  je     L19
  mov    -0x88(%rbp),%rax
  movq   $0x0,(%rax)
  jmp    L19
L43:
  movzbl -0x4b(%rbp),%eax
  test   %al,%al
  jne    L19
  mov    D131(%rip),%rax
  mov    (%rax),%edx
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  mov    $0x0,%eax
  jmp    L165
L19:
  mov    -0x60(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x30(%rbp)
  movzbl -0x4a(%rbp),%eax
  test   %al,%al
  je     L289
  movzbl -0x4a(%rbp),%eax
  movsbl %al,%edx
  mov    -0x40(%rbp),%rcx
  lea    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <asn1_find_end@plt>
  test   %eax,%eax
  je     L131
  mov    -0x38(%rbp),%rax
  sub    -0x30(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  jmp    L313
L289:
  mov    -0x38(%rbp),%rax
  sub    -0x30(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x38(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x38(%rbp)
  movq   $0x0,-0x18(%rbp)
  jmp    L313
L341:
  movzbl -0x4b(%rbp),%eax
  test   %al,%al
  je     L37
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x18(%rbp)
  mov    D112(%rip),%rax
  movzbl (%rax),%eax
  movzbl %al,%edi
  movzbl -0x4a(%rbp),%eax
  movsbl %al,%ecx
  mov    -0x40(%rbp),%rdx
  lea    -0x38(%rbp),%rsi
  lea    -0x20(%rbp),%rax
  mov    %edi,%r9d
  mov    $0xffffffff,%r8d
  mov    %rax,%rdi
  call   <asn1_collect@plt>
  test   %eax,%eax
  jne    L195
  movb   $0x1,-0x49(%rbp)
  jmp    L351
L195:
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  lea    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <BUF_MEM_grow_clean@plt>
  test   %eax,%eax
  jne    L228
  mov    D230(%rip),%rax
  mov    (%rax),%edx
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ASN1err@plt>
  mov    $0x0,%eax
  jmp    L165
L228:
  mov    -0x18(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  movq   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  movb   $0x1,-0x49(%rbp)
  jmp    L313
L37:
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x38(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x38(%rbp)
L313:
  mov    -0x48(%rbp),%ecx
  mov    -0x70(%rbp),%r8
  lea    -0x49(%rbp),%rdi
  mov    -0x28(%rbp),%rdx
  mov    -0x30(%rbp),%rsi
  mov    -0x58(%rbp),%rax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <asn1_ex_c2i@plt>
  test   %eax,%eax
  je     L44
  mov    -0x38(%rbp),%rdx
  mov    -0x60(%rbp),%rax
  mov    %rdx,(%rax)
  movl   $0x1,-0x44(%rbp)
  jmp    L351
L131:
  nop
  jmp    L351
L44:
  nop
L351:
  movzbl -0x49(%rbp),%eax
  test   %al,%al
  je     L249
  mov    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L249
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <OPENSSL_free@plt>
L249:
  mov    -0x44(%rbp),%eax
L165:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L209
  call   <__stack_chk_fail@plt>
L209:
  leave
  ret
```

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;
  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;
      buf.data = NULL;
    }
  } else if (cst) {
    buf.length = 0;
    buf.max = 0;
    buf.data = NULL;
    if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL)) {
      free_cont = 1;
      goto err;
    }
    len = buf.length;
    if (!BUF_MEM_grow_clean(&buf, len + 1)) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
      return 0;
    }
    buf.data[len] = 0;
    cont = (const unsigned char *)buf.data;
    free_cont = 1;
  } 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 && buf.data)
    OPENSSL_free(buf.data);
  return ret;
}
```