// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/kstring.c
// Function: ksplit_core
int ksplit_core(char *s, int delimiter, int *_max, int **_offsets)
{
	int i, n, max, last_char, last_start, *offsets, l;
	n = 0; max = *_max; offsets = *_offsets;
	l = strlen(s);

#define __ksplit_aux do {						\
		if (_offsets) {						\
			s[i] = 0;					\
			if (n == max) {					\
				int *tmp;				\
				max = max? max<<1 : 2;			\
				if ((tmp = (int*)realloc(offsets, sizeof(int) * max))) {  \
					offsets = tmp;			\
				} else	{				\
					free(offsets);			\
					*_offsets = NULL;		\
					return 0;			\
				}					\
			}						\
			offsets[n++] = last_start;			\
		} else ++n;						\
	} while (0)

	for (i = 0, last_char = last_start = 0; i <= l; ++i) {
		if (delimiter == 0) {
			if (isspace((int)((unsigned char) s[i])) || s[i] == 0) {
				if (isgraph(last_char))
                    __ksplit_aux; // the end of a field
			} else {
				if (isspace(last_char) || last_char == 0)
                    last_start = i;
			}
		} else {
			if (s[i] == delimiter || s[i] == 0) {
				if (last_char != 0 && last_char != delimiter) __ksplit_aux; // the end of a field
			} else {
				if (last_char == delimiter || last_char == 0) last_start = i;
			}
		}
		last_char = (int)((unsigned char)s[i]);
	}
	*_max = max; *_offsets = offsets;
	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x41b0
movl %eax, -0x4c(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jg 0xb5ce
cmpl $0x0, -0x14(%rbp)
jne 0xb4af
callq 0x44f0
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq -0x2c(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0xb3b3
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xb482
callq 0x44f0
movq (%rax), %rax
movslq -0x38(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0xb480
jmp 0xb3d3
cmpq $0x0, -0x28(%rbp)
je 0xb473
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x30(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0xb459
cmpl $0x0, -0x34(%rbp)
je 0xb402
movl -0x34(%rbp), %eax
shll %eax
movl %eax, -0x64(%rbp)
jmp 0xb40c
movl $0x2, %eax
movl %eax, -0x64(%rbp)
jmp 0xb40c
movl -0x64(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x48(%rbp), %rdi
movslq -0x34(%rbp), %rsi
shlq $0x2, %rsi
callq 0x4820
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0xb437
movq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0xb457
movq -0x48(%rbp), %rdi
callq 0x45a0
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xb5e8
jmp 0xb459
movl -0x3c(%rbp), %edx
movq -0x48(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xb47c
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xb47e
jmp 0xb480
jmp 0xb4aa
callq 0x44f0
movq (%rax), %rax
movslq -0x38(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0xb4a2
cmpl $0x0, -0x38(%rbp)
jne 0xb4a8
movl -0x2c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0xb4aa
jmp 0xb5b1
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl -0x14(%rbp), %eax
je 0xb4d5
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xb599
cmpl $0x0, -0x38(%rbp)
je 0xb597
movl -0x38(%rbp), %eax
cmpl -0x14(%rbp), %eax
je 0xb597
jmp 0xb4ed
cmpq $0x0, -0x28(%rbp)
je 0xb58a
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x30(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0xb570
cmpl $0x0, -0x34(%rbp)
je 0xb51c
movl -0x34(%rbp), %eax
shll %eax
movl %eax, -0x68(%rbp)
jmp 0xb526
movl $0x2, %eax
movl %eax, -0x68(%rbp)
jmp 0xb526
movl -0x68(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x48(%rbp), %rdi
movslq -0x34(%rbp), %rsi
shlq $0x2, %rsi
callq 0x4820
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
je 0xb551
movq -0x60(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0xb56e
movq -0x48(%rbp), %rdi
callq 0x45a0
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xb5e8
jmp 0xb570
movl -0x3c(%rbp), %edx
movq -0x48(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xb593
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xb595
jmp 0xb597
jmp 0xb5af
movl -0x38(%rbp), %eax
cmpl -0x14(%rbp), %eax
je 0xb5a7
cmpl $0x0, -0x38(%rbp)
jne 0xb5ad
movl -0x2c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0xb5af
jmp 0xb5b1
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xb363
movl -0x34(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)