// File: /workspace/github_c_makefile_star2_O2/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 0x46f(%rip), %rbx       # 0x306f
movq %rbx, %rdi
callq 0x1030
leaq 0x77c(%rip), %rdi       # 0x338b
callq 0x1030
movq %rbx, %rdi
callq 0x1030
leaq -0x505(%rip), %rdi      # 0x271e
movq 0x338e(%rip), %rsi      # 0x5fb8
callq 0x2030
testq %rax, %rax
je 0x2d67
movq %rax, %rbx
pushq $0xd
popq %rbp
pushq $0x32
popq %r13
movq %rsp, %r14
leaq 0x755(%rip), %r15       # 0x33a1
leaq 0x76c(%rip), %r12       # 0x33bf
subq $0x1, %rbp
jb 0x2c8f
callq 0x10b0
xorl %edx, %edx
divl %r13d
movq %rdx, (%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2255
testl %eax, %eax
je 0x2c80
movq %r12, %rdi
callq 0x1030
jmp 0x2c53
movl (%rsp), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1050
jmp 0x2c53
movq %rbx, %rdi
callq 0x21af
leaq 0x73c(%rip), %rdi       # 0x33da
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
pushq $0x1
popq %rbp
leaq 0x766(%rip), %r14       # 0x3417
leaq 0x73d(%rip), %r15       # 0x33f5
movq %rbx, %rdi
callq 0x21af
movq %rbx, %rdi
testq %rax, %rax
je 0x2cfd
callq 0x21b9
testq %rax, %rax
je 0x2ced
movq %rax, %r12
movl (%rax), %edx
movq %r15, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
movq %r12, %rdi
callq 0x10c0
jmp 0x2cf9
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
incl %ebp
jmp 0x2cb8
callq 0x21af
leaq 0x6d1(%rip), %r14       # 0x33da
movq %r14, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x89a(%rip), %rdi       # 0x35b6
callq 0x1030
movq %rbx, %rdi
callq 0x20ed
movq %rbx, %rdi
callq 0x21af
movq %r14, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
callq 0x10b0
xorl %edx, %edx
divl %r13d
movq %rsp, %rsi
movq %rdx, (%rsi)
movq %rbx, %rdi
callq 0x2255
testl %eax, %eax
je 0x2d81
leaq 0x65f(%rip), %rdi       # 0x33bf
callq 0x1030
jmp 0x2d92
leaq 0x623(%rip), %rdi       # 0x3391
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1030
movl (%rsp), %esi
leaq 0x6b1(%rip), %rdi       # 0x343c
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x21af
leaq 0x639(%rip), %rdi       # 0x33da
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x819(%rip), %rdi       # 0x35ca
callq 0x1030
movq %rbx, %rdi
callq 0x2176
leaq 0x2aa(%rip), %rbx       # 0x306f
movq %rbx, %rdi
callq 0x1030
leaq 0x5b7(%rip), %rdi       # 0x338b
callq 0x1030
movq %rbx, %rdi
callq 0x1030
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq