#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ UINT_MAX;
unsigned int compress(unsigned char *, unsigned int, unsigned char **);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ malloc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
unsigned int readbuffer(int /*<<< orphan*/ *, unsigned char *);
int /*<<< orphan*/ rename(char *, char *);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ writefile(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             unsigned char *, unsigned int, unsigned char **);
int main(int argc, char **argv) {
  FILE *in, *out;
  unsigned char *buffer;
  unsigned buffersize, orgbuffersize;
  unsigned char pairtable[128][2];
  if (argc < 2 || argc > 3)
    usage();
  if ((in = fopen(argv[1], "rt")) == NULL) {
    printf("SCPACK: error opening input %s\n", argv[1]);
    usage();
  }
  if (argc == 2) {
    if ((out = fopen("~SCPACK.TMP", "wt")) == NULL) {
      printf("SCPACK: error opening temporary file %s\n", "~SCPACK.TMP");
      usage();
    }
  } else {
    if ((out = fopen(argv[2], "wt")) == NULL) {
      printf("SCPACK: error opening output file %s\n", argv[2]);
      usage();
    }
  }
  buffer = (unsigned char *)malloc(UINT_MAX);
  if (buffer == NULL) {
    printf("SCPACK: error allocating memory\n");
    return 1;
  }
  buffersize = readbuffer(in, buffer);
  orgbuffersize = buffersize;
  if (buffersize > 0) {
    buffersize = compress(buffer, buffersize, pairtable);
    writefile(in, out, buffer, buffersize, pairtable);
    printf("SCPACK: compression ratio: %ld%% (%d -> %d)\n",
           100L - (100L * buffersize) / orgbuffersize, orgbuffersize,
           buffersize);
  } else {
    printf("SCPACK: no SCPACK section found, nothing to do\n");
  }
  fclose(out);
  fclose(in);
  if (buffersize == 0) {
    if (argc == 2)
      unlink("~SCPACK.TMP");
    else
      unlink(argv[2]);
  } else if (argc == 2) {
    unlink(argv[1]);
    rename("~SCPACK.TMP", argv[1]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     11cd <main+0x2d>
cmpl   $0x3,-0x8(%rbp)
jle    11d4 <main+0x34>
mov    $0x0,%al
call   10a0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1d(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1213 <main+0x73>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10a0 <usage@plt>
cmpl   $0x2,-0x8(%rbp)
jne    125f <main+0xbf>
lea    0xdff(%rip),%rdi
lea    0xe04(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    125a <main+0xba>
lea    0xded(%rip),%rdi
lea    0xdd7(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10a0 <usage@plt>
jmp    12a3 <main+0x103>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdc1(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    129e <main+0xfe>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10a0 <usage@plt>
jmp    12a3 <main+0x103>
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12da <main+0x13a>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13e9 <main+0x249>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <readbuffer@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jbe    135b <main+0x1bb>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
lea    -0x130(%rbp),%rdx
call   1030 <compress@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
lea    -0x130(%rbp),%r8
call   1080 <writefile@plt>
mov    -0x2c(%rbp),%eax
imul   $0x64,%rax,%rax
mov    -0x30(%rbp),%ecx
cqto
idiv   %rcx
mov    $0x64,%esi
sub    %rax,%rsi
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
lea    0xd53(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1369 <main+0x1c9>
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
cmpl   $0x0,-0x2c(%rbp)
jne    13b2 <main+0x212>
cmpl   $0x2,-0x8(%rbp)
jne    13a0 <main+0x200>
lea    0xc8d(%rip),%rdi
call   1040 <unlink@plt>
jmp    13ad <main+0x20d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <unlink@plt>
jmp    13e2 <main+0x242>
cmpl   $0x2,-0x8(%rbp)
jne    13dd <main+0x23d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <unlink@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xc4b(%rip),%rdi
call   10c0 <rename@plt>
jmp    13e2 <main+0x242>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rsi,%r13
mov    %edi,%ebp
lea    -0x4(%rbp),%eax
cmp    $0xfffffffd,%eax
ja     11d5 <main+0x25>
xor    %eax,%eax
call   10b0 <usage@plt>
mov    0x8(%r13),%rdi
lea    0xe20(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
je     121d <main+0x6d>
cmp    $0x2,%ebp
jne    123b <main+0x8b>
lea    0xe2a(%rip),%rdi
lea    0xe2f(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    126f <main+0xbf>
lea    0xe1e(%rip),%rdi
lea    0xe08(%rip),%rsi
jmp    125e <main+0xae>
mov    0x8(%r13),%rsi
lea    0xddb(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   10b0 <usage@plt>
cmp    $0x2,%ebp
je     11f2 <main+0x42>
mov    0x10(%r13),%rdi
lea    0xde9(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    126f <main+0xbf>
mov    0x10(%r13),%rsi
lea    0xdfd(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %r15d,%r15d
xor    %eax,%eax
call   10b0 <usage@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     12e6 <main+0x136>
mov    %rax,%rbx
mov    %rbp,(%rsp)
mov    %r12,%rdi
mov    %rax,%rsi
call   1080 <readbuffer@plt>
test   %eax,%eax
je     12fd <main+0x14d>
mov    %eax,%ebp
mov    %r13,0x8(%rsp)
lea    0x10(%rsp),%r14
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1030 <compress@plt>
mov    %eax,%r13d
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %r14,%r8
call   1090 <writefile@plt>
mov    %r13d,%eax
imul   $0x64,%rax,%rax
mov    %ebp,%ecx
movabs $0x7f00000000,%rdx
test   %rdx,%rax
je     131b <main+0x16b>
xor    %edx,%edx
div    %rcx
jmp    131f <main+0x16f>
lea    0xdf0(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%r14d
jmp    1393 <main+0x1e3>
lea    0xdaa(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1060 <fclose@plt>
mov    %r12,%rdi
call   1060 <fclose@plt>
jmp    1378 <main+0x1c8>
xor    %edx,%edx
div    %ecx
mov    $0x64,%esi
sub    %rax,%rsi
lea    0xd53(%rip),%rdi
xor    %r14d,%r14d
mov    %ebp,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,%rdi
call   1060 <fclose@plt>
mov    %r12,%rdi
call   1060 <fclose@plt>
test   %r13d,%r13d
mov    0x8(%rsp),%r13
je     1378 <main+0x1c8>
cmpl   $0x2,(%rsp)
jne    1393 <main+0x1e3>
mov    0x8(%r13),%rdi
call   1040 <unlink@plt>
mov    0x8(%r13),%rsi
lea    0xcb2(%rip),%rdi
call   10d0 <rename@plt>
jmp    1393 <main+0x1e3>
cmpl   $0x2,(%rsp)
jne    1387 <main+0x1d7>
lea    0xc9e(%rip),%rdi
jmp    138b <main+0x1db>
mov    0x10(%r13),%rdi
call   1040 <unlink@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rt\00"
@.str.1 = [32 x i8] c"SCPACK: error opening input %s\0A\00"
@.str.2 = [12 x i8] c"~SCPACK.TMP\00"
@.str.3 = [3 x i8] c"wt\00"
@.str.4 = [41 x i8] c"SCPACK: error opening temporary file %s\0A\00"
@.str.5 = [38 x i8] c"SCPACK: error opening output file %s\0A\00"
@UINT_MAX = global i32 0
@.str.6 = [33 x i8] c"SCPACK: error allocating memory\0A\00"
@.str.7 = [45 x i8] c"SCPACK: compression ratio: %ld%% (%d -> %d)\0A\00"
@.str.8 = [48 x i8] c"SCPACK: no SCPACK section found, nothing to do\0A\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 i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca [128 x [2 x i8]]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %17, label %14
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 3
br i1 %16, label %17, label %19
17: ; preds = %14, %2
%18 = call i32 (...) @usage()
br label %19
19: ; preds = %17, %14
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %23, i32** %6
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %31
25: ; preds = %19
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = call i32 (...) @usage()
br label %31
31: ; preds = %25, %19
%32 = load i32, i32* %4
%33 = icmp eq i32 %32, 2
br i1 %33, label %34, label %41
34: ; preds = %31
%35 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %35, i32** %7
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 (...) @usage()
br label %40
40: ; preds = %37, %34
br label %54
41: ; preds = %31
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
%45 = call i32* @fopen(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %45, i32** %7
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %53
47: ; preds = %41
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 2
%50 = load i8*, i8** %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %50)
%52 = call i32 (...) @usage()
br label %53
53: ; preds = %47, %41
br label %54
54: ; preds = %53, %40
%55 = load i32, i32* @UINT_MAX
%56 = call i64 @malloc(i32 %55)
%57 = inttoptr i64 %56 to i8*
store i8* %57, i8** %8
%58 = load i8*, i8** %8
%59 = icmp eq i8* %58, null
br i1 %59, label %60, label %62
60: ; preds = %54
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %126
62: ; preds = %54
%63 = load i32*, i32** %6
%64 = load i8*, i8** %8
%65 = call i32 @readbuffer(i32* %63, i8* %64)
store i32 %65, i32* %9
%66 = load i32, i32* %9
store i32 %66, i32* %10
%67 = load i32, i32* %9
%68 = icmp ugt i32 %67, 0
br i1 %68, label %69, label %92
69: ; preds = %62
%70 = load i8*, i8** %8
%71 = load i32, i32* %9
%72 = getelementptr inbounds [128 x [2 x i8]], [128 x [2 x i8]]* %11, i64 0, i64 0
%73 = bitcast [2 x i8]* %72 to i8**
%74 = call i32 @compress(i8* %70, i32 %71, i8** %73)
store i32 %74, i32* %9
%75 = load i32*, i32** %6
%76 = load i32*, i32** %7
%77 = load i8*, i8** %8
%78 = load i32, i32* %9
%79 = getelementptr inbounds [128 x [2 x i8]], [128 x [2 x i8]]* %11, i64 0, i64 0
%80 = bitcast [2 x i8]* %79 to i8**
%81 = call i32 @writefile(i32* %75, i32* %76, i8* %77, i32 %78, i8** %80)
%82 = load i32, i32* %9
%83 = zext i32 %82 to i64
%84 = mul nsw i64 100, %83
%85 = load i32, i32* %10
%86 = zext i32 %85 to i64
%87 = sdiv i64 %84, %86
%88 = sub nsw i64 100, %87
%89 = load i32, i32* %10
%90 = load i32, i32* %9
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i64 %88, i32 %89, i32 %90)
br label %94
92: ; preds = %62
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0))
br label %94
94: ; preds = %92, %69
%95 = load i32*, i32** %7
%96 = call i32 @fclose(i32* %95)
%97 = load i32*, i32** %6
%98 = call i32 @fclose(i32* %97)
%99 = load i32, i32* %9
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %112
101: ; preds = %94
%102 = load i32, i32* %4
%103 = icmp eq i32 %102, 2
br i1 %103, label %104, label %106
104: ; preds = %101
%105 = call i32 @unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %111
106: ; preds = %101
%107 = load i8**, i8*** %5
%108 = getelementptr inbounds i8*, i8** %107, i64 2
%109 = load i8*, i8** %108
%110 = call i32 @unlink(i8* %109)
br label %111
111: ; preds = %106, %104
br label %125
112: ; preds = %94
%113 = load i32, i32* %4
%114 = icmp eq i32 %113, 2
br i1 %114, label %115, label %124
115: ; preds = %112
%116 = load i8**, i8*** %5
%117 = getelementptr inbounds i8*, i8** %116, i64 1
%118 = load i8*, i8** %117
%119 = call i32 @unlink(i8* %118)
%120 = load i8**, i8*** %5
%121 = getelementptr inbounds i8*, i8** %120, i64 1
%122 = load i8*, i8** %121
%123 = call i32 @rename(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %122)
br label %124
124: ; preds = %115, %112
br label %125
125: ; preds = %124, %111
store i32 0, i32* %3
br label %126
126: ; preds = %125, %60
%127 = load i32, i32* %3
ret i32 %127
}

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
@.str.1 = [32 x i8] c"SCPACK: error opening input %s\0A\00"
@.str.2 = [12 x i8] c"~SCPACK.TMP\00"
@.str.3 = [3 x i8] c"wt\00"
@.str.4 = [41 x i8] c"SCPACK: error opening temporary file %s\0A\00"
@.str.5 = [38 x i8] c"SCPACK: error opening output file %s\0A\00"
@UINT_MAX = global i32 0
@.str.7 = [45 x i8] c"SCPACK: compression ratio: %ld%% (%d -> %d)\0A\00"
@str = [47 x i8] c"SCPACK: no SCPACK section found, nothing to do\00"
@str.9 = [32 x i8] c"SCPACK: error allocating memory\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x [2 x i8]]
%4 = getelementptr inbounds [128 x [2 x i8]], [128 x [2 x i8]]* %3, i64 0, i64 0, i64 0
%5 = add i32 %0, -4
%6 = icmp ult i32 %5, -2
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (...) @usage()
br label %9
9: ; preds = %2, %7
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i8*, i8** %10
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = tail call i32 (...) @usage()
br label %18
18: ; preds = %14, %9
%19 = icmp eq i32 %0, 2
br i1 %19, label %20, label %25
20: ; preds = %18
%21 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %35
23: ; preds = %20
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %33
25: ; preds = %18
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = tail call i32* @fopen(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = load i8*, i8** %26
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %23, %30
%34 = tail call i32 (...) @usage()
br label %35
35: ; preds = %33, %25, %20
%36 = phi i32* [ %21, %20 ], [ %28, %25 ], [ null, %33 ]
%37 = load i32, i32* @UINT_MAX
%38 = tail call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to i8*
%40 = icmp eq i64 %38, 0
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0))
br label %76
43: ; preds = %35
%44 = tail call i32 @readbuffer(i32* %12, i8* %39)
%45 = icmp eq i32 %44, 0
br i1 %45, label %59, label %46
46: ; preds = %43
%47 = bitcast [128 x [2 x i8]]* %3 to i8**
%48 = call i32 @compress(i8* %39, i32 %44, i8** %47)
%49 = call i32 @writefile(i32* %12, i32* %36, i8* %39, i32 %48, i8** %47)
%50 = zext i32 %48 to i64
%51 = mul nuw nsw i64 %50, 100
%52 = zext i32 %44 to i64
%53 = udiv i64 %51, %52
%54 = sub nsw i64 100, %53
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0), i64 %54, i32 %44, i32 %48)
%56 = icmp eq i32 %48, 0
%57 = call i32 @fclose(i32* %36)
%58 = call i32 @fclose(i32* %12)
br i1 %56, label %63, label %70
59: ; preds = %43
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%61 = tail call i32 @fclose(i32* %36)
%62 = tail call i32 @fclose(i32* %12)
br label %63
63: ; preds = %59, %46
br i1 %19, label %64, label %66
64: ; preds = %63
%65 = call i32 @unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %76
66: ; preds = %63
%67 = getelementptr inbounds i8*, i8** %1, i64 2
%68 = load i8*, i8** %67
%69 = call i32 @unlink(i8* %68)
br label %76
70: ; preds = %46
br i1 %19, label %71, label %76
71: ; preds = %70
%72 = load i8*, i8** %10
%73 = call i32 @unlink(i8* %72)
%74 = load i8*, i8** %10
%75 = call i32 @rename(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %74)
br label %76
76: ; preds = %66, %64, %71, %70, %41
%77 = phi i32 [ 1, %41 ], [ 0, %70 ], [ 0, %71 ], [ 0, %64 ], [ 0, %66 ]
ret i32 %77
}