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

	if(expr_crs == PTN_END)
		return;

	ASSERT(expr_crs > 1)
	ASSERT(expr_crs < expr_data[0])

	while(EXPR_TYPE(expr_crs) != PTN_END)
	{
		switch(EXPR_TYPE(expr_crs))
		{
		case PTN_START:  break;

		case PTN_GROUP:

			fputs("(", output);
			pattern_print_expression(output, expr_data, EXPR_DATA_0(expr_crs));
			fputs(")", output);
			break;

		case PTN_NOT:

			fputs("!", output);
			pattern_print_expression(output, expr_data, EXPR_DATA_0(expr_crs));
			break;

		case PTN_ONE_MORE:

			pattern_print_expression(output, expr_data, EXPR_DATA_0(expr_crs));
			fputs("+", output);
			break;

		case PTN_ZERO_MORE:

			pattern_print_expression(output, expr_data, EXPR_DATA_0(expr_crs));
			fputs("*", output);
			break;

		case PTN_OPTIONAL:

			pattern_print_expression(output, expr_data, EXPR_DATA_0(expr_crs));
			fputs("?", output);
			break;

		case PTN_ALTERNATE:

			pattern_print_expression(output, expr_data, EXPR_DATA_0(expr_crs));
			fputs("|", output);
			pattern_print_expression(output, expr_data, EXPR_DATA_1(expr_crs));
			break;

		case PTN_ANY:

			fputs(".", output);
			break;

		case PTN_ATTRIBUTES:

			fputs("%", output);
			attrs_output_brackets(EXPR_DATA_0(expr_crs), EXPR_DATA_1(expr_crs));
			break;

		case PTN_CHARS:

			if(EXPR_DATA_0(expr_crs) == 1)
				utf16_output_char_escape(stdout, EXPR_DATA_1(expr_crs));
			else
			{
				fputs("[", output);
				for(i = 0; i < EXPR_DATA_0(expr_crs); i++)
					utf16_output_char_escape(output, EXPR_CONST_DATA(expr_crs)[i + 1]);
				fputs("]", output);
			}
			break;

		case PTN_SUBPATTERN:

			fputs("@{", output);
			for(i = 0; i < EXPR_DATA_0(expr_crs); i++)
				fprintf(output, "%c", EXPR_CONST_DATA(expr_crs)[i + 1]);
			fputs("}", output);
			break;

		case PTN_END_OF_INPUT:

			fputs("^", output);
			break;

		default:  fprintf(output, "0x%x?", EXPR_TYPE(expr_crs));  return;
		}

		expr_crs = EXPR_NXT(expr_crs);
	}

	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0xffff, %edx           # imm = 0xFFFF
