#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__ execcmd(char *);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char *);
char *strrchr(char *, char);
int /*<<< orphan*/ trace(int, char *, ...);
extern int uncompress(const char *file, char *uncfile) {
  int stat = 0;
  char *p, cmd[2048] = "", tmpfile[1024] = "";
  trace(3, "uncompress: file=%s\n", file);
  strcpy(tmpfile, file);
  if (!(p = strrchr(tmpfile, '.')))
    return 0;
  if (!strcmp(p, ".z") || !strcmp(p, ".Z") || !strcmp(p, ".gz") ||
      !strcmp(p, ".GZ") || !strcmp(p, ".zip") || !strcmp(p, ".ZIP")) {
    strcpy(uncfile, tmpfile);
    uncfile[p - tmpfile] = '\0';
    sprintf(cmd, "gzip -f -d -c \"%s\" > \"%s\"", tmpfile, uncfile);
    if (execcmd(cmd)) {
      remove(uncfile);
      return -1;
    }
    strcpy(tmpfile, uncfile);
    stat = 1;
  }
  if ((p = strrchr(tmpfile, '.')) && !strcmp(p, ".tar")) {
    strcpy(uncfile, tmpfile);
    uncfile[p - tmpfile] = '\0';
    sprintf(cmd, "tar -xf \"%s\"", tmpfile);
    if (execcmd(cmd)) {
      if (stat)
        remove(tmpfile);
      return -1;
    }
    if (stat)
      remove(tmpfile);
    stat = 1;
  } else if ((p = strrchr(tmpfile, '.')) && strlen(p) > 3 &&
             (*(p + 3) == 'd' || *(p + 3) == 'D')) {
    strcpy(uncfile, tmpfile);
    uncfile[p - tmpfile + 3] = *(p + 3) == 'D' ? 'O' : 'o';
    sprintf(cmd, "crx2rnx < \"%s\" > \"%s\"", tmpfile, uncfile);
    if (execcmd(cmd)) {
      remove(uncfile);
      if (stat)
        remove(tmpfile);
      return -1;
    }
    if (stat)
      remove(tmpfile);
    stat = 1;
  }
  trace(3, "uncompress: stat=%d\n", stat);
  return stat;
}


x86 assembly (clang, -O0):
<uncompress>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x830(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1080 <memset@plt>
lea    -0xc30(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    -0x10(%rbp),%rdx
mov    $0x3,%edi
lea    0xe20(%rip),%rsi
mov    $0x0,%al
call   10a0 <trace@plt>
lea    -0xc30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0xc30(%rbp),%rdi
mov    $0x2e,%esi
call   1070 <strrchr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1222 <uncompress+0x92>
movl   $0x0,-0x4(%rbp)
jmp    1546 <uncompress+0x3b6>
mov    -0x28(%rbp),%rdi
lea    0xde8(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <uncompress+0x128>
mov    -0x28(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <uncompress+0x128>
mov    -0x28(%rbp),%rdi
lea    0xdbc(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <uncompress+0x128>
mov    -0x28(%rbp),%rdi
lea    0xda7(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <uncompress+0x128>
mov    -0x28(%rbp),%rdi
lea    0xd92(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <uncompress+0x128>
mov    -0x28(%rbp),%rdi
lea    0xd7e(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    1340 <uncompress+0x1b0>
mov    -0x18(%rbp),%rdi
lea    -0xc30(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
lea    -0xc30(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
lea    -0x830(%rbp),%rdi
lea    -0xc30(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xd36(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x830(%rbp),%rdi
call   1050 <execcmd@plt>
cmp    $0x0,%rax
je     1329 <uncompress+0x199>
mov    -0x18(%rbp),%rdi
call   1030 <remove@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1546 <uncompress+0x3b6>
lea    -0xc30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x1c(%rbp)
lea    -0xc30(%rbp),%rdi
mov    $0x2e,%esi
call   1070 <strrchr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1414 <uncompress+0x284>
mov    -0x28(%rbp),%rdi
lea    0xcdd(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    1414 <uncompress+0x284>
mov    -0x18(%rbp),%rdi
lea    -0xc30(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
lea    -0xc30(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
lea    -0x830(%rbp),%rdi
lea    -0xc30(%rbp),%rdx
lea    0xc99(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x830(%rbp),%rdi
call   1050 <execcmd@plt>
cmp    $0x0,%rax
je     13f2 <uncompress+0x262>
cmpl   $0x0,-0x1c(%rbp)
je     13e6 <uncompress+0x256>
lea    -0xc30(%rbp),%rdi
call   1030 <remove@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1546 <uncompress+0x3b6>
cmpl   $0x0,-0x1c(%rbp)
je     1408 <uncompress+0x278>
lea    -0xc30(%rbp),%rdi
call   1030 <remove@plt>
movl   $0x1,-0x1c(%rbp)
jmp    152a <uncompress+0x39a>
lea    -0xc30(%rbp),%rdi
mov    $0x2e,%esi
call   1070 <strrchr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1525 <uncompress+0x395>
mov    -0x28(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x3,%eax
jle    1525 <uncompress+0x395>
mov    -0x28(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x64,%eax
je     1467 <uncompress+0x2d7>
mov    -0x28(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x44,%eax
jne    1525 <uncompress+0x395>
mov    -0x18(%rbp),%rdi
lea    -0xc30(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x28(%rbp),%rax
movsbl 0x3(%rax),%edx
mov    $0x6f,%eax
mov    $0x4f,%ecx
cmp    $0x44,%edx
cmove  %ecx,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
lea    -0xc30(%rbp),%rsi
sub    %rsi,%rcx
mov    %dl,0x3(%rax,%rcx,1)
lea    -0x830(%rbp),%rdi
lea    -0xc30(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xb99(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x830(%rbp),%rdi
call   1050 <execcmd@plt>
cmp    $0x0,%rax
je     1508 <uncompress+0x378>
mov    -0x18(%rbp),%rdi
call   1030 <remove@plt>
cmpl   $0x0,-0x1c(%rbp)
je     14fc <uncompress+0x36c>
lea    -0xc30(%rbp),%rdi
call   1030 <remove@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1546 <uncompress+0x3b6>
cmpl   $0x0,-0x1c(%rbp)
je     151e <uncompress+0x38e>
lea    -0xc30(%rbp),%rdi
call   1030 <remove@plt>
movl   $0x1,-0x1c(%rbp)
jmp    152a <uncompress+0x39a>
mov    -0x1c(%rbp),%edx
mov    $0x3,%edi
lea    0xb36(%rip),%rsi
mov    $0x0,%al
call   10a0 <trace@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uncompress>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc00,%rsp
mov    %rsi,%r14
mov    %rdi,%rbp
lea    0x400(%rsp),%rdi
xor    %r15d,%r15d
mov    $0x800,%edx
xor    %esi,%esi
call   1080 <memset@plt>
mov    %rsp,%rbx
mov    $0x400,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
lea    0xe2b(%rip),%rsi
mov    $0x3,%edi
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <trace@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1070 <strrchr@plt>
test   %rax,%rax
je     140a <uncompress+0x27a>
mov    %rax,%rbp
lea    0xe06(%rip),%rsi
mov    %rax,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1282 <uncompress+0xf2>
lea    0xdf6(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1282 <uncompress+0xf2>
lea    0xde6(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1282 <uncompress+0xf2>
lea    0xdd7(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1282 <uncompress+0xf2>
lea    0xdc8(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1282 <uncompress+0xf2>
lea    0xdba(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1282 <uncompress+0xf2>
xor    %r15d,%r15d
mov    $0x1,%r12b
jmp    12e8 <uncompress+0x158>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
sub    %rbx,%rbp
movb   $0x0,(%r14,%rbp,1)
lea    0xd91(%rip),%rsi
lea    0x400(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1050 <execcmd@plt>
test   %rax,%rax
je     12d4 <uncompress+0x144>
mov    %r14,%rdi
call   1030 <remove@plt>
mov    $0xffffffff,%r15d
jmp    140a <uncompress+0x27a>
mov    %rsp,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    $0x1,%r15d
xor    %r12d,%r12d
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1070 <strrchr@plt>
test   %rax,%rax
je     13f4 <uncompress+0x264>
mov    %rax,%rbp
lea    0xd3c(%rip),%rsi
mov    %rax,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
je     138a <uncompress+0x1fa>
mov    %rbp,%rdi
call   1060 <strlen@plt>
cmp    $0x4,%eax
jl     13f4 <uncompress+0x264>
mov    0x3(%rbp),%al
or     $0x20,%al
cmp    $0x64,%al
jne    13f4 <uncompress+0x264>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
cmpb   $0x44,0x3(%rbp)
setne  %al
shl    $0x5,%al
or     $0x4f,%al
sub    %rbx,%rbp
mov    %al,0x3(%rbp,%r14,1)
lea    0xcfe(%rip),%rsi
lea    0x400(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1050 <execcmd@plt>
test   %rax,%rax
je     13db <uncompress+0x24b>
mov    %r14,%rdi
call   1030 <remove@plt>
jmp    13c6 <uncompress+0x236>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
sub    %rbx,%rbp
movb   $0x0,(%r14,%rbp,1)
lea    0xca8(%rip),%rsi
lea    0x400(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1050 <execcmd@plt>
test   %rax,%rax
je     13db <uncompress+0x24b>
mov    $0xffffffff,%r15d
test   %r12b,%r12b
jne    140a <uncompress+0x27a>
mov    %rsp,%rdi
call   1030 <remove@plt>
jmp    140a <uncompress+0x27a>
mov    $0x1,%r15d
test   %r12b,%r12b
jne    13f4 <uncompress+0x264>
mov    %rsp,%rdi
call   1030 <remove@plt>
mov    $0x1,%r15d
lea    0xc74(%rip),%rsi
mov    $0x3,%edi
mov    %r15d,%edx
xor    %eax,%eax
call   10a0 <trace@plt>
mov    %r15d,%eax
add    $0xc00,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"uncompress: file=%s\0A\00"
@.str.1 = [3 x i8] c".z\00"
@.str.2 = [3 x i8] c".Z\00"
@.str.3 = [4 x i8] c".gz\00"
@.str.4 = [4 x i8] c".GZ\00"
@.str.5 = [5 x i8] c".zip\00"
@.str.6 = [5 x i8] c".ZIP\00"
@.str.7 = [26 x i8] c"gzip -f -d -c \22%s\22 > \22%s\22\00"
@.str.8 = [5 x i8] c".tar\00"
@.str.9 = [13 x i8] c"tar -xf \22%s\22\00"
@.str.10 = [22 x i8] c"crx2rnx < \22%s\22 > \22%s\22\00"
@.str.11 = [21 x i8] c"uncompress: stat=%d\0A\00"
define i32 @uncompress(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [2048 x i8]
%9 = alloca [1024 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
%10 = bitcast [2048 x i8]* %8 to i8*
%11 = bitcast [1024 x i8]* %9 to i8*
%12 = load i8*, i8** %4
%13 = call i32 (i32, i8*, ...) @trace(i32 3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %4
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%18 = call i8* @strrchr(i8* %17, i8 signext 46)
store i8* %18, i8** %7
%19 = icmp ne i8* %18, null
br i1 %19, label %21, label %20
20: ; preds = %2
store i32 0, i32* %3
br label %177
21: ; preds = %2
%22 = load i8*, i8** %7
%23 = call i32 @strcmp(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %45
25: ; preds = %21
%26 = load i8*, i8** %7
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %45
29: ; preds = %25
%30 = load i8*, i8** %7
%31 = call i32 @strcmp(i8* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %45
33: ; preds = %29
%34 = load i8*, i8** %7
%35 = call i32 @strcmp(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %45
37: ; preds = %33
%38 = load i8*, i8** %7
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i8*, i8** %7
%43 = call i32 @strcmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %70, label %45
45: ; preds = %41, %37, %33, %29, %25, %21
%46 = load i8*, i8** %5
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%48 = call i32 @strcpy(i8* %46, i8* %47)
%49 = load i8*, i8** %5
%50 = load i8*, i8** %7
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%52 = ptrtoint i8* %50 to i64
%53 = ptrtoint i8* %51 to i64
%54 = sub i64 %52, %53
%55 = getelementptr inbounds i8, i8* %49, i64 %54
store i8 0, i8* %55
%56 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%58 = load i8*, i8** %5
%59 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %56, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %57, i8* %58)
%60 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%61 = call i64 @execcmd(i8* %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %45
%64 = load i8*, i8** %5
%65 = call i32 @remove(i8* %64)
store i32 -1, i32* %3
br label %177
66: ; preds = %45
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%68 = load i8*, i8** %5
%69 = call i32 @strcpy(i8* %67, i8* %68)
store i32 1, i32* %6
br label %70
70: ; preds = %66, %41
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%72 = call i8* @strrchr(i8* %71, i8 signext 46)
store i8* %72, i8** %7
%73 = icmp ne i8* %72, null
br i1 %73, label %74, label %109
74: ; preds = %70
%75 = load i8*, i8** %7
%76 = call i32 @strcmp(i8* %75, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%77 = icmp ne i32 %76, 0
br i1 %77, label %109, label %78
78: ; preds = %74
%79 = load i8*, i8** %5
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%81 = call i32 @strcpy(i8* %79, i8* %80)
%82 = load i8*, i8** %5
%83 = load i8*, i8** %7
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%85 = ptrtoint i8* %83 to i64
%86 = ptrtoint i8* %84 to i64
%87 = sub i64 %85, %86
%88 = getelementptr inbounds i8, i8* %82, i64 %87
store i8 0, i8* %88
%89 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%91 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %89, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i8* %90)
%92 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%93 = call i64 @execcmd(i8* %92)
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %102
95: ; preds = %78
%96 = load i32, i32* %6
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %101
98: ; preds = %95
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%100 = call i32 @remove(i8* %99)
br label %101
101: ; preds = %98, %95
store i32 -1, i32* %3
br label %177
102: ; preds = %78
%103 = load i32, i32* %6
%104 = icmp ne i32 %103, 0
br i1 %104, label %105, label %108
105: ; preds = %102
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%107 = call i32 @remove(i8* %106)
br label %108
108: ; preds = %105, %102
store i32 1, i32* %6
br label %173
109: ; preds = %74, %70
%110 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%111 = call i8* @strrchr(i8* %110, i8 signext 46)
store i8* %111, i8** %7
%112 = icmp ne i8* %111, null
br i1 %112, label %113, label %172
113: ; preds = %109
%114 = load i8*, i8** %7
%115 = call i32 @strlen(i8* %114)
%116 = icmp sgt i32 %115, 3
br i1 %116, label %117, label %172
117: ; preds = %113
%118 = load i8*, i8** %7
%119 = getelementptr inbounds i8, i8* %118, i64 3
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = icmp eq i32 %121, 100
br i1 %122, label %129, label %123
123: ; preds = %117
%124 = load i8*, i8** %7
%125 = getelementptr inbounds i8, i8* %124, i64 3
%126 = load i8, i8* %125
%127 = sext i8 %126 to i32
%128 = icmp eq i32 %127, 68
br i1 %128, label %129, label %172
129: ; preds = %123, %117
%130 = load i8*, i8** %5
%131 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%132 = call i32 @strcpy(i8* %130, i8* %131)
%133 = load i8*, i8** %7
%134 = getelementptr inbounds i8, i8* %133, i64 3
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = icmp eq i32 %136, 68
%138 = zext i1 %137 to i64
%139 = select i1 %137, i32 79, i32 111
%140 = trunc i32 %139 to i8
%141 = load i8*, i8** %5
%142 = load i8*, i8** %7
%143 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%144 = ptrtoint i8* %142 to i64
%145 = ptrtoint i8* %143 to i64
%146 = sub i64 %144, %145
%147 = add nsw i64 %146, 3
%148 = getelementptr inbounds i8, i8* %141, i64 %147
store i8 %140, i8* %148
%149 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%150 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%151 = load i8*, i8** %5
%152 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %149, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* %150, i8* %151)
%153 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%154 = call i64 @execcmd(i8* %153)
%155 = icmp ne i64 %154, 0
br i1 %155, label %156, label %165
156: ; preds = %129
%157 = load i8*, i8** %5
%158 = call i32 @remove(i8* %157)
%159 = load i32, i32* %6
%160 = icmp ne i32 %159, 0
br i1 %160, label %161, label %164
161: ; preds = %156
%162 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%163 = call i32 @remove(i8* %162)
br label %164
164: ; preds = %161, %156
store i32 -1, i32* %3
br label %177
165: ; preds = %129
%166 = load i32, i32* %6
%167 = icmp ne i32 %166, 0
br i1 %167, label %168, label %171
168: ; preds = %165
%169 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%170 = call i32 @remove(i8* %169)
br label %171
171: ; preds = %168, %165
store i32 1, i32* %6
br label %172
172: ; preds = %171, %123, %113, %109
br label %173
173: ; preds = %172, %108
%174 = load i32, i32* %6
%175 = call i32 (i32, i8*, ...) @trace(i32 3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 %174)
%176 = load i32, i32* %6
store i32 %176, i32* %3
br label %177
177: ; preds = %173, %164, %101, %63, %20
%178 = load i32, i32* %3
ret i32 %178
}

LLVM IR (-O2):
@.str = [21 x i8] c"uncompress: file=%s\0A\00"
@.str.1 = [3 x i8] c".z\00"
@.str.2 = [3 x i8] c".Z\00"
@.str.3 = [4 x i8] c".gz\00"
@.str.4 = [4 x i8] c".GZ\00"
@.str.5 = [5 x i8] c".zip\00"
@.str.6 = [5 x i8] c".ZIP\00"
@.str.7 = [26 x i8] c"gzip -f -d -c \22%s\22 > \22%s\22\00"
@.str.8 = [5 x i8] c".tar\00"
@.str.9 = [13 x i8] c"tar -xf \22%s\22\00"
@.str.10 = [22 x i8] c"crx2rnx < \22%s\22 > \22%s\22\00"
@.str.11 = [21 x i8] c"uncompress: stat=%d\0A\00"
define i32 @uncompress(i8* %0, i8* %1) {
%3 = alloca [2048 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = tail call i32 (i32, i8*, ...) @trace(i32 3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = call i32 @strcpy(i8* %6, i8* %0)
%9 = call i8* @strrchr(i8* %6, i8 signext 46)
%10 = icmp eq i8* %9, null
br i1 %10, label %92, label %11
11: ; preds = %2
%12 = call i32 @strcmp(i8* %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %29, label %14
14: ; preds = %11
%15 = call i32 @strcmp(i8* %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %29, label %17
17: ; preds = %14
%18 = call i32 @strcmp(i8* %9, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %29, label %20
20: ; preds = %17
%21 = call i32 @strcmp(i8* %9, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %20
%24 = call i32 @strcmp(i8* %9, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = call i32 @strcmp(i8* %9, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %42
29: ; preds = %26, %23, %20, %17, %14, %11
%30 = call i32 @strcpy(i8* %1, i8* %6)
%31 = ptrtoint i8* %9 to i64
%32 = ptrtoint [1024 x i8]* %4 to i64
%33 = sub i64 %31, %32
%34 = getelementptr inbounds i8, i8* %1, i64 %33
store i8 0, i8* %34
%35 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %6, i8* %1)
%36 = call i64 @execcmd(i8* %5)
%37 = icmp eq i64 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %29
%39 = call i32 @remove(i8* %1)
br label %92
40: ; preds = %29
%41 = call i32 @strcpy(i8* %6, i8* %1)
br label %42
42: ; preds = %40, %26
%43 = phi i1 [ false, %40 ], [ true, %26 ]
%44 = phi i32 [ 1, %40 ], [ 0, %26 ]
%45 = call i8* @strrchr(i8* %6, i8 signext 46)
%46 = icmp eq i8* %45, null
br i1 %46, label %89, label %47
47: ; preds = %42
%48 = call i32 @strcmp(i8* %45, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %63
50: ; preds = %47
%51 = call i32 @strcpy(i8* %1, i8* %6)
%52 = ptrtoint i8* %45 to i64
%53 = ptrtoint [1024 x i8]* %4 to i64
%54 = sub i64 %52, %53
%55 = getelementptr inbounds i8, i8* %1, i64 %54
store i8 0, i8* %55
%56 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i8* %6)
%57 = call i64 @execcmd(i8* %5)
%58 = icmp eq i64 %57, 0
br i1 %58, label %62, label %59
59: ; preds = %50
br i1 %43, label %92, label %60
60: ; preds = %59
%61 = call i32 @remove(i8* %6)
br label %92
62: ; preds = %50
br i1 %43, label %89, label %87
63: ; preds = %47
%64 = call i32 @strlen(i8* %45)
%65 = icmp sgt i32 %64, 3
br i1 %65, label %66, label %89
66: ; preds = %63
%67 = getelementptr inbounds i8, i8* %45, i64 3
%68 = load i8, i8* %67
switch i8 %68, label %89 [
i8 100, label %69
i8 68, label %69
]
69: ; preds = %66, %66
%70 = call i32 @strcpy(i8* %1, i8* %6)
%71 = load i8, i8* %67
%72 = icmp eq i8 %71, 68
%73 = select i1 %72, i8 79, i8 111
%74 = ptrtoint i8* %45 to i64
%75 = ptrtoint [1024 x i8]* %4 to i64
%76 = sub i64 3, %75
%77 = add i64 %76, %74
%78 = getelementptr inbounds i8, i8* %1, i64 %77
store i8 %73, i8* %78
%79 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* %6, i8* %1)
%80 = call i64 @execcmd(i8* %5)
%81 = icmp eq i64 %80, 0
br i1 %81, label %86, label %82
82: ; preds = %69
%83 = call i32 @remove(i8* %1)
br i1 %43, label %92, label %84
84: ; preds = %82
%85 = call i32 @remove(i8* %6)
br label %92
86: ; preds = %69
br i1 %43, label %89, label %87
87: ; preds = %86, %62
%88 = call i32 @remove(i8* %6)
br label %89
89: ; preds = %87, %42, %86, %66, %62, %63
%90 = phi i32 [ %44, %63 ], [ 1, %62 ], [ %44, %66 ], [ 1, %86 ], [ %44, %42 ], [ 1, %87 ]
%91 = call i32 (i32, i8*, ...) @trace(i32 3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 %90)
br label %92
92: ; preds = %82, %84, %59, %60, %2, %89, %38
%93 = phi i32 [ %90, %89 ], [ -1, %38 ], [ 0, %2 ], [ -1, %60 ], [ -1, %59 ], [ -1, %84 ], [ -1, %82 ]
ret i32 %93
}