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

```asm
<asn1_d2i_ex_primitive>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdx,0x8(%rsp)
  mov    %r9d,0x4(%rsp)
  mov    0x90(%rsp),%r14d
  mov    0x98(%rsp),%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  movb   $0x0,0x1b(%rsp)
  test   %rdi,%rdi
  je     L297
  mov    %rdi,%r13
  mov    %rsi,%r12
  mov    %rcx,%rbp
  mov    %r8d,%ebx
  mov    D230(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,(%rcx)
  je     L380
  mov    0x8(%rcx),%eax
  mov    %eax,0x1c(%rsp)
  mov    D211(%rip),%rdx
  cmp    (%rdx),%eax
  je     L302
L315:
  cmp    $0xffffffff,%ebx
  je     L202
L363:
  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     L278
  cmp    $0xffffffff,%eax
  je     L57
  mov    0x1c(%rsp),%eax
  mov    D75(%rip),%rdx
  cmp    (%rdx),%eax
  je     L281
  mov    D135(%rip),%rdx
  cmp    (%rdx),%eax
  je     L281
  mov    D109(%rip),%rdx
  cmp    (%rdx),%eax
  je     L61
  cmpb   $0x0,0x19(%rsp)
  jne    L121
  mov    0x28(%rsp),%r15
  mov    0x20(%rsp),%r14
  lea    (%r15,%r14,1),%rax
  mov    %rax,0x28(%rsp)
  jmp    L104
L297:
  mov    D6(%rip),%rax
  mov    (%rax),%esi
  mov    D67(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  mov    $0x0,%ebx
  jmp    L57
L302:
  test   %r8d,%r8d
  jns    L30
L161:
  test   %r14b,%r14b
  jne    L351
  mov    (%r12),%rax
  mov    %rax,0x28(%rsp)
  lea    0x30(%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     L195
  mov    D85(%rip),%rax
  movzbl (%rax),%eax
  cmp    %al,0x30(%rsp)
  je     L315
  mov    D109(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x1c(%rsp)
  jmp    L315
L30:
  mov    D151(%rip),%rax
  mov    (%rax),%esi
  mov    D67(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
L293:
  mov    $0x0,%ebx
  jmp    L57
L309:
  mov    $0xffffffff,%ebx
  jmp    L161
L351:
  mov    D236(%rip),%rax
  mov    (%rax),%esi
  mov    D67(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  jmp    L293
L195:
  mov    D141(%rip),%rax
  mov    (%rax),%esi
  mov    D67(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  jmp    L293
L278:
  mov    D141(%rip),%rax
  mov    (%rax),%esi
  mov    D67(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  jmp    L57
L281:
  mov    D109(%rip),%rdx
  cmp    (%rdx),%eax
  je     L61
  cmpb   $0x0,0x19(%rsp)
  je     L371
L83:
  mov    (%r12),%r15
  movzbl 0x1a(%rsp),%edx
  test   %dl,%dl
  jne    L317
  mov    0x28(%rsp),%rax
  mov    %rax,%r14
  sub    %r15,%r14
  add    0x20(%rsp),%r14
  add    0x20(%rsp),%rax
  mov    %rax,0x28(%rsp)
  movq   $0x0,0x38(%rsp)
L104:
  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     L208
  mov    0x28(%rsp),%rax
  mov    %rax,(%r12)
  mov    $0x1,%ebx
L208:
  cmpb   $0x0,0x1b(%rsp)
  jne    L134
L57:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L107
  mov    %ebx,%eax
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L61:
  test   %r15,%r15
  je     L83
  movq   $0x0,(%r15)
  jmp    L83
L371:
  mov    D77(%rip),%rax
  mov    (%rax),%esi
  mov    D67(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  mov    $0x0,%ebx
  jmp    L57
L317:
  movsbl %dl,%edx
  lea    0x28(%rsp),%rdi
  mov    0x20(%rsp),%rsi
  call   <asn1_find_end@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L208
  mov    0x28(%rsp),%r14
  sub    %r15,%r14
  jmp    L104
L121:
  movq   $0x0,0x30(%rsp)
  movq   $0x0,0x40(%rsp)
  movq   $0x0,0x38(%rsp)
  movsbl 0x1a(%rsp),%ecx
  lea    0x28(%rsp),%rsi
  lea    0x30(%rsp),%rdi
  mov    D85(%rip),%rax
  movzbl (%rax),%r9d
  mov    $0xffffffff,%r8d
  mov    0x20(%rsp),%rdx
  call   <asn1_collect@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jne    L182
  movb   $0x1,0x1b(%rsp)
L134:
  mov    0x38(%rsp),%rdi
  test   %rdi,%rdi
  je     L57
  call   <OPENSSL_free@plt>
  jmp    L57
L182:
  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     L246
  mov    0x38(%rsp),%rax
  movq   $0x0,(%rax,%r14,8)
  mov    0x38(%rsp),%r15
  movb   $0x1,0x1b(%rsp)
  jmp    L104
L246:
  mov    D175(%rip),%rax
  mov    (%rax),%esi
  mov    D67(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  jmp    L57
L380:
  mov    %r8d,0x1c(%rsp)
  mov    D211(%rip),%rax
  cmp    (%rax),%r8d
  je     L309
L202:
  mov    0x1c(%rsp),%ebx
  mov    D85(%rip),%rax
  movzbl (%rax),%eax
  mov    %eax,0x4(%rsp)
  jmp    L363
L107:
  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;
  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;
}
```