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

/* Variables and functions */
scalar_t__ GetFileLength(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rename(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char const *);
int /*<<< orphan*/ swap_phondata(char *, char *, char const *);
int /*<<< orphan*/ swap_phonindex(char *, char *);
int /*<<< orphan*/ swap_phontab(char *, char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  const char *indir = "/usr/share/espeak-data";
  const char *outdir = ".";
  const char *manifest = "phondata-manifest";
  char *f1, *f2;
  if (argc > 4)
    usage(argv[0]);
  if (argc > 1) {
    if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
      usage(argv[0]);
    indir = argv[1];
  }
  if (argc > 2)
    outdir = argv[2];
  if (argc > 3)
    manifest = argv[3];
  f1 = (char *)malloc(strlen(indir) + 20);
  if (f1 == NULL) {
    fprintf(stderr, "Unable to allocate memory\n");
    exit(1);
  }
  f2 = (char *)malloc(strlen(outdir) + 20);
  if (f2 == NULL) {
    fprintf(stderr, "Unable to allocate memory\n");
    exit(1);
  }
  printf("Host seems to be little-endian ..\n");
  sprintf(f1, "%s/phondata", indir);
  sprintf(f2, "%s/temp_1", outdir);
  printf("Processing phondata ..\n");
  swap_phondata(f1, f2, manifest);
  if (GetFileLength(f1) != GetFileLength(f2)) {
    fprintf(stderr, "Error: phondata length is different from the original\n");
    exit(1);
  }
  sprintf(f1, "%s/phondata", outdir);
  rename(f2, f1);
  sprintf(f1, "%s/phontab", indir);
  sprintf(f2, "%s/temp_1", outdir);
  printf("Processing phontab ..\n");
  swap_phontab(f1, f2);
  sprintf(f1, "%s/phontab", outdir);
  rename(f2, f1);
  sprintf(f1, "%s/phonindex", indir);
  sprintf(f2, "%s/temp_1", outdir);
  printf("Processing phonindex ..\n");
  swap_phonindex(f1, f2);
  sprintf(f1, "%s/phonindex", outdir);
  rename(f2, f1);
  free(f1);
  free(f2);
  printf("Done.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe03(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe0f(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe06(%rip),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x4,-0x8(%rbp)
jle    122d <main+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <usage@plt>
cmpl   $0x1,-0x8(%rbp)
jle    128b <main+0xab>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xde5(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     1273 <main+0x93>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdca(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    127f <main+0x9f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    12a1 <main+0xc1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    12b7 <main+0xd7>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x14,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12fa <main+0x11a>
mov    0x2cfe(%rip),%rax
mov    (%rax),%edi
lea    0xd4a(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x14,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    133d <main+0x15d>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
lea    0xd07(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0xd0c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd1b(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd13(%rip),%rsi
call   10f0 <sprintf@plt>
lea    0xd11(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   10c0 <swap_phondata@plt>
mov    -0x30(%rbp),%rdi
call   10e0 <GetFileLength@plt>
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
call   10e0 <GetFileLength@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
je     13d3 <main+0x1f3>
mov    0x2c25(%rip),%rax
mov    (%rax),%edi
lea    0xcdd(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xc91(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   10d0 <rename@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xcd5(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xc68(%rip),%rsi
call   10f0 <sprintf@plt>
lea    0xcc0(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <swap_phontab@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xc94(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   10d0 <rename@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xc95(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xc06(%rip),%rsi
call   10f0 <sprintf@plt>
lea    0xc82(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10b0 <swap_phonindex@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xc54(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   10d0 <rename@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
lea    0xc4f(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x5,%edi
jl     11ff <main+0x1f>
mov    (%rbx),%rdi
call   10a0 <usage@plt>
jmp    1204 <main+0x24>
cmp    $0x2,%ebp
jl     1252 <main+0x72>
mov    0x8(%rbx),%rdi
lea    0xe1a(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     122e <main+0x4e>
mov    0x8(%rbx),%rdi
lea    0xe08(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1236 <main+0x56>
mov    (%rbx),%rdi
call   10a0 <usage@plt>
mov    0x8(%rbx),%r14
lea    0xdd6(%rip),%r13
cmp    $0x3,%ebp
jb     1260 <main+0x80>
mov    0x10(%rbx),%r15
je     1267 <main+0x87>
mov    0x18(%rbx),%r13
jmp    1267 <main+0x87>
lea    0xdbe(%rip),%r13
lea    0xda0(%rip),%r14
lea    0xe83(%rip),%r15
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x14(%rax),%rdi
call   1090 <malloc@plt>
test   %rax,%rax
je     13fe <main+0x21e>
mov    %rax,%rbx
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0x14(%rax),%rdi
call   1090 <malloc@plt>
test   %rax,%rax
je     13fe <main+0x21e>
mov    %rax,%r12
lea    0xe0b(%rip),%rdi
call   1040 <puts@plt>
lea    0xd9a(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   10f0 <sprintf@plt>
lea    0xd94(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
call   10f0 <sprintf@plt>
lea    0xdfd(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   10c0 <swap_phondata@plt>
mov    %rbx,%rdi
call   10e0 <GetFileLength@plt>
mov    %rax,%rbp
mov    %r12,%rdi
call   10e0 <GetFileLength@plt>
cmp    %rax,%rbp
jne    1410 <main+0x230>
lea    0xd40(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
call   10f0 <sprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10d0 <rename@plt>
lea    0xd70(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   10f0 <sprintf@plt>
lea    0xd1a(%rip),%r13
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   10f0 <sprintf@plt>
lea    0xd97(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <swap_phontab@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
call   10f0 <sprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10d0 <rename@plt>
lea    0xd21(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   10f0 <sprintf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   10f0 <sprintf@plt>
lea    0xd5a(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10b0 <swap_phonindex@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
call   10f0 <sprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10d0 <rename@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
lea    0xd32(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bdb(%rip),%rax
mov    (%rax),%edi
lea    0xc25(%rip),%rsi
jmp    1420 <main+0x240>
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
lea    0xc44(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"/usr/share/espeak-data\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [18 x i8] c"phondata-manifest\00"
@.str.3 = [3 x i8] c"-h\00"
@.str.4 = [7 x i8] c"--help\00"
@stderr = global i32 0
@.str.5 = [27 x i8] c"Unable to allocate memory\0A\00"
@.str.6 = [35 x i8] c"Host seems to be little-endian ..\0A\00"
@.str.7 = [12 x i8] c"%s/phondata\00"
@.str.8 = [10 x i8] c"%s/temp_1\00"
@.str.9 = [24 x i8] c"Processing phondata ..\0A\00"
@.str.10 = [55 x i8] c"Error: phondata length is different from the original\0A\00"
@.str.11 = [11 x i8] c"%s/phontab\00"
@.str.12 = [23 x i8] c"Processing phontab ..\0A\00"
@.str.13 = [13 x i8] c"%s/phonindex\00"
@.str.14 = [25 x i8] c"Processing phonindex ..\0A\00"
@.str.15 = [7 x i8] c"Done.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8** %8
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 4
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @usage(i8* %16)
br label %18
18: ; preds = %13, %2
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 1
br i1 %20, label %21, label %42
21: ; preds = %18
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %33, label %27
27: ; preds = %21
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %27, %21
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 @usage(i8* %36)
br label %38
38: ; preds = %33, %27
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
store i8* %41, i8** %6
br label %42
42: ; preds = %38, %18
%43 = load i32, i32* %4
%44 = icmp sgt i32 %43, 2
br i1 %44, label %45, label %49
45: ; preds = %42
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
store i8* %48, i8** %7
br label %49
49: ; preds = %45, %42
%50 = load i32, i32* %4
%51 = icmp sgt i32 %50, 3
br i1 %51, label %52, label %56
52: ; preds = %49
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 3
%55 = load i8*, i8** %54
store i8* %55, i8** %8
br label %56
56: ; preds = %52, %49
%57 = load i8*, i8** %6
%58 = call i64 @strlen(i8* %57)
%59 = add nsw i64 %58, 20
%60 = call i64 @malloc(i64 %59)
%61 = inttoptr i64 %60 to i8*
store i8* %61, i8** %9
%62 = load i8*, i8** %9
%63 = icmp eq i8* %62, null
br i1 %63, label %64, label %68
64: ; preds = %56
%65 = load i32, i32* @stderr
%66 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %56
%69 = load i8*, i8** %7
%70 = call i64 @strlen(i8* %69)
%71 = add nsw i64 %70, 20
%72 = call i64 @malloc(i64 %71)
%73 = inttoptr i64 %72 to i8*
store i8* %73, i8** %10
%74 = load i8*, i8** %10
%75 = icmp eq i8* %74, null
br i1 %75, label %76, label %80
76: ; preds = %68
%77 = load i32, i32* @stderr
%78 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %68
%81 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%82 = load i8*, i8** %9
%83 = load i8*, i8** %6
%84 = call i32 @sprintf(i8* %82, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* %83)
%85 = load i8*, i8** %10
%86 = load i8*, i8** %7
%87 = call i32 @sprintf(i8* %85, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %86)
%88 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%89 = load i8*, i8** %9
%90 = load i8*, i8** %10
%91 = load i8*, i8** %8
%92 = call i32 @swap_phondata(i8* %89, i8* %90, i8* %91)
%93 = load i8*, i8** %9
%94 = call i64 @GetFileLength(i8* %93)
%95 = load i8*, i8** %10
%96 = call i64 @GetFileLength(i8* %95)
%97 = icmp ne i64 %94, %96
br i1 %97, label %98, label %102
98: ; preds = %80
%99 = load i32, i32* @stderr
%100 = call i32 @fprintf(i32 %99, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%101 = call i32 @exit(i32 1)
unreachable
102: ; preds = %80
%103 = load i8*, i8** %9
%104 = load i8*, i8** %7
%105 = call i32 @sprintf(i8* %103, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* %104)
%106 = load i8*, i8** %10
%107 = load i8*, i8** %9
%108 = call i32 @rename(i8* %106, i8* %107)
%109 = load i8*, i8** %9
%110 = load i8*, i8** %6
%111 = call i32 @sprintf(i8* %109, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %110)
%112 = load i8*, i8** %10
%113 = load i8*, i8** %7
%114 = call i32 @sprintf(i8* %112, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %113)
%115 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
%116 = load i8*, i8** %9
%117 = load i8*, i8** %10
%118 = call i32 @swap_phontab(i8* %116, i8* %117)
%119 = load i8*, i8** %9
%120 = load i8*, i8** %7
%121 = call i32 @sprintf(i8* %119, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %120)
%122 = load i8*, i8** %10
%123 = load i8*, i8** %9
%124 = call i32 @rename(i8* %122, i8* %123)
%125 = load i8*, i8** %9
%126 = load i8*, i8** %6
%127 = call i32 @sprintf(i8* %125, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i8* %126)
%128 = load i8*, i8** %10
%129 = load i8*, i8** %7
%130 = call i32 @sprintf(i8* %128, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %129)
%131 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0))
%132 = load i8*, i8** %9
%133 = load i8*, i8** %10
%134 = call i32 @swap_phonindex(i8* %132, i8* %133)
%135 = load i8*, i8** %9
%136 = load i8*, i8** %7
%137 = call i32 @sprintf(i8* %135, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i8* %136)
%138 = load i8*, i8** %10
%139 = load i8*, i8** %9
%140 = call i32 @rename(i8* %138, i8* %139)
%141 = load i8*, i8** %9
%142 = call i32 @free(i8* %141)
%143 = load i8*, i8** %10
%144 = call i32 @free(i8* %143)
%145 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"/usr/share/espeak-data\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [18 x i8] c"phondata-manifest\00"
@.str.3 = [3 x i8] c"-h\00"
@.str.4 = [7 x i8] c"--help\00"
@stderr = global i32 0
@.str.5 = [27 x i8] c"Unable to allocate memory\0A\00"
@.str.7 = [12 x i8] c"%s/phondata\00"
@.str.8 = [10 x i8] c"%s/temp_1\00"
@.str.10 = [55 x i8] c"Error: phondata length is different from the original\0A\00"
@.str.11 = [11 x i8] c"%s/phontab\00"
@.str.13 = [13 x i8] c"%s/phonindex\00"
@str = [34 x i8] c"Host seems to be little-endian ..\00"
@str.16 = [23 x i8] c"Processing phondata ..\00"
@str.17 = [22 x i8] c"Processing phontab ..\00"
@str.18 = [24 x i8] c"Processing phonindex ..\00"
@str.19 = [6 x i8] c"Done.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 4
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
br label %9
7: ; preds = %2
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %31
9: ; preds = %4, %7
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = load i8*, i8** %10
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14, %9
%19 = load i8*, i8** %1
%20 = tail call i32 @usage(i8* %19)
br label %21
21: ; preds = %14, %18
%22 = load i8*, i8** %10
%23 = icmp ugt i32 %0, 2
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = icmp eq i32 %0, 3
br i1 %27, label %31, label %28
28: ; preds = %24
%29 = getelementptr inbounds i8*, i8** %1, i64 3
%30 = load i8*, i8** %29
br label %31
31: ; preds = %7, %21, %28, %24
%32 = phi i8* [ %26, %28 ], [ %26, %24 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %21 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %7 ]
%33 = phi i8* [ %22, %28 ], [ %22, %24 ], [ %22, %21 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), %7 ]
%34 = phi i8* [ %30, %28 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), %24 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), %21 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), %7 ]
%35 = tail call i64 @strlen(i8* dereferenceable(1) %33)
%36 = add nsw i64 %35, 20
%37 = tail call i64 @malloc(i64 %36)
%38 = inttoptr i64 %37 to i8*
%39 = icmp eq i64 %37, 0
br i1 %39, label %40, label %44
40: ; preds = %31
%41 = load i32, i32* @stderr
%42 = tail call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%43 = tail call i32 @exit(i32 1)
unreachable
44: ; preds = %31
%45 = tail call i64 @strlen(i8* dereferenceable(1) %32)
%46 = add nsw i64 %45, 20
%47 = tail call i64 @malloc(i64 %46)
%48 = inttoptr i64 %47 to i8*
%49 = icmp eq i64 %47, 0
br i1 %49, label %50, label %54
50: ; preds = %44
%51 = load i32, i32* @stderr
%52 = tail call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%53 = tail call i32 @exit(i32 1)
unreachable
54: ; preds = %44
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%56 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* %33)
%57 = tail call i32 @sprintf(i8* %48, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %32)
%58 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.16, i64 0, i64 0))
%59 = tail call i32 @swap_phondata(i8* %38, i8* %48, i8* %34)
%60 = tail call i64 @GetFileLength(i8* %38)
%61 = tail call i64 @GetFileLength(i8* %48)
%62 = icmp eq i64 %60, %61
br i1 %62, label %67, label %63
63: ; preds = %54
%64 = load i32, i32* @stderr
%65 = tail call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%66 = tail call i32 @exit(i32 1)
unreachable
67: ; preds = %54
%68 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* %32)
%69 = tail call i32 @rename(i8* %48, i8* %38)
%70 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %33)
%71 = tail call i32 @sprintf(i8* %48, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %32)
%72 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.17, i64 0, i64 0))
%73 = tail call i32 @swap_phontab(i8* %38, i8* %48)
%74 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %32)
%75 = tail call i32 @rename(i8* %48, i8* %38)
%76 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i8* %33)
%77 = tail call i32 @sprintf(i8* %48, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %32)
%78 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.18, i64 0, i64 0))
%79 = tail call i32 @swap_phonindex(i8* %38, i8* %48)
%80 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i8* %32)
%81 = tail call i32 @rename(i8* %48, i8* %38)
%82 = tail call i32 @free(i8* %38)
%83 = tail call i32 @free(i8* %48)
%84 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.19, i64 0, i64 0))
ret i32 0
}