// File: /workspace/github_c_makefile_star2_O3/Enes1313[P]DataStructures/Test/main.c
// Function: testDynamicArray
void testDynamicArray()
{
	size_t i, x;
	eaDSDynamicArray dynamicArray;

	puts("********************************************");
	puts("Dinamik Array");
	puts("********************************************");

	if (EXIT_FAILURE == eaDSDynamicArrayInit(&dynamicArray, intCreateAndCopy, intCompare, free))
	{
		puts("dynamicArray olusmadi!");
		return;
	}

	for(i = 0; i < 13; i++)
	{
		x = (unsigned int) rand() % 50;

		if(EXIT_SUCCESS == eaDSDynamicArrayAdd(&dynamicArray, &x))
		{
			printf("DynamicArray'e eleman eklendi : %d \n", (int)x);
		}
		else
		{
			puts("DynamicArray'e eleman eklenemedi!");
		}
	}

	x = 50;

	if(EXIT_SUCCESS == eaDSDynamicArrayInsert(&dynamicArray, &x, 2))
	{
		printf("DynamicArray'in 3. sirasina eleman eklendi : %d\n", (int)x);
	}
	else
	{
		puts("DynamicArray'in 3. sirasina eleman eklenemedi!");
	}
	
	x = 51;
/*
	if(EXIT_SUCCESS == eaDSDynamicArrayInsert(&dynamicArray, &x, 6))
	{
		printf("DynamicArray'in 6. sirasina eleman eklendi : %d\n", (int)x);
	}
	else
	{
		puts("DynamicArray'in 6. sirasina eleman eklenemedi!");
	}*/

	x = 10;

	printf("DynamicArray'den siliniyor : %d\n", (int)x);
	eaDSDynamicArrayRemove(&dynamicArray, &x);

	printf("DynamicArray'den 2. eleman atiliyor!\n");
	eaDSDynamicArrayRemoveAt(&dynamicArray, 1);

	for(i = 0; i < eaDSDynamicArrayGetCount(&dynamicArray); i++)
	{
		void * data = eaDSDynamicArrayGetFrom(&dynamicArray, i);

		if(NULL != data)
		{
			printf("DynamicArray'den %d. eleman alindi : %d\n", (int)i + 1, *(int *)data);
			free(data);
		}
		else
		{
			printf("DynamicArray'den %d. eleman alma basarisiz\n", (int)i + 1);
		}
	}

	printf("DynamicArray siralaniyor...\n");
	eaDSDynamicArraySort(&dynamicArray);

	for(i = 0; i < eaDSDynamicArrayGetCount(&dynamicArray); i++)
	{
		void * data = eaDSDynamicArrayGetAddressFrom(&dynamicArray, i);

		if(NULL != data)
		{
			printf("DynamicArray'den %d. eleman alindi : %d\n", (int)i + 1, *(int *)data);
		}
		else
		{
			printf("DynamicArray'den %d. eleman alma basarisiz\n", (int)i + 1);
		}
	}

	printf("DynamicArray eleman sayisi : %d.\n", (int)eaDSDynamicArrayGetCount(&dynamicArray));

	printf("DynamicArray resetleniyor.\n");
	eaDSDynamicArrayReset(&dynamicArray);

	printf("DynamicArray eleman sayisi : %d.\n", (int)eaDSDynamicArrayGetCount(&dynamicArray));

	x = (unsigned int) rand() % 50;

	if(EXIT_SUCCESS == eaDSDynamicArrayAdd(&dynamicArray, &x))
	{
		printf("DynamicArray'e eleman eklendi : %d\n", (int)x);
	}
	else
	{
		puts("DynamicArray'e eleman eklenemedi!");
	}

	printf("DynamicArray eleman sayisi : %d.\n", (int)eaDSDynamicArrayGetCount(&dynamicArray));

	printf("DynamicArray siliniyor.\n");
	eaDSDynamicArrayClear(&dynamicArray);

	puts("********************************************");
	puts("Dinamik Array");
	puts("********************************************");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
leaq 0x17b6(%rip), %rbx      # 0x406f
movq %rbx, %rdi
callq 0x1030
leaq 0x186f(%rip), %rdi      # 0x4137
callq 0x1030
movq %rbx, %rdi
callq 0x1030
leaq -0x5f(%rip), %rsi       # 0x287d
leaq -0x52(%rip), %rdx       # 0x2891
movq 0x46ce(%rip), %rcx      # 0x6fb8
leaq 0x10(%rsp), %rdi
callq 0x15cc
cmpl $0x1, %eax
jne 0x2905
leaq 0x1845(%rip), %rbx      # 0x4145
jmp 0x2baf
movl $0xd, %ebp
leaq 0x10(%rsp), %r14
leaq 0x8(%rsp), %r15
leaq 0x1841(%rip), %r12      # 0x415c
leaq 0x185f(%rip), %r13      # 0x4181
callq 0x10b0
movl %eax, %ecx
imulq $0x51eb851f, %rcx, %rcx # imm = 0x51EB851F
shrq $0x24, %rcx
imull $0x32, %ecx, %ecx
subl %ecx, %eax
movq %rax, 0x8(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x1801
testl %eax, %eax
je 0x2957
movq %r13, %rdi
callq 0x1030
jmp 0x2965
movl 0x8(%rsp), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x1050
decq %rbp
jne 0x2922
leaq 0x8(%rsp), %rsi
movq $0x32, (%rsi)
leaq 0x10(%rsp), %rdi
movl $0x2, %edx
callq 0x187c
testl %eax, %eax
je 0x2997
leaq 0x1844(%rip), %rdi      # 0x41d4
callq 0x1030
jmp 0x29a9
movl 0x8(%rsp), %esi
leaq 0x1801(%rip), %rdi      # 0x41a3
xorl %eax, %eax
callq 0x1050
leaq 0x8(%rsp), %r14
movq $0xa, (%r14)
leaq 0x1847(%rip), %rdi      # 0x4203
movl $0xa, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x1922
leaq 0x1b10(%rip), %rdi      # 0x44ef
callq 0x1030
movl $0x1, %esi
movq %r15, %rdi
callq 0x1a92
movq %r15, %rdi
callq 0x17f7
testq %rax, %rax
je 0x2a5d
leaq 0x10(%rsp), %r14
leaq 0x1843(%rip), %r15      # 0x424d
leaq 0x1813(%rip), %r12      # 0x4224
xorl %r13d, %r13d
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b56
incq %r13
testq %rax, %rax
je 0x2a43
movq %rax, %rbp
movl (%rax), %edx
movq %r12, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
movq %rbp, %rdi
callq 0x10c0
jmp 0x2a50
movq %r15, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
movq %r14, %rdi
callq 0x17f7
cmpq %rax, %r13
jb 0x2a14
leaq 0x1ab0(%rip), %rdi      # 0x4514
callq 0x1030
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x178f
movq %r14, %rdi
callq 0x17f7
testq %rax, %rax
je 0x2ad7
leaq 0x10(%rsp), %r14
leaq 0x17be(%rip), %r15      # 0x424d
leaq 0x178e(%rip), %r12      # 0x4224
xorl %r13d, %r13d
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b6c
incq %r13
testq %rax, %rax
je 0x2abd
movl (%rax), %edx
movq %r12, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
jmp 0x2aca
movq %r15, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
movq %r14, %rdi
callq 0x17f7
cmpq %rax, %r13
jb 0x2a99
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x17f7
leaq 0x178e(%rip), %r15      # 0x4279
movq %r15, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x1a32(%rip), %rdi      # 0x4530
callq 0x1030
movq %r14, %rdi
callq 0x16c8
movq %r14, %rdi
callq 0x17f7
movq %r15, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
callq 0x10b0
movl %eax, %ecx
imulq $0x51eb851f, %rcx, %rcx # imm = 0x51EB851F
shrq $0x24, %rcx
imull $0x32, %ecx, %ecx
subl %ecx, %eax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movq %r14, %rdi
callq 0x1801
testl %eax, %eax
je 0x2b58
leaq 0x1630(%rip), %rdi      # 0x4181
callq 0x1030
jmp 0x2b6a
movl 0x8(%rsp), %esi
leaq 0x1738(%rip), %rdi      # 0x429b
xorl %eax, %eax
callq 0x1050
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x17f7
leaq 0x16fb(%rip), %rdi      # 0x4279
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x19bd(%rip), %rdi      # 0x454b
callq 0x1030
movq %r14, %rdi
callq 0x1753
movq %rbx, %rdi
callq 0x1030
leaq 0x158d(%rip), %rdi      # 0x4137
callq 0x1030
movq %rbx, %rdi
callq 0x1030
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq