#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 uint;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int compressDataExt(unsigned char *, int, char *);
int /*<<< orphan*/ createLzmaExt(unsigned char *, int, void *);
int /*<<< orphan*/ decodeLzma(void *, unsigned char **, int *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fread(unsigned char *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ freeLzmaStruct(void *);
int /*<<< orphan*/ fwrite(unsigned char *, int, size_t, int /*<<< orphan*/ *);
scalar_t__ getfileSize(char *);
int /*<<< orphan*/ initLzmaStruct(void **);
int /*<<< orphan*/ loadDataExt(unsigned char **, int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ readBuffLzmaStruct(unsigned char *, int, void *);
int sizeBytesLzmaStruct(void *);
int /*<<< orphan*/ stderr;
int writeBuffLzmaStruct(unsigned char *, int, void *);
int main(int argc, const char *argv[]) {
  FILE *inFile = 0;
  uint inFileSize, outFileSize;
  unsigned char *inBuffer, *outBuffer;
  unsigned char *bcs;
  void *lzmadata, *lzmadata2;
  FILE *outFile = 0;
  int res;
  initLzmaStruct(&lzmadata);
  initLzmaStruct(&lzmadata2);
  printf(
      "\nLZMA Compressor/decompressor test lib \n 4.26 Copyright (c) 1999-2005 "
      "Igor Pavlov  2005-08-05, modified by Antonio Fariña (2009-09-09)\n");
  if (argc != 4) {
    printf("\nUsage:  farilzmaTest srcFile filelzma.unc  path2lzmaEncoder \n");
    return 1;
  }
  bcs = inBuffer = outBuffer = NULL;
  inFileSize = (uint)getfileSize((char *)argv[1]);
  inBuffer = (unsigned char *)malloc(inFileSize * sizeof(unsigned char));
  inFile = fopen(argv[1], "rb");
  if (inFile == 0) {
    fprintf(stderr, "Can not open input file");
    exit(0);
  }
  if (!fread(inBuffer, 1, (size_t)inFileSize, inFile)) {
    fprintf(stderr, "\nread failed");
  }
  fclose(inFile);
  res = compressDataExt(inBuffer, inFileSize, (char *)argv[3]);
  free(inBuffer);
  loadDataExt(&inBuffer, &inFileSize);
  createLzmaExt(inBuffer, inFileSize, lzmadata);
  {
    uint lzmamemneeds = sizeBytesLzmaStruct(lzmadata);
    fprintf(stderr,
            "\n compressed File has %d bytes ==> in memory size = %d bytes",
            inFileSize, lzmamemneeds);
  }
  {
    uint pos1, pos2;
    bcs = (unsigned char *)malloc(inFileSize * 4);
    pos1 = 3;
    pos2 = writeBuffLzmaStruct(bcs, pos1, lzmadata);
    fprintf(stderr,
            "\n space wasted due to writeBuffLzmaStruct = %d bytes . Inipos = "
            "%d, endPos=%d\n",
            pos2 - pos1, pos1, pos2);
    fflush(stderr);
    readBuffLzmaStruct(&(bcs[pos1]), pos2 - pos1, lzmadata2);
  }
  decodeLzma(lzmadata2, &outBuffer, &outFileSize);
  outFile = fopen(argv[2], "wb+");
  if (outFile == 0) {
    fprintf(stderr, "Can not open output file");
    exit(0);
  }
  if (!fwrite(outBuffer, 1, (size_t)outFileSize, outFile)) {
    fprintf(stderr, "\n Unable to write data!");
    res = 1;
  }
  if (outFile != 0)
    fclose(outFile);
  if (inBuffer)
    free(inBuffer);
  if (outBuffer)
    free(outBuffer);
  if (bcs)
    free(bcs);
  freeLzmaStruct(lzmadata);
  freeLzmaStruct(lzmadata2);
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x50(%rbp)
lea    -0x40(%rbp),%rdi
call   10c0 <initLzmaStruct@plt>
lea    -0x48(%rbp),%rdi
call   10c0 <initLzmaStruct@plt>
lea    0xd81(%rip),%rdi
call   1090 <printf@plt>
cmpl   $0x4,-0x8(%rbp)
je     12a6 <main+0x66>
lea    0xdf4(%rip),%rdi
call   1090 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1533 <main+0x2f3>
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <getfileSize@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdd8(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1322 <main+0xe2>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
lea    0xdb7(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1130 <exit@plt>
mov    -0x28(%rbp),%rdi
movslq -0x1c(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1060 <fread@plt>
cmp    $0x0,%eax
jne    1358 <main+0x118>
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
lea    0xd92(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1080 <fclose@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
call   1110 <compressDataExt@plt>
mov    %eax,-0x54(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
lea    -0x28(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <loadDataExt@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
call   1100 <createLzmaExt@plt>
mov    -0x40(%rbp),%rdi
call   1150 <sizeBytesLzmaStruct@plt>
mov    %eax,-0x58(%rbp)
mov    0x2c2f(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
mov    -0x58(%rbp),%ecx
lea    0xd30(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x1c(%rbp),%edi
shl    $0x2,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x3,-0x5c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x5c(%rbp),%esi
mov    -0x40(%rbp),%rdx
call   1070 <writeBuffLzmaStruct@plt>
mov    %eax,-0x60(%rbp)
mov    0x2be9(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%edx
sub    -0x5c(%rbp),%edx
mov    -0x5c(%rbp),%ecx
mov    -0x60(%rbp),%r8d
lea    0xd20(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2bc5(%rip),%rax
mov    (%rax),%edi
call   10f0 <fflush@plt>
mov    -0x38(%rbp),%rdi
movslq -0x5c(%rbp),%rax
add    %rax,%rdi
mov    -0x60(%rbp),%esi
sub    -0x5c(%rbp),%esi
mov    -0x48(%rbp),%rdx
call   1040 <readBuffLzmaStruct@plt>
mov    -0x48(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1160 <decodeLzma@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd20(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    148e <main+0x24e>
mov    0x2b69(%rip),%rax
mov    (%rax),%edi
lea    0xd00(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1130 <exit@plt>
mov    -0x30(%rbp),%rdi
movslq -0x20(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    $0x1,%esi
call   1140 <fwrite@plt>
cmp    $0x0,%eax
jne    14cb <main+0x28b>
mov    0x2b2c(%rip),%rax
mov    (%rax),%edi
lea    0xcdc(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x54(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     14df <main+0x29f>
mov    -0x50(%rbp),%rdi
call   1080 <fclose@plt>
cmpq   $0x0,-0x28(%rbp)
je     14f3 <main+0x2b3>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x30(%rbp)
je     1507 <main+0x2c7>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x38(%rbp)
je     151b <main+0x2db>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   10b0 <freeLzmaStruct@plt>
mov    -0x48(%rbp),%rdi
call   10b0 <freeLzmaStruct@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r15
mov    %edi,%ebx
lea    0x8(%rsp),%rdi
call   10c0 <initLzmaStruct@plt>
lea    0x18(%rsp),%rdi
call   10c0 <initLzmaStruct@plt>
lea    0xe7d(%rip),%rdi
call   1050 <puts@plt>
cmp    $0x4,%ebx
jne    1464 <main+0x224>
movq   $0x0,0x20(%rsp)
mov    0x8(%r15),%rdi
call   10a0 <getfileSize@plt>
mov    %rax,%rbx
mov    %ebx,0x4(%rsp)
mov    %ebx,%edi
call   10e0 <malloc@plt>
mov    %rax,%r14
mov    %rax,0x10(%rsp)
mov    0x8(%r15),%rdi
lea    0xd53(%rip),%rsi
call   1120 <fopen@plt>
test   %rax,%rax
je     1486 <main+0x246>
mov    %rax,%rbp
movslq %ebx,%rdx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %rax,%rcx
call   1070 <fread@plt>
test   %eax,%eax
jne    12ec <main+0xac>
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
lea    0xd36(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %rbp,%rdi
call   1090 <fclose@plt>
mov    0x10(%rsp),%rbx
mov    0x4(%rsp),%esi
mov    0x18(%r15),%rdx
mov    %rbx,%rdi
call   1110 <compressDataExt@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0x10(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   1060 <loadDataExt@plt>
mov    0x10(%rsp),%rdi
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%rdx
call   1100 <createLzmaExt@plt>
mov    0x8(%rsp),%rdi
call   1150 <sizeBytesLzmaStruct@plt>
mov    0x2c99(%rip),%r12
mov    (%r12),%edi
mov    0x4(%rsp),%edx
lea    0xcd2(%rip),%rsi
mov    %eax,%ecx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0x4(%rsp),%edi
shl    $0x2,%edi
call   10e0 <malloc@plt>
mov    %rax,%rbp
mov    0x8(%rsp),%rdx
mov    %rax,%rdi
mov    $0x3,%esi
call   1080 <writeBuffLzmaStruct@plt>
mov    (%r12),%edi
lea    -0x3(%rax),%ebx
lea    0xcd7(%rip),%rsi
mov    %ebx,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    (%r12),%edi
call   10f0 <fflush@plt>
lea    0x3(%rbp),%rdi
mov    0x18(%rsp),%rdx
mov    %ebx,%esi
call   1040 <readBuffLzmaStruct@plt>
mov    0x18(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x2c(%rsp),%rdx
call   1160 <decodeLzma@plt>
mov    0x10(%r15),%rdi
lea    0xcdd(%rip),%rsi
call   1120 <fopen@plt>
test   %rax,%rax
je     1498 <main+0x258>
mov    %rax,%rbx
mov    0x20(%rsp),%rdi
movslq 0x2c(%rsp),%rdx
mov    $0x1,%esi
mov    %rax,%rcx
call   1140 <fwrite@plt>
test   %eax,%eax
jne    141b <main+0x1db>
mov    (%r12),%edi
lea    0xcc3(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%r14d
mov    %rbx,%rdi
call   1090 <fclose@plt>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     1432 <main+0x1f2>
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
test   %rdi,%rdi
je     1441 <main+0x201>
call   1030 <free@plt>
test   %rbp,%rbp
je     144e <main+0x20e>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   10b0 <freeLzmaStruct@plt>
mov    0x18(%rsp),%rdi
call   10b0 <freeLzmaStruct@plt>
jmp    1476 <main+0x236>
lea    0xd06(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b53(%rip),%rax
mov    (%rax),%edi
lea    0xb6d(%rip),%rsi
jmp    14a3 <main+0x263>
mov    (%r12),%edi
lea    0xc15(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
@.str = [137 x i8] c"\0ALZMA Compressor/decompressor test lib \0A 4.26 Copyright (c) 1999-2005 Igor Pavlov 2005-08-05, modified by Antonio Fari\C3\B1a (2009-09-09)\0A\00"
@.str.1 = [63 x i8] c"\0AUsage: farilzmaTest srcFile filelzma.unc path2lzmaEncoder \0A\00"
@.str.2 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.3 = [24 x i8] c"Can not open input file\00"
@.str.4 = [13 x i8] c"\0Aread failed\00"
@.str.5 = [61 x i8] c"\0A compressed File has %d bytes ==> in memory size = %d bytes\00"
@.str.6 = [79 x i8] c"\0A space wasted due to writeBuffLzmaStruct = %d bytes . Inipos = %d, endPos=%d\0A\00"
@.str.7 = [4 x i8] c"wb+\00"
@.str.8 = [25 x i8] c"Can not open output file\00"
@.str.9 = [24 x i8] c"\0A Unable to write data!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i32* null, i32** %14
%19 = call i32 @initLzmaStruct(i8** %12)
%20 = call i32 @initLzmaStruct(i8** %13)
%21 = call i32 @printf(i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 4
br i1 %23, label %24, label %26
24: ; preds = %2
%25 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %158
26: ; preds = %2
store i8* null, i8** %10
store i8* null, i8** %9
store i8* null, i8** %11
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i64 @getfileSize(i8* %29)
%31 = trunc i64 %30 to i32
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = mul i64 %33, 1
%35 = trunc i64 %34 to i32
%36 = call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to i8*
store i8* %37, i8** %9
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %41, i32** %6
%42 = load i32*, i32** %6
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %48
44: ; preds = %26
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%47 = call i32 @exit(i32 0)
unreachable
48: ; preds = %26
%49 = load i8*, i8** %9
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = load i32*, i32** %6
%53 = call i32 @fread(i8* %49, i32 1, i64 %51, i32* %52)
%54 = icmp ne i32 %53, 0
br i1 %54, label %58, label %55
55: ; preds = %48
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %58
58: ; preds = %55, %48
%59 = load i32*, i32** %6
%60 = call i32 @fclose(i32* %59)
%61 = load i8*, i8** %9
%62 = load i32, i32* %7
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 3
%65 = load i8*, i8** %64
%66 = call i32 @compressDataExt(i8* %61, i32 %62, i8* %65)
store i32 %66, i32* %15
%67 = load i8*, i8** %9
%68 = call i32 @free(i8* %67)
%69 = call i32 @loadDataExt(i8** %9, i32* %7)
%70 = load i8*, i8** %9
%71 = load i32, i32* %7
%72 = load i8*, i8** %12
%73 = call i32 @createLzmaExt(i8* %70, i32 %71, i8* %72)
%74 = load i8*, i8** %12
%75 = call i32 @sizeBytesLzmaStruct(i8* %74)
store i32 %75, i32* %16
%76 = load i32, i32* @stderr
%77 = load i32, i32* %7
%78 = load i32, i32* %16
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i32 %77, i32 %78)
%80 = load i32, i32* %7
%81 = mul nsw i32 %80, 4
%82 = call i64 @malloc(i32 %81)
%83 = inttoptr i64 %82 to i8*
store i8* %83, i8** %11
store i32 3, i32* %17
%84 = load i8*, i8** %11
%85 = load i32, i32* %17
%86 = load i8*, i8** %12
%87 = call i32 @writeBuffLzmaStruct(i8* %84, i32 %85, i8* %86)
store i32 %87, i32* %18
%88 = load i32, i32* @stderr
%89 = load i32, i32* %18
%90 = load i32, i32* %17
%91 = sub nsw i32 %89, %90
%92 = load i32, i32* %17
%93 = load i32, i32* %18
%94 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.6, i64 0, i64 0), i32 %91, i32 %92, i32 %93)
%95 = load i32, i32* @stderr
%96 = call i32 @fflush(i32 %95)
%97 = load i8*, i8** %11
%98 = load i32, i32* %17
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %97, i64 %99
%101 = load i32, i32* %18
%102 = load i32, i32* %17
%103 = sub nsw i32 %101, %102
%104 = load i8*, i8** %13
%105 = call i32 @readBuffLzmaStruct(i8* %100, i32 %103, i8* %104)
%106 = load i8*, i8** %13
%107 = call i32 @decodeLzma(i8* %106, i8** %10, i32* %8)
%108 = load i8**, i8*** %5
%109 = getelementptr inbounds i8*, i8** %108, i64 2
%110 = load i8*, i8** %109
%111 = call i32* @fopen(i8* %110, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
store i32* %111, i32** %14
%112 = load i32*, i32** %14
%113 = icmp eq i32* %112, null
br i1 %113, label %114, label %118
114: ; preds = %58
%115 = load i32, i32* @stderr
%116 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%117 = call i32 @exit(i32 0)
unreachable
118: ; preds = %58
%119 = load i8*, i8** %10
%120 = load i32, i32* %8
%121 = sext i32 %120 to i64
%122 = load i32*, i32** %14
%123 = call i32 @fwrite(i8* %119, i32 1, i64 %121, i32* %122)
%124 = icmp ne i32 %123, 0
br i1 %124, label %128, label %125
125: ; preds = %118
%126 = load i32, i32* @stderr
%127 = call i32 (i32, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %15
br label %128
128: ; preds = %125, %118
%129 = load i32*, i32** %14
%130 = icmp ne i32* %129, null
br i1 %130, label %131, label %134
131: ; preds = %128
%132 = load i32*, i32** %14
%133 = call i32 @fclose(i32* %132)
br label %134
134: ; preds = %131, %128
%135 = load i8*, i8** %9
%136 = icmp ne i8* %135, null
br i1 %136, label %137, label %140
137: ; preds = %134
%138 = load i8*, i8** %9
%139 = call i32 @free(i8* %138)
br label %140
140: ; preds = %137, %134
%141 = load i8*, i8** %10
%142 = icmp ne i8* %141, null
br i1 %142, label %143, label %146
143: ; preds = %140
%144 = load i8*, i8** %10
%145 = call i32 @free(i8* %144)
br label %146
146: ; preds = %143, %140
%147 = load i8*, i8** %11
%148 = icmp ne i8* %147, null
br i1 %148, label %149, label %152
149: ; preds = %146
%150 = load i8*, i8** %11
%151 = call i32 @free(i8* %150)
br label %152
152: ; preds = %149, %146
%153 = load i8*, i8** %12
%154 = call i32 @freeLzmaStruct(i8* %153)
%155 = load i8*, i8** %13
%156 = call i32 @freeLzmaStruct(i8* %155)
%157 = load i32, i32* %15
store i32 %157, i32* %3
br label %158
158: ; preds = %152, %24
%159 = load i32, i32* %3
ret i32 %159
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.3 = [24 x i8] c"Can not open input file\00"
@.str.4 = [13 x i8] c"\0Aread failed\00"
@.str.5 = [61 x i8] c"\0A compressed File has %d bytes ==> in memory size = %d bytes\00"
@.str.6 = [79 x i8] c"\0A space wasted due to writeBuffLzmaStruct = %d bytes . Inipos = %d, endPos=%d\0A\00"
@.str.7 = [4 x i8] c"wb+\00"
@.str.8 = [25 x i8] c"Can not open output file\00"
@.str.9 = [24 x i8] c"\0A Unable to write data!\00"
@str = [136 x i8] c"\0ALZMA Compressor/decompressor test lib \0A 4.26 Copyright (c) 1999-2005 Igor Pavlov 2005-08-05, modified by Antonio Fari\C3\B1a (2009-09-09)\00"
@str.10 = [62 x i8] c"\0AUsage: farilzmaTest srcFile filelzma.unc path2lzmaEncoder \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i8** %5 to i8*
%12 = bitcast i8** %6 to i8*
%13 = bitcast i8** %7 to i8*
%14 = bitcast i8** %8 to i8*
%15 = call i32 @initLzmaStruct(i8** %7)
%16 = call i32 @initLzmaStruct(i8** %8)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([136 x i8], [136 x i8]* @str, i64 0, i64 0))
%18 = icmp eq i32 %0, 4
br i1 %18, label %21, label %19
19: ; preds = %2
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.10, i64 0, i64 0))
br label %115
21: ; preds = %2
store i8* null, i8** %6
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @getfileSize(i8* %23)
%25 = trunc i64 %24 to i32
store i32 %25, i32* %3
%26 = call i64 @malloc(i32 %25)
%27 = inttoptr i64 %26 to i8*
store i8* %27, i8** %5
%28 = load i8*, i8** %22
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %35
31: ; preds = %21
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%34 = call i32 @exit(i32 0)
unreachable
35: ; preds = %21
%36 = shl i64 %24, 32
%37 = ashr exact i64 %36, 32
%38 = call i32 @fread(i8* %27, i32 1, i64 %37, i32* %29)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = load i32, i32* @stderr
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %43
43: ; preds = %40, %35
%44 = call i32 @fclose(i32* %29)
%45 = load i8*, i8** %5
%46 = load i32, i32* %3
%47 = getelementptr inbounds i8*, i8** %1, i64 3
%48 = load i8*, i8** %47
%49 = call i32 @compressDataExt(i8* %45, i32 %46, i8* %48)
%50 = call i32 @free(i8* %45)
%51 = call i32 @loadDataExt(i8** %5, i32* %3)
%52 = load i8*, i8** %5
%53 = load i32, i32* %3
%54 = load i8*, i8** %7
%55 = call i32 @createLzmaExt(i8* %52, i32 %53, i8* %54)
%56 = load i8*, i8** %7
%57 = call i32 @sizeBytesLzmaStruct(i8* %56)
%58 = load i32, i32* @stderr
%59 = load i32, i32* %3
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i32 %59, i32 %57)
%61 = load i32, i32* %3
%62 = shl nsw i32 %61, 2
%63 = call i64 @malloc(i32 %62)
%64 = inttoptr i64 %63 to i8*
%65 = load i8*, i8** %7
%66 = call i32 @writeBuffLzmaStruct(i8* %64, i32 3, i8* %65)
%67 = load i32, i32* @stderr
%68 = add nsw i32 %66, -3
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.6, i64 0, i64 0), i32 %68, i32 3, i32 %66)
%70 = load i32, i32* @stderr
%71 = call i32 @fflush(i32 %70)
%72 = getelementptr inbounds i8, i8* %64, i64 3
%73 = load i8*, i8** %8
%74 = call i32 @readBuffLzmaStruct(i8* %72, i32 %68, i8* %73)
%75 = load i8*, i8** %8
%76 = call i32 @decodeLzma(i8* %75, i8** %6, i32* %4)
%77 = getelementptr inbounds i8*, i8** %1, i64 2
%78 = load i8*, i8** %77
%79 = call i32* @fopen(i8* %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%80 = icmp eq i32* %79, null
br i1 %80, label %81, label %85
81: ; preds = %43
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%84 = call i32 @exit(i32 0)
unreachable
85: ; preds = %43
%86 = load i8*, i8** %6
%87 = load i32, i32* %4
%88 = sext i32 %87 to i64
%89 = call i32 @fwrite(i8* %86, i32 1, i64 %88, i32* %79)
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %85
%92 = load i32, i32* @stderr
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
br label %94
94: ; preds = %85, %91
%95 = phi i32 [ %49, %85 ], [ 1, %91 ]
%96 = call i32 @fclose(i32* %79)
%97 = load i8*, i8** %5
%98 = icmp eq i8* %97, null
br i1 %98, label %101, label %99
99: ; preds = %94
%100 = call i32 @free(i8* %97)
br label %101
101: ; preds = %99, %94
%102 = load i8*, i8** %6
%103 = icmp eq i8* %102, null
br i1 %103, label %106, label %104
104: ; preds = %101
%105 = call i32 @free(i8* %102)
br label %106
106: ; preds = %104, %101
%107 = icmp eq i64 %63, 0
br i1 %107, label %110, label %108
108: ; preds = %106
%109 = call i32 @free(i8* %64)
br label %110
110: ; preds = %108, %106
%111 = load i8*, i8** %7
%112 = call i32 @freeLzmaStruct(i8* %111)
%113 = load i8*, i8** %8
%114 = call i32 @freeLzmaStruct(i8* %113)
br label %115
115: ; preds = %110, %19
%116 = phi i32 [ 1, %19 ], [ %95, %110 ]
ret i32 %116
}