// File: /workspace/github_c_makefile_star2_O1/lh3[P]ksw2/cli.c
// Function: main
int main(int argc, char *argv[])
{
	void *km = 0;
	int8_t a = 2, b = 4, q = 4, e = 2, q2 = 13, e2 = 1;
	int c, i, pair = 1, w = -1, flag = 0, rep = 1, zdrop = -1, no_kalloc = 0;
	char *algo = "extd", *s;
	int8_t mat[25];
	ksw_extz_t ez;
	gzFile fp[2];

	while ((c = getopt(argc, argv, "t:w:R:rsgz:A:B:O:E:Ka")) >= 0) {
		if (c == 't') algo = optarg;
		else if (c == 'w') w = atoi(optarg);
		else if (c == 'R') rep = atoi(optarg);
		else if (c == 'z') zdrop = atoi(optarg);
		else if (c == 'r') flag |= KSW_EZ_RIGHT;
		else if (c == 's') flag |= KSW_EZ_SCORE_ONLY;
		else if (c == 'g') flag |= KSW_EZ_APPROX_MAX | KSW_EZ_APPROX_DROP;
		else if (c == 'K') no_kalloc = 1;
		else if (c == 'A') a = atoi(optarg);
		else if (c == 'B') b = atoi(optarg);
		else if (c == 'a') pair = 0;
		else if (c == 'O') {
			q = q2 = strtol(optarg, &s, 10);
			if (*s == ',') q2 = strtol(s+1, &s, 10);
		} else if (c == 'E') {
			e = e2 = strtol(optarg, &s, 10);
			if (*s == ',') e2 = strtol(s+1, &s, 10);
		}
	}
	if (argc - optind < 2) {
		fprintf(stderr, "Usage: ksw2-test [options] <DNA-target> <DNA-query>\n");
		fprintf(stderr, "Options:\n");
		fprintf(stderr, "  -t STR        algorithm: gg, gg2, gg2_sse, extz, extz2_sse, extd, extd2_sse [%s]\n", algo);
		fprintf(stderr, "  -R INT        repeat INT times (for benchmarking) [1]\n");
		fprintf(stderr, "  -w INT        band width [inf]\n");
		fprintf(stderr, "  -z INT        Z-drop [%d]\n", zdrop);
		fprintf(stderr, "  -r            gap right alignment\n");
		fprintf(stderr, "  -s            score only\n");
		fprintf(stderr, "  -A INT        match score [%d]\n", a);
		fprintf(stderr, "  -B INT        mismatch penalty [%d]\n", b);
		fprintf(stderr, "  -O INT[,INT]  gap open penalty [%d,%d]\n", q, q2);
		fprintf(stderr, "  -E INT[,INT]  gap extension penalty [%d,%d]\n", e, e2);
		fprintf(stderr, "  -a            all vs all\n");
		return 1;
	}
#ifdef HAVE_KALLOC
	km = no_kalloc? 0 : km_init();
#endif
	memset(&ez, 0, sizeof(ksw_extz_t));
	ksw_gen_simple_mat(5, mat, a, -b);
	fp[0] = gzopen(argv[optind], "r");
	fp[1] = gzopen(argv[optind+1], "r");

	if (fp[0] == 0 && fp[1] == 0) {
		global_aln(algo, km, argv[optind+1], argv[optind], 5, mat, q, e, q2, e2, w, zdrop, flag, &ez);
		print_aln("first", "second", &ez);
	} else if (fp[0] && fp[1]) {
		kseq_t *ks[2];
		ks[0] = kseq_init(fp[0]);
		ks[1] = kseq_init(fp[1]);
		if (pair) {
			while (kseq_read(ks[0]) > 0) {
				if (kseq_read(ks[1]) <= 0) break;
				for (i = 0; i < rep; ++i)
					global_aln(algo, km, ks[1]->seq.s, ks[0]->seq.s, 5, mat, q, e, q2, e2, w, zdrop, flag, &ez);
				print_aln(ks[0]->name.s, ks[1]->name.s, &ez);
			}
		} else {
			int i, m_seq = 0, n_seq = 0;
			named_seq_t *seq = 0;
			while (kseq_read(ks[0]) > 0) {
				named_seq_t *s;
				if (n_seq == m_seq) EXPAND(seq, m_seq);
				s = &seq[n_seq++];
				s->name = strdup(ks[0]->name.s);
				s->seq = strdup(ks[0]->seq.s);
			}
			while (kseq_read(ks[1]) > 0) {
				for (i = 0; i < n_seq; ++i) {
					global_aln(algo, km, ks[1]->seq.s, seq[i].seq, 5, mat, q, e, q2, e2, w, zdrop, flag, &ez);
					print_aln(seq[i].name, ks[1]->name.s, &ez);
				}
			}
			for (i = 0; i < n_seq; ++i) {
				free(seq[i].name);
				free(seq[i].seq);
			}
			free(seq);
		}
		kseq_destroy(ks[0]);
		kseq_destroy(ks[1]);
		gzclose(fp[0]);
		gzclose(fp[1]);
	}
	kfree(km, ez.cigar);
#ifdef HAVE_KALLOC
	km_destroy(km);
#endif
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %r13
movl %edi, %ebp
leaq 0xac64(%rip), %rdx      # 0xc02d
callq 0x1130
testl %eax, %eax
js 0x1644
movb $0xd, %cl
movq %rcx, 0x30(%rsp)
movb $0x1, %cl
movq %rcx, 0x10(%rsp)
movl $0x1, 0x38(%rsp)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rcx, 0x60(%rsp)
movl $0x0, 0x18(%rsp)
leaq 0xac23(%rip), %rcx      # 0xc028
movq %rcx, 0x40(%rsp)
movb $0x4, %cl
movq %rcx, 0x8(%rsp)
movb $0x2, %cl
movq %rcx, 0x20(%rsp)
leaq 0x88(%rsp), %rbx
leaq 0xac06(%rip), %r12      # 0xc02d
movb $0x4, %cl
movq %rcx, 0x28(%rsp)
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rcx, 0x50(%rsp)
movl $0x1, 0x58(%rsp)
movb $0x2, %cl
movq %rcx, 0x48(%rsp)
movq %rbx, %r14
cmpl $0x60, %eax
jle 0x1475
leal -0x72(%rax), %ecx
cmpl $0x8, %ecx
ja 0x150f
leaq 0xaba0(%rip), %rsi      # 0xc004
movslq (%rsi,%rcx,4), %rax
addq %rsi, %rax
jmpq *%rax
orl $0x2, %edx
jmp 0x1558
cmpl $0x4a, %eax
jg 0x14dd
movq %rdx, %r15
cmpl $0x41, %eax
je 0x157c
cmpl $0x42, %eax
je 0x159f
cmpl $0x45, %eax
movq %r15, %rdx
jne 0x1558
movq 0xdb36(%rip), %rax      # 0xefd8
movq (%rax), %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x10e0
movq 0x88(%rsp), %rdi
cmpb $0x2c, (%rdi)
movq %rax, 0x48(%rsp)
jne 0x1607
incq %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x10e0
jmp 0x1607
cmpl $0x4b, %eax
je 0x1592
cmpl $0x4f, %eax
je 0x15b5
cmpl $0x52, %eax
jne 0x1558
movq %rdx, %r15
movq 0xdada(%rip), %rax      # 0xefd8
movq (%rax), %rdi
callq 0x1140
movl %eax, 0x38(%rsp)
jmp 0x160c
cmpl $0x61, %eax
je 0x15f3
cmpl $0x67, %eax
jne 0x1558
orl $0x18, %edx
jmp 0x1558
movq %rdx, %r15
movq 0xdaac(%rip), %rax      # 0xefd8
movq (%rax), %rdi
callq 0x1140
movq %rax, 0x60(%rsp)
jmp 0x160c
movq %rdx, %r15
movq 0xda90(%rip), %rax      # 0xefd8
movq (%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x160c
orl $0x1, %edx
movq %rdx, %r15
jmp 0x160c
movq %rdx, %r15
movq 0xda6e(%rip), %rax      # 0xefd8
movq (%rax), %rdi
callq 0x1140
movq %rax, 0x50(%rsp)
jmp 0x160c
movq 0xda55(%rip), %rax      # 0xefd8
movq (%rax), %rdi
callq 0x1140
movq %rax, 0x20(%rsp)
jmp 0x160c
movq %rdx, %r15
movl $0x1, 0x18(%rsp)
jmp 0x160c
movq 0xda32(%rip), %rax      # 0xefd8
movq (%rax), %rdi
callq 0x1140
movq %rax, 0x8(%rsp)
jmp 0x160c
movq %rdx, %r15
movq 0xda19(%rip), %rax      # 0xefd8
movq (%rax), %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x10e0
movq 0x88(%rsp), %rdi
cmpb $0x2c, (%rdi)
movq %rax, 0x28(%rsp)
jne 0x1600
incq %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x10e0
jmp 0x1600
movq %rdx, %r15
movl $0x0, 0x58(%rsp)
jmp 0x160c
movq %rax, 0x30(%rsp)
jmp 0x160c
movq %rax, 0x10(%rsp)
movl %ebp, %edi
movq %r13, %rsi
movq %r12, %rdx
callq 0x1130
testl %eax, %eax
movq %r15, %rdx
movq %r14, %rbx
jns 0x144c
cmpl $0x0, 0x18(%rsp)
sete %al
cmpl $0x0, 0x58(%rsp)
sete %r12b
movq 0x60(%rsp), %r14
movq 0x50(%rsp), %rbx
jmp 0x1694
movb $0x4, %al
movq %rax, 0x28(%rsp)
leaq 0xa9d6(%rip), %rax      # 0xc028
movq %rax, 0x40(%rsp)
movb $0x1, %al
movq %rax, 0x10(%rsp)
movl $0x1, 0x38(%rsp)
xorl %r12d, %r12d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movb $0x2, %al
movq %rax, 0x48(%rsp)
movb $0xd, %al
movq %rax, 0x30(%rsp)
xorl %edx, %edx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movb $0x1, %al
movb $0x4, %cl
movq %rcx, 0x8(%rsp)
movb $0x2, %cl
movq %rcx, 0x20(%rsp)
movq 0xd935(%rip), %r15      # 0xefd0
subl (%r15), %ebp
cmpl $0x1, %ebp
jle 0x1a33
testb %al, %al
movq 0x40(%rsp), %rbp
movq %rdx, 0x58(%rsp)
movl %r12d, 0x68(%rsp)
je 0x16c6
callq 0x2b80
movq %rax, 0x18(%rsp)
jmp 0x16cf
movq $0x0, 0x18(%rsp)
movq %r14, %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movq $0x0, 0x100(%rsp)
movq 0x20(%rsp), %rdx
movl %edx, %eax
sarb $0x7, %al
xorb %al, %dl
subb %al, %dl
movq 0x8(%rsp), %rax
movl %eax, %esi
sarb $0x7, %sil
xorb %sil, %al
subb %al, %sil
leaq 0x90(%rsp), %rax
xorl %ecx, %ecx
movzbl %dl, %edx
movzbl %sil, %esi
leaq (%rcx,%rcx,4), %rdi
xorl %r8d, %r8d
cmpq %r8, %rcx
movl %esi, %r9d
cmovel %edx, %r9d
movb %r9b, (%rax,%r8)
incq %r8
cmpq $0x4, %r8
jne 0x1730
movb $0x0, 0x94(%rsp,%rdi)
incq %rcx
addq $0x5, %rax
cmpq $0x4, %rcx
jne 0x1729
movq %rbx, 0x50(%rsp)
movb $0x0, 0xa8(%rsp)
movl $0x0, 0xa4(%rsp)
movslq (%r15), %rax
movq (%r13,%rax,8), %rdi
leaq 0xaaca(%rip), %rbx      # 0xc24d
movq %rbx, %rsi
callq 0x1120
movq %rax, %r14
movslq (%r15), %rax
movq 0x8(%r13,%rax,8), %rdi
movq %rbx, %rsi
callq 0x1120
movq %rax, %rbx
movq %r14, %rax
orq %rbx, %rax
movq %rbp, 0x40(%rsp)
jne 0x1825
movslq (%r15), %rax
movq (%r13,%rax,8), %rcx
movq 0x8(%r13,%rax,8), %rdx
subq $0x8, %rsp
leaq 0xd8(%rsp), %rbx
movsbl 0x18(%rsp), %eax
movsbl 0x38(%rsp), %r10d
movsbl 0x50(%rsp), %r11d
movsbl 0x30(%rsp), %r9d
leaq 0x98(%rsp), %r8
movq %rbp, %rdi
movq 0x20(%rsp), %r15
movq %r15, %rsi
pushq %rbx
pushq 0x68(%rsp)
pushq %r12
pushq 0x70(%rsp)
pushq %rax
pushq %r10
pushq %r11
callq 0x1d5e
addq $0x40, %rsp
leaq 0xaa3e(%rip), %rdi      # 0xc24f
leaq 0xaa3d(%rip), %rsi      # 0xc255
movq %rbx, %rdx
callq 0x2407
jmp 0x1d32
testq %r14, %r14
movq 0x18(%rsp), %r15
je 0x1d32
testq %rbx, %rbx
movq %r15, 0x18(%rsp)
je 0x1d32
movq %r14, 0xc0(%rsp)
movq %r14, %rdi
callq 0x24ab
movq %rax, %r13
movq %rbx, %rdi
callq 0x24ab
movq %rax, %r14
movq %r13, %rdi
callq 0x24f5
cmpb $0x0, 0x68(%rsp)
movq %r12, 0x60(%rsp)
movq %rbx, 0xb8(%rsp)
je 0x191b
testl %eax, %eax
movq %r13, 0x78(%rsp)
jle 0x1b7f
movq %r14, 0x70(%rsp)
xorl %ebp, %ebp
movl $0x8, %r14d
movq $0x0, 0x8(%rsp)
xorl %r15d, %r15d
movl %r15d, %eax
cmpq %rax, %rbp
jne 0x18d9
movl %r15d, %ebx
sarl %ebx
addl %r15d, %ebx
testl %r15d, %r15d
movl $0x10, %eax
cmovel %eax, %ebx
movslq %ebx, %rsi
shlq $0x4, %rsi
movq 0x8(%rsp), %rdi
callq 0x1110
movq %rax, %r12
movl %ebx, %r15d
jmp 0x18de
movq 0x8(%rsp), %r12
incq %rbp
movq 0x10(%r13), %rdi
callq 0x1170
movq %rax, -0x8(%r12,%r14)
movq 0x40(%r13), %rdi
callq 0x1170
movq %r12, 0x8(%rsp)
movq %rax, (%r12,%r14)
movq %r13, %rdi
callq 0x24f5
addq $0x10, %r14
testl %eax, %eax
jg 0x18a5
movq 0x70(%rsp), %r14
jmp 0x1b8a
testl %eax, %eax
jle 0x1d03
leaq 0xd0(%rsp), %rbx
movsbl 0x10(%rsp), %eax
movq %rax, 0x20(%rsp)
movsbl 0x30(%rsp), %eax
movq %rax, 0x8(%rsp)
movsbl 0x48(%rsp), %eax
movq %rax, 0x10(%rsp)
movsbl 0x28(%rsp), %eax
movl %eax, 0x68(%rsp)
movq %r13, 0x78(%rsp)
movq %r14, 0x70(%rsp)
movl 0x68(%rsp), %ebp
movq %r14, %rdi
callq 0x24f5
testl %eax, %eax
jle 0x1d03
cmpl $0x0, 0x38(%rsp)
movq 0x60(%rsp), %r11
movq %r13, %rdi
movq %rbx, %r10
movq %r14, %rcx
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %r14
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbx
jle 0x1a05
movl 0x38(%rsp), %r12d
movq 0x40(%rcx), %rdx
movq 0x40(%rdi), %rcx
subq $0x8, %rsp
movq 0x48(%rsp), %rdi
leaq 0x98(%rsp), %r8
movl %ebp, %r9d
pushq %r10
pushq 0x68(%rsp)
pushq %r11
pushq 0x70(%rsp)
pushq %r14
pushq %r13
pushq %rbx
movq %r10, %r15
movq %rbx, %r13
movq %r11, %rbx
callq 0x1d5e
movq 0x58(%rsp), %rsi
movq %rbx, %r11
movq %r13, %rbx
movq 0xb0(%rsp), %rcx
movq %r15, %r10
movq 0x48(%rsp), %r13
movq 0xb8(%rsp), %rdi
addq $0x40, %rsp
decl %r12d
jne 0x199e
movq %rdi, %r13
movq 0x10(%rdi), %rdi
movq 0x10(%rcx), %rsi
movq %r10, %rdx
movq %r10, %rbx
movq %rcx, %r14
callq 0x2407
movq %r13, %rdi
callq 0x24f5
testl %eax, %eax
jg 0x1960
jmp 0x1d03
movq 0xd5be(%rip), %rbx      # 0xeff8
movq (%rbx), %rcx
leaq 0xa5ff(%rip), %rdi      # 0xc043
movl $0x34, %esi
movl $0x1, %edx
callq 0x1160
movq (%rbx), %rcx
leaq 0xa61b(%rip), %rdi      # 0xc078
movl $0x9, %esi
movl $0x1, %edx
callq 0x1160
movq (%rbx), %rdi
leaq 0xa60c(%rip), %rsi      # 0xc082
movq 0x40(%rsp), %rdx
xorl %eax, %eax
callq 0x10d0
movq (%rbx), %rcx
leaq 0xa64a(%rip), %rdi      # 0xc0d6
movl $0x38, %esi
movl $0x1, %edx
callq 0x1160
movq (%rbx), %rcx
leaq 0xa66a(%rip), %rdi      # 0xc10f
movl $0x21, %esi
movl $0x1, %edx
callq 0x1160
movq (%rbx), %rdi
leaq 0xa673(%rip), %rsi      # 0xc131
movl %r14d, %edx
xorl %eax, %eax
callq 0x10d0
movq (%rbx), %rcx
leaq 0xa67c(%rip), %rdi      # 0xc14e
movl $0x24, %esi
movl $0x1, %edx
callq 0x1160
movq (%rbx), %rcx
leaq 0xa688(%rip), %rdi      # 0xc173
movl $0x1b, %esi
movl $0x1, %edx
callq 0x1160
movq (%rbx), %rdi
movsbl 0x20(%rsp), %edx
leaq 0xa686(%rip), %rsi      # 0xc18f
xorl %eax, %eax
callq 0x10d0
movq (%rbx), %rdi
movsbl 0x8(%rsp), %edx
leaq 0xa692(%rip), %rsi      # 0xc1b1
xorl %eax, %eax
callq 0x10d0
movq (%rbx), %rdi
movsbl 0x28(%rsp), %edx
movsbl 0x30(%rsp), %ecx
leaq 0xa69e(%rip), %rsi      # 0xc1d8
xorl %eax, %eax
callq 0x10d0
movq (%rbx), %rdi
movsbl 0x48(%rsp), %edx
movsbl 0x10(%rsp), %ecx
leaq 0xa6ad(%rip), %rsi      # 0xc202
xorl %eax, %eax
callq 0x10d0
movq (%rbx), %rcx
leaq 0xa6cb(%rip), %rdi      # 0xc231
movl $0x1b, %esi
movl $0x1, %edx
callq 0x1160
movl $0x1, %eax
jmp 0x1d4c
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
movq %r14, %rdi
callq 0x24f5
movl %ebp, %ecx
movq %rcx, 0x80(%rsp)
testl %eax, %eax
jle 0x1cc3
movq 0x80(%rsp), %rax
shlq $0x4, %rax
movq %rax, 0x68(%rsp)
movsbl 0x10(%rsp), %eax
movq %rax, 0x38(%rsp)
movsbl 0x30(%rsp), %eax
movq %rax, 0x20(%rsp)
movsbl 0x48(%rsp), %eax
movq %rax, 0x10(%rsp)
movsbl 0x28(%rsp), %eax
movl %eax, 0x28(%rsp)
movq %rbp, 0xc8(%rsp)
testl %ebp, %ebp
movq 0x60(%rsp), %r10
movq 0x50(%rsp), %r11
movq 0x8(%rsp), %rdi
leaq 0xd0(%rsp), %r13
movq 0x38(%rsp), %rbp
movq 0x20(%rsp), %r15
movq 0x10(%rsp), %r12
leaq 0x90(%rsp), %rax
je 0x1cab
xorl %ebx, %ebx
movq %rdi, 0x8(%rsp)
movq 0x40(%r14), %rdx
movq 0x8(%rdi,%rbx), %rcx
subq $0x8, %rsp
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %rax, %r8
movl 0x30(%rsp), %r9d
pushq %r13
pushq 0x68(%rsp)
pushq %r10
pushq %r11
pushq %rbp
pushq %r15
pushq %r12
movq %r10, %r15
movq %r13, %rbp
movq %r11, %r13
movq %rax, %r12
callq 0x1d5e
addq $0x40, %rsp
movq 0x8(%rsp), %rax
movq (%rax,%rbx), %rdi
movq 0x10(%r14), %rsi
movq %rbp, %rdx
callq 0x2407
movq %r12, %rax
movq 0x8(%rsp), %rdi
movq 0x68(%rsp), %rcx
movq %r13, %r11
movq %rbp, %r13
movq 0x38(%rsp), %rbp
movq 0x10(%rsp), %r12
movq %r15, %r10
movq 0x20(%rsp), %r15
addq $0x10, %rbx
cmpq %rbx, %rcx
jne 0x1c21
movq %r14, %rdi
callq 0x24f5
testl %eax, %eax
movq 0xc8(%rsp), %rbp
jg 0x1be4
testl %ebp, %ebp
movq 0x8(%rsp), %r15
movq 0x80(%rsp), %r12
je 0x1cf6
shlq $0x4, %r12
xorl %ebx, %ebx
movq (%r15,%rbx), %rdi
callq 0x1040
movq 0x8(%r15,%rbx), %rdi
callq 0x1040
addq $0x10, %rbx
cmpq %rbx, %r12
jne 0x1cda
movq %r15, %rdi
callq 0x1040
movq 0x78(%rsp), %r13
movq %r13, %rdi
callq 0x287c
movq %r14, %rdi
callq 0x287c
movq 0xc0(%rsp), %rdi
callq 0x1030
movq 0xb8(%rsp), %rdi
callq 0x1030
movq 0x18(%rsp), %r15
movq 0x100(%rsp), %rsi
movq %r15, %rdi
callq 0x2bf9
movq %r15, %rdi
callq 0x2b8f
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq