// File: /workspace/github_c_makefile_star2_O0/Enes1313[P]DataStructures/DS/eaDSCircularBuffer.c
// Function: eaDSCircularBufferGetWhereIsIt
int eaDSCircularBufferGetWhereIsIt(const eaDSCircularBuffer circularBuffer, const void * data, size_t numberOfData, size_t * len)
{
	size_t i;

	if (circularBuffer->Head <= circularBuffer->Tail)
	{
		for (i = circularBuffer->Head; i < circularBuffer->Tail; ++i)
		{
			if (circularBuffer->dataCompare((char *)circularBuffer->Data + i, data, circularBuffer->SizeOfData * numberOfData) == 0)
			{
				*len = i - circularBuffer->Head;

				return EXIT_SUCCESS;
			}
		}
	}
	else
	{
		for (i = circularBuffer->Head; i < circularBuffer->Capacity; ++i)
		{
			if (circularBuffer->dataCompare((char *)circularBuffer->Data + i, data, circularBuffer->SizeOfData * numberOfData) == 0)
			{
				*len = i - circularBuffer->Head;

				return EXIT_SUCCESS;
			}
		}

		for (i = 0; i < circularBuffer->Tail; ++i)
		{
			if (circularBuffer->dataCompare((char *)circularBuffer->Data + i, data, circularBuffer->SizeOfData * numberOfData) == 0)
			{
				*len = i + circularBuffer->Capacity - circularBuffer->Head;

				return EXIT_SUCCESS;
			}
		}
	}

	return EXIT_FAILURE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
ja 0x1883
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x187e
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
addq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rdx
imulq -0x20(%rbp), %rdx
callq *%rax
cmpl $0x0, %eax
jne 0x186e
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
subq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1975
jmp 0x1870
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1816
jmp 0x196e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x18f7
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
addq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rdx
imulq -0x20(%rbp), %rdx
callq *%rax
cmpl $0x0, %eax
jne 0x18e7
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
subq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1975
jmp 0x18e9
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x188f
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x196c
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
addq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rdx
imulq -0x20(%rbp), %rdx
callq *%rax
cmpl $0x0, %eax
jne 0x195c
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
subq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1975
jmp 0x195e
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x18ff
jmp 0x196e
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop