// File: /workspace/github_c_makefile_star2_O2/MikeGray-APH[P]LibLouisAPH/source/outputs/pattern-output.c
// Function: pattern_output_expression
static void pattern_output_expression(const unichar *expr_data, int expr_crs)
{
	int i;

	while(EXPR_TYPE(expr_crs) != PTN_END)
	{
		printf("%s%d", &spaces[space], expr_crs);
		if(expr_crs < 100)
			printf(" ");
		if(expr_crs < 10)
			printf(" ");
		for(i = 0; i < 13 - (30 - space); i++)
			printf(" ");

		switch(EXPR_TYPE(expr_crs))
		{
		case PTN_START:

			printf("START\t%d\t%d\n", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs));
			break;

		case PTN_GROUP:

			printf("(    \t%d\t%d\t-> %d\n", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs), EXPR_DATA_0(expr_crs));
			space--;
			if(space < 0)
				space = 0;
			pattern_output_expression(expr_data, EXPR_DATA_0(expr_crs));
			space++;
			if(space > 30)
				space = 30;
			break;

		case PTN_NOT:

			printf("!    \t%d\t%d\t-> %d\n", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs), EXPR_DATA_0(expr_crs));
			space--;
			if(space < 0)
				space = 0;
			pattern_output_expression(expr_data, EXPR_DATA_0(expr_crs));
			space++;
			if(space > 30)
				space = 30;
			break;

		case PTN_ONE_MORE:

			printf("+    \t%d\t%d\t-> %d\t#%d\n", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs), EXPR_DATA_0(expr_crs), EXPR_DATA_1(expr_crs));
			space--;
			if(space < 0)
				space = 0;
			pattern_output_expression(expr_data, EXPR_DATA_0(expr_crs));
			space++;
			if(space > 30)
				space = 30;
			break;

		case PTN_ZERO_MORE:

			printf("*    \t%d\t%d\t-> %d\t#%d\n", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs), EXPR_DATA_0(expr_crs), EXPR_DATA_1(expr_crs));
			space--;
			if(space < 0)
				space = 0;
			pattern_output_expression(expr_data, EXPR_DATA_0(expr_crs));
			space++;
			if(space > 30)
				space = 30;
			break;

		case PTN_OPTIONAL:

			printf("?    \t%d\t%d\t-> %d\n", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs), EXPR_DATA_0(expr_crs));
			space--;
			if(space < 0)
				space = 0;
			pattern_output_expression(expr_data, EXPR_DATA_0(expr_crs));
			space++;
			if(space > 30)
				space = 30;
			break;

		case PTN_ALTERNATE:

			printf("|    \t%d\t%d\t-> %d\t-> %d\n", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs), EXPR_DATA_0(expr_crs), EXPR_DATA_1(expr_crs));
			space--;
			if(space < 0)
				space = 0;
			pattern_output_expression(expr_data, EXPR_DATA_0(expr_crs));
			pattern_output_expression(expr_data, EXPR_DATA_1(expr_crs));
			space++;
			if(space > 30)
				space = 30;
			break;

		case PTN_ANY:

			printf(".    \t%d\t%d\n", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs));
			break;

		case PTN_ATTRIBUTES:

			printf("%%    \t%d\t%d\t", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs));
			attrs_output(EXPR_DATA_0(expr_crs), EXPR_DATA_1(expr_crs));
			puts("");
			break;

		case PTN_CHARS:

			printf("[]   \t%d\t%d\t", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs));
			for(i = 0; i < EXPR_DATA_0(expr_crs); i++)
				utf16_output_char_escape(stdout, EXPR_CONST_DATA(expr_crs)[i + 1]);
			puts("");
			break;

		case PTN_SUBPATTERN:

			printf("@    \t%d\t%d\t", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs));
			for(i = 0; i < EXPR_DATA_0(expr_crs); i++)
				printf("%c", EXPR_CONST_DATA(expr_crs)[i + 1]);
			puts("");
			break;

		case PTN_END_OF_INPUT:

			printf("^    \t%d\t%d\n", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs));
			break;

		default:

			printf("%d?    \t%d\t%d\n", EXPR_TYPE(expr_crs), EXPR_PRV(expr_crs), EXPR_NXT(expr_crs));
			break;
		}

		expr_crs = EXPR_NXT(expr_crs);
	}

	printf("%s%d", &spaces[space], expr_crs);
	if(expr_crs < 100)
		printf(" ");
	if(expr_crs < 10)
		printf(" ");
	for(i = 0; i < 13 - (30 - space); i++)
		printf(" ");
	printf("END\t%d\t%d\n", EXPR_PRV(expr_crs), EXPR_NXT(expr_crs));
	fflush(stdout);
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %edx
movq %rdi, %rbx
leaq 0x8(%rdi), %rax
movq %rax, 0x8(%rsp)
pushq $0x20
popq %rbp
movq 0x817e(%rip), %r13      # 0x16fd8
movq %rdi, 0x10(%rsp)
movl %edx, %r15d
movzwl (%rbx,%r15,2), %r14d
movslq 0x82e2(%rip), %rsi      # 0x17150
leaq 0x82bb(%rip), %rax      # 0x17130
addq %rax, %rsi
leaq 0x2fa1(%rip), %rdi      # 0x11e20
xorl %eax, %eax
callq 0x10c0
cmpw $-0x1, %r14w
je 0xf1ef
cmpl $0x63, %r15d
jg 0xeeab
movl %ebp, %edi
callq 0x1050
cmpl $0x9, %r15d
jg 0xeeab
movl %ebp, %edi
callq 0x1050
xorl %r14d, %r14d
movl 0x829c(%rip), %eax      # 0x17150
addl $-0x11, %eax
cmpl %eax, %r14d
jge 0xeec8
movl %ebp, %edi
callq 0x1050
incl %r14d
jmp 0xeeae
movzwl (%rbx,%r15,2), %esi
leal -0x1(%rsi), %eax
cmpl $0xb, %eax
ja 0xf1c7
leaq 0x2ea4(%rip), %rcx      # 0x11d84
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
leaq 0x2f26(%rip), %rdi      # 0x11e25
jmp 0xeff3
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
leaq 0x2fcd(%rip), %rdi      # 0x11ee7
jmp 0xeff3
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
movzwl 0x6(%rbx,%r12,2), %ecx
movzwl 0x8(%rbx,%r12,2), %r8d
leaq 0x2f2e(%rip), %rdi      # 0x11e6f
jmp 0xefd4
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
leaq 0x2f71(%rip), %rdi      # 0x11ecd
xorl %eax, %eax
callq 0x10c0
movq 0x8(%rsp), %rax
leaq (%rax,%r12,2), %r14
xorl %r15d, %r15d
movzwl 0x6(%rbx,%r12,2), %eax
cmpq %rax, %r15
jae 0xf1bd
movq (%r13), %rdi
movzwl (%r14,%r15,2), %esi
incq %r15
callq 0xed51
jmp 0xef6f
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
movzwl 0x6(%rbx,%r12,2), %ecx
leaq 0x2e98(%rip), %rdi      # 0x11e45
jmp 0xf039
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
movzwl 0x6(%rbx,%r12,2), %ecx
movzwl 0x8(%rbx,%r12,2), %r8d
leaq 0x2e84(%rip), %rdi      # 0x11e58
xorl %eax, %eax
callq 0x10c0
jmp 0xf040
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
leaq 0x2ebf(%rip), %rdi      # 0x11eb2
xorl %eax, %eax
callq 0x10c0
jmp 0xf1e4
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
movzwl 0x6(%rbx,%r12,2), %ecx
leaq 0x2e17(%rip), %rdi      # 0x11e32
jmp 0xf039
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
movzwl 0x6(%rbx,%r12,2), %ecx
leaq 0x2e4d(%rip), %rdi      # 0x11e86
xorl %eax, %eax
callq 0x10c0
movl 0x810a(%rip), %eax      # 0x17150
cmpl $0x2, %eax
pushq $0x1
popq %rcx
cmovll %ecx, %eax
decl %eax
movl %eax, 0x80f9(%rip)      # 0x17150
movzwl 0x6(%rbx,%r12,2), %esi
movq %rbx, %rdi
callq 0xee34
movl 0x80e5(%rip), %eax      # 0x17150
cmpl $0x1d, %eax
pushq $0x1d
popq %rcx
cmovgel %ecx, %eax
incl %eax
movl %eax, 0x80d4(%rip)      # 0x17150
jmp 0xf1e4
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
movzwl 0x6(%rbx,%r12,2), %ecx
movzwl 0x8(%rbx,%r12,2), %r8d
leaq 0x2df6(%rip), %rdi      # 0x11e99
xorl %eax, %eax
callq 0x10c0
movl 0x80a0(%rip), %eax      # 0x17150
cmpl $0x2, %eax
pushq $0x1
popq %rcx
cmovll %ecx, %eax
decl %eax
movl %eax, 0x808f(%rip)      # 0x17150
movzwl 0x6(%rbx,%r12,2), %esi
movq %rbx, %rdi
callq 0xee34
movzwl 0x8(%rbx,%r12,2), %esi
jmp 0xf05d
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %esi
movzwl 0x4(%rbx,%r12,2), %edx
leaq 0x2ded(%rip), %rdi      # 0x11eda
xorl %eax, %eax
callq 0x10c0
movq 0x8(%rsp), %rax
leaq (%rax,%r12,2), %r14
xorl %r15d, %r15d
movzwl 0x6(%rbx,%r12,2), %eax
cmpq %rax, %r15
jae 0xf1bd
movzwl (%r14,%r15,2), %edi
incq %r15
callq 0x1050
jmp 0xf100
movq %rbx, %r14
movq %r13, %rbx
movslq %r15d, %r12
movzwl 0x2(%r14,%r12,2), %esi
movzwl 0x4(%r14,%r12,2), %edx
leaq 0x2d85(%rip), %rdi      # 0x11ebf
xorl %eax, %eax
callq 0x10c0
movzwl 0x6(%r14,%r12,2), %r13d
movzwl 0x8(%r14,%r12,2), %r14d
xorl %r15d, %r15d
cmpq $0x10, %r15
je 0xf180
pushq $0x1
popq %rax
movl %r15d, %ecx
shlq %cl, %rax
testl %r13d, %eax
je 0xf17b
movq (%rbx), %rdi
leaq 0x7ff2(%rip), %rax      # 0x17160
movsbl (%r15,%rax), %eax
movzwl %ax, %esi
callq 0xed51
incq %r15
jmp 0xf150
xorl %r15d, %r15d
movq %rbx, %r13
movq 0x10(%rsp), %rbx
cmpq $0x10, %r15
je 0xf1bd
pushq $0x1
popq %rax
movl %r15d, %ecx
shlq %cl, %rax
testl %r14d, %eax
je 0xf1b8
movq (%r13), %rdi
leaq 0x7fb6(%rip), %rax      # 0x17160
movsbl 0x10(%r15,%rax), %eax
movzwl %ax, %esi
callq 0xed51
incq %r15
jmp 0xf18b
pushq $0xa
popq %rdi
callq 0x1050
jmp 0xf1e4
movslq %r15d, %r12
movzwl 0x2(%rbx,%r12,2), %edx
movzwl 0x4(%rbx,%r12,2), %ecx
leaq 0x2d17(%rip), %rdi      # 0x11ef4
xorl %eax, %eax
callq 0x10c0
movzwl 0x4(%rbx,%r12,2), %edx
jmp 0xee5f
cmpl $0x63, %r15d
jg 0xf20b
pushq $0x20
popq %rdi
callq 0x1050
cmpl $0x9, %r15d
jg 0xf20b
pushq $0x20
popq %rdi
callq 0x1050
xorl %r14d, %r14d
pushq $0x20
popq %rbp
movl 0x7f39(%rip), %eax      # 0x17150
addl $-0x11, %eax
cmpl %eax, %r14d
jge 0xf22b
movl %ebp, %edi
callq 0x1050
incl %r14d
jmp 0xf211
movslq %r15d, %rax
movzwl 0x2(%rbx,%rax,2), %esi
movzwl 0x4(%rbx,%rax,2), %edx
leaq 0x2cc4(%rip), %rdi      # 0x11f03
xorl %eax, %eax
callq 0x10c0
movq (%r13), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a0