user: Please show me the C implementation that matches the assembly code listed below:

```asm
<verrevcmp>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  test   %rdi,%rdi
  lea    D3(%rip),%rax
  cmove  %rax,%rbx
  test   %rsi,%rsi
  cmove  %rax,%rbp
  mov    $0xffffffff,%r12d
  jmp    L296
L17:
  movsbl %dil,%edi
  call   <cisdigit@plt>
  test   %rax,%rax
  jne    L346
  movzbl (%rbx),%edi
  mov    $0x0,%r13d
  test   %dil,%dil
  je     L86
  movsbl %dil,%edi
  call   <cisalpha@plt>
  test   %rax,%rax
  je     L328
  movsbl (%rbx),%r13d
  movzbl 0x0(%rbp),%edi
  cmp    $0x7e,%dil
  jne    L106
  mov    %r12d,%eax
  jmp    L264
L328:
  movsbl (%rbx),%r13d
  add    $0x100,%r13d
  jmp    L86
L34:
  movsbl 0x0(%rbp),%eax
  add    $0x100,%eax
  jmp    L264
L351:
  movsbl %dil,%edi
  call   <cisdigit@plt>
  test   %rax,%rax
  je     L32
  jmp    L338
L10:
  cmpb   $0x30,(%rbx)
  je     L118
  jmp    L349
L77:
  add    $0x1,%rbx
  add    $0x1,%rbp
L113:
  movsbl (%rbx),%edi
  call   <cisdigit@plt>
  test   %rax,%rax
  je     L383
  movsbl 0x0(%rbp),%edi
  call   <cisdigit@plt>
  test   %rax,%rax
  je     L383
  test   %r13d,%r13d
  jne    L77
  movsbl (%rbx),%r13d
  movsbl 0x0(%rbp),%eax
  sub    %eax,%r13d
  jmp    L77
L383:
  movsbl (%rbx),%edi
  call   <cisdigit@plt>
  test   %rax,%rax
  jne    L354
  movsbl 0x0(%rbp),%edi
  call   <cisdigit@plt>
  test   %rax,%rax
  jne    L107
  test   %r13d,%r13d
  jne    L375
L296:
  cmpb   $0x0,(%rbx)
  jne    L33
  cmpb   $0x0,0x0(%rbp)
  jne    L33
  mov    $0x0,%r13d
  jmp    L375
L354:
  mov    $0x1,%r13d
  jmp    L375
L107:
  mov    $0xffffffff,%r13d
  jmp    L375
L346:
  mov    $0x0,%r13d
L86:
  movzbl 0x0(%rbp),%edi
  cmp    $0x7e,%dil
  je     L292
L106:
  movsbl %dil,%edi
  call   <cisdigit@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  je     L386
L264:
  cmp    %r13d,%eax
  jne    L40
L25:
  add    $0x1,%rbx
  add    $0x1,%rbp
L33:
  movzbl (%rbx),%edi
  test   %dil,%dil
  jne    L351
L338:
  movzbl 0x0(%rbp),%edi
  test   %dil,%dil
  je     L322
  movsbl %dil,%edi
  call   <cisdigit@plt>
  test   %rax,%rax
  jne    L10
L32:
  movzbl (%rbx),%edi
  cmp    $0x7e,%dil
  jne    L17
  movzbl 0x0(%rbp),%edi
  cmp    $0x7e,%dil
  je     L25
  movsbl %dil,%edi
  call   <cisdigit@plt>
  test   %rax,%rax
  jne    L261
  mov    %r12d,%r13d
L386:
  movzbl 0x0(%rbp),%edi
  mov    $0x0,%eax
  test   %dil,%dil
  je     L264
  movsbl %dil,%edi
  call   <cisalpha@plt>
  test   %rax,%rax
  je     L34
  movsbl 0x0(%rbp),%eax
  jmp    L264
L292:
  mov    $0xffffffff,%eax
L40:
  sub    %eax,%r13d
L375:
  mov    %r13d,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L322:
  cmpb   $0x30,(%rbx)
  jne    L6
L118:
  add    $0x1,%rbx
  cmpb   $0x30,(%rbx)
  je     L118
L349:
  cmpb   $0x30,0x0(%rbp)
  jne    L6
L59:
  add    $0x1,%rbp
  cmpb   $0x30,0x0(%rbp)
  je     L59
L6:
  mov    $0x0,%r13d
  jmp    L113
L261:
  mov    $0x0,%eax
  mov    $0xffffffff,%r13d
  jmp    L40
```

tool_calls: name: retrieve_data
arguments: data_label: D3
type: string

tool: 

assistant: ```c
int verrevcmp(const char *val, const char *ref) {
  if (!val)
    val = "";
  if (!ref)
    ref = "";
  while (*val || *ref) {
    int first_diff = 0;
    while ((*val && !cisdigit(*val)) || (*ref && !cisdigit(*ref))) {
      int vc = ((*val) == '~' ? -1 : cisdigit((*val)) ? 0 : !(*val) ? 0 : cisalpha((*val)) ? (*val) : (*val) + 256), rc = ((*ref) == '~' ? -1 : cisdigit((*ref)) ? 0 : !(*ref) ? 0 : cisalpha((*ref)) ? (*ref) : (*ref) + 256);
      if (vc != rc)
        return vc - rc;
      val++;
      ref++;
    }
    while (*val == '0')
      val++;
    while (*ref == '0')
      ref++;
    while (cisdigit(*val) && cisdigit(*ref)) {
      if (!first_diff)
        first_diff = *val - *ref;
      val++;
      ref++;
    }
    if (cisdigit(*val))
      return 1;
    if (cisdigit(*ref))
      return -1;
    if (first_diff)
      return first_diff;
  }
  return 0;
}
```