// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rsi, %r15
movl %edi, %ebp
leaq 0x590f(%rip), %rdx      # 0xba02
callq 0x2240
testl %eax, %eax
js 0x615b
xorl %ebx, %ebx
leaq 0x58fd(%rip), %r14      # 0xba02
movq 0x9ecc(%rip), %r13      # 0xffd8
cmpl $0x67, %eax
je 0x613c
leaq 0xa348(%rip), %r12      # 0x10460
cmpl $0x6e, %eax
je 0x612d
cmpl $0x70, %eax
jne 0x63c5
leaq 0xa337(%rip), %r12      # 0x10464
movq (%r13), %rdi
callq 0x2250
movl %eax, (%r12)
jmp 0x6141
movl $0x1, %ebx
movl %ebp, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2240
testl %eax, %eax
jns 0x610c
testl %ebx, %ebx
sete 0xb(%rsp)
jmp 0x6160
movb $0x1, 0xb(%rsp)
movq 0x9e69(%rip), %rax      # 0xffd0
movslq (%rax), %rax
cmpl %ebp, %eax
je 0x63b9
movq (%r15,%rax,8), %r14
leaq 0x6231(%rip), %rsi      # 0xc3ae
movq %r14, %rdi
callq 0x2170
testl %eax, %eax
je 0x619a
leaq 0x5008(%rip), %rsi      # 0xb198
movq %r14, %rdi
callq 0x2220
jmp 0x61b7
movq 0x9e27(%rip), %rax      # 0xffc8
movq (%rax), %rdi
callq 0x21b0
leaq 0x4fe8(%rip), %rsi      # 0xb198
movl %eax, %edi
callq 0x20b0
testq %rax, %rax
je 0x63c0
movq %rax, 0x18(%rsp)
movq %rax, %rdi
callq 0x3e57
movq %rax, %rbx
movq %rax, %rdi
callq 0x3ea1
testl %eax, %eax
js 0x63a3
leaq 0x9f89(%rip), %rbp      # 0x10170
movq %rbx, 0x20(%rsp)
movl %eax, 0x10(%rsp)
xorl %r12d, %r12d
xorl %r14d, %r14d
movl %r14d, %edx
movq 0x30(%rbx), %rax
movslq %r14d, %r8
cmpq %r8, %rax
jbe 0x6326
xorl %r13d, %r13d
subl 0xa251(%rip), %r13d     # 0x10464
movq 0x40(%rbx), %rsi
movl 0xa243(%rip), %edi      # 0x10460
movl %edx, 0xc(%rsp)
movl %edx, 0x14(%rsp)
movsbq (%rsi,%r8), %rcx
cmpb $0xf, (%rcx,%rbp)
jne 0x62e4
movslq %edx, %r15
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
cmpq %r15, %rax
jbe 0x6286
incq %r15
xorl %ebx, %ebx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %edx, %r8d
movsbq -0x1(%rsi,%r15), %rcx
cmpb $0xf, (%rcx,%rbp)
movl $0x1, %ecx
je 0x626a
movl %r13d, %ecx
addl %ecx, %ebx
cmpl %r14d, %ebx
cmovgl %r8d, %r11d
cmovgl %ebx, %r14d
cmpq %r15, %rax
jbe 0x6286
incq %r15
incl %r8d
testl %ebx, %ebx
jns 0x6256
testl %r11d, %r11d
js 0x62cb
xorl %r8d, %r8d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl %r11d, %r14d
movl %r14d, %ecx
movsbq (%rsi,%rcx), %rcx
cmpb $0xf, (%rcx,%rbp)
movl $0x1, %ecx
je 0x62b2
movl %r13d, %ecx
addl %ecx, %r8d
cmpl %ebx, %r8d
cmovgl %r14d, %r10d
cmovgl %r8d, %ebx
decl %r14d
movl %r8d, %ecx
orl %r14d, %ecx
jns 0x629c
incl %r11d
movl %r11d, %r8d
subl %r10d, %r8d
cmpl %edi, %r8d
jge 0x62e8
movl %r12d, %r10d
movl %r11d, %edx
movl %r9d, %r11d
jmp 0x62f3
incl %edx
jmp 0x62f8
movl %r11d, 0xc(%rsp)
movl %r10d, %r12d
movl %r11d, %r9d
cmpl %edi, %r8d
jge 0x630d
movslq %edx, %r8
cmpq %r8, %rax
ja 0x6225
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movl %r12d, %r10d
testl %r11d, %r11d
setns %al
movl %r10d, %r12d
movq 0x20(%rsp), %rbx
movl 0x14(%rsp), %edx
movl 0xc(%rsp), %r14d
jmp 0x632b
xorl %eax, %eax
movl %edx, %r14d
testb %al, %al
je 0x6376
testl %r12d, %r12d
je 0x61f6
cmpb $0x0, 0xb(%rsp)
je 0x6359
movq 0x9c7a(%rip), %rax      # 0xffc0
movq (%rax), %rdi
movq %rbx, %rsi
movl %r12d, %ecx
callq 0x63d9
jmp 0x61f6
movq 0x10(%rbx), %rsi
leaq 0x5761(%rip), %rdi      # 0xbac5
movl %r12d, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x20f0
jmp 0x61f6
cmpb $0x0, 0xb(%rsp)
je 0x6393
movq 0x9c3c(%rip), %rax      # 0xffc0
movq (%rax), %rdi
movq %rbx, %rsi
movl 0x10(%rsp), %ecx
callq 0x63d9
movq %rbx, %rdi
callq 0x3ea1
testl %eax, %eax
jns 0x61ec
movq %rbx, %rdi
callq 0x4229
movq 0x18(%rsp), %rdi
callq 0x2040
xorl %eax, %eax
jmp 0x63ca
callq 0x27a5
jmp 0x63c5
callq 0x2786
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq