#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");
  printf("Reading from: %s\n", indir);
  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
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd19(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd11(%rip),%rsi
call   10f0 <sprintf@plt>
lea    0xd0f(%rip),%rdi
mov    $0x0,%al
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     13e9 <main+0x209>
mov    0x2c0f(%rip),%rax
mov    (%rax),%edi
lea    0xcd9(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xc8d(%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    0xcd1(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xc64(%rip),%rsi
call   10f0 <sprintf@plt>
lea    0xcbc(%rip),%rdi
mov    $0x0,%al
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    0xc8e(%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    0xc8f(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xc00(%rip),%rsi
call   10f0 <sprintf@plt>
lea    0xc7c(%rip),%rdi
mov    $0x0,%al
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    0xc4c(%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    0xc47(%rip),%rdi
mov    $0x0,%al
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     120f <main+0x1f>
mov    (%rbx),%rdi
call   10b0 <usage@plt>
jmp    1214 <main+0x24>
cmp    $0x2,%ebp
jl     1262 <main+0x72>
mov    0x8(%rbx),%rdi
lea    0xe0a(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     123e <main+0x4e>
mov    0x8(%rbx),%rdi
lea    0xdf8(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1246 <main+0x56>
mov    (%rbx),%rdi
call   10b0 <usage@plt>
mov    0x8(%rbx),%r14
lea    0xdc6(%rip),%r13
cmp    $0x3,%ebp
jb     1270 <main+0x80>
mov    0x10(%rbx),%r15
je     1277 <main+0x87>
mov    0x18(%rbx),%r13
jmp    1277 <main+0x87>
lea    0xdae(%rip),%r13
lea    0xd90(%rip),%r14
lea    0xe85(%rip),%r15
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x14(%rax),%rdi
call   10a0 <malloc@plt>
test   %rax,%rax
je     141f <main+0x22f>
mov    %rax,%rbx
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0x14(%rax),%rdi
call   10a0 <malloc@plt>
test   %rax,%rax
je     141f <main+0x22f>
mov    %rax,%r12
lea    0xe0d(%rip),%rdi
call   1040 <puts@plt>
lea    0xd8a(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd8b(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1100 <sprintf@plt>
lea    0xd85(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
call   1100 <sprintf@plt>
lea    0xdee(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   10d0 <swap_phondata@plt>
mov    %rbx,%rdi
call   10f0 <GetFileLength@plt>
mov    %rax,%rbp
mov    %r12,%rdi
call   10f0 <GetFileLength@plt>
cmp    %rax,%rbp
jne    1431 <main+0x241>
lea    0xd31(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
call   1100 <sprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10e0 <rename@plt>
lea    0xd61(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1100 <sprintf@plt>
lea    0xd0b(%rip),%r13
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1100 <sprintf@plt>
lea    0xd88(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <swap_phontab@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
call   1100 <sprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10e0 <rename@plt>
lea    0xd12(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1100 <sprintf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1100 <sprintf@plt>
lea    0xd4b(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10c0 <swap_phonindex@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
call   1100 <sprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10e0 <rename@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
lea    0xd23(%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    0x2bba(%rip),%rax
mov    (%rax),%edi
lea    0xc04(%rip),%rsi
jmp    1441 <main+0x251>
mov    0x2ba8(%rip),%rax
mov    (%rax),%edi
lea    0xc35(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <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 = [18 x i8] c"Reading from: %s\0A\00"
@.str.8 = [12 x i8] c"%s/phondata\00"
@.str.9 = [10 x i8] c"%s/temp_1\00"
@.str.10 = [24 x i8] c"Processing phondata ..\0A\00"
@.str.11 = [55 x i8] c"Error: phondata length is different from the original\0A\00"
@.str.12 = [11 x i8] c"%s/phontab\00"
@.str.13 = [23 x i8] c"Processing phontab ..\0A\00"
@.str.14 = [13 x i8] c"%s/phonindex\00"
@.str.15 = [25 x i8] c"Processing phonindex ..\0A\00"
@.str.16 = [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 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%82 = load i8*, i8** %6
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %82)
%84 = load i8*, i8** %9
%85 = load i8*, i8** %6
%86 = call i32 @sprintf(i8* %84, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %85)
%87 = load i8*, i8** %10
%88 = load i8*, i8** %7
%89 = call i32 @sprintf(i8* %87, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %88)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%91 = load i8*, i8** %9
%92 = load i8*, i8** %10
%93 = load i8*, i8** %8
%94 = call i32 @swap_phondata(i8* %91, i8* %92, i8* %93)
%95 = load i8*, i8** %9
%96 = call i64 @GetFileLength(i8* %95)
%97 = load i8*, i8** %10
%98 = call i64 @GetFileLength(i8* %97)
%99 = icmp ne i64 %96, %98
br i1 %99, label %100, label %104
100: ; preds = %80
%101 = load i32, i32* @stderr
%102 = call i32 @fprintf(i32 %101, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.11, i64 0, i64 0))
%103 = call i32 @exit(i32 1)
unreachable
104: ; preds = %80
%105 = load i8*, i8** %9
%106 = load i8*, i8** %7
%107 = call i32 @sprintf(i8* %105, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %106)
%108 = load i8*, i8** %10
%109 = load i8*, i8** %9
%110 = call i32 @rename(i8* %108, i8* %109)
%111 = load i8*, i8** %9
%112 = load i8*, i8** %6
%113 = call i32 @sprintf(i8* %111, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %112)
%114 = load i8*, i8** %10
%115 = load i8*, i8** %7
%116 = call i32 @sprintf(i8* %114, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %115)
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
%118 = load i8*, i8** %9
%119 = load i8*, i8** %10
%120 = call i32 @swap_phontab(i8* %118, i8* %119)
%121 = load i8*, i8** %9
%122 = load i8*, i8** %7
%123 = call i32 @sprintf(i8* %121, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %122)
%124 = load i8*, i8** %10
%125 = load i8*, i8** %9
%126 = call i32 @rename(i8* %124, i8* %125)
%127 = load i8*, i8** %9
%128 = load i8*, i8** %6
%129 = call i32 @sprintf(i8* %127, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8* %128)
%130 = load i8*, i8** %10
%131 = load i8*, i8** %7
%132 = call i32 @sprintf(i8* %130, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %131)
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0))
%134 = load i8*, i8** %9
%135 = load i8*, i8** %10
%136 = call i32 @swap_phonindex(i8* %134, i8* %135)
%137 = load i8*, i8** %9
%138 = load i8*, i8** %7
%139 = call i32 @sprintf(i8* %137, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8* %138)
%140 = load i8*, i8** %10
%141 = load i8*, i8** %9
%142 = call i32 @rename(i8* %140, i8* %141)
%143 = load i8*, i8** %9
%144 = call i32 @free(i8* %143)
%145 = load i8*, i8** %10
%146 = call i32 @free(i8* %145)
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, 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 = [18 x i8] c"Reading from: %s\0A\00"
@.str.8 = [12 x i8] c"%s/phondata\00"
@.str.9 = [10 x i8] c"%s/temp_1\00"
@.str.11 = [55 x i8] c"Error: phondata length is different from the original\0A\00"
@.str.12 = [11 x i8] c"%s/phontab\00"
@.str.14 = [13 x i8] c"%s/phonindex\00"
@str = [34 x i8] c"Host seems to be little-endian ..\00"
@str.17 = [23 x i8] c"Processing phondata ..\00"
@str.18 = [22 x i8] c"Processing phontab ..\00"
@str.19 = [24 x i8] c"Processing phonindex ..\00"
@str.20 = [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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %33)
%57 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %33)
%58 = tail call i32 @sprintf(i8* %48, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %32)
%59 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.17, i64 0, i64 0))
%60 = tail call i32 @swap_phondata(i8* %38, i8* %48, i8* %34)
%61 = tail call i64 @GetFileLength(i8* %38)
%62 = tail call i64 @GetFileLength(i8* %48)
%63 = icmp eq i64 %61, %62
br i1 %63, label %68, label %64
64: ; preds = %54
%65 = load i32, i32* @stderr
%66 = tail call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.11, i64 0, i64 0))
%67 = tail call i32 @exit(i32 1)
unreachable
68: ; preds = %54
%69 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %32)
%70 = tail call i32 @rename(i8* %48, i8* %38)
%71 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %33)
%72 = tail call i32 @sprintf(i8* %48, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %32)
%73 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.18, i64 0, i64 0))
%74 = tail call i32 @swap_phontab(i8* %38, i8* %48)
%75 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %32)
%76 = tail call i32 @rename(i8* %48, i8* %38)
%77 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8* %33)
%78 = tail call i32 @sprintf(i8* %48, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %32)
%79 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.19, i64 0, i64 0))
%80 = tail call i32 @swap_phonindex(i8* %38, i8* %48)
%81 = tail call i32 @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8* %32)
%82 = tail call i32 @rename(i8* %48, i8* %38)
%83 = tail call i32 @free(i8* %38)
%84 = tail call i32 @free(i8* %48)
%85 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.20, i64 0, i64 0))
ret i32 0
}