// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/programs/xpack.c
// Function: main
int
tmain(int argc, tchar *argv[])
{
	struct options options;
	tchar *default_file_list[] = { NULL };
	int opt_char;
	int i;
	int ret;

	program_invocation_name = get_filename(argv[0]);

	options.to_stdout = false;
	options.decompress = is_xunpack();
	options.force = false;
	options.keep = false;
	options.compression_level = 6;
	options.chunk_size = 524288;
	options.suffix = T("xpack");

	while ((opt_char = tgetopt(argc, argv, optstring)) != -1) {
		switch (opt_char) {
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9':
			options.compression_level = opt_char - '0';
			break;
		case 'c':
			options.to_stdout = true;
			break;
		case 'd':
			options.decompress = true;
			break;
		case 'f':
			options.force = true;
			break;
		case 'h':
			show_usage(stdout);
			return 0;
		case 'k':
			options.keep = true;
			break;
		case 'L':
			options.compression_level =
				parse_compression_level(toptarg);
			if (options.compression_level <= 0)
				return 1;
			break;
		case 's':
			options.chunk_size = parse_chunk_size(toptarg);
			if (options.chunk_size == 0)
				return 1;
			break;
		case 'S':
			options.suffix = toptarg;
			break;
		case 'V':
			show_version();
			return 0;
		default:
			show_usage(stderr);
			return 1;
		}
	}

	argv += toptind;
	argc -= toptind;

	if (argc == 0) {
		argv = default_file_list;
		argc = ARRAY_LEN(default_file_list);
	} else {
		for (i = 0; i < argc; i++)
			if (argv[i][0] == '-' && argv[i][1] == '\0')
				argv[i] = NULL;
	}

	ret = 0;
	if (options.decompress) {
		struct xpack_decompressor *d;

		d = alloc_decompressor();
		if (d == NULL)
			return 1;

		for (i = 0; i < argc; i++)
			ret |= -decompress_file(d, argv[i], &options);

		xpack_free_decompressor(d);
	} else {
		struct xpack_compressor *c;

		c = alloc_compressor(options.chunk_size,
				     options.compression_level);
		if (c == NULL)
			return 1;

		for (i = 0; i < argc; i++)
			ret |= -compress_file(c, argv[i], &options);

		xpack_free_compressor(c);
	}

	/*
	 * If ret=0, there were no warnings or errors.  Exit with status 0.
	 * If ret=2, there was at least one warning.  Exit with status 2.
	 * Else, there was at least one error.  Exit with status 1.
	 */
	if (ret != 0 && ret != 2)
		ret = 1;

	return ret;
}

// Assembly:
subq $0x58, %rsp
movl $0x0, 0x54(%rsp)
movl %edi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x10e0
movq 0x48(%rsp), %rax
movq (%rax), %rdi
callq 0x2920
movq %rax, %rcx
leaq 0x11df3(%rip), %rax     # 0x13110
movq %rcx, (%rax)
movb $0x0, 0x30(%rsp)
callq 0x1660
andb $0x1, %al
movb %al, 0x31(%rsp)
movb $0x0, 0x32(%rsp)
movb $0x0, 0x33(%rsp)
movl $0x6, 0x34(%rsp)
movl $0x80000, 0x38(%rsp)    # imm = 0x80000
leaq 0xedc8(%rip), %rax      # 0x10119
movq %rax, 0x40(%rsp)
movl 0x50(%rsp), %edi
movq 0x48(%rsp), %rsi
leaq 0xedb9(%rip), %rdx      # 0x1011f
callq 0x31d0
movl %eax, 0x24(%rsp)
cmpl $-0x1, %eax
je 0x148c
movl 0x24(%rsp), %eax
addl $-0x31, %eax
movl %eax, %ecx
movq %rcx, (%rsp)
subl $0x42, %eax
ja 0x146b
movq (%rsp), %rax
leaq 0xec6b(%rip), %rcx      # 0x10004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x24(%rsp), %eax
subl $0x30, %eax
movl %eax, 0x34(%rsp)
jmp 0x1487
movb $0x1, 0x30(%rsp)
jmp 0x1487
movb $0x1, 0x31(%rsp)
jmp 0x1487
movb $0x1, 0x32(%rsp)
jmp 0x1487
movq 0x11c01(%rip), %rax     # 0x12fd8
movq (%rax), %rdi
callq 0x1690
movl $0x0, 0x54(%rsp)
jmp 0x1653
movb $0x1, 0x33(%rsp)
jmp 0x1487
leaq 0x11d33(%rip), %rax     # 0x13130
movq (%rax), %rdi
callq 0x30e0
movl %eax, 0x34(%rsp)
cmpl $0x0, 0x34(%rsp)
jg 0x141d
movl $0x1, 0x54(%rsp)
jmp 0x1653
jmp 0x1487
leaq 0x11d0a(%rip), %rax     # 0x13130
movq (%rax), %rdi
callq 0x3060
movl %eax, 0x38(%rsp)
cmpl $0x0, 0x38(%rsp)
jne 0x1446
movl $0x1, 0x54(%rsp)
jmp 0x1653
jmp 0x1487
leaq 0x11ce1(%rip), %rax     # 0x13130
movq (%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x1487
callq 0x16c0
movl $0x0, 0x54(%rsp)
jmp 0x1653
movq 0x11b86(%rip), %rax     # 0x12ff8
movq (%rax), %rdi
callq 0x1690
movl $0x1, 0x54(%rsp)
jmp 0x1653
jmp 0x1356
leaq 0x11c6d(%rip), %rax     # 0x13100
movl (%rax), %ecx
movq 0x48(%rsp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x48(%rsp)
leaq 0x11c50(%rip), %rax     # 0x13100
movl (%rax), %ecx
movl 0x50(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x50(%rsp)
cmpl $0x0, 0x50(%rsp)
jne 0x14d7
leaq 0x28(%rsp), %rax
movq %rax, 0x48(%rsp)
movl $0x1, 0x50(%rsp)
jmp 0x1539
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x50(%rsp), %eax
jge 0x1537
movq 0x48(%rsp), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x1528
movq 0x48(%rsp), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x1528
movq 0x48(%rsp), %rax
movslq 0x20(%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0x152a
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x14df
jmp 0x1539
movl $0x0, 0x1c(%rsp)
testb $0x1, 0x31(%rsp)
je 0x15bd
callq 0x31a0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x1567
movl $0x1, 0x54(%rsp)
jmp 0x1653
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x50(%rsp), %eax
jge 0x15b1
movq 0x10(%rsp), %rdi
movq 0x48(%rsp), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x30(%rsp), %rdx
callq 0x16e0
movl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
orl 0x1c(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x156f
movq 0x10(%rsp), %rdi
callq 0xf890
jmp 0x1635
movl 0x38(%rsp), %edi
movl 0x34(%rsp), %esi
callq 0x3150
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x15e1
movl $0x1, 0x54(%rsp)
jmp 0x1653
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x50(%rsp), %eax
jge 0x162b
movq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x30(%rsp), %rdx
callq 0x1b60
movl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
orl 0x1c(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x15e9
movq 0x8(%rsp), %rdi
callq 0x75d0
cmpl $0x0, 0x1c(%rsp)
je 0x164b
cmpl $0x2, 0x1c(%rsp)
je 0x164b
movl $0x1, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax)