// File: /workspace/github_c_makefile_star2_O3/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 0x1292(%rip), %rbx      # 0x406f
movq %rbx, %rdi
callq 0x1030
leaq 0x159f(%rip), %rdi      # 0x438b
callq 0x1030
movq %rbx, %rdi
callq 0x1030
leaq -0x583(%rip), %rdi      # 0x287d
movq 0x41b1(%rip), %rsi      # 0x6fb8
callq 0x211c
testq %rax, %rax
je 0x2f6a
movq %rax, %rbx
movl $0xd, %r13d
movq %rsp, %r14
leaq 0x1579(%rip), %r15      # 0x43a1
leaq 0x1590(%rip), %r12      # 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 %rbx, %rdi
movq %r14, %rsi
callq 0x2359
testl %eax, %eax
je 0x2e63
movq %r12, %rdi
callq 0x1030
jmp 0x2e70
movl (%rsp), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1050
decq %r13
jne 0x2e2f
movq %rbx, %rdi
callq 0x22b3
leaq 0x1556(%rip), %rdi      # 0x43da
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x22b3
testq %rax, %rax
je 0x2ef0
movl $0x1, %ebp
leaq 0x1571(%rip), %r14      # 0x4417
leaq 0x1548(%rip), %r15      # 0x43f5
movq %rbx, %rdi
callq 0x22bd
testq %rax, %rax
je 0x2ed5
movq %rax, %r12
movl (%rax), %edx
movq %r15, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
movq %r12, %rdi
callq 0x10c0
jmp 0x2ee1
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x22b3
incl %ebp
testq %rax, %rax
jne 0x2ead
movq %rbx, %rdi
callq 0x22b3
leaq 0x14db(%rip), %r14      # 0x43da
movq %r14, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x16a4(%rip), %rdi      # 0x45b6
callq 0x1030
movq %rbx, %rdi
callq 0x21e6
movq %rbx, %rdi
callq 0x22b3
movq %r14, %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 %rbx, %rdi
callq 0x2359
testl %eax, %eax
je 0x2f84
leaq 0x145c(%rip), %rdi      # 0x43bf
callq 0x1030
jmp 0x2f95
leaq 0x1420(%rip), %rdi      # 0x4391
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1030
movl (%rsp), %esi
leaq 0x14ae(%rip), %rdi      # 0x443c
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x22b3
leaq 0x1436(%rip), %rdi      # 0x43da
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x1616(%rip), %rdi      # 0x45ca
callq 0x1030
movq %rbx, %rdi
callq 0x2271
leaq 0x10a7(%rip), %rbx      # 0x406f
movq %rbx, %rdi
callq 0x1030
leaq 0x13b4(%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