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     L162
  mov    (%rdi),%r12
  test   %r12,%r12
  je     L162
  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     L273
L206:
  test   %r14,%r14
  jne    L215
  mov    D30(%rip),%rax
  xor    %r13d,%r13d
  mov    (%rax),%rax
  mov    %rax,0x10(%r12)
L191:
  mov    (%r12),%rdi
  call   <free@plt>
  mov    %r15,(%r12)
  mov    %r13d,0x8(%r12)
  test   %rbx,%rbx
  je     L189
  mov    %r12,(%rbx)
L189:
  mov    (%rsp),%rax
  mov    %rax,0x0(%rbp)
L122:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L215:
  cmpb   $0x0,(%rsi)
  js     L54
  mov    D30(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,0x10(%r12)
  cmpb   $0x0,(%rsi)
  jne    L288
  mov    $0x1,%r13d
  cmp    $0x1,%r14
  je     L44
  add    $0x1,%rsi
  sub    $0x1,%r14
L288:
  mov    %r14d,%r13d
L44:
  mov    %r14,%rdx
  mov    %r15,%rdi
  call   <memcpy@plt>
  jmp    L191
  nopl   0x0(%rax)
L162:
  xor    %eax,%eax
  call   <M_ASN1_INTEGER_new@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L283
  mov    D30(%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    L206
  mov    D4(%rip),%rax
  mov    (%rax),%esi
  mov    D15(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  test   %rbx,%rbx
  je     L203
L140:
  cmp    %r12,(%rbx)
  je     L283
L203:
  mov    %r12,%rdi
  call   <M_ASN1_INTEGER_free@plt>
  nopw   0x0(%rax,%rax,1)
L283:
  xor    %r12d,%r12d
  jmp    L122
L54:
  mov    D56(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,0x10(%r12)
  cmpb   $0xff,(%rsi)
  je     L50
L255:
  movslq %r14d,%rcx
  mov    %r14d,%edx
  sub    $0x1,%rcx
  lea    (%rsi,%rcx,1),%rax
  lea    (%r15,%rcx,1),%rsi
  movzbl (%rax),%ecx
  test   %cl,%cl
  jne    L155
  test   %r14d,%r14d
  jne    L15
  jmp    L156
  nopl   0x0(%rax,%rax,1)
L178:
  test   %edx,%edx
  je     L156
L15:
  sub    $0x1,%rax
  movb   $0x0,(%rsi)
  sub    $0x1,%rsi
  sub    $0x1,%edx
  movzbl (%rax),%ecx
  test   %cl,%cl
  je     L178
L155:
  test   %edx,%edx
  je     L156
  neg    %ecx
  mov    %r14d,%r13d
  mov    %cl,(%rsi)
  cmp    $0x1,%edx
  jle    L191
  sub    $0x2,%edx
  mov    $0xfffffffffffffffe,%rdi
  sub    %rdx,%rdi
  mov    $0xffffffffffffffff,%rdx
  nopl   0x0(%rax)
L243:
  movzbl (%rax,%rdx,1),%ecx
  not    %ecx
  mov    %cl,(%rsi,%rdx,1)
  sub    $0x1,%rdx
  cmp    %rdi,%rdx
  jne    L243
  jmp    L191
  nop
L156:
  movb   $0x1,(%r15)
  lea    0x1(%r14),%r13d
  movb   $0x0,(%r15,%r14,1)
  jmp    L191
  nopw   0x0(%rax,%rax,1)
L50:
  cmp    $0x1,%r14
  je     L150
  add    $0x1,%rsi
  sub    $0x1,%r14
  jmp    L255
  nopl   0x0(%rax,%rax,1)
L150:
  movb   $0x1,(%r15)
  mov    $0x1,%r13d
  jmp    L191
L273:
  mov    D4(%rip),%rax
  mov    (%rax),%esi
  mov    D15(%rip),%rax
  mov    (%rax),%edi
  call   <ASN1err@plt>
  jmp    L140
```

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);
}
```