// File: /workspace/github_c_makefile_star2_O1/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 0x22e0
movl $0x0, (%rsp)
leaq 0x1bcd(%rip), %r14      # 0x3004
movq 0x3b92(%rip), %r15      # 0x4fd0
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1140
cmpl $0x6c, %eax
jle 0x147c
cmpl $0x73, %eax
je 0x14dc
cmpl $0x72, %eax
je 0x14ea
cmpl $0x6d, %eax
jne 0x1556
movq (%r15), %rdi
callq 0x1150
movl %eax, 0x4(%rsp)
jmp 0x1528
cmpl $0x62, %eax
jg 0x14c0
cmpl $0x57, %eax
jne 0x1537
movq (%r15), %r12
movq %r12, %rdi
callq 0x1150
movl %eax, 0x8(%rsp)
movq %r12, %rdi
movl $0x2c, %esi
callq 0x10a0
testq %rax, %rax
je 0x1543
incq %rax
movq %rax, %rdi
callq 0x1150
movl %eax, 0xc(%rsp)
jmp 0x1528
cmpl $0x63, %eax
jne 0x1556
movq (%r15), %rdi
callq 0x1150
testl %eax, %eax
je 0x1523
orb $0x1, 0x14(%rsp)
jmp 0x1528
movq (%r15), %rdi
callq 0x1150
movl %eax, 0x10(%rsp)
jmp 0x1528
movq (%r15), %r13
movq %r13, %rdi
callq 0x1150
movl %eax, %r12d
movl %eax, 0x18(%rsp)
movq %r13, %rdi
movl $0x2c, %esi
callq 0x10a0
testq %rax, %rax
je 0x151c
incq %rax
movq %rax, %rdi
callq 0x1150
movl %eax, %r12d
movl %r12d, 0x1c(%rsp)
jmp 0x1528
andb $-0x2, 0x14(%rsp)
movb $0x1, %al
testb %al, %al
jne 0x143e
jmp 0x15fb
cmpl $0x3a, %eax
jne 0x1551
callq 0x1190
jmp 0x1548
callq 0x11b7
movl $0x2, (%rsp)
jmp 0x1562
cmpl $-0x1, %eax
je 0x1566
callq 0x11d3
movl $0x1, (%rsp)
xorl %eax, %eax
jmp 0x152a
movq 0x3a5b(%rip), %r15      # 0x4fc8
movslq (%r15), %rax
addl $-0x3, %ebp
cmpl %ebp, %eax
jne 0x15d6
movq (%rbx,%rax,8), %rsi
leaq 0x20(%rsp), %rdi
callq 0x1b55
testl %eax, %eax
js 0x15eb
movslq (%r15), %rax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x38(%rsp), %rdi
callq 0x1cd7
testl %eax, %eax
js 0x15f4
leaq 0x60(%rsp), %r14
leaq 0x20(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0x4(%rsp), %rcx
movq %r14, %rdi
callq 0x22f6
movslq (%r15), %rax
movq 0x10(%rbx,%rax,8), %rdi
movq %r14, %rsi
callq 0x1ae1
sarl $0x1f, %eax
andl $0x6, %eax
movl %eax, (%rsp)
jmp 0x15fb
leaq 0x1a93(%rip), %rdi      # 0x3070
callq 0x1060
movl $0x3, (%rsp)
jmp 0x15fb
movl $0x4, (%rsp)
jmp 0x15fb
movl $0x5, (%rsp)
movl (%rsp), %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)