#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 */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ gzcopy(int /*<<< orphan*/, int, unsigned long *,
                          unsigned long *, int /*<<< orphan*/);
int /*<<< orphan*/ gzinit(unsigned long *, unsigned long *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  unsigned long crc, tot;
  argc--;
  argv++;
  if (argc == 0) {
    fputs("gzjoin usage: gzjoin f1.gz [f2.gz [f3.gz ...]] > fjoin.gz\n",
          stderr);
    return 0;
  }
  gzinit(&crc, &tot, stdout);
  while (argc--)
    gzcopy(*argv++, argc, &crc, &tot, stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1186 <main+0x56>
mov    0x2e74(%rip),%rax
mov    (%rax),%esi
lea    0xe8b(%rip),%rdi
call   1030 <fputs@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ea <main+0xba>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <gzinit@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11e3 <main+0xb3>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
mov    -0x8(%rbp),%esi
mov    0x2e0a(%rip),%rax
mov    (%rax),%r8d
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1050 <gzcopy@plt>
jmp    119c <main+0x6c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
cmp    $0x1,%edi
jne    1158 <main+0x28>
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
lea    0xeaf(%rip),%rdi
call   1030 <fputs@plt>
jmp    11ac <main+0x7c>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e74(%rip),%r12
mov    (%r12),%edx
lea    0x8(%rsp),%r14
mov    %rsp,%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <gzinit@plt>
add    $0xfffffffe,%ebp
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx),%edi
mov    (%r12),%r8d
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r15,%rcx
call   1050 <gzcopy@plt>
add    $0x8,%rbx
add    $0xffffffff,%ebp
jb     1190 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [59 x i8] c"gzjoin usage: gzjoin f1.gz [f2.gz [f3.gz ...]] > fjoin.gz\0A\00"
@stderr = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i32 1
store i8** %11, i8*** %5
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 @fputs(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %15)
store i32 0, i32* %3
br label %33
17: ; preds = %2
%18 = load i32, i32* @stdout
%19 = call i32 @gzinit(i64* %6, i64* %7, i32 %18)
br label %20
20: ; preds = %24, %17
%21 = load i32, i32* %4
%22 = add nsw i32 %21, -1
store i32 %22, i32* %4
%23 = icmp ne i32 %21, 0
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i32 1
store i8** %26, i8*** %5
%27 = load i8*, i8** %25
%28 = ptrtoint i8* %27 to i32
%29 = load i32, i32* %4
%30 = load i32, i32* @stdout
%31 = call i32 @gzcopy(i32 %28, i32 %29, i64* %6, i64* %7, i32 %30)
br label %20
32: ; preds = %20
store i32 0, i32* %3
br label %33
33: ; preds = %32, %14
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [59 x i8] c"gzjoin usage: gzjoin f1.gz [f2.gz [f3.gz ...]] > fjoin.gz\0A\00"
@stderr = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %3 to i8*
%6 = bitcast i64* %4 to i8*
%7 = icmp eq i32 %0, 1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 @fputs(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %26
11: ; preds = %2
%12 = load i32, i32* @stdout
%13 = call i32 @gzinit(i64* %3, i64* %4, i32 %12)
%14 = add nsw i32 %0, -2
br label %15
15: ; preds = %11, %15
%16 = phi i32 [ %14, %11 ], [ %24, %15 ]
%17 = phi i8** [ %1, %11 ], [ %18, %15 ]
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = ptrtoint i8* %19 to i64
%21 = trunc i64 %20 to i32
%22 = load i32, i32* @stdout
%23 = call i32 @gzcopy(i32 %21, i32 %16, i64* %3, i64* %4, i32 %22)
%24 = add nsw i32 %16, -1
%25 = icmp eq i32 %16, 0
br i1 %25, label %26, label %15
26: ; preds = %15, %8
ret i32 0
}