#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 /*<<< orphan*/ rbuf;

/* Variables and functions */
scalar_t__ cdb_bread(int, unsigned char *, unsigned int);
unsigned int cdb_hash(void const *, unsigned int);
unsigned int cdb_unpack(unsigned char *);
scalar_t__ lseek(int, unsigned int, int /*<<< orphan*/);
scalar_t__ memcmp(unsigned char *, char const *, unsigned int);
int cdb_seek(int fd, const void *key, unsigned klen, unsigned *dlenp) {
  unsigned htstart;
  unsigned htsize;
  unsigned httodo;
  unsigned hti;
  unsigned pos;
  unsigned hval;
  unsigned char rbuf[64];
  int needseek = 1;
  hval = cdb_hash(key, klen);
  pos = (hval & 0xff) << 3;
  if (lseek(fd, pos, 0) < 0 || cdb_bread(fd, rbuf, 8) < 0)
    return -1;
  if ((htsize = cdb_unpack(rbuf + 4)) == 0)
    return 0;
  hti = (hval >> 8) % htsize;
  httodo = htsize;
  htstart = cdb_unpack(rbuf);
  for (;;) {
    if (needseek && lseek(fd, htstart + (hti << 3), 0) < 0)
      return -1;
    if (cdb_bread(fd, rbuf, 8) < 0)
      return -1;
    if ((pos = cdb_unpack(rbuf + 4)) == 0)
      return 0;
    if (cdb_unpack(rbuf) != hval)
      needseek = 0;
    else {
      if (lseek(fd, pos, 0) < 0 || cdb_bread(fd, rbuf, 8) < 0)
        return -1;
      if (cdb_unpack(rbuf) == klen) {
        unsigned l = klen, c;
        const char *k = (const char *)key;
        if (dlenp)
          *dlenp = cdb_unpack(rbuf + 4);
        for (;;) {
          if (!l)
            return 1;
          c = l > sizeof(rbuf) ? sizeof(rbuf) : l;
          if (cdb_bread(fd, rbuf, c) < 0)
            return -1;
          if (memcmp(rbuf, k, c) != 0)
            break;
          k += c;
          l -= c;
        }
      }
      needseek = 1;
    }
    if (!--httodo)
      return 0;
    if (++hti == htsize) {
      hti = 0;
      needseek = 1;
    }
  }
}


