// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0xc70(%rip), %rdi       # 0x506f
callq 0x1030
leaq 0x104e(%rip), %rdi      # 0x5459
callq 0x1030
leaq 0xc58(%rip), %rdi       # 0x506f
callq 0x1030
leaq -0x633(%rip), %rdi      # 0x3df0
movq 0x3b8e(%rip), %rsi      # 0x7fb8
callq 0x3310
movq %rax, %rcx
movq %rcx, -0x18(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x444e
leaq 0x101b(%rip), %rdi      # 0x545f
callq 0x1030
jmp 0x4634
movq $0x0, -0x8(%rbp)
cmpq $0xd, -0x8(%rbp)
jae 0x44b8
callq 0x10c0
movl $0x32, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x37b0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x449c
movq -0x10(%rbp), %rax
movl %eax, %esi
leaq 0xfdc(%rip), %rdi       # 0x546f
movb $0x0, %al
callq 0x1050
jmp 0x44a8
leaq 0xfea(%rip), %rdi       # 0x548d
callq 0x1030
jmp 0x44aa
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x4456
movq -0x18(%rbp), %rdi
callq 0x3630
movl %eax, %esi
leaq 0xfde(%rip), %rdi       # 0x54a8
movb $0x0, %al
callq 0x1050
movq $0x0, -0x8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3630
cmpq $0x0, %rax
je 0x454c
movq -0x18(%rbp), %rdi
callq 0x3670
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x4525
movq -0x8(%rbp), %rax
movl %eax, %esi
addl $0x1, %esi
movq -0x20(%rbp), %rax
movl (%rax), %edx
leaq 0xfb0(%rip), %rdi       # 0x54c3
movb $0x0, %al
callq 0x1050
movq -0x20(%rbp), %rdi
callq 0x10d0
jmp 0x453c
movq -0x8(%rbp), %rax
movl %eax, %esi
addl $0x1, %esi
leaq 0xfb0(%rip), %rdi       # 0x54e5
movb $0x0, %al
callq 0x1050
jmp 0x453e
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x44d9
movq -0x18(%rbp), %rdi
callq 0x3630
movl %eax, %esi
leaq 0xf4a(%rip), %rdi       # 0x54a8
movb $0x0, %al
callq 0x1050
leaq 0xf9e(%rip), %rdi       # 0x550a
movb $0x0, %al
callq 0x1050
movq -0x18(%rbp), %rdi
callq 0x34b0
movq -0x18(%rbp), %rdi
callq 0x3630
movl %eax, %esi
leaq 0xf1a(%rip), %rdi       # 0x54a8
movb $0x0, %al
callq 0x1050
callq 0x10c0
movl $0x32, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x37b0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x45d4
movq -0x10(%rbp), %rax
movl %eax, %esi
leaq 0xf54(%rip), %rdi       # 0x551f
movb $0x0, %al
callq 0x1050
jmp 0x45e0
leaq 0xeb2(%rip), %rdi       # 0x548d
callq 0x1030
movq -0x18(%rbp), %rdi
callq 0x3630
movl %eax, %esi
leaq 0xeb6(%rip), %rdi       # 0x54a8
movb $0x0, %al
callq 0x1050
leaq 0xf3c(%rip), %rdi       # 0x553c
movb $0x0, %al
callq 0x1050
movq -0x18(%rbp), %rdi
callq 0x35c0
leaq 0xa58(%rip), %rdi       # 0x506f
callq 0x1030
leaq 0xe36(%rip), %rdi       # 0x5459
callq 0x1030
leaq 0xa40(%rip), %rdi       # 0x506f
callq 0x1030
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)