// File: /workspace/github_c_makefile_star2_O0/MikeGray-APH[P]LibLouisAPH/source/compile.c
// Function: compile_pattern
static int compile_pattern(void)
{
	struct subpattern *subpattern;
	unichar pattern[PATTERN_MAX], *token_tag, *token_src, *tag, *expr_data, *src_data;
	int tag_len, expr_len, src_len;

	tag =
	expr_data =
	src_data = NULL;

	if(!token_parse())
		goto return_fail;

	token_convert_escapes();
	if(token_len <= 0)
	{
		log_message(LOG_ERROR, "%s:%d  invalid pattern name", table_file_names[include_depth], table_file_lines[include_depth]);
		return 0;
	}
	token_tag = token_crs;
	tag_len = token_len;

	if(!token_parse())
		goto return_fail;
	if(token_convert_escapes_with_dots() <= 0)
		goto return_fail;

	token_src = token_crs;
	src_len = token_len;
	expr_len = pattern_compile(pattern, PATTERN_MAX, token_crs, token_len, table->attrs_chars, table->subpatterns);
	if(!expr_len)
		goto return_fail;

	if(token_parse())
	if(token_crs[0] == u'<' && token_len == 1)
		pattern_reverse(pattern);

	tag = MALLOC((tag_len + 1) * sizeof(unichar));
	if(!tag)
	{
		LOG_ALLOCATE_FAIL
		goto return_fail_free;
	}
	utf16_copy(tag, token_tag, tag_len + 1);

	expr_data = MALLOC((expr_len + 1) * sizeof(unichar));
	if(!expr_data)
	{
		LOG_ALLOCATE_FAIL
		goto return_fail_free;
	}
	memcpy(expr_data, pattern, (expr_len + 1) * sizeof(unichar));

	src_data = MALLOC((src_len + 1) * sizeof(unichar));
	if(!src_data)
	{
		LOG_ALLOCATE_FAIL
		goto return_fail_free;
	}
	utf16_copy(src_data, token_src, src_len + 1);

	subpattern = subpattern_allocate();
	if(!subpattern)
	{
		LOG_ALLOCATE_FAIL
		goto return_fail_free;
	}
	subpattern->nxt = NULL;
	subpattern->processing = 0;
	subpattern->tag = tag;
	subpattern->tag_len = tag_len;
	subpattern->expr_data = expr_data;
	subpattern->expr_len = expr_len;
	subpattern->src_data = src_data;
	subpattern->src_len = src_len;

	subpattern->nxt = table->subpatterns;
	table->subpatterns = subpattern;

	return 1;

	return_fail:
	log_message(LOG_ERROR, "%s:%d  invalid pattern", table_file_names[include_depth], table_file_lines[include_depth]);

	return_fail_free:
	if(tag)
		FREE(tag);
	if(expr_data)
		FREE(expr_data);
	if(src_data)
		FREE(src_data);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4a90, %rsp           # imm = 0x4A90
movq $0x0, -0x4a78(%rbp)
movq $0x0, -0x4a70(%rbp)
movq $0x0, -0x4a68(%rbp)
callq 0x6190
cmpl $0x0, %eax
jne 0x753b
jmp 0x7852
callq 0x9670
cmpl $0x0, 0x1ecb9(%rip)     # 0x26200
jg 0x758b
movslq 0x1cc48(%rip), %rcx     # 0x24198
leaq 0x1cc69(%rip), %rax     # 0x241c0
movq (%rax,%rcx,8), %rdx
movslq 0x1cc36(%rip), %rcx     # 0x24198
leaq 0x1cc37(%rip), %rax     # 0x241a0
movl (%rax,%rcx,4), %ecx
movl $0x6, %edi
leaq 0x17288(%rip), %rsi     # 0x1e800
movb $0x0, %al
callq 0xf610
movl $0x0, -0x4(%rbp)
jmp 0x78d1
movq 0x1ec76(%rip), %rax     # 0x26208
movq %rax, -0x4a58(%rbp)
movl 0x1ec61(%rip), %eax     # 0x26200
movl %eax, -0x4a7c(%rbp)
callq 0x6190
cmpl $0x0, %eax
jne 0x75b4
jmp 0x7852
callq 0xa0a0
cmpl $0x0, %eax
jg 0x75c3
jmp 0x7852
movq 0x1ec3e(%rip), %rax     # 0x26208
movq %rax, -0x4a60(%rbp)
movl 0x1ec29(%rip), %eax     # 0x26200
movl %eax, -0x4a84(%rbp)
leaq -0x4a50(%rbp), %rdi
movq 0x1ec1d(%rip), %rdx     # 0x26208
movl 0x1ec0f(%rip), %ecx     # 0x26200
movq 0x1cb68(%rip), %r8      # 0x24160
addq $0x30, %r8
movq 0x1cb5d(%rip), %rax     # 0x24160
movq 0x28(%rax), %r9
movl $0x2520, %esi           # imm = 0x2520
callq 0xbf90
movl %eax, -0x4a80(%rbp)
cmpl $0x0, -0x4a80(%rbp)
jne 0x7625
jmp 0x7852
callq 0x6190
cmpl $0x0, %eax
je 0x7655
movq 0x1ebd2(%rip), %rax     # 0x26208
movzwl (%rax), %eax
cmpl $0x3c, %eax
jne 0x7653
cmpl $0x1, 0x1ebbb(%rip)     # 0x26200
jne 0x7653
leaq -0x4a50(%rbp), %rdi
callq 0xca30
jmp 0x7655
movl -0x4a7c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq %rdi
callq 0x1160
movq %rax, -0x4a68(%rbp)
cmpq $0x0, -0x4a68(%rbp)
jne 0x769e
movl $0x7, %edi
leaq 0x16bf2(%rip), %rsi     # 0x1e278
leaq 0x16c94(%rip), %rdx     # 0x1e321
movl $0x371, %ecx            # imm = 0x371
movb $0x0, %al
callq 0xf610
jmp 0x7888
movq -0x4a68(%rbp), %rdi
movq -0x4a58(%rbp), %rsi
movl -0x4a7c(%rbp), %edx
addl $0x1, %edx
callq 0x6290
movl -0x4a80(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq %rdi
callq 0x1160
movq %rax, -0x4a70(%rbp)
cmpq $0x0, -0x4a70(%rbp)
jne 0x7703
movl $0x7, %edi
leaq 0x16b8d(%rip), %rsi     # 0x1e278
leaq 0x16c2f(%rip), %rdx     # 0x1e321
movl $0x379, %ecx            # imm = 0x379
movb $0x0, %al
callq 0xf610
jmp 0x7888
movq -0x4a70(%rbp), %rdi
leaq -0x4a50(%rbp), %rsi
movl -0x4a80(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
shlq %rdx
callq 0x1150
movl -0x4a84(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq %rdi
callq 0x1160
movq %rax, -0x4a78(%rbp)
cmpq $0x0, -0x4a78(%rbp)
jne 0x776e
movl $0x7, %edi
leaq 0x16b22(%rip), %rsi     # 0x1e278
leaq 0x16bc4(%rip), %rdx     # 0x1e321
movl $0x381, %ecx            # imm = 0x381
movb $0x0, %al
callq 0xf610
jmp 0x7888
movq -0x4a78(%rbp), %rdi
movq -0x4a60(%rbp), %rsi
movl -0x4a84(%rbp), %edx
addl $0x1, %edx
callq 0x6290
callq 0xbea0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x77be
movl $0x7, %edi
leaq 0x16ad2(%rip), %rsi     # 0x1e278
leaq 0x16b74(%rip), %rdx     # 0x1e321
movl $0x389, %ecx            # imm = 0x389
movb $0x0, %al
callq 0xf610
jmp 0x7888
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x2c(%rax)
movq -0x4a68(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x4a7c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x4a70(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x4a80(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x4a78(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x4a84(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movq 0x1c931(%rip), %rax     # 0x24160
movq 0x28(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq 0x1c91b(%rip), %rax     # 0x24160
movq %rcx, 0x28(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x78d1
movslq 0x1c93f(%rip), %rcx     # 0x24198
leaq 0x1c960(%rip), %rax     # 0x241c0
movq (%rax,%rcx,8), %rdx
movslq 0x1c92d(%rip), %rcx     # 0x24198
leaq 0x1c92e(%rip), %rax     # 0x241a0
movl (%rax,%rcx,4), %ecx
movl $0x6, %edi
leaq 0x16f9b(%rip), %rsi     # 0x1e81c
movb $0x0, %al
callq 0xf610
cmpq $0x0, -0x4a68(%rbp)
je 0x789e
movq -0x4a68(%rbp), %rdi
callq 0x1040
cmpq $0x0, -0x4a70(%rbp)
je 0x78b4
movq -0x4a70(%rbp), %rdi
callq 0x1040
cmpq $0x0, -0x4a78(%rbp)
je 0x78ca
movq -0x4a78(%rbp), %rdi
callq 0x1040
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x4a90, %rsp           # imm = 0x4A90
popq %rbp
retq
nopl (%rax)