#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*/ tmp;
typedef int /*<<< orphan*/ *gzFile;

/* Variables and functions */
scalar_t__ Z_NULL;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ gzclose(int /*<<< orphan*/ *);
char *gzerror(int /*<<< orphan*/ *, int *);
scalar_t__ gzgets(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ *gzopen(char *, char *);
int gzprintf(int /*<<< orphan*/ *, char *, char *, char *, long long);
long long gztell(int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *, long long *, long long *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ system(char *);
int hash_index_file(char *filename, int chunk_size, int skip_sort) {
  char hash_file_name[512];
  char indexname[512];
  char sname[1024];
  long long beginH, gz_chunk = 0;
  char tmp[10000];
  int res = 0;
  int error;
  char min_name[1024];
  char max_name[1024];
  long long current_chunk = 0;
  long long count = 0;
  strcpy(min_name, "");
  strcpy(max_name, "");
  snprintf(indexname, 512, "%s.index", filename);
  snprintf(hash_file_name, 512, "%s.index.hash", filename);
  if (skip_sort == 0) {
    char cmd[10000];
    snprintf(cmd, 10000, "sort_index.sh %s", indexname);
    system(cmd);
  }
  gzFile gzhash_file = gzopen(hash_file_name, "wb");
  gzFile gzfile_index = gzopen(indexname, "r");
  if (gzfile_index == NULL) {
    fprintf(stderr, "error opening gzfile_index :%s\n",
            gzerror(gzfile_index, &error));
    return -2;
  }
  if (gzhash_file == NULL) {
    fprintf(stderr, "error opening gzhash_file :%s\n",
            gzerror(gzhash_file, &error));
    return -2;
  }
  while (gzgets(gzfile_index, tmp, sizeof(tmp)) != Z_NULL) {
    sscanf(tmp, "%s %lld %lld", sname, &gz_chunk, &beginH);
    if (strcmp(sname, "UMACOMPRESSEDFORMAT") != 0) {
      if ((count % chunk_size) == 0) {
        if (strcmp(min_name, "") != 0) {
          res = gzprintf(gzhash_file, "%s %s %lld\n", min_name, max_name,
                         current_chunk);
        }
        strcpy(min_name, "");
        strcpy(max_name, "");
        current_chunk = gztell(gzfile_index);
      }
      if ((strcmp(min_name, "") == 0) || (strcmp(sname, min_name) < 0)) {
        strcpy(min_name, sname);
      }
      if ((strcmp(max_name, "") == 0) || (strcmp(sname, max_name) > 0)) {
        strcpy(max_name, sname);
      }
      count++;
    }
  }
  if (strcmp(min_name, "") != 0) {
    res = gzprintf(gzhash_file, "%s %s %lld\n", min_name, max_name,
                   current_chunk);
  }
  gzclose(gzhash_file);
  gzclose(gzfile_index);
  return 0;
}


x86 assembly (clang, -O0):
<hash_index_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5e90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movq   $0x0,-0x830(%rbp)
movl   $0x0,-0x2f44(%rbp)
movq   $0x0,-0x3758(%rbp)
movq   $0x0,-0x3760(%rbp)
lea    -0x3350(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x3750(%rbp),%rdi
lea    0xe77(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x200,%esi
lea    0xdc3(%rip),%rdx
call   1080 <snprintf@plt>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x200,%esi
lea    0xdb0(%rip),%rdx
call   1080 <snprintf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1293 <hash_index_file+0xd3>
lea    -0x5e70(%rbp),%rdi
lea    -0x420(%rbp),%rcx
mov    $0x2710,%esi
lea    0xd95(%rip),%rdx
call   1080 <snprintf@plt>
lea    -0x5e70(%rbp),%rdi
call   1070 <system@plt>
lea    -0x220(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   10d0 <gzopen@plt>
mov    %rax,-0x5e78(%rbp)
lea    -0x420(%rbp),%rdi
lea    0xd70(%rip),%rsi
call   10d0 <gzopen@plt>
mov    %rax,-0x5e80(%rbp)
cmpq   $0x0,-0x5e80(%rbp)
jne    1318 <hash_index_file+0x158>
mov    0x2d04(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5e84(%rbp)
mov    -0x5e80(%rbp),%rdi
lea    -0x2f48(%rbp),%rsi
call   10b0 <gzerror@plt>
mov    -0x5e84(%rbp),%edi
mov    %rax,%rdx
lea    0xd26(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1594 <hash_index_file+0x3d4>
cmpq   $0x0,-0x5e78(%rbp)
jne    1369 <hash_index_file+0x1a9>
mov    0x2cb3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5e88(%rbp)
mov    -0x5e78(%rbp),%rdi
lea    -0x2f48(%rbp),%rsi
call   10b0 <gzerror@plt>
mov    -0x5e88(%rbp),%edi
mov    %rax,%rdx
lea    0xcf5(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1594 <hash_index_file+0x3d4>
jmp    136e <hash_index_file+0x1ae>
mov    -0x5e80(%rbp),%rdi
lea    -0x2f40(%rbp),%rsi
mov    $0x2710,%edx
call   1050 <gzgets@plt>
mov    0x2c4b(%rip),%rcx
cmp    (%rcx),%rax
je     152a <hash_index_file+0x36a>
lea    -0x2f40(%rbp),%rdi
lea    -0x820(%rbp),%rdx
lea    0xcc1(%rip),%rsi
lea    -0x830(%rbp),%rcx
lea    -0x828(%rbp),%r8
call   10c0 <sscanf@plt>
lea    -0x820(%rbp),%rdi
lea    0xcad(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     1525 <hash_index_file+0x365>
mov    -0x3760(%rbp),%rax
movslq -0x14(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    1479 <hash_index_file+0x2b9>
lea    -0x3350(%rbp),%rdi
lea    0xc95(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     1440 <hash_index_file+0x280>
mov    -0x5e78(%rbp),%rdi
lea    -0x3350(%rbp),%rdx
lea    -0x3750(%rbp),%rcx
mov    -0x3758(%rbp),%r8
lea    0xc58(%rip),%rsi
call   1060 <gzprintf@plt>
mov    %eax,-0x2f44(%rbp)
lea    -0x3350(%rbp),%rdi
lea    0xc4a(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x3750(%rbp),%rdi
lea    0xc37(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x5e80(%rbp),%rdi
call   10e0 <gztell@plt>
mov    %rax,-0x3758(%rbp)
lea    -0x3350(%rbp),%rdi
lea    0xc11(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     14b3 <hash_index_file+0x2f3>
lea    -0x820(%rbp),%rdi
lea    -0x3350(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jge    14c6 <hash_index_file+0x306>
lea    -0x3350(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x3750(%rbp),%rdi
lea    0xbc4(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     1500 <hash_index_file+0x340>
lea    -0x820(%rbp),%rdi
lea    -0x3750(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jle    1513 <hash_index_file+0x353>
lea    -0x3750(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x3760(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x3760(%rbp)
jmp    136e <hash_index_file+0x1ae>
lea    -0x3350(%rbp),%rdi
lea    0xb60(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     1575 <hash_index_file+0x3b5>
mov    -0x5e78(%rbp),%rdi
lea    -0x3350(%rbp),%rdx
lea    -0x3750(%rbp),%rcx
mov    -0x3758(%rbp),%r8
lea    0xb23(%rip),%rsi
call   1060 <gzprintf@plt>
mov    %eax,-0x2f44(%rbp)
mov    -0x5e78(%rbp),%rdi
call   1030 <gzclose@plt>
mov    -0x5e80(%rbp),%rdi
call   1030 <gzclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5e90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_index_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3748,%rsp
mov    %edx,%r14d
mov    %esi,0x4(%rsp)
mov    %rdi,%rbp
movq   $0x0,0x20(%rsp)
lea    0xead(%rip),%rbx
lea    0x630(%rsp),%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
lea    0x230(%rsp),%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
lea    0xdee(%rip),%rdx
lea    0x30(%rsp),%rdi
mov    $0x200,%esi
mov    %rbp,%rcx
call   1080 <snprintf@plt>
lea    0xdde(%rip),%rdx
lea    0xa30(%rsp),%rdi
mov    $0x200,%esi
mov    %rbp,%rcx
call   1080 <snprintf@plt>
test   %r14d,%r14d
jne    126e <hash_index_file+0xae>
lea    0xdcb(%rip),%rdx
lea    0x1030(%rsp),%rbx
lea    0x30(%rsp),%rcx
mov    %rbx,%rdi
mov    $0x2710,%esi
call   1080 <snprintf@plt>
mov    %rbx,%rdi
call   1070 <system@plt>
lea    0xdb3(%rip),%rsi
lea    0xa30(%rsp),%rdi
call   10d0 <gzopen@plt>
mov    %rax,%rbx
lea    0xd9f(%rip),%rsi
lea    0x30(%rsp),%rdi
call   10d0 <gzopen@plt>
test   %rax,%rax
je     1332 <hash_index_file+0x172>
test   %rbx,%rbx
je     1353 <hash_index_file+0x193>
mov    %rax,%r15
mov    %rbx,0x10(%rsp)
lea    0x1030(%rsp),%rsi
mov    %rax,%rdi
mov    $0x2710,%edx
call   1050 <gzgets@plt>
mov    0x2d0c(%rip),%rcx
cmp    (%rcx),%rax
jne    1393 <hash_index_file+0x1d3>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0xdb5(%rip),%rsi
lea    0x630(%rsp),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
mov    0x10(%rsp),%rbx
je     131e <hash_index_file+0x15e>
lea    0xd8c(%rip),%rsi
lea    0x630(%rsp),%rdx
lea    0x230(%rsp),%rcx
mov    %rbx,%rdi
mov    0x8(%rsp),%r8
call   1060 <gzprintf@plt>
mov    %rbx,%rdi
call   1030 <gzclose@plt>
mov    %r15,%rdi
call   1030 <gzclose@plt>
xor    %eax,%eax
jmp    1381 <hash_index_file+0x1c1>
mov    0x2ca7(%rip),%rax
mov    (%rax),%ebx
lea    0x1030(%rsp),%rsi
xor    %edi,%edi
call   10b0 <gzerror@plt>
lea    0xcdc(%rip),%rsi
jmp    1372 <hash_index_file+0x1b2>
mov    0x2c86(%rip),%rax
mov    (%rax),%ebx
lea    0x1030(%rsp),%rsi
xor    %edi,%edi
call   10b0 <gzerror@plt>
lea    0xcdb(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   10a0 <fprintf@plt>
mov    $0xfffffffe,%eax
add    $0x3748,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movslq 0x4(%rsp),%rax
mov    %rax,0x18(%rsp)
xor    %r12d,%r12d
lea    0x1030(%rsp),%rbp
lea    0xc30(%rsp),%r14
lea    0x630(%rsp),%rbx
xor    %eax,%eax
mov    %rax,0x8(%rsp)
jmp    13ff <hash_index_file+0x23f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
add    $0x1,%r12
mov    %r15,%rdi
mov    %rbp,%rsi
mov    $0x2710,%edx
call   1050 <gzgets@plt>
mov    0x2be2(%rip),%rcx
cmp    (%rcx),%rax
je     12dc <hash_index_file+0x11c>
mov    %rbp,%rdi
lea    0xc63(%rip),%rsi
mov    %r14,%rdx
lea    0x20(%rsp),%rcx
lea    0x28(%rsp),%r8
call   10c0 <sscanf@plt>
mov    %r14,%rdi
lea    0xc54(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     13df <hash_index_file+0x21f>
mov    %r12,%rax
mov    0x18(%rsp),%rcx
or     %rcx,%rax
shr    $0x20,%rax
je     1450 <hash_index_file+0x290>
mov    %r12,%rax
cqto
idiv   %rcx
jmp    1459 <hash_index_file+0x299>
nopw   0x0(%rax,%rax,1)
mov    %r12d,%eax
xor    %edx,%edx
divl   0x4(%rsp)
lea    0xc38(%rip),%rsi
test   %rdx,%rdx
jne    14d1 <hash_index_file+0x311>
mov    %r15,%r13
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
lea    0x230(%rsp),%rbp
je     1499 <hash_index_file+0x2d9>
mov    0x10(%rsp),%rdi
lea    0xc04(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    0x8(%rsp),%r8
call   1060 <gzprintf@plt>
mov    %rbx,%rdi
lea    0xbf5(%rip),%r15
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    %r13,%rdi
call   10e0 <gztell@plt>
mov    %r15,%rsi
mov    %r13,%r15
mov    %rax,0x8(%rsp)
lea    0x1030(%rsp),%rbp
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     14ee <hash_index_file+0x32e>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jns    14f9 <hash_index_file+0x339>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
lea    0x230(%rsp),%r13
mov    %r13,%rdi
lea    0xb8d(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     13d0 <hash_index_file+0x210>
mov    %r14,%rdi
mov    %r13,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jg     13d0 <hash_index_file+0x210>
jmp    13db <hash_index_file+0x21b>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [9 x i8] c"%s.index\00"
@.str.2 = [14 x i8] c"%s.index.hash\00"
@.str.3 = [17 x i8] c"sort_index.sh %s\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.6 = [32 x i8] c"error opening gzfile_index :%s\0A\00"
@.str.7 = [31 x i8] c"error opening gzhash_file :%s\0A\00"
@Z_NULL = global i64 0
@.str.8 = [13 x i8] c"%s %lld %lld\00"
@.str.9 = [20 x i8] c"UMACOMPRESSEDFORMAT\00"
@.str.10 = [12 x i8] c"%s %s %lld\0A\00"
define i32 @hash_index_file(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [512 x i8]
%9 = alloca [512 x i8]
%10 = alloca [1024 x i8]
%11 = alloca i64
%12 = alloca i64
%13 = alloca [10000 x i8]
%14 = alloca i32
%15 = alloca i32
%16 = alloca [1024 x i8]
%17 = alloca [1024 x i8]
%18 = alloca i64
%19 = alloca i64
%20 = alloca [10000 x i8]
%21 = alloca i32*
%22 = alloca i32*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64 0, i64* %12
store i32 0, i32* %14
store i64 0, i64* %18
store i64 0, i64* %19
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%24 = call i32 @strcpy(i8* %23, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%28 = load i8*, i8** %5
%29 = call i32 @snprintf(i8* %27, i32 512, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%31 = load i8*, i8** %5
%32 = call i32 @snprintf(i8* %30, i32 512, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = load i32, i32* %7
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %41
35: ; preds = %3
%36 = getelementptr inbounds [10000 x i8], [10000 x i8]* %20, i64 0, i64 0
%37 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%38 = call i32 @snprintf(i8* %36, i32 10000, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %37)
%39 = getelementptr inbounds [10000 x i8], [10000 x i8]* %20, i64 0, i64 0
%40 = call i32 @system(i8* %39)
br label %41
41: ; preds = %35, %3
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%43 = call i32* @gzopen(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %43, i32** %21
%44 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%45 = call i32* @gzopen(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %45, i32** %22
%46 = load i32*, i32** %22
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %53
48: ; preds = %41
%49 = load i32, i32* @stderr
%50 = load i32*, i32** %22
%51 = call i8* @gzerror(i32* %50, i32* %15)
%52 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %51)
store i32 -2, i32* %4
br label %143
53: ; preds = %41
%54 = load i32*, i32** %21
%55 = icmp eq i32* %54, null
br i1 %55, label %56, label %61
56: ; preds = %53
%57 = load i32, i32* @stderr
%58 = load i32*, i32** %21
%59 = call i8* @gzerror(i32* %58, i32* %15)
%60 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %59)
store i32 -2, i32* %4
br label %143
61: ; preds = %53
br label %62
62: ; preds = %127, %61
%63 = load i32*, i32** %22
%64 = getelementptr inbounds [10000 x i8], [10000 x i8]* %13, i64 0, i64 0
%65 = call i64 @gzgets(i32* %63, i8* %64, i32 10000)
%66 = load i64, i64* @Z_NULL
%67 = icmp ne i64 %65, %66
br i1 %67, label %68, label %128
68: ; preds = %62
%69 = getelementptr inbounds [10000 x i8], [10000 x i8]* %13, i64 0, i64 0
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%71 = call i32 @sscanf(i8* %69, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %70, i64* %12, i64* %11)
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %127
75: ; preds = %68
%76 = load i64, i64* %19
%77 = load i32, i32* %6
%78 = sext i32 %77 to i64
%79 = srem i64 %76, %78
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %98
81: ; preds = %75
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%83 = call i64 @strcmp(i8* %82, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%84 = icmp ne i64 %83, 0
br i1 %84, label %85, label %91
85: ; preds = %81
%86 = load i32*, i32** %21
%87 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%89 = load i64, i64* %18
%90 = call i32 @gzprintf(i32* %86, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %87, i8* %88, i64 %89)
store i32 %90, i32* %14
br label %91
91: ; preds = %85, %81
%92 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%93 = call i32 @strcpy(i8* %92, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%94 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%95 = call i32 @strcpy(i8* %94, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%96 = load i32*, i32** %22
%97 = call i64 @gztell(i32* %96)
store i64 %97, i64* %18
br label %98
98: ; preds = %91, %75
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%100 = call i64 @strcmp(i8* %99, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%101 = icmp eq i64 %100, 0
br i1 %101, label %107, label %102
102: ; preds = %98
%103 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%105 = call i64 @strcmp(i8* %103, i8* %104)
%106 = icmp slt i64 %105, 0
br i1 %106, label %107, label %111
107: ; preds = %102, %98
%108 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%109 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%110 = call i32 @strcpy(i8* %108, i8* %109)
br label %111
111: ; preds = %107, %102
%112 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%113 = call i64 @strcmp(i8* %112, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%114 = icmp eq i64 %113, 0
br i1 %114, label %120, label %115
115: ; preds = %111
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%117 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%118 = call i64 @strcmp(i8* %116, i8* %117)
%119 = icmp sgt i64 %118, 0
br i1 %119, label %120, label %124
120: ; preds = %115, %111
%121 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%122 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%123 = call i32 @strcpy(i8* %121, i8* %122)
br label %124
124: ; preds = %120, %115
%125 = load i64, i64* %19
%126 = add nsw i64 %125, 1
store i64 %126, i64* %19
br label %127
127: ; preds = %124, %68
br label %62
128: ; preds = %62
%129 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%130 = call i64 @strcmp(i8* %129, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%131 = icmp ne i64 %130, 0
br i1 %131, label %132, label %138
132: ; preds = %128
%133 = load i32*, i32** %21
%134 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%135 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%136 = load i64, i64* %18
%137 = call i32 @gzprintf(i32* %133, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %134, i8* %135, i64 %136)
store i32 %137, i32* %14
br label %138
138: ; preds = %132, %128
%139 = load i32*, i32** %21
%140 = call i32 @gzclose(i32* %139)
%141 = load i32*, i32** %22
%142 = call i32 @gzclose(i32* %141)
store i32 0, i32* %4
br label %143
143: ; preds = %138, %56, %48
%144 = load i32, i32* %4
ret i32 %144
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [9 x i8] c"%s.index\00"
@.str.2 = [14 x i8] c"%s.index.hash\00"
@.str.3 = [17 x i8] c"sort_index.sh %s\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.6 = [32 x i8] c"error opening gzfile_index :%s\0A\00"
@.str.7 = [31 x i8] c"error opening gzhash_file :%s\0A\00"
@Z_NULL = global i64 0
@.str.8 = [13 x i8] c"%s %lld %lld\00"
@.str.9 = [20 x i8] c"UMACOMPRESSEDFORMAT\00"
@.str.10 = [12 x i8] c"%s %s %lld\0A\00"
define i32 @hash_index_file(i8* %0, i32 %1, i32 %2) {
%4 = alloca [512 x i8]
%5 = alloca [512 x i8]
%6 = alloca [1024 x i8]
%7 = alloca i64
%8 = alloca i64
%9 = alloca [10000 x i8]
%10 = alloca i32
%11 = alloca [1024 x i8]
%12 = alloca [1024 x i8]
%13 = alloca [10000 x i8]
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%17 = bitcast i64* %7 to i8*
%18 = bitcast i64* %8 to i8*
store i64 0, i64* %8
%19 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%20 = bitcast i32* %10 to i8*
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%23 = call i32 @strcpy(i8* %21, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @snprintf(i8* %15, i32 512, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%26 = call i32 @snprintf(i8* %14, i32 512, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%27 = icmp eq i32 %2, 0
br i1 %27, label %28, label %32
28: ; preds = %3
%29 = getelementptr inbounds [10000 x i8], [10000 x i8]* %13, i64 0, i64 0
%30 = call i32 @snprintf(i8* %29, i32 10000, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%31 = call i32 @system(i8* %29)
br label %32
32: ; preds = %28, %3
%33 = call i32* @gzopen(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%34 = call i32* @gzopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i32, i32* @stderr
%38 = call i8* @gzerror(i32* null, i32* %10)
%39 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %38)
br label %104
40: ; preds = %32
%41 = icmp eq i32* %33, null
br i1 %41, label %48, label %42
42: ; preds = %40
%43 = call i64 @gzgets(i32* %34, i8* %19, i32 10000)
%44 = load i64, i64* @Z_NULL
%45 = icmp eq i64 %43, %44
br i1 %45, label %95, label %46
46: ; preds = %42
%47 = sext i32 %1 to i64
br label %52
48: ; preds = %40
%49 = load i32, i32* @stderr
%50 = call i8* @gzerror(i32* null, i32* %10)
%51 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %50)
br label %104
52: ; preds = %46, %89
%53 = phi i64 [ 0, %46 ], [ %91, %89 ]
%54 = phi i64 [ 0, %46 ], [ %90, %89 ]
%55 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %16, i64* %8, i64* %7)
%56 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %89, label %58
58: ; preds = %52
%59 = srem i64 %53, %47
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %70
61: ; preds = %58
%62 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %61
%65 = call i32 @gzprintf(i32* %33, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %21, i8* %22, i64 %54)
br label %66
66: ; preds = %64, %61
%67 = call i32 @strcpy(i8* %21, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%68 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%69 = call i64 @gztell(i32* %34)
br label %70
70: ; preds = %66, %58
%71 = phi i64 [ %69, %66 ], [ %54, %58 ]
%72 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %77, label %74
74: ; preds = %70
%75 = call i64 @strcmp(i8* %16, i8* %21)
%76 = icmp slt i64 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %74, %70
%78 = call i32 @strcpy(i8* %21, i8* %16)
br label %79
79: ; preds = %77, %74
%80 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %85, label %82
82: ; preds = %79
%83 = call i64 @strcmp(i8* %16, i8* %22)
%84 = icmp sgt i64 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %82, %79
%86 = call i32 @strcpy(i8* %22, i8* %16)
br label %87
87: ; preds = %85, %82
%88 = add nsw i64 %53, 1
br label %89
89: ; preds = %87, %52
%90 = phi i64 [ %71, %87 ], [ %54, %52 ]
%91 = phi i64 [ %88, %87 ], [ %53, %52 ]
%92 = call i64 @gzgets(i32* %34, i8* %19, i32 10000)
%93 = load i64, i64* @Z_NULL
%94 = icmp eq i64 %92, %93
br i1 %94, label %95, label %52
95: ; preds = %89, %42
%96 = phi i64 [ 0, %42 ], [ %90, %89 ]
%97 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%98 = icmp eq i64 %97, 0
br i1 %98, label %101, label %99
99: ; preds = %95
%100 = call i32 @gzprintf(i32* %33, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %21, i8* %22, i64 %96)
br label %101
101: ; preds = %99, %95
%102 = call i32 @gzclose(i32* %33)
%103 = call i32 @gzclose(i32* %34)
br label %104
104: ; preds = %101, %48, %36
%105 = phi i32 [ -2, %36 ], [ -2, %48 ], [ 0, %101 ]
ret i32 %105
}