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

```asm
<searchwindex>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <ftell@plt>
  test   %rax,%rax
  jne    L458
  movq   $0x0,D41(%rip)
  mov    D272(%rip),%rax
  mov    (%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <fseek@plt>
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <ftell@plt>
  mov    %rax,D310(%rip)
  jmp    L458
L137:
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    D41(%rip),%rdx
  mov    D310(%rip),%rax
  add    %rdx,%rax
  sar    %rax
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L231
  mov    D216(%rip),%rax
  mov    (%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <fseek@plt>
  test   %rax,%rax
  je     L426
  mov    $0xffffffff,%eax
  jmp    L275
L231:
  mov    D216(%rip),%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rcx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fseek@plt>
  test   %rax,%rax
  je     L54
  mov    $0xffffffff,%eax
  jmp    L275
L471:
  addq   $0x1,-0x20(%rbp)
L54:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <getc@plt>
  mov    %eax,-0x24(%rbp)
  mov    D93(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  je     L443
  cmpl   $0xa,-0x24(%rbp)
  jne    L471
L443:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  je     L426
  mov    $0xffffffff,%eax
  jmp    L275
L426:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <getc@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x20,-0x24(%rbp)
  je     L114
  cmpl   $0x9,-0x24(%rbp)
  jne    L157
L114:
  movl   $0x0,-0x24(%rbp)
L157:
  cmpl   $0x0,-0x24(%rbp)
  je     L53
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,-0x24(%rbp)
  jne    L53
  addq   $0x1,-0x18(%rbp)
  jmp    L426
L53:
  mov    D93(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  je     L402
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,-0x24(%rbp)
  jl     L315
L402:
  mov    -0x8(%rbp),%rax
  sub    $0x1,%rax
  mov    %rax,D327(%rip)
  jmp    L458
L315:
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,D327(%rip)
L458:
  mov    D327(%rip),%rdx
  mov    D327(%rip),%rax
  cmp    %rax,%rdx
  jle    L137
  mov    D216(%rip),%rax
  mov    (%rax),%edx
  mov    D327(%rip),%rcx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fseek@plt>
  test   %rax,%rax
  je     L110
  mov    $0xffffffff,%eax
  jmp    L275
L110:
  mov    D327(%rip),%rax
  test   %rax,%rax
  je     L19
  jmp    L376
L382:
  mov    D327(%rip),%rax
  add    $0x1,%rax
  mov    %rax,D327(%rip)
L376:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <getc@plt>
  mov    %eax,-0x24(%rbp)
  mov    D93(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  je     L415
  cmpl   $0xa,-0x24(%rbp)
  jne    L382
L415:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  je     L19
  mov    $0xffffffff,%eax
  jmp    L275
L19:
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
L453:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <getc@plt>
  mov    %eax,-0x24(%rbp)
  mov    D93(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L29
  mov    $0x0,%eax
  jmp    L275
L29:
  mov    D327(%rip),%rax
  add    $0x1,%rax
  mov    %rax,D327(%rip)
  cmpl   $0x20,-0x24(%rbp)
  je     L194
  cmpl   $0x9,-0x24(%rbp)
  jne    L373
L194:
  movl   $0x0,-0x24(%rbp)
L373:
  cmpl   $0x0,-0x24(%rbp)
  je     L340
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,-0x24(%rbp)
  jne    L340
  addq   $0x1,-0x18(%rbp)
  jmp    L453
L340:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,-0x24(%rbp)
  jl     L110
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,-0x24(%rbp)
  je     L424
  mov    $0x0,%eax
  jmp    L275
L424:
  nop
L526:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x20,-0x24(%rbp)
  je     L526
  cmpl   $0x9,-0x24(%rbp)
  je     L526
  lea    D327(%rip),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L511
L566:
  lea    D225(%rip),%rax
  cmp    %rax,-0x10(%rbp)
  jae    L545
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x24(%rbp),%edx
  mov    %dl,(%rax)
L545:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <getc@plt>
  mov    %eax,-0x24(%rbp)
L511:
  cmpl   $0x20,-0x24(%rbp)
  je     L206
  cmpl   $0x9,-0x24(%rbp)
  je     L206
  cmpl   $0x28,-0x24(%rbp)
  je     L206
  cmpl   $0xa,-0x24(%rbp)
  je     L206
  mov    D93(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L566
L206:
  lea    D327(%rip),%rax
  cmp    %rax,-0x10(%rbp)
  jne    L135
  mov    $0x0,%eax
  jmp    L275
L135:
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L235
L379:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %eax,-0x24(%rbp)
L235:
  cmpl   $0x20,-0x24(%rbp)
  je     L379
  cmpl   $0x9,-0x24(%rbp)
  je     L379
  cmpl   $0x28,-0x24(%rbp)
  je     L33
  mov    $0x0,%eax
  jmp    L275
L33:
  lea    D16(%rip),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L294
L166:
  cmpl   $0x40,-0x24(%rbp)
  jle    L551
  cmpl   $0x5a,-0x24(%rbp)
  jg     L551
  addl   $0x20,-0x24(%rbp)
L551:
  lea    D133(%rip),%rax
  cmp    %rax,-0x10(%rbp)
  jae    L294
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x24(%rbp),%edx
  mov    %dl,(%rax)
L294:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x29,-0x24(%rbp)
  je     L306
  cmpl   $0xa,-0x24(%rbp)
  je     L306
  mov    D93(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L166
L306:
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  cmpl   $0x29,-0x24(%rbp)
  jne    L107
  lea    D16(%rip),%rax
  cmp    %rax,-0x10(%rbp)
  jne    L533
L107:
  mov    $0x0,%eax
  jmp    L275
L584:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <getc@plt>
  mov    %eax,-0x24(%rbp)
L533:
  mov    D93(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  je     L333
  cmpl   $0xa,-0x24(%rbp)
  jne    L584
L333:
  cmpl   $0xa,-0x24(%rbp)
  je     L665
  mov    $0x0,%eax
  jmp    L275
L665:
  mov    -0x48(%rbp),%rax
  lea    D327(%rip),%rdx
  mov    %rdx,(%rax)
  mov    -0x50(%rbp),%rax
  lea    D16(%rip),%rdx
  mov    %rdx,(%rax)
  mov    $0x1,%eax
L275:
  leave
  ret
```

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;
}
```