user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<BinSearchDelete>:
  endbr64
  mov    %rdi,%r8
  mov    %esi,%edi
  mov    %edx,%r9d
  test   %sil,%sil
  je     L167
  movzbl %sil,%esi
  lea    (%r8,%rsi,2),%rcx
L225:
  cmpw   $0x0,-0x2(%rcx)
  jne    L167
  sub    $0x2,%rcx
  sub    $0x1,%dil
  jne    L225
L167:
  movzwl (%r8),%ecx
  mov    $0x0,%eax
  cmp    %dx,%cx
  ja     L30
  lea    -0x1(%rdi),%esi
  movzbl %sil,%eax
  lea    (%r8,%rax,2),%r11
  movzwl (%r11),%r10d
  mov    $0x0,%eax
  cmp    %dx,%r10w
  jb     L30
  cmp    %dx,%cx
  je     L151
  cmp    %dx,%r10w
  je     L194
  mov    $0x0,%ecx
  test   %sil,%sil
  jne    L188
  mov    $0xffffffff,%eax
  ret
L151:
  movzbl %dil,%eax
  lea    -0x1(%rax),%esi
  test   %esi,%esi
  jle    L181
  mov    $0x0,%edx
L175:
  movzbl %dl,%eax
  add    $0x1,%rax
  movzwl (%r8,%rax,2),%ecx
  mov    %cx,-0x2(%r8,%rax,2)
  add    $0x1,%edx
  movzbl %dl,%eax
  cmp    %esi,%eax
  jl     L175
L47:
  movzbl %dl,%edx
  movw   $0x0,(%r8,%rdx,2)
  mov    $0x0,%eax
  ret
L181:
  mov    $0x0,%edx
  jmp    L47
L194:
  movw   $0x0,(%r11)
  mov    %esi,%eax
  ret
L149:
  movzbl %dil,%edi
  sub    $0x1,%edi
  movzbl %al,%edx
  cmp    %edi,%edx
  jge    L116
  mov    %eax,%ecx
L84:
  movzbl %cl,%edx
  add    $0x1,%rdx
  movzwl (%r8,%rdx,2),%esi
  mov    %si,-0x2(%r8,%rdx,2)
  add    $0x1,%ecx
  movzbl %cl,%edx
  cmp    %edi,%edx
  jl     L84
L68:
  movzbl %cl,%ecx
  movw   $0x0,(%r8,%rcx,2)
  ret
L116:
  mov    %eax,%ecx
  jmp    L68
L173:
  mov    %esi,%edx
  jmp    L79
L133:
  lea    0x1(%rax),%ecx
  movzbl %cl,%eax
  cmp    %r9w,(%r8,%rax,2)
  je     L21
L36:
  cmp    %sil,%cl
  jae    L136
L188:
  movzbl %sil,%edx
  movzbl %cl,%eax
  sub    %eax,%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  add    %ecx,%eax
  movzbl %al,%edx
  movzwl (%r8,%rdx,2),%edx
  cmp    %r9w,%dx
  je     L149
  jbe    L133
  lea    -0x1(%rax),%esi
  movzbl %sil,%eax
  cmp    %r9w,(%r8,%rax,2)
  jne    L36
  movzbl %dil,%edi
  sub    $0x1,%edi
  movzbl %sil,%eax
  cmp    %edi,%eax
  jge    L173
  mov    %esi,%edx
L129:
  movzbl %dl,%eax
  add    $0x1,%rax
  movzwl (%r8,%rax,2),%ecx
  mov    %cx,-0x2(%r8,%rax,2)
  add    $0x1,%edx
  movzbl %dl,%eax
  cmp    %edi,%eax
  jl     L129
L79:
  movzbl %dl,%edx
  movw   $0x0,(%r8,%rdx,2)
  mov    %esi,%eax
  ret
L21:
  movzbl %dil,%eax
  sub    $0x1,%eax
  movzbl %cl,%edx
  cmp    %eax,%edx
  jge    L64
  mov    %ecx,%esi
L55:
  movzbl %sil,%edx
  add    $0x1,%rdx
  movzwl (%r8,%rdx,2),%edi
  mov    %di,-0x2(%r8,%rdx,2)
  add    $0x1,%esi
  movzbl %sil,%edx
  cmp    %eax,%edx
  jl     L55
L127:
  movzbl %sil,%esi
  movw   $0x0,(%r8,%rsi,2)
  mov    %ecx,%eax
  ret
L64:
  mov    %ecx,%esi
  jmp    L127
L136:
  mov    $0xffffffff,%eax
L30:
  ret
```

assistant: ```c
char BinSearchDelete(unsigned short *src, unsigned char len, unsigned short key) {
  unsigned char i, low, high, mid;
  while ((len >= 1) && (src[len - 1] == 0))
    len--;
  low = 0;
  high = len - 1;
  if ((key < src[low]) || (key > src[high]))
    return 0;
  if (key == src[low]) {
    for (i = low; i < len - 1; i++) {
      src[i] = src[i + 1];
    }
    src[i] = 0;
    return low;
  }
  if (key == src[high]) {
    src[high] = 0;
    return high;
  }
  while (low < high) {
    mid = low + ((high - low) / 2);
    if (key == src[mid]) {
      for (i = mid; i < len - 1; i++) {
        src[i] = src[i + 1];
      }
      src[i] = 0;
      return mid;
    }
    if (key < src[mid]) {
      high = mid - 1;
      if (key == src[high]) {
        for (i = high; i < len - 1; i++) {
          src[i] = src[i + 1];
        }
        src[i] = 0;
        return high;
      }
    } else {
      low = mid + 1;
      if (key == src[low]) {
        for (i = low; i < len - 1; i++) {
          src[i] = src[i + 1];
        }
        src[i] = 0;
        return low;
      }
    }
  }
  return -1;
}
```