// File: /workspace/github_c_makefile_star2_O0/MikeGray-APH[P]LibLouisAPH/source/compile.c
// Function: compile_filter
static int compile_filter(void)
{
	struct filter *filter;
	unichar pattern[PATTERN_MAX], *name, *before, *after;
	int name_len, before_len, after_len;

	DB_MEMSET(pattern, 0, PATTERN_MAX)
	before =
	after = NULL;

	if(!token_parse())
		goto return_fail;

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

	if(!token_parse())
		goto return_fail;

	if(token_crs[0] == u'-' && token_len == 1)
	{
		before = NULL;
		before_len = 0;
	}
	else
	{
		if(token_convert_escapes_with_dots() <= 0)
			goto return_fail;
		before_len = pattern_compile(pattern, PATTERN_MAX, token_crs, token_len, table->attrs_chars, table->subpatterns);
		if(!before_len)
			goto return_fail;
		pattern_reverse(pattern);
		before = MALLOC((before_len + 1) * sizeof(unichar));
		if(!before)
		{
			LOG_ALLOCATE_FAIL
			goto return_fail_free;
		}
		memcpy(before, pattern, (before_len + 1) * sizeof(unichar));
	}

	if(!token_parse())
		goto return_fail;

	if(token_crs[0] == u'-' && token_len == 1)
	{
		after = NULL;
		after_len = 0;
	}
	else
	{
		if(token_convert_escapes_with_dots() <= 0)
			goto return_fail;
		after_len = pattern_compile(pattern, PATTERN_MAX, token_crs, token_len, table->attrs_chars, table->subpatterns);
		if(!after_len)
			goto return_fail;
		after = MALLOC((after_len + 1) * sizeof(unichar));
		if(!after)
		{
			LOG_ALLOCATE_FAIL
			goto return_fail_free;
		}
		memcpy(after, pattern, (after_len + 1) * sizeof(unichar));
	}

	filter = filter_allocate();
	if(!filter)
	{
		LOG_ALLOCATE_FAIL
		goto return_fail_free;
	}
	filter->name = MALLOC((name_len + 1) * sizeof(unichar));
	if(!filter->name)
	{
		LOG_ALLOCATE_FAIL
		goto return_fail_free;
	}
	utf16_copy(filter->name, name, name_len + 1);
	filter->name_len = name_len;

	filter->nxt = NULL;
	filter->before = before;
	filter->before_len = before_len;
	filter->after = after;
	filter->after_len = after_len;

	filter->nxt = table->filters;
	table->filters = filter;

	return 1;

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

	return_fail_free:
	if(before)
		FREE(before);
	if(after)
		FREE(after);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4a80, %rsp           # imm = 0x4A80
leaq -0x4a50(%rbp), %rdi
xorl %esi, %esi
movl $0x2520, %edx           # imm = 0x2520
callq 0x1100
movq $0x0, -0x4a68(%rbp)
movq $0x0, -0x4a60(%rbp)
callq 0x6190
cmpl $0x0, %eax
jne 0x7923
jmp 0x7cb8
callq 0x9670
cmpl $0x0, 0x1e8d1(%rip)     # 0x26200
jg 0x7973
movslq 0x1c860(%rip), %rcx     # 0x24198
leaq 0x1c881(%rip), %rax     # 0x241c0
movq (%rax,%rcx,8), %rdx
movslq 0x1c84e(%rip), %rcx     # 0x24198
leaq 0x1c84f(%rip), %rax     # 0x241a0
movl (%rax,%rcx,4), %ecx
movl $0x6, %edi
leaq 0x16ed3(%rip), %rsi     # 0x1e833
movb $0x0, %al
callq 0xf610
movl $0x0, -0x4(%rbp)
jmp 0x7d21
movq 0x1e88e(%rip), %rax     # 0x26208
movq %rax, -0x4a58(%rbp)
movl 0x1e879(%rip), %eax     # 0x26200
movl %eax, -0x4a6c(%rbp)
callq 0x6190
cmpl $0x0, %eax
jne 0x799c
jmp 0x7cb8
movq 0x1e865(%rip), %rax     # 0x26208
movzwl (%rax), %eax
cmpl $0x2d, %eax
jne 0x79ce
cmpl $0x1, 0x1e84e(%rip)     # 0x26200
jne 0x79ce
movq $0x0, -0x4a60(%rbp)
movl $0x0, -0x4a70(%rbp)
jmp 0x7a9c
callq 0xa0a0
cmpl $0x0, %eax
jg 0x79dd
jmp 0x7cb8
leaq -0x4a50(%rbp), %rdi
movq 0x1e81d(%rip), %rdx     # 0x26208
movl 0x1e80f(%rip), %ecx     # 0x26200
movq 0x1c768(%rip), %r8      # 0x24160
addq $0x30, %r8
movq 0x1c75d(%rip), %rax     # 0x24160
movq 0x28(%rax), %r9
movl $0x2520, %esi           # imm = 0x2520
callq 0xbf90
movl %eax, -0x4a70(%rbp)
cmpl $0x0, -0x4a70(%rbp)
jne 0x7a25
jmp 0x7cb8
leaq -0x4a50(%rbp), %rdi
callq 0xca30
movl -0x4a70(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq %rdi
callq 0x1160
movq %rax, -0x4a60(%rbp)
cmpq $0x0, -0x4a60(%rbp)
jne 0x7a7a
movl $0x7, %edi
leaq 0x16816(%rip), %rsi     # 0x1e278
leaq 0x168b8(%rip), %rdx     # 0x1e321
movl $0x3d1, %ecx            # imm = 0x3D1
movb $0x0, %al
callq 0xf610
jmp 0x7cee
movq -0x4a60(%rbp), %rdi
leaq -0x4a50(%rbp), %rsi
movl -0x4a70(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
shlq %rdx
callq 0x1150
callq 0x6190
cmpl $0x0, %eax
jne 0x7aab
jmp 0x7cb8
movq 0x1e756(%rip), %rax     # 0x26208
movzwl (%rax), %eax
cmpl $0x2d, %eax
jne 0x7add
cmpl $0x1, 0x1e73f(%rip)     # 0x26200
jne 0x7add
movq $0x0, -0x4a68(%rbp)
movl $0x0, -0x4a74(%rbp)
jmp 0x7b9f
callq 0xa0a0
cmpl $0x0, %eax
jg 0x7aec
jmp 0x7cb8
leaq -0x4a50(%rbp), %rdi
movq 0x1e70e(%rip), %rdx     # 0x26208
movl 0x1e700(%rip), %ecx     # 0x26200
movq 0x1c659(%rip), %r8      # 0x24160
addq $0x30, %r8
movq 0x1c64e(%rip), %rax     # 0x24160
movq 0x28(%rax), %r9
movl $0x2520, %esi           # imm = 0x2520
callq 0xbf90
movl %eax, -0x4a74(%rbp)
cmpl $0x0, -0x4a74(%rbp)
jne 0x7b34
jmp 0x7cb8
movl -0x4a74(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq %rdi
callq 0x1160
movq %rax, -0x4a68(%rbp)
cmpq $0x0, -0x4a68(%rbp)
jne 0x7b7d
movl $0x7, %edi
leaq 0x16713(%rip), %rsi     # 0x1e278
leaq 0x167b5(%rip), %rdx     # 0x1e321
movl $0x3e9, %ecx            # imm = 0x3E9
movb $0x0, %al
callq 0xf610
jmp 0x7cee
movq -0x4a68(%rbp), %rdi
leaq -0x4a50(%rbp), %rsi
movl -0x4a74(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
shlq %rdx
callq 0x1150
callq 0x2af0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x7bd3
movl $0x7, %edi
leaq 0x166bd(%rip), %rsi     # 0x1e278
leaq 0x1675f(%rip), %rdx     # 0x1e321
movl $0x3f2, %ecx            # imm = 0x3F2
movb $0x0, %al
callq 0xf610
jmp 0x7cee
movl -0x4a6c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq %rdi
callq 0x1160
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x7c21
movl $0x7, %edi
leaq 0x1666f(%rip), %rsi     # 0x1e278
leaq 0x16711(%rip), %rdx     # 0x1e321
movl $0x3f8, %ecx            # imm = 0x3F8
movb $0x0, %al
callq 0xf610
jmp 0x7cee
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x4a58(%rbp), %rsi
movl -0x4a6c(%rbp), %edx
addl $0x1, %edx
callq 0x6290
movl -0x4a6c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x4a60(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x4a70(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x4a68(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x4a74(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq 0x1c4cb(%rip), %rax     # 0x24160
movq 0x20(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq 0x1c4b5(%rip), %rax     # 0x24160
movq %rcx, 0x20(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x7d21
movslq 0x1c4d9(%rip), %rcx     # 0x24198
leaq 0x1c4fa(%rip), %rax     # 0x241c0
movq (%rax,%rcx,8), %rdx
movslq 0x1c4c7(%rip), %rcx     # 0x24198
leaq 0x1c4c8(%rip), %rax     # 0x241a0
movl (%rax,%rcx,4), %ecx
movl $0x6, %edi
leaq 0x16b67(%rip), %rsi     # 0x1e84e
movb $0x0, %al
callq 0xf610
cmpq $0x0, -0x4a60(%rbp)
je 0x7d04
movq -0x4a60(%rbp), %rdi
callq 0x1040
cmpq $0x0, -0x4a68(%rbp)
je 0x7d1a
movq -0x4a68(%rbp), %rdi
callq 0x1040
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x4a80, %rsp           # imm = 0x4A80
popq %rbp
retq
nopl (%rax)