// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
leaq 0x1210(%rip), %rdi      # 0x506f
callq 0x1030
leaq 0x12cc(%rip), %rdi      # 0x5137
callq 0x1030
leaq 0x11f8(%rip), %rdi      # 0x506f
callq 0x1030
leaq -0x48(%rbp), %rdi
leaq -0x97(%rip), %rsi       # 0x3df0
leaq -0x6e(%rip), %rdx       # 0x3e20
movq 0x4123(%rip), %rcx      # 0x7fb8
callq 0x1a60
movl %eax, %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jne 0x3eb6
leaq 0x1299(%rip), %rdi      # 0x5145
callq 0x1030
jmp 0x41c4
movq $0x0, -0x8(%rbp)
cmpq $0xd, -0x8(%rbp)
jae 0x3f20
callq 0x10c0
movl $0x32, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movq %rax, -0x10(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x1f00
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3f04
movq -0x10(%rbp), %rax
movl %eax, %esi
leaq 0x1261(%rip), %rdi      # 0x515c
movb $0x0, %al
callq 0x1050
jmp 0x3f10
leaq 0x1276(%rip), %rdi      # 0x5181
callq 0x1030
jmp 0x3f12
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x3ebe
movq $0x32, -0x10(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x10(%rbp), %rsi
movl $0x2, %edx
callq 0x2010
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3f58
movq -0x10(%rbp), %rax
movl %eax, %esi
leaq 0x1254(%rip), %rdi      # 0x51a3
movb $0x0, %al
callq 0x1050
jmp 0x3f64
leaq 0x1275(%rip), %rdi      # 0x51d4
callq 0x1030
movq $0x33, -0x10(%rbp)
movq $0xa, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl %eax, %esi
leaq 0x1282(%rip), %rdi      # 0x5203
movb $0x0, %al
callq 0x1050
leaq -0x48(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x21a0
leaq 0x1288(%rip), %rdi      # 0x5224
movb $0x0, %al
callq 0x1050
leaq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x24c0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1ec0
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0x4041
movq -0x8(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x26c0
movq %rax, -0x50(%rbp)
xorl %eax, %eax
cmpq -0x50(%rbp), %rax
je 0x4017
movq -0x8(%rbp), %rax
movl %eax, %esi
addl $0x1, %esi
movq -0x50(%rbp), %rax
movl (%rax), %edx
leaq 0x1245(%rip), %rdi      # 0x524a
movb $0x0, %al
callq 0x1050
movq -0x50(%rbp), %rdi
callq 0x10d0
jmp 0x402e
movq -0x8(%rbp), %rax
movl %eax, %esi
addl $0x1, %esi
leaq 0x124c(%rip), %rdi      # 0x5273
movb $0x0, %al
callq 0x1050
jmp 0x4030
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x3fb9
leaq 0x1257(%rip), %rdi      # 0x529f
movb $0x0, %al
callq 0x1050
leaq -0x48(%rbp), %rdi
callq 0x1dc0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1ec0
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0x40dc
movq -0x8(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x2710
movq %rax, -0x58(%rbp)
xorl %eax, %eax
cmpq -0x58(%rbp), %rax
je 0x40b5
movq -0x8(%rbp), %rax
movl %eax, %esi
addl $0x1, %esi
movq -0x58(%rbp), %rax
movl (%rax), %edx
leaq 0x119e(%rip), %rdi      # 0x524a
movb $0x0, %al
callq 0x1050
jmp 0x40cc
movq -0x8(%rbp), %rax
movl %eax, %esi
addl $0x1, %esi
leaq 0x11ae(%rip), %rdi      # 0x5273
movb $0x0, %al
callq 0x1050
jmp 0x40ce
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x4060
leaq -0x48(%rbp), %rdi
callq 0x1ec0
movl %eax, %esi
leaq 0x11ce(%rip), %rdi      # 0x52bc
movb $0x0, %al
callq 0x1050
leaq 0x11e2(%rip), %rdi      # 0x52de
movb $0x0, %al
callq 0x1050
leaq -0x48(%rbp), %rdi
callq 0x1c40
leaq -0x48(%rbp), %rdi
callq 0x1ec0
movl %eax, %esi
leaq 0x119e(%rip), %rdi      # 0x52bc
movb $0x0, %al
callq 0x1050
callq 0x10c0
movl $0x32, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movq %rax, -0x10(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x1f00
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x4164
movq -0x10(%rbp), %rax
movl %eax, %esi
leaq 0x119f(%rip), %rdi      # 0x52fa
movb $0x0, %al
callq 0x1050
jmp 0x4170
leaq 0x1016(%rip), %rdi      # 0x5181
callq 0x1030
leaq -0x48(%rbp), %rdi
callq 0x1ec0
movl %eax, %esi
leaq 0x113a(%rip), %rdi      # 0x52bc
movb $0x0, %al
callq 0x1050
leaq 0x118e(%rip), %rdi      # 0x531e
movb $0x0, %al
callq 0x1050
leaq -0x48(%rbp), %rdi
callq 0x1d50
leaq 0xec8(%rip), %rdi       # 0x506f
callq 0x1030
leaq 0xf84(%rip), %rdi       # 0x5137
callq 0x1030
leaq 0xeb0(%rip), %rdi       # 0x506f
callq 0x1030
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)