// File: /workspace/github_c_makefile_star2_O1/aokad[P]sequeeze/seqtk.c
// Function: stk_famask
int stk_famask(int argc, char *argv[])
{
	gzFile fp[2];
	kseq_t *seq[2];
	int i, l, c;
	while ((c = getopt(argc, argv, "")) >= 0);
	if (argc - optind < 2) {
		fprintf(stderr, "Usage: seqtk famask <src.fa> <mask.fa>\n");
		return 1;
	}
	for (i = 0; i < 2; ++i) {
		fp[i] = strcmp(argv[optind+i], "-")? gzopen(argv[optind+i], "r") : gzdopen(fileno(stdin), "r");
		seq[i] = kseq_init(fp[i]);
	}
	if (fp[0] == 0 || fp[1] == 0) {
		fprintf(stderr, "[E::%s] failed to open the input file/stream.\n", __func__);
		return 1;
	}
	while (kseq_read(seq[0]) >= 0) {
		int min_l, c[2];
		kseq_read(seq[1]);
		if (strcmp(seq[0]->name.s, seq[1]->name.s))
			fprintf(stderr, "[%s] Different sequence names: %s != %s\n", __func__, seq[0]->name.s, seq[1]->name.s);
		if (seq[0]->seq.l != seq[1]->seq.l)
			fprintf(stderr, "[%s] Unequal sequence length: %ld != %ld\n", __func__, seq[0]->seq.l, seq[1]->seq.l);
		min_l = seq[0]->seq.l < seq[1]->seq.l? seq[0]->seq.l : seq[1]->seq.l;
		printf(">%s", seq[0]->name.s);
		for (l = 0; l < min_l; ++l) {
			c[0] = seq[0]->seq.s[l]; c[1] = seq[1]->seq.s[l];
			if (c[1] == 'x') c[0] = tolower(c[0]);
			else if (c[1] != 'X') c[0] = c[1];
			if (l%60 == 0) putchar('\n');
			putchar(c[0]);
		}
		putchar('\n');
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x5fdb(%rip), %r14      # 0xb6ee
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2240
testl %eax, %eax
jns 0x5713
movq 0xa8a5(%rip), %r13      # 0xffd0
subl (%r13), %ebp
cmpl $0x2, %ebp
jl 0x5910
xorl %ebp, %ebp
leaq 0x6c6d(%rip), %r14      # 0xc3ae
leaq 0x5a50(%rip), %r15      # 0xb198
movslq (%r13), %rax
addq %rbp, %rax
movq (%rbx,%rax,8), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x2170
testl %eax, %eax
je 0x576f
movq %r12, %rdi
movq %r15, %rsi
callq 0x2220
jmp 0x5788
movq 0xa852(%rip), %rax      # 0xffc8
movq (%rax), %rdi
callq 0x21b0
movl %eax, %edi
movq %r15, %rsi
callq 0x20b0
movq %rax, 0x10(%rsp,%rbp,8)
movq %rax, %rdi
callq 0x3e57
movq %rax, (%rsp,%rbp,8)
incq %rbp
cmpq $0x1, %rbp
je 0x5748
cmpq $0x0, 0x10(%rsp)
je 0x5917
cmpq $0x0, 0x18(%rsp)
je 0x5917
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x3ea1
testl %eax, %eax
js 0x58ff
movq 0x8(%rsp), %r14
movl $0x88888889, %r13d      # imm = 0x88888889
movq %r14, %rdi
callq 0x3ea1
movq 0x10(%rbx), %r12
movq 0x10(%r14), %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2170
testl %eax, %eax
jne 0x58b1
movq 0x30(%rbx), %rcx
movq 0x30(%r14), %r8
cmpq %r8, %rcx
jne 0x58db
movq 0x10(%rbx), %rsi
movq 0x30(%rbx), %rax
movq 0x30(%r14), %rbp
cmpq %rbp, %rax
cmovbq %rax, %rbp
leaq 0x5c6d(%rip), %rdi      # 0xb494
xorl %eax, %eax
callq 0x20f0
testl %ebp, %ebp
jle 0x5895
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
movsbl (%rax,%r15), %r12d
movq 0x40(%r14), %rax
movzbl (%rax,%r15), %eax
cmpl $0x58, %eax
je 0x5868
cmpl $0x78, %eax
jne 0x5864
movl %r12d, %edi
callq 0x21c0
movl %eax, %r12d
jmp 0x5868
movsbl %al, %r12d
movl %r15d, %eax
imulq %r13, %rax
shrq $0x25, %rax
imull $-0x3c, %eax, %eax
addl %r15d, %eax
jne 0x5885
movl $0xa, %edi
callq 0x2060
movl %r12d, %edi
callq 0x2060
incq %r15
cmpq %r15, %rbp
jne 0x583b
movl $0xa, %edi
callq 0x2060
movq %rbx, %rdi
callq 0x3ea1
testl %eax, %eax
jns 0x57d9
jmp 0x58ff
movq 0xa740(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x5fa2(%rip), %rsi      # 0xb864
leaq 0x6056(%rip), %rdx      # 0xb91f
movq %r12, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x2190
jmp 0x57fc
movq 0xa716(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x5fa1(%rip), %rsi      # 0xb88d
leaq 0x602c(%rip), %rdx      # 0xb91f
xorl %eax, %eax
callq 0x2190
jmp 0x580d
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2697
jmp 0x591c
callq 0x2678
movl $0x1, %eax
jmp 0x5901