user: 请从给定的汇编指令推导出C源代码：

```asm
<findIndex>:
  endbr64
  lea    (%rcx,%rdx,1),%r10d
  lea    -0x1(%r10),%edx
  cmp    %edx,%ecx
  jg     L177
  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    L126
L110:
  cmp    %r8d,%edi
  jne    L138
  mov    %edi,%esi
  mov    %eax,%edx
L126:
  mov    %edx,%ecx
  sub    %eax,%ecx
  cmp    $0x5,%ecx
  jg     L110
  movslq %eax,%rcx
  lea    (%r11,%rcx,4),%rcx
  cmp    %edx,%eax
  jl     L127
  jmp    L61
  nopw   0x0(%rax,%rax,1)
L65:
  add    $0x1,%eax
  lea    0x4(%rcx),%rsi
  cmp    %eax,%edx
  je     L73
  mov    %rsi,%rcx
L127:
  mov    (%rcx),%esi
  cmp    %edi,%esi
  jl     L65
L35:
  cmp    %esi,%edi
  je     L185
  jl     L69
  mov    %eax,%ecx
  not    %edx
  cmp    %eax,%r10d
  not    %ecx
  mov    %edx,%eax
  cmovg  %ecx,%eax
L185:
  pop    %rbx
  ret
  nopw   0x0(%rax,%rax,1)
L138:
  cmp    %ebx,%edi
  je     L54
  cmp    %edi,%esi
  jge    L18
  lea    0x1(%r9),%eax
  movslq %eax,%rcx
  mov    (%r11,%rcx,4),%r8d
L178:
  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    L126
  nopl   0x0(%rax)
L18:
  jle    L96
  lea    -0x1(%r9),%edx
  movslq %edx,%rcx
  mov    (%r11,%rcx,4),%ebx
  jmp    L178
  nopw   0x0(%rax,%rax,1)
L73:
  mov    0x4(%rcx),%esi
  jmp    L35
  nopl   (%rax)
L54:
  mov    %edi,%esi
  mov    %edx,%eax
  jmp    L126
  nopl   0x0(%rax)
L69:
  neg    %eax
  pop    %rbx
  ret
L96:
  mov    %r9d,%edx
  mov    %r9d,%eax
  jmp    L126
L61:
  mov    (%rcx),%esi
  jmp    L35
L177:
  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));
}
```