// File: /workspace/github_c_makefile_star2_O2/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), %r14
movq %r14, %rdi
callq 0x401930
leaq 0xa028(%rsp), %r15
movq %r15, %rdi
callq 0x401980
leaq 0x2020(%rsp), %r12
movq %r12, %rdi
callq 0x4019d0
leaq 0x12030(%rsp), %r13
movq %r13, %rdi
callq 0x401a24
movl $0x2001, %ebx           # imm = 0x2001
pushq $0x31
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x40193c
decl %ebx
je 0x401751
testb %al, %al
je 0x40179b
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x40198c
testb %al, %al
je 0x40179b
movq %r12, %rdi
movss 0x968d2(%rip), %xmm0    # 0x498004
callq 0x4019dc
testb %al, %al
je 0x40179b
movq %r13, %rdi
movsd 0x968c2(%rip), %xmm0    # 0x498008
callq 0x401a30
testb %al, %al
jne 0x401702
jmp 0x40179b
testb %al, %al
jne 0x40179b
leaq 0xa028(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x40198c
testb %al, %al
jne 0x40179b
leaq 0x2020(%rsp), %rdi
movss 0x9688b(%rip), %xmm0    # 0x498004
callq 0x4019dc
testb %al, %al
jne 0x40179b
leaq 0x12030(%rsp), %rdi
movsd 0x96876(%rip), %xmm0    # 0x498008
callq 0x401a30
testb %al, %al
je 0x4017b6
pushq $0x1
popq %rax
movl %eax, %r14d
movl %r14d, %eax
addq $0x22038, %rsp          # imm = 0x22038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x2001, %r15d          # imm = 0x2001
leaq 0x18(%rsp), %r14
leaq 0x7(%rsp), %rbx
leaq 0xa028(%rsp), %r12
leaq 0x2020(%rsp), %rbp
leaq 0x12030(%rsp), %r13
decl %r15d
je 0x4018cf
movq %r14, %rdi
movq %rbx, %rsi
callq 0x40195d
testb %al, %al
je 0x40179b
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x4019ac
testb %al, %al
je 0x40179b
movq %rbp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x4019fe
testb %al, %al
je 0x40179b
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x401a52
testb %al, %al
je 0x40179b
movsbl 0x7(%rsp), %esi
movq %r14, %rdi
callq 0x40193c
testb %al, %al
je 0x40179b
movl 0xc(%rsp), %esi
movq %r12, %rdi
callq 0x40198c
testb %al, %al
je 0x40179b
movss 0x8(%rsp), %xmm0
movq %rbp, %rdi
callq 0x4019dc
testb %al, %al
je 0x40179b
movsd 0x10(%rsp), %xmm0
movq %r13, %rdi
callq 0x401a30
testb %al, %al
je 0x40179b
movq %r14, %rdi
xorl %esi, %esi
callq 0x40195d
testb %al, %al
je 0x40179b
movq %r12, %rdi
xorl %esi, %esi
callq 0x4019ac
testb %al, %al
je 0x40179b
movq %rbp, %rdi
xorl %esi, %esi
callq 0x4019fe
testb %al, %al
je 0x40179b
movq %r13, %rdi
xorl %esi, %esi
callq 0x401a52
testb %al, %al
jne 0x4017de
jmp 0x40179b
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x40195d
testb %al, %al
jne 0x40179b
leaq 0xa028(%rsp), %rdi
xorl %esi, %esi
callq 0x4019ac
testb %al, %al
jne 0x40179b
xorl %r14d, %r14d
leaq 0x2020(%rsp), %rdi
xorl %esi, %esi
callq 0x4019fe
testb %al, %al
jne 0x40179b
leaq 0x12030(%rsp), %rdi
xorl %esi, %esi
callq 0x401a52
testb %al, %al
jne 0x40179b
jmp 0x4017a1