user: Converte this assembly snippet into its equivalent C code:

```asm
<nstrcmp>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,%rbx
  call   <xstrdup@plt>
  mov    %rax,%r12
  mov    %rbx,%rdi
  call   <xstrdup@plt>
  mov    %rax,%r13
  mov    %r12,%rdi
  call   <cutalias@plt>
  mov    %rax,%r15
  mov    %r13,%rdi
  call   <cutalias@plt>
  mov    %rax,0x8(%rsp)
  mov    %r12,%rdi
  call   <rindex_nondigit@plt>
  mov    %eax,%ebp
  mov    %r13,%rdi
  call   <rindex_nondigit@plt>
  mov    %eax,%ebx
  cmp    %eax,%ebp
  mov    %eax,%edx
  cmovle %ebp,%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L74
  cmp    %ebx,%ebp
  jg     L96
  jl     L28
  movslq %ebx,%rbx
  add    %r13,%rbx
  movslq %ebp,%rdi
  add    %r12,%rdi
  call   <atoi@plt>
  mov    %eax,%ebp
  mov    %rbx,%rdi
  call   <atoi@plt>
  cmp    %eax,%ebp
  jl     L144
  jg     L76
  test   %r15,%r15
  je     L101
  mov    %r15,%rdi
  call   <atoi@plt>
  mov    %eax,%ebp
  mov    $0xffffffff,%ebx
  cmpq   $0x0,0x8(%rsp)
  je     L51
L79:
  mov    0x8(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,%ebx
L51:
  mov    %r12,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  cmp    %ebp,%ebx
  jg     L53
L158:
  cmp    %ebx,%ebp
  setg   %r14b
  movzbl %r14b,%r14d
L19:
  mov    %r14d,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L74:
  mov    %eax,%r14d
  mov    %r12,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  jmp    L19
L96:
  mov    %r12,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    $0x1,%r14d
  jmp    L19
L28:
  mov    %r12,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    $0xffffffff,%r14d
  jmp    L19
L144:
  mov    %r12,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    $0xffffffff,%r14d
  jmp    L19
L76:
  mov    %r12,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    $0x1,%r14d
  jmp    L19
L53:
  mov    $0xffffffff,%r14d
  jmp    L19
L101:
  mov    $0xffffffff,%ebp
  cmpq   $0x0,0x8(%rsp)
  jne    L79
  mov    %r12,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    $0xffffffff,%ebx
  mov    $0xffffffff,%ebp
  jmp    L158
```

assistant: ```c
int nstrcmp(const char *ap, const char *bp) {
  char *a = xstrdup(ap);
  char *b = xstrdup(bp);
  char *an, *bn;
  int av = 0, bv = 0;
  char *aalias = cutalias(a);
  char *balias = cutalias(b);
  int aindex = rindex_nondigit(a);
  int bindex = rindex_nondigit(b);
  int complen = (aindex < bindex) ? aindex : bindex;
  int res = strncmp(a, b, complen);
  if (res != 0) {
    free(a);
    free(b);
    return res;
  }
  if (aindex > bindex) {
    free(a);
    free(b);
    return 1;
  }
  if (aindex < bindex) {
    free(a);
    free(b);
    return -1;
  }
  an = a + aindex;
  bn = b + bindex;
  av = atoi(an);
  bv = atoi(bn);
  if (av < bv) {
    free(a);
    free(b);
    return -1;
  }
  if (av > bv) {
    free(a);
    free(b);
    return 1;
  }
  av = -1;
  if (aalias != NULL)
    av = atoi(aalias);
  bv = -1;
  if (balias != NULL)
    bv = atoi(balias);
  free(a);
  free(b);
  if (av < bv)
    return -1;
  if (av > bv)
    return 1;
  return 0;
}
```