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

```asm
<searchwindex>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%r14
  mov    %rdx,(%rsp)
  mov    %rcx,0x8(%rsp)
  call   <ftell@plt>
  test   %rax,%rax
  je     L303
L455:
  mov    D175(%rip),%r12
  mov    D47(%rip),%rax
  cmp    %rax,%r12
  jg     L600
  mov    $0x0,%r15d
  jmp    L748
L303:
  movq   $0x0,D175(%rip)
  mov    D10(%rip),%rax
  mov    (%rax),%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <fseek@plt>
  mov    %rbp,%rdi
  call   <ftell@plt>
  mov    %rax,D188(%rip)
  jmp    L455
L615:
  lea    -0x1(%r12),%rsi
  mov    D188(%rip),%rax
  mov    (%rax),%edx
  mov    %rbp,%rdi
  call   <fseek@plt>
  test   %rax,%rax
  jne    L386
  mov    %r12,%r13
L536:
  mov    %rbp,%rdi
  call   <getc@plt>
  mov    D89(%rip),%rdx
  cmp    %eax,(%rdx)
  je     L63
  cmp    $0xa,%eax
  je     L63
  add    $0x1,%r13
  jmp    L536
L63:
  mov    %rbp,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  je     L207
  mov    $0xffffffff,%eax
  jmp    L165
L509:
  mov    %r15d,%edx
L526:
  mov    D89(%rip),%rax
  cmp    %edx,(%rax)
  je     L291
  movzbl (%rbx),%eax
  cmp    %edx,%eax
  jg     L316
L291:
  sub    $0x1,%r12
  mov    %r12,D38(%rip)
L199:
  mov    D175(%rip),%r12
  mov    D38(%rip),%rax
  cmp    %rax,%r12
  jg     L600
L748:
  add    %rax,%r12
  sar    %r12
  jne    L615
  mov    D188(%rip),%rax
  mov    (%rax),%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <fseek@plt>
  mov    %rax,%r13
  test   %rax,%rax
  jne    L564
L207:
  mov    %r14,%rbx
L218:
  mov    %rbp,%rdi
  call   <getc@plt>
  cmp    $0x9,%eax
  je     L509
  mov    %eax,%edx
  and    $0xffffffdf,%edx
  je     L526
  movzbl (%rbx),%edx
  cmp    %eax,%edx
  jne    L361
  add    $0x1,%rbx
  jmp    L218
L361:
  mov    %eax,%edx
  jmp    L526
L316:
  add    $0x1,%r13
  mov    %r13,D38(%rip)
  jmp    L199
L600:
  mov    D188(%rip),%rax
  mov    (%rax),%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <fseek@plt>
  mov    %rax,%rdx
  mov    $0xffffffff,%eax
  test   %rdx,%rdx
  jne    L165
  mov    $0x0,%r12d
  jmp    L484
L437:
  addq   $0x1,D38(%rip)
L453:
  mov    %rbp,%rdi
  call   <getc@plt>
  mov    D89(%rip),%rdx
  cmp    %eax,(%rdx)
  je     L475
  cmp    $0xa,%eax
  jne    L437
L475:
  mov    %rbp,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  je     L664
  mov    $0xffffffff,%eax
  jmp    L165
L301:
  mov    %r12d,%edx
L29:
  movzbl (%rbx),%ecx
  cmp    %edx,%ecx
  jle    L210
L484:
  cmpq   $0x0,D38(%rip)
  jne    L453
L664:
  mov    %r14,%rbx
L709:
  mov    %rbp,%rdi
  call   <getc@plt>
  mov    D89(%rip),%rdx
  cmp    %eax,(%rdx)
  je     L680
  addq   $0x1,D38(%rip)
  cmp    $0x9,%eax
  je     L301
  mov    %eax,%edx
  and    $0xffffffdf,%edx
  je     L29
  movzbl (%rbx),%edx
  cmp    %eax,%edx
  jne    L226
  add    $0x1,%rbx
  jmp    L709
L226:
  mov    %eax,%edx
  jmp    L29
L210:
  mov    $0x0,%eax
  jne    L165
L504:
  mov    %rbp,%rdi
  call   <fgetc@plt>
  mov    %eax,%edx
  cmp    $0x9,%eax
  je     L504
  cmp    $0x20,%eax
  je     L504
  cmp    $0x28,%eax
  je     L68
  cmp    $0xa,%eax
  je     L68
  lea    D38(%rip),%rbx
  lea    0xff(%rbx),%r12
  jmp    L363
L68:
  mov    $0x0,%eax
  jmp    L165
L387:
  mov    %rbp,%rdi
  call   <getc@plt>
  mov    %eax,%edx
  cmp    $0x20,%eax
  je     L699
  cmp    $0x9,%eax
  je     L699
  cmp    $0x28,%eax
  je     L658
  cmp    $0xa,%eax
  je     L658
L363:
  mov    D89(%rip),%rax
  cmp    %edx,(%rax)
  je     L699
  cmp    %r12,%rbx
  jae    L387
  mov    %dl,(%rbx)
  lea    0x1(%rbx),%rbx
  jmp    L387
L699:
  lea    D38(%rip),%rax
  cmp    %rax,%rbx
  je     L95
  movb   $0x0,(%rbx)
  cmp    $0x20,%edx
  je     L648
  cmp    $0x9,%edx
  jne    L238
L648:
  mov    %rbp,%rdi
  call   <fgetc@plt>
  mov    %eax,%edx
  cmp    $0x20,%eax
  je     L648
  cmp    $0x9,%eax
  je     L648
L238:
  mov    $0x0,%eax
  lea    D113(%rip),%rbx
  lea    0x1f(%rbx),%r12
  cmp    $0x28,%edx
  jne    L165
L39:
  mov    %rbp,%rdi
  call   <fgetc@plt>
  cmp    $0x29,%eax
  setne  %dl
  cmp    $0xa,%eax
  je     L512
  test   %dl,%dl
  je     L512
  mov    D89(%rip),%rdx
  cmp    %eax,(%rdx)
  je     L388
  lea    -0x41(%rax),%ecx
  lea    0x20(%rax),%edx
  cmp    $0x1a,%ecx
  cmovb  %edx,%eax
  cmp    %r12,%rbx
  jae    L39
  add    $0x1,%rbx
  mov    %al,-0x1(%rbx)
  jmp    L39
L512:
  movb   $0x0,(%rbx)
  lea    D113(%rip),%rax
  cmp    %rax,%rbx
  je     L506
  test   %dl,%dl
  jne    L506
  mov    D89(%rip),%rax
  cmpl   $0x29,(%rax)
  je     L75
L231:
  mov    %rbp,%rdi
  call   <getc@plt>
  mov    %eax,%edx
  mov    D89(%rip),%rax
  cmp    %edx,(%rax)
  je     L341
  cmp    $0xa,%edx
  jne    L231
L341:
  mov    $0x0,%eax
  cmp    $0xa,%edx
  jne    L165
  mov    (%rsp),%rax
  lea    D38(%rip),%rcx
  mov    %rcx,(%rax)
  mov    0x8(%rsp),%rax
  lea    D113(%rip),%rcx
  mov    %rcx,(%rax)
  mov    $0x1,%eax
  jmp    L165
L564:
  mov    $0xffffffff,%eax
L165:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L386:
  mov    $0xffffffff,%eax
  jmp    L165
L680:
  mov    $0x0,%eax
  jmp    L165
L95:
  mov    $0x0,%eax
  jmp    L165
L506:
  mov    $0x0,%eax
  jmp    L165
L75:
  mov    $0x0,%eax
  jmp    L165
L388:
  movb   $0x0,(%rbx)
  mov    $0x0,%eax
  jmp    L165
L658:
  mov    $0x0,%eax
  lea    D38(%rip),%rcx
  cmp    %rcx,%rbx
  je     L165
  movb   $0x0,(%rbx)
  jmp    L238
```

