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

```asm
<BinSearchDelete>:
  endbr64
  mov    %esi,%ecx
  mov    %edx,%r9d
  test   %sil,%sil
  je     L147
  movzbl %sil,%esi
  lea    (%rdi,%rsi,2),%rax
  jmp    L84
  nopl   0x0(%rax)
L14:
  sub    $0x2,%rax
  test   %cl,%cl
  je     L147
L84:
  movzbl %cl,%r8d
  sub    $0x1,%ecx
  cmpw   $0x0,-0x2(%rax)
  je     L14
L213:
  movzwl (%rdi),%esi
  xor    %eax,%eax
  cmp    %dx,%si
  ja     L176
  movzbl %cl,%r10d
  lea    (%rdi,%r10,2),%r11
  movzwl (%r11),%r10d
  cmp    %dx,%r10w
  jb     L176
  cmp    %dx,%si
  je     L88
  cmp    %dx,%r10w
  je     L208
  xor    %esi,%esi
  test   %cl,%cl
  jne    L71
  jmp    L229
  nopl   0x0(%rax)
L217:
  lea    -0x1(%rax),%ecx
  movzbl %cl,%eax
  lea    (%rdi,%rax,2),%rax
  cmp    %r9w,(%rax)
  je     L56
L166:
  cmp    %sil,%cl
  jbe    L229
L71:
  movzbl %sil,%eax
  movzbl %cl,%edx
  sub    %eax,%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  add    %esi,%eax
  movzbl %al,%edx
  lea    (%rdi,%rdx,2),%rdx
  cmp    %r9w,(%rdx)
  je     L4
  ja     L217
  lea    0x1(%rax),%esi
  movzbl %sil,%eax
  lea    (%rdi,%rax,2),%rdx
  cmp    %r9w,(%rdx)
  jne    L166
  movzbl %r8b,%eax
  movzbl %sil,%ecx
  sub    $0x1,%eax
  cmp    %ecx,%eax
  jle    L80
  mov    %esi,%ecx
  nopw   0x0(%rax,%rax,1)
L157:
  movzbl %cl,%edx
  add    $0x1,%ecx
  add    $0x1,%rdx
  movzwl (%rdi,%rdx,2),%r8d
  mov    %r8w,-0x2(%rdi,%rdx,2)
  movzbl %cl,%r8d
  cmp    %eax,%r8d
  jl     L157
  movzbl %dl,%edx
  lea    (%rdi,%rdx,2),%rdx
L80:
  xor    %eax,%eax
  mov    %ax,(%rdx)
  mov    %esi,%eax
  ret
L229:
  mov    $0xffffffff,%eax
L176:
  ret
  nopl   0x0(%rax,%rax,1)
L147:
  xor    %r8d,%r8d
  mov    $0xffffffff,%ecx
  jmp    L213
L88:
  movzbl %r8b,%esi
  sub    $0x1,%esi
  test   %esi,%esi
  jle    L2
  xor    %edx,%edx
  nopw   0x0(%rax,%rax,1)
L145:
  movzbl %dl,%eax
  add    $0x1,%edx
  add    $0x1,%rax
  movzwl (%rdi,%rax,2),%ecx
  mov    %cx,-0x2(%rdi,%rax,2)
  movzbl %dl,%ecx
  cmp    %esi,%ecx
  jl     L145
  movzbl %al,%eax
  lea    (%rdi,%rax,2),%rdi
L2:
  xor    %r8d,%r8d
  xor    %eax,%eax
  mov    %r8w,(%rdi)
  ret
L4:
  sub    $0x1,%r8d
  movzbl %al,%ecx
  cmp    %ecx,%r8d
  jle    L212
  mov    %eax,%ecx
  nopl   0x0(%rax)
L183:
  movzbl %cl,%edx
  add    $0x1,%ecx
  add    $0x1,%rdx
  movzwl (%rdi,%rdx,2),%esi
  mov    %si,-0x2(%rdi,%rdx,2)
  movzbl %cl,%esi
  cmp    %r8d,%esi
  jl     L183
  movzbl %dl,%edx
  lea    (%rdi,%rdx,2),%rdx
L212:
  xor    %ecx,%ecx
  mov    %cx,(%rdx)
  ret
L208:
  xor    %esi,%esi
  mov    %ecx,%eax
  mov    %si,(%r11)
  ret
L56:
  sub    $0x1,%r8d
  movzbl %cl,%edx
  cmp    %r8d,%edx
  jge    L63
  mov    %ecx,%edx
  nop
L158:
  movzbl %dl,%eax
  add    $0x1,%edx
  add    $0x1,%rax
  movzwl (%rdi,%rax,2),%esi
  mov    %si,-0x2(%rdi,%rax,2)
  movzbl %dl,%esi
  cmp    %r8d,%esi
  jl     L158
  movzbl %al,%eax
  lea    (%rdi,%rax,2),%rax
L63:
  xor    %edx,%edx
  mov    %dx,(%rax)
  mov    %ecx,%eax
  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;
}
```