// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl $0x0, -0x2c(%rbp)
movl %edi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movb $0x2, -0x41(%rbp)
movb $0x4, -0x42(%rbp)
movb $0x4, -0x43(%rbp)
movb $0x2, -0x44(%rbp)
movb $0xd, -0x45(%rbp)
movb $0x1, -0x46(%rbp)
movl $0x1, -0x54(%rbp)
movl $0xffffffff, -0x58(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x5c(%rbp)
movl $0x1, -0x60(%rbp)
movl $0xffffffff, -0x64(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x68(%rbp)
leaq 0x1cd11(%rip), %rax     # 0x1e004
movq %rax, -0x70(%rbp)
movl -0x30(%rbp), %edi
movq -0x38(%rbp), %rsi
leaq 0x1cd04(%rip), %rdx     # 0x1e009
callq 0x1130
movl %eax, -0x4c(%rbp)
cmpl $0x0, %eax
jl 0x14d3
cmpl $0x74, -0x4c(%rbp)
jne 0x132f
movq 0x1fcb5(%rip), %rax     # 0x20fd8
movq (%rax), %rax
movq %rax, -0x70(%rbp)
jmp 0x14ce
cmpl $0x77, -0x4c(%rbp)
jne 0x134c
movq 0x1fc9c(%rip), %rax     # 0x20fd8
movq (%rax), %rdi
callq 0x1140
movl %eax, -0x58(%rbp)
jmp 0x14cc
cmpl $0x52, -0x4c(%rbp)
jne 0x1369
movq 0x1fc7f(%rip), %rax     # 0x20fd8
movq (%rax), %rdi
callq 0x1140
movl %eax, -0x60(%rbp)
jmp 0x14ca
cmpl $0x7a, -0x4c(%rbp)
jne 0x1386
movq 0x1fc62(%rip), %rax     # 0x20fd8
movq (%rax), %rdi
callq 0x1140
movl %eax, -0x64(%rbp)
jmp 0x14c8
cmpl $0x72, -0x4c(%rbp)
jne 0x139a
movl -0x5c(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x5c(%rbp)
jmp 0x14c6
cmpl $0x73, -0x4c(%rbp)
jne 0x13ae
movl -0x5c(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x14c4
cmpl $0x67, -0x4c(%rbp)
jne 0x13c2
movl -0x5c(%rbp), %eax
orl $0x18, %eax
movl %eax, -0x5c(%rbp)
jmp 0x14c2
cmpl $0x4b, -0x4c(%rbp)
jne 0x13d4
movl $0x1, -0x68(%rbp)
jmp 0x14c0
cmpl $0x41, -0x4c(%rbp)
jne 0x13f1
movq 0x1fbf7(%rip), %rax     # 0x20fd8
movq (%rax), %rdi
callq 0x1140
movb %al, -0x41(%rbp)
jmp 0x14be
cmpl $0x42, -0x4c(%rbp)
jne 0x140e
movq 0x1fbda(%rip), %rax     # 0x20fd8
movq (%rax), %rdi
callq 0x1140
movb %al, -0x42(%rbp)
jmp 0x14bc
cmpl $0x61, -0x4c(%rbp)
jne 0x1420
movl $0x0, -0x54(%rbp)
jmp 0x14ba
cmpl $0x4f, -0x4c(%rbp)
jne 0x146b
movq 0x1fbab(%rip), %rax     # 0x20fd8
movq (%rax), %rdi
leaq -0x78(%rbp), %rsi
movl $0xa, %edx
callq 0x10e0
movb %al, -0x45(%rbp)
movb %al, -0x43(%rbp)
movq -0x78(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
jne 0x1469
movq -0x78(%rbp), %rdi
addq $0x1, %rdi
leaq -0x78(%rbp), %rsi
movl $0xa, %edx
callq 0x10e0
movb %al, -0x45(%rbp)
jmp 0x14b8
cmpl $0x45, -0x4c(%rbp)
jne 0x14b6
movq 0x1fb60(%rip), %rax     # 0x20fd8
movq (%rax), %rdi
leaq -0x78(%rbp), %rsi
movl $0xa, %edx
callq 0x10e0
movb %al, -0x46(%rbp)
movb %al, -0x44(%rbp)
movq -0x78(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
jne 0x14b4
movq -0x78(%rbp), %rdi
addq $0x1, %rdi
leaq -0x78(%rbp), %rsi
movl $0xa, %edx
callq 0x10e0
movb %al, -0x46(%rbp)
jmp 0x14b6
jmp 0x14b8
jmp 0x14ba
jmp 0x14bc
jmp 0x14be
jmp 0x14c0
jmp 0x14c2
jmp 0x14c4
jmp 0x14c6
jmp 0x14c8
jmp 0x14ca
jmp 0x14cc
jmp 0x14ce
jmp 0x12f7
movl -0x30(%rbp), %eax
movq 0x1faf3(%rip), %rcx     # 0x20fd0
subl (%rcx), %eax
cmpl $0x2, %eax
jge 0x164b
movq 0x1fb09(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
leaq 0x1cb26(%rip), %rsi     # 0x1e01f
movb $0x0, %al
callq 0x10d0
movq 0x1faf1(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
leaq 0x1cb43(%rip), %rsi     # 0x1e054
movb $0x0, %al
callq 0x10d0
movq 0x1fad9(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
movq -0x70(%rbp), %rdx
leaq 0x1cb31(%rip), %rsi     # 0x1e05e
movb $0x0, %al
callq 0x10d0
movq 0x1fabd(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
leaq 0x1cb6d(%rip), %rsi     # 0x1e0b2
movb $0x0, %al
callq 0x10d0
movq 0x1faa5(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
leaq 0x1cb8e(%rip), %rsi     # 0x1e0eb
movb $0x0, %al
callq 0x10d0
movq 0x1fa8d(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
movl -0x64(%rbp), %edx
leaq 0x1cb95(%rip), %rsi     # 0x1e10d
movb $0x0, %al
callq 0x10d0
movq 0x1fa72(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
leaq 0x1cb9a(%rip), %rsi     # 0x1e12a
movb $0x0, %al
callq 0x10d0
movq 0x1fa5a(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
leaq 0x1cba7(%rip), %rsi     # 0x1e14f
movb $0x0, %al
callq 0x10d0
movq 0x1fa42(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
movsbl -0x41(%rbp), %edx
leaq 0x1cba7(%rip), %rsi     # 0x1e16b
movb $0x0, %al
callq 0x10d0
movq 0x1fa26(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
movsbl -0x42(%rbp), %edx
leaq 0x1cbad(%rip), %rsi     # 0x1e18d
movb $0x0, %al
callq 0x10d0
movq 0x1fa0a(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
movsbl -0x43(%rbp), %edx
movsbl -0x45(%rbp), %ecx
leaq 0x1cbb4(%rip), %rsi     # 0x1e1b4
movb $0x0, %al
callq 0x10d0
movq 0x1f9ea(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
movsbl -0x44(%rbp), %edx
movsbl -0x46(%rbp), %ecx
leaq 0x1cbbe(%rip), %rsi     # 0x1e1de
movb $0x0, %al
callq 0x10d0
movq 0x1f9ca(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
leaq 0x1cbd5(%rip), %rsi     # 0x1e20d
movb $0x0, %al
callq 0x10d0
movl $0x1, -0x2c(%rbp)
jmp 0x1bf5
cmpl $0x0, -0x68(%rbp)
je 0x165c
xorl %eax, %eax
movq %rax, -0x128(%rbp)
jmp 0x1668
callq 0x31c0
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0xd8(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x1090
leaq -0xa0(%rbp), %rsi
movb -0x41(%rbp), %cl
movsbl -0x42(%rbp), %edx
xorl %eax, %eax
subl %edx, %eax
movl $0x5, %edi
movsbl %cl, %edx
movsbl %al, %ecx
callq 0x1c10
movq -0x38(%rbp), %rax
movq 0x1f91d(%rip), %rcx     # 0x20fd0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1cb68(%rip), %rsi     # 0x1e229
callq 0x1120
movq %rax, -0xf0(%rbp)
movq -0x38(%rbp), %rax
movq 0x1f8f8(%rip), %rcx     # 0x20fd0
movl (%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1cb3e(%rip), %rsi     # 0x1e229
callq 0x1120
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0xf0(%rbp)
jne 0x17cd
cmpq $0x0, -0xe8(%rbp)
jne 0x17cd
movq -0x70(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rax
movq 0x1f8aa(%rip), %rcx     # 0x20fd0
movl (%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x38(%rbp), %rax
movq 0x1f893(%rip), %rcx     # 0x20fd0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rcx
leaq -0xa0(%rbp), %r9
movb -0x43(%rbp), %r13b
movb -0x44(%rbp), %r12b
movb -0x45(%rbp), %r15b
movb -0x46(%rbp), %r14b
movl -0x58(%rbp), %ebx
movl -0x64(%rbp), %r11d
movl -0x5c(%rbp), %r10d
movl $0x5, %r8d
leaq -0xd8(%rbp), %rax
movsbl %r13b, %r13d
movl %r13d, (%rsp)
movsbl %r12b, %r12d
movl %r12d, 0x8(%rsp)
movsbl %r15b, %r15d
movl %r15d, 0x10(%rsp)
movsbl %r14b, %r14d
movl %r14d, 0x18(%rsp)
movl %ebx, 0x20(%rsp)
movl %r11d, 0x28(%rsp)
movl %r10d, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x1d30
leaq 0x1ca76(%rip), %rdi     # 0x1e22b
leaq 0x1ca75(%rip), %rsi     # 0x1e231
leaq -0xd8(%rbp), %rdx
callq 0x25f0
jmp 0x1bd5
cmpq $0x0, -0xf0(%rbp)
je 0x1bd3
cmpq $0x0, -0xe8(%rbp)
je 0x1bd3
movq -0xf0(%rbp), %rdi
callq 0x26d0
movq %rax, -0x100(%rbp)
movq -0xe8(%rbp), %rdi
callq 0x26d0
movq %rax, -0xf8(%rbp)
cmpl $0x0, -0x54(%rbp)
je 0x191b
jmp 0x181b
movq -0x100(%rbp), %rdi
callq 0x2710
cmpl $0x0, %eax
jle 0x1916
movq -0xf8(%rbp), %rdi
callq 0x2710
cmpl $0x0, %eax
jg 0x1846
jmp 0x1916
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x60(%rbp), %eax
jge 0x18ef
movq -0x70(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0xf8(%rbp), %rax
movq 0x40(%rax), %rdx
movq -0x100(%rbp), %rax
movq 0x40(%rax), %rcx
leaq -0xa0(%rbp), %r9
movb -0x43(%rbp), %r13b
movb -0x44(%rbp), %r12b
movb -0x45(%rbp), %r15b
movb -0x46(%rbp), %r14b
movl -0x58(%rbp), %ebx
movl -0x64(%rbp), %r11d
movl -0x5c(%rbp), %r10d
movl $0x5, %r8d
leaq -0xd8(%rbp), %rax
movsbl %r13b, %r13d
movl %r13d, (%rsp)
movsbl %r12b, %r12d
movl %r12d, 0x8(%rsp)
movsbl %r15b, %r15d
movl %r15d, 0x10(%rsp)
movsbl %r14b, %r14d
movl %r14d, 0x18(%rsp)
movl %ebx, 0x20(%rsp)
movl %r11d, 0x28(%rsp)
movl %r10d, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x1d30
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x184d
movq -0x100(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0xf8(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x25f0
jmp 0x181b
jmp 0x1ba3
movl $0x0, -0x108(%rbp)
movl $0x0, -0x10c(%rbp)
movq $0x0, -0x118(%rbp)
movq -0x100(%rbp), %rdi
callq 0x2710
cmpl $0x0, %eax
jle 0x1a22
movl -0x10c(%rbp), %eax
cmpl -0x108(%rbp), %eax
jne 0x19b9
jmp 0x195f
cmpl $0x0, -0x108(%rbp)
je 0x1980
movl -0x108(%rbp), %eax
movl -0x108(%rbp), %ecx
sarl %ecx
addl %ecx, %eax
movl %eax, -0x12c(%rbp)
jmp 0x198d
movl $0x10, %eax
movl %eax, -0x12c(%rbp)
jmp 0x198d
movl -0x12c(%rbp), %eax
movl %eax, -0x108(%rbp)
movq -0x118(%rbp), %rdi
movslq -0x108(%rbp), %rsi
shlq $0x4, %rsi
callq 0x1110
movq %rax, -0x118(%rbp)
jmp 0x19b9
movq -0x118(%rbp), %rax
movl -0x10c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x10c(%rbp)
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x120(%rbp)
movq -0x100(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x1160
movq %rax, %rcx
movq -0x120(%rbp), %rax
movq %rcx, (%rax)
movq -0x100(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x1160
movq %rax, %rcx
movq -0x120(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x193a
jmp 0x1a24
movq -0xf8(%rbp), %rdi
callq 0x2710
cmpl $0x0, %eax
jle 0x1b33
movl $0x0, -0x104(%rbp)
movl -0x104(%rbp), %eax
cmpl -0x10c(%rbp), %eax
jge 0x1b2e
movq -0x70(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0xf8(%rbp), %rax
movq 0x40(%rax), %rdx
movq -0x118(%rbp), %rax
movslq -0x104(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
leaq -0xa0(%rbp), %r9
movb -0x43(%rbp), %r13b
movb -0x44(%rbp), %r12b
movb -0x45(%rbp), %r15b
movb -0x46(%rbp), %r14b
movl -0x58(%rbp), %ebx
movl -0x64(%rbp), %r11d
movl -0x5c(%rbp), %r10d
movl $0x5, %r8d
leaq -0xd8(%rbp), %rax
movsbl %r13b, %r13d
movl %r13d, (%rsp)
movsbl %r12b, %r12d
movl %r12d, 0x8(%rsp)
movsbl %r15b, %r15d
movl %r15d, 0x10(%rsp)
movsbl %r14b, %r14d
movl %r14d, 0x18(%rsp)
movl %ebx, 0x20(%rsp)
movl %r11d, 0x28(%rsp)
movl %r10d, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x1d30
movq -0x118(%rbp), %rax
movslq -0x104(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0xf8(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x25f0
movl -0x104(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
jmp 0x1a43
jmp 0x1a24
movl $0x0, -0x104(%rbp)
movl -0x104(%rbp), %eax
cmpl -0x10c(%rbp), %eax
jge 0x1b97
movq -0x118(%rbp), %rax
movslq -0x104(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x1040
movq -0x118(%rbp), %rax
movslq -0x104(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x1040
movl -0x104(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
jmp 0x1b3d
movq -0x118(%rbp), %rdi
callq 0x1040
movq -0x100(%rbp), %rdi
callq 0x2b00
movq -0xf8(%rbp), %rdi
callq 0x2b00
movq -0xf0(%rbp), %rdi
callq 0x1030
movq -0xe8(%rbp), %rdi
callq 0x1030
jmp 0x1bd5
movq -0x40(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x3290
movq -0x40(%rbp), %rdi
callq 0x31e0
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw (%rax,%rax)