// File: /workspace/github_c_makefile_star2_O2/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 0x2178
leaq 0x1d74(%rip), %r14      # 0x3004
movq 0x3d39(%rip), %r15      # 0x4fd0
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1130
cmpl $0x57, %eax
je 0x1337
cmpl $0x63, %eax
je 0x131b
cmpl $0x6d, %eax
je 0x130a
cmpl $0x72, %eax
je 0x12d3
cmpl $0x73, %eax
jne 0x137a
movq (%r15), %rdi
callq 0x1140
movl %eax, 0x10(%rsp)
jmp 0x1297
movq (%r15), %r13
movq %r13, %rdi
callq 0x1140
movl %eax, %r12d
movl %eax, 0x18(%rsp)
movq %r13, %rdi
pushq $0x2c
popq %rsi
callq 0x10a0
testq %rax, %rax
je 0x1303
incq %rax
movq %rax, %rdi
callq 0x1140
movl %eax, %r12d
movl %r12d, 0x1c(%rsp)
jmp 0x1297
movq (%r15), %rdi
callq 0x1140
movl %eax, 0x4(%rsp)
jmp 0x1297
movq (%r15), %rdi
callq 0x1140
movl 0x14(%rsp), %ecx
testl %eax, %eax
je 0x136e
orl $0x1, %ecx
movl %ecx, 0x14(%rsp)
jmp 0x1297
movq (%r15), %r12
movq %r12, %rdi
callq 0x1140
movl %eax, 0x8(%rsp)
movq %r12, %rdi
pushq $0x2c
popq %rsi
callq 0x10a0
testq %rax, %rax
je 0x1455
incq %rax
movq %rax, %rdi
callq 0x1140
movl %eax, 0xc(%rsp)
jmp 0x1297
andl $-0x2, %ecx
movl %ecx, 0x14(%rsp)
jmp 0x1297
cmpl $-0x1, %eax
jne 0x1404
movq 0x3c3e(%rip), %r15      # 0x4fc8
movslq (%r15), %rax
addl $-0x3, %ebp
cmpl %ebp, %eax
jne 0x13f0
movq (%rbx,%rax,8), %rsi
leaq 0x20(%rsp), %rdi
callq 0x19d8
testl %eax, %eax
js 0x1400
movslq (%r15), %rax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x38(%rsp), %rdi
callq 0x1b97
testl %eax, %eax
js 0x142c
leaq 0x60(%rsp), %r14
leaq 0x20(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0x4(%rsp), %rcx
movq %r14, %rdi
callq 0x218e
movslq (%r15), %rax
movq 0x10(%rbx,%rax,8), %rdi
movq %r14, %rsi
callq 0x194b
sarl $0x1f, %eax
andl $0x6, %eax
jmp 0x146e
leaq 0x1c79(%rip), %rdi      # 0x3070
callq 0x1060
pushq $0x3
jmp 0x146d
pushq $0x4
jmp 0x146d
cmpl $0x3a, %eax
jne 0x1430
movq 0x3be8(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq 0x3bc6(%rip), %rax      # 0x4fe0
movl (%rax), %edx
leaq 0x1c13(%rip), %rsi      # 0x3036
xorl %eax, %eax
callq 0x10f0
jmp 0x146b
pushq $0x5
jmp 0x146d
movq 0x3bc1(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq 0x3b9f(%rip), %rax      # 0x4fe0
movl (%rax), %edx
leaq 0x1c0c(%rip), %rsi      # 0x3056
xorl %eax, %eax
callq 0x10f0
pushq $0x1
jmp 0x146d
movq 0x3b9c(%rip), %rax      # 0x4ff8
movq (%rax), %rsi
leaq 0x1baa(%rip), %rdi      # 0x3010
callq 0x10b0
pushq $0x2
popq %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)