// File: /workspace/github_c_makefile_star2_O3/ravenexp[P]aatrace/testconv.c
// Function: main
int main(int argc, char* argv[])
{
	struct aatrace_pic src;
	struct aatrace_font font;
	struct aatrace_text txt;

	struct aatrace_convert_ctx ctx;
	int c;

	aatrace_convert_ctx_init(&ctx);

	while ((c = getopt(argc, argv, ":m:W:s:r:c:")) != -1) {
		const char* p;

		switch(c) {
		case 'm':
			ctx.match.method = (enum aatrace_match_method)atoi(optarg);
			break;
		case 'W':
			ctx.match.sad_weight = atoi(optarg);
			p = strchr(optarg, ',');
			if (!p) {
				fputs("-W requires two operands: <sad>,<asd>", stderr);
				return 2;
			}
			ctx.match.asd_weight = atoi(p + 1);
			break;
		case 's':
			ctx.search.method = (enum aatrace_search_method)atoi(optarg);
			break;
		case 'r':
			ctx.search.hrange = (unsigned)atoi(optarg);
			p = strchr(optarg, ',');
			ctx.search.vrange = p ? (unsigned)atoi(p + 1) : ctx.search.hrange;
			break;
		case 'c':
			if (atoi(optarg)) {
				ctx.search.flags |= AATRACE_SEARCH_FLAG_COVERAGE;
			} else {
				ctx.search.flags &= ~AATRACE_SEARCH_FLAG_COVERAGE;
			}
			break;
		case ':':
			fprintf(stderr, "Option -%c requires an operand\n", optopt);
			return 2;
		default:
		case '?':
			fprintf(stderr, "Unrecognized option: -%c\n", optopt);
			return 1;
		}
	}

	if (optind != argc - 3) {
		puts(usage);
		return 3;
	}

	if (util_load_pic(&src, argv[optind]) < 0)
		return 4;

	if (util_load_font(&font, argv[optind + 1]) < 0)
		return 5;

	aatrace_convert_pic(&txt, &src, &font, &ctx);

	if (util_store_text(argv[optind + 2], &txt) < 0)
		return 6;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rdi
callq 0x2300
leaq 0x1be4(%rip), %r14      # 0x3004
movq 0x3ba9(%rip), %r13      # 0x4fd0
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1130
cmpl $0x6c, %eax
jle 0x1463
cmpl $0x73, %eax
je 0x14d1
cmpl $0x72, %eax
je 0x14e3
cmpl $0x6d, %eax
jne 0x15cf
movq (%r13), %rdi
callq 0x1140
movl %eax, 0x4(%rsp)
jmp 0x1427
cmpl $0x62, %eax
jg 0x14ab
cmpl $0x57, %eax
jne 0x152c
movq (%r13), %r15
movq %r15, %rdi
callq 0x1140
movl %eax, 0x8(%rsp)
movq %r15, %rdi
movl $0x2c, %esi
callq 0x10a0
testq %rax, %rax
je 0x15db
incq %rax
movq %rax, %rdi
callq 0x1140
movl %eax, 0xc(%rsp)
jmp 0x1427
cmpl $0x63, %eax
jne 0x15cf
movq (%r13), %rdi
callq 0x1140
movl 0x14(%rsp), %ecx
testl %eax, %eax
je 0x1520
orl $0x1, %ecx
movl %ecx, 0x14(%rsp)
jmp 0x1427
movq (%r13), %rdi
callq 0x1140
movl %eax, 0x10(%rsp)
jmp 0x1427
movq (%r13), %r12
movq %r12, %rdi
callq 0x1140
movl %eax, %r15d
movl %eax, 0x18(%rsp)
movq %r12, %rdi
movl $0x2c, %esi
callq 0x10a0
testq %rax, %rax
je 0x1516
incq %rax
movq %rax, %rdi
callq 0x1140
movl %eax, %r15d
movl %r15d, 0x1c(%rsp)
jmp 0x1427
andl $-0x2, %ecx
movl %ecx, 0x14(%rsp)
jmp 0x1427
cmpl $-0x1, %eax
jne 0x15c3
movq 0x3a8c(%rip), %r15      # 0x4fc8
movslq (%r15), %rax
addl $-0x3, %ebp
cmpl %ebp, %eax
jne 0x15a2
movq (%rbx,%rax,8), %rsi
leaq 0x20(%rsp), %rdi
callq 0x1b33
testl %eax, %eax
js 0x15b5
movslq (%r15), %rax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x38(%rsp), %rdi
callq 0x1ca8
testl %eax, %eax
js 0x15bc
leaq 0x60(%rsp), %r14
leaq 0x20(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0x4(%rsp), %rcx
movq %r14, %rdi
callq 0x2316
movslq (%r15), %rax
movq 0x10(%rbx,%rax,8), %rdi
movq %r14, %rsi
callq 0x1ac4
sarl $0x1f, %eax
andl $0x6, %eax
jmp 0x15e5
leaq 0x1ac7(%rip), %rdi      # 0x3070
callq 0x1060
movl $0x3, %eax
jmp 0x15e5
movl $0x4, %eax
jmp 0x15e5
movl $0x5, %eax
jmp 0x15e5
cmpl $0x3a, %eax
jne 0x15cf
callq 0x1180
jmp 0x15e0
callq 0x11c3
movl $0x1, %eax
jmp 0x15e5
callq 0x11a7
movl $0x2, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq