// File: ksabry[P]bfbrute/src/ProgramIterator.h
// Function: ProgramIterator<400ul, 32ul, 12ul, 32ul>::NextSingleIterator()
bool NextSingleIterator()
	{
		while (iterators[iteratorIdx].Next())
		{
#if defined INITIAL_ZERO || defined INITIAL_DATA_SYMMETRIC
			// Check that the first iterator has a right delta
			if (iteratorIdx <= firstIteratorWithNonZeroDataDelta)
			{
				int_fast32_t dataDelta = iterators[iteratorIdx].DataDelta();
				if (dataDelta < 0)
				{
					continue;
				}
				else if (dataDelta > 0)
				{
					firstIteratorWithNonZeroDataDelta = iteratorIdx;
				}
				else
				{
					firstIteratorWithNonZeroDataDelta = iteratorIdx + 1;
				}
			}
#endif

#ifdef INITIAL_ZERO
			// Do not permit guaranteed 0 after initial iterator or meaningless movements at the beginning
			auto& data = iterators[0].Data();
			if (iteratorIdx == 0 && (data.data[data.idx + cache_data_size / 2] == 0 || data.data[cache_data_size / 2] == 0))
			{
				continue;
			}
#endif

			// Remove patterns equivalent to [+]
			// Note that while [+*] and [-*] are not necessarily equivalent in behavior to [+], the cases in which they are not equivalent are always infinite loops and so can be safely pruned
			if (
				iteratorIdx > 0
				&& brackets[iteratorIdx - 1].bracket == Bracket::LEFT
				&& brackets[iteratorIdx].bracket == Bracket::RIGHT
				&&
				(
					// Do not permit [-*] with any amount of minuses
					iterators[iteratorIdx].Data().data[cache_data_size / 2] == 256 - iteratorSizes[iteratorIdx]
					// Do not permit [+*] with more than 1 plus
					|| iteratorSizes[iteratorIdx] > 1 && iterators[iteratorIdx].Data().data[cache_data_size / 2] == iteratorSizes[iteratorIdx]
				)
			)
			{
				continue;
			}

			return true;
		}
		return false;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
imulq $0x1e8, 0x4238(%rax), %rax # imm = 0x1E8
addq %rax, %rdi
callq 0x105a0
testb $0x1, %al
jne 0x103ce
jmp 0x10584
movq -0x28(%rbp), %rcx
movq 0x4238(%rcx), %rax
cmpq 0x4240(%rcx), %rax
jg 0x10445
movq -0x28(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
imulq $0x1e8, 0x4238(%rax), %rax # imm = 0x1E8
addq %rax, %rdi
callq 0x10610
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0x10410
jmp 0x103a4
cmpq $0x0, -0x18(%rbp)
jle 0x1042b
movq -0x28(%rbp), %rax
movq 0x4238(%rax), %rcx
movq %rcx, 0x4240(%rax)
jmp 0x10441
movq -0x28(%rbp), %rax
movq 0x4238(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x4240(%rax)
jmp 0x10443
jmp 0x10445
movq -0x28(%rbp), %rdi
addq $0x128, %rdi            # imm = 0x128
callq 0x10630
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x20(%rbp)
cmpq $0x0, 0x4238(%rax)
jne 0x10492
movq -0x20(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x20(%rcx), %rcx
movzbl 0x10(%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x1048d
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x0, %eax
jne 0x10492
jmp 0x103a4
movq -0x28(%rbp), %rax
cmpq $0x0, 0x4238(%rax)
jle 0x1057e
movq -0x28(%rbp), %rcx
movq %rcx, %rax
addq $0x3e30, %rax           # imm = 0x3E30
movq 0x4238(%rcx), %rcx
subq $0x1, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x1057e
movq -0x28(%rbp), %rcx
movq %rcx, %rax
addq $0x3e30, %rax           # imm = 0x3E30
movq 0x4238(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0x1057e
movq -0x28(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
imulq $0x1e8, 0x4238(%rax), %rax # imm = 0x1E8
addq %rax, %rdi
callq 0x10630
movq -0x28(%rbp), %rdx
movzbl 0x10(%rax), %eax
movq 0x4238(%rdx), %rsi
movl $0x100, %ecx            # imm = 0x100
subq 0x28(%rdx,%rsi,8), %rcx
cmpq %rcx, %rax
je 0x10579
movq -0x28(%rbp), %rax
movq 0x4238(%rax), %rcx
cmpq $0x1, 0x28(%rax,%rcx,8)
jle 0x1057e
movq -0x28(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
imulq $0x1e8, 0x4238(%rax), %rax # imm = 0x1E8
addq %rax, %rdi
callq 0x10630
movq -0x28(%rbp), %rcx
movzbl 0x10(%rax), %eax
movq 0x4238(%rcx), %rdx
cmpq 0x28(%rcx,%rdx,8), %rax
jne 0x1057e
jmp 0x103a4
movb $0x1, -0x1(%rbp)
jmp 0x10588
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)