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

```asm
<search_index>:
  endbr64
  push   %r15
  mov    %rsi,%rcx
  mov    $0x1,%edx
  mov    %rsi,%r15
  push   %r14
  mov    $0x8,%esi
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %r8d,0xc(%rsp)
  mov    %edi,0x8(%rsp)
  lea    0x20(%rsp),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <fread@plt>
  mov    0x2c(%rsp),%edx
  mov    0x28(%rsp),%eax
  mov    0x30(%rsp),%r14d
  mov    0x24(%rsp),%ecx
  mov    %edx,%r13d
  mov    %eax,%esi
  shl    $0x10,%edx
  mov    0xc(%rsp),%r8d
  shl    $0x18,%r14d
  shl    $0x10,%esi
  shl    $0x18,%r13d
  or     %edx,%r14d
  shl    $0x8,%eax
  or     %esi,%r13d
  or     %ecx,%r14d
  mov    %ecx,%esi
  or     0x20(%rsp),%r13d
  shl    $0x8,%esi
  or     %eax,%r14d
  or     %esi,%r13d
  mov    %r14d,%eax
  sub    %r13d,%eax
  cmp    $0x7,%eax
  je     L87
  lea    0x19(%rsp),%rbp
  jmp    L60
L49:
  mov    %r12d,%r14d
  cmp    $0x7,%ebx
  je     L87
L60:
  movslq %r14d,%rax
  mov    %r14d,%edx
  mov    %r13d,%ecx
  imul   $0xffffffff92492493,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x1f,%ecx
  shr    $0x20,%rax
  add    %r14d,%eax
  sar    $0x2,%eax
  sub    %edx,%eax
  movslq %r13d,%rdx
  imul   $0xffffffff92492493,%rdx,%rdx
  shr    $0x20,%rdx
  add    %r13d,%edx
  sar    $0x2,%edx
  sub    %edx,%ecx
  add    %ecx,%eax
  test   $0x1,%al
  je     L68
  add    $0x1,%eax
L68:
  mov    %eax,%edx
  mov    %r15,%rdi
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  lea    0x0(,%rax,8),%r9d
  mov    %r9d,%ebx
  sub    %eax,%ebx
  mov    D18(%rip),%rax
  lea    (%rbx,%r13,1),%r12d
  mov    (%rax),%edx
  mov    %r12d,%esi
  call   <fseek@plt>
  mov    %r15,%rcx
  mov    $0x1,%edx
  mov    %rbp,%rdi
  mov    $0x7,%esi
  call   <fread@plt>
  mov    0x25(%rsp),%eax
  mov    0x21(%rsp),%ecx
  mov    0x1d(%rsp),%edx
  mov    %eax,%r8d
  mov    %ecx,%esi
  shl    $0x10,%esi
  shl    $0x18,%r8d
  or     %esi,%r8d
  mov    %edx,%esi
  or     0x19(%rsp),%r8d
  shl    $0x8,%esi
  or     %esi,%r8d
  cmp    0x8(%rsp),%r8d
  je     L76
  jge    L49
  mov    %r14d,%ebx
  mov    %r12d,%r13d
  sub    %r12d,%ebx
  cmp    $0x7,%ebx
  jne    L60
L87:
  cmp    0x8(%rsp),%r8d
  jle    L4
  mov    D18(%rip),%rax
  mov    %r13d,%esi
  mov    %r15,%rdi
  mov    (%rax),%edx
  call   <fseek@plt>
  lea    0x19(%rsp),%rdi
  mov    %r15,%rcx
  mov    $0x1,%edx
  mov    $0x7,%esi
  call   <fread@plt>
L4:
  mov    0x25(%rsp),%eax
  mov    0x21(%rsp),%ecx
  mov    0x1d(%rsp),%edx
L76:
  shl    $0x10,%eax
  shl    $0x8,%ecx
  or     %ecx,%eax
  or     %edx,%eax
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L42
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L42:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
uint32_t search_index(const uint32_t ip, FILE *qqwry_file) {
  uint32_t index_ip;
  uint32_t index_start;
  uint32_t index_end;
  uint32_t index_mid;
  unsigned char head[8];
  unsigned char index_bytes[7];
  fread(head, 8, 1, qqwry_file);
  index_start = (uint32_t)((((uint8_t *)(&head[0]))[3] << 24) | (((uint8_t *)(&head[0]))[2] << 16) | (((uint8_t *)(&head[0]))[1] << 8) | ((uint8_t *)(&head[0]))[0]);
  index_end = (uint32_t)((((uint8_t *)(&head[4]))[3] << 24) | (((uint8_t *)(&head[4]))[2] << 16) | (((uint8_t *)(&head[4]))[1] << 8) | ((uint8_t *)(&head[4]))[0]);
  while (1) {
    if ((index_end - index_start) == 7) {
      break;
    }
    index_mid = index_end / 7 - index_start / 7;
    if (index_mid % 2 == 0) {
      index_mid = index_mid / 2;
    } else {
      index_mid = (index_mid + 1) / 2;
    }
    index_mid = index_start + index_mid * 7;
    fseek(qqwry_file, index_mid, SEEK_SET);
    fread(index_bytes, 7, 1, qqwry_file);
    index_ip = (uint32_t)((((uint8_t *)(&index_bytes[0]))[3] << 24) | (((uint8_t *)(&index_bytes[0]))[2] << 16) | (((uint8_t *)(&index_bytes[0]))[1] << 8) | ((uint8_t *)(&index_bytes[0]))[0]);
    if (index_ip == ip) {
      break;
    } else if (index_ip < ip) {
      index_start = index_mid;
    } else {
      index_end = index_mid;
    }
  }
  if (index_ip > ip) {
    fseek(qqwry_file, index_start, SEEK_SET);
    fread(index_bytes, 7, 1, qqwry_file);
  }
  return (uint32_t)((((uint8_t *)(&index_bytes[4]))[2] << 16) | (((uint8_t *)(&index_bytes[4]))[1] << 8) | ((uint8_t *)(&index_bytes[4]))[0]);
}
```