#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int unzip(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int zipup(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  FILE *fi, *fo;
  int i;
  fi = fopen(argv[1], "rb");
  fo = fopen(argv[2], "wb");
  i = zipup(fi, fo);
  fclose(fi);
  fclose(fo);
  if (i) {
    printf("returncode %d\n", i);
    return i;
  }
  fi = fopen(argv[2], "rb");
  fo = fopen(argv[3], "wb");
  i = unzip(fi, fo);
  fclose(fi);
  fclose(fo);
  if (i) {
    printf("returncode %d\n", i);
    return i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe76(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <zipup@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x0,-0x24(%rbp)
je     11dc <main+0x8c>
mov    -0x24(%rbp),%esi
lea    0xe3a(%rip),%rdi
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <main+0x109>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe15(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe00(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <unzip@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x0,-0x24(%rbp)
je     1252 <main+0x102>
mov    -0x24(%rbp),%esi
lea    0xdc4(%rip),%rdi
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <main+0x109>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe9b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
mov    0x10(%r14),%rdi
lea    0xe8b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1030 <zipup@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
test   %ebp,%ebp
jne    11e8 <main+0x98>
mov    0x10(%r14),%rdi
lea    0xe54(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
mov    0x18(%r14),%rdi
lea    0xe44(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1060 <unzip@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
test   %ebp,%ebp
je     1203 <main+0xb3>
lea    0xe17(%rip),%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
jmp    11f6 <main+0xa6>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [15 x i8] c"returncode %d\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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %6
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %7
%17 = load i32*, i32** %6
%18 = load i32*, i32** %7
%19 = call i32 @zipup(i32* %17, i32* %18)
store i32 %19, i32* %8
%20 = load i32*, i32** %6
%21 = call i32 @fclose(i32* %20)
%22 = load i32*, i32** %7
%23 = call i32 @fclose(i32* %22)
%24 = load i32, i32* %8
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %2
%27 = load i32, i32* %8
%28 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %8
store i32 %29, i32* %3
br label %53
30: ; preds = %2
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %34, i32** %6
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
%38 = call i32* @fopen(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %38, i32** %7
%39 = load i32*, i32** %6
%40 = load i32*, i32** %7
%41 = call i32 @unzip(i32* %39, i32* %40)
store i32 %41, i32* %8
%42 = load i32*, i32** %6
%43 = call i32 @fclose(i32* %42)
%44 = load i32*, i32** %7
%45 = call i32 @fclose(i32* %44)
%46 = load i32, i32* %8
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %30
%49 = load i32, i32* %8
%50 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %8
store i32 %51, i32* %3
br label %53
52: ; preds = %30
store i32 0, i32* %3
br label %53
53: ; preds = %52, %48, %26
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [15 x i8] c"returncode %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32* @fopen(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @zipup(i32* %5, i32* %8)
%10 = tail call i32 @fclose(i32* %5)
%11 = tail call i32 @fclose(i32* %8)
%12 = icmp eq i32 %9, 0
br i1 %12, label %13, label %23
13: ; preds = %2
%14 = load i8*, i8** %6
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 @unzip(i32* %15, i32* %18)
%20 = tail call i32 @fclose(i32* %15)
%21 = tail call i32 @fclose(i32* %18)
%22 = icmp eq i32 %19, 0
br i1 %22, label %26, label %23
23: ; preds = %13, %2
%24 = phi i32 [ %9, %2 ], [ %19, %13 ]
%25 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23, %13
%27 = phi i32 [ 0, %13 ], [ %24, %23 ]
ret i32 %27
}