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

```asm
<pq_nkrange>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x0,%ebp
  cmpb   $0x0,(%rdi)
  jne    L92
L130:
  mov    %ebp,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L92:
  mov    %rdi,%rbx
  call   <strlen@plt>
  lea    0x1(%rax),%ebp
  mov    $0x1,%esi
  mov    %ebp,%edi
  call   <calloc@plt>
  mov    %rax,%r13
  mov    $0x1,%esi
  mov    %ebp,%edi
  call   <calloc@plt>
  mov    %rax,%r12
  movb   $0x0,(%rax)
  movzbl (%rbx),%eax
  test   %al,%al
  je     L61
  add    $0x1,%rbx
  mov    $0x0,%edx
  mov    $0x0,%ecx
  mov    $0x0,%ebp
  mov    $0xffffffff,%r14d
  jmp    L55
L66:
  movslq %edx,%rdx
  movb   $0x0,(%r12,%rdx,1)
  movslq %ecx,%rcx
  movb   $0x0,0x0(%r13,%rcx,1)
  mov    %r13,%rdi
  call   <atoi@plt>
  mov    %eax,%r15d
  mov    %r12,%rdi
  call   <atoi@plt>
  cmp    %eax,%r15d
  jl     L60
  mov    $0x1,%edx
  jne    L146
  jmp    L139
L60:
  mov    %r14d,%edx
L146:
  add    $0x1,%ebp
  add    %edx,%eax
  cmp    %eax,%r15d
  jne    L146
L139:
  add    $0x1,%ebp
  mov    %rbx,%rax
  movb   $0x0,(%r12)
  movb   $0x0,0x0(%r13)
  mov    $0x0,%edx
  mov    $0x0,%ecx
  jmp    L87
L98:
  movb   $0x0,0x0(%r13)
  movslq %edx,%rax
  movb   $0x0,(%r12,%rax,1)
  add    $0x1,%edx
  mov    %rbx,%rax
  mov    $0x0,%ecx
L87:
  movzbl (%rax),%eax
  add    $0x1,%rbx
  test   %al,%al
  je     L152
L55:
  cmp    $0x2c,%al
  je     L66
  cmp    $0x2d,%al
  je     L98
  movslq %edx,%rsi
  mov    %al,(%r12,%rsi,1)
  movslq %ecx,%rsi
  mov    %al,0x0(%r13,%rsi,1)
  add    $0x1,%ecx
  add    $0x1,%edx
  mov    %rbx,%rax
  jmp    L87
L61:
  mov    $0x0,%edx
  mov    $0x0,%ecx
  mov    $0x0,%ebp
L152:
  movslq %edx,%rdx
  movb   $0x0,(%r12,%rdx,1)
  movslq %ecx,%rcx
  movb   $0x0,0x0(%r13,%rcx,1)
  mov    %r13,%rdi
  call   <atoi@plt>
  mov    %eax,%ebx
  mov    %r12,%rdi
  call   <atoi@plt>
  cmp    %eax,%ebx
  jl     L108
  mov    $0x1,%edx
  jne    L109
  jmp    L114
L108:
  mov    $0xffffffff,%edx
L109:
  add    $0x1,%ebp
  add    %edx,%eax
  cmp    %eax,%ebx
  jne    L109
L114:
  add    $0x1,%ebp
  mov    %r13,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  jmp    L130
```

assistant: ```c
int pq_nkrange(char *text) {
  int a, i, j, c;
  int strsize;
  int cval, pval;
  char *tmp, *curr, *prev;
  if (*text == '\0') {
    return 0;
  }
  strsize = strlen(text);
  curr = calloc(strsize + 1, sizeof *curr);
  prev = calloc(strsize + 1, sizeof *prev);
  tmp = text;
  prev[0] = '\0';
  a = c = i = j = 0;
  while (*tmp) {
    if (*tmp == ',') {
      curr[i] = prev[j] = '\0';
      cval = atoi(curr);
      pval = atoi(prev);
      c = cval >= pval ? 1 : -1;
      while (pval != cval) {
        a++;
        pval = pval + c;
      }
      i = j = 0;
      a++;
      tmp++;
      curr[0] = prev[0] = '\0';
    } else if (*tmp == '-') {
      prev[j] = curr[0] = '\0';
      i = 0;
      j++;
      tmp++;
    } else {
      curr[i] = prev[j] = *tmp;
      i++;
      j++;
      tmp++;
    }
  }
  curr[i] = prev[j] = '\0';
  cval = atoi(curr);
  pval = atoi(prev);
  c = cval >= pval ? 1 : -1;
  while (pval != cval) {
    a++;
    pval = pval + c;
  }
  a++;
  free(curr);
  free(prev);
  return a;
}
```