user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<c2i_ASN1_INTEGER>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  test   %rdi,%rdi
  je     L69
  mov    (%rdi),%r12
  test   %r12,%r12
  je     L69
  mov    (%rsi),%rsi
  lea    0x1(%rdx),%rdi
  lea    (%rsi,%rdx,1),%rax
  mov    %rsi,0x8(%rsp)
  mov    %rax,(%rsp)
  call   <malloc@plt>
  mov    0x8(%rsp),%rsi
  test   %rax,%rax
  mov    %rax,%r15
  je     L105
L261:
  test   %r14,%r14
  jne    L221
  mov    D16(%rip),%rax
  xor    %r13d,%r13d
  mov    (%rax),%rax
  mov    %rax,0x10(%r12)
L209:
  mov    (%r12),%rdi
  call   <free@plt>
  mov    %r15,(%r12)
  mov    %r13d,0x8(%r12)
  test   %rbx,%rbx
  je     L61
  mov    %r12,(%rbx)
L61:
  mov    (%rsp),%rax
  mov    %rax,0x0(%rbp)
L4:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L221:
  cmpb   $0x0,(%rsi)
  js     L45
  mov    D16(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,0x10(%r12)
  cmpb   $0x0,(%rsi)
  jne    L228
  mov    $0x1,%r13d
  cmp    $0x1,%r14
  je     L81
  add    $0x1,%rsi
  sub    $0x1,%r14
L228:
  mov    %r14d,%r13d
L81:
  mov    %r14,%rdx
  mov    %r15,%rdi
  call   <memcpy@plt>
  jmp    L209
  nopl   0x0(%rax)
L69:
  xor    %eax,%eax
  call   <M_ASN1_INTEGER_new@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L113
  mov    D16(%rip),%rax
  lea    0x1(%r14),%rdi
  mov    (%rax),%rax
  mov    %rax,0x10(%r12)
  mov    0x0(%rbp),%rsi
  lea    (%rsi,%r14,1),%rax
  mov    %rsi,0x8(%rsp)
  mov    %rax,(%rsp)
  call   <malloc@plt>
  mov    0x8(%rsp),%rsi
  test   %rax,%rax
  mov    %rax,%r15
  jne    L261
  mov    D66(%rip),%rax
  mov    (%rax),%esi
  mov    D33(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  test   %rbx,%rbx
  je     L241
L259:
  cmp    %r12,(%rbx)
  je     L113
L241:
  mov    %r12,%rdi
  call   <M_ASN1_INTEGER_free@plt>
  nopw   0x0(%rax,%rax,1)
L113:
  xor    %r12d,%r12d
  jmp    L4
L45:
  mov    D49(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,0x10(%r12)
  cmpb   $0xff,(%rsi)
  je     L289
L116:
  movslq %r14d,%rdx
  mov    %r14d,%r13d
  sub    $0x1,%rdx
  lea    (%rsi,%rdx,1),%rax
  lea    (%r15,%rdx,1),%rsi
  movzbl (%rax),%ecx
  test   %cl,%cl
  jne    L277
  test   %r14d,%r14d
  je     L94
  mov    %r14d,%edx
  jmp    L285
  nop
L253:
  test   %edx,%edx
  je     L94
L285:
  sub    $0x1,%rax
  movb   $0x0,(%rsi)
  sub    $0x1,%rsi
  sub    $0x1,%edx
  movzbl (%rax),%ecx
  test   %cl,%cl
  je     L253
L156:
  test   %edx,%edx
  je     L94
  neg    %ecx
  mov    %cl,(%rsi)
  cmp    $0x1,%edx
  jle    L209
  sub    $0x2,%edx
  mov    $0xfffffffffffffffe,%rdi
  sub    %rdx,%rdi
  mov    $0xffffffffffffffff,%rdx
  xchg   %ax,%ax
L17:
  movzbl (%rax,%rdx,1),%ecx
  not    %ecx
  mov    %cl,(%rsi,%rdx,1)
  sub    $0x1,%rdx
  cmp    %rdi,%rdx
  jne    L17
  jmp    L209
  nopw   0x0(%rax,%rax,1)
L94:
  movb   $0x1,(%r15)
  lea    0x1(%r14),%r13d
  movb   $0x0,(%r15,%r14,1)
  jmp    L209
  nopw   0x0(%rax,%rax,1)
L289:
  cmp    $0x1,%r14
  je     L74
  add    $0x1,%rsi
  sub    $0x1,%r14
  jmp    L116
  nopl   0x0(%rax,%rax,1)
L74:
  movb   $0x1,(%r15)
  mov    $0x1,%r13d
  jmp    L209
L105:
  mov    D66(%rip),%rax
  mov    (%rax),%esi
  mov    D33(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  jmp    L259
L277:
  mov    %r14d,%edx
  jmp    L156
```

assistant: ```c
ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, long len) {
  ASN1_INTEGER *ret = NULL;
  const unsigned char *p, *pend;
  unsigned char *to, *s;
  int i;
  if ((a == NULL) || ((*a) == NULL)) {
    if ((ret = M_ASN1_INTEGER_new()) == NULL)
      return (NULL);
    ret->type = V_ASN1_INTEGER;
  } else
    ret = (*a);
  p = *pp;
  pend = p + len;
  s = malloc(len + 1);
  if (s == NULL) {
    i = ERR_R_MALLOC_FAILURE;
    goto err;
  }
  to = s;
  if (!len) {
    ret->type = V_ASN1_INTEGER;
  } else if (*p & 0x80) {
    ret->type = V_ASN1_NEG_INTEGER;
    if ((*p == 0xff) && (len != 1)) {
      p++;
      len--;
    }
    i = len;
    p += i - 1;
    to += i - 1;
    while ((!*p) && i) {
      *(to--) = 0;
      i--;
      p--;
    }
    if (!i) {
      *s = 1;
      s[len] = 0;
      len++;
    } else {
      *(to--) = (*(p--) ^ 0xff) + 1;
      i--;
      for (; i > 0; i--)
        *(to--) = *(p--) ^ 0xff;
    }
  } else {
    ret->type = V_ASN1_INTEGER;
    if ((*p == 0) && (len != 1)) {
      p++;
      len--;
    }
    memcpy(s, p, len);
  }
  free(ret->data);
  ret->data = s;
  ret->length = (int)len;
  if (a != NULL)
    (*a) = ret;
  *pp = pend;
  return (ret);
err:
  ASN1err(ASN1_F_C2I_ASN1_INTEGER, i);
  if ((ret != NULL) && ((a == NULL) || (*a != ret)))
    M_ASN1_INTEGER_free(ret);
  return (NULL);
}
```