// File: /workspace/github_c_makefile_star2_O3/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 0x5f32(%rip), %r14      # 0xb6fe
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2240
testl %eax, %eax
jns 0x57cc
movq 0xa7ec(%rip), %rax      # 0xffd0
subl (%rax), %ebp
cmpl $0x2, %ebp
jl 0x59e9
xorl %eax, %eax
leaq 0x10(%rsp), %r13
movq %rsp, %r12
movb $0x1, %bpl
leaq 0x20(%rsp), %r14
leaq 0x18(%rsp), %r15
movq 0xa7c3(%rip), %rcx      # 0xffd0
movslq (%rcx), %rcx
cltq
addq %rcx, %rax
movq (%rbx,%rax,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x5824
cmpb $0x0, 0x1(%rdi)
je 0x5858
leaq 0x597d(%rip), %rsi      # 0xb1a8
callq 0x2220
movq %rax, (%r13)
movq %rax, %rdi
callq 0x3edd
movq %rax, (%r12)
movl $0x1, %eax
movq %r15, %r12
movq %r14, %r13
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x5806
jmp 0x5877
movq 0xa769(%rip), %rax      # 0xffc8
movq (%rax), %rdi
callq 0x21b0
movl %eax, %edi
leaq 0x5938(%rip), %rsi      # 0xb1a8
callq 0x20b0
jmp 0x5830
cmpq $0x0, 0x10(%rsp)
je 0x59f0
cmpq $0x0, 0x20(%rsp)
je 0x59f0
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x3f27
testl %eax, %eax
js 0x59d8
movq 0x18(%rsp), %r14
movl $0x88888889, %r13d      # imm = 0x88888889
movq %r14, %rdi
callq 0x3f27
movq 0x10(%rbx), %r12
movq 0x10(%r14), %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2170
testl %eax, %eax
jne 0x597f
movq 0x30(%rbx), %r12
movq 0x30(%r14), %r8
cmpq %r8, %r12
jne 0x59a9
movq %r12, %rax
cmpq %r12, %rax
cmovbq %rax, %r12
movq 0x10(%rbx), %rsi
leaq 0x5bad(%rip), %rdi      # 0xb4a4
xorl %eax, %eax
callq 0x20f0
testl %r12d, %r12d
jle 0x5963
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
movsbl (%rax,%r15), %ebp
movq 0x40(%r14), %rax
movzbl (%rax,%r15), %eax
cmpl $0x58, %eax
je 0x5937
cmpl $0x78, %eax
jne 0x5934
movl %ebp, %edi
callq 0x21c0
movl %eax, %ebp
jmp 0x5937
movsbl %al, %ebp
movl %r15d, %eax
imulq %r13, %rax
shrq $0x25, %rax
imull $-0x3c, %eax, %eax
addl %r15d, %eax
jne 0x5954
movl $0xa, %edi
callq 0x2060
movl %ebp, %edi
callq 0x2060
incq %r15
cmpq %r15, %r12
jne 0x590d
movl $0xa, %edi
callq 0x2060
movq %rbx, %rdi
callq 0x3f27
testl %eax, %eax
jns 0x58ae
jmp 0x59d8
movq 0xa672(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x5ee4(%rip), %rsi      # 0xb874
leaq 0x5f98(%rip), %rdx      # 0xb92f
movq %r12, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x2190
jmp 0x58d1
movq 0xa648(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x5ee3(%rip), %rsi      # 0xb89d
leaq 0x5f6e(%rip), %rdx      # 0xb92f
movq %r12, %rcx
xorl %eax, %eax
callq 0x2190
movq 0x30(%rbx), %rax
movq 0x30(%r14), %r12
jmp 0x58e5
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2697
jmp 0x59f5
callq 0x2678
movl $0x1, %eax
jmp 0x59da