x86 assembly (clang, -O0):
<cdb_seek>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x1,-0x84(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <cdb_hash@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
and    $0xff,%eax
shl    $0x3,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x34(%rbp),%esi
xor    %edx,%edx
call   1030 <lseek@plt>
cmp    $0x0,%rax
jl     11c2 <cdb_seek+0x72>
mov    -0x8(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x8,%edx
call   1070 <cdb_bread@plt>
cmp    $0x0,%rax
jge    11ce <cdb_seek+0x7e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1469 <cdb_seek+0x319>
lea    -0x80(%rbp),%rdi
add    $0x4,%rdi
call   1050 <cdb_unpack@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jne    11f3 <cdb_seek+0xa3>
movl   $0x0,-0x4(%rbp)
jmp    1469 <cdb_seek+0x319>
mov    -0x38(%rbp),%eax
shr    $0x8,%eax
xor    %edx,%edx
divl   -0x28(%rbp)
mov    %edx,-0x30(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x80(%rbp),%rdi
call   1050 <cdb_unpack@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x84(%rbp)
je     124b <cdb_seek+0xfb>
mov    -0x8(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%eax
shl    $0x3,%eax
add    %eax,%esi
xor    %edx,%edx
call   1030 <lseek@plt>
cmp    $0x0,%rax
jge    124b <cdb_seek+0xfb>
movl   $0xffffffff,-0x4(%rbp)
jmp    1469 <cdb_seek+0x319>
mov    -0x8(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x8,%edx
call   1070 <cdb_bread@plt>
cmp    $0x0,%rax
jge    1272 <cdb_seek+0x122>
movl   $0xffffffff,-0x4(%rbp)
jmp    1469 <cdb_seek+0x319>
lea    -0x80(%rbp),%rdi
add    $0x4,%rdi
call   1050 <cdb_unpack@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jne    1297 <cdb_seek+0x147>
movl   $0x0,-0x4(%rbp)
jmp    1469 <cdb_seek+0x319>
lea    -0x80(%rbp),%rdi
call   1050 <cdb_unpack@plt>
cmp    -0x38(%rbp),%eax
je     12b8 <cdb_seek+0x168>
movl   $0x0,-0x84(%rbp)
jmp    1423 <cdb_seek+0x2d3>
mov    -0x8(%rbp),%edi
mov    -0x34(%rbp),%esi
xor    %edx,%edx
call   1030 <lseek@plt>
cmp    $0x0,%rax
jl     12ea <cdb_seek+0x19a>
mov    -0x8(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x8,%edx
call   1070 <cdb_bread@plt>
cmp    $0x0,%rax
jge    12f6 <cdb_seek+0x1a6>
movl   $0xffffffff,-0x4(%rbp)
jmp    1469 <cdb_seek+0x319>
lea    -0x80(%rbp),%rdi
call   1050 <cdb_unpack@plt>
cmp    -0x14(%rbp),%eax
jne    1419 <cdb_seek+0x2c9>
mov    -0x14(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     133c <cdb_seek+0x1ec>
lea    -0x80(%rbp),%rdi
add    $0x4,%rdi
call   1050 <cdb_unpack@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1341 <cdb_seek+0x1f1>
cmpl   $0x0,-0x88(%rbp)
jne    135a <cdb_seek+0x20a>
movl   $0x1,-0x4(%rbp)
jmp    1469 <cdb_seek+0x319>
mov    -0x88(%rbp),%eax
cmp    $0x40,%rax
jbe    137b <cdb_seek+0x22b>
mov    $0x40,%eax
mov    %rax,-0xa0(%rbp)
jmp    1388 <cdb_seek+0x238>
mov    -0x88(%rbp),%eax
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rax
mov    %eax,-0x8c(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    -0x8c(%rbp),%edx
call   1070 <cdb_bread@plt>
cmp    $0x0,%rax
jge    13bd <cdb_seek+0x26d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1469 <cdb_seek+0x319>
lea    -0x80(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    -0x8c(%rbp),%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
je     13e2 <cdb_seek+0x292>
jmp    1414 <cdb_seek+0x2c4>
mov    -0x8c(%rbp),%ecx
mov    -0x98(%rbp),%rax
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x98(%rbp)
mov    -0x8c(%rbp),%ecx
mov    -0x88(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x88(%rbp)
jmp    1341 <cdb_seek+0x1f1>
jmp    1419 <cdb_seek+0x2c9>
movl   $0x1,-0x84(%rbp)
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
jne    1441 <cdb_seek+0x2f1>
movl   $0x0,-0x4(%rbp)
jmp    1469 <cdb_seek+0x319>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmp    -0x28(%rbp),%eax
jne    1464 <cdb_seek+0x314>
movl   $0x0,-0x30(%rbp)
movl   $0x1,-0x84(%rbp)
jmp    1213 <cdb_seek+0xc3>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdb_seek>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rcx,%r12
mov    %edx,%r13d
mov    %rsi,%rbp
mov    %edi,%r14d
mov    %rsi,%rdi
mov    %edx,%esi
call   1060 <cdb_hash@plt>
mov    %eax,%ebx
movzbl %bl,%esi
shl    $0x3,%esi
mov    %r14d,%edi
xor    %edx,%edx
call   1030 <lseek@plt>
test   %rax,%rax
js     1377 <cdb_seek+0x227>
lea    0x30(%rsp),%rsi
mov    %r14d,%edi
mov    $0x8,%edx
call   1070 <cdb_bread@plt>
test   %rax,%rax
js     1377 <cdb_seek+0x227>
lea    0x34(%rsp),%rdi
call   1050 <cdb_unpack@plt>
test   %eax,%eax
je     138d <cdb_seek+0x23d>
mov    %eax,%r15d
mov    %rbp,0x18(%rsp)
mov    %ebx,0xc(%rsp)
shr    $0x8,%ebx
mov    %ebx,%eax
xor    %edx,%edx
div    %r15d
mov    %edx,%ebp
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <cdb_unpack@plt>
mov    %rax,0x20(%rsp)
mov    %r15d,0x8(%rsp)
mov    %r15d,(%rsp)
mov    $0x1,%ecx
test   %ecx,%ecx
je     1213 <cdb_seek+0xc3>
mov    0x20(%rsp),%rax
lea    (%rax,%rbp,8),%esi
mov    %r14d,%edi
xor    %edx,%edx
call   1030 <lseek@plt>
test   %rax,%rax
js     1377 <cdb_seek+0x227>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1070 <cdb_bread@plt>
test   %rax,%rax
js     1377 <cdb_seek+0x227>
mov    %rbp,0x28(%rsp)
mov    %rbx,%r15
lea    0x34(%rsp),%rdi
call   1050 <cdb_unpack@plt>
test   %eax,%eax
je     138d <cdb_seek+0x23d>
mov    %eax,%ebp
mov    %r15,%rdi
call   1050 <cdb_unpack@plt>
xor    %edx,%edx
mov    $0x0,%ecx
cmp    0xc(%rsp),%eax
jne    1340 <cdb_seek+0x1f0>
mov    %r14d,%edi
mov    %ebp,%esi
xor    %edx,%edx
call   1030 <lseek@plt>
test   %rax,%rax
js     1377 <cdb_seek+0x227>
mov    %r14d,%edi
mov    %r15,%rbx
mov    %r15,%rsi
mov    $0x8,%edx
call   1070 <cdb_bread@plt>
test   %rax,%rax
js     1377 <cdb_seek+0x227>
mov    %rbx,%rdi
call   1050 <cdb_unpack@plt>
mov    $0x1,%ecx
cmp    %r13d,%eax
mov    $0x0,%edx
jne    1340 <cdb_seek+0x1f0>
test   %r12,%r12
je     12c0 <cdb_seek+0x170>
lea    0x34(%rsp),%rdi
call   1050 <cdb_unpack@plt>
mov    %eax,(%r12)
test   %r13d,%r13d
je     1391 <cdb_seek+0x241>
mov    %r12,0x10(%rsp)
mov    0x18(%rsp),%r12
mov    %r13d,0x4(%rsp)
nopl   0x0(%rax,%rax,1)
cmp    $0x40,%r13d
mov    $0x40,%ebp
cmovb  %r13d,%ebp
mov    %r14d,%edi
mov    %r15,%rbx
mov    %r15,%rsi
mov    %ebp,%edx
call   1070 <cdb_bread@plt>
test   %rax,%rax
js     1377 <cdb_seek+0x227>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1040 <memcmp@plt>
test   %rax,%rax
jne    1320 <cdb_seek+0x1d0>
mov    %ebp,%eax
add    %rax,%r12
sub    %ebp,%r13d
jne    12e0 <cdb_seek+0x190>
jmp    1391 <cdb_seek+0x241>
mov    $0x1,%ecx
mov    0x10(%rsp),%r12
mov    0x4(%rsp),%r13d
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%eax
add    $0xffffffff,%eax
je     137c <cdb_seek+0x22c>
mov    %eax,(%rsp)
mov    0x28(%rsp),%rbp
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
mov    $0x0,%eax
cmove  %eax,%ebp
mov    $0x1,%eax
cmove  %eax,%ecx
mov    %r15,%rbx
test   %ecx,%ecx
jne    11f8 <cdb_seek+0xa8>
jmp    1213 <cdb_seek+0xc3>
mov    $0xffffffff,%edx
mov    %edx,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
jmp    137c <cdb_seek+0x22c>
mov    $0x1,%edx
jmp    137c <cdb_seek+0x22c>

LLVM IR (-O0):
define i32 @cdb_seek(i32 %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [64 x i8]
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i8*
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i32 1, i32* %17
%21 = load i8*, i8** %7
%22 = load i32, i32* %8
%23 = call i32 @cdb_hash(i8* %21, i32 %22)
store i32 %23, i32* %15
%24 = load i32, i32* %15
%25 = and i32 %24, 255
%26 = shl i32 %25, 3
store i32 %26, i32* %14
%27 = load i32, i32* %6
%28 = load i32, i32* %14
%29 = call i64 @lseek(i32 %27, i32 %28, i32 0)
%30 = icmp slt i64 %29, 0
br i1 %30, label %36, label %31
31: ; preds = %4
%32 = load i32, i32* %6
%33 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%34 = call i64 @cdb_bread(i32 %32, i8* %33, i32 8)
%35 = icmp slt i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %31, %4
store i32 -1, i32* %5
br label %158
37: ; preds = %31
%38 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%39 = getelementptr inbounds i8, i8* %38, i64 4
%40 = call i32 @cdb_unpack(i8* %39)
store i32 %40, i32* %11
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %37
store i32 0, i32* %5
br label %158
43: ; preds = %37
%44 = load i32, i32* %15
%45 = lshr i32 %44, 8
%46 = load i32, i32* %11
%47 = urem i32 %45, %46
store i32 %47, i32* %13
%48 = load i32, i32* %11
store i32 %48, i32* %12
%49 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%50 = call i32 @cdb_unpack(i8* %49)
store i32 %50, i32* %10
br label %51
51: ; preds = %157, %43
%52 = load i32, i32* %17
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %63
54: ; preds = %51
%55 = load i32, i32* %6
%56 = load i32, i32* %10
%57 = load i32, i32* %13
%58 = shl i32 %57, 3
%59 = add i32 %56, %58
%60 = call i64 @lseek(i32 %55, i32 %59, i32 0)
%61 = icmp slt i64 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %54
store i32 -1, i32* %5
br label %158
63: ; preds = %54, %51
%64 = load i32, i32* %6
%65 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%66 = call i64 @cdb_bread(i32 %64, i8* %65, i32 8)
%67 = icmp slt i64 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %63
store i32 -1, i32* %5
br label %158
69: ; preds = %63
%70 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%71 = getelementptr inbounds i8, i8* %70, i64 4
%72 = call i32 @cdb_unpack(i8* %71)
store i32 %72, i32* %14
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %69
store i32 0, i32* %5
br label %158
75: ; preds = %69
%76 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%77 = call i32 @cdb_unpack(i8* %76)
%78 = load i32, i32* %15
%79 = icmp ne i32 %77, %78
br i1 %79, label %80, label %81
80: ; preds = %75
store i32 0, i32* %17
br label %146
81: ; preds = %75
%82 = load i32, i32* %6
%83 = load i32, i32* %14
%84 = call i64 @lseek(i32 %82, i32 %83, i32 0)
%85 = icmp slt i64 %84, 0
br i1 %85, label %91, label %86
86: ; preds = %81
%87 = load i32, i32* %6
%88 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%89 = call i64 @cdb_bread(i32 %87, i8* %88, i32 8)
%90 = icmp slt i64 %89, 0
br i1 %90, label %91, label %92
91: ; preds = %86, %81
store i32 -1, i32* %5
br label %158
92: ; preds = %86
%93 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%94 = call i32 @cdb_unpack(i8* %93)
%95 = load i32, i32* %8
%96 = icmp eq i32 %94, %95
br i1 %96, label %97, label %145
97: ; preds = %92
%98 = load i32, i32* %8
store i32 %98, i32* %18
%99 = load i8*, i8** %7
store i8* %99, i8** %20
%100 = load i32*, i32** %9
%101 = icmp ne i32* %100, null
br i1 %101, label %102, label %107
102: ; preds = %97
%103 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%104 = getelementptr inbounds i8, i8* %103, i64 4
%105 = call i32 @cdb_unpack(i8* %104)
%106 = load i32*, i32** %9
store i32 %105, i32* %106
br label %107
107: ; preds = %102, %97
br label %108
108: ; preds = %136, %107
%109 = load i32, i32* %18
%110 = icmp ne i32 %109, 0
br i1 %110, label %112, label %111
111: ; preds = %108
store i32 1, i32* %5
br label %158
112: ; preds = %108
%113 = load i32, i32* %18
%114 = zext i32 %113 to i64
%115 = icmp ugt i64 %114, 64
br i1 %115, label %116, label %117
116: ; preds = %112
br label %120
117: ; preds = %112
%118 = load i32, i32* %18
%119 = zext i32 %118 to i64
br label %120
120: ; preds = %117, %116
%121 = phi i64 [ 64, %116 ], [ %119, %117 ]
%122 = trunc i64 %121 to i32
store i32 %122, i32* %19
%123 = load i32, i32* %6
%124 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%125 = load i32, i32* %19
%126 = call i64 @cdb_bread(i32 %123, i8* %124, i32 %125)
%127 = icmp slt i64 %126, 0
br i1 %127, label %128, label %129
128: ; preds = %120
store i32 -1, i32* %5
br label %158
129: ; preds = %120
%130 = getelementptr inbounds [64 x i8], [64 x i8]* %16, i64 0, i64 0
%131 = load i8*, i8** %20
%132 = load i32, i32* %19
%133 = call i64 @memcmp(i8* %130, i8* %131, i32 %132)
%134 = icmp ne i64 %133, 0
br i1 %134, label %135, label %136
135: ; preds = %129
br label %144
136: ; preds = %129
%137 = load i32, i32* %19
%138 = load i8*, i8** %20
%139 = zext i32 %137 to i64
%140 = getelementptr inbounds i8, i8* %138, i64 %139
store i8* %140, i8** %20
%141 = load i32, i32* %19
%142 = load i32, i32* %18
%143 = sub i32 %142, %141
store i32 %143, i32* %18
br label %108
144: ; preds = %135
br label %145
145: ; preds = %144, %92
store i32 1, i32* %17
br label %146
146: ; preds = %145, %80
%147 = load i32, i32* %12
%148 = add i32 %147, -1
store i32 %148, i32* %12
%149 = icmp ne i32 %148, 0
br i1 %149, label %151, label %150
150: ; preds = %146
store i32 0, i32* %5
br label %158
151: ; preds = %146
%152 = load i32, i32* %13
%153 = add i32 %152, 1
store i32 %153, i32* %13
%154 = load i32, i32* %11
%155 = icmp eq i32 %153, %154
br i1 %155, label %156, label %157
156: ; preds = %151
store i32 0, i32* %13
store i32 1, i32* %17
br label %157
157: ; preds = %156, %151
br label %51
158: ; preds = %150, %128, %111, %91, %74, %68, %62, %42, %36
%159 = load i32, i32* %5
ret i32 %159
}

LLVM IR (-O2):
define i32 @cdb_seek(i32 %0, i8* %1, i32 %2, i32* writeonly %3) {
%5 = alloca [64 x i8]
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%7 = tail call i32 @cdb_hash(i8* %1, i32 %2)
%8 = shl i32 %7, 3
%9 = and i32 %8, 2040
%10 = tail call i64 @lseek(i32 %0, i32 %9, i32 0)
%11 = icmp slt i64 %10, 0
br i1 %11, label %81, label %12
12: ; preds = %4
%13 = call i64 @cdb_bread(i32 %0, i8* %6, i32 8)
%14 = icmp slt i64 %13, 0
br i1 %14, label %81, label %15
15: ; preds = %12
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 4
%17 = call i32 @cdb_unpack(i8* %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %81, label %19
19: ; preds = %15
%20 = lshr i32 %7, 8
%21 = urem i32 %20, %17
%22 = call i32 @cdb_unpack(i8* %6)
%23 = icmp eq i32* %3, null
%24 = icmp eq i32 %2, 0
br label %25
25: ; preds = %76, %19
%26 = phi i32 [ %21, %19 ], [ %79, %76 ]
%27 = phi i32 [ %17, %19 ], [ %74, %76 ]
%28 = phi i32 [ 1, %19 ], [ %80, %76 ]
%29 = icmp eq i32 %28, 0
br i1 %29, label %35, label %30
30: ; preds = %25
%31 = shl i32 %26, 3
%32 = add i32 %31, %22
%33 = call i64 @lseek(i32 %0, i32 %32, i32 0)
%34 = icmp slt i64 %33, 0
br i1 %34, label %81, label %35
35: ; preds = %30, %25
%36 = call i64 @cdb_bread(i32 %0, i8* %6, i32 8)
%37 = icmp slt i64 %36, 0
br i1 %37, label %81, label %38
38: ; preds = %35
%39 = call i32 @cdb_unpack(i8* %16)
%40 = icmp eq i32 %39, 0
br i1 %40, label %81, label %41
41: ; preds = %38
%42 = call i32 @cdb_unpack(i8* %6)
%43 = icmp eq i32 %42, %7
br i1 %43, label %44, label %72
44: ; preds = %41
%45 = call i64 @lseek(i32 %0, i32 %39, i32 0)
%46 = icmp slt i64 %45, 0
br i1 %46, label %81, label %47
47: ; preds = %44
%48 = call i64 @cdb_bread(i32 %0, i8* %6, i32 8)
%49 = icmp slt i64 %48, 0
br i1 %49, label %81, label %50
50: ; preds = %47
%51 = call i32 @cdb_unpack(i8* %6)
%52 = icmp eq i32 %51, %2
br i1 %52, label %53, label %72
53: ; preds = %50
br i1 %23, label %56, label %54
54: ; preds = %53
%55 = call i32 @cdb_unpack(i8* %16)
store i32 %55, i32* %3
br label %56
56: ; preds = %54, %53
br i1 %24, label %81, label %57
57: ; preds = %56, %67
%58 = phi i8* [ %69, %67 ], [ %1, %56 ]
%59 = phi i32 [ %70, %67 ], [ %2, %56 ]
%60 = icmp ult i32 %59, 64
%61 = select i1 %60, i32 %59, i32 64
%62 = call i64 @cdb_bread(i32 %0, i8* %6, i32 %61)
%63 = icmp slt i64 %62, 0
br i1 %63, label %81, label %64
64: ; preds = %57
%65 = call i64 @memcmp(i8* %6, i8* %58, i32 %61)
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %72
67: ; preds = %64
%68 = zext i32 %61 to i64
%69 = getelementptr inbounds i8, i8* %58, i64 %68
%70 = sub i32 %59, %61
%71 = icmp eq i32 %70, 0
br i1 %71, label %81, label %57
72: ; preds = %64, %50, %41
%73 = phi i32 [ 0, %41 ], [ 1, %50 ], [ 1, %64 ]
%74 = add i32 %27, -1
%75 = icmp eq i32 %74, 0
br i1 %75, label %81, label %76
76: ; preds = %72
%77 = add i32 %26, 1
%78 = icmp eq i32 %77, %17
%79 = select i1 %78, i32 0, i32 %77
%80 = select i1 %78, i32 1, i32 %73
br label %25
81: ; preds = %72, %44, %47, %38, %35, %30, %56, %67, %57, %15, %4, %12
%82 = phi i32 [ -1, %12 ], [ -1, %4 ], [ 0, %15 ], [ 1, %67 ], [ -1, %57 ], [ 1, %56 ], [ 0, %72 ], [ -1, %44 ], [ -1, %47 ], [ 0, %38 ], [ -1, %35 ], [ -1, %30 ]
ret i32 %82
}