user: Converte this assembly snippet into its equivalent C code:

```asm
<BinSearchDelete>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,%ecx
  mov    %edx,%eax
  mov    %ecx,%edx
  mov    %dl,-0x1c(%rbp)
  mov    %ax,-0x20(%rbp)
  jmp    L233
L84:
  movzbl -0x1c(%rbp),%eax
  sub    $0x1,%eax
  mov    %al,-0x1c(%rbp)
L233:
  cmpb   $0x0,-0x1c(%rbp)
  je     L127
  movzbl -0x1c(%rbp),%eax
  add    %rax,%rax
  lea    -0x2(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  je     L84
L127:
  movb   $0x0,-0x3(%rbp)
  movzbl -0x1c(%rbp),%eax
  sub    $0x1,%eax
  mov    %al,-0x2(%rbp)
  movzbl -0x3(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cmp    %ax,-0x20(%rbp)
  jb     L46
  movzbl -0x2(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cmp    %ax,-0x20(%rbp)
  jbe    L62
L46:
  mov    $0x0,%eax
  jmp    L89
L62:
  movzbl -0x3(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cmp    %ax,-0x20(%rbp)
  jne    L36
  movzbl -0x3(%rbp),%eax
  mov    %al,-0x4(%rbp)
  jmp    L79
L238:
  movzbl -0x4(%rbp),%eax
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl -0x4(%rbp),%edx
  lea    (%rdx,%rdx,1),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzwl (%rax),%eax
  mov    %ax,(%rdx)
  movzbl -0x4(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x4(%rbp)
L79:
  movzbl -0x4(%rbp),%eax
  movzbl -0x1c(%rbp),%edx
  sub    $0x1,%edx
  cmp    %edx,%eax
  jl     L238
  movzbl -0x4(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movw   $0x0,(%rax)
  movzbl -0x3(%rbp),%eax
  jmp    L89
L36:
  movzbl -0x2(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cmp    %ax,-0x20(%rbp)
  jne    L164
  movzbl -0x2(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movw   $0x0,(%rax)
  movzbl -0x2(%rbp),%eax
  jmp    L89
L18:
  movzbl -0x2(%rbp),%eax
  movzbl -0x3(%rbp),%edx
  sub    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  movzbl -0x3(%rbp),%eax
  add    %edx,%eax
  mov    %al,-0x1(%rbp)
  movzbl -0x1(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cmp    %ax,-0x20(%rbp)
  jne    L146
  movzbl -0x1(%rbp),%eax
  mov    %al,-0x4(%rbp)
  jmp    L170
L63:
  movzbl -0x4(%rbp),%eax
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl -0x4(%rbp),%edx
  lea    (%rdx,%rdx,1),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzwl (%rax),%eax
  mov    %ax,(%rdx)
  movzbl -0x4(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x4(%rbp)
L170:
  movzbl -0x4(%rbp),%eax
  movzbl -0x1c(%rbp),%edx
  sub    $0x1,%edx
  cmp    %edx,%eax
  jl     L63
  movzbl -0x4(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movw   $0x0,(%rax)
  movzbl -0x1(%rbp),%eax
  jmp    L89
L146:
  movzbl -0x1(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cmp    %ax,-0x20(%rbp)
  jae    L218
  movzbl -0x1(%rbp),%eax
  sub    $0x1,%eax
  mov    %al,-0x2(%rbp)
  movzbl -0x2(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cmp    %ax,-0x20(%rbp)
  jne    L164
  movzbl -0x2(%rbp),%eax
  mov    %al,-0x4(%rbp)
  jmp    L67
L3:
  movzbl -0x4(%rbp),%eax
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl -0x4(%rbp),%edx
  lea    (%rdx,%rdx,1),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzwl (%rax),%eax
  mov    %ax,(%rdx)
  movzbl -0x4(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x4(%rbp)
L67:
  movzbl -0x4(%rbp),%eax
  movzbl -0x1c(%rbp),%edx
  sub    $0x1,%edx
  cmp    %edx,%eax
  jl     L3
  movzbl -0x4(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movw   $0x0,(%rax)
  movzbl -0x2(%rbp),%eax
  jmp    L89
L218:
  movzbl -0x1(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x3(%rbp)
  movzbl -0x3(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cmp    %ax,-0x20(%rbp)
  jne    L164
  movzbl -0x3(%rbp),%eax
  mov    %al,-0x4(%rbp)
  jmp    L7
L160:
  movzbl -0x4(%rbp),%eax
  add    $0x1,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl -0x4(%rbp),%edx
  lea    (%rdx,%rdx,1),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzwl (%rax),%eax
  mov    %ax,(%rdx)
  movzbl -0x4(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x4(%rbp)
L7:
  movzbl -0x4(%rbp),%eax
  movzbl -0x1c(%rbp),%edx
  sub    $0x1,%edx
  cmp    %edx,%eax
  jl     L160
  movzbl -0x4(%rbp),%eax
  lea    (%rax,%rax,1),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movw   $0x0,(%rax)
  movzbl -0x3(%rbp),%eax
  jmp    L89
L164:
  movzbl -0x3(%rbp),%eax
  cmp    -0x2(%rbp),%al
  jb     L18
  mov    $0xffffffff,%eax
L89:
  pop    %rbp
  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;
}
```