// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/kstring.c
// Function: kstrtok
char *kstrtok(const char *str, const char *sep_in, ks_tokaux_t *aux)
{
	const unsigned char *p, *start, *sep = (unsigned char *) sep_in;
	if (sep) { // set up the table
		if (str == 0 && aux->finished) return 0; // no need to set up if we have finished
		aux->finished = 0;
		if (sep[0] && sep[1]) {
			aux->sep = -1;
			aux->tab[0] = aux->tab[1] = aux->tab[2] = aux->tab[3] = 0;
			for (p = sep; *p; ++p) aux->tab[*p>>6] |= 1ull<<(*p&0x3f);
		} else aux->sep = sep[0];
	}
	if (aux->finished) return 0;
	else if (str) start = (unsigned char *) str, aux->finished = 0;
	else start = (unsigned char *) aux->p + 1;
	if (aux->sep < 0) {
		for (p = start; *p; ++p)
			if (aux->tab[*p>>6]>>(*p&0x3f)&1) break;
	} else {
		// Using strchr is fast for next token, but slower for
		// last token due to extra pass from strlen.  Overall
		// on a VCF parse this func was 146% faster with // strchr.
		// Equiv to:
		// for (p = start; *p; ++p) if (*p == aux->sep) break;

		// NB: We could use strchrnul() here from glibc if detected,
		// which is ~40% faster again, but it's not so portable.
		// i.e.   p = (uint8_t *)strchrnul((char *)start, aux->sep);
		uint8_t *p2 = (uint8_t *)strchr((char *)start, aux->sep);
		p = p2 ? p2 : start + strlen((char *)start);
	}
	aux->p = (const char *) p; // end of token
	if (*p == 0) aux->finished = 1; // no more tokens
	return (char*)start;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xb1eb
cmpq $0x0, -0x10(%rbp)
jne 0xb125
movq -0x20(%rbp), %rax
cmpl $0x0, 0x24(%rax)
je 0xb125
movq $0x0, -0x8(%rbp)
jmp 0xb304
movq -0x20(%rbp), %rax
movl $0x0, 0x24(%rax)
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0xb1db
movq -0x38(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0xb1db
movq -0x20(%rbp), %rax
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0xb1d9
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
andl $0x3f, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movzbl (%rcx), %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb193
jmp 0xb1e9
movq -0x38(%rbp), %rax
movzbl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x20(%rax)
jmp 0xb1eb
movq -0x20(%rbp), %rax
cmpl $0x0, 0x24(%rax)
je 0xb202
movq $0x0, -0x8(%rbp)
jmp 0xb304
cmpq $0x0, -0x10(%rbp)
je 0xb21e
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, 0x24(%rax)
jmp 0xb22e
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xb230
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jge 0xb28d
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0xb28b
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movzbl (%rcx), %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq -0x28(%rbp), %rcx
movzbl (%rcx), %ecx
andl $0x3f, %ecx
movl %ecx, %ecx
shrq %cl, %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0xb27b
jmp 0xb28b
jmp 0xb27d
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb242
jmp 0xb2d9
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x20(%rax), %esi
callq 0x4170
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xb2b2
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0xb2d1
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, %rcx
movq -0x50(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xb2fc
movq -0x20(%rbp), %rax
movl $0x1, 0x24(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nop