// File: /workspace/github_c_makefile_star2_O2/aokad[P]sequeeze/seqtk.c
// Function: stk_cutN
int stk_cutN(int argc, char *argv[])
{
	int c, l, gap_only = 0;
	gzFile fp;
	kseq_t *ks;
	while ((c = getopt(argc, argv, "n:p:g")) >= 0) {
		switch (c) {
		case 'n': cutN_min_N_tract = atoi(optarg); break;
		case 'p': cutN_nonN_penalty = atoi(optarg); break;
		case 'g': gap_only = 1; break;
		default: return 1;
		}
	}
	if (argc == optind) {
		fprintf(stderr, "\n");
		fprintf(stderr, "Usage:   seqtk cutN [options] <in.fa>\n\n");
		fprintf(stderr, "Options: -n INT    min size of N tract [%d]\n", cutN_min_N_tract);
		fprintf(stderr, "         -p INT    penalty for a non-N [%d]\n", cutN_nonN_penalty);
		fprintf(stderr, "         -g        print gaps only, no sequence\n\n");
		return 1;
	}
	fp = (strcmp(argv[optind], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[optind], "r");
	if (fp == 0) {
		fprintf(stderr, "[E::%s] failed to open the input file/stream.\n", __func__);
		return 1;
	}
	ks = kseq_init(fp);
	while ((l = kseq_read(ks)) >= 0) {
		int k = 0, begin = 0, end = 0;
		while (find_next_cut(ks, k, &begin, &end) >= 0) {
			if (begin != 0) {
				if (gap_only) printf("%s\t%d\t%d\n", ks->name.s, begin, end);
				else print_seq(stdout, ks, k, begin);
			}
			k = end;
		}
		if (!gap_only) print_seq(stdout, ks, k, l);
	}
	kseq_destroy(ks);
	gzclose(fp);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %ebp
movb $0x1, %al
movl %eax, 0x8(%rsp)
leaq 0x4b74(%rip), %r14      # 0x9a12
leaq 0x95bb(%rip), %r13      # 0xe460
movq 0x912c(%rip), %r12      # 0xdfd8
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2240
testl %eax, %eax
js 0x4ef2
movq %r13, %r15
cmpl $0x6e, %eax
je 0x4ed1
cmpl $0x70, %eax
jne 0x4edf
leaq 0x9593(%rip), %r15      # 0xe464
movq (%r12), %rdi
callq 0x2250
movl %eax, (%r15)
jmp 0x4eac
cmpl $0x67, %eax
jne 0x515a
movl $0x0, 0x8(%rsp)
jmp 0x4eac
movq 0x90d7(%rip), %rax      # 0xdfd0
movslq (%rax), %rax
cmpl %ebp, %eax
je 0x50cc
movq (%rbx,%rax,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x4f17
cmpb $0x0, 0x1(%rdi)
je 0x50aa
leaq 0x428a(%rip), %rsi      # 0x91a8
callq 0x2220
testq %rax, %rax
je 0x513b
movq %rax, 0x10(%rsp)
movq %rax, %rdi
callq 0x3102
movq %rax, %r14
leaq 0x922d(%rip), %r15      # 0xe170
pushq $-0x1
popq %rbx
pushq $0x1
popq %r13
movq %r14, %rdi
callq 0x312e
testl %eax, %eax
js 0x5091
movl %eax, 0xc(%rsp)
movq 0x30(%r14), %rbp
xorl %r12d, %r12d
movl %r12d, %edx
xorl %eax, %eax
subl 0x94f4(%rip), %eax      # 0xe464
movl 0x94ea(%rip), %esi      # 0xe460
movslq %r12d, %rcx
cmpq %rcx, %rbp
jbe 0x506b
movq 0x40(%r14), %r8
movsbq (%r8,%rcx), %rdi
cmpb $0xf, (%rdi,%r15)
jne 0x501c
xorl %r9d, %r9d
movl %ebx, %edi
movl %ebx, %r10d
cmpq %rcx, %rbp
jbe 0x4fcc
testl %r9d, %r9d
js 0x4fcc
movsbq (%r8,%rcx), %r11
cmpb $0xf, (%r11,%r15)
movl %r13d, %r11d
je 0x4fba
movl %eax, %r11d
addl %r11d, %r9d
cmpl %r10d, %r9d
cmovgl %ecx, %edi
cmovgl %r9d, %r10d
incq %rcx
jmp 0x4f9e
xorl %r9d, %r9d
movl %edi, %r10d
movl %ebx, %ecx
movl %ebx, %r11d
movl %r9d, %r12d
orl %r10d, %r12d
js 0x5007
movl %r10d, %r12d
movsbq (%r8,%r12), %r12
cmpb $0xf, (%r12,%r15)
movl %r13d, %r12d
je 0x4ff4
movl %eax, %r12d
addl %r12d, %r9d
cmpl %r11d, %r9d
cmovgl %r10d, %ecx
cmovgl %r9d, %r11d
decl %r10d
jmp 0x4fd7
leal 0x1(%rdi), %r12d
movl %r12d, %r8d
subl %ecx, %r8d
cmpl %esi, %r8d
jl 0x4f76
jmp 0x5024
incl %r12d
jmp 0x4f76
cmpl $-0x1, %edi
jl 0x506b
testl %ecx, %ecx
je 0x4f65
testb $0x1, 0x8(%rsp)
je 0x504f
movq 0x8f81(%rip), %rax      # 0xdfc0
movq (%rax), %rdi
movq %r14, %rsi
callq 0x516c
jmp 0x4f65
movq 0x10(%r14), %rsi
leaq 0x4a7b(%rip), %rdi      # 0x9ad5
movl %ecx, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x20f0
jmp 0x4f65
testb $0x1, 0x8(%rsp)
je 0x4f4a
movq 0x8f43(%rip), %rax      # 0xdfc0
movq (%rax), %rdi
movq %r14, %rsi
movl 0xc(%rsp), %ecx
callq 0x516c
jmp 0x4f4a
movq %r14, %rdi
callq 0x3329
movq 0x10(%rsp), %rdi
callq 0x2040
xorl %eax, %eax
jmp 0x515d
movq 0x8f17(%rip), %rax      # 0xdfc8
movq (%rax), %rdi
callq 0x21b0
leaq 0x40e8(%rip), %rsi      # 0x91a8
movl %eax, %edi
callq 0x20b0
jmp 0x4f23
movq 0x8f25(%rip), %r14      # 0xdff8
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x2140
movq (%r14), %rcx
leaq 0x4930(%rip), %rdi      # 0x9a18
pushq $0x27
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x2260
movq (%r14), %rdi
movl 0x9361(%rip), %edx      # 0xe460
leaq 0x493a(%rip), %rsi      # 0x9a40
xorl %eax, %eax
callq 0x2190
movq (%r14), %rdi
movl 0x934e(%rip), %edx      # 0xe464
leaq 0x4950(%rip), %rsi      # 0x9a6d
xorl %eax, %eax
callq 0x2190
movq (%r14), %rcx
leaq 0x496c(%rip), %rdi      # 0x9a9a
pushq $0x31
popq %rsi
movq %rbx, %rdx
callq 0x2260
jmp 0x515a
movq 0x8eb6(%rip), %rax      # 0xdff8
movq (%rax), %rdi
leaq 0x4255(%rip), %rsi      # 0x93a1
leaq 0x4979(%rip), %rdx      # 0x9acc
xorl %eax, %eax
callq 0x2190
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq