user: Please show me the C implementation that matches the assembly code listed below:

```asm
<asn1_primitive_new>:
  endbr64
  test   %rsi,%rsi
  je     L116
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    0x10(%rsi),%rax
  test   %rax,%rax
  je     L351
  test   %edx,%edx
  je     L326
  mov    0x8(%rax),%rax
  test   %rax,%rax
  je     L369
  call   *%rax
  pop    %rbx
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L326:
  mov    (%rax),%rax
  test   %rax,%rax
  je     L301
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    *%rax
  nopw   0x0(%rax,%rax,1)
L351:
  mov    D17(%rip),%rbx
  mov    (%rbx),%rax
  cmp    %rax,(%rsi)
  je     L102
  mov    0x8(%rsi),%r12d
  cmp    $0x82,%r12d
  je     L86
  jg     L356
  cmp    $0x80,%r12d
  je     L206
  cmp    $0x81,%r12d
  jne    L67
L191:
  movq   $0x1,0x0(%r13)
  mov    $0x1,%eax
L6:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L301:
  mov    D17(%rip),%rbx
  mov    (%rbx),%rax
  cmp    %rax,(%rsi)
  je     L214
  mov    0x8(%rsi),%r12d
  cmp    $0x82,%r12d
  je     L86
  jg     L145
  cmp    $0x80,%r12d
  je     L206
  cmp    $0x81,%r12d
  je     L191
L156:
  mov    %r12d,%edi
  call   <ASN1_STRING_type_new@plt>
  mov    (%rbx),%rcx
  test   %rax,%rax
  mov    %rax,0x0(%r13)
  mov    %rax,%r14
  setne  %al
  cmp    %rcx,0x0(%rbp)
  sete   %dl
  and    %al,%dl
  je     L152
  mov    0x4(%r14),%ecx
  mov    %edx,%eax
L332:
  mov    D31(%rip),%rdx
  or     (%rdx),%ecx
  mov    %ecx,0x4(%r14)
  jmp    L152
  nop
L369:
  mov    D17(%rip),%rbx
  mov    (%rbx),%rax
  cmp    %rax,(%rsi)
  je     L82
  mov    0x8(%rsi),%r12d
  cmp    $0x82,%r12d
  je     L86
  jg     L234
  cmp    $0x80,%r12d
  je     L206
  cmp    $0x81,%r12d
  je     L191
  jmp    L281
  cs nopw 0x0(%rax,%rax,1)
L102:
  mov    $0xffffffff,%r12d
L67:
  test   %edx,%edx
  je     L156
L281:
  mov    0x0(%r13),%r14
  mov    $0x8,%edx
  xor    %esi,%esi
  mov    %r14,%rdi
  call   <memset@plt>
  mov    D39(%rip),%rax
  movd   %r12d,%xmm0
  mov    (%rax),%ecx
  mov    (%rbx),%rax
  movd   %ecx,%xmm1
  punpckldq %xmm1,%xmm0
  movq   %xmm0,(%r14)
  cmp    %rax,0x0(%rbp)
  je     L296
  cmpq   $0x0,0x0(%r13)
  setne  %al
L152:
  pop    %rbx
  movzbl %al,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L356:
  cmp    $0x83,%r12d
  jne    L67
L50:
  mov    $0x10,%edi
  call   <OPENSSL_malloc@plt>
  test   %rax,%rax
  je     L25
  movq   $0x0,0x8(%rax)
  movl   $0xffffffff,(%rax)
  mov    %rax,0x0(%r13)
  mov    $0x1,%eax
  jmp    L152
  nopl   0x0(%rax)
L25:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L145:
  cmp    $0x83,%r12d
  je     L50
  jmp    L156
  cs nopw 0x0(%rax,%rax,1)
L234:
  cmp    $0x83,%r12d
  je     L50
  jmp    L281
  xchg   %ax,%ax
L86:
  mov    0xc(%rbp),%eax
  mov    %eax,0x0(%r13)
  mov    $0x1,%eax
  jmp    L6
  nopl   0x0(%rax)
L206:
  mov    D29(%rip),%rax
  mov    (%rax),%edi
  call   <OBJ_nid2obj@plt>
  mov    %rax,0x0(%r13)
  mov    $0x1,%eax
  jmp    L6
  nopl   0x0(%rax)
L82:
  mov    $0xffffffff,%r12d
  jmp    L281
  nopl   0x0(%rax,%rax,1)
L214:
  mov    $0xffffffff,%r12d
  jmp    L156
  nopl   0x0(%rax,%rax,1)
L296:
  cmpq   $0x0,0x0(%r13)
  setne  %al
  jmp    L332
  nopl   (%rax)
L116:
  xor    %eax,%eax
  ret
```

assistant: ```c
int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed) {
  ASN1_TYPE *typ;
  ASN1_STRING *str;
  int utype;
  if (!it)
    return 0;
  if (it->funcs) {
    const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
    if (embed) {
      if (pf->prim_clear) {
        pf->prim_clear(pval, it);
        return 1;
      }
    } else if (pf->prim_new) {
      return pf->prim_new(pval, it);
    }
  }
  if (it->itype == ASN1_ITYPE_MSTRING)
    utype = -1;
  else
    utype = it->utype;
  switch (utype) {
  case V_ASN1_OBJECT:
    *pval = (ASN1_VALUE *)OBJ_nid2obj(NID_undef);
    return 1;
  case V_ASN1_BOOLEAN:
    *(ASN1_BOOLEAN *)pval = it->size;
    return 1;
  case V_ASN1_NULL:
    *pval = (ASN1_VALUE *)1;
    return 1;
  case V_ASN1_ANY:
    typ = OPENSSL_malloc(sizeof(*typ));
    if (typ == NULL)
      return 0;
    typ->value.ptr = NULL;
    typ->type = -1;
    *pval = (ASN1_VALUE *)typ;
    break;
  default:
    if (embed) {
      str = *(ASN1_STRING **)pval;
      memset(str, 0, sizeof(*str));
      str->type = utype;
      str->flags = ASN1_STRING_FLAG_EMBED;
    } else {
      str = ASN1_STRING_type_new(utype);
      *pval = (ASN1_VALUE *)str;
    }
    if (it->itype == ASN1_ITYPE_MSTRING && str)
      str->flags |= ASN1_STRING_FLAG_MSTRING;
    break;
  }
  if (*pval)
    return 1;
  return 0;
}
```