// File: /workspace/github_c_makefile_star2_O3/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
pushq %rax
movl %esi, %r12d
movq %rdi, %rbx
movl %esi, %eax
cmpw $-0x1, (%rdi,%rax,2)
je 0x10e70
leaq (%rbx,%rax,2), %r14
leaq 0x8(%rbx), %rax
movq %rax, (%rsp)
leaq 0x7661(%rip), %r15      # 0x18120
movq 0x7512(%rip), %r13      # 0x17fd8
movslq 0x7673(%rip), %rsi      # 0x18140
addq %r15, %rsi
leaq 0x3415(%rip), %rdi      # 0x13eec
movl %r12d, %edx
xorl %eax, %eax
callq 0x10c0
cmpl $0x63, %r12d
jg 0x10b01
movl $0x20, %edi
callq 0x1050
cmpl $0x9, %r12d
jg 0x10b01
movl $0x20, %edi
callq 0x1050
movl 0x7639(%rip), %eax      # 0x18140
addl $-0x11, %eax
testl %eax, %eax
jle 0x10b29
xorl %ebp, %ebp
movl $0x20, %edi
callq 0x1050
incl %ebp
movl 0x761e(%rip), %eax      # 0x18140
addl $-0x11, %eax
cmpl %eax, %ebp
jl 0x10b10
movzwl (%r14), %esi
leal -0x1(%rsi), %eax
cmpl $0xb, %eax
ja 0x10e3e
leaq 0x32d4(%rip), %rcx      # 0x13e14
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x3392(%rip), %rdi      # 0x13ef1
jmp 0x10c5e
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x3439(%rip), %rdi      # 0x13fb3
jmp 0x10c5e
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
movzwl 0x6(%rbx,%r14,2), %ecx
movzwl 0x8(%rbx,%r14,2), %r8d
leaq 0x339a(%rip), %rdi      # 0x13f3b
jmp 0x10c3f
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x33dd(%rip), %rdi      # 0x13f99
xorl %eax, %eax
callq 0x10c0
cmpw $0x0, 0x6(%rbx,%r14,2)
je 0x10e2b
movq (%rsp), %rax
leaq (%rax,%r14,2), %r15
xorl %r12d, %r12d
movq (%r13), %rdi
movzwl (%r15,%r12,2), %esi
incq %r12
callq 0x1099e
movzwl 0x6(%rbx,%r14,2), %eax
cmpq %rax, %r12
jb 0x10bdb
jmp 0x10e2b
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
movzwl 0x6(%rbx,%r14,2), %ecx
leaq 0x32f9(%rip), %rdi      # 0x13f11
jmp 0x10ca4
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
movzwl 0x6(%rbx,%r14,2), %ecx
movzwl 0x8(%rbx,%r14,2), %r8d
leaq 0x32e5(%rip), %rdi      # 0x13f24
xorl %eax, %eax
callq 0x10c0
jmp 0x10cab
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x3320(%rip), %rdi      # 0x13f7e
xorl %eax, %eax
callq 0x10c0
jmp 0x10e5b
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
movzwl 0x6(%rbx,%r14,2), %ecx
leaq 0x3278(%rip), %rdi      # 0x13efe
jmp 0x10ca4
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
movzwl 0x6(%rbx,%r14,2), %ecx
leaq 0x32ae(%rip), %rdi      # 0x13f52
xorl %eax, %eax
callq 0x10c0
movl 0x748f(%rip), %eax      # 0x18140
cmpl $0x2, %eax
movl $0x1, %ecx
cmovll %ecx, %eax
decl %eax
movl %eax, 0x747c(%rip)      # 0x18140
movzwl 0x6(%rbx,%r14,2), %esi
movq %rbx, %rdi
callq 0x10a8e
movl 0x7468(%rip), %eax      # 0x18140
cmpl $0x1d, %eax
movl $0x1d, %ecx
cmovgel %ecx, %eax
incl %eax
movl %eax, 0x7455(%rip)      # 0x18140
jmp 0x10e5b
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
movzwl 0x6(%rbx,%r14,2), %ecx
movzwl 0x8(%rbx,%r14,2), %r8d
leaq 0x3253(%rip), %rdi      # 0x13f65
xorl %eax, %eax
callq 0x10c0
movl 0x7421(%rip), %eax      # 0x18140
cmpl $0x2, %eax
movl $0x1, %ecx
cmovll %ecx, %eax
decl %eax
movl %eax, 0x740e(%rip)      # 0x18140
movzwl 0x6(%rbx,%r14,2), %esi
movq %rbx, %rdi
callq 0x10a8e
movzwl 0x8(%rbx,%r14,2), %esi
jmp 0x10cca
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x3248(%rip), %rdi      # 0x13fa6
xorl %eax, %eax
callq 0x10c0
cmpw $0x0, 0x6(%rbx,%r14,2)
je 0x10e2b
movq (%rsp), %rax
leaq (%rax,%r14,2), %r15
xorl %r12d, %r12d
movzwl (%r15,%r12,2), %edi
incq %r12
callq 0x1050
movzwl 0x6(%rbx,%r14,2), %eax
cmpq %rax, %r12
jb 0x10d7d
jmp 0x10e2b
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x31db(%rip), %rdi      # 0x13f8b
xorl %eax, %eax
callq 0x10c0
movzwl 0x6(%rbx,%r14,2), %ebp
movzwl 0x8(%rbx,%r14,2), %r15d
xorl %r12d, %r12d
movl $0x1, %eax
movl %r12d, %ecx
shlq %cl, %rax
testl %ebp, %eax
je 0x10ded
movq (%r13), %rdi
leaq 0x7370(%rip), %rax      # 0x18150
movsbl (%r12,%rax), %eax
movzwl %ax, %esi
callq 0x1099e
incq %r12
cmpq $0x10, %r12
jne 0x10dc6
xorl %r12d, %r12d
movl $0x1, %eax
movl %r12d, %ecx
shlq %cl, %rax
testl %r15d, %eax
je 0x10e22
movq (%r13), %rdi
leaq 0x733c(%rip), %rax      # 0x18150
movsbl 0x10(%r12,%rax), %eax
movzwl %ax, %esi
callq 0x1099e
incq %r12
cmpq $0x10, %r12
jne 0x10df9
movl $0xa, %edi
callq 0x1050
leaq 0x72e4(%rip), %r15      # 0x18120
jmp 0x10e5b
movslq %r12d, %r14
movzwl 0x2(%rbx,%r14,2), %edx
movzwl 0x4(%rbx,%r14,2), %ecx
leaq 0x316c(%rip), %rdi      # 0x13fc0
xorl %eax, %eax
callq 0x10c0
movzwl 0x4(%rbx,%r14,2), %r12d
leaq (%rbx,%r12,2), %r14
cmpw $-0x1, (%r14)
jne 0x10ac6
movslq 0x72c9(%rip), %rax      # 0x18140
leaq 0x72a2(%rip), %rsi      # 0x18120
addq %rax, %rsi
leaq 0x3064(%rip), %rdi      # 0x13eec
movl %r12d, %edx
xorl %eax, %eax
callq 0x10c0
cmpl $0x63, %r12d
jg 0x10eb2
movl $0x20, %edi
callq 0x1050
cmpl $0x9, %r12d
jg 0x10eb2
movl $0x20, %edi
callq 0x1050
movl 0x7288(%rip), %eax      # 0x18140
addl $-0x11, %eax
testl %eax, %eax
jle 0x10eda
xorl %ebp, %ebp
movl $0x20, %edi
callq 0x1050
incl %ebp
movl 0x726d(%rip), %eax      # 0x18140
addl $-0x11, %eax
cmpl %eax, %ebp
jl 0x10ec1
movslq %r12d, %rax
movzwl 0x2(%rbx,%rax,2), %esi
movzwl 0x4(%rbx,%rax,2), %edx
leaq 0x30e1(%rip), %rdi      # 0x13fcf
xorl %eax, %eax
callq 0x10c0
movq 0x70dc(%rip), %rax      # 0x17fd8
movq (%rax), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a0