assistant: ```c
int searchwindex(FILE *wf, char *title, char **ppage, char **psection) {
  static char page[256], section[32];
  static long low, high;
  long mid0, mid1;
  int c;
  unsigned char *pt;
  char *pc;
  if (ftell(wf) == 0) {
    low = 0;
    fseek(wf, (off_t)0, SEEK_END);
    high = ftell(wf);
  }
  while (low <= high) {
    pt = (unsigned char *)title;
    mid0 = mid1 = (low + high) >> 1;
    if (mid0 == 0) {
      if (fseek(wf, (off_t)0, SEEK_SET) != 0)
        return -1;
    } else {
      if (fseek(wf, (off_t)mid0 - 1, SEEK_SET) != 0)
        return -1;
      while ((c = getc(wf)) != EOF && c != '\n')
        mid1++;
      if (ferror(wf))
        return -1;
    }
    for (;;) {
      if ((c = getc(wf)) == ' ' || c == '\t')
        c = 0;
      if (c == 0 || c != *pt)
        break;
      pt++;
    }
    if (c == EOF || *pt <= c) {
      high = mid0 - 1;
    } else {
      low = mid1 + 1;
    }
  }
  if (fseek(wf, (off_t)low, SEEK_SET) != 0)
    return -1;
  do {
    if (low != 0) {
      while ((c = getc(wf)) != EOF && c != '\n')
        low++;
      if (ferror(wf))
        return -1;
    }
    pt = (unsigned char *)title;
    for (;;) {
      if ((c = getc(wf)) == EOF)
        return 0;
      low++;
      if (c == ' ' || c == '\t')
        c = 0;
      if (c == 0 || c != *pt)
        break;
      pt++;
    }
  } while (c < *pt);
  if (*pt != c)
    return 0;
  while ((c = fgetc(wf)) == ' ' || c == '\t') {
  }
  pc = page;
  while (c != ' ' && c != '\t' && c != '(' && c != '\n' && c != EOF) {
    if (pc < ((page) + (sizeof(page) / sizeof((page)[0]))) - 1)
      *pc++ = c;
    c = getc(wf);
  }
  if (pc == page)
    return 0;
  *pc = 0;
  while (c == ' ' || c == '\t')
    c = fgetc(wf);
  if (c != '(')
    return 0;
  pc = section;
  while ((c = fgetc(wf)) != ')' && c != '\n' && c != EOF) {
    if ('A' <= c && c <= 'Z')
      c = c - 'A' + 'a';
    if (pc < ((section) + (sizeof(section) / sizeof((section)[0]))) - 1)
      *pc++ = c;
  }
  *pc = 0;
  if (c != ')' || pc == section)
    return 0;
  while (c != EOF && c != '\n')
    c = getc(wf);
  if (c != '\n')
    return 0;
  *ppage = page;
  *psection = section;
  return 1;
}
```