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

```asm
<cpi_vercmp>:
  endbr64
  push   %r15
  mov    %rdi,%rax
  push   %r14
  or     %rsi,%rax
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rsi,%rsi
  setne  %dil
  test   %rbp,%rbp
  jne    L166
  test   %dil,%dil
  jne    L34
L166:
  test   %rax,%rax
  je     L146
  test   %rbp,%rbp
  setne  %al
  test   %r12,%r12
  jne    L66
  mov    $0x1,%ebx
  test   %al,%al
  je     L66
L95:
  add    $0x8,%rsp
  mov    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L66:
  and    %eax,%edi
  movzbl %dil,%edi
  call   <assert@plt>
L114:
  cmpb   $0x0,0x0(%rbp)
  jne    L22
  cmpb   $0x0,(%r12)
  je     L146
L22:
  mov    %rbp,%rdi
  call   <vercmp_nondigit_end@plt>
  mov    %r12,%rdi
  mov    %rax,%r13
  call   <vercmp_nondigit_end@plt>
  mov    %rax,%r14
  cmp    %r13,%rbp
  jae    L42
  nop
L131:
  xor    %edi,%edi
  cmp    %rbp,%r13
  jbe    L54
  movsbl 0x0(%rbp),%edi
  add    $0x1,%rbp
L54:
  xor    %r15d,%r15d
  cmp    %r12,%r14
  jbe    L127
  movsbl (%r12),%r15d
  add    $0x1,%r12
L127:
  call   <vercmp_char_value@plt>
  mov    %r15d,%edi
  mov    %eax,%ebx
  call   <vercmp_char_value@plt>
  sub    %eax,%ebx
  jne    L95
  cmp    %r13,%rbp
  setbe  %al
  xor    %edi,%edi
  cmp    %r14,%r12
  setbe  %dil
  and    %eax,%edi
  call   <assert@plt>
  cmp    %r13,%rbp
  jb     L131
L42:
  cmp    %r14,%r12
  jb     L131
  cmp    %rbp,%r13
  mov    %rbp,%rbx
  mov    %r12,%r15
  sete   %al
  xor    %edi,%edi
  cmp    %r12,%r14
  sete   %dil
  and    %eax,%edi
  call   <assert@plt>
  mov    %rbp,%rdi
  call   <vercmp_digit_end@plt>
  mov    %r12,%rdi
  mov    %rax,%rbp
  call   <vercmp_digit_end@plt>
  mov    %rbx,%rdi
  mov    %rbp,%rsi
  mov    %rax,%r12
  call   <vercmp_num_value@plt>
  mov    %r12,%rsi
  mov    %r15,%rdi
  mov    %eax,%ebx
  call   <vercmp_num_value@plt>
  sub    %eax,%ebx
  je     L114
  jmp    L95
  xchg   %ax,%ax
L146:
  xor    %ebx,%ebx
  jmp    L95
L34:
  mov    $0xffffffff,%ebx
  jmp    L95
```

assistant: ```c
__attribute__((visibility("hidden"))) int cpi_vercmp(const char *v1, const char *v2) {
  const char *v1n;
  const char *v2n;
  int diff;
  if (v1 == NULL && v2 != NULL) {
    return -1;
  } else if (v1 == NULL && v2 == NULL) {
    return 0;
  } else if (v1 != NULL && v2 == NULL) {
    return 1;
  }
  assert(v1 != NULL && v2 != NULL);
  while (*v1 != '\0' || *v2 != '\0') {
    v1n = vercmp_nondigit_end(v1);
    v2n = vercmp_nondigit_end(v2);
    while (v1 < v1n || v2 < v2n) {
      char c1 = '\0';
      char c2 = '\0';
      if (v1 < v1n) {
        c1 = *v1++;
      }
      if (v2 < v2n) {
        c2 = *v2++;
      }
      diff = vercmp_char_value(c1) - vercmp_char_value(c2);
      if (diff != 0) {
        return diff;
      }
      assert(v1 <= v1n && v2 <= v2n);
    }
    assert(v1 == v1n && v2 == v2n);
    v1n = vercmp_digit_end(v1);
    v2n = vercmp_digit_end(v2);
    {
      int i1 = vercmp_num_value(v1, v1n);
      int i2 = vercmp_num_value(v2, v2n);
      int diff = i1 - i2;
      if (diff != 0) {
        return diff;
      }
    }
    v1 = v1n;
    v2 = v2n;
  }
  return 0;
}
```