// File: /workspace/github_c_makefile_star2_O1/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 0x10fc9
leaq (%rbx,%rax,2), %r14
leaq 0x8(%rbx), %rax
movq %rax, (%rsp)
leaq 0x74e1(%rip), %r15      # 0x18120
movq 0x7392(%rip), %r13      # 0x17fd8
movslq 0x74f3(%rip), %rsi      # 0x18140
addq %r15, %rsi
leaq 0x3189(%rip), %rdi      # 0x13de0
movl %r12d, %edx
xorl %eax, %eax
callq 0x10c0
cmpl $0x63, %r12d
jg 0x10c71
movl $0x20, %edi
callq 0x1050
cmpl $0x9, %r12d
jg 0x10c81
movl $0x20, %edi
callq 0x1050
movl 0x74b9(%rip), %eax      # 0x18140
addl $-0x11, %eax
testl %eax, %eax
jle 0x10ca9
xorl %ebp, %ebp
movl $0x20, %edi
callq 0x1050
incl %ebp
movl 0x749e(%rip), %eax      # 0x18140
addl $-0x11, %eax
cmpl %eax, %ebp
jl 0x10c90
movzwl (%r14), %esi
leal -0x1(%rsi), %eax
movslq %r12d, %r14
cmpl $0xb, %eax
ja 0x10f9a
leaq 0x3081(%rip), %rcx      # 0x13d44
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x3106(%rip), %rdi      # 0x13de5
jmp 0x10dc9
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x31b0(%rip), %rdi      # 0x13ea7
jmp 0x10dc9
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 0x3114(%rip), %rdi      # 0x13e2f
jmp 0x10dad
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x315a(%rip), %rdi      # 0x13e8d
xorl %eax, %eax
callq 0x10c0
cmpw $0x0, 0x6(%rbx,%r14,2)
je 0x10f87
movq (%rsp), %rax
leaq (%rax,%r14,2), %r15
xorl %r12d, %r12d
movq (%r13), %rdi
movzwl (%r15,%r12,2), %esi
incq %r12
callq 0x10b1e
movzwl 0x6(%rbx,%r14,2), %eax
cmpq %rax, %r12
jb 0x10d52
jmp 0x10f87
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
movzwl 0x6(%rbx,%r14,2), %ecx
leaq 0x3079(%rip), %rdi      # 0x13e05
jmp 0x10e09
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 0x306b(%rip), %rdi      # 0x13e18
xorl %eax, %eax
callq 0x10c0
jmp 0x10e10
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x30a9(%rip), %rdi      # 0x13e72
xorl %eax, %eax
callq 0x10c0
jmp 0x10fb4
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
movzwl 0x6(%rbx,%r14,2), %ecx
leaq 0x3004(%rip), %rdi      # 0x13df2
jmp 0x10e09
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
movzwl 0x6(%rbx,%r14,2), %ecx
leaq 0x303d(%rip), %rdi      # 0x13e46
xorl %eax, %eax
callq 0x10c0
movl 0x732a(%rip), %eax      # 0x18140
cmpl $0x2, %eax
movl $0x1, %ecx
cmovll %ecx, %eax
decl %eax
movl %eax, 0x7317(%rip)      # 0x18140
movzwl 0x6(%rbx,%r14,2), %esi
movq %rbx, %rdi
callq 0x10c0e
movl 0x7303(%rip), %eax      # 0x18140
cmpl $0x1d, %eax
movl $0x1d, %ecx
cmovgel %ecx, %eax
incl %eax
movl %eax, 0x72f0(%rip)      # 0x18140
jmp 0x10fb4
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 0x2fe5(%rip), %rdi      # 0x13e59
xorl %eax, %eax
callq 0x10c0
movl 0x72bf(%rip), %eax      # 0x18140
cmpl $0x2, %eax
movl $0x1, %ecx
cmovll %ecx, %eax
decl %eax
movl %eax, 0x72ac(%rip)      # 0x18140
movzwl 0x6(%rbx,%r14,2), %esi
movq %rbx, %rdi
callq 0x10c0e
movzwl 0x8(%rbx,%r14,2), %esi
jmp 0x10e2f
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x2fdd(%rip), %rdi      # 0x13e9a
xorl %eax, %eax
callq 0x10c0
cmpw $0x0, 0x6(%rbx,%r14,2)
je 0x10f87
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 0x10edc
jmp 0x10f87
movzwl 0x2(%rbx,%r14,2), %esi
movzwl 0x4(%rbx,%r14,2), %edx
leaq 0x2f73(%rip), %rdi      # 0x13e7f
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 0x10f49
movq (%r13), %rdi
leaq 0x7214(%rip), %rax      # 0x18150
movsbl (%r12,%rax), %eax
movzwl %ax, %esi
callq 0x10b1e
incq %r12
cmpq $0x10, %r12
jne 0x10f22
xorl %r12d, %r12d
movl $0x1, %eax
movl %r12d, %ecx
shlq %cl, %rax
testl %r15d, %eax
je 0x10f7e
movq (%r13), %rdi
leaq 0x71e0(%rip), %rax      # 0x18150
movsbl 0x10(%r12,%rax), %eax
movzwl %ax, %esi
callq 0x10b1e
incq %r12
cmpq $0x10, %r12
jne 0x10f55
movl $0xa, %edi
callq 0x1050
leaq 0x7188(%rip), %r15      # 0x18120
jmp 0x10fb4
movzwl 0x2(%rbx,%r14,2), %edx
movzwl 0x4(%rbx,%r14,2), %ecx
leaq 0x2f07(%rip), %rdi      # 0x13eb4
xorl %eax, %eax
callq 0x10c0
movzwl 0x4(%rbx,%r14,2), %r12d
leaq (%rbx,%r12,2), %r14
cmpw $-0x1, (%r14)
jne 0x10c46
movslq 0x7170(%rip), %rax      # 0x18140
leaq 0x7149(%rip), %rsi      # 0x18120
addq %rax, %rsi
leaq 0x2dff(%rip), %rdi      # 0x13de0
movl %r12d, %edx
xorl %eax, %eax
callq 0x10c0
cmpl $0x63, %r12d
jg 0x10ffb
movl $0x20, %edi
callq 0x1050
cmpl $0x9, %r12d
jg 0x1100b
movl $0x20, %edi
callq 0x1050
movl 0x712f(%rip), %eax      # 0x18140
addl $-0x11, %eax
testl %eax, %eax
jle 0x11033
xorl %ebp, %ebp
movl $0x20, %edi
callq 0x1050
incl %ebp
movl 0x7114(%rip), %eax      # 0x18140
addl $-0x11, %eax
cmpl %eax, %ebp
jl 0x1101a
movslq %r12d, %rax
movzwl 0x2(%rbx,%rax,2), %esi
movzwl 0x4(%rbx,%rax,2), %edx
leaq 0x2e7c(%rip), %rdi      # 0x13ec3
xorl %eax, %eax
callq 0x10c0
movq 0x6f83(%rip), %rax      # 0x17fd8
movq (%rax), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1190