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

/* Variables and functions */
int atoi(char *);
int decodecheck(int /*<<< orphan*/ *, int);
int in_string(char *, char *);
int strlen(char *);
int wpdf_getbufline(char *, int, char *, int *, int);
int wpdf_getline(char *, int, int /*<<< orphan*/ *);
int pdf_numpages_1(void *ptr, int bufsize) {
  char buf[256];
  FILE *f;
  char *opbuf;
  int i, i0, status, np, gls;
  static char *kwords[] = {
      "/Type",        "/Pages",  "/Kids",   "/Count", "/Filter",
      "/FlateDecode", "/Length", "/ObjStm", "stream", ""};
  f = NULL;
  opbuf = NULL;
  if (bufsize == 0)
    f = (FILE *)ptr;
  else
    opbuf = (char *)ptr;
  status = 0;
  i0 = 0;
  np = -1;
  while (1) {
    if (bufsize == 0)
      gls = wpdf_getline(buf, 254, f);
    else
      gls = wpdf_getbufline(buf, 254, opbuf, &i0, bufsize);
    for (i = 0; kwords[i][0] != '\0'; i++) {
      int ip;
      ip = in_string(buf, kwords[i]);
      if (ip >= 0) {
        status |= (1 << i);
        if (i == 3 || i == 6)
          np = atoi(&buf[ip + strlen(kwords[i])]);
        if (status == 15 && np > 0)
          break;
        if (bufsize == 0 && (status & 0x1f1) == 0x1f1 && np > 0) {
          np = decodecheck(f, np);
          if (np > 0) {
            status = 15;
            break;
          }
        }
      }
    }
    if (status == 15 && np > 0)
      break;
    if (in_string(buf, "endobj") >= 0) {
      status = 0;
      np = -1;
    }
    if (!gls)
      break;
  }
  if (np > 0)
    return (np);
  return (-2);
}


