user: 请将以下的汇编代码转换成C语言代码:

```asm
<asn1_oid_encode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    -0x2c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  mov    %eax,%esi
  mov    $0x1,%edi
  call   <calloc@plt>
  mov    -0x38(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L35
  mov    D9(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L29
L35:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    %eax,%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x3,%eax
  mov    %eax,%esi
  mov    -0x28(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  lea    (%rsi,%rcx,1),%edx
  mov    %dl,(%rax)
  movl   $0x2,-0x14(%rbp)
  jmp    L64
L56:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  cmpq   $0xfffffff,-0x8(%rbp)
  jbe    L27
  mov    -0x8(%rbp),%rax
  shr    $0x1c,%rax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  or     $0xffffff80,%ecx
  mov    %ecx,%edx
  mov    %dl,(%rax)
L27:
  cmpq   $0x1fffff,-0x8(%rbp)
  jbe    L2
  mov    -0x8(%rbp),%rax
  shr    $0x15,%rax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  or     $0xffffff80,%ecx
  mov    %ecx,%edx
  mov    %dl,(%rax)
L2:
  cmpq   $0x3fff,-0x8(%rbp)
  jbe    L49
  mov    -0x8(%rbp),%rax
  shr    $0xe,%rax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  or     $0xffffff80,%ecx
  mov    %ecx,%edx
  mov    %dl,(%rax)
L49:
  cmpq   $0x7f,-0x8(%rbp)
  jbe    L71
  mov    -0x8(%rbp),%rax
  shr    $0x7,%rax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  or     $0xffffff80,%ecx
  mov    %ecx,%edx
  mov    %dl,(%rax)
L71:
  mov    -0x8(%rbp),%rax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  and    $0x7f,%ecx
  mov    %ecx,%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x14(%rbp)
L64:
  mov    -0x14(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L56
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%rax
  sub    %rdx,%rax
  mov    %eax,%edx
  mov    -0x40(%rbp),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
L29:
  leave
  ret
```

assistant: ```c
int asn1_oid_encode(const unsigned long *in_oid, int in_len, unsigned char **out_oid, int *out_len) {
  unsigned char *oid;
  unsigned long id;
  int i;
  *out_oid = calloc(1, in_len * 5);
  if (*out_oid == NULL)
    return -ENOMEM;
  oid = *out_oid;
  *oid++ = (unsigned char)(40 * in_oid[0] + in_oid[1]);
  for (i = 2; i < in_len; i++) {
    id = in_oid[i];
    if (id >= (1 << 28))
      *oid++ = (0x80 | ((id >> 28) & 0x7F));
    if (id >= (1 << 21))
      *oid++ = (0x80 | ((id >> 21) & 0x7F));
    if (id >= (1 << 14))
      *oid++ = (0x80 | ((id >> 14) & 0x7F));
    if (id >= (1 << 7))
      *oid++ = (0x80 | ((id >> 7) & 0x7F));
    *oid++ = id & 0x7F;
  }
  *out_len = (int)(oid - *out_oid);
  return 0;
}
```