je 0x11328
cmpl $0x1, %edx
jle 0x11356
movq %rsi, %r14
movzwl (%rsi), %eax
cmpl %edx, %eax
jbe 0x11356
movq %rdi, %rbx
leaq 0x8(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0x2eee(%rip), %rbp      # 0x13e44
movl %edx, %r13d
movzwl (%r14,%r13,2), %edx
leal -0x1(%rdx), %eax
cmpl $0xb, %eax
ja 0x11320
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
leaq 0x2f52(%rip), %rdi      # 0x13ecd
movq %rbx, %rsi
callq 0x1100
movzwl 0x6(%r14,%r13,2), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10f12
leaq 0x2f34(%rip), %rdi      # 0x13ecf
jmp 0x1130d
leaq 0x2f3d(%rip), %rdi      # 0x13ee4
jmp 0x1130d
movzwl 0x6(%r14,%r13,2), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10f12
leaq 0x2f11(%rip), %rdi      # 0x13ed5
jmp 0x1130d
cmpw $0x1, 0x6(%r14,%r13,2)
jne 0x112c7
movq 0x6ffb(%rip), %rax      # 0x17fd8
movq (%rax), %rdi
movzwl 0x8(%r14,%r13,2), %esi
callq 0x1099e
jmp 0x11315
leaq 0x2eda(%rip), %rdi      # 0x13ed1
movq %rbx, %rsi
callq 0x1100
movzwl 0x6(%r14,%r13,2), %edx
jmp 0x11073
movzwl 0x6(%r14,%r13,2), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10f12
leaq 0x2eb4(%rip), %rdi      # 0x13ed3
jmp 0x1130d
leaq 0x2eae(%rip), %rdi      # 0x13ed9
jmp 0x1130d
movzwl 0x6(%r14,%r13,2), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10f12
leaq 0x2ea2(%rip), %rdi      # 0x13eea
jmp 0x1130d
movzwl 0x6(%r14,%r13,2), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10f12
leaq 0x2e72(%rip), %rdi      # 0x13ed7
movq %rbx, %rsi
callq 0x1100
movzwl 0x8(%r14,%r13,2), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10f12
jmp 0x11315
leaq 0x2e55(%rip), %rdi      # 0x13edf
movq %rbx, %rsi
callq 0x1100
cmpw $0x0, 0x6(%r14,%r13,2)
je 0x110c2
movq 0x10(%rsp), %rax
leaq (%rax,%r13,2), %r15
xorl %r12d, %r12d
movzwl (%r15,%r12,2), %edi
incq %r12
movq %rbx, %rsi
callq 0x1130
movzwl 0x6(%r14,%r13,2), %eax
cmpq %rax, %r12
jb 0x110a7
leaq 0x2e19(%rip), %rdi      # 0x13ee2
jmp 0x1130d
leaq 0x2e06(%rip), %rdi      # 0x13edb
movq %rbx, %rsi
callq 0x1100
movdqa 0x2dba(%rip), %xmm10    # 0x13ea0
pxor %xmm9, %xmm9
movdqa 0x2d9c(%rip), %xmm8     # 0x13e90
movzwl 0x6(%r14,%r13,2), %ebp
movzwl 0x8(%r14,%r13,2), %r12d
movq %rbp, %xmm0
pshufd $0x44, %xmm0, %xmm1     # xmm1 = xmm0[0,1,0,1]
pxor %xmm0, %xmm0
movl $0x10, %eax
shufps $0x88, %xmm1, %xmm1     # xmm1 = xmm1[0,2,0,2]
movdqa 0x2951(%rip), %xmm2     # 0x13a70
movdqa 0x2d59(%rip), %xmm3     # 0x13e80
movdqa %xmm8, %xmm4
psllq %xmm2, %xmm4
pshufd $0xee, %xmm2, %xmm5     # xmm5 = xmm2[2,3,2,3]
movdqa %xmm8, %xmm6
psllq %xmm5, %xmm6
movsd %xmm4, %xmm6            # xmm6 = xmm4[0],xmm6[1]
movdqa %xmm8, %xmm4
psllq %xmm3, %xmm4
pshufd $0xee, %xmm3, %xmm5     # xmm5 = xmm3[2,3,2,3]
movdqa %xmm8, %xmm7
psllq %xmm5, %xmm7
movsd %xmm4, %xmm7            # xmm7 = xmm4[0],xmm7[1]
shufps $0x88, %xmm7, %xmm6     # xmm6 = xmm6[0,2],xmm7[0,2]
andps %xmm1, %xmm6
pcmpgtd %xmm9, %xmm6
psubd %xmm6, %xmm0
paddq %xmm10, %xmm2
paddq %xmm10, %xmm3
addq $-0x4, %rax
jne 0x11127
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
paddd %xmm0, %xmm1
pshufd $0x55, %xmm1, %xmm2     # xmm2 = xmm1[1,1,1,1]
paddd %xmm1, %xmm2
pxor %xmm0, %xmm0
movss %xmm2, %xmm0            # xmm0 = xmm2[0],xmm0[1,2,3]
movd %r12d, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
movl $0x10, %eax
shufps $0x88, %xmm1, %xmm1     # xmm1 = xmm1[0,2,0,2]
movdqa 0x28be(%rip), %xmm2     # 0x13a70
movdqa 0x2cc6(%rip), %xmm3     # 0x13e80
movdqa %xmm8, %xmm4
psllq %xmm2, %xmm4
pshufd $0xee, %xmm2, %xmm5     # xmm5 = xmm2[2,3,2,3]
movdqa %xmm8, %xmm6
psllq %xmm5, %xmm6
movsd %xmm4, %xmm6            # xmm6 = xmm4[0],xmm6[1]
movdqa %xmm8, %xmm4
psllq %xmm3, %xmm4
pshufd $0xee, %xmm3, %xmm5     # xmm5 = xmm3[2,3,2,3]
movdqa %xmm8, %xmm7
psllq %xmm5, %xmm7
movsd %xmm4, %xmm7            # xmm7 = xmm4[0],xmm7[1]
shufps $0x88, %xmm7, %xmm6     # xmm6 = xmm6[0,2],xmm7[0,2]
andps %xmm1, %xmm6
pcmpgtd %xmm9, %xmm6
psubd %xmm6, %xmm0
paddq %xmm10, %xmm2
paddq %xmm10, %xmm3
addq $-0x4, %rax
jne 0x111ba
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
paddd %xmm0, %xmm1
pshufd $0x55, %xmm1, %xmm0     # xmm0 = xmm1[1,1,1,1]
paddd %xmm1, %xmm0
movd %xmm0, %eax
movl %eax, 0xc(%rsp)
cmpl $0x2, %eax
jb 0x11239
movl $0x5b, %edi
callq 0x1050
xorl %r15d, %r15d
movl $0x1, %eax
movl %r15d, %ecx
shlq %cl, %rax
testl %ebp, %eax
je 0x11269
movq 0x6d86(%rip), %rax      # 0x17fd8
movq (%rax), %rdi
leaq 0x6ef4(%rip), %rax      # 0x18150
movsbl (%r15,%rax), %eax
movzwl %ax, %esi
callq 0x1099e
incq %r15
cmpq $0x10, %r15
jne 0x1123c
xorl %r15d, %r15d
leaq 0x2bc8(%rip), %rbp      # 0x13e44
movl $0x1, %eax
movl %r15d, %ecx
shlq %cl, %rax
testl %r12d, %eax
je 0x112ab
movq 0x6d45(%rip), %rax      # 0x17fd8
movq (%rax), %rdi
leaq 0x6eb3(%rip), %rax      # 0x18150
movsbl 0x10(%r15,%rax), %eax
movzwl %ax, %esi
callq 0x1099e
incq %r15
cmpq $0x10, %r15
jne 0x1127c
cmpl $0x2, 0xc(%rsp)
jb 0x11315
movl $0x5d, %edi
callq 0x1050
jmp 0x11315
leaq 0x2c0f(%rip), %rdi      # 0x13edd
movq %rbx, %rsi
callq 0x1100
cmpw $0x0, 0x6(%r14,%r13,2)
je 0x11306
movq 0x10(%rsp), %rax
leaq (%rax,%r13,2), %r15
xorl %r12d, %r12d
movzwl (%r15,%r12,2), %esi
incq %r12
movq %rbx, %rdi
callq 0x1099e
movzwl 0x6(%r14,%r13,2), %eax
cmpq %rax, %r12
jb 0x112eb
leaq 0x2f29(%rip), %rdi      # 0x14236
movq %rbx, %rsi
callq 0x1100
movzwl 0x4(%r14,%r13,2), %edx
jmp 0x10f56
cmpl $0xffff, %edx           # imm = 0xFFFF
jne 0x11337
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2ba8(%rip), %rsi      # 0x13ee6
movq %rbx, %rdi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1160
callq 0x1060