// File: /workspace/github_c_makefile_star2_O1/younix[P]stack/test.c
// Function: main
int
main(int argc, char*argv[])
{
	struct cstack c;
	struct istack i;
	struct fstack f;
	struct dstack d;

	char   cval = '1';
	int    ival = 1;
	float  fval = 1.0;
	double dval = 1.0;

	cstack_init(&c);
	istack_init(&i);
	fstack_init(&f);
	dstack_init(&d);

	for (int p = 0; p < BUFSIZ; p++) {
		if (cstack_push(&c, cval) == false) goto err;
		if (istack_push(&i, ival) == false) goto err;
		if (fstack_push(&f, fval) == false) goto err;
		if (dstack_push(&d, dval) == false) goto err;
	}

	if (cstack_push(&c, cval) == true) goto err;
	if (istack_push(&i, ival) == true) goto err;
	if (fstack_push(&f, fval) == true) goto err;
	if (dstack_push(&d, dval) == true) goto err;

	for (int p = 0; p < BUFSIZ; p++) {
		if (cstack_pop(&c, &cval) == false) goto err;
		if (istack_pop(&i, &ival) == false) goto err;
		if (fstack_pop(&f, &fval) == false) goto err;
		if (dstack_pop(&d, &dval) == false) goto err;

		if (cstack_push(&c, cval) == false) goto err;
		if (istack_push(&i, ival) == false) goto err;
		if (fstack_push(&f, fval) == false) goto err;
		if (dstack_push(&d, dval) == false) goto err;

		if (cstack_pop(&c, NULL) == false) goto err;
		if (istack_pop(&i, NULL) == false) goto err;
		if (fstack_pop(&f, NULL) == false) goto err;
		if (dstack_pop(&d, NULL) == false) goto err;
	}

	if (cstack_pop(&c, NULL) == true) goto err;
	if (istack_pop(&i, NULL) == true) goto err;
	if (fstack_pop(&f, NULL) == true) goto err;
	if (dstack_pop(&d, NULL) == true) goto err;

	return EXIT_SUCCESS;
 err:
	return EXIT_FAILURE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x22038, %rsp          # imm = 0x22038
movb $0x31, 0x7(%rsp)
movl $0x1, 0xc(%rsp)
movl $0x3f800000, 0x8(%rsp)  # imm = 0x3F800000
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsp)
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x40195c
leaq 0xa028(%rsp), %r14
movq %r14, %rdi
callq 0x4019ac
leaq 0x2020(%rsp), %r15
movq %r15, %rdi
callq 0x4019fc
leaq 0x12030(%rsp), %r12
movq %r12, %rdi
callq 0x401a50
movl $0x2000, %r13d          # imm = 0x2000
movl $0x5, %ebp
movsbl 0x7(%rsp), %esi
movq %rbx, %rdi
callq 0x401968
testb %al, %al
je 0x401754
movl 0xc(%rsp), %esi
movq %r14, %rdi
callq 0x4019b8
testb %al, %al
je 0x401754
movss 0x8(%rsp), %xmm0
movq %r15, %rdi
callq 0x401a08
testb %al, %al
je 0x401754
movsd 0x10(%rsp), %xmm0
movq %r12, %rdi
callq 0x401a5c
testb %al, %al
je 0x401754
decl %r13d
jne 0x401705
movl $0x2, %ebp
cmpl $0x5, %ebp
je 0x401942
xorl %ebx, %ebx
cmpl $0x2, %ebp
jne 0x401947
movsbl 0x7(%rsp), %esi
leaq 0x18(%rsp), %rdi
callq 0x401968
testb %al, %al
jne 0x401942
movl 0xc(%rsp), %esi
leaq 0xa028(%rsp), %rdi
callq 0x4019b8
testb %al, %al
jne 0x401942
movss 0x8(%rsp), %xmm0
leaq 0x2020(%rsp), %rdi
callq 0x401a08
testb %al, %al
jne 0x401942
movsd 0x10(%rsp), %xmm0
leaq 0x12030(%rsp), %rdi
callq 0x401a5c
testb %al, %al
jne 0x401942
leaq 0x18(%rsp), %rdi
leaq 0x7(%rsp), %rsi
callq 0x401989
testb %al, %al
je 0x401942
xorl %r14d, %r14d
leaq 0xa028(%rsp), %rbx
leaq 0x2020(%rsp), %r15
leaq 0x12030(%rsp), %r13
leaq 0x18(%rsp), %rbp
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x4019d8
testb %al, %al
je 0x4018f1
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0x401a2a
testb %al, %al
je 0x4018f1
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x401a7e
testb %al, %al
je 0x4018f1
movsbl 0x7(%rsp), %esi
movq %rbp, %rdi
callq 0x401968
testb %al, %al
je 0x4018f1
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0x4019b8
testb %al, %al
je 0x4018f1
movss 0x8(%rsp), %xmm0
movq %r15, %rdi
callq 0x401a08
testb %al, %al
je 0x4018f1
movsd 0x10(%rsp), %xmm0
movq %r13, %rdi
callq 0x401a5c
testb %al, %al
je 0x4018f1
movq %rbp, %rdi
xorl %esi, %esi
callq 0x401989
testb %al, %al
je 0x4018f1
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4019d8
testb %al, %al
je 0x4018f1
movq %r15, %rdi
xorl %esi, %esi
callq 0x401a2a
testb %al, %al
je 0x4018f1
movq %r13, %rdi
xorl %esi, %esi
callq 0x401a7e
testb %al, %al
je 0x4018f1
cmpl $0x1fff, %r14d          # imm = 0x1FFF
je 0x4018f7
setae %r12b
movq %rbp, %rdi
leaq 0x7(%rsp), %rsi
callq 0x401989
incl %r14d
testb %al, %al
jne 0x401808
testb $0x1, %r12b
je 0x401942
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x401989
testb %al, %al
jne 0x401942
leaq 0xa028(%rsp), %rdi
xorl %esi, %esi
callq 0x4019d8
testb %al, %al
jne 0x401942
xorl %ebx, %ebx
leaq 0x2020(%rsp), %rdi
xorl %esi, %esi
callq 0x401a2a
testb %al, %al
jne 0x401942
leaq 0x12030(%rsp), %rdi
xorl %esi, %esi
callq 0x401a7e
testb %al, %al
je 0x401947
movl $0x1, %ebx
movl %ebx, %eax
addq $0x22038, %rsp          # imm = 0x22038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop