#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 /*<<< orphan*/ GenHomeLocation(int /*<<< orphan*/ *);
int /*<<< orphan*/ GenKeyWordList(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ GenTopicHeir(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ GenTopicList(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ GenTopicLoc(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ LC_ALL;
int /*<<< orphan*/ MergeMetaInfo(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
char *malloc(scalar_t__);
int /*<<< orphan*/ perror(int /*<<< orphan*/ *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
void main(int argc, char **argv) {
  char *fName;
  FILE *tlocFile, *heirFile, *keyFile, *metaFile;
  FILE *volFile, *keyWordFile;
  setlocale(LC_ALL, "");
  if (argc < 2) {
    fprintf(stderr, "usage: %s <volume-name>\n", *argv);
    exit(1);
  }
  fName = malloc(strlen(*(argv + 1)) + strlen(".tpc") + 1);
  strcpy(fName, *(argv + 1));
  strcat(fName, ".tpc");
  if ((heirFile = fopen(fName, "r")) == NULL) {
    fprintf(stderr, "%s: error opening heirarchy file %s for reading\n", *argv,
            fName);
    perror(NULL);
    exit(1);
  }
  fName = malloc(strlen(*(argv + 1)) + strlen(".idt") + 1);
  strcpy(fName, *(argv + 1));
  strcat(fName, ".idt");
  if ((tlocFile = fopen(fName, "r")) == NULL) {
    fprintf(stderr, "%s: error opening topic location file %s for reading\n",
            *argv, fName);
    perror(NULL);
    exit(1);
  }
  fName = malloc(strlen(*(argv + 1)) + strlen(".idx") + 1);
  strcpy(fName, *(argv + 1));
  strcat(fName, ".idx");
  if ((keyFile = fopen(fName, "r")) == NULL) {
    fprintf(stderr, "%s: error opening keyword file %s for reading\n", *argv,
            fName);
    perror(NULL);
    exit(1);
  }
  fName = malloc(strlen(*(argv + 1)) + strlen(".hmi") + 1);
  strcpy(fName, *(argv + 1));
  strcat(fName, ".hmi");
  if ((metaFile = fopen(fName, "r")) == NULL) {
    fprintf(stderr, "%s: error opening meta file %s for reading\n", *argv,
            fName);
    perror(NULL);
    exit(1);
  }
  fName = malloc(strlen(*(argv + 1)) + strlen(".hv") + 1);
  strcpy(fName, *(argv + 1));
  strcat(fName, ".hv");
  if ((volFile = fopen(fName, "w")) == NULL) {
    fprintf(stderr, "%s: error opening Volume file %s for writing\n", *argv,
            fName);
    perror(NULL);
    exit(1);
  }
  fName = malloc(strlen(*(argv + 1)) + strlen(".hvk") + 1);
  strcpy(fName, *(argv + 1));
  strcat(fName, ".hvk");
  if ((keyWordFile = fopen(fName, "w")) == NULL) {
    fprintf(stderr, "%s: error opening Keyword file %s for writing\n", *argv,
            fName);
    perror(NULL);
    exit(1);
  }
  GenTopicList(heirFile, volFile);
  GenTopicHeir(heirFile, volFile);
  GenTopicLoc(tlocFile, volFile);
  GenKeyWordList(keyFile, keyWordFile);
  MergeMetaInfo(metaFile, volFile);
  GenHomeLocation(volFile);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
lea    0xe06(%rip),%rsi
call   10c0 <setlocale@plt>
cmpl   $0x2,-0x4(%rbp)
jge    1249 <main+0x59>
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdc8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x50(%rbp)
lea    0xdb8(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x50(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xd83(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xd78(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    12ee <main+0xfe>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
lea    0xd4c(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x58(%rbp)
lea    0xd4b(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x58(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xd16(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xcd3(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1393 <main+0x1a3>
mov    0x2c7b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
lea    0xcdd(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x60(%rbp)
lea    0xce1(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x60(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xcac(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xc2e(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    1438 <main+0x248>
mov    0x2bd6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
lea    0xc73(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x68(%rbp)
lea    0xc70(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x68(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xc3b(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xb89(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    14dd <main+0x2ed>
mov    0x2b31(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
lea    0xc02(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x70(%rbp)
lea    0xbfc(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x70(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xbc7(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xbbb(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1582 <main+0x392>
mov    0x2a8c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
lea    0xb8f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x78(%rbp)
lea    0xb8b(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x78(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xb56(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xb16(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1627 <main+0x437>
mov    0x29e7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
lea    0xb1d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1070 <GenTopicList@plt>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10d0 <GenTopicHeir@plt>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1080 <GenTopicLoc@plt>
mov    -0x30(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1040 <GenKeyWordList@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1050 <MergeMetaInfo@plt>
mov    -0x40(%rbp),%rdi
call   10b0 <GenHomeLocation@plt>
xor    %edi,%edi
call   1110 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
mov    %edi,%ebp
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
lea    0xe05(%rip),%rsi
call   10c0 <setlocale@plt>
cmp    $0x1,%ebp
jg     1242 <main+0x52>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xdcf(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x8(%r13),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x5(%rax),%rdi
call   10a0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xdad(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strcat@plt>
lea    0xda3(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
jne    12a1 <main+0xb1>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xd84(%rip),%rsi
jmp    1487 <main+0x297>
mov    %rax,%r14
mov    0x8(%r13),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x5(%rax),%rdi
call   10a0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xd83(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strcat@plt>
lea    0xd41(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
jne    1303 <main+0x113>
mov    0x2cef(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xd58(%rip),%rsi
jmp    1487 <main+0x297>
mov    %rax,%r15
mov    0x8(%r13),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x5(%rax),%rdi
call   10a0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xd5c(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strcat@plt>
lea    0xcdf(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
jne    1365 <main+0x175>
mov    0x2c8d(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xd31(%rip),%rsi
jmp    1487 <main+0x297>
mov    %rax,%r12
mov    0x8(%r13),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x5(%rax),%rdi
call   10a0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xd2e(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strcat@plt>
lea    0xc7d(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
jne    13c7 <main+0x1d7>
mov    0x2c2b(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xd03(%rip),%rsi
jmp    1487 <main+0x297>
mov    %rax,0x10(%rsp)
mov    0x8(%r13),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x4(%rax),%rdi
call   10a0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xcfb(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strcat@plt>
lea    0xcf0(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
jne    1428 <main+0x238>
mov    0x2bc7(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xcd1(%rip),%rsi
jmp    1487 <main+0x297>
mov    %rax,0x8(%rsp)
mov    0x8(%r13),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x5(%rax),%rdi
call   10a0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xcce(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strcat@plt>
lea    0xc8f(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
jne    14a2 <main+0x2b2>
mov    0x2b66(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xca3(%rip),%rsi
mov    %rbp,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    %r14,%rdi
mov    0x8(%rsp),%rbx
mov    %rbx,%rsi
mov    %rax,%rbp
call   1070 <GenTopicList@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10d0 <GenTopicHeir@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <GenTopicLoc@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1040 <GenKeyWordList@plt>
mov    0x10(%rsp),%rdi
mov    %rbx,%rsi
call   1050 <MergeMetaInfo@plt>
mov    %rbx,%rdi
call   10b0 <GenHomeLocation@plt>
xor    %edi,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [25 x i8] c"usage: %s <volume-name>\0A\00"
@.str.2 = [5 x i8] c".tpc\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [49 x i8] c"%s: error opening heirarchy file %s for reading\0A\00"
@.str.5 = [5 x i8] c".idt\00"
@.str.6 = [54 x i8] c"%s: error opening topic location file %s for reading\0A\00"
@.str.7 = [5 x i8] c".idx\00"
@.str.8 = [47 x i8] c"%s: error opening keyword file %s for reading\0A\00"
@.str.9 = [5 x i8] c".hmi\00"
@.str.10 = [44 x i8] c"%s: error opening meta file %s for reading\0A\00"
@.str.11 = [4 x i8] c".hv\00"
@.str.12 = [2 x i8] c"w\00"
@.str.13 = [46 x i8] c"%s: error opening Volume file %s for writing\0A\00"
@.str.14 = [5 x i8] c".hvk\00"
@.str.15 = [47 x i8] c"%s: error opening Keyword file %s for writing\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%12 = load i32, i32* @LC_ALL
%13 = call i32 @setlocale(i32 %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %4
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i64 @strlen(i8* %25)
%27 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%28 = add nsw i64 %26, %27
%29 = add nsw i64 %28, 1
%30 = call i8* @malloc(i64 %29)
store i8* %30, i8** %5
%31 = load i8*, i8** %5
%32 = load i8**, i8*** %4
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @strcpy(i8* %31, i8* %34)
%36 = load i8*, i8** %5
%37 = call i32 @strcat(i8* %36, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%38 = load i8*, i8** %5
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %39, i32** %7
%40 = icmp eq i32* %39, null
br i1 %40, label %41, label %49
41: ; preds = %22
%42 = load i32, i32* @stderr
%43 = load i8**, i8*** %4
%44 = load i8*, i8** %43
%45 = load i8*, i8** %5
%46 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i8* %44, i8* %45)
%47 = call i32 @perror(i32* null)
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %22
%50 = load i8**, i8*** %4
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = call i64 @strlen(i8* %52)
%54 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%55 = add nsw i64 %53, %54
%56 = add nsw i64 %55, 1
%57 = call i8* @malloc(i64 %56)
store i8* %57, i8** %5
%58 = load i8*, i8** %5
%59 = load i8**, i8*** %4
%60 = getelementptr inbounds i8*, i8** %59, i64 1
%61 = load i8*, i8** %60
%62 = call i32 @strcpy(i8* %58, i8* %61)
%63 = load i8*, i8** %5
%64 = call i32 @strcat(i8* %63, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%65 = load i8*, i8** %5
%66 = call i32* @fopen(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %66, i32** %6
%67 = icmp eq i32* %66, null
br i1 %67, label %68, label %76
68: ; preds = %49
%69 = load i32, i32* @stderr
%70 = load i8**, i8*** %4
%71 = load i8*, i8** %70
%72 = load i8*, i8** %5
%73 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i8* %71, i8* %72)
%74 = call i32 @perror(i32* null)
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %49
%77 = load i8**, i8*** %4
%78 = getelementptr inbounds i8*, i8** %77, i64 1
%79 = load i8*, i8** %78
%80 = call i64 @strlen(i8* %79)
%81 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%82 = add nsw i64 %80, %81
%83 = add nsw i64 %82, 1
%84 = call i8* @malloc(i64 %83)
store i8* %84, i8** %5
%85 = load i8*, i8** %5
%86 = load i8**, i8*** %4
%87 = getelementptr inbounds i8*, i8** %86, i64 1
%88 = load i8*, i8** %87
%89 = call i32 @strcpy(i8* %85, i8* %88)
%90 = load i8*, i8** %5
%91 = call i32 @strcat(i8* %90, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%92 = load i8*, i8** %5
%93 = call i32* @fopen(i8* %92, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %93, i32** %8
%94 = icmp eq i32* %93, null
br i1 %94, label %95, label %103
95: ; preds = %76
%96 = load i32, i32* @stderr
%97 = load i8**, i8*** %4
%98 = load i8*, i8** %97
%99 = load i8*, i8** %5
%100 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), i8* %98, i8* %99)
%101 = call i32 @perror(i32* null)
%102 = call i32 @exit(i32 1)
unreachable
103: ; preds = %76
%104 = load i8**, i8*** %4
%105 = getelementptr inbounds i8*, i8** %104, i64 1
%106 = load i8*, i8** %105
%107 = call i64 @strlen(i8* %106)
%108 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%109 = add nsw i64 %107, %108
%110 = add nsw i64 %109, 1
%111 = call i8* @malloc(i64 %110)
store i8* %111, i8** %5
%112 = load i8*, i8** %5
%113 = load i8**, i8*** %4
%114 = getelementptr inbounds i8*, i8** %113, i64 1
%115 = load i8*, i8** %114
%116 = call i32 @strcpy(i8* %112, i8* %115)
%117 = load i8*, i8** %5
%118 = call i32 @strcat(i8* %117, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%119 = load i8*, i8** %5
%120 = call i32* @fopen(i8* %119, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %120, i32** %9
%121 = icmp eq i32* %120, null
br i1 %121, label %122, label %130
122: ; preds = %103
%123 = load i32, i32* @stderr
%124 = load i8**, i8*** %4
%125 = load i8*, i8** %124
%126 = load i8*, i8** %5
%127 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0), i8* %125, i8* %126)
%128 = call i32 @perror(i32* null)
%129 = call i32 @exit(i32 1)
unreachable
130: ; preds = %103
%131 = load i8**, i8*** %4
%132 = getelementptr inbounds i8*, i8** %131, i64 1
%133 = load i8*, i8** %132
%134 = call i64 @strlen(i8* %133)
%135 = call i64 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%136 = add nsw i64 %134, %135
%137 = add nsw i64 %136, 1
%138 = call i8* @malloc(i64 %137)
store i8* %138, i8** %5
%139 = load i8*, i8** %5
%140 = load i8**, i8*** %4
%141 = getelementptr inbounds i8*, i8** %140, i64 1
%142 = load i8*, i8** %141
%143 = call i32 @strcpy(i8* %139, i8* %142)
%144 = load i8*, i8** %5
%145 = call i32 @strcat(i8* %144, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%146 = load i8*, i8** %5
%147 = call i32* @fopen(i8* %146, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i32* %147, i32** %10
%148 = icmp eq i32* %147, null
br i1 %148, label %149, label %157
149: ; preds = %130
%150 = load i32, i32* @stderr
%151 = load i8**, i8*** %4
%152 = load i8*, i8** %151
%153 = load i8*, i8** %5
%154 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %150, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.13, i64 0, i64 0), i8* %152, i8* %153)
%155 = call i32 @perror(i32* null)
%156 = call i32 @exit(i32 1)
unreachable
157: ; preds = %130
%158 = load i8**, i8*** %4
%159 = getelementptr inbounds i8*, i8** %158, i64 1
%160 = load i8*, i8** %159
%161 = call i64 @strlen(i8* %160)
%162 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%163 = add nsw i64 %161, %162
%164 = add nsw i64 %163, 1
%165 = call i8* @malloc(i64 %164)
store i8* %165, i8** %5
%166 = load i8*, i8** %5
%167 = load i8**, i8*** %4
%168 = getelementptr inbounds i8*, i8** %167, i64 1
%169 = load i8*, i8** %168
%170 = call i32 @strcpy(i8* %166, i8* %169)
%171 = load i8*, i8** %5
%172 = call i32 @strcat(i8* %171, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%173 = load i8*, i8** %5
%174 = call i32* @fopen(i8* %173, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i32* %174, i32** %11
%175 = icmp eq i32* %174, null
br i1 %175, label %176, label %184
176: ; preds = %157
%177 = load i32, i32* @stderr
%178 = load i8**, i8*** %4
%179 = load i8*, i8** %178
%180 = load i8*, i8** %5
%181 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %177, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.15, i64 0, i64 0), i8* %179, i8* %180)
%182 = call i32 @perror(i32* null)
%183 = call i32 @exit(i32 1)
unreachable
184: ; preds = %157
%185 = load i32*, i32** %7
%186 = load i32*, i32** %10
%187 = call i32 @GenTopicList(i32* %185, i32* %186)
%188 = load i32*, i32** %7
%189 = load i32*, i32** %10
%190 = call i32 @GenTopicHeir(i32* %188, i32* %189)
%191 = load i32*, i32** %6
%192 = load i32*, i32** %10
%193 = call i32 @GenTopicLoc(i32* %191, i32* %192)
%194 = load i32*, i32** %8
%195 = load i32*, i32** %11
%196 = call i32 @GenKeyWordList(i32* %194, i32* %195)
%197 = load i32*, i32** %9
%198 = load i32*, i32** %10
%199 = call i32 @MergeMetaInfo(i32* %197, i32* %198)
%200 = load i32*, i32** %10
%201 = call i32 @GenHomeLocation(i32* %200)
%202 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [25 x i8] c"usage: %s <volume-name>\0A\00"
@.str.2 = [5 x i8] c".tpc\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [49 x i8] c"%s: error opening heirarchy file %s for reading\0A\00"
@.str.5 = [5 x i8] c".idt\00"
@.str.6 = [54 x i8] c"%s: error opening topic location file %s for reading\0A\00"
@.str.7 = [5 x i8] c".idx\00"
@.str.8 = [47 x i8] c"%s: error opening keyword file %s for reading\0A\00"
@.str.9 = [5 x i8] c".hmi\00"
@.str.10 = [44 x i8] c"%s: error opening meta file %s for reading\0A\00"
@.str.11 = [4 x i8] c".hv\00"
@.str.12 = [2 x i8] c"w\00"
@.str.13 = [46 x i8] c"%s: error opening Volume file %s for writing\0A\00"
@.str.14 = [5 x i8] c".hvk\00"
@.str.15 = [47 x i8] c"%s: error opening Keyword file %s for writing\0A\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @LC_ALL
%4 = tail call i32 @setlocale(i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i64 @strlen(i8* dereferenceable(1) %13)
%15 = add nsw i64 %14, 5
%16 = tail call i8* @malloc(i64 %15)
%17 = tail call i32 @strcpy(i8* %16, i8* %13)
%18 = tail call i32 @strcat(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %27
21: ; preds = %11
%22 = load i32, i32* @stderr
%23 = load i8*, i8** %1
%24 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i8* %23, i8* %16)
%25 = tail call i32 @perror(i32* null)
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %11
%28 = load i8*, i8** %12
%29 = tail call i64 @strlen(i8* dereferenceable(1) %28)
%30 = add nsw i64 %29, 5
%31 = tail call i8* @malloc(i64 %30)
%32 = tail call i32 @strcpy(i8* %31, i8* %28)
%33 = tail call i32 @strcat(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%34 = tail call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %42
36: ; preds = %27
%37 = load i32, i32* @stderr
%38 = load i8*, i8** %1
%39 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i8* %38, i8* %31)
%40 = tail call i32 @perror(i32* null)
%41 = tail call i32 @exit(i32 1)
unreachable
42: ; preds = %27
%43 = load i8*, i8** %12
%44 = tail call i64 @strlen(i8* dereferenceable(1) %43)
%45 = add nsw i64 %44, 5
%46 = tail call i8* @malloc(i64 %45)
%47 = tail call i32 @strcpy(i8* %46, i8* %43)
%48 = tail call i32 @strcat(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%49 = tail call i32* @fopen(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%50 = icmp eq i32* %49, null
br i1 %50, label %51, label %57
51: ; preds = %42
%52 = load i32, i32* @stderr
%53 = load i8*, i8** %1
%54 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), i8* %53, i8* %46)
%55 = tail call i32 @perror(i32* null)
%56 = tail call i32 @exit(i32 1)
unreachable
57: ; preds = %42
%58 = load i8*, i8** %12
%59 = tail call i64 @strlen(i8* dereferenceable(1) %58)
%60 = add nsw i64 %59, 5
%61 = tail call i8* @malloc(i64 %60)
%62 = tail call i32 @strcpy(i8* %61, i8* %58)
%63 = tail call i32 @strcat(i8* %61, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%64 = tail call i32* @fopen(i8* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%65 = icmp eq i32* %64, null
br i1 %65, label %66, label %72
66: ; preds = %57
%67 = load i32, i32* @stderr
%68 = load i8*, i8** %1
%69 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0), i8* %68, i8* %61)
%70 = tail call i32 @perror(i32* null)
%71 = tail call i32 @exit(i32 1)
unreachable
72: ; preds = %57
%73 = load i8*, i8** %12
%74 = tail call i64 @strlen(i8* dereferenceable(1) %73)
%75 = add nsw i64 %74, 4
%76 = tail call i8* @malloc(i64 %75)
%77 = tail call i32 @strcpy(i8* %76, i8* %73)
%78 = tail call i32 @strcat(i8* %76, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%79 = tail call i32* @fopen(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%80 = icmp eq i32* %79, null
br i1 %80, label %81, label %87
81: ; preds = %72
%82 = load i32, i32* @stderr
%83 = load i8*, i8** %1
%84 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.13, i64 0, i64 0), i8* %83, i8* %76)
%85 = tail call i32 @perror(i32* null)
%86 = tail call i32 @exit(i32 1)
unreachable
87: ; preds = %72
%88 = load i8*, i8** %12
%89 = tail call i64 @strlen(i8* dereferenceable(1) %88)
%90 = add nsw i64 %89, 5
%91 = tail call i8* @malloc(i64 %90)
%92 = tail call i32 @strcpy(i8* %91, i8* %88)
%93 = tail call i32 @strcat(i8* %91, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%94 = tail call i32* @fopen(i8* %91, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%95 = icmp eq i32* %94, null
br i1 %95, label %96, label %102
96: ; preds = %87
%97 = load i32, i32* @stderr
%98 = load i8*, i8** %1
%99 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.15, i64 0, i64 0), i8* %98, i8* %91)
%100 = tail call i32 @perror(i32* null)
%101 = tail call i32 @exit(i32 1)
unreachable
102: ; preds = %87
%103 = tail call i32 @GenTopicList(i32* %19, i32* %79)
%104 = tail call i32 @GenTopicHeir(i32* %19, i32* %79)
%105 = tail call i32 @GenTopicLoc(i32* %34, i32* %79)
%106 = tail call i32 @GenKeyWordList(i32* %49, i32* %94)
%107 = tail call i32 @MergeMetaInfo(i32* %64, i32* %79)
%108 = tail call i32 @GenHomeLocation(i32* %79)
%109 = tail call i32 @exit(i32 0)
unreachable
}