x86 assembly (clang, -O0):
<pdf_numpages_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movq   $0x0,-0x128(%rbp)
movq   $0x0,-0x130(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11a2 <pdf_numpages_1+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x128(%rbp)
jmp    11ad <pdf_numpages_1+0x4d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x130(%rbp)
movl   $0x0,-0x13c(%rbp)
movl   $0x0,-0x138(%rbp)
movl   $0xffffffff,-0x140(%rbp)
ff ff ff
cmpl   $0x0,-0x14(%rbp)
jne    11f8 <pdf_numpages_1+0x98>
lea    -0x120(%rbp),%rdi
mov    -0x128(%rbp),%rdx
mov    $0xfe,%esi
call   1060 <wpdf_getline@plt>
mov    %eax,-0x144(%rbp)
jmp    1221 <pdf_numpages_1+0xc1>
lea    -0x120(%rbp),%rdi
mov    -0x130(%rbp),%rdx
mov    -0x14(%rbp),%r8d
mov    $0xfe,%esi
lea    -0x138(%rbp),%rcx
call   1080 <wpdf_getbufline@plt>
mov    %eax,-0x144(%rbp)
movl   $0x0,-0x134(%rbp)
movslq -0x134(%rbp),%rcx
lea    0x2e27(%rip),%rax
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1394 <pdf_numpages_1+0x234>
lea    -0x120(%rbp),%rdi
movslq -0x134(%rbp),%rcx
lea    0x2e02(%rip),%rax
mov    (%rax,%rcx,8),%rsi
call   1050 <in_string@plt>
mov    %eax,-0x148(%rbp)
cmpl   $0x0,-0x148(%rbp)
jl     137b <pdf_numpages_1+0x21b>
mov    -0x134(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x13c(%rbp),%eax
mov    %eax,-0x13c(%rbp)
cmpl   $0x3,-0x134(%rbp)
je     12ad <pdf_numpages_1+0x14d>
cmpl   $0x6,-0x134(%rbp)
jne    12f1 <pdf_numpages_1+0x191>
mov    -0x148(%rbp),%eax
mov    %eax,-0x14c(%rbp)
movslq -0x134(%rbp),%rcx
lea    0x2d99(%rip),%rax
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x14c(%rbp),%eax
add    %ecx,%eax
cltq
lea    -0x120(%rbp),%rdi
add    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,-0x140(%rbp)
cmpl   $0xf,-0x13c(%rbp)
jne    1310 <pdf_numpages_1+0x1b0>
cmpl   $0x0,-0x140(%rbp)
jle    1310 <pdf_numpages_1+0x1b0>
jmp    1394 <pdf_numpages_1+0x234>
cmpl   $0x0,-0x14(%rbp)
jne    1376 <pdf_numpages_1+0x216>
mov    -0x13c(%rbp),%eax
and    $0x1f1,%eax
cmp    $0x1f1,%eax
jne    1376 <pdf_numpages_1+0x216>
cmpl   $0x0,-0x140(%rbp)
jle    1376 <pdf_numpages_1+0x216>
mov    -0x128(%rbp),%rdi
mov    -0x140(%rbp),%esi
call   1030 <decodecheck@plt>
mov    %eax,-0x140(%rbp)
cmpl   $0x0,-0x140(%rbp)
jle    1371 <pdf_numpages_1+0x211>
movl   $0xf,-0x13c(%rbp)
jmp    1394 <pdf_numpages_1+0x234>
jmp    1376 <pdf_numpages_1+0x216>
jmp    137b <pdf_numpages_1+0x21b>
jmp    1380 <pdf_numpages_1+0x220>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    122b <pdf_numpages_1+0xcb>
cmpl   $0xf,-0x13c(%rbp)
jne    13b3 <pdf_numpages_1+0x253>
cmpl   $0x0,-0x140(%rbp)
jle    13b3 <pdf_numpages_1+0x253>
jmp    13fa <pdf_numpages_1+0x29a>
lea    -0x120(%rbp),%rdi
lea    0xc85(%rip),%rsi
call   1050 <in_string@plt>
cmp    $0x0,%eax
jl     13e3 <pdf_numpages_1+0x283>
movl   $0x0,-0x13c(%rbp)
movl   $0xffffffff,-0x140(%rbp)
ff ff ff
cmpl   $0x0,-0x144(%rbp)
jne    13f5 <pdf_numpages_1+0x295>
jmp    13fa <pdf_numpages_1+0x29a>
jmp    11cb <pdf_numpages_1+0x6b>
cmpl   $0x0,-0x140(%rbp)
jle    1415 <pdf_numpages_1+0x2b5>
mov    -0x140(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    141c <pdf_numpages_1+0x2bc>
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdf_numpages_1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
mov    %esi,%eax
xor    %ecx,%ecx
test   %esi,%esi
mov    $0x0,%edx
cmove  %rdi,%rdx
mov    %rdx,0x10(%rsp)
cmove  %rcx,%rdi
mov    %rdi,0x18(%rsp)
movl   $0x0,0xc(%rsp)
xor    %r12d,%r12d
mov    $0xffffffff,%r15d
mov    %esi,0x8(%rsp)
jmp    11e6 <pdf_numpages_1+0x86>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x20(%rsp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <in_string@plt>
test   %eax,%eax
mov    $0x0,%eax
cmovns %eax,%ebp
mov    $0xffffffff,%eax
cmovns %eax,%r15d
mov    %ebp,%r12d
cmpl   $0x0,0x4(%rsp)
mov    0x8(%rsp),%eax
je     1302 <pdf_numpages_1+0x1a2>
lea    0x20(%rsp),%rdi
mov    $0xfe,%esi
test   %eax,%eax
je     1210 <pdf_numpages_1+0xb0>
mov    0x18(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %eax,%r8d
call   1080 <wpdf_getbufline@plt>
jmp    121a <pdf_numpages_1+0xba>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rdx
call   1060 <wpdf_getline@plt>
mov    %eax,0x4(%rsp)
xor    %ebx,%ebx
lea    0xe01(%rip),%r14
jmp    1257 <pdf_numpages_1+0xf7>
nopl   0x0(%rax)
cmpl   $0x0,0x8(%rsp)
je     12b0 <pdf_numpages_1+0x150>
lea    0xdc2(%rip),%rax
movslq 0x4(%rax,%rbx,4),%r14
add    $0x1,%rbx
add    %rax,%r14
mov    %r12d,%ebp
cmp    $0x9,%rbx
je     12f0 <pdf_numpages_1+0x190>
lea    0x20(%rsp),%rdi
mov    %r14,%rsi
call   1050 <in_string@plt>
test   %eax,%eax
js     1237 <pdf_numpages_1+0xd7>
mov    %eax,%r13d
bts    %ebx,%r12d
cmp    $0x6,%ebx
je     1279 <pdf_numpages_1+0x119>
cmp    $0x3,%ebx
jne    1296 <pdf_numpages_1+0x136>
mov    %r14,%rdi
call   1040 <strlen@plt>
add    %r13d,%eax
cltq
lea    (%rsp,%rax,1),%rdi
add    $0x20,%rdi
call   1070 <atoi@plt>
mov    %eax,%r15d
mov    $0xf,%ebp
cmp    $0xf,%r12d
jne    1230 <pdf_numpages_1+0xd0>
test   %r15d,%r15d
jle    1230 <pdf_numpages_1+0xd0>
jmp    12f0 <pdf_numpages_1+0x190>
nopl   0x0(%rax,%rax,1)
mov    %r12d,%eax
not    %eax
test   $0x1f1,%eax
jne    1237 <pdf_numpages_1+0xd7>
test   %r15d,%r15d
jle    1237 <pdf_numpages_1+0xd7>
mov    0x10(%rsp),%rdi
mov    %r15d,%esi
call   1030 <decodecheck@plt>
mov    %eax,%r15d
test   %eax,%eax
jle    1237 <pdf_numpages_1+0xd7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0xf,%ebp
jne    11b0 <pdf_numpages_1+0x50>
test   %r15d,%r15d
jle    11b0 <pdf_numpages_1+0x50>
test   %r15d,%r15d
mov    $0xfffffffe,%eax
cmovg  %r15d,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@pdf_numpages_1.kwords = internal global [10 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i32 0, i32 0)]
@.str = [6 x i8] c"/Type\00"
@.str.1 = [7 x i8] c"/Pages\00"
@.str.2 = [6 x i8] c"/Kids\00"
@.str.3 = [7 x i8] c"/Count\00"
@.str.4 = [8 x i8] c"/Filter\00"
@.str.5 = [13 x i8] c"/FlateDecode\00"
@.str.6 = [8 x i8] c"/Length\00"
@.str.7 = [8 x i8] c"/ObjStm\00"
@.str.8 = [7 x i8] c"stream\00"
@.str.9 = [1 x i8] zeroinitializer
@.str.10 = [7 x i8] c"endobj\00"
define i32 @pdf_numpages_1(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [256 x i8]
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* null, i32** %7
store i8* null, i8** %8
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i8*, i8** %4
%19 = bitcast i8* %18 to i32*
store i32* %19, i32** %7
br label %22
20: ; preds = %2
%21 = load i8*, i8** %4
store i8* %21, i8** %8
br label %22
22: ; preds = %20, %17
store i32 0, i32* %11
store i32 0, i32* %10
store i32 -1, i32* %12
br label %23
23: ; preds = %22, %121
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%28 = load i32*, i32** %7
%29 = call i32 @wpdf_getline(i8* %27, i32 254, i32* %28)
store i32 %29, i32* %13
br label %35
30: ; preds = %23
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%32 = load i8*, i8** %8
%33 = load i32, i32* %5
%34 = call i32 @wpdf_getbufline(i8* %31, i32 254, i8* %32, i32* %10, i32 %33)
store i32 %34, i32* %13
br label %35
35: ; preds = %30, %26
store i32 0, i32* %9
br label %36
36: ; preds = %102, %35
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [10 x i8*], [10 x i8*]* @pdf_numpages_1.kwords, i64 0, i64 %38
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i8, i8* %40, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %105
45: ; preds = %36
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%47 = load i32, i32* %9
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [10 x i8*], [10 x i8*]* @pdf_numpages_1.kwords, i64 0, i64 %48
%50 = load i8*, i8** %49
%51 = call i32 @in_string(i8* %46, i8* %50)
store i32 %51, i32* %14
%52 = load i32, i32* %14
%53 = icmp sge i32 %52, 0
br i1 %53, label %54, label %101
54: ; preds = %45
%55 = load i32, i32* %9
%56 = shl i32 1, %55
%57 = load i32, i32* %11
%58 = or i32 %57, %56
store i32 %58, i32* %11
%59 = load i32, i32* %9
%60 = icmp eq i32 %59, 3
br i1 %60, label %64, label %61
61: ; preds = %54
%62 = load i32, i32* %9
%63 = icmp eq i32 %62, 6
br i1 %63, label %64, label %75
64: ; preds = %61, %54
%65 = load i32, i32* %14
%66 = load i32, i32* %9
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [10 x i8*], [10 x i8*]* @pdf_numpages_1.kwords, i64 0, i64 %67
%69 = load i8*, i8** %68
%70 = call i32 @strlen(i8* %69)
%71 = add nsw i32 %65, %70
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %72
%74 = call i32 @atoi(i8* %73)
store i32 %74, i32* %12
br label %75
75: ; preds = %64, %61
%76 = load i32, i32* %11
%77 = icmp eq i32 %76, 15
br i1 %77, label %78, label %82
78: ; preds = %75
%79 = load i32, i32* %12
%80 = icmp sgt i32 %79, 0
br i1 %80, label %81, label %82
81: ; preds = %78
br label %105
82: ; preds = %78, %75
%83 = load i32, i32* %5
%84 = icmp eq i32 %83, 0
br i1 %84, label %85, label %100
85: ; preds = %82
%86 = load i32, i32* %11
%87 = and i32 %86, 497
%88 = icmp eq i32 %87, 497
br i1 %88, label %89, label %100
89: ; preds = %85
%90 = load i32, i32* %12
%91 = icmp sgt i32 %90, 0
br i1 %91, label %92, label %100
92: ; preds = %89
%93 = load i32*, i32** %7
%94 = load i32, i32* %12
%95 = call i32 @decodecheck(i32* %93, i32 %94)
store i32 %95, i32* %12
%96 = load i32, i32* %12
%97 = icmp sgt i32 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %92
store i32 15, i32* %11
br label %105
99: ; preds = %92
br label %100
100: ; preds = %99, %89, %85, %82
br label %101
101: ; preds = %100, %45
br label %102
102: ; preds = %101
%103 = load i32, i32* %9
%104 = add nsw i32 %103, 1
store i32 %104, i32* %9
br label %36
105: ; preds = %98, %81, %36
%106 = load i32, i32* %11
%107 = icmp eq i32 %106, 15
br i1 %107, label %108, label %112
108: ; preds = %105
%109 = load i32, i32* %12
%110 = icmp sgt i32 %109, 0
br i1 %110, label %111, label %112
111: ; preds = %108
br label %122
112: ; preds = %108, %105
%113 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%114 = call i32 @in_string(i8* %113, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%115 = icmp sge i32 %114, 0
br i1 %115, label %116, label %117
116: ; preds = %112
store i32 0, i32* %11
store i32 -1, i32* %12
br label %117
117: ; preds = %116, %112
%118 = load i32, i32* %13
%119 = icmp ne i32 %118, 0
br i1 %119, label %121, label %120
120: ; preds = %117
br label %122
121: ; preds = %117
br label %23
122: ; preds = %120, %111
%123 = load i32, i32* %12
%124 = icmp sgt i32 %123, 0
br i1 %124, label %125, label %127
125: ; preds = %122
%126 = load i32, i32* %12
store i32 %126, i32* %3
br label %128
127: ; preds = %122
store i32 -2, i32* %3
br label %128
128: ; preds = %127, %125
%129 = load i32, i32* %3
ret i32 %129
}

LLVM IR (-O2):
@reltable.pdf_numpages_1 = internal unnamed_addr constant [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([10 x i32]* @reltable.pdf_numpages_1 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([10 x i32]* @reltable.pdf_numpages_1 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([10 x i32]* @reltable.pdf_numpages_1 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([10 x i32]* @reltable.pdf_numpages_1 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.4 to i64), i64 ptrtoint ([10 x i32]* @reltable.pdf_numpages_1 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.pdf_numpages_1 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.pdf_numpages_1 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.7 to i64), i64 ptrtoint ([10 x i32]* @reltable.pdf_numpages_1 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.8 to i64), i64 ptrtoint ([10 x i32]* @reltable.pdf_numpages_1 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.9 to i64), i64 ptrtoint ([10 x i32]* @reltable.pdf_numpages_1 to i64)) to i32)]
@.str = [6 x i8] c"/Type\00"
@.str.1 = [7 x i8] c"/Pages\00"
@.str.2 = [6 x i8] c"/Kids\00"
@.str.3 = [7 x i8] c"/Count\00"
@.str.4 = [8 x i8] c"/Filter\00"
@.str.5 = [13 x i8] c"/FlateDecode\00"
@.str.6 = [8 x i8] c"/Length\00"
@.str.7 = [8 x i8] c"/ObjStm\00"
@.str.8 = [7 x i8] c"stream\00"
@.str.9 = [1 x i8] zeroinitializer
@.str.10 = [7 x i8] c"endobj\00"
define i32 @pdf_numpages_1(i8* %0, i32 %1) {
%3 = alloca [256 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %1, 0
%8 = bitcast i8* %0 to i32*
%9 = select i1 %7, i32* %8, i32* null
%10 = select i1 %7, i8* null, i8* %0
store i32 0, i32* %4
br label %11
11: ; preds = %63, %2
%12 = phi i32 [ 0, %2 ], [ %66, %63 ]
%13 = phi i32 [ -1, %2 ], [ %67, %63 ]
br i1 %7, label %14, label %16
14: ; preds = %11
%15 = call i32 @wpdf_getline(i8* %5, i32 254, i32* %9)
br label %18
16: ; preds = %11
%17 = call i32 @wpdf_getbufline(i8* %5, i32 254, i8* %10, i32* %4, i32 %1)
br label %18
18: ; preds = %16, %14
%19 = phi i32 [ %15, %14 ], [ %17, %16 ]
br label %20
20: ; preds = %18, %50
%21 = phi i64 [ 0, %18 ], [ %53, %50 ]
%22 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %18 ], [ %55, %50 ]
%23 = phi i32 [ %13, %18 ], [ %52, %50 ]
%24 = phi i32 [ %12, %18 ], [ %51, %50 ]
%25 = call i32 @in_string(i8* %5, i8* %22)
%26 = icmp sgt i32 %25, -1
br i1 %26, label %27, label %50
27: ; preds = %20
%28 = trunc i64 %21 to i32
%29 = shl nuw i32 1, %28
%30 = or i32 %24, %29
switch i32 %28, label %37 [
i32 6, label %31
i32 3, label %31
]
31: ; preds = %27, %27
%32 = call i32 @strlen(i8* %22)
%33 = add nsw i32 %32, %25
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %34
%36 = call i32 @atoi(i8* %35)
br label %37
37: ; preds = %27, %31
%38 = phi i32 [ %36, %31 ], [ %23, %27 ]
%39 = icmp eq i32 %30, 15
%40 = icmp sgt i32 %38, 0
%41 = select i1 %39, i1 %40, i1 false
br i1 %41, label %57, label %42
42: ; preds = %37
br i1 %7, label %43, label %50
43: ; preds = %42
%44 = and i32 %30, 497
%45 = icmp eq i32 %44, 497
%46 = select i1 %45, i1 %40, i1 false
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = call i32 @decodecheck(i32* %9, i32 %38)
%49 = icmp sgt i32 %48, 0
br i1 %49, label %57, label %50
50: ; preds = %42, %43, %47, %20
%51 = phi i32 [ %30, %47 ], [ %30, %43 ], [ %30, %42 ], [ %24, %20 ]
%52 = phi i32 [ %48, %47 ], [ %38, %43 ], [ %38, %42 ], [ %23, %20 ]
%53 = add nuw nsw i64 %21, 1
%54 = shl i64 %53, 2
%55 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.pdf_numpages_1 to i8*), i64 %54)
%56 = icmp eq i64 %53, 9
br i1 %56, label %57, label %20
57: ; preds = %47, %37, %50
%58 = phi i32 [ %51, %50 ], [ 15, %37 ], [ 15, %47 ]
%59 = phi i32 [ %52, %50 ], [ %38, %37 ], [ %48, %47 ]
%60 = icmp eq i32 %58, 15
%61 = icmp sgt i32 %59, 0
%62 = select i1 %60, i1 %61, i1 false
br i1 %62, label %69, label %63
63: ; preds = %57
%64 = call i32 @in_string(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%65 = icmp sgt i32 %64, -1
%66 = select i1 %65, i32 0, i32 %58
%67 = select i1 %65, i32 -1, i32 %59
%68 = icmp eq i32 %19, 0
br i1 %68, label %69, label %11
69: ; preds = %63, %57
%70 = phi i32 [ %59, %57 ], [ %67, %63 ]
%71 = icmp sgt i32 %70, 0
%72 = select i1 %71, i32 %70, i32 -2
ret i32 %72
}