#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 scalar_t__ gzFile;

/* Variables and functions */
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ PROT_READ;
int /*<<< orphan*/ SEEK_SET;
scalar_t__ Z_NULL;
int /*<<< orphan*/ close(int);
scalar_t__ gzopen(char *, char *);
int /*<<< orphan*/ gzread(scalar_t__, unsigned char *, int);
int /*<<< orphan*/ gzseek(scalar_t__, int, int /*<<< orphan*/);
int /*<<< orphan*/ lseek(int, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(unsigned char *, char, int);
scalar_t__ mmap(int /*<<< orphan*/ *, long, int /*<<< orphan*/,
                int /*<<< orphan*/, int, int /*<<< orphan*/);
int ntohl(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, unsigned char *, int);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
long strlen(char const *);
char *lookup(char *file_prefix, long file_size, long wc, char *word) {
  int fd;
  char *data;
  const char *p;
  long index_size;
  int offset;
  int size;
  int flag = 0;
  unsigned char *buf;
  char idx_file_name[256];
  char dict_file_name[256];
  char gz_file_name[256];
  strcpy(idx_file_name, file_prefix);
  strcat(idx_file_name, ".idx");
  strcpy(dict_file_name, file_prefix);
  strcat(dict_file_name, ".dict");
  strcpy(gz_file_name, file_prefix);
  strcat(gz_file_name, ".dict.dz");
  if ((fd = open(idx_file_name, O_RDONLY)) < 0) {
    printf("open failed\n");
    return NULL;
  }
  data = (char *)mmap(NULL, file_size, PROT_READ, MAP_SHARED, fd, 0);
  p = data;
  int i;
  for (i = 0; i < wc; i++) {
    index_size = strlen(p) + 1 + 2 * sizeof(int);
    if (strcmp(word, p) == 0) {
      flag = 1;
    }
    if (flag == 1) {
      close(fd);
      offset = ntohl(*(int *)(p + strlen(p) + 1));
      size = ntohl(*(int *)(p + strlen(p) + 1 + sizeof(int)));
      gzFile zfile;
      zfile = gzopen(gz_file_name, "rb");
      if (zfile != Z_NULL) {
        gzseek(zfile, offset, SEEK_SET);
        buf = (unsigned char *)malloc(size + 1);
        memset(buf, '\0', size + 1);
        gzread(zfile, buf, size);
        return buf;
      }
    n:
      if ((fd = open(dict_file_name, O_RDONLY)) < 0) {
        printf("open %s failed \n", dict_file_name);
        return "Open dict file faile";
      }
      lseek(fd, offset, SEEK_SET);
      buf = (unsigned char *)malloc(size + 1);
      memset(buf, '\0', size + 1);
      read(fd, buf, size);
      close(fd);
      return buf;
    }
    p += index_size;
  }
  return "Not found";
}


x86 assembly (clang, -O0):
<lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x380,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x54(%rbp)
lea    -0x160(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x160(%rbp),%rdi
lea    0xdc0(%rip),%rsi
call   1110 <strcat@plt>
lea    -0x260(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x260(%rbp),%rdi
lea    0xda2(%rip),%rsi
call   1110 <strcat@plt>
lea    -0x360(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x360(%rbp),%rdi
lea    0xd85(%rip),%rsi
call   1110 <strcat@plt>
lea    -0x160(%rbp),%rdi
mov    0x2d3f(%rip),%rax
mov    (%rax),%esi
call   1100 <open@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
jge    12c7 <lookup+0xc7>
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1504 <lookup+0x304>
mov    -0x18(%rbp),%rsi
mov    0x2d26(%rip),%rax
mov    (%rax),%edx
mov    0x2d0d(%rip),%rax
mov    (%rax),%ecx
mov    -0x2c(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x364(%rbp)
movslq -0x364(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    14f9 <lookup+0x2f9>
mov    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%rax
add    $0x8,%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1347 <lookup+0x147>
movl   $0x1,-0x54(%rbp)
cmpl   $0x1,-0x54(%rbp)
jne    14d9 <lookup+0x2d9>
mov    -0x2c(%rbp),%edi
call   10a0 <close@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x380(%rbp)
mov    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x380(%rbp),%rax
mov    0x1(%rax,%rcx,1),%edi
call   1120 <ntohl@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x378(%rbp)
mov    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x378(%rbp),%rax
mov    0x5(%rax,%rcx,1),%edi
call   1120 <ntohl@plt>
mov    %eax,-0x50(%rbp)
lea    -0x360(%rbp),%rdi
lea    0xc66(%rip),%rsi
call   10f0 <gzopen@plt>
mov    %rax,-0x370(%rbp)
mov    -0x370(%rbp),%rax
mov    0x2beb(%rip),%rcx
cmp    (%rcx),%rax
je     1436 <lookup+0x236>
mov    -0x370(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    0x2bd9(%rip),%rax
mov    (%rax),%edx
call   1060 <gzseek@plt>
mov    -0x50(%rbp),%edi
add    $0x1,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x50(%rbp),%edx
add    $0x1,%edx
xor    %esi,%esi
call   1090 <memset@plt>
mov    -0x370(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x50(%rbp),%edx
call   10d0 <gzread@plt>
mov    -0x60(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1504 <lookup+0x304>
jmp    143b <lookup+0x23b>
lea    -0x260(%rbp),%rdi
mov    0x2b8f(%rip),%rax
mov    (%rax),%esi
call   1100 <open@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
jge    1481 <lookup+0x281>
lea    -0x260(%rbp),%rsi
lea    0xbba(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xbbd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1504 <lookup+0x304>
mov    -0x2c(%rbp),%edi
mov    -0x4c(%rbp),%esi
mov    0x2b3a(%rip),%rax
mov    (%rax),%edx
call   1080 <lseek@plt>
mov    -0x50(%rbp),%edi
add    $0x1,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x50(%rbp),%edx
add    $0x1,%edx
xor    %esi,%esi
call   1090 <memset@plt>
mov    -0x2c(%rbp),%edi
mov    -0x60(%rbp),%rsi
mov    -0x50(%rbp),%edx
call   10b0 <read@plt>
mov    -0x2c(%rbp),%edi
call   10a0 <close@plt>
mov    -0x60(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1504 <lookup+0x304>
mov    -0x48(%rbp),%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x364(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x364(%rbp)
jmp    1303 <lookup+0x103>
lea    0xb4a(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x380,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x308,%rsp
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x200(%rsp),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xdb9(%rip),%rsi
mov    %r12,%rdi
call   1120 <strcat@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xda1(%rip),%rsi
mov    %rbp,%rdi
call   1120 <strcat@plt>
lea    0x100(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xd85(%rip),%rsi
mov    %rbp,%rdi
call   1120 <strcat@plt>
mov    0x2d43(%rip),%rax
mov    (%rax),%esi
mov    %r12,%rdi
call   1110 <open@plt>
test   %eax,%eax
js     130d <lookup+0xfd>
mov    %eax,%r12d
mov    0x2d4b(%rip),%rax
mov    (%rax),%edx
mov    0x2d32(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r15,%rsi
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1060 <mmap@plt>
lea    0xd6e(%rip),%r15
test   %r13,%r13
jle    1427 <lookup+0x217>
mov    %rax,%rbp
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rbp,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1321 <lookup+0x111>
add    %rbx,%rbp
add    $0x9,%rbp
add    $0xffffffffffffffff,%r13
jne    12e0 <lookup+0xd0>
jmp    1427 <lookup+0x217>
lea    0xd33(%rip),%rdi
call   1040 <puts@plt>
xor    %r15d,%r15d
jmp    1427 <lookup+0x217>
mov    %r12d,%edi
call   10b0 <close@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %rax,%rbx
mov    0x1(%rbp,%rax,1),%edi
call   1130 <ntohl@plt>
mov    %eax,%r15d
mov    0x5(%rbp,%rbx,1),%edi
call   1130 <ntohl@plt>
mov    %eax,%r14d
lea    0xcc1(%rip),%rsi
lea    0x100(%rsp),%rdi
call   1100 <gzopen@plt>
mov    %rax,%rbp
mov    0x2c56(%rip),%rax
cmp    (%rax),%rbp
jne    13cf <lookup+0x1bf>
mov    0x2c62(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdi
call   1110 <open@plt>
test   %eax,%eax
js     140f <lookup+0x1ff>
mov    %eax,%ebp
mov    0x2c37(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
mov    %r15d,%esi
call   1090 <lseek@plt>
mov    %r14d,%ebx
add    $0x1,%ebx
mov    %ebx,%edi
call   10f0 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   10a0 <memset@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14d,%edx
call   10c0 <read@plt>
mov    %ebp,%edi
call   10b0 <close@plt>
jmp    1427 <lookup+0x217>
mov    0x2bf2(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
mov    %r15d,%esi
call   1070 <gzseek@plt>
mov    %r14d,%ebx
add    $0x1,%ebx
mov    %ebx,%edi
call   10f0 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   10a0 <memset@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   10e0 <gzread@plt>
jmp    1427 <lookup+0x217>
lea    0xc01(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xc01(%rip),%r15
mov    %r15,%rax
add    $0x308,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c".idx\00"
@.str.1 = [6 x i8] c".dict\00"
@.str.2 = [9 x i8] c".dict.dz\00"
@O_RDONLY = global i32 0
@.str.3 = [13 x i8] c"open failed\0A\00"
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@.str.4 = [3 x i8] c"rb\00"
@Z_NULL = global i64 0
@SEEK_SET = global i32 0
@.str.5 = [17 x i8] c"open %s failed \0A\00"
@.str.6 = [21 x i8] c"Open dict file faile\00"
@.str.7 = [10 x i8] c"Not found\00"
define i8* @lookup(i8* %0, i64 %1, i64 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca [256 x i8]
%19 = alloca [256 x i8]
%20 = alloca [256 x i8]
%21 = alloca i32
%22 = alloca i64
store i8* %0, i8** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i32 0, i32* %16
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%24 = load i8*, i8** %6
%25 = call i32 @strcpy(i8* %23, i8* %24)
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%29 = load i8*, i8** %6
%30 = call i32 @strcpy(i8* %28, i8* %29)
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%32 = call i32 @strcat(i8* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %20, i64 0, i64 0
%34 = load i8*, i8** %6
%35 = call i32 @strcpy(i8* %33, i8* %34)
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %20, i64 0, i64 0
%37 = call i32 @strcat(i8* %36, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%39 = load i32, i32* @O_RDONLY
%40 = call i32 @open(i8* %38, i32 %39)
store i32 %40, i32* %10
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %4
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
store i8* null, i8** %5
br label %150
44: ; preds = %4
%45 = load i64, i64* %7
%46 = load i32, i32* @PROT_READ
%47 = load i32, i32* @MAP_SHARED
%48 = load i32, i32* %10
%49 = call i64 @mmap(i32* null, i64 %45, i32 %46, i32 %47, i32 %48, i32 0)
%50 = inttoptr i64 %49 to i8*
store i8* %50, i8** %11
%51 = load i8*, i8** %11
store i8* %51, i8** %12
store i32 0, i32* %21
br label %52
52: ; preds = %146, %44
%53 = load i32, i32* %21
%54 = sext i32 %53 to i64
%55 = load i64, i64* %8
%56 = icmp slt i64 %54, %55
br i1 %56, label %57, label %149
57: ; preds = %52
%58 = load i8*, i8** %12
%59 = call i64 @strlen(i8* %58)
%60 = add nsw i64 %59, 1
%61 = add i64 %60, 8
store i64 %61, i64* %13
%62 = load i8*, i8** %9
%63 = load i8*, i8** %12
%64 = call i64 @strcmp(i8* %62, i8* %63)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %67
66: ; preds = %57
store i32 1, i32* %16
br label %67
67: ; preds = %66, %57
%68 = load i32, i32* %16
%69 = icmp eq i32 %68, 1
br i1 %69, label %70, label %142
70: ; preds = %67
%71 = load i32, i32* %10
%72 = call i32 @close(i32 %71)
%73 = load i8*, i8** %12
%74 = load i8*, i8** %12
%75 = call i64 @strlen(i8* %74)
%76 = getelementptr inbounds i8, i8* %73, i64 %75
%77 = getelementptr inbounds i8, i8* %76, i64 1
%78 = bitcast i8* %77 to i32*
%79 = load i32, i32* %78
%80 = call i32 @ntohl(i32 %79)
store i32 %80, i32* %14
%81 = load i8*, i8** %12
%82 = load i8*, i8** %12
%83 = call i64 @strlen(i8* %82)
%84 = getelementptr inbounds i8, i8* %81, i64 %83
%85 = getelementptr inbounds i8, i8* %84, i64 1
%86 = getelementptr inbounds i8, i8* %85, i64 4
%87 = bitcast i8* %86 to i32*
%88 = load i32, i32* %87
%89 = call i32 @ntohl(i32 %88)
store i32 %89, i32* %15
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %20, i64 0, i64 0
%91 = call i64 @gzopen(i8* %90, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i64 %91, i64* %22
%92 = load i64, i64* %22
%93 = load i64, i64* @Z_NULL
%94 = icmp ne i64 %92, %93
br i1 %94, label %95, label %113
95: ; preds = %70
%96 = load i64, i64* %22
%97 = load i32, i32* %14
%98 = load i32, i32* @SEEK_SET
%99 = call i32 @gzseek(i64 %96, i32 %97, i32 %98)
%100 = load i32, i32* %15
%101 = add nsw i32 %100, 1
%102 = call i64 @malloc(i32 %101)
%103 = inttoptr i64 %102 to i8*
store i8* %103, i8** %17
%104 = load i8*, i8** %17
%105 = load i32, i32* %15
%106 = add nsw i32 %105, 1
%107 = call i32 @memset(i8* %104, i8 signext 0, i32 %106)
%108 = load i64, i64* %22
%109 = load i8*, i8** %17
%110 = load i32, i32* %15
%111 = call i32 @gzread(i64 %108, i8* %109, i32 %110)
%112 = load i8*, i8** %17
store i8* %112, i8** %5
br label %150
113: ; preds = %70
br label %114
114: ; preds = %113
%115 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%116 = load i32, i32* @O_RDONLY
%117 = call i32 @open(i8* %115, i32 %116)
store i32 %117, i32* %10
%118 = icmp slt i32 %117, 0
br i1 %118, label %119, label %122
119: ; preds = %114
%120 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %120)
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8** %5
br label %150
122: ; preds = %114
%123 = load i32, i32* %10
%124 = load i32, i32* %14
%125 = load i32, i32* @SEEK_SET
%126 = call i32 @lseek(i32 %123, i32 %124, i32 %125)
%127 = load i32, i32* %15
%128 = add nsw i32 %127, 1
%129 = call i64 @malloc(i32 %128)
%130 = inttoptr i64 %129 to i8*
store i8* %130, i8** %17
%131 = load i8*, i8** %17
%132 = load i32, i32* %15
%133 = add nsw i32 %132, 1
%134 = call i32 @memset(i8* %131, i8 signext 0, i32 %133)
%135 = load i32, i32* %10
%136 = load i8*, i8** %17
%137 = load i32, i32* %15
%138 = call i32 @read(i32 %135, i8* %136, i32 %137)
%139 = load i32, i32* %10
%140 = call i32 @close(i32 %139)
%141 = load i8*, i8** %17
store i8* %141, i8** %5
br label %150
142: ; preds = %67
%143 = load i64, i64* %13
%144 = load i8*, i8** %12
%145 = getelementptr inbounds i8, i8* %144, i64 %143
store i8* %145, i8** %12
br label %146
146: ; preds = %142
%147 = load i32, i32* %21
%148 = add nsw i32 %147, 1
store i32 %148, i32* %21
br label %52
149: ; preds = %52
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %5
br label %150
150: ; preds = %149, %122, %119, %95, %42
%151 = load i8*, i8** %5
ret i8* %151
}

LLVM IR (-O2):
@.str = [5 x i8] c".idx\00"
@.str.1 = [6 x i8] c".dict\00"
@.str.2 = [9 x i8] c".dict.dz\00"
@O_RDONLY = global i32 0
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@.str.4 = [3 x i8] c"rb\00"
@Z_NULL = global i64 0
@SEEK_SET = global i32 0
@.str.5 = [17 x i8] c"open %s failed \0A\00"
@.str.6 = [21 x i8] c"Open dict file faile\00"
@.str.7 = [10 x i8] c"Not found\00"
@str = [12 x i8] c"open failed\00"
define i8* @lookup(i8* %0, i64 %1, i64 %2, i8* %3) {
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%11 = call i32 @strcpy(i8* %8, i8* %0)
%12 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @strcpy(i8* %9, i8* %0)
%14 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @strcpy(i8* %10, i8* %0)
%16 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* @O_RDONLY
%18 = call i32 @open(i8* %8, i32 %17)
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %4
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %78
22: ; preds = %4
%23 = load i32, i32* @PROT_READ
%24 = load i32, i32* @MAP_SHARED
%25 = call i64 @mmap(i32* null, i64 %1, i32 %23, i32 %24, i32 %18, i32 0)
%26 = icmp sgt i64 %2, 0
br i1 %26, label %27, label %78
27: ; preds = %22
%28 = inttoptr i64 %25 to i8*
br label %29
29: ; preds = %27, %73
%30 = phi i64 [ 0, %27 ], [ %76, %73 ]
%31 = phi i8* [ %28, %27 ], [ %75, %73 ]
%32 = call i64 @strlen(i8* dereferenceable(1) %31)
%33 = call i64 @strcmp(i8* %3, i8* %31)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %73
35: ; preds = %29
%36 = call i32 @close(i32 %18)
%37 = call i64 @strlen(i8* dereferenceable(1) %31)
%38 = getelementptr inbounds i8, i8* %31, i64 %37
%39 = getelementptr inbounds i8, i8* %38, i64 1
%40 = bitcast i8* %39 to i32*
%41 = load i32, i32* %40
%42 = call i32 @ntohl(i32 %41)
%43 = getelementptr inbounds i8, i8* %39, i64 4
%44 = bitcast i8* %43 to i32*
%45 = load i32, i32* %44
%46 = call i32 @ntohl(i32 %45)
%47 = call i64 @gzopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%48 = load i64, i64* @Z_NULL
%49 = icmp eq i64 %47, %48
br i1 %49, label %58, label %50
50: ; preds = %35
%51 = load i32, i32* @SEEK_SET
%52 = call i32 @gzseek(i64 %47, i32 %42, i32 %51)
%53 = add nsw i32 %46, 1
%54 = call i64 @malloc(i32 %53)
%55 = inttoptr i64 %54 to i8*
%56 = call i32 @memset(i8* %55, i8 signext 0, i32 %53)
%57 = call i32 @gzread(i64 %47, i8* %55, i32 %46)
br label %78
58: ; preds = %35
%59 = load i32, i32* @O_RDONLY
%60 = call i32 @open(i8* %9, i32 %59)
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %9)
br label %78
64: ; preds = %58
%65 = load i32, i32* @SEEK_SET
%66 = call i32 @lseek(i32 %60, i32 %42, i32 %65)
%67 = add nsw i32 %46, 1
%68 = call i64 @malloc(i32 %67)
%69 = inttoptr i64 %68 to i8*
%70 = call i32 @memset(i8* %69, i8 signext 0, i32 %67)
%71 = call i32 @read(i32 %60, i8* %69, i32 %46)
%72 = call i32 @close(i32 %60)
br label %78
73: ; preds = %29
%74 = add i64 %32, 9
%75 = getelementptr inbounds i8, i8* %31, i64 %74
%76 = add nuw nsw i64 %30, 1
%77 = icmp eq i64 %76, %2
br i1 %77, label %78, label %29
78: ; preds = %73, %22, %64, %62, %50, %20
%79 = phi i8* [ null, %20 ], [ %55, %50 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), %62 ], [ %69, %64 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %22 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %73 ]
ret i8* %79
}