// File: /workspace/github_c_makefile_star2_O3/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 0x3c5535(%rip), %rsi    # 0x5ca60b
xorl %edx, %edx
movl $0x3, %ecx
xorl %eax, %eax
callq 0x204fe9
movl 0x4(%rbx), %edx
xorl %edi, %edi
testl %edx, %edx
setg %dil
leaq 0x3c554c(%rip), %rsi    # 0x5ca642
xorl %eax, %eax
callq 0x204fe9
xorl %edi, %edi
cmpl $0x0, (%rbx)
setg %dil
movl 0x4(%rbx), %edx
leaq 0x3c556b(%rip), %rsi    # 0x5ca67b
xorl %eax, %eax
callq 0x204fe9
movl 0x8(%rbx), %edx
movl %edx, %edi
notl %edi
shrl $0x1f, %edi
leaq 0x3c558c(%rip), %rsi    # 0x5ca6b4
xorl %eax, %eax
callq 0x204fe9
movl 0xc(%rbx), %edx
xorl %edi, %edi
testl %edx, %edx
setg %dil
leaq 0x3c55ba(%rip), %rsi    # 0x5ca6fb
xorl %eax, %eax
callq 0x204fe9
movl 0x10(%rbx), %edx
movl %edx, %edi
notl %edi
shrl $0x1f, %edi
leaq 0x3c55df(%rip), %rsi    # 0x5ca738
xorl %eax, %eax
callq 0x204fe9
movl 0x38(%rbx), %r8d
xorl %edi, %edi
cmpl $0x3, %r8d
setb %dil
leaq 0x3c5601(%rip), %rsi    # 0x5ca776
xorl %edx, %edx
movl $0x2, %ecx
xorl %eax, %eax
callq 0x204fe9
movl 0x38(%rbx), %eax
cmpl $0x2, %eax
je 0x2051a3
cmpl $0x1, %eax
jne 0x2051cc
movl 0x20(%rbx), %edx
movl %edx, %eax
andl $-0x2, %eax
xorl %ebp, %ebp
cmpl $0x2, %eax
sete %bpl
jmp 0x2051d4
xorl %edi, %edi
cmpl $0x0, 0x30(%rbx)
sete %dil
leaq 0x3c55f2(%rip), %rsi    # 0x5ca7a6
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x204fe9
movl 0x20(%rbx), %edx
cmpl $0x3, %edx
ja 0x2051d4
cmpl $0x2, %edx
jne 0x2051cf
jmp 0x2051d4
movl 0x20(%rbx), %edx
movl $0x1, %ebp
leaq 0x3c533b(%rip), %r9     # 0x5ca516
leaq 0x52850e(%rip), %rax    # 0x72d6f0
movq %r9, %rcx
cmpl $0x2, %edx
ja 0x2051f0
movl %edx, %ecx
movq (%rax,%rcx,8), %rcx
movl 0x38(%rbx), %r8d
cmpq $0x2, %r8
ja 0x2051fe
movq (%rax,%r8,8), %r9
leaq 0x3c55d2(%rip), %rsi    # 0x5ca7d7
movl %ebp, %edi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x204fe9