// File: /workspace/github_c_makefile_star2_O1/Enes1313[P]DataStructures/Test/main.c
// Function: testStack
void testStack()
{
	size_t i, x;
	eaDSStack stack;

	puts("********************************************");
	puts("Stack");
	puts("********************************************");

	if (NULL == (stack = eaDSStackInit(intCreateAndCopy, free)))
	{
		puts("stack olusmadi!");
		return;
	}

	for(i = 0; i < 13; i++)
	{
		x = (unsigned int) rand() % 50;

		if(EXIT_SUCCESS == eaDSStackPush(stack, &x))
		{
			printf("Stack'e eleman eklendi : %d \n", (int)x);
		}
		else
		{
			puts("Stack'e eleman eklenemedi!");
		}
	}

	printf("Stack eleman sayisi : %d.\n", (int)eaDSStackGetCount(stack));

	for(i = 0; eaDSStackGetCount(stack); i++)
	{
		void * data = eaDSStackPop(stack);
		if(NULL != data)
		{
			printf("Stack'den %d. eleman alindi : %d\n", (int)i + 1, *(int *)data);
			free(data);
		}
		else
		{
			printf("Stack'den %d. eleman alma basarisiz\n", (int)i + 1);
		}
	}

	printf("Stack eleman sayisi : %d.\n", (int)eaDSStackGetCount(stack));

	printf("Stack resetleniyor.\n");
	eaDSStackReset(stack);

	printf("Stack eleman sayisi : %d.\n", (int)eaDSStackGetCount(stack));

	x = (unsigned int) rand() % 50;

	if(EXIT_SUCCESS == eaDSStackPush(stack, &x))
	{
		printf("Stack'e eleman eklendi : %d\n", (int)x);
	}
	else
	{
		puts("Stack'e eleman eklenemedi!");
	}

	printf("Stack eleman sayisi : %d.\n", (int)eaDSStackGetCount(stack));

	printf("Stack siliniyor.\n");
	eaDSStackClear(stack);

	puts("********************************************");
	puts("Stack");
	puts("********************************************");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x1338(%rip), %rbx      # 0x406f
movq %rbx, %rdi
callq 0x1030
leaq 0x1645(%rip), %rdi      # 0x438b
callq 0x1030
movq %rbx, %rdi
callq 0x1030
leaq -0x561(%rip), %rdi      # 0x27f9
movq 0x4257(%rip), %rsi      # 0x6fb8
callq 0x20b0
testq %rax, %rax
je 0x2ec3
movq %rax, %r14
movl $0xd, %ebp
movq %rsp, %r15
leaq 0x1620(%rip), %r12      # 0x43a1
leaq 0x1637(%rip), %r13      # 0x43bf
callq 0x10b0
movl %eax, %ecx
imulq $0x51eb851f, %rcx, %rcx # imm = 0x51EB851F
shrq $0x24, %rcx
imull $0x32, %ecx, %ecx
subl %ecx, %eax
movq %rax, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x22e4
testl %eax, %eax
je 0x2dbc
movq %r13, %rdi
callq 0x1030
jmp 0x2dc9
movl (%rsp), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x1050
decq %rbp
jne 0x2d88
movq %r14, %rdi
callq 0x223e
leaq 0x15fd(%rip), %rdi      # 0x43da
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
movq %r14, %rdi
callq 0x223e
testq %rax, %rax
je 0x2e49
movl $0x1, %ebp
leaq 0x1618(%rip), %r15      # 0x4417
leaq 0x15ef(%rip), %r12      # 0x43f5
movq %r14, %rdi
callq 0x2248
testq %rax, %rax
je 0x2e2e
movq %rax, %r13
movl (%rax), %edx
movq %r12, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
movq %r13, %rdi
callq 0x10c0
jmp 0x2e3a
movq %r15, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
movq %r14, %rdi
callq 0x223e
incl %ebp
testq %rax, %rax
jne 0x2e06
movq %r14, %rdi
callq 0x223e
leaq 0x1582(%rip), %r15      # 0x43da
movq %r15, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x174b(%rip), %rdi      # 0x45b6
callq 0x1030
movq %r14, %rdi
callq 0x217a
movq %r14, %rdi
callq 0x223e
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
movq %rsp, %rsi
movq %rax, (%rsi)
movq %r14, %rdi
callq 0x22e4
testl %eax, %eax
je 0x2ecc
leaq 0x1503(%rip), %rdi      # 0x43bf
callq 0x1030
jmp 0x2edd
leaq 0x14c7(%rip), %rbx      # 0x4391
jmp 0x2f1d
movl (%rsp), %esi
leaq 0x1566(%rip), %rdi      # 0x443c
xorl %eax, %eax
callq 0x1050
movq %r14, %rdi
callq 0x223e
leaq 0x14ee(%rip), %rdi      # 0x43da
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x16ce(%rip), %rdi      # 0x45ca
callq 0x1030
movq %r14, %rdi
callq 0x2205
movq %rbx, %rdi
callq 0x1030
leaq 0x1473(%rip), %rdi      # 0x438b
callq 0x1030
movq %rbx, %rdi
callq 0x1030
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq