#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef char *section;
typedef char *page;
typedef scalar_t__ off_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
scalar_t__ ferror(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
scalar_t__ fseek(int /*<<< orphan*/ *, scalar_t__, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int getc(int /*<<< orphan*/ *);
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);
  }
  do {
    pt = (unsigned char *)title;
    if (low <= high) {
      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 (low <= high) {
      if (c == EOF || *pt <= c) {
        high = mid0 - 1;
      } else {
        low = mid1 + 1;
      }
    }
  } while (low <= high);
  if (*pt != 0 || c != 0)
    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;
}


x86 assembly (clang, -O0):
<searchwindex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <ftell@plt>
cmp    $0x0,%rax
jne    11ac <searchwindex+0x5c>
movq   $0x0,0x2ffa(%rip)
mov    -0x10(%rbp),%rdi
mov    0x2e57(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1060 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1050 <ftell@plt>
mov    %rax,0x2fdc(%rip)
jmp    11b1 <searchwindex+0x61>
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    0x2fc0(%rip),%rax
cmp    0x2fc1(%rip),%rax
jg     12ce <searchwindex+0x17e>
mov    0x2fac(%rip),%rax
add    0x2fad(%rip),%rax
sar    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1223 <searchwindex+0xd3>
mov    -0x10(%rbp),%rdi
mov    0x2dd3(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1060 <fseek@plt>
cmp    $0x0,%rax
je     121e <searchwindex+0xce>
movl   $0xffffffff,-0x4(%rbp)
jmp    167d <searchwindex+0x52d>
jmp    12c9 <searchwindex+0x179>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
sub    $0x1,%rsi
mov    0x2d9a(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
cmp    $0x0,%rax
je     1253 <searchwindex+0x103>
movl   $0xffffffff,-0x4(%rbp)
jmp    167d <searchwindex+0x52d>
jmp    1258 <searchwindex+0x108>
mov    -0x10(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,%ecx
mov    %ecx,-0x3c(%rbp)
xor    %eax,%eax
mov    0x2d71(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x51(%rbp)
je     1284 <searchwindex+0x134>
cmpl   $0xa,-0x3c(%rbp)
setne  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    1294 <searchwindex+0x144>
jmp    12a5 <searchwindex+0x155>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1258 <searchwindex+0x108>
mov    -0x10(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     12c4 <searchwindex+0x174>
movl   $0xffffffff,-0x4(%rbp)
jmp    167d <searchwindex+0x52d>
jmp    12c9 <searchwindex+0x179>
jmp    12ce <searchwindex+0x17e>
jmp    12d3 <searchwindex+0x183>
mov    -0x10(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x20,%eax
je     12f2 <searchwindex+0x1a2>
cmpl   $0x9,-0x3c(%rbp)
jne    12f9 <searchwindex+0x1a9>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1315 <searchwindex+0x1c5>
mov    -0x3c(%rbp),%eax
mov    -0x48(%rbp),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
je     131a <searchwindex+0x1ca>
jmp    132b <searchwindex+0x1db>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    12d3 <searchwindex+0x183>
mov    0x2e4e(%rip),%rax
cmp    0x2e4f(%rip),%rax
jg     1389 <searchwindex+0x239>
mov    -0x3c(%rbp),%eax
mov    0x2c97(%rip),%rcx
cmp    (%rcx),%eax
je     1361 <searchwindex+0x211>
mov    -0x48(%rbp),%rax
movzbl (%rax),%eax
cmp    -0x3c(%rbp),%eax
jg     1375 <searchwindex+0x225>
mov    -0x30(%rbp),%rax
sub    $0x1,%rax
mov    %rax,0x2e18(%rip)
jmp    1384 <searchwindex+0x234>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,0x2dfc(%rip)
jmp    1389 <searchwindex+0x239>
jmp    138e <searchwindex+0x23e>
mov    0x2deb(%rip),%rax
cmp    0x2dec(%rip),%rax
jle    11b1 <searchwindex+0x61>
mov    -0x48(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
jne    13bc <searchwindex+0x26c>
cmpl   $0x0,-0x3c(%rbp)
je     13c8 <searchwindex+0x278>
movl   $0x0,-0x4(%rbp)
jmp    167d <searchwindex+0x52d>
jmp    13cd <searchwindex+0x27d>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0x3c(%rbp)
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x52(%rbp)
je     13f3 <searchwindex+0x2a3>
cmpl   $0x9,-0x3c(%rbp)
sete   %al
mov    %al,-0x52(%rbp)
mov    -0x52(%rbp),%al
test   $0x1,%al
jne    1403 <searchwindex+0x2b3>
jmp    1408 <searchwindex+0x2b8>
jmp    13cd <searchwindex+0x27d>
lea    0x2c51(%rip),%rax
mov    %rax,-0x50(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0x3c(%rbp)
mov    %al,-0x53(%rbp)
je     1461 <searchwindex+0x311>
xor    %eax,%eax
cmpl   $0x9,-0x3c(%rbp)
mov    %al,-0x53(%rbp)
je     1461 <searchwindex+0x311>
xor    %eax,%eax
cmpl   $0x28,-0x3c(%rbp)
mov    %al,-0x53(%rbp)
je     1461 <searchwindex+0x311>
xor    %eax,%eax
cmpl   $0xa,-0x3c(%rbp)
mov    %al,-0x53(%rbp)
je     1461 <searchwindex+0x311>
mov    -0x3c(%rbp),%eax
mov    0x2b87(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x53(%rbp)
mov    -0x53(%rbp),%al
test   $0x1,%al
jne    1471 <searchwindex+0x321>
jmp    14af <searchwindex+0x35f>
lea    0x2be8(%rip),%rax
add    $0xff,%rax
cmp    %rax,-0x50(%rbp)
jae    149e <searchwindex+0x34e>
mov    -0x3c(%rbp),%eax
mov    %al,%cl
mov    -0x50(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x50(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,-0x3c(%rbp)
jmp    1413 <searchwindex+0x2c3>
lea    0x2baa(%rip),%rax
cmp    %rax,-0x50(%rbp)
jne    14cc <searchwindex+0x37c>
movl   $0x0,-0x4(%rbp)
jmp    167d <searchwindex+0x52d>
mov    -0x50(%rbp),%rax
movb   $0x0,(%rax)
mov    $0x1,%al
cmpl   $0x20,-0x3c(%rbp)
mov    %al,-0x54(%rbp)
je     14ec <searchwindex+0x39c>
cmpl   $0x9,-0x3c(%rbp)
sete   %al
mov    %al,-0x54(%rbp)
mov    -0x54(%rbp),%al
test   $0x1,%al
jne    14fc <searchwindex+0x3ac>
jmp    150d <searchwindex+0x3bd>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x3c(%rbp)
jmp    14d3 <searchwindex+0x383>
cmpl   $0x28,-0x3c(%rbp)
je     1523 <searchwindex+0x3d3>
movl   $0x0,-0x4(%rbp)
jmp    167d <searchwindex+0x52d>
lea    0x2c36(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0x3c(%rbp)
xor    %eax,%eax
cmp    $0x29,%ecx
mov    %al,-0x55(%rbp)
je     156b <searchwindex+0x41b>
xor    %eax,%eax
cmpl   $0xa,-0x3c(%rbp)
mov    %al,-0x55(%rbp)
je     156b <searchwindex+0x41b>
mov    -0x3c(%rbp),%eax
mov    0x2a7d(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%al
test   $0x1,%al
jne    157b <searchwindex+0x42b>
jmp    15cf <searchwindex+0x47f>
mov    $0x41,%eax
cmp    -0x3c(%rbp),%eax
jg     159f <searchwindex+0x44f>
cmpl   $0x5a,-0x3c(%rbp)
jg     159f <searchwindex+0x44f>
mov    -0x3c(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x3c(%rbp)
lea    0x2bba(%rip),%rax
add    $0x1f,%rax
cmp    %rax,-0x50(%rbp)
jae    15ca <searchwindex+0x47a>
mov    -0x3c(%rbp),%eax
mov    %al,%cl
mov    -0x50(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x50(%rbp)
mov    %cl,(%rax)
jmp    152e <searchwindex+0x3de>
mov    -0x50(%rbp),%rax
movb   $0x0,(%rax)
cmpl   $0x29,-0x3c(%rbp)
jne    15f1 <searchwindex+0x4a1>
lea    0x2b79(%rip),%rax
cmp    %rax,-0x50(%rbp)
jne    15fd <searchwindex+0x4ad>
movl   $0x0,-0x4(%rbp)
jmp    167d <searchwindex+0x52d>
jmp    1602 <searchwindex+0x4b2>
mov    -0x3c(%rbp),%ecx
xor    %eax,%eax
mov    0x29d2(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x56(%rbp)
je     1623 <searchwindex+0x4d3>
cmpl   $0xa,-0x3c(%rbp)
setne  %al
mov    %al,-0x56(%rbp)
mov    -0x56(%rbp),%al
test   $0x1,%al
jne    1633 <searchwindex+0x4e3>
jmp    1644 <searchwindex+0x4f4>
mov    -0x10(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,-0x3c(%rbp)
jmp    1602 <searchwindex+0x4b2>
cmpl   $0xa,-0x3c(%rbp)
je     165a <searchwindex+0x50a>
movl   $0x0,-0x4(%rbp)
jmp    167d <searchwindex+0x52d>
mov    -0x20(%rbp),%rax
lea    0x29fb(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
lea    0x2aed(%rip),%rcx
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<searchwindex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x10(%rsp)
mov    %rdx,0x8(%rsp)
mov    %rsi,%r12
mov    %rdi,%rbx
call   1050 <ftell@plt>
test   %rax,%rax
je     1181 <searchwindex+0x31>
mov    0x3009(%rip),%rax
jmp    11ae <searchwindex+0x5e>
movq   $0x0,0x2ff4(%rip)
mov    0x2e55(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <fseek@plt>
mov    %rbx,%rdi
call   1050 <ftell@plt>
mov    %rax,0x2fda(%rip)
mov    0x2fcb(%rip),%rcx
mov    0x2e24(%rip),%r14
jmp    11d4 <searchwindex+0x84>
xchg   %ax,%ax
lea    -0x1(%r15),%rax
mov    %rax,0x2fbd(%rip)
cmp    %rax,%rcx
jg     1312 <searchwindex+0x1c2>
cmp    %rax,%rcx
jg     1267 <searchwindex+0x117>
add    %rcx,%rax
cmp    $0x1,%rax
ja     1210 <searchwindex+0xc0>
mov    0x2de3(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <fseek@plt>
mov    $0x0,%r15d
mov    $0x0,%ebp
test   %rax,%rax
je     1267 <searchwindex+0x117>
jmp    13f4 <searchwindex+0x2a4>
xchg   %ax,%ax
mov    %rax,%r15
sar    %r15
lea    -0x1(%r15),%rbp
mov    0x2daf(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <fseek@plt>
mov    $0xffffffff,%r13d
test   %rax,%rax
jne    13fa <searchwindex+0x2aa>
nopl   (%rax)
mov    %rbx,%rdi
call   1070 <getc@plt>
add    $0x1,%rbp
cmp    $0xa,%eax
je     1256 <searchwindex+0x106>
cmp    (%r14),%eax
jne    1240 <searchwindex+0xf0>
mov    %rbx,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    13fa <searchwindex+0x2aa>
mov    %rbx,%rdi
call   1070 <getc@plt>
cmp    $0x20,%eax
ja     12d0 <searchwindex+0x180>
xor    %edx,%edx
mov    %eax,%ecx
movabs $0x100000201,%rsi
bt     %rcx,%rsi
mov    %r12,%r13
jae    12d0 <searchwindex+0x180>
mov    0x2eee(%rip),%rcx
mov    0x2eef(%rip),%rax
cmp    %rax,%rcx
jg     11cb <searchwindex+0x7b>
cmp    (%r14),%edx
je     11c0 <searchwindex+0x70>
movzbl 0x0(%r13),%esi
cmp    %esi,%edx
jge    11c0 <searchwindex+0x70>
lea    0x1(%rbp),%rcx
mov    %rcx,0x2ebd(%rip)
jmp    11cb <searchwindex+0x7b>
nopl   0x0(%rax,%rax,1)
mov    %r12,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl 0x0(%r13),%ecx
cmp    %ecx,%eax
jne    130b <searchwindex+0x1bb>
add    $0x1,%r13
mov    %rbx,%rdi
call   1070 <getc@plt>
mov    %eax,%ecx
xor    %edx,%edx
cmp    $0x9,%eax
cmove  %edx,%eax
cmp    $0x20,%ecx
cmove  %edx,%eax
test   %eax,%eax
jne    12e0 <searchwindex+0x190>
jmp    128b <searchwindex+0x13b>
mov    %eax,%edx
jmp    128b <searchwindex+0x13b>
test   %edx,%edx
jne    1378 <searchwindex+0x228>
cmpb   $0x0,0x0(%r13)
jne    1378 <searchwindex+0x228>
nopl   (%rax)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    $0x9,%eax
je     1320 <searchwindex+0x1d0>
cmp    $0x20,%eax
je     1320 <searchwindex+0x1d0>
lea    0x2d27(%rip),%rbp
lea    0x2e1f(%rip),%r15
movabs $0x10100000600,%r12
xor    %r13d,%r13d
jmp    1358 <searchwindex+0x208>
nop
mov    %rbx,%rdi
call   1070 <getc@plt>
cmp    $0x28,%eax
ja     1365 <searchwindex+0x215>
mov    %eax,%ecx
bt     %rcx,%r12
jb     137d <searchwindex+0x22d>
cmp    (%r14),%eax
je     137d <searchwindex+0x22d>
cmp    %r15,%rbp
jae    1350 <searchwindex+0x200>
mov    %al,0x0(%rbp)
add    $0x1,%rbp
jmp    1350 <searchwindex+0x200>
xor    %r13d,%r13d
jmp    13fa <searchwindex+0x2aa>
lea    0x2cdc(%rip),%r15
cmp    %r15,%rbp
je     13fa <searchwindex+0x2aa>
movb   $0x0,0x0(%rbp)
jmp    1398 <searchwindex+0x248>
nop
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    $0x9,%eax
je     1390 <searchwindex+0x240>
cmp    $0x20,%eax
je     1390 <searchwindex+0x240>
cmp    $0x28,%eax
jne    13fa <searchwindex+0x2aa>
lea    0x2db2(%rip),%rbp
lea    0x2dca(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    $0xa,%eax
je     140c <searchwindex+0x2bc>
cmp    $0x29,%eax
je     140c <searchwindex+0x2bc>
cmp    (%r14),%eax
je     140c <searchwindex+0x2bc>
cmp    %r12,%rbp
jae    13c0 <searchwindex+0x270>
lea    -0x41(%rax),%ecx
lea    0x20(%rax),%edx
cmp    $0x1a,%ecx
movzbl %dl,%ecx
cmovae %eax,%ecx
mov    %cl,0x0(%rbp)
add    $0x1,%rbp
jmp    13c0 <searchwindex+0x270>
mov    $0xffffffff,%r13d
mov    %r13d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movb   $0x0,0x0(%rbp)
cmp    $0x29,%eax
jne    13fa <searchwindex+0x2aa>
lea    0x2d44(%rip),%r12
cmp    %r12,%rbp
je     13fa <searchwindex+0x2aa>
cmpl   $0x29,(%r14)
je     13fa <searchwindex+0x2aa>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1070 <getc@plt>
cmp    $0xa,%eax
je     1442 <searchwindex+0x2f2>
cmp    (%r14),%eax
jne    1430 <searchwindex+0x2e0>
cmp    $0xa,%eax
jne    13fa <searchwindex+0x2aa>
mov    0x8(%rsp),%rax
mov    %r15,(%rax)
mov    0x10(%rsp),%rax
mov    %r12,(%rax)
mov    $0x1,%r13d
jmp    13fa <searchwindex+0x2aa>

LLVM IR (-O0):
@searchwindex.page = internal global [256 x i8] zeroinitializer
@searchwindex.section = internal global [32 x i8] zeroinitializer
@searchwindex.low = internal global i64 0
@searchwindex.high = internal global i64 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@EOF = global i32 0
define i32 @searchwindex(i32* %0, i8* %1, i8** %2, i8** %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8**
%9 = alloca i8**
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8** %2, i8*** %8
store i8** %3, i8*** %9
%15 = load i32*, i32** %6
%16 = call i64 @ftell(i32* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %4
store i64 0, i64* @searchwindex.low
%19 = load i32*, i32** %6
%20 = load i32, i32* @SEEK_END
%21 = call i64 @fseek(i32* %19, i64 0, i32 %20)
%22 = load i32*, i32** %6
%23 = call i64 @ftell(i32* %22)
store i64 %23, i64* @searchwindex.high
br label %24
24: ; preds = %18, %4
br label %25
25: ; preds = %117, %24
%26 = load i8*, i8** %7
store i8* %26, i8** %13
%27 = load i64, i64* @searchwindex.low
%28 = load i64, i64* @searchwindex.high
%29 = icmp sle i64 %27, %28
br i1 %29, label %30, label %73
30: ; preds = %25
%31 = load i64, i64* @searchwindex.low
%32 = load i64, i64* @searchwindex.high
%33 = add nsw i64 %31, %32
%34 = ashr i64 %33, 1
store i64 %34, i64* %11
store i64 %34, i64* %10
%35 = load i64, i64* %10
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %30
%38 = load i32*, i32** %6
%39 = load i32, i32* @SEEK_SET
%40 = call i64 @fseek(i32* %38, i64 0, i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %37
store i32 -1, i32* %5
br label %253
43: ; preds = %37
br label %72
44: ; preds = %30
%45 = load i32*, i32** %6
%46 = load i64, i64* %10
%47 = sub nsw i64 %46, 1
%48 = load i32, i32* @SEEK_SET
%49 = call i64 @fseek(i32* %45, i64 %47, i32 %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %44
store i32 -1, i32* %5
br label %253
52: ; preds = %44
br label %53
53: ; preds = %63, %52
%54 = load i32*, i32** %6
%55 = call i32 @getc(i32* %54)
store i32 %55, i32* %12
%56 = load i32, i32* @EOF
%57 = icmp ne i32 %55, %56
br i1 %57, label %58, label %61
58: ; preds = %53
%59 = load i32, i32* %12
%60 = icmp ne i32 %59, 10
br label %61
61: ; preds = %58, %53
%62 = phi i1 [ false, %53 ], [ %60, %58 ]
br i1 %62, label %63, label %66
63: ; preds = %61
%64 = load i64, i64* %11
%65 = add nsw i64 %64, 1
store i64 %65, i64* %11
br label %53
66: ; preds = %61
%67 = load i32*, i32** %6
%68 = call i64 @ferror(i32* %67)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %71
70: ; preds = %66
store i32 -1, i32* %5
br label %253
71: ; preds = %66
br label %72
72: ; preds = %71, %43
br label %73
73: ; preds = %72, %25
br label %74
74: ; preds = %92, %73
%75 = load i32*, i32** %6
%76 = call i32 @getc(i32* %75)
store i32 %76, i32* %12
%77 = icmp eq i32 %76, 32
br i1 %77, label %81, label %78
78: ; preds = %74
%79 = load i32, i32* %12
%80 = icmp eq i32 %79, 9
br i1 %80, label %81, label %82
81: ; preds = %78, %74
store i32 0, i32* %12
br label %82
82: ; preds = %81, %78
%83 = load i32, i32* %12
%84 = icmp eq i32 %83, 0
br i1 %84, label %91, label %85
85: ; preds = %82
%86 = load i32, i32* %12
%87 = load i8*, i8** %13
%88 = load i8, i8* %87
%89 = zext i8 %88 to i32
%90 = icmp ne i32 %86, %89
br i1 %90, label %91, label %92
91: ; preds = %85, %82
br label %95
92: ; preds = %85
%93 = load i8*, i8** %13
%94 = getelementptr inbounds i8, i8* %93, i32 1
store i8* %94, i8** %13
br label %74
95: ; preds = %91
%96 = load i64, i64* @searchwindex.low
%97 = load i64, i64* @searchwindex.high
%98 = icmp sle i64 %96, %97
br i1 %98, label %99, label %116
99: ; preds = %95
%100 = load i32, i32* %12
%101 = load i32, i32* @EOF
%102 = icmp eq i32 %100, %101
br i1 %102, label %109, label %103
103: ; preds = %99
%104 = load i8*, i8** %13
%105 = load i8, i8* %104
%106 = zext i8 %105 to i32
%107 = load i32, i32* %12
%108 = icmp sle i32 %106, %107
br i1 %108, label %109, label %112
109: ; preds = %103, %99
%110 = load i64, i64* %10
%111 = sub nsw i64 %110, 1
store i64 %111, i64* @searchwindex.high
br label %115
112: ; preds = %103
%113 = load i64, i64* %11
%114 = add nsw i64 %113, 1
store i64 %114, i64* @searchwindex.low
br label %115
115: ; preds = %112, %109
br label %116
116: ; preds = %115, %95
br label %117
117: ; preds = %116
%118 = load i64, i64* @searchwindex.low
%119 = load i64, i64* @searchwindex.high
%120 = icmp sle i64 %118, %119
br i1 %120, label %25, label %121
121: ; preds = %117
%122 = load i8*, i8** %13
%123 = load i8, i8* %122
%124 = zext i8 %123 to i32
%125 = icmp ne i32 %124, 0
br i1 %125, label %129, label %126
126: ; preds = %121
%127 = load i32, i32* %12
%128 = icmp ne i32 %127, 0
br i1 %128, label %129, label %130
129: ; preds = %126, %121
store i32 0, i32* %5
br label %253
130: ; preds = %126
br label %131
131: ; preds = %140, %130
%132 = load i32*, i32** %6
%133 = call i32 @fgetc(i32* %132)
store i32 %133, i32* %12
%134 = icmp eq i32 %133, 32
br i1 %134, label %138, label %135
135: ; preds = %131
%136 = load i32, i32* %12
%137 = icmp eq i32 %136, 9
br label %138
138: ; preds = %135, %131
%139 = phi i1 [ true, %131 ], [ %137, %135 ]
br i1 %139, label %140, label %141
140: ; preds = %138
br label %131
141: ; preds = %138
store i8* getelementptr inbounds ([256 x i8], [256 x i8]* @searchwindex.page, i64 0, i64 0), i8** %14
br label %142
142: ; preds = %168, %141
%143 = load i32, i32* %12
%144 = icmp ne i32 %143, 32
br i1 %144, label %145, label %158
145: ; preds = %142
%146 = load i32, i32* %12
%147 = icmp ne i32 %146, 9
br i1 %147, label %148, label %158
148: ; preds = %145
%149 = load i32, i32* %12
%150 = icmp ne i32 %149, 40
br i1 %150, label %151, label %158
151: ; preds = %148
%152 = load i32, i32* %12
%153 = icmp ne i32 %152, 10
br i1 %153, label %154, label %158
154: ; preds = %151
%155 = load i32, i32* %12
%156 = load i32, i32* @EOF
%157 = icmp ne i32 %155, %156
br label %158
158: ; preds = %154, %151, %148, %145, %142
%159 = phi i1 [ false, %151 ], [ false, %148 ], [ false, %145 ], [ false, %142 ], [ %157, %154 ]
br i1 %159, label %160, label %171
160: ; preds = %158
%161 = load i8*, i8** %14
%162 = icmp ult i8* %161, getelementptr inbounds ([256 x i8], [256 x i8]* @searchwindex.page, i64 1, i64 -1)
br i1 %162, label %163, label %168
163: ; preds = %160
%164 = load i32, i32* %12
%165 = trunc i32 %164 to i8
%166 = load i8*, i8** %14
%167 = getelementptr inbounds i8, i8* %166, i32 1
store i8* %167, i8** %14
store i8 %165, i8* %166
br label %168
168: ; preds = %163, %160
%169 = load i32*, i32** %6
%170 = call i32 @getc(i32* %169)
store i32 %170, i32* %12
br label %142
171: ; preds = %158
%172 = load i8*, i8** %14
%173 = icmp eq i8* %172, getelementptr inbounds ([256 x i8], [256 x i8]* @searchwindex.page, i64 0, i64 0)
br i1 %173, label %174, label %175
174: ; preds = %171
store i32 0, i32* %5
br label %253
175: ; preds = %171
%176 = load i8*, i8** %14
store i8 0, i8* %176
br label %177
177: ; preds = %185, %175
%178 = load i32, i32* %12
%179 = icmp eq i32 %178, 32
br i1 %179, label %183, label %180
180: ; preds = %177
%181 = load i32, i32* %12
%182 = icmp eq i32 %181, 9
br label %183
183: ; preds = %180, %177
%184 = phi i1 [ true, %177 ], [ %182, %180 ]
br i1 %184, label %185, label %188
185: ; preds = %183
%186 = load i32*, i32** %6
%187 = call i32 @fgetc(i32* %186)
store i32 %187, i32* %12
br label %177
188: ; preds = %183
%189 = load i32, i32* %12
%190 = icmp ne i32 %189, 40
br i1 %190, label %191, label %192
191: ; preds = %188
store i32 0, i32* %5
br label %253
192: ; preds = %188
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @searchwindex.section, i64 0, i64 0), i8** %14
br label %193
193: ; preds = %224, %192
%194 = load i32*, i32** %6
%195 = call i32 @fgetc(i32* %194)
store i32 %195, i32* %12
%196 = icmp ne i32 %195, 41
br i1 %196, label %197, label %204
197: ; preds = %193
%198 = load i32, i32* %12
%199 = icmp ne i32 %198, 10
br i1 %199, label %200, label %204
200: ; preds = %197
%201 = load i32, i32* %12
%202 = load i32, i32* @EOF
%203 = icmp ne i32 %201, %202
br label %204
204: ; preds = %200, %197, %193
%205 = phi i1 [ false, %197 ], [ false, %193 ], [ %203, %200 ]
br i1 %205, label %206, label %225
206: ; preds = %204
%207 = load i32, i32* %12
%208 = icmp sle i32 65, %207
br i1 %208, label %209, label %216
209: ; preds = %206
%210 = load i32, i32* %12
%211 = icmp sle i32 %210, 90
br i1 %211, label %212, label %216
212: ; preds = %209
%213 = load i32, i32* %12
%214 = sub nsw i32 %213, 65
%215 = add nsw i32 %214, 97
store i32 %215, i32* %12
br label %216
216: ; preds = %212, %209, %206
%217 = load i8*, i8** %14
%218 = icmp ult i8* %217, getelementptr inbounds ([32 x i8], [32 x i8]* @searchwindex.section, i64 1, i64 -1)
br i1 %218, label %219, label %224
219: ; preds = %216
%220 = load i32, i32* %12
%221 = trunc i32 %220 to i8
%222 = load i8*, i8** %14
%223 = getelementptr inbounds i8, i8* %222, i32 1
store i8* %223, i8** %14
store i8 %221, i8* %222
br label %224
224: ; preds = %219, %216
br label %193
225: ; preds = %204
%226 = load i8*, i8** %14
store i8 0, i8* %226
%227 = load i32, i32* %12
%228 = icmp ne i32 %227, 41
br i1 %228, label %232, label %229
229: ; preds = %225
%230 = load i8*, i8** %14
%231 = icmp eq i8* %230, getelementptr inbounds ([32 x i8], [32 x i8]* @searchwindex.section, i64 0, i64 0)
br i1 %231, label %232, label %233
232: ; preds = %229, %225
store i32 0, i32* %5
br label %253
233: ; preds = %229
br label %234
234: ; preds = %243, %233
%235 = load i32, i32* %12
%236 = load i32, i32* @EOF
%237 = icmp ne i32 %235, %236
br i1 %237, label %238, label %241
238: ; preds = %234
%239 = load i32, i32* %12
%240 = icmp ne i32 %239, 10
br label %241
241: ; preds = %238, %234
%242 = phi i1 [ false, %234 ], [ %240, %238 ]
br i1 %242, label %243, label %246
243: ; preds = %241
%244 = load i32*, i32** %6
%245 = call i32 @getc(i32* %244)
store i32 %245, i32* %12
br label %234
246: ; preds = %241
%247 = load i32, i32* %12
%248 = icmp ne i32 %247, 10
br i1 %248, label %249, label %250
249: ; preds = %246
store i32 0, i32* %5
br label %253
250: ; preds = %246
%251 = load i8**, i8*** %8
store i8* getelementptr inbounds ([256 x i8], [256 x i8]* @searchwindex.page, i64 0, i64 0), i8** %251
%252 = load i8**, i8*** %9
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @searchwindex.section, i64 0, i64 0), i8** %252
store i32 1, i32* %5
br label %253
253: ; preds = %250, %249, %232, %191, %174, %129, %70, %51, %42
%254 = load i32, i32* %5
ret i32 %254
}

LLVM IR (-O2):
@searchwindex.page = internal global [256 x i8] zeroinitializer
@searchwindex.section = internal global [32 x i8] zeroinitializer
@searchwindex.low = internal unnamed_addr global i64 0
@searchwindex.high = internal unnamed_addr global i64 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@EOF = global i32 0
define i32 @searchwindex(i32* nocapture %0, i8* nocapture %1, i8** nocapture writeonly %2, i8** nocapture writeonly %3) {
%5 = tail call i64 @ftell(i32* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = load i64, i64* @searchwindex.high
br label %13
9: ; preds = %4
store i64 0, i64* @searchwindex.low
%10 = load i32, i32* @SEEK_END
%11 = tail call i64 @fseek(i32* %0, i64 0, i32 %10)
%12 = tail call i64 @ftell(i32* %0)
store i64 %12, i64* @searchwindex.high
br label %13
13: ; preds = %7, %9
%14 = phi i64 [ %8, %7 ], [ %12, %9 ]
%15 = load i64, i64* @searchwindex.low
br label %16
16: ; preds = %81, %13
%17 = phi i64 [ %14, %13 ], [ %82, %81 ]
%18 = phi i64 [ %15, %13 ], [ %83, %81 ]
%19 = phi i64 [ undef, %13 ], [ %47, %81 ]
%20 = phi i64 [ undef, %13 ], [ %48, %81 ]
%21 = icmp sgt i64 %18, %17
br i1 %21, label %46, label %22
22: ; preds = %16
%23 = add nsw i64 %17, %18
%24 = ashr i64 %23, 1
%25 = icmp ult i64 %23, 2
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = load i32, i32* @SEEK_SET
%28 = tail call i64 @fseek(i32* %0, i64 0, i32 %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %46, label %145
30: ; preds = %22
%31 = add nsw i64 %24, -1
%32 = load i32, i32* @SEEK_SET
%33 = tail call i64 @fseek(i32* %0, i64 %31, i32 %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %145
35: ; preds = %30, %35
%36 = phi i64 [ %42, %35 ], [ %24, %30 ]
%37 = tail call i32 @getc(i32* %0)
%38 = load i32, i32* @EOF
%39 = icmp ne i32 %37, %38
%40 = icmp ne i32 %37, 10
%41 = and i1 %40, %39
%42 = add nsw i64 %36, 1
br i1 %41, label %35, label %43
43: ; preds = %35
%44 = tail call i64 @ferror(i32* %0)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %145
46: ; preds = %26, %43, %16
%47 = phi i64 [ 0, %26 ], [ %24, %43 ], [ %19, %16 ]
%48 = phi i64 [ 0, %26 ], [ %36, %43 ], [ %20, %16 ]
%49 = tail call i32 @getc(i32* %0)
switch i32 %49, label %50 [
i32 32, label %64
i32 9, label %64
i32 0, label %64
]
50: ; preds = %46, %56
%51 = phi i32 [ %62, %56 ], [ %49, %46 ]
%52 = phi i8* [ %57, %56 ], [ %1, %46 ]
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = icmp eq i32 %51, %54
br i1 %55, label %56, label %64
56: ; preds = %50
%57 = getelementptr inbounds i8, i8* %52, i64 1
%58 = tail call i32 @getc(i32* %0)
%59 = icmp eq i32 %58, 32
%60 = icmp eq i32 %58, 9
%61 = or i1 %59, %60
%62 = select i1 %61, i32 0, i32 %58
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %50
64: ; preds = %50, %56, %46, %46, %46
%65 = phi i8* [ %1, %46 ], [ %1, %46 ], [ %1, %46 ], [ %57, %56 ], [ %52, %50 ]
%66 = phi i32 [ 0, %46 ], [ 0, %46 ], [ 0, %46 ], [ 0, %56 ], [ %51, %50 ]
%67 = load i64, i64* @searchwindex.low
%68 = load i64, i64* @searchwindex.high
%69 = icmp sgt i64 %67, %68
br i1 %69, label %81, label %70
70: ; preds = %64
%71 = load i32, i32* @EOF
%72 = icmp eq i32 %66, %71
br i1 %72, label %77, label %73
73: ; preds = %70
%74 = load i8, i8* %65
%75 = zext i8 %74 to i32
%76 = icmp slt i32 %66, %75
br i1 %76, label %79, label %77
77: ; preds = %73, %70
%78 = add nsw i64 %47, -1
store i64 %78, i64* @searchwindex.high
br label %81
79: ; preds = %73
%80 = add nsw i64 %48, 1
store i64 %80, i64* @searchwindex.low
br label %81
81: ; preds = %64, %79, %77
%82 = phi i64 [ %68, %64 ], [ %68, %79 ], [ %78, %77 ]
%83 = phi i64 [ %67, %64 ], [ %80, %79 ], [ %67, %77 ]
%84 = icmp sgt i64 %83, %82
br i1 %84, label %85, label %16
85: ; preds = %81
%86 = load i8, i8* %65
%87 = icmp ne i8 %86, 0
%88 = icmp ne i32 %66, 0
%89 = or i1 %88, %87
br i1 %89, label %145, label %90
90: ; preds = %85, %92
%91 = tail call i32 @fgetc(i32* %0)
switch i32 %91, label %93 [
i32 32, label %92
i32 9, label %92
]
92: ; preds = %90, %90
br label %90
93: ; preds = %90, %104
%94 = phi i32 [ %106, %104 ], [ %91, %90 ]
%95 = phi i8* [ %105, %104 ], [ getelementptr inbounds ([256 x i8], [256 x i8]* @searchwindex.page, i64 0, i64 0), %90 ]
switch i32 %94, label %96 [
i32 40, label %107
i32 32, label %107
i32 10, label %107
i32 9, label %107
]
96: ; preds = %93
%97 = load i32, i32* @EOF
%98 = icmp eq i32 %94, %97
br i1 %98, label %107, label %99
99: ; preds = %96
%100 = icmp ult i8* %95, getelementptr inbounds ([256 x i8], [256 x i8]* @searchwindex.page, i64 0, i64 255)
br i1 %100, label %101, label %104
101: ; preds = %99
%102 = trunc i32 %94 to i8
%103 = getelementptr inbounds i8, i8* %95, i64 1
store i8 %102, i8* %95
br label %104
104: ; preds = %101, %99
%105 = phi i8* [ %103, %101 ], [ %95, %99 ]
%106 = tail call i32 @getc(i32* %0)
br label %93
107: ; preds = %93, %93, %93, %93, %96
%108 = icmp eq i8* %95, getelementptr inbounds ([256 x i8], [256 x i8]* @searchwindex.page, i64 0, i64 0)
br i1 %108, label %145, label %109
109: ; preds = %107
store i8 0, i8* %95
br label %110
110: ; preds = %112, %109
%111 = phi i32 [ %94, %109 ], [ %113, %112 ]
switch i32 %111, label %145 [
i32 32, label %112
i32 9, label %112
i32 40, label %127
]
112: ; preds = %110, %110
%113 = tail call i32 @fgetc(i32* %0)
br label %110
114: ; preds = %127, %119
%115 = tail call i32 @fgetc(i32* %0)
switch i32 %115, label %116 [
i32 41, label %130
i32 10, label %130
]
116: ; preds = %114
%117 = load i32, i32* @EOF
%118 = icmp eq i32 %115, %117
br i1 %118, label %130, label %119
119: ; preds = %116
br i1 %129, label %120, label %114
120: ; preds = %119
%121 = add i32 %115, -65
%122 = icmp ult i32 %121, 26
%123 = add nsw i32 %115, 32
%124 = select i1 %122, i32 %123, i32 %115
%125 = trunc i32 %124 to i8
%126 = getelementptr inbounds i8, i8* %128, i64 1
store i8 %125, i8* %128
br label %127
127: ; preds = %110, %120
%128 = phi i8* [ %126, %120 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @searchwindex.section, i64 0, i64 0), %110 ]
%129 = icmp ult i8* %128, getelementptr inbounds ([32 x i8], [32 x i8]* @searchwindex.section, i64 0, i64 31)
br label %114
130: ; preds = %114, %114, %116
%131 = icmp eq i32 %115, 41
store i8 0, i8* %128
%132 = icmp ne i8* %128, getelementptr inbounds ([32 x i8], [32 x i8]* @searchwindex.section, i64 0, i64 0)
%133 = select i1 %131, i1 %132, i1 false
%134 = load i32, i32* @EOF
%135 = icmp ne i32 %134, 41
%136 = select i1 %133, i1 %135, i1 false
br i1 %136, label %137, label %145
137: ; preds = %130, %137
%138 = tail call i32 @getc(i32* %0)
%139 = load i32, i32* @EOF
%140 = icmp ne i32 %138, %139
%141 = icmp ne i32 %138, 10
%142 = and i1 %141, %140
br i1 %142, label %137, label %143
143: ; preds = %137
br i1 %141, label %145, label %144
144: ; preds = %143
store i8* getelementptr inbounds ([256 x i8], [256 x i8]* @searchwindex.page, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @searchwindex.section, i64 0, i64 0), i8** %3
br label %145
145: ; preds = %43, %30, %26, %110, %143, %130, %107, %85, %144
%146 = phi i32 [ 1, %144 ], [ 0, %85 ], [ 0, %107 ], [ 0, %130 ], [ 0, %143 ], [ 0, %110 ], [ -1, %26 ], [ -1, %30 ], [ -1, %43 ]
ret i32 %146
}