user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<findIndex>:
  endbr64
  lea    (%rcx,%rdx,1),%r10d
  lea    -0x1(%r10),%edx
  cmp    %edx,%ecx
  jg     L73
  mov    %ecx,%eax
  lea    (%rcx,%rdx,1),%ecx
  push   %rbx
  mov    %rsi,%r11
  mov    %ecx,%r9d
  shr    $0x1f,%r9d
  add    %ecx,%r9d
  movslq %eax,%rcx
  sar    %r9d
  mov    (%rsi,%rcx,4),%r8d
  movslq %r9d,%rcx
  mov    (%rsi,%rcx,4),%esi
  movslq %edx,%rcx
  mov    (%r11,%rcx,4),%ebx
  jmp    L14
L29:
  cmp    %r8d,%edi
  jne    L159
  mov    %edi,%esi
  mov    %eax,%edx
L14:
  mov    %edx,%ecx
  sub    %eax,%ecx
  cmp    $0x5,%ecx
  jg     L29
  movslq %eax,%rcx
  lea    (%r11,%rcx,4),%rcx
  cmp    %edx,%eax
  jl     L96
  jmp    L37
  nopw   0x0(%rax,%rax,1)
L107:
  add    $0x1,%eax
  lea    0x4(%rcx),%rsi
  cmp    %eax,%edx
  je     L142
  mov    %rsi,%rcx
L96:
  mov    (%rcx),%esi
  cmp    %edi,%esi
  jl     L107
L104:
  cmp    %esi,%edi
  je     L136
  jl     L162
  mov    %eax,%ecx
  not    %edx
  cmp    %eax,%r10d
  not    %ecx
  mov    %edx,%eax
  cmovg  %ecx,%eax
L136:
  pop    %rbx
  ret
  nopw   0x0(%rax,%rax,1)
L159:
  cmp    %ebx,%edi
  je     L173
  cmp    %edi,%esi
  jge    L174
  lea    0x1(%r9),%eax
  movslq %eax,%rcx
  mov    (%r11,%rcx,4),%r8d
L127:
  lea    (%rax,%rdx,1),%ecx
  mov    %ecx,%r9d
  shr    $0x1f,%r9d
  add    %ecx,%r9d
  sar    %r9d
  movslq %r9d,%rcx
  mov    (%r11,%rcx,4),%esi
  jmp    L14
  nopl   0x0(%rax)
L174:
  jle    L81
  lea    -0x1(%r9),%edx
  movslq %edx,%rcx
  mov    (%r11,%rcx,4),%ebx
  jmp    L127
  nopw   0x0(%rax,%rax,1)
L142:
  mov    0x4(%rcx),%esi
  jmp    L104
  nopl   (%rax)
L173:
  mov    %edi,%esi
  mov    %edx,%eax
  jmp    L14
  nopl   0x0(%rax)
L162:
  neg    %eax
  pop    %rbx
  ret
L81:
  mov    %r9d,%edx
  mov    %r9d,%eax
  jmp    L14
L37:
  mov    (%rcx),%esi
  jmp    L104
L73:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int findIndex(int target, int *attributes, int count, int offset) {
  int focusPos, beginPos, endPos;
  int focusAttrib, beginAttrib, endAttrib;
  beginPos = offset;
  endPos = beginPos + count - 1;
  if (endPos < beginPos)
    return (-1);
  focusPos = (beginPos + endPos) / 2;
  beginAttrib = attributes[beginPos];
  focusAttrib = attributes[focusPos];
  endAttrib = attributes[endPos];
  while (endPos - beginPos > 5) {
    if (beginAttrib == target) {
      focusAttrib = beginAttrib;
      endPos = beginPos;
    } else if (endAttrib == target) {
      focusAttrib = endAttrib;
      beginPos = endPos;
    } else if (focusAttrib < target) {
      beginPos = focusPos + 1;
      beginAttrib = attributes[beginPos];
      focusPos = (beginPos + endPos) / 2;
      focusAttrib = attributes[focusPos];
    } else if (focusAttrib > target) {
      endPos = focusPos - 1;
      endAttrib = attributes[endPos];
      focusPos = (beginPos + endPos) / 2;
      focusAttrib = attributes[focusPos];
    } else {
      beginPos = focusPos;
      endPos = focusPos;
    }
  }
  if (endPos - beginPos <= 5) {
    int *attptr = attributes + beginPos;
    while ((beginPos < endPos) && ((*attptr) < target)) {
      beginPos++;
      attptr++;
    }
    focusAttrib = (*attptr);
  }
  if (focusAttrib == target)
    return (beginPos);
  else if (focusAttrib > target)
    return (-beginPos);
  else if (beginPos > offset + count - 1)
    return (-(endPos + 1));
  else
    return (-(beginPos + 1));
}
```