// File: /workspace/github_cpp_makefile_star2_O2/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 $0x118, %rsp            # imm = 0x118
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x1da41(%rip), %rsi     # 0x21fa5
leaq 0x78(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x4aac
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq 0x68(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %edx, %edx
movb %dl, (%rax)
movb %dl, (%rcx)
movq (%rbx), %rsi
leaq 0x38(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x4aac
leaq 0x19ab2(%rip), %rsi     # 0x1e063
leaq 0x38(%rsp), %rdi
pushq $-0x1
popq %rdx
callq 0x4160
cmpq $-0x1, %rax
je 0x45d6
incq %rax
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x4050
leaq 0x19a89(%rip), %rsi     # 0x1e066
leaq 0x38(%rsp), %rdi
callq 0x4080
testl %eax, %eax
je 0x460a
leaq 0x19a7b(%rip), %rsi     # 0x1e06d
leaq 0x38(%rsp), %rdi
callq 0x4080
testl %eax, %eax
setne %al
movl %eax, 0x10(%rsp)
sete %al
jmp 0x4614
movl $0x0, 0x10(%rsp)
xorl %eax, %eax
movl $0x0, 0xc(%rsp)
leaq 0x19a52(%rip), %r15     # 0x1e075
leaq 0x1e025(%rip), %r14     # 0x2264f
leaq 0x78(%rsp), %r12
leaq 0x199ce(%rip), %r13     # 0x1e004
movl %eax, 0x8(%rsp)
movb %al, 0x7(%rsp)
movl $0x0, 0x14(%rsp)
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x4040
leal -0x31(%rax), %ecx
cmpl $0x8, %ecx
ja 0x4671
movslq (%r13,%rcx,4), %rax
addq %r13, %rax
movq %r14, %rsi
jmpq *%rax
leaq 0x2068a(%rip), %rsi     # 0x24cf9
jmp 0x46da
leal -0x63(%rax), %ecx
cmpl $0xa, %ecx
ja 0x46e7
leaq 0x199a8(%rip), %rdx     # 0x1e028
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x26930(%rip), %rax     # 0x2afc0
movq (%rax), %rsi
movq %r12, %rdi
callq 0x4370
jmp 0x4646
leaq 0x199e4(%rip), %rsi     # 0x1e088
jmp 0x46da
leaq 0x20668(%rip), %rsi     # 0x24d15
jmp 0x46da
leaq 0x1d8ef(%rip), %rsi     # 0x21fa5
jmp 0x46da
leaq 0x199d2(%rip), %rsi     # 0x1e091
jmp 0x46da
leaq 0x199c3(%rip), %rsi     # 0x1e08b
jmp 0x46da
leaq 0x199bd(%rip), %rsi     # 0x1e08e
jmp 0x46da
leaq 0x199ba(%rip), %rsi     # 0x1e094
movq %r12, %rdi
callq 0x4370
jmp 0x4646
cmpl $-0x1, %eax
je 0x472d
cmpl $0x4e, %eax
jne 0x4a22
movb $0x1, %al
movl %eax, 0x14(%rsp)
jmp 0x4646
movb $0x1, %al
movl %eax, 0xc(%rsp)
jmp 0x4646
movb $0x1, 0x7(%rsp)
jmp 0x4646
movl $0x0, 0x10(%rsp)
jmp 0x4646
movb $0x1, %al
movl %eax, 0x8(%rsp)
jmp 0x4646
movq 0x268ac(%rip), %rax     # 0x2afe0
movslq (%rax), %r14
movslq %ebp, %r13
leaq 0x18(%rsp), %r15
leaq 0xb8(%rsp), %rbp
movl 0x8(%rsp), %r12d
movq (%rbx,%r14,8), %rsi
testq %rsi, %rsi
je 0x475d
movq %r15, %rdi
callq 0x4370
movq %r15, %rdi
leaq 0x1d9f1(%rip), %rsi     # 0x22158
callq 0x4080
testl %eax, %eax
jne 0x477e
andq $0x0, 0x20(%rsp)
movq 0x18(%rsp), %rax
movb $0x0, (%rax)
leaq 0x58(%rsp), %rdi
movq %r15, %rsi
callq 0x40d0
cmpq $0x0, 0x20(%rsp)
je 0x47ec
movq %rbp, %rdi
movq %r15, %rsi
callq 0x4250
movq %rbp, %rdi
callq 0x4500
movl %eax, %r12d
movq %rbp, %rdi
callq 0x43a8
testb %r12b, %r12b
je 0x4a31
cmpq $0x0, 0x20(%rsp)
movl 0x8(%rsp), %r12d
je 0x47ec
movq 0x18(%rsp), %rdi
movq 0x267fd(%rip), %rax     # 0x2afd0
movq (%rax), %rdx
leaq 0x1d986(%rip), %rsi     # 0x22163
callq 0x41b0
movq 0x267e7(%rip), %rcx     # 0x2afd0
movq %rax, (%rcx)
cmpq $0x0, 0x20(%rsp)
sete %al
orb %r12b, %al
testb $0x1, 0x10(%rsp)
je 0x48c3
testb $0x1, %al
jne 0x488c
movq %r15, %rdi
leaq 0x27a7b(%rip), %rsi     # 0x2c290
callq 0x4380
testb $0x1, 0xc(%rsp)
jne 0x4867
leaq 0xf8(%rsp), %rdi
movq %r15, %rsi
callq 0x4250
leaq 0xf8(%rsp), %rbp
movq %rbp, %rdi
callq 0x4500
movl %eax, %r12d
movq %rbp, %rdi
leaq 0xb8(%rsp), %rbp
leaq 0x18(%rsp), %r15
callq 0x43a8
testb %r12b, %r12b
movl 0x8(%rsp), %r12d
jne 0x4a00
movq 0x18(%rsp), %rdi
movq 0x26735(%rip), %rax     # 0x2afa8
movq (%rax), %rdx
leaq 0x1dcf6(%rip), %rsi     # 0x22573
callq 0x41b0
movq 0x2671f(%rip), %rcx     # 0x2afa8
movq %rax, (%rcx)
leaq 0x1e188(%rip), %rcx     # 0x22a1b
testb $0x1, 0x14(%rsp)
je 0x489f
movq 0x58(%rsp), %rcx
movq 0x78(%rsp), %rdx
leaq 0x26935(%rip), %rdi     # 0x2b1e0
leaq 0x26936(%rip), %rsi     # 0x2b1e8
xorl %r8d, %r8d
pushq $0x1
popq %r9
callq 0xdb38
jmp 0x4996
testb $0x1, %al
jne 0x4983
movq %r15, %rdi
leaq 0x279bb(%rip), %rsi     # 0x2c290
xorl %edx, %edx
callq 0x4390
cmpq $-0x1, %rax
je 0x4a49
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x41a0
movq %r15, %rdi
leaq 0x98(%rsp), %rbp
movq %rbp, %rsi
callq 0x4220
movq %rbp, %rdi
callq 0x43a8
testb $0x1, 0xc(%rsp)
jne 0x4956
leaq 0xd8(%rsp), %rdi
movq %r15, %rsi
callq 0x4250
leaq 0xd8(%rsp), %rbp
movq %rbp, %rdi
callq 0x4500
movl %eax, %r12d
movq %rbp, %rdi
callq 0x43a8
testb %r12b, %r12b
movl 0x8(%rsp), %r12d
jne 0x4a00
movq 0x18(%rsp), %rdi
movq 0x26646(%rip), %rax     # 0x2afa8
movq (%rax), %rdx
leaq 0x1dc07(%rip), %rsi     # 0x22573
callq 0x41b0
leaq 0xb8(%rsp), %rbp
movq 0x26628(%rip), %rcx     # 0x2afa8
movq %rax, (%rcx)
leaq 0x26856(%rip), %rdi     # 0x2b1e0
leaq 0x26857(%rip), %rsi     # 0x2b1e8
callq 0xc642
testb $0x1, 0x7(%rsp)
jne 0x49a7
movq 0x58(%rsp), %rdi
callq 0x4350
incq %r14
cmpq %r13, %r14
jl 0x474c
movq 0x265ee(%rip), %rax     # 0x2afa8
movq (%rax), %rdi
callq 0x41e0
xorl %ebx, %ebx
leaq 0x38(%rsp), %rdi
callq 0x43a8
leaq 0x58(%rsp), %rdi
callq 0x43a8
leaq 0x18(%rsp), %rdi
callq 0x43a8
leaq 0x78(%rsp), %rdi
callq 0x43a8
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x265d1(%rip), %rax     # 0x2afd8
movq (%rax), %rdi
movq 0x18(%rsp), %rdx
leaq 0x19695(%rip), %rsi     # 0x1e0ab
xorl %eax, %eax
callq 0x4280
pushq $0x1
popq %rbx
jmp 0x49c4
cmpl $0x56, %eax
jne 0x4a2c
callq 0x4527
callq 0x4513
movq 0x265a0(%rip), %rax     # 0x2afd8
movq (%rax), %rdi
movq 0x18(%rsp), %rdx
leaq 0x19650(%rip), %rsi     # 0x1e097
jmp 0x4a5f
movq 0x26588(%rip), %rax     # 0x2afd8
movq (%rax), %rdi
movq 0x18(%rsp), %rdx
leaq 0x1965f(%rip), %rsi     # 0x1e0be
xorl %eax, %eax
callq 0x4280
pushq $0x1
popq %rdi
callq 0x4210
jmp 0x4a79
movq %rax, %rbx
jmp 0x4a86
jmp 0x4a79
jmp 0x4a79
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x43a8
leaq 0x58(%rsp), %rdi
callq 0x43a8
leaq 0x18(%rsp), %rdi
callq 0x43a8
leaq 0x78(%rsp), %rdi
callq 0x43a8
movq %rbx, %rdi
callq 0x4320