// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/main.c
// Function: main_opt_validate
void main_opt_validate(main_opt_t *opt)
{
	assert_or_exit(AlignmentModeStart <= opt->alignment_mode && opt->alignment_mode <= AlignmentModeEnd, "Alignment mode (-M) was not valid ([%d-%d]), found %d.", AlignmentModeStart, AlignmentModeEnd, opt->alignment_mode);
	assert_or_exit(opt->mismatch_score > 0, "Mismatch score (-a) must be greater than zero, found %d.", opt->mismatch_score);
	assert_or_exit(opt->match_score > 0, "Mismatch score (-b) must be greater than zero, found %d.", opt->mismatch_score);
	assert_or_exit(opt->gap_open >= 0, "Gap open penalty (-q) must be greater than or equal to zero, found %d.", opt->gap_open);
	assert_or_exit(opt->gap_extend > 0, "Gap extend penalty (-r) must be greater than zero, found %d.", opt->gap_extend);
	assert_or_exit(0 <= opt->band_width, "Band width (-w) must be greater than or equal zero, found %d.", opt->band_width);
	assert_or_exit(LibraryStart <= opt->library && opt->library <= LibraryEnd, "Library (-l) was not valid ([%d-%d]), found %d.", LibraryStart, LibraryEnd, opt->library);

	// verify library type with alignment_mode
	int found_mismatch = 0;
	switch (opt->library) {
		case Ksw2: 
			if (opt->alignment_mode != Extension && opt->alignment_mode != Global) found_mismatch = 1; 
			break;
		case Parasail: 
			assert_or_exit(opt->right_align_gaps == 0, "Cannot right adjust gaps (-R) with parasail (-l)");
			if (opt->alignment_mode != Local && opt->alignment_mode != Glocal && opt->alignment_mode != Global) found_mismatch = 1; 
			break;
		default: break;
	}
	assert_or_exit(found_mismatch == 0, "Cannot use alignment mode (-M) %d-%s with library (-l) %d-%s.", 
			opt->alignment_mode, library_to_str(opt->alignment_mode),
			opt->library, library_to_str(opt->library));
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x20(%rdi), %r8d
xorl %edi, %edi
cmpl $0x4, %r8d
setb %dil
leaq 0x3c18d2(%rip), %rsi    # 0x56860b
pushq $0x3
popq %rcx
xorl %edx, %edx
xorl %eax, %eax
callq 0x1a6c54
movl 0x4(%rbx), %edx
xorl %edi, %edi
testl %edx, %edx
setg %dil
leaq 0x3c18eb(%rip), %rsi    # 0x568642
xorl %eax, %eax
callq 0x1a6c54
xorl %edi, %edi
cmpl $0x0, (%rbx)
setg %dil
movl 0x4(%rbx), %edx
leaq 0x3c190a(%rip), %rsi    # 0x56867b
xorl %eax, %eax
callq 0x1a6c54
movl 0x8(%rbx), %edx
movl %edx, %edi
notl %edi
shrl $0x1f, %edi
leaq 0x3c192b(%rip), %rsi    # 0x5686b4
xorl %eax, %eax
callq 0x1a6c54
movl 0xc(%rbx), %edx
xorl %edi, %edi
testl %edx, %edx
setg %dil
leaq 0x3c1959(%rip), %rsi    # 0x5686fb
xorl %eax, %eax
callq 0x1a6c54
movl 0x10(%rbx), %edx
movl %edx, %edi
notl %edi
shrl $0x1f, %edi
leaq 0x3c197e(%rip), %rsi    # 0x568738
xorl %eax, %eax
callq 0x1a6c54
movl 0x38(%rbx), %r8d
xorl %edi, %edi
cmpl $0x3, %r8d
setb %dil
leaq 0x3c19a0(%rip), %rsi    # 0x568776
pushq $0x2
popq %rcx
xorl %edx, %edx
xorl %eax, %eax
callq 0x1a6c54
movl 0x38(%rbx), %eax
cmpl $0x2, %eax
je 0x1a6e02
cmpl $0x1, %eax
jne 0x1a6e2b
movl 0x20(%rbx), %edx
movl %edx, %eax
andl $-0x2, %eax
xorl %ebp, %ebp
cmpl $0x2, %eax
sete %bpl
jmp 0x1a6e31
xorl %edi, %edi
cmpl $0x0, 0x30(%rbx)
sete %dil
leaq 0x3c1993(%rip), %rsi    # 0x5687a6
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x1a6c54
movl 0x20(%rbx), %edx
cmpl $0x3, %edx
ja 0x1a6e31
cmpl $0x2, %edx
jne 0x1a6e2e
jmp 0x1a6e31
movl 0x20(%rbx), %edx
pushq $0x1
popq %rbp
leaq 0x3c16de(%rip), %r9     # 0x568516
leaq 0x4e98b1(%rip), %rax    # 0x6906f0
movq %r9, %rcx
cmpl $0x2, %edx
ja 0x1a6e4d
movl %edx, %ecx
movq (%rax,%rcx,8), %rcx
movl 0x38(%rbx), %r8d
cmpq $0x2, %r8
ja 0x1a6e5b
movq (%rax,%r8,8), %r9
leaq 0x3c1975(%rip), %rsi    # 0x5687d7
movl %ebp, %edi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1a6c54