// File: /workspace/github_c_makefile_star2_O1/lmcilroy[P]lzm/lzdata.c
// Function: main
int
main(int argc, char **argv)
{
	struct lzdata_args args;
	int ret = 0;
	int err;
	int c;

	args.file_size = FILE_SIZE;
	args.chunk_size = CHUNK_SIZE;
	args.min_lit_len = 0;
	args.max_lit_len = 0;
	args.min_match_len = 0;
	args.max_match_len = 0;
	args.min_offset = 0;
	args.max_offset = 0;
	args.verbose = false;
	args.match_prob = MATCH_PROB;
	args.lit_len_scale = LEN_SCALE;
	args.match_len_scale = LEN_SCALE;
	args.random_seed = 0;

	while ((c = getopt_long(argc, argv, "hv", long_opts, NULL)) != EOF) {
		switch (c) {
		case FILESIZE:
			args.file_size = strtoul(optarg, NULL, 0);
			if (args.chunk_size == 0) {
				fprintf(stderr, "Error: file size is zero");
				exit(1);
			}
			args.file_size <<= 20;
			break;
		case CHUNKSIZE:
			args.chunk_size = strtoul(optarg, NULL, 0);
			if (args.chunk_size == 0) {
				fprintf(stderr, "Error: chunk size is zero");
				exit(1);
			}
			args.chunk_size <<= 10;
			break;
		case MINLITLEN:
			args.min_lit_len = strtoul(optarg, NULL, 0);
			if (args.min_lit_len == 0) {
				fprintf(stderr, "Error: bad min lit len");
				exit(1);
			}
			break;
		case MAXLITLEN:
			args.max_lit_len = strtoul(optarg, NULL, 0);
			if (args.max_lit_len == 0) {
				fprintf(stderr, "Error: bad max lit len");
				exit(1);
			}
			break;
		case MINMATCHLEN:
			args.min_match_len = strtoul(optarg, NULL, 0);
			if (args.min_match_len == 0) {
				fprintf(stderr, "Error: bad min match len");
				exit(1);
			}
			break;
		case MAXMATCHLEN:
			args.max_match_len = strtoul(optarg, NULL, 0);
			if (args.max_match_len == 0) {
				fprintf(stderr, "Error: bad max match len");
				exit(1);
			}
			break;
		case MINOFFSET:
			args.min_offset = strtoul(optarg, NULL, 0);
			if (args.min_offset == 0) {
				fprintf(stderr, "Error: bad min offset");
				exit(1);
			}
			break;
		case MAXOFFSET:
			args.max_offset = strtoul(optarg, NULL, 0);
			if (args.max_offset == 0) {
				fprintf(stderr, "Error: bad max offset");
				exit(1);
			}
			break;
		case MATCHPROB:
			args.match_prob = strtod(optarg, NULL);
			if (args.match_prob < 0.0 || args.match_prob > 1.0) {
				fprintf(stderr, "Error: bad match prob");
				exit(1);
			}
			break;
		case LITLENSCALE:
			args.lit_len_scale = strtod(optarg, NULL);
			if (args.lit_len_scale < 0.0) {
				fprintf(stderr, "Error: bad lit len scale");
				exit(1);
			}
			break;
		case MATCHLENSCALE:
			args.match_len_scale = strtod(optarg, NULL);
			if (args.match_len_scale < 0.0) {
				fprintf(stderr, "Error: bad match len scale");
				exit(1);
			}
			break;
		case RANDOMSEED:
			args.random_seed = strtoul(optarg, NULL, 0);
			break;
		case 'v':
		case VERBOSE:
			args.verbose = true;
			break;
		case 'h':
		case HELP:
		default:
			usage();
			exit(1);
			break;
		}
	}

	if (args.min_lit_len == 0)
		args.min_lit_len = 1;
	if (args.max_lit_len == 0)
		args.max_lit_len = args.chunk_size;
	if (args.min_match_len == 0)
		args.min_match_len = MIN_MATCH;
	if (args.max_match_len == 0)
		args.max_match_len = args.chunk_size;
	if (args.min_offset == 0)
		args.min_offset = 1;
	if (args.max_offset == 0)
		args.max_offset = args.chunk_size;

	if (args.min_lit_len > args.max_lit_len) {
		fprintf(stderr, "Error: min lit length > max lit length\n");
		exit(1);
	}

	if (args.min_match_len > args.max_match_len) {
		fprintf(stderr, "Error: min match length > max match length\n");
		exit(1);
	}

	if (args.min_offset > args.max_offset) {
		fprintf(stderr, "Error: min offset > max offset\n");
		exit(1);
	}

	if (optind == argc) {
		usage();
		exit(1);
	}

	if (args.verbose == true) {
		printf("File size: %lu\n", args.file_size);
		printf("Chunk size: %u\n", args.chunk_size);
		printf("Min lit len: %u\n", args.min_lit_len);
		printf("Max lit len: %u\n", args.max_lit_len);
		printf("Min match len: %u\n", args.min_match_len);
		printf("Max match len: %u\n", args.max_match_len);
		printf("Min offset: %u\n", args.min_offset);
		printf("Max offset: %u\n", args.max_offset);
		printf("Match probability: %.4f\n", args.match_prob);
		printf("Lit len scale: %.4f\n", args.lit_len_scale);
		printf("Match len scale: %.4f\n", args.match_len_scale);
		printf("Random seed: %lu\n", args.random_seed);
	}

	srand48(args.random_seed);

	while (optind < argc) {
		args.filename = argv[optind];
		err = process_file(&args);
		if (ret == 0)
			ret = err;
		optind++;
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %rbp
movl %edi, (%rsp)
leaq 0x18(%rsp), %rcx
movq $0x6400000, -0x8(%rcx)  # imm = 0x6400000
movl $0x400000, (%rcx)       # imm = 0x400000
xorpd %xmm0, %xmm0
movupd %xmm0, 0x4(%rcx)
movupd %xmm0, 0x10(%rcx)
movabsq $0x3fe570a3d70a3d71, %rax # imm = 0x3FE570A3D70A3D71
movq %rax, 0x20(%rcx)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0x28(%rcx)
movq %rax, 0x30(%rcx)
movq $0x0, 0x38(%rcx)
leaq 0xb11(%rip), %r14       # 0x2054
leaq 0x2b76(%rip), %r15      # 0x40c0
leaq 0xacb(%rip), %rbx       # 0x201c
movq 0x2a80(%rip), %r12      # 0x3fd8
movl (%rsp), %edi
movq %rbp, %rsi
movq %r14, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x1080
leal 0x1(%rax), %ecx
cmpl $0xd, %ecx
ja 0x15a5
movslq (%rbx,%rcx,4), %rax
addq %rbx, %rax
jmpq *%rax
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
movq %rax, 0x10(%rsp)
cmpl $0x0, 0x18(%rsp)
je 0x1ceb
shlq $0x14, %rax
movq %rax, 0x10(%rsp)
jmp 0x1558
cmpl $0x76, %eax
jne 0x1cbe
movl $0x1, 0x34(%rsp)
jmp 0x1558
movq (%r12), %rdi
xorl %esi, %esi
callq 0x1060
movsd %xmm0, 0x40(%rsp)
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1558
jmp 0x1cf0
movq (%r12), %rdi
xorl %esi, %esi
callq 0x1060
movsd %xmm0, 0x38(%rsp)
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja 0x1ce6
ucomisd 0xa09(%rip), %xmm0      # 0x2008
jbe 0x1558
jmp 0x1ce6
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
movl %eax, 0x2c(%rsp)
testl %eax, %eax
jne 0x1558
jmp 0x1cdc
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
movl %eax, 0x18(%rsp)
testl %eax, %eax
je 0x1cf5
shll $0xa, %eax
movl %eax, 0x18(%rsp)
jmp 0x1558
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
movl %eax, 0x24(%rsp)
testl %eax, %eax
jne 0x1558
jmp 0x1cd2
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
movl %eax, 0x28(%rsp)
testl %eax, %eax
jne 0x1558
jmp 0x1cd7
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
movq %rax, 0x50(%rsp)
jmp 0x1558
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
movl %eax, 0x30(%rsp)
testl %eax, %eax
jne 0x1558
jmp 0x1ce1
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
movl %eax, 0x20(%rsp)
testl %eax, %eax
jne 0x1558
jmp 0x1ccd
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
movl %eax, 0x1c(%rsp)
testl %eax, %eax
jne 0x1558
jmp 0x1cfa
movq (%r12), %rdi
xorl %esi, %esi
callq 0x1060
movsd %xmm0, 0x48(%rsp)
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1558
callq 0x1170
cmpl $0x0, 0x1c(%rsp)
jne 0x172d
movl $0x1, 0x1c(%rsp)
cmpl $0x0, 0x20(%rsp)
jne 0x173c
movl 0x18(%rsp), %eax
movl %eax, 0x20(%rsp)
cmpl $0x0, 0x24(%rsp)
jne 0x174b
movl $0x4, 0x24(%rsp)
cmpl $0x0, 0x28(%rsp)
jne 0x175a
movl 0x18(%rsp), %eax
movl %eax, 0x28(%rsp)
cmpl $0x0, 0x2c(%rsp)
jne 0x1769
movl $0x1, 0x2c(%rsp)
cmpl $0x0, 0x30(%rsp)
jne 0x1778
movl 0x18(%rsp), %eax
movl %eax, 0x30(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x20(%rsp), %eax
ja 0x1cff
movl 0x24(%rsp), %eax
cmpl 0x28(%rsp), %eax
ja 0x1d04
movl 0x2c(%rsp), %eax
cmpl 0x30(%rsp), %eax
ja 0x1d09
movq 0x2827(%rip), %rcx      # 0x3fd0
movl (%rsp), %eax
cmpl %eax, (%rcx)
je 0x1cbe
cmpl $0x1, 0x34(%rsp)
jne 0x189f
movq 0x10(%rsp), %rsi
leaq 0xa09(%rip), %rdi       # 0x21d4
xorl %eax, %eax
callq 0x1090
movl 0x18(%rsp), %esi
leaq 0xa07(%rip), %rdi       # 0x21e4
xorl %eax, %eax
callq 0x1090
movl 0x1c(%rsp), %esi
leaq 0xa05(%rip), %rdi       # 0x21f4
xorl %eax, %eax
callq 0x1090
movl 0x20(%rsp), %esi
leaq 0xa04(%rip), %rdi       # 0x2205
xorl %eax, %eax
callq 0x1090
movl 0x24(%rsp), %esi
leaq 0xa03(%rip), %rdi       # 0x2216
xorl %eax, %eax
callq 0x1090
movl 0x28(%rsp), %esi
leaq 0xa04(%rip), %rdi       # 0x2229
xorl %eax, %eax
callq 0x1090
movl 0x2c(%rsp), %esi
leaq 0xa05(%rip), %rdi       # 0x223c
xorl %eax, %eax
callq 0x1090
movl 0x30(%rsp), %esi
leaq 0xa03(%rip), %rdi       # 0x224c
xorl %eax, %eax
callq 0x1090
movsd 0x38(%rsp), %xmm0
leaq 0x9ff(%rip), %rdi       # 0x225c
movb $0x1, %al
callq 0x1090
movsd 0x40(%rsp), %xmm0
leaq 0xa04(%rip), %rdi       # 0x2275
movb $0x1, %al
callq 0x1090
movsd 0x48(%rsp), %xmm0
leaq 0xa05(%rip), %rdi       # 0x228a
movb $0x1, %al
callq 0x1090
movq 0x50(%rsp), %rsi
leaq 0xa09(%rip), %rdi       # 0x22a1
xorl %eax, %eax
callq 0x1090
movq 0x50(%rsp), %rdi
callq 0x10d0
movq 0x2720(%rip), %rax      # 0x3fd0
movl (%rax), %ebx
xorl %ecx, %ecx
cmpl (%rsp), %ebx
jge 0x1caa
callq 0x1100
cltq
movq %rax, 0x90(%rsp)
leaq 0x8(%rsp), %r14
xorl %ecx, %ecx
movq %rbp, 0x80(%rsp)
movl %ecx, 0x88(%rsp)
movslq %ebx, %rax
movq (%rbp,%rax,8), %rax
movq %rax, 0x8(%rsp)
movq $0x0, 0x78(%rsp)
movl 0x18(%rsp), %edx
leaq 0x78(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x1130
testl %eax, %eax
jne 0x1c09
movq 0x8(%rsp), %rdi
movl $0xc1, %esi
movl $0x180, %edx            # imm = 0x180
xorl %eax, %eax
callq 0x10e0
movl %eax, %r12d
testl %eax, %eax
js 0x1c23
leaq 0x58(%rsp), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movupd %xmm0, (%rax)
movq 0x10(%rsp), %rax
testq %rax, %rax
jle 0x1b6c
xorl %esi, %esi
movl %r12d, 0x8c(%rsp)
movl 0x18(%rsp), %ecx
movq %rcx, %rdx
addq %rsi, %rdx
movl %eax, %ebp
movq %rsi, 0x98(%rsp)
subl %esi, %ebp
cmpq %rax, %rdx
cmovlel %ecx, %ebp
movq 0x78(%rsp), %r13
cmpl $0x0, 0x2c(%rsp)
je 0x19a4
xorl %ebx, %ebx
movq %r13, %rdi
movl %ebx, %esi
movl %ebp, %edx
movq %r14, %rcx
callq 0x1dc4
movl %eax, %ebx
cmpl 0x2c(%rsp), %eax
jb 0x198b
jmp 0x19a6
xorl %ebx, %ebx
leal 0x1(%rbp), %r15d
movl %r15d, %eax
subl 0x24(%rsp), %eax
cmpl %eax, %ebx
movl %r15d, 0x4(%rsp)
jae 0x1af7
callq 0x1150
movsd 0x38(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1a94
movq %r14, %r12
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0xa0(%rsp)
callq 0x1150
movsd 0x616(%rip), %xmm1      # 0x2008
subsd %xmm0, %xmm1
movsd 0xa0(%rsp), %xmm0
divsd %xmm1, %xmm0
subsd 0x48(%rsp), %xmm0
movapd %xmm0, %xmm1
movl 0x24(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl 0x28(%rsp), %ecx
cmpl %eax, %ecx
cmovbl %ecx, %eax
leal (%rax,%rbx), %ecx
movl %ebp, %r15d
subl %ebx, %r15d
cmpl %ebp, %ecx
cmovbel %eax, %r15d
movl 0x30(%rsp), %r14d
cmpl %ebx, %r14d
cmovael %ebx, %r14d
callq 0x10b0
movl 0x2c(%rsp), %ecx
subl %ecx, %r14d
incl %r14d
xorl %edx, %edx
divq %r14
incq 0x60(%rsp)
addq %r15, 0x70(%rsp)
addl %ecx, %edx
addl %ebx, %r15d
cmpl $0x4, %r15d
jb 0x1aa7
leal -0x3(%r15), %eax
cmpl %ebx, %eax
jbe 0x1aa7
movq %r12, %r14
movl %ebx, %ecx
movl %edx, %esi
movl (%r13,%rsi), %esi
movl %esi, (%r13,%rcx)
addl $0x4, %ebx
addl $0x4, %edx
cmpl %eax, %ebx
jb 0x1a7a
jmp 0x1aaa
movq %r13, %rdi
movl %ebx, %esi
movl %ebp, %edx
movq %r14, %rcx
callq 0x1dc4
movl %eax, %ebx
jmp 0x1ae8
movq %r12, %r14
cmpl %r15d, %ebx
movl 0x8c(%rsp), %r12d
jae 0x1ae3
movl %ebx, %ebx
movl %r15d, %esi
leaq (%rbx,%r13), %rax
movq %rbx, %rcx
subq %rsi, %rcx
movl %edx, %esi
xorl %edx, %edx
leal (%rsi,%rdx), %edi
movb (%r13,%rdi), %dil
movb %dil, (%rax,%rdx)
incq %rdx
movq %rcx, %rdi
addq %rdx, %rdi
jne 0x1aca
addl %edx, %ebx
movl 0x4(%rsp), %r15d
movl %r15d, %eax
subl 0x24(%rsp), %eax
cmpl %eax, %ebx
jb 0x19be
cmpl %ebp, %ebx
jae 0x1b10
movq %r13, %rdi
movl %ebx, %esi
movl %ebp, %edx
movq %r14, %rcx
callq 0x1dc4
movl %eax, %ebx
cmpl %ebp, %eax
jb 0x1afb
xorl %ebx, %ebx
testl %ebp, %ebp
je 0x1b49
movq 0x78(%rsp), %r13
movl %ebp, %r15d
movl %r15d, %edx
movl %r12d, %edi
movq %r13, %rsi
callq 0x1070
testl %eax, %eax
js 0x1b42
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r13
subl %eax, %r15d
jne 0x1b1e
jmp 0x1b49
callq 0x1040
movl (%rax), %ebx
testl %ebx, %ebx
jne 0x1c59
movl %ebp, %eax
movq 0x98(%rsp), %rsi
addq %rax, %rsi
movq 0x10(%rsp), %rax
cmpq %rax, %rsi
jl 0x1961
xorl %ebx, %ebx
cmpl $0x1, 0x34(%rsp)
jne 0x1c63
movq 0x70(%rsp), %r8
testq %r8, %r8
movq 0x80(%rsp), %rbp
js 0x1b95
xorps %xmm0, %xmm0
cvtsi2ss %r8, %xmm0
jmp 0x1bb0
movq %r8, %rax
shrq %rax
movl %r8d, %ecx
andl $0x1, %ecx
orq %rax, %rcx
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
movq 0x68(%rsp), %rdx
mulss 0x45b(%rip), %xmm0      # 0x2018
movq %r8, %rax
addq %rdx, %rax
js 0x1bcf
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
jmp 0x1be7
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm0
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rcx
cvtss2sd %xmm0, %xmm0
leaq 0x7ac(%rip), %rdi       # 0x23ac
movb $0x1, %al
callq 0x1090
jmp 0x1c6b
movq %r14, %rdi
leaq 0x18(%rsp), %rsi
callq 0x1307
movl $0xc, %ebx
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x1c6b
callq 0x1040
movl (%rax), %ebx
movq 0x23c7(%rip), %rax      # 0x3ff8
movq (%rax), %r15
movq 0x8(%rsp), %r13
movl %ebx, %edi
callq 0x1140
movq %r15, %rdi
leaq 0x71d(%rip), %rsi       # 0x2367
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10c0
jmp 0x1c6b
movq %r14, %rdi
movl %ebx, %esi
callq 0x1340
movq 0x80(%rsp), %rbp
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x1c7a
callq 0x1030
cmpl $-0x1, %r12d
je 0x1c88
movl %r12d, %edi
callq 0x10a0
movl 0x88(%rsp), %ecx
testl %ecx, %ecx
cmovel %ebx, %ecx
movq 0x2335(%rip), %rax      # 0x3fd0
movl (%rax), %ebx
incl %ebx
movl %ebx, (%rax)
cmpl (%rsp), %ebx
jl 0x18db
movl %ecx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1d0e
movl $0x1, %edi
callq 0x1110
callq 0x1273
callq 0x124e
callq 0x1229
callq 0x1204
callq 0x11df
callq 0x11ba
callq 0x12e2
callq 0x1195
callq 0x12bd
callq 0x1298
callq 0x13c1
callq 0x139c
callq 0x1377