#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 int uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ target;
typedef int /*<<< orphan*/ path;
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_SET;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int read_compressed_int(int /*<<< orphan*/ *);
int /*<<< orphan*/ skip_array(int /*<<< orphan*/ *);
int /*<<< orphan*/ *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/ *);
scalar_t__ stricmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ trim_leading(char *, int);
int seek_config_path(FILE *f, char *config_path) {
  int i;
  uint8_t type;
  uint32_t num_entries;
  uint32_t fp;
  char path[2048];
  char target[512];
  char buffer[512];
  strncpy(path, config_path, sizeof(path));
  trim_leading(path, sizeof(path));
  for (i = 0; i < sizeof(target) - 1; i++) {
    if (path[i] == 0 || path[i] == '>' || path[i] == ' ')
      break;
  }
  strncpy(target, path, i);
  target[i] = 0;
  while (fgetc(f) != 0)
    ;
  num_entries = read_compressed_int(f);
  for (i = 0; i < num_entries; i++) {
    fp = ftell(f);
    type = fgetc(f);
    if (type == 0) {
      if (fgets(buffer, sizeof(buffer), f) == NULL)
        return 1;
      fseek(f, fp + strlen(buffer) + 2, SEEK_SET);
      fread(&fp, 4, 1, f);
      if (stricmp(buffer, target))
        continue;
      fseek(f, fp, SEEK_SET);
      if (strchr(path, '>') == NULL)
        return 0;
      strcpy(path, strchr(config_path, '>') + 2);
      return seek_config_path(f, path);
    } else if (type == 1) {
      type = fgetc(f);
      if (fgets(buffer, sizeof(buffer), f) == NULL)
        return 1;
      if (stricmp(buffer, target) == 0) {
        fseek(f, fp, SEEK_SET);
        return 0;
      }
      fseek(f, fp + strlen(buffer) + 3, SEEK_SET);
      if (type == 0)
        while (fgetc(f) != 0)
          ;
      else
        fseek(f, 4, SEEK_CUR);
    } else if (type == 2) {
      if (fgets(buffer, sizeof(buffer), f) == NULL)
        return 1;
      if (stricmp(buffer, target) == 0) {
        fseek(f, fp, SEEK_SET);
        return 0;
      }
      fseek(f, fp + strlen(buffer) + 2, SEEK_SET);
      skip_array(f);
    } else {
      while (fgetc(f) != 0)
        ;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<seek_config_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x830(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x800,%edx
call   1030 <strncpy@plt>
lea    -0x830(%rbp),%rdi
mov    $0x800,%esi
call   1050 <trim_leading@plt>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x1ff,%rax
jae    1287 <seek_config_path+0xa7>
movslq -0x1c(%rbp),%rax
movsbl -0x830(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     126f <seek_config_path+0x8f>
movslq -0x1c(%rbp),%rax
movsbl -0x830(%rbp,%rax,1),%eax
ff
cmp    $0x3e,%eax
je     126f <seek_config_path+0x8f>
movslq -0x1c(%rbp),%rax
movsbl -0x830(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
jne    1274 <seek_config_path+0x94>
jmp    1287 <seek_config_path+0xa7>
jmp    1279 <seek_config_path+0x99>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1220 <seek_config_path+0x40>
lea    -0xa30(%rbp),%rdi
lea    -0x830(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
movslq -0x1c(%rbp),%rax
movb   $0x0,-0xa30(%rbp,%rax,1)
mov    -0x10(%rbp),%rdi
call   10a0 <fgetc@plt>
cmp    $0x0,%eax
je     12c0 <seek_config_path+0xe0>
jmp    12a9 <seek_config_path+0xc9>
mov    -0x10(%rbp),%rdi
call   10d0 <read_compressed_int@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    162d <seek_config_path+0x44d>
mov    -0x10(%rbp),%rdi
call   10e0 <ftell@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <fgetc@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1428 <seek_config_path+0x248>
lea    -0xc30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x200,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
jne    132c <seek_config_path+0x14c>
movl   $0x1,-0x4(%rbp)
jmp    1634 <seek_config_path+0x454>
mov    -0x10(%rbp),%rax
mov    %rax,-0xc38(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0xc3c(%rbp)
lea    -0xc30(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0xc3c(%rbp),%esi
mov    -0xc38(%rbp),%rdi
add    %eax,%esi
add    $0x2,%esi
mov    0x2c73(%rip),%rax
mov    (%rax),%edx
call   1100 <fseek@plt>
mov    -0x10(%rbp),%rcx
lea    -0x28(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1060 <fread@plt>
lea    -0xc30(%rbp),%rdi
lea    -0xa30(%rbp),%rsi
call   1070 <stricmp@plt>
cmp    $0x0,%rax
je     13a5 <seek_config_path+0x1c5>
jmp    161f <seek_config_path+0x43f>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    0x2c25(%rip),%rax
mov    (%rax),%edx
call   1100 <fseek@plt>
lea    -0x830(%rbp),%rdi
mov    $0x3e,%esi
call   1090 <strchr@plt>
cmp    $0x0,%rax
jne    13e1 <seek_config_path+0x201>
movl   $0x0,-0x4(%rbp)
jmp    1634 <seek_config_path+0x454>
lea    -0x830(%rbp),%rax
mov    %rax,-0xc48(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x3e,%esi
call   1090 <strchr@plt>
mov    -0xc48(%rbp),%rdi
mov    %rax,%rsi
add    $0x8,%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    -0x830(%rbp),%rsi
call   10f0 <seek_config_path@plt>
mov    %eax,-0x4(%rbp)
jmp    1634 <seek_config_path+0x454>
cmpl   $0x1,-0x20(%rbp)
jne    152e <seek_config_path+0x34e>
mov    -0x10(%rbp),%rdi
call   10a0 <fgetc@plt>
mov    %eax,-0x20(%rbp)
lea    -0xc30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x200,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
jne    1469 <seek_config_path+0x289>
movl   $0x1,-0x4(%rbp)
jmp    1634 <seek_config_path+0x454>
lea    -0xc30(%rbp),%rdi
lea    -0xa30(%rbp),%rsi
call   1070 <stricmp@plt>
cmp    $0x0,%rax
jne    14a7 <seek_config_path+0x2c7>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    0x2b44(%rip),%rax
mov    (%rax),%edx
call   1100 <fseek@plt>
movl   $0x0,-0x4(%rbp)
jmp    1634 <seek_config_path+0x454>
mov    -0x10(%rbp),%rax
mov    %rax,-0xc50(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0xc54(%rbp)
lea    -0xc30(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0xc54(%rbp),%esi
mov    -0xc50(%rbp),%rdi
add    %eax,%esi
add    $0x3,%esi
mov    0x2af8(%rip),%rax
mov    (%rax),%edx
call   1100 <fseek@plt>
cmpl   $0x0,-0x20(%rbp)
jne    1512 <seek_config_path+0x332>
jmp    14f6 <seek_config_path+0x316>
mov    -0x10(%rbp),%rdi
call   10a0 <fgetc@plt>
cmp    $0x0,%eax
je     150d <seek_config_path+0x32d>
jmp    14f6 <seek_config_path+0x316>
jmp    1529 <seek_config_path+0x349>
mov    -0x10(%rbp),%rdi
mov    0x2acb(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%esi
call   1100 <fseek@plt>
jmp    1615 <seek_config_path+0x435>
cmpl   $0x2,-0x20(%rbp)
jne    15ef <seek_config_path+0x40f>
lea    -0xc30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x200,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
jne    1563 <seek_config_path+0x383>
movl   $0x1,-0x4(%rbp)
jmp    1634 <seek_config_path+0x454>
lea    -0xc30(%rbp),%rdi
lea    -0xa30(%rbp),%rsi
call   1070 <stricmp@plt>
cmp    $0x0,%rax
jne    15a1 <seek_config_path+0x3c1>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    0x2a4a(%rip),%rax
mov    (%rax),%edx
call   1100 <fseek@plt>
movl   $0x0,-0x4(%rbp)
jmp    1634 <seek_config_path+0x454>
mov    -0x10(%rbp),%rax
mov    %rax,-0xc60(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0xc64(%rbp)
lea    -0xc30(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0xc64(%rbp),%esi
mov    -0xc60(%rbp),%rdi
add    %eax,%esi
add    $0x2,%esi
mov    0x29fe(%rip),%rax
mov    (%rax),%edx
call   1100 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <skip_array@plt>
jmp    1610 <seek_config_path+0x430>
jmp    15f4 <seek_config_path+0x414>
mov    -0x10(%rbp),%rdi
call   10a0 <fgetc@plt>
cmp    $0x0,%eax
je     160b <seek_config_path+0x42b>
jmp    15f4 <seek_config_path+0x414>
jmp    1610 <seek_config_path+0x430>
jmp    1615 <seek_config_path+0x435>
jmp    161a <seek_config_path+0x43a>
jmp    161f <seek_config_path+0x43f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12d3 <seek_config_path+0xf3>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seek_config_path>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x210(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x800,%edx
call   1030 <strncpy@plt>
mov    %rbp,%rdi
mov    $0x800,%esi
call   1050 <trim_leading@plt>
mov    $0x6,%edx
movabs $0x4000000100000001,%rax
movzbl 0x20a(%rsp,%rdx,1),%ecx
cmp    $0x3e,%rcx
ja     1240 <seek_config_path+0x60>
bt     %rcx,%rax
jb     12d4 <seek_config_path+0xf4>
movzbl 0x20b(%rsp,%rdx,1),%ecx
cmp    $0x3e,%rcx
ja     1258 <seek_config_path+0x78>
bt     %rcx,%rax
jb     12da <seek_config_path+0xfa>
movzbl 0x20c(%rsp,%rdx,1),%ecx
cmp    $0x3e,%rcx
ja     126c <seek_config_path+0x8c>
bt     %rcx,%rax
jb     12e0 <seek_config_path+0x100>
movzbl 0x20d(%rsp,%rdx,1),%ecx
cmp    $0x3e,%rcx
ja     1280 <seek_config_path+0xa0>
bt     %rcx,%rax
jb     12e6 <seek_config_path+0x106>
movzbl 0x20e(%rsp,%rdx,1),%ecx
cmp    $0x3e,%rcx
ja     1294 <seek_config_path+0xb4>
bt     %rcx,%rax
jb     12ec <seek_config_path+0x10c>
movzbl 0x20f(%rsp,%rdx,1),%ecx
cmp    $0x3e,%rcx
ja     12a8 <seek_config_path+0xc8>
bt     %rcx,%rax
jb     12f2 <seek_config_path+0x112>
movzbl 0x210(%rsp,%rdx,1),%ecx
cmp    $0x3e,%rcx
ja     12bc <seek_config_path+0xdc>
bt     %rcx,%rax
jb     12f6 <seek_config_path+0x116>
add    $0x7,%rdx
cmp    $0x205,%rdx
jne    1228 <seek_config_path+0x48>
mov    $0x1ff,%edx
jmp    12f6 <seek_config_path+0x116>
add    $0xfffffffffffffffa,%rdx
jmp    12f6 <seek_config_path+0x116>
add    $0xfffffffffffffffb,%rdx
jmp    12f6 <seek_config_path+0x116>
add    $0xfffffffffffffffc,%rdx
jmp    12f6 <seek_config_path+0x116>
add    $0xfffffffffffffffd,%rdx
jmp    12f6 <seek_config_path+0x116>
add    $0xfffffffffffffffe,%rdx
jmp    12f6 <seek_config_path+0x116>
add    $0xffffffffffffffff,%rdx
mov    %edx,%ebp
lea    0x10(%rsp),%rdi
lea    0x210(%rsp),%rsi
call   1030 <strncpy@plt>
movb   $0x0,0x10(%rsp,%rbp,1)
nop
mov    %rbx,%rdi
call   10a0 <fgetc@plt>
test   %eax,%eax
jne    1310 <seek_config_path+0x130>
mov    %rbx,%rdi
call   10d0 <read_compressed_int@plt>
mov    %eax,%ebp
mov    $0xffffffff,%eax
test   %ebp,%ebp
jle    1581 <seek_config_path+0x3a1>
mov    %r14,0x8(%rsp)
xor    %r14d,%r14d
lea    0xa10(%rsp),%r12
jmp    136d <seek_config_path+0x18d>
mov    0x2c9c(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1100 <fseek@plt>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14d
cmp    %ebp,%r14d
je     1501 <seek_config_path+0x321>
mov    %rbx,%rdi
call   10e0 <ftell@plt>
mov    %eax,%r13d
mov    %eax,0x4(%rsp)
mov    %rbx,%rdi
call   10a0 <fgetc@plt>
test   %eax,%eax
je     1420 <seek_config_path+0x240>
cmp    $0x1,%eax
je     1490 <seek_config_path+0x2b0>
cmp    $0x2,%eax
jne    1400 <seek_config_path+0x220>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %rbx,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     1508 <seek_config_path+0x328>
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
call   1070 <stricmp@plt>
test   %rax,%rax
je     150f <seek_config_path+0x32f>
mov    %r12,%rdi
call   1080 <strlen@plt>
lea    (%rax,%r13,1),%esi
add    $0x2,%esi
mov    0x2bf9(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
mov    %rbx,%rdi
call   10c0 <skip_array@plt>
jmp    1360 <seek_config_path+0x180>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10a0 <fgetc@plt>
test   %eax,%eax
jne    1400 <seek_config_path+0x220>
jmp    1360 <seek_config_path+0x180>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    $0x200,%esi
mov    %rbx,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     1508 <seek_config_path+0x328>
mov    %r12,%rdi
call   1080 <strlen@plt>
lea    (%rax,%r13,1),%esi
add    $0x2,%esi
mov    0x2b89(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fread@plt>
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
call   1070 <stricmp@plt>
test   %rax,%rax
jne    1360 <seek_config_path+0x180>
jmp    1527 <seek_config_path+0x347>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10a0 <fgetc@plt>
mov    %eax,%r15d
mov    %r12,%rdi
mov    $0x200,%esi
mov    %rbx,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     1508 <seek_config_path+0x328>
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
call   1070 <stricmp@plt>
test   %rax,%rax
je     150f <seek_config_path+0x32f>
mov    %r12,%rdi
call   1080 <strlen@plt>
lea    (%rax,%r13,1),%esi
add    $0x3,%esi
mov    0x2b00(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
test   %r15d,%r15d
jne    1345 <seek_config_path+0x165>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10a0 <fgetc@plt>
test   %eax,%eax
jne    14f0 <seek_config_path+0x310>
jmp    1360 <seek_config_path+0x180>
mov    $0xffffffff,%eax
jmp    1581 <seek_config_path+0x3a1>
mov    $0x1,%eax
jmp    1581 <seek_config_path+0x3a1>
mov    0x2ac2(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r13d,%esi
call   1100 <fseek@plt>
xor    %eax,%eax
jmp    1581 <seek_config_path+0x3a1>
mov    0x4(%rsp),%esi
mov    0x2aa6(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
lea    0x210(%rsp),%rdi
mov    $0x3e,%esi
call   1090 <strchr@plt>
test   %rax,%rax
je     1523 <seek_config_path+0x343>
mov    0x8(%rsp),%rdi
mov    $0x3e,%esi
call   1090 <strchr@plt>
lea    0x8(%rax),%rsi
lea    0x210(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10f0 <seek_config_path@plt>
add    $0xc18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
@SEEK_CUR = global i32 0
define i32 @seek_config_path(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [2048 x i8]
%11 = alloca [512 x i8]
%12 = alloca [512 x i8]
store i32* %0, i32** %4
store i8* %1, i8** %5
%13 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%14 = load i8*, i8** %5
%15 = call i32 @strncpy(i8* %13, i8* %14, i32 2048)
%16 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%17 = call i32 @trim_leading(i8* %16, i32 2048)
store i32 0, i32* %6
br label %18
18: ; preds = %45, %2
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = icmp ult i64 %20, 511
br i1 %21, label %22, label %48
22: ; preds = %18
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 0
br i1 %28, label %43, label %29
29: ; preds = %22
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 62
br i1 %35, label %43, label %36
36: ; preds = %29
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 32
br i1 %42, label %43, label %44
43: ; preds = %36, %29, %22
br label %48
44: ; preds = %36
br label %45
45: ; preds = %44
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %18
48: ; preds = %43, %18
%49 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%50 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%51 = load i32, i32* %6
%52 = call i32 @strncpy(i8* %49, i8* %50, i32 %51)
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 %54
store i8 0, i8* %55
br label %56
56: ; preds = %60, %48
%57 = load i32*, i32** %4
%58 = call i32 @fgetc(i32* %57)
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %56
br label %56
61: ; preds = %56
%62 = load i32*, i32** %4
%63 = call i32 @read_compressed_int(i32* %62)
store i32 %63, i32* %8
store i32 0, i32* %6
br label %64
64: ; preds = %199, %61
%65 = load i32, i32* %6
%66 = load i32, i32* %8
%67 = icmp slt i32 %65, %66
br i1 %67, label %68, label %202
68: ; preds = %64
%69 = load i32*, i32** %4
%70 = call i32 @ftell(i32* %69)
store i32 %70, i32* %9
%71 = load i32*, i32** %4
%72 = call i32 @fgetc(i32* %71)
store i32 %72, i32* %7
%73 = load i32, i32* %7
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %115
75: ; preds = %68
%76 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%77 = load i32*, i32** %4
%78 = call i32* @fgets(i8* %76, i32 512, i32* %77)
%79 = icmp eq i32* %78, null
br i1 %79, label %80, label %81
80: ; preds = %75
store i32 1, i32* %3
br label %203
81: ; preds = %75
%82 = load i32*, i32** %4
%83 = load i32, i32* %9
%84 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%85 = call i32 @strlen(i8* %84)
%86 = add nsw i32 %83, %85
%87 = add nsw i32 %86, 2
%88 = load i32, i32* @SEEK_SET
%89 = call i32 @fseek(i32* %82, i32 %87, i32 %88)
%90 = load i32*, i32** %4
%91 = call i32 @fread(i32* %9, i32 4, i32 1, i32* %90)
%92 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%93 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%94 = call i64 @stricmp(i8* %92, i8* %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %81
br label %199
97: ; preds = %81
%98 = load i32*, i32** %4
%99 = load i32, i32* %9
%100 = load i32, i32* @SEEK_SET
%101 = call i32 @fseek(i32* %98, i32 %99, i32 %100)
%102 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%103 = call i32* @strchr(i8* %102, i8 signext 62)
%104 = icmp eq i32* %103, null
br i1 %104, label %105, label %106
105: ; preds = %97
store i32 0, i32* %3
br label %203
106: ; preds = %97
%107 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%108 = load i8*, i8** %5
%109 = call i32* @strchr(i8* %108, i8 signext 62)
%110 = getelementptr inbounds i32, i32* %109, i64 2
%111 = call i32 @strcpy(i8* %107, i32* %110)
%112 = load i32*, i32** %4
%113 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%114 = call i32 @seek_config_path(i32* %112, i8* %113)
store i32 %114, i32* %3
br label %203
115: ; preds = %68
%116 = load i32, i32* %7
%117 = icmp eq i32 %116, 1
br i1 %117, label %118, label %159
118: ; preds = %115
%119 = load i32*, i32** %4
%120 = call i32 @fgetc(i32* %119)
store i32 %120, i32* %7
%121 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%122 = load i32*, i32** %4
%123 = call i32* @fgets(i8* %121, i32 512, i32* %122)
%124 = icmp eq i32* %123, null
br i1 %124, label %125, label %126
125: ; preds = %118
store i32 1, i32* %3
br label %203
126: ; preds = %118
%127 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%128 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%129 = call i64 @stricmp(i8* %127, i8* %128)
%130 = icmp eq i64 %129, 0
br i1 %130, label %131, label %136
131: ; preds = %126
%132 = load i32*, i32** %4
%133 = load i32, i32* %9
%134 = load i32, i32* @SEEK_SET
%135 = call i32 @fseek(i32* %132, i32 %133, i32 %134)
store i32 0, i32* %3
br label %203
136: ; preds = %126
%137 = load i32*, i32** %4
%138 = load i32, i32* %9
%139 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%140 = call i32 @strlen(i8* %139)
%141 = add nsw i32 %138, %140
%142 = add nsw i32 %141, 3
%143 = load i32, i32* @SEEK_SET
%144 = call i32 @fseek(i32* %137, i32 %142, i32 %143)
%145 = load i32, i32* %7
%146 = icmp eq i32 %145, 0
br i1 %146, label %147, label %154
147: ; preds = %136
br label %148
148: ; preds = %152, %147
%149 = load i32*, i32** %4
%150 = call i32 @fgetc(i32* %149)
%151 = icmp ne i32 %150, 0
br i1 %151, label %152, label %153
152: ; preds = %148
br label %148
153: ; preds = %148
br label %158
154: ; preds = %136
%155 = load i32*, i32** %4
%156 = load i32, i32* @SEEK_CUR
%157 = call i32 @fseek(i32* %155, i32 4, i32 %156)
br label %158
158: ; preds = %154, %153
br label %197
159: ; preds = %115
%160 = load i32, i32* %7
%161 = icmp eq i32 %160, 2
br i1 %161, label %162, label %189
162: ; preds = %159
%163 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%164 = load i32*, i32** %4
%165 = call i32* @fgets(i8* %163, i32 512, i32* %164)
%166 = icmp eq i32* %165, null
br i1 %166, label %167, label %168
167: ; preds = %162
store i32 1, i32* %3
br label %203
168: ; preds = %162
%169 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%170 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%171 = call i64 @stricmp(i8* %169, i8* %170)
%172 = icmp eq i64 %171, 0
br i1 %172, label %173, label %178
173: ; preds = %168
%174 = load i32*, i32** %4
%175 = load i32, i32* %9
%176 = load i32, i32* @SEEK_SET
%177 = call i32 @fseek(i32* %174, i32 %175, i32 %176)
store i32 0, i32* %3
br label %203
178: ; preds = %168
%179 = load i32*, i32** %4
%180 = load i32, i32* %9
%181 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%182 = call i32 @strlen(i8* %181)
%183 = add nsw i32 %180, %182
%184 = add nsw i32 %183, 2
%185 = load i32, i32* @SEEK_SET
%186 = call i32 @fseek(i32* %179, i32 %184, i32 %185)
%187 = load i32*, i32** %4
%188 = call i32 @skip_array(i32* %187)
br label %196
189: ; preds = %159
br label %190
190: ; preds = %194, %189
%191 = load i32*, i32** %4
%192 = call i32 @fgetc(i32* %191)
%193 = icmp ne i32 %192, 0
br i1 %193, label %194, label %195
194: ; preds = %190
br label %190
195: ; preds = %190
br label %196
196: ; preds = %195, %178
br label %197
197: ; preds = %196, %158
br label %198
198: ; preds = %197
br label %199
199: ; preds = %198, %96
%200 = load i32, i32* %6
%201 = add nsw i32 %200, 1
store i32 %201, i32* %6
br label %64
202: ; preds = %64
store i32 -1, i32* %3
br label %203
203: ; preds = %202, %173, %167, %131, %125, %106, %105, %80
%204 = load i32, i32* %3
ret i32 %204
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@SEEK_CUR = global i32 0
define i32 @seek_config_path(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca [2048 x i8]
%5 = alloca [512 x i8]
%6 = alloca [512 x i8]
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%11 = call i32 @strncpy(i8* %8, i8* %1, i32 2048)
%12 = call i32 @trim_leading(i8* %8, i32 2048)
br label %13
13: ; preds = %41, %2
%14 = phi i64 [ 0, %2 ], [ %42, %41 ]
%15 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %14
%16 = load i8, i8* %15
switch i8 %16, label %17 [
i8 0, label %44
i8 62, label %44
i8 32, label %44
]
17: ; preds = %13
%18 = add nuw nsw i64 %14, 1
%19 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %18
%20 = load i8, i8* %19
switch i8 %20, label %21 [
i8 0, label %44
i8 62, label %44
i8 32, label %44
]
21: ; preds = %17
%22 = add nuw nsw i64 %14, 2
%23 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %22
%24 = load i8, i8* %23
switch i8 %24, label %25 [
i8 0, label %44
i8 62, label %44
i8 32, label %44
]
25: ; preds = %21
%26 = add nuw nsw i64 %14, 3
%27 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %26
%28 = load i8, i8* %27
switch i8 %28, label %29 [
i8 0, label %44
i8 62, label %44
i8 32, label %44
]
29: ; preds = %25
%30 = add nuw nsw i64 %14, 4
%31 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %30
%32 = load i8, i8* %31
switch i8 %32, label %33 [
i8 0, label %44
i8 62, label %44
i8 32, label %44
]
33: ; preds = %29
%34 = add nuw nsw i64 %14, 5
%35 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %34
%36 = load i8, i8* %35
switch i8 %36, label %37 [
i8 0, label %44
i8 62, label %44
i8 32, label %44
]
37: ; preds = %33
%38 = add nuw nsw i64 %14, 6
%39 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %38
%40 = load i8, i8* %39
switch i8 %40, label %41 [
i8 0, label %44
i8 62, label %44
i8 32, label %44
]
41: ; preds = %37
%42 = add nuw nsw i64 %14, 7
%43 = icmp eq i64 %42, 511
br i1 %43, label %47, label %13
44: ; preds = %37, %37, %37, %33, %33, %33, %29, %29, %29, %25, %25, %25, %21, %21, %21, %17, %17, %17, %13, %13, %13
%45 = phi i64 [ %14, %13 ], [ %14, %13 ], [ %14, %13 ], [ %18, %17 ], [ %18, %17 ], [ %18, %17 ], [ %22, %21 ], [ %22, %21 ], [ %22, %21 ], [ %26, %25 ], [ %26, %25 ], [ %26, %25 ], [ %30, %29 ], [ %30, %29 ], [ %30, %29 ], [ %34, %33 ], [ %34, %33 ], [ %34, %33 ], [ %38, %37 ], [ %38, %37 ], [ %38, %37 ]
%46 = trunc i64 %45 to i32
br label %47
47: ; preds = %41, %44
%48 = phi i32 [ %46, %44 ], [ 511, %41 ]
%49 = zext i32 %48 to i64
%50 = call i32 @strncpy(i8* %9, i8* %8, i32 %48)
%51 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %49
store i8 0, i8* %51
br label %52
52: ; preds = %52, %47
%53 = call i32 @fgetc(i32* %0)
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %52
55: ; preds = %52
%56 = call i32 @read_compressed_int(i32* %0)
%57 = icmp sgt i32 %56, 0
br i1 %57, label %58, label %130
58: ; preds = %55, %127
%59 = phi i32 [ %128, %127 ], [ 0, %55 ]
%60 = call i32 @ftell(i32* %0)
store i32 %60, i32* %3
%61 = call i32 @fgetc(i32* %0)
switch i32 %61, label %124 [
i32 0, label %62
i32 1, label %85
i32 2, label %108
]
62: ; preds = %58
%63 = call i32* @fgets(i8* %10, i32 512, i32* %0)
%64 = icmp eq i32* %63, null
br i1 %64, label %130, label %65
65: ; preds = %62
%66 = call i32 @strlen(i8* %10)
%67 = add i32 %60, 2
%68 = add i32 %67, %66
%69 = load i32, i32* @SEEK_SET
%70 = call i32 @fseek(i32* %0, i32 %68, i32 %69)
%71 = call i32 @fread(i32* %3, i32 4, i32 1, i32* %0)
%72 = call i64 @stricmp(i8* %10, i8* %9)
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %127
74: ; preds = %65
%75 = load i32, i32* %3
%76 = load i32, i32* @SEEK_SET
%77 = call i32 @fseek(i32* %0, i32 %75, i32 %76)
%78 = call i32* @strchr(i8* %8, i8 signext 62)
%79 = icmp eq i32* %78, null
br i1 %79, label %130, label %80
80: ; preds = %74
%81 = call i32* @strchr(i8* %1, i8 signext 62)
%82 = getelementptr inbounds i32, i32* %81, i64 2
%83 = call i32 @strcpy(i8* %8, i32* %82)
%84 = call i32 @seek_config_path(i32* %0, i8* %8)
br label %130
85: ; preds = %58
%86 = call i32 @fgetc(i32* %0)
%87 = call i32* @fgets(i8* %10, i32 512, i32* %0)
%88 = icmp eq i32* %87, null
br i1 %88, label %130, label %89
89: ; preds = %85
%90 = call i64 @stricmp(i8* %10, i8* %9)
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %95
92: ; preds = %89
%93 = load i32, i32* @SEEK_SET
%94 = call i32 @fseek(i32* %0, i32 %60, i32 %93)
br label %130
95: ; preds = %89
%96 = call i32 @strlen(i8* %10)
%97 = add i32 %60, 3
%98 = add i32 %97, %96
%99 = load i32, i32* @SEEK_SET
%100 = call i32 @fseek(i32* %0, i32 %98, i32 %99)
%101 = icmp eq i32 %86, 0
br i1 %101, label %102, label %105
102: ; preds = %95, %102
%103 = call i32 @fgetc(i32* %0)
%104 = icmp eq i32 %103, 0
br i1 %104, label %127, label %102
105: ; preds = %95
%106 = load i32, i32* @SEEK_CUR
%107 = call i32 @fseek(i32* %0, i32 4, i32 %106)
br label %127
108: ; preds = %58
%109 = call i32* @fgets(i8* %10, i32 512, i32* %0)
%110 = icmp eq i32* %109, null
br i1 %110, label %130, label %111
111: ; preds = %108
%112 = call i64 @stricmp(i8* %10, i8* %9)
%113 = icmp eq i64 %112, 0
br i1 %113, label %114, label %117
114: ; preds = %111
%115 = load i32, i32* @SEEK_SET
%116 = call i32 @fseek(i32* %0, i32 %60, i32 %115)
br label %130
117: ; preds = %111
%118 = call i32 @strlen(i8* %10)
%119 = add i32 %60, 2
%120 = add i32 %119, %118
%121 = load i32, i32* @SEEK_SET
%122 = call i32 @fseek(i32* %0, i32 %120, i32 %121)
%123 = call i32 @skip_array(i32* %0)
br label %127
124: ; preds = %58, %124
%125 = call i32 @fgetc(i32* %0)
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %124
127: ; preds = %102, %124, %117, %105, %65
%128 = add nuw nsw i32 %59, 1
%129 = icmp eq i32 %128, %56
br i1 %129, label %130, label %58
130: ; preds = %62, %85, %108, %127, %55, %74, %114, %92, %80
%131 = phi i32 [ %84, %80 ], [ 0, %92 ], [ 0, %114 ], [ 0, %74 ], [ -1, %55 ], [ 1, %62 ], [ 1, %85 ], [ 1, %108 ], [ -1, %127 ]
ret i32 %131
}