// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x84(%rbp), %rdi
callq 0x2a20
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x1edc(%rip), %rdx      # 0x318f
callq 0x1140
movl %eax, -0x88(%rbp)
cmpl $-0x1, %eax
je 0x148c
movl -0x88(%rbp), %eax
addl $-0x3a, %eax
movl %eax, %ecx
movq %rcx, -0x98(%rbp)
subl $0x39, %eax
ja 0x1458
movq -0x98(%rbp), %rax
leaq 0x1d20(%rip), %rcx      # 0x3010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x3cd0(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
callq 0x1150
movl %eax, -0x84(%rbp)
jmp 0x1487
movq 0x3cb6(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
callq 0x1150
movl %eax, -0x80(%rbp)
movq 0x3ca4(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
movl $0x2c, %esi
callq 0x10a0
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x136c
movq 0x3ca7(%rip), %rax      # 0x4ff8
movq (%rax), %rsi
leaq 0x1e40(%rip), %rdi      # 0x319b
callq 0x10b0
movl $0x2, -0x4(%rbp)
jmp 0x155b
movq -0x90(%rbp), %rdi
addq $0x1, %rdi
callq 0x1150
movl %eax, -0x7c(%rbp)
jmp 0x1487
movq 0x3c45(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
callq 0x1150
movl %eax, -0x78(%rbp)
jmp 0x1487
movq 0x3c2e(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
callq 0x1150
movl %eax, -0x70(%rbp)
movq 0x3c1c(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
movl $0x2c, %esi
callq 0x10a0
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
je 0x13ea
movq -0x90(%rbp), %rdi
addq $0x1, %rdi
callq 0x1150
movl %eax, -0x9c(%rbp)
jmp 0x13f3
movl -0x70(%rbp), %eax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x1487
movq 0x3bc8(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
callq 0x1150
cmpl $0x0, %eax
je 0x1420
movl -0x74(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1429
movl -0x74(%rbp), %eax
andl $-0x2, %eax
movl %eax, -0x74(%rbp)
jmp 0x1487
movq 0x3bc6(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq 0x3ba4(%rip), %rax      # 0x4fe0
movl (%rax), %edx
leaq 0x1d7c(%rip), %rsi      # 0x31c1
movb $0x0, %al
callq 0x1100
movl $0x2, -0x4(%rbp)
jmp 0x155b
jmp 0x145a
movq 0x3b97(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq 0x3b75(%rip), %rax      # 0x4fe0
movl (%rax), %edx
leaq 0x1d6d(%rip), %rsi      # 0x31e1
movb $0x0, %al
callq 0x1100
movl $0x1, -0x4(%rbp)
jmp 0x155b
jmp 0x12a5
movq 0x3b35(%rip), %rax      # 0x4fc8
movl (%rax), %eax
movl -0x8(%rbp), %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
je 0x14b7
leaq 0x1c5a(%rip), %rdi      # 0x3100
callq 0x1060
movl $0x3, -0x4(%rbp)
jmp 0x155b
movq -0x10(%rbp), %rax
movq 0x3b06(%rip), %rcx      # 0x4fc8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x28(%rbp), %rdi
callq 0x1e60
cmpl $0x0, %eax
jge 0x14e0
movl $0x4, -0x4(%rbp)
jmp 0x155b
movq -0x10(%rbp), %rax
movq 0x3add(%rip), %rcx      # 0x4fc8
movl (%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x50(%rbp), %rdi
callq 0x2120
cmpl $0x0, %eax
jge 0x150e
movl $0x5, -0x4(%rbp)
jmp 0x155b
leaq -0x68(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x84(%rbp), %rcx
callq 0x2a50
movq -0x10(%rbp), %rax
movq 0x3a97(%rip), %rcx      # 0x4fc8
movl (%rcx), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x68(%rbp), %rsi
callq 0x1d60
cmpl $0x0, %eax
jge 0x1554
movl $0x6, -0x4(%rbp)
jmp 0x155b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)