// File: /workspace/github_c_makefile_star2_O0/aokad[P]sequeeze/seqtk.c
// Function: stk_mask
void stk_mask(kseq_t *seq, const khash_t(reg) *h, int is_complement, int mask_chr)
{
	unsigned i, j;
	khiter_t k;
	k = kh_get(reg, h, seq->name.s);
	if (k == kh_end(h)) { // not found in the hash table
		if (is_complement) {
			if (mask_chr) {
				for (j = 0; j < seq->seq.l; ++j)
					seq->seq.s[j] = mask_chr;
			} else {
				for (j = 0; j < seq->seq.l; ++j)
					seq->seq.s[j] = tolower(seq->seq.s[j]);
			}
		}
	} else {
		reglist_t *p = &kh_val(h, k);
		if (!is_complement) {
			for (i = 0; i < p->n; ++i) {
				unsigned beg = p->a[i]>>32, end = p->a[i];
				if (beg >= seq->seq.l) continue;
				if (end > seq->seq.l) end = seq->seq.l;
				if (!mask_chr) for (j = beg; j < end; ++j) seq->seq.s[j] = tolower(seq->seq.s[j]);
				else for (j = beg; j < end; ++j) seq->seq.s[j] = mask_chr;
			}
		} else {
			int8_t *mask = calloc(seq->seq.l, 1);
			for (i = 0; i < p->n; ++i) {
				unsigned beg = p->a[i]>>32, end = p->a[i];
				if (end >= seq->seq.l) end = seq->seq.l;
				for (j = beg; j < end; ++j) mask[j] = 1;
			}
			if (mask_chr) {
				for (j = 0; j < seq->seq.l; ++j)
					if (mask[j] == 0) seq->seq.s[j] = mask_chr;
			} else {
				for (j = 0; j < seq->seq.l; ++j)
					if (mask[j] == 0) seq->seq.s[j] = tolower(seq->seq.s[j]);
			}
			free(mask);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x2760
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x7a19
cmpl $0x0, -0x14(%rbp)
je 0x7a14
cmpl $0x0, -0x18(%rbp)
je 0x79cd
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x79cb
movl -0x18(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x20(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x79a0
jmp 0x7a12
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x7a10
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x20(%rbp), %ecx
movsbl (%rax,%rcx), %edi
callq 0x21c0
movb %al, %dl
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x20(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x79d4
jmp 0x7a12
jmp 0x7a14
jmp 0x7c70
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x24(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x7b29
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jae 0x7b24
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jb 0x7a89
jmp 0x7b16
movl -0x38(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jbe 0x7aa1
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x7ae6
movl -0x34(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x38(%rbp), %eax
jae 0x7ae4
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x20(%rbp), %ecx
movsbl (%rax,%rcx), %edi
callq 0x21c0
movb %al, %dl
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x20(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7aad
jmp 0x7b14
movl -0x34(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x38(%rbp), %eax
jae 0x7b12
movl -0x18(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x20(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7aec
jmp 0x7b14
jmp 0x7b16
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7a40
jmp 0x7c6e
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movl $0x1, %esi
callq 0x2160
movq %rax, -0x40(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jae 0x7bc2
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, -0x44(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jb 0x7b91
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x48(%rbp), %eax
jae 0x7bb5
movq -0x40(%rbp), %rax
movl -0x20(%rbp), %ecx
movb $0x1, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7b97
jmp 0x7bb7
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7b46
cmpl $0x0, -0x18(%rbp)
je 0x7c0e
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x7c0c
movq -0x40(%rbp), %rax
movl -0x20(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x7bff
movl -0x18(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x20(%rbp), %ecx
movb %dl, (%rax,%rcx)
jmp 0x7c01
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7bcf
jmp 0x7c65
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x7c63
movq -0x40(%rbp), %rax
movl -0x20(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x7c56
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x20(%rbp), %ecx
movsbl (%rax,%rcx), %edi
callq 0x21c0
movb %al, %dl
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x20(%rbp), %ecx
movb %dl, (%rax,%rcx)
jmp 0x7c58
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7c15
jmp 0x7c65
movq -0x40(%rbp), %rdi
callq 0x2040
jmp 0x7c70
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)