user: 请从给定的汇编指令推导出C源代码：

```asm
<i2c_ASN1_INTEGER>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %rsi,%r12
  call   <ASN1_INTEGER_valid@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L123
  mov    0x0(%rbp),%eax
  mov    D0(%rip),%rdx
  and    (%rdx),%eax
  mov    0x4(%rbp),%ebx
  test   %ebx,%ebx
  je     L43
  mov    0x8(%rbp),%rcx
  mov    (%rcx),%edx
  test   %eax,%eax
  jne    L156
  mov    $0x0,%esi
  cmp    $0x7f,%edx
  jle    L156
L86:
  add    $0x1,%ebx
  test   %r12,%r12
  je     L123
  mov    (%r12),%rdx
  lea    0x1(%rdx),%r8
  mov    %sil,(%rdx)
  mov    0x4(%rbp),%edi
  test   %edi,%edi
  je     L183
L202:
  test   %eax,%eax
  je     L14
  movslq %edi,%rax
  mov    0x8(%rbp),%rdx
  lea    -0x4(%rdx,%rax,4),%rcx
  lea    -0x1(%r8,%rax,1),%r8
  movzbl (%rcx),%esi
  test   %sil,%sil
  jne    L146
  mov    %r8,%rax
L42:
  sub    $0x1,%rax
  movb   $0x0,0x1(%rax)
  sub    $0x1,%rcx
  lea    (%rdi,%rax,1),%edx
  sub    %r8d,%edx
  movzbl (%rcx),%esi
  test   %sil,%sil
  je     L42
L165:
  neg    %esi
  mov    %sil,(%rax)
  cmp    $0x1,%edx
  jle    L79
  lea    -0x2(%rdx),%edx
  mov    $0xfffffffffffffffe,%rdi
  sub    %rdx,%rdi
  mov    $0xffffffffffffffff,%rdx
L153:
  movzbl (%rcx,%rdx,1),%esi
  not    %esi
  mov    %sil,(%rax,%rdx,1)
  sub    $0x1,%rdx
  cmp    %rdi,%rdx
  jne    L153
  jmp    L79
L156:
  test   %eax,%eax
  je     L192
  cmp    $0x80,%edx
  jg     L20
  je     L144
L192:
  test   %r12,%r12
  je     L123
  mov    (%r12),%r8
  mov    0x4(%rbp),%edi
  jmp    L202
L144:
  cmp    $0x1,%ebx
  jle    L192
  lea    0x4(%rcx),%rdx
  lea    -0x2(%rbx),%esi
  lea    0x8(%rcx,%rsi,4),%rcx
L121:
  cmpl   $0x0,(%rdx)
  jne    L215
  add    $0x4,%rdx
  cmp    %rcx,%rdx
  jne    L121
  jmp    L192
L14:
  mov    0x8(%rbp),%rsi
  mov    %edi,%edx
  mov    %r8,%rdi
  call   <memcpy@plt>
  jmp    L79
L146:
  mov    %r8,%rax
  mov    %edi,%edx
  jmp    L165
L129:
  mov    $0x1,%ebx
  jmp    L123
L43:
  test   %r12,%r12
  je     L129
  mov    (%r12),%r8
  mov    $0x1,%ebx
L183:
  movb   $0x0,(%r8)
L79:
  movslq %ebx,%rax
  add    %rax,(%r12)
L123:
  mov    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L20:
  mov    $0xffffffff,%esi
  jmp    L86
L215:
  mov    $0xffffffff,%esi
  jmp    L86
```

assistant: ```c
int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp) {
  int pad = 0, ret, i, neg;
  unsigned char *p, *n, pb = 0;
  if (!ASN1_INTEGER_valid(a))
    return 0;
  neg = a->type & V_ASN1_NEG;
  if (a->length == 0)
    ret = 1;
  else {
    ret = a->length;
    i = a->data[0];
    if (!neg && (i > 127)) {
      pad = 1;
      pb = 0;
    } else if (neg) {
      if (i > 128) {
        pad = 1;
        pb = 0xFF;
      } else if (i == 128) {
        for (i = 1; i < a->length; i++)
          if (a->data[i]) {
            pad = 1;
            pb = 0xFF;
            break;
          }
      }
    }
    ret += pad;
  }
  if (pp == NULL)
    return (ret);
  p = *pp;
  if (pad)
    *(p++) = pb;
  if (a->length == 0)
    *(p++) = 0;
  else if (!neg)
    memcpy(p, a->data, a->length);
  else {
    n = a->data + a->length - 1;
    p += a->length - 1;
    i = a->length;
    while (!*n) {
      *(p--) = 0;
      n--;
      i--;
    }
    *(p--) = ((*(n--)) ^ 0xff) + 1;
    i--;
    for (; i > 0; i--)
      *(p--) = *(n--) ^ 0xff;
  }
  *pp += ret;
  return (ret);
}
```