// File: /workspace/github_cpp_makefile_star2_O3/twekkel[P]mzpq/mzpq.cpp
// Function: main
int main(int argc, char **argv) {

	// Initialization
	int c = 0;
	bool conout   = false;
	bool compress = true;
	bool force    = false;
	bool keep     = false;
	bool name     = false;
	std::size_t found;
	std::string method = "4";
	std::string fname;
	std::string fnorg;

	// See how we are called and change defaults accordingly
	std::string filename = argv[0];
	found = filename.find_last_of("\\/");
	if ( std::string::npos != found ) filename.erase(0, found + 1);

	if ( filename.compare("unmzpq") == 0 ) {
		compress = false;
	} else if ( filename.compare("mzpqcat") == 0 ) {
		conout   = true;
		compress = false;
		keep     = true;
	}

	// Parse command line arguments
	while ((c = getopt (argc, argv, "123456789cdfhkm:NV")) != -1)
	switch(c)
	{
	case '1':
		method = "1";
		break;
	case '2':
		method = "2";
		break;
	case '3':
		method = "3";
		break;
	case '4':
		method = "4";
		break;
	case '5':
		method = "47";
		break;
	case '6':
		method = "51";
		break;
	case '7':
		method = "54";
		break;
	case '8':
		method = "57";
		break;
	case '9':
		method = "59";
		break;
	case 'c':
		conout = true;
		break;
	case 'd':
		compress = false;
		break;
	case 'f':
		force = true;
		break;
	case 'h':
		usage();
		break;
	case 'k':
		keep = true;
		break;
	case 'm':
		method = optarg;
		break;
	case 'N':
		name = true;
		break;
	case 'V':
		version();
		break;
	default:
		usage();
	}

	// Loop over the arguments/file names, at least once to cover stdin
	int i = optind;
	do {

		if ( argv[i] != NULL ) fname = argv[i];
		if ( fname.compare("-") == 0) fname.clear();
		fnorg = fname;

		// Try to read from file
		if ( ! fname.empty() && ! fexists(fname) ) {
			fprintf(stderr, "%s does not exists\n", fname.c_str());
			exit(1);
		}

		if ( ! fname.empty() ) {
			stdin = freopen( fname.c_str() , "r", stdin );
		}

		// Compress
		if ( compress && ! conout && ! fname.empty() ) {
			fname += suffix;
			if ( ! force && fexists(fname) ) {
				fprintf(stderr, "%s already exists\n", fname.c_str());
				return 1;
			}
			stdout = freopen(fname.c_str() , "w", stdout);
		}

		// Decompress
		if ( ! compress && ! conout && ! fname.empty() ) {
			found = fname.find(suffix);
			if ( found == std::string::npos ) {
				fprintf(stderr, "unknown suffix: %s\n", fname.c_str());
				exit(1);
			}
			fname = fname.substr( 0, found );
			if ( ! force && fexists(fname) ) {
				fprintf(stderr, "%s already exists\n", fname.c_str());
				return 1;
			}
			stdout = freopen(fname.c_str() , "w", stdout);
		}

		// Do the actual work
		if ( compress ) {
			libzpaq::compress(&in, &out, method.c_str(), name ? fnorg.c_str() : "");
		} else {
			libzpaq::decompress(&in, &out);
		}

		// Remove input file
		if ( ! keep ) remove(fnorg.c_str());

		// Next file
		i++;
	} while ( i < argc );

	// Flush output streams before exiting
	fflush(stdout);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rsi, %r13
movl %edi, %ebp
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x35156(%rip), %rsi     # 0x39745
leaq 0x35150(%rip), %rdx     # 0x39746
leaq 0x68(%rsp), %rdi
callq 0x4d68
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
xorl %eax, %eax
movq %rax, -0x8(%r15)
movb %al, (%r15)
leaq 0x58(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq (%r13), %rsi
leaq 0x88(%rsp), %rdi
leaq 0x108(%rsp), %rdx
callq 0x4d04
leaq 0x30a1d(%rip), %rsi     # 0x3505e
leaq 0x88(%rsp), %rdi
movl $0x2, %ecx
movq $-0x1, %rdx
callq 0x4360
cmpq $-0x1, %rax
je 0x4675
incq %rax
leaq 0x88(%rsp), %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x4050
leaq 0x309e5(%rip), %rsi     # 0x35061
leaq 0x88(%rsp), %rdi
callq 0x4070
testl %eax, %eax
je 0x46af
leaq 0x309d4(%rip), %rsi     # 0x35068
leaq 0x88(%rsp), %rdi
callq 0x4070
testl %eax, %eax
setne %al
movl %eax, 0x4(%rsp)
sete %al
jmp 0x46b9
movl $0x0, 0x4(%rsp)
xorl %eax, %eax
movq $0x0, 0x28(%rsp)
leaq 0x309a7(%rip), %r15     # 0x35070
leaq 0x30934(%rip), %r12     # 0x35004
leaq 0x68(%rsp), %r14
movb %al, 0x3(%rsp)
movq $0x0, 0x38(%rsp)
movq %r13, 0x40(%rsp)
movl %eax, 0x34(%rsp)
movl %ebp, %edi
movq %r13, %rsi
movq %r15, %rdx
callq 0x4040
cmpl $0x4d, %eax
jg 0x4724
leal -0x31(%rax), %ecx
cmpl $0x8, %ecx
ja 0x4835
movl $0x1, %r8d
movslq (%r12,%rcx,4), %rax
addq %r12, %rax
jmpq *%rax
leaq 0x356d0(%rip), %rcx     # 0x39def
jmp 0x47e2
leal -0x63(%rax), %ecx
cmpl $0xa, %ecx
ja 0x47f6
leaq 0x308f1(%rip), %rdx     # 0x35028
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x3c879(%rip), %rax     # 0x40fc0
movq (%rax), %r13
movl %ebp, %ebx
movq %r15, %rbp
movq 0x70(%rsp), %r15
movq %r13, %rdi
callq 0x40b0
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbp, %r15
movl %ebx, %ebp
movq %r13, %rcx
movq 0x40(%rsp), %r13
movq %rax, %r8
callq 0x4290
jmp 0x46eb
movl $0x2, %r8d
leaq 0x308f8(%rip), %rcx     # 0x35083
jmp 0x47e2
leaq 0x37d21(%rip), %rcx     # 0x3c4b5
jmp 0x47e2
leaq 0x34fa8(%rip), %rcx     # 0x39745
jmp 0x47e2
movl $0x2, %r8d
leaq 0x308e0(%rip), %rcx     # 0x3508c
jmp 0x47e2
leaq 0x37ce4(%rip), %rcx     # 0x3c499
jmp 0x47e2
movl $0x2, %r8d
leaq 0x308c2(%rip), %rcx     # 0x35086
jmp 0x47e2
movl $0x2, %r8d
leaq 0x308b6(%rip), %rcx     # 0x35089
jmp 0x47e2
movl $0x2, %r8d
leaq 0x308ad(%rip), %rcx     # 0x3508f
movq 0x70(%rsp), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x4290
jmp 0x46eb
cmpl $0x4e, %eax
jne 0x4c47
movb $0x1, %al
movq %rax, 0x38(%rsp)
jmp 0x46eb
movb $0x1, %al
movq %rax, 0x28(%rsp)
jmp 0x46eb
movl $0x0, 0x4(%rsp)
jmp 0x46eb
movb $0x1, 0x3(%rsp)
jmp 0x46eb
movb $0x1, %al
jmp 0x46e7
cmpl $-0x1, %eax
jne 0x4c51
movq 0x3c79b(%rip), %rax     # 0x40fe0
movslq (%rax), %r13
leaq 0xf8(%rsp), %r12
movslq %ebp, %rbp
leaq 0x8(%rsp), %r15
movq 0x40(%rsp), %rax
movq (%rax,%r13,8), %r14
testq %r14, %r14
je 0x488c
movq %r12, %rbx
movq 0x10(%rsp), %r12
movq %r14, %rdi
callq 0x40b0
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rbx, %r12
movq %r14, %rcx
movq %rax, %r8
callq 0x4290
movq %r15, %rdi
leaq 0x35062(%rip), %rsi     # 0x398f8
callq 0x4070
testl %eax, %eax
jne 0x48b0
movq $0x0, 0x10(%rsp)
movq 0x8(%rsp), %rax
movb $0x0, (%rax)
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x40d0
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
je 0x494e
movq %r12, 0xe8(%rsp)
movq 0x8(%rsp), %rsi
addq %rsi, %rdx
leaq 0xe8(%rsp), %rdi
callq 0x4dfe
movq 0xe8(%rsp), %rdi
xorl %esi, %esi
callq 0x42f0
movl %eax, %r14d
movq 0xe8(%rsp), %rdi
cmpq %r12, %rdi
je 0x4917
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x4180
cmpl $-0x1, %r14d
je 0x4c64
cmpq $0x0, 0x10(%rsp)
je 0x494e
movq 0x8(%rsp), %rdi
movq 0x3c69b(%rip), %rax     # 0x40fd0
movq (%rax), %rdx
leaq 0x34fc4(%rip), %rsi     # 0x39903
callq 0x41a0
movq 0x3c685(%rip), %rcx     # 0x40fd0
movq %rax, (%rcx)
cmpq $0x0, 0x10(%rsp)
sete %al
orb 0x34(%rsp), %al
testb $0x1, 0x4(%rsp)
je 0x4a54
testb $0x1, %al
jne 0x4a1b
movq 0x3d90b(%rip), %rsi     # 0x42280
movq 0x3d90c(%rip), %rdx     # 0x42288
movq %r15, %rdi
callq 0x4080
testb $0x1, 0x28(%rsp)
jne 0x49f6
leaq 0xd8(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %rdi
callq 0x4dfe
movq 0xc8(%rsp), %rdi
xorl %esi, %esi
callq 0x42f0
movl %eax, %r14d
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x49ec
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x4180
cmpl $-0x1, %r14d
jne 0x4c27
movq 0x8(%rsp), %rdi
movq 0x3c5a6(%rip), %rax     # 0x40fa8
movq (%rax), %rdx
leaq 0x35307(%rip), %rsi     # 0x39d13
callq 0x41a0
movq 0x3c590(%rip), %rcx     # 0x40fa8
movq %rax, (%rcx)
leaq 0x35799(%rip), %rcx     # 0x3a1bb
testb $0x1, 0x38(%rsp)
je 0x4a2e
movq 0x48(%rsp), %rcx
movq 0x68(%rsp), %rdx
leaq 0x3c796(%rip), %rdi     # 0x411d0
leaq 0x3c797(%rip), %rsi     # 0x411d8
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xe9c1
jmp 0x4b70
testb $0x1, %al
jne 0x4b5d
movq 0x3d81d(%rip), %rsi     # 0x42280
movq 0x3d81e(%rip), %rcx     # 0x42288
movq %r15, %rdi
xorl %edx, %edx
callq 0x4300
cmpq $-0x1, %rax
je 0x4c6e
leaq 0x108(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x4190
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4220
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x4ac6
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x4180
testb $0x1, 0x28(%rsp)
jne 0x4b38
leaq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0x4dfe
movq 0xa8(%rsp), %rdi
xorl %esi, %esi
callq 0x42f0
movl %eax, %r14d
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x4b2e
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4180
cmpl $-0x1, %r14d
jne 0x4c33
movq 0x8(%rsp), %rdi
movq 0x3c464(%rip), %rax     # 0x40fa8
movq (%rax), %rdx
leaq 0x351c5(%rip), %rsi     # 0x39d13
callq 0x41a0
movq 0x3c44e(%rip), %rcx     # 0x40fa8
movq %rax, (%rcx)
leaq 0x3c66c(%rip), %rdi     # 0x411d0
leaq 0x3c66d(%rip), %rsi     # 0x411d8
callq 0xd28a
testb $0x1, 0x3(%rsp)
jne 0x4b81
movq 0x48(%rsp), %rdi
callq 0x4340
incq %r13
cmpq %rbp, %r13
jl 0x4858
movq 0x3c414(%rip), %rax     # 0x40fa8
movq (%rax), %rdi
callq 0x41e0
xorl %ebx, %ebx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
leaq 0x78(%rsp), %r14
leaq 0x18(%rsp), %r15
je 0x4bc9
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4180
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x4be5
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4180
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4bfc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4180
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x4c13
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4180
movl %ebx, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %rdi
callq 0x43f2
jmp 0x4c3d
leaq 0x8(%rsp), %rdi
callq 0x43a7
movl $0x1, %ebx
jmp 0x4b9e
cmpl $0x56, %eax
jne 0x4c51
callq 0x45a9
leaq 0x3049f(%rip), %rdi     # 0x350f7
callq 0x4280
xorl %edi, %edi
callq 0x4210
leaq 0x8(%rsp), %rdi
callq 0x4380
leaq 0x8(%rsp), %rdi
callq 0x43cb
jmp 0x4c83
movq %rax, %rbx
jmp 0x4cb1
jmp 0x4c83
jmp 0x4c83
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
leaq 0x78(%rsp), %r14
leaq 0x18(%rsp), %r15
je 0x4cb1
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4180
leaq 0x58(%rsp), %rax
movq 0x48(%rsp), %rdi
cmpq %rax, %rdi
je 0x4ccd
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4180
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4ce4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4180
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x4cfb
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4180
movq %rbx, %rdi
callq 0x4310
nop