// File: /workspace/github_c_makefile_star2_O0/MikeGray-APH[P]LibLouisAPH/source/compile.c
// Function: compile_rule
static int compile_rule(void)
{
	struct rule *rule;
	enum table_hash_type hash_type;
	enum rule_direction direction;
	unichar *chars, *dots;
	int chars_len, dots_len;
	int chars_weight, dots_weight;

	if(!token_parse())
		goto return_fail;

	chars_weight =
	dots_weight = 0;
	direction = BOTH;
	while(*token_crs == u'-')
	{
		if(token_is_equal("-forward", 8))
			direction = FORWARD;
		else if(token_is_equal("-backward", 9))
			direction = BACKWARD;
		else if(token_is_equal("-after", 6))
			chars_weight =
			dots_weight = 1;
		else
		{
			log_message(LOG_ERROR, "%s:%d  invalid rule option %#S", table_file_names[include_depth], table_file_lines[include_depth], token_crs, token_len);
			return 0;
		}

		if(!token_parse())
			goto return_fail;
	}

	if(token_is_equal("init", 4))
		hash_type = TABLE_HASH_INIT;
	else if(token_is_equal("premode", 7))
		hash_type = TABLE_HASH_PREMODE;
	else if(token_is_equal("postmode", 8))
		hash_type = TABLE_HASH_POSTMODE;
	else if(token_is_equal("pretrans", 8))
		hash_type = TABLE_HASH_PRETRANS;
	else if(token_is_equal("trans", 5))
		hash_type = TABLE_HASH_TRANS;
	else if(token_is_equal("posttrans", 9))
		hash_type = TABLE_HASH_POSTTRANS;
	else if(token_is_equal("fini", 4))
		hash_type = TABLE_HASH_FINI;
	else
	{
		log_message(LOG_ERROR, "%s:%d  invalid rule type %#S", table_file_names[include_depth], table_file_lines[include_depth], token_crs, token_len);
		return 0;
	}

	if(!token_parse())
		goto return_fail;

	chars_len = token_convert_escapes_with_dots();
	if(chars_len <= 0)
		goto return_fail;
	chars = token_crs;

	if(!token_parse())
		goto return_fail;

	if(token_is_equal("-", 1))
	{
		//NOTE:  FORWARD direction may noy be necessary
		direction = FORWARD;
		dots_len = 0;
		dots = NULL;
	}
	else
	{
		if(hash_type == TABLE_HASH_TRANS)
			dots_len = token_convert_to_dots();
		else
			dots_len = token_convert_escapes_with_dots();
		if(dots_len <= 0)
			goto return_fail;
		dots = token_crs;
	}

	rule = table_add_rule(table, hash_type, direction, rule_filter_forward, rule_filter_backward, chars, chars_len, dots, dots_len, chars_weight, dots_weight);
	if(!rule)
	{
		log_message(LOG_ERROR, "%s:%d  unable to add rule", table_file_names[include_depth], table_file_lines[include_depth]);
		return 0;
	}
	rule->attrs = rule_attrs;
	rule->direction = direction;

	return 1;

	return_fail:
	log_message(LOG_ERROR, "%s:%d  invalid rule", table_file_names[include_depth], table_file_lines[include_depth]);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x60, %rsp
callq 0x6190
cmpl $0x0, %eax
jne 0x7fca
jmp 0x8354
movl $0x0, -0x48(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x28(%rbp)
movq 0x1e222(%rip), %rax     # 0x26208
movzwl (%rax), %eax
cmpl $0x2d, %eax
jne 0x80c1
leaq 0x1689d(%rip), %rdi     # 0x1e896
movl $0x8, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x8014
movl $0x1, -0x28(%rbp)
jmp 0x80ad
leaq 0x16884(%rip), %rdi     # 0x1e89f
movl $0x9, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x8033
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
jmp 0x80ab
leaq 0x1686f(%rip), %rdi     # 0x1e8a9
movl $0x6, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x8059
movl $0x1, -0x48(%rbp)
movl $0x1, -0x44(%rbp)
jmp 0x80a9
movslq 0x1c138(%rip), %rcx     # 0x24198
leaq 0x1c159(%rip), %rax     # 0x241c0
movq (%rax,%rcx,8), %rdx
movslq 0x1c126(%rip), %rcx     # 0x24198
leaq 0x1c127(%rip), %rax     # 0x241a0
movl (%rax,%rcx,4), %ecx
movq 0x1e185(%rip), %r8      # 0x26208
movl 0x1e176(%rip), %r9d     # 0x26200
movl $0x6, %edi
leaq 0x1681a(%rip), %rsi     # 0x1e8b0
movb $0x0, %al
callq 0xf610
movl $0x0, -0x14(%rbp)
jmp 0x8391
jmp 0x80ab
jmp 0x80ad
callq 0x6190
cmpl $0x0, %eax
jne 0x80bc
jmp 0x8354
jmp 0x7fdf
leaq 0x16807(%rip), %rdi     # 0x1e8cf
movl $0x4, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x80e3
movl $0x1, -0x24(%rbp)
jmp 0x8205
leaq 0x167ea(%rip), %rdi     # 0x1e8d4
movl $0x7, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x8105
movl $0x2, -0x24(%rbp)
jmp 0x8203
leaq 0x167d0(%rip), %rdi     # 0x1e8dc
movl $0x8, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x8127
movl $0x3, -0x24(%rbp)
jmp 0x8201
leaq 0x167b7(%rip), %rdi     # 0x1e8e5
movl $0x8, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x8149
movl $0x4, -0x24(%rbp)
jmp 0x81ff
leaq 0x16798(%rip), %rdi     # 0x1e8e8
movl $0x5, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x816b
movl $0x5, -0x24(%rbp)
jmp 0x81fd
leaq 0x1677c(%rip), %rdi     # 0x1e8ee
movl $0x9, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x818a
movl $0x6, -0x24(%rbp)
jmp 0x81fb
leaq 0x16767(%rip), %rdi     # 0x1e8f8
movl $0x4, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x81a9
movl $0x7, -0x24(%rbp)
jmp 0x81f9
movslq 0x1bfe8(%rip), %rcx     # 0x24198
leaq 0x1c009(%rip), %rax     # 0x241c0
movq (%rax,%rcx,8), %rdx
movslq 0x1bfd6(%rip), %rcx     # 0x24198
leaq 0x1bfd7(%rip), %rax     # 0x241a0
movl (%rax,%rcx,4), %ecx
movq 0x1e035(%rip), %r8      # 0x26208
movl 0x1e026(%rip), %r9d     # 0x26200
movl $0x6, %edi
leaq 0x16717(%rip), %rsi     # 0x1e8fd
movb $0x0, %al
callq 0xf610
movl $0x0, -0x14(%rbp)
jmp 0x8391
jmp 0x81fb
jmp 0x81fd
jmp 0x81ff
jmp 0x8201
jmp 0x8203
jmp 0x8205
callq 0x6190
cmpl $0x0, %eax
jne 0x8214
jmp 0x8354
callq 0xa0a0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jg 0x8227
jmp 0x8354
movq 0x1dfda(%rip), %rax     # 0x26208
movq %rax, -0x30(%rbp)
callq 0x6190
cmpl $0x0, %eax
jne 0x8241
jmp 0x8354
leaq 0x17190(%rip), %rdi     # 0x1f3d8
movl $0x1, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x826f
movl $0x1, -0x28(%rbp)
movl $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
jmp 0x829d
cmpl $0x5, -0x24(%rbp)
jne 0x827f
callq 0x9ed0
movl %eax, -0x40(%rbp)
jmp 0x8287
callq 0xa0a0
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jg 0x8292
jmp 0x8354
movq 0x1df6f(%rip), %rax     # 0x26208
movq %rax, -0x38(%rbp)
movq 0x1bebc(%rip), %rdi     # 0x24160
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
movq 0x1bec7(%rip), %rcx     # 0x24178
movq 0x1beb8(%rip), %r8      # 0x24170
movq -0x30(%rbp), %r9
movl -0x3c(%rbp), %r14d
movq -0x38(%rbp), %rbx
movl -0x40(%rbp), %r11d
movl -0x44(%rbp), %r10d
movl -0x48(%rbp), %eax
movl %r14d, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x2ea0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x8335
movslq 0x1be9b(%rip), %rcx     # 0x24198
leaq 0x1bebc(%rip), %rax     # 0x241c0
movq (%rax,%rcx,8), %rdx
movslq 0x1be89(%rip), %rcx     # 0x24198
leaq 0x1be8a(%rip), %rax     # 0x241a0
movl (%rax,%rcx,4), %ecx
movl $0x6, %edi
leaq 0x165f5(%rip), %rsi     # 0x1e91a
movb $0x0, %al
callq 0xf610
movl $0x0, -0x14(%rbp)
jmp 0x8391
movl 0x1be2d(%rip), %ecx     # 0x24168
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movl $0x1, -0x14(%rbp)
jmp 0x8391
movslq 0x1be3d(%rip), %rcx     # 0x24198
leaq 0x1be5e(%rip), %rax     # 0x241c0
movq (%rax,%rcx,8), %rdx
movslq 0x1be2b(%rip), %rcx     # 0x24198
leaq 0x1be2c(%rip), %rax     # 0x241a0
movl (%rax,%rcx,4), %ecx
movl $0x6, %edi
leaq 0x165b1(%rip), %rsi     # 0x1e934
movb $0x0, %al
callq 0xf610
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)