// File: /workspace/github_cpp_makefile_star2_O3/Alcaro[P]bridges/arlib/string.cpp
// Function: cstring::crspliti(cstring, unsigned long) const
array<cstring> cstring::crspliti(cstring sep, size_t limit) const
{
	array<cstring> ret;
	const uint8_t * datastart = ptr();
	const uint8_t * data = ptr()+length();
	
	const uint8_t * sepp = sep.ptr();
	size_t sepl = sep.length();
	
	size_t outlen = 0;
	while (outlen < limit)
	{
		if (datastart+sepl > data) break;
		const uint8_t * next = data-sepl;
		while (memcmp(next, sepp, sepl) != 0)
		{
			if (datastart==next) goto done;
			next--;
		}
		size_t len = data - (next+sepl) + (data == ptr()+length() ? 0 : sepl);
		if (len)
			ret.insert(0, arrayview<uint8_t>(next+sepl, len));
		outlen++;
		data = next;
	}
done:
	size_t len = data - datastart + (data == ptr()+length() ? 0 : sepl);
	if (len)
		ret.insert(0, arrayview<uint8_t>(datastart, len));
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, %r14
movq %rdx, %rbp
movq %rsi, %r12
leaq 0x58(%rsp), %rcx
movq %rdx, (%rcx)
movq %r14, 0x8(%rcx)
xorps %xmm0, %xmm0
movq %rdi, 0x8(%rsp)
movups %xmm0, (%rdi)
movzbl 0xf(%rsi), %edx
movl %edx, %eax
xorl $0xf, %eax
testb %dl, %dl
movq (%rsi), %r15
cmovsl 0x8(%rsi), %eax
cmovnsq %rsi, %r15
movq %r14, %rdx
shrq $0x38, %rdx
xorl $0xf, %edx
testq %r14, %r14
cmovnsq %rcx, %rbp
leaq (%rax,%r15), %rbx
cmovnsl %edx, %r14d
movq %r8, 0x38(%rsp)
testq %r8, %r8
je 0x1a3a5
cmpl %eax, %r14d
ja 0x1a3a5
leaq (%r15,%r14), %rax
movq %rax, 0x28(%rsp)
movq %r14, %rax
negq %rax
movq %rax, 0x30(%rsp)
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movq 0x30(%rsp), %rax
leaq (%rbx,%rax), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x3380
testl %eax, %eax
je 0x1a300
cmpq %r15, %r13
je 0x1a3a5
decq %r13
jmp 0x1a2e0
leaq (%r14,%r13), %rsi
movq %rbx, %rax
subq %rsi, %rax
movzbl 0xf(%r12), %ecx
movl %ecx, %edx
xorl $0xf, %edx
testb %cl, %cl
movq (%r12), %rcx
cmovsl 0x8(%r12), %edx
cmovnsq %r12, %rcx
addq %rcx, %rdx
cmpq %rdx, %rbx
movl $0x0, %edx
cmovneq %r14, %rdx
addq %rax, %rdx
je 0x1a386
leaq 0x48(%rsp), %rdi
xorl %ecx, %ecx
callq 0x5990
movups 0x48(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x8(%rsp), %rbx
movq 0x8(%rbx), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x1285c
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
leaq 0x10(%rsi), %rdi
shlq $0x4, %rdx
addq $-0x10, %rdx
callq 0x3600
movq (%rbx), %rax
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%rax)
movq 0x40(%rsp), %rax
incq %rax
cmpq 0x38(%rsp), %rax
jae 0x1a3a8
movq %r13, %rbx
cmpq %r13, 0x28(%rsp)
jbe 0x1a2d2
jmp 0x1a3a8
movq %rbx, %r13
movq %r13, %rax
subq %r15, %rax
movzbl 0xf(%r12), %ecx
movl %ecx, %esi
xorl $0xf, %esi
testb %cl, %cl
movq (%r12), %rcx
cmovsl 0x8(%r12), %esi
cmovnsq %r12, %rcx
addq %rcx, %rsi
xorl %edx, %edx
cmpq %rsi, %r13
cmovneq %r14, %rdx
addq %rax, %rdx
movq 0x8(%rsp), %rbx
je 0x1a42c
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x5990
movups (%r14), %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x8(%rbx), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x1285c
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
leaq 0x10(%rsi), %rdi
shlq $0x4, %rdx
addq $-0x10, %rdx
callq 0x3600
movq (%rbx), %rax
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%rax)
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq