// File: /workspace/github_c_makefile_star2_O1/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 0x39170c(%rip), %rsi    # 0x59660b
xorl %ebp, %ebp
xorl %edx, %edx
movl $0x3, %ecx
xorl %eax, %eax
callq 0x204e12
movl 0x4(%rbx), %edx
xorl %edi, %edi
testl %edx, %edx
setg %dil
leaq 0x391721(%rip), %rsi    # 0x596642
xorl %eax, %eax
callq 0x204e12
xorl %edi, %edi
cmpl $0x0, (%rbx)
setg %dil
movl 0x4(%rbx), %edx
leaq 0x391740(%rip), %rsi    # 0x59667b
xorl %eax, %eax
callq 0x204e12
movl 0x8(%rbx), %edx
movl %edx, %edi
notl %edi
shrl $0x1f, %edi
leaq 0x391761(%rip), %rsi    # 0x5966b4
xorl %eax, %eax
callq 0x204e12
movl 0xc(%rbx), %edx
xorl %edi, %edi
testl %edx, %edx
setg %dil
leaq 0x39178f(%rip), %rsi    # 0x5966fb
xorl %eax, %eax
callq 0x204e12
movl 0x10(%rbx), %edx
movl %edx, %edi
notl %edi
shrl $0x1f, %edi
leaq 0x3917b4(%rip), %rsi    # 0x596738
xorl %eax, %eax
callq 0x204e12
movl 0x38(%rbx), %r8d
xorl %edi, %edi
cmpl $0x3, %r8d
setb %dil
leaq 0x3917d6(%rip), %rsi    # 0x596776
xorl %edx, %edx
movl $0x2, %ecx
xorl %eax, %eax
callq 0x204e12
movl 0x38(%rbx), %eax
cmpl $0x2, %eax
je 0x204fd1
movl $0x1, %ebp
cmpl $0x1, %eax
jne 0x204ffc
movl 0x20(%rbx), %eax
andl $-0x2, %eax
xorl %ebp, %ebp
cmpl $0x2, %eax
sete %bpl
jmp 0x204ffc
xorl %edi, %edi
cmpl $0x0, 0x30(%rbx)
sete %dil
leaq 0x3917c4(%rip), %rsi    # 0x5967a6
xorl %eax, %eax
callq 0x204e12
movl 0x20(%rbx), %eax
cmpq $0x3, %rax
ja 0x204ffc
leaq 0x3914a7(%rip), %rcx    # 0x5964a0
movl (%rcx,%rax,4), %ebp
movl 0x20(%rbx), %edx
leaq 0x391510(%rip), %r9     # 0x596516
leaq 0x4f26e3(%rip), %rax    # 0x6f76f0
movq %r9, %rcx
cmpq $0x2, %rdx
ja 0x20501a
movq (%rax,%rdx,8), %rcx
movl 0x38(%rbx), %r8d
cmpq $0x2, %r8
ja 0x205028
movq (%rax,%r8,8), %r9
leaq 0x3917a8(%rip), %rsi    # 0x5967d7
movl %ebp, %edi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x204e12