// File: /workspace/github_cpp_makefile_star2_O3/ksabry[P]bfbrute/src/DataCache.h
// Function: DataCache<32ul, 12ul>::AddComposite(AlignedData<32ul>*, AlignedData<32ul>*, char*, char*, unsigned int, unsigned int)
void AddComposite(
		AlignedData<data_size>* leftData, AlignedData<data_size>* rightData, 
		char * leftProgram, char * rightProgram, 
		unsigned leftProgramSize, unsigned rightProgramSize)
	{
		//char leftDataIndex = leftData[0] - startDataIndex;
		//char rightDataIndex = rightData[0] - startDataIndex;

		currentDataIdx = leftData->idx + rightData->idx;
		if (currentDataIdx < lowDataIdx || currentDataIdx >= highDataIdx)
			return;

		if (leftData->idx > 0)
		{
			for (uint8_t rightI = data_size - leftData->idx; rightI < data_size; rightI++)
				if (rightData->data[rightI] != 0)
					return;
			memcpy(currentData, leftData->data, data_size);
			for (uint8_t rightI = 0; rightI < data_size - leftData->idx; rightI++)
				currentData[rightI + leftData->idx] += rightData->data[rightI];
		}
		else
		{
			for (uint8_t i = 0; i < -leftData->idx; i++)
				if (rightData->data[i] != 0)
					return;
			memcpy(currentData, leftData->data, data_size);
			for (uint8_t rightI = -leftData->idx; rightI < data_size; rightI++)
				currentData[rightI + leftData->idx] += rightData->data[rightI];
		}

		memcpy(currentProgram, leftProgram, leftProgramSize);
		memcpy(currentProgram + leftProgramSize, rightProgram, rightProgramSize);
		
		currentDataStart = Min(leftData->start, rightData->start + leftData->idx);
		currentDataEnd = Max(leftData->end, rightData->end + leftData->idx);

		if (currentDataStart > 10000 || currentDataEnd > 10000)
		{
			volatile int x = 0;
		}

		AddData();
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movl 0x40(%rsp), %ebp
movq 0x20(%rsi), %rax
movq 0x20(%rdx), %rdx
addq %rax, %rdx
movq %rdx, 0x1c0(%rdi)
cmpq 0x8(%rdi), %rdx
jl 0x4792
movq %rdi, %rbx
cmpq 0x10(%rdi), %rdx
jge 0x4792
movq %r8, %r12
movq %rsi, %r14
testq %rax, %rax
jle 0x469f
movb $0x20, %dl
subb %al, %dl
cmpb $0x1f, %dl
ja 0x4646
movzbl %dl, %eax
incq %rax
cmpb $0x0, -0x1(%r15,%rax)
jne 0x4792
movq %rax, %rdx
incq %rdx
cmpb $0x20, %al
movq %rdx, %rax
jne 0x462d
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x1b0(%rbx)
movups %xmm0, 0x1a0(%rbx)
movq 0x20(%r14), %rax
cmpq $0x20, %rax
je 0x4702
leaq 0x1a0(%rbx), %rdx
movb $0x1, %dil
xorl %esi, %esi
movb (%r15,%rsi), %r8b
addq %rsi, %rax
addb %r8b, (%rdx,%rax)
movzbl %dil, %esi
movq 0x20(%r14), %rax
movl $0x20, %r8d
subq %rax, %r8
movl %esi, %edi
incb %dil
cmpq %rsi, %r8
ja 0x4677
jmp 0x4702
jns 0x46bf
negq %rax
movb $0x1, %dl
xorl %esi, %esi
cmpb $0x0, (%r15,%rsi)
jne 0x4792
movzbl %dl, %esi
movl %esi, %edx
incb %dl
cmpq %rax, %rsi
jb 0x46a8
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x1b0(%rbx)
movups %xmm0, 0x1a0(%rbx)
xorl %edx, %edx
subb 0x20(%r14), %dl
cmpb $0x1f, %dl
ja 0x4702
leaq 0x1a0(%rbx), %rax
movzbl %dl, %edx
movb (%r15,%rdx), %sil
movq 0x20(%r14), %rdi
addq %rax, %rdi
addb %sil, (%rdx,%rdi)
incq %rdx
cmpb $0x20, %dl
jne 0x46eb
leaq 0x1d8(%rbx), %rdi
movl %r9d, %r13d
movq %rcx, %rsi
movq %r13, %rdx
callq 0x2190
leaq (%rbx,%r13), %rdi
addq $0x1d8, %rdi            # imm = 0x1D8
movl %ebp, %edx
movq %r12, %rsi
callq 0x2190
movq 0x20(%r14), %rax
movq 0x28(%r14), %rcx
movq 0x28(%r15), %rdx
addq %rax, %rdx
cmpq %rdx, %rcx
cmovlq %rcx, %rdx
movq %rdx, 0x1c8(%rbx)
addq 0x30(%r15), %rax
movq 0x30(%r14), %rcx
cmpq %rax, %rcx
cmovgq %rcx, %rax
movq %rax, 0x1d0(%rbx)
movl $0x2711, %ecx           # imm = 0x2711
cmpq %rcx, %rdx
setl %dl
cmpq %rcx, %rax
setl %al
testb %al, %dl
jne 0x477c
movl $0x0, 0x4(%rsp)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3c6a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop