// File: /workspace/github_c_makefile_star2_O0/MikeGray-APH[P]LibLouisAPH/source/compile.c
// Function: conversion_compile_from_file
struct conversion* conversion_compile_from_file(const char *file_name)
{
	FILE *file;
	char cchars[INPUT_LINE_MAX];
	struct conversion conversion_auto, *conversion;
	int file_name_len, cchars_len;

	file = fopen(file_name, "r");
	if(!file)
		return NULL;

	conversion = &conversion_auto;
	conversion_init(conversion);

	file_name_len = strlen(file_name);
	conversion->file_name = MALLOC(file_name_len + 1);
	LOG_ALLOCATE_FAIL_RETURN_NULL(conversion->file_name)
	strcpy(conversion->file_name, file_name);

	table_file_lines[0] = 0;

	while(fgets(cchars, INPUT_LINE_MAX, file))
	{
		table_file_lines[0]++;

		cchars_len = strlen(cchars);
		if(cchars[cchars_len - 1] != '\n' && cchars[cchars_len - 1] != '\r')
		{
			/*   last line not empty   */
			if(fgets(cchars, INPUT_LINE_MAX, file))
			{
				/*   input too long   */
				log_message(LOG_ERROR, "%s:%d  line too long", table_file_names[include_depth], table_file_lines[include_depth]);
				log_included_file_errors();

				cchars_len = strlen(cchars);
				while(cchars[cchars_len - 1] != '\n' && cchars[cchars_len - 1] != '\r')
				if(fgets(cchars, INPUT_LINE_MAX, file))
					cchars_len = strlen(cchars);
				else
					break;
				continue;
			}
		}

		if(cchars[0] == '#')
			continue;

		memset(token_line, 0, INPUT_LINE_MAX * sizeof(unichar));
		utf8_convert_to_utf16(token_line, INPUT_LINE_MAX - 1, cchars, INPUT_LINE_MAX, NULL);

		if(!token_init(token_line))
			continue;

		if(token_is_equal(".end", 4))
			break;

		     if(token_is_equal("convert", 7))
			compile_convert(conversion);
		else if(token_is_equal("unknown", 7))
			compile_unknown(conversion);
	}

	fclose(file);

	/*   this could happen if file_name was a directory   */
	if(!table_file_lines[0])
	{
		FREE(table->file_name);
		return NULL;
	}

	conversion = conversion_allocate();
	*conversion = conversion_auto;

	return conversion;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1250, %rsp           # imm = 0x1250
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x19c14(%rip), %rsi     # 0x1efce
callq 0x1190
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x53d7
movq $0x0, -0x8(%rbp)
jmp 0x56fc
leaq -0x1238(%rbp), %rax
movq %rax, -0x1240(%rbp)
movq -0x1240(%rbp), %rdi
callq 0x45c0
movq -0x10(%rbp), %rdi
callq 0x10a0
movl %eax, -0x1244(%rbp)
movl -0x1244(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x1160
movq %rax, %rcx
movq -0x1240(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x1240(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x5459
movl $0x7, %edi
leaq 0x18e3f(%rip), %rsi     # 0x1e278
leaq 0x18ee1(%rip), %rdx     # 0x1e321
movl $0x8ce, %ecx            # imm = 0x8CE
movb $0x0, %al
callq 0xf610
movq $0x0, -0x8(%rbp)
jmp 0x56fc
movq -0x1240(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x1070
movl $0x0, 0x1ed29(%rip)     # 0x241a0
leaq -0x1020(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x1000, %esi           # imm = 0x1000
callq 0x1120
cmpq $0x0, %rax
je 0x56a1
movl 0x1ed04(%rip), %eax     # 0x241a0
addl $0x1, %eax
movl %eax, 0x1ecfb(%rip)     # 0x241a0
leaq -0x1020(%rbp), %rdi
callq 0x10a0
movl %eax, -0x1248(%rbp)
movl -0x1248(%rbp), %eax
subl $0x1, %eax
cltq
movsbl -0x1020(%rbp,%rax), %eax
cmpl $0xa, %eax
je 0x55e0
movl -0x1248(%rbp), %eax
subl $0x1, %eax
cltq
movsbl -0x1020(%rbp,%rax), %eax
cmpl $0xd, %eax
je 0x55e0
leaq -0x1020(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x1000, %esi           # imm = 0x1000
callq 0x1120
cmpq $0x0, %rax
je 0x55de
movslq 0x1ec83(%rip), %rcx     # 0x24198
leaq 0x1eca4(%rip), %rax     # 0x241c0
movq (%rax,%rcx,8), %rdx
movslq 0x1ec71(%rip), %rcx     # 0x24198
leaq 0x1ec72(%rip), %rax     # 0x241a0
movl (%rax,%rcx,4), %ecx
movl $0x6, %edi
leaq 0x18df5(%rip), %rsi     # 0x1e332
movb $0x0, %al
callq 0xf610
callq 0x5710
leaq -0x1020(%rbp), %rdi
callq 0x10a0
movl %eax, -0x1248(%rbp)
movl -0x1248(%rbp), %eax
subl $0x1, %eax
cltq
movsbl -0x1020(%rbp,%rax), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x1249(%rbp)
je 0x559a
movl -0x1248(%rbp), %eax
subl $0x1, %eax
cltq
movsbl -0x1020(%rbp,%rax), %eax
cmpl $0xd, %eax
setne %al
movb %al, -0x1249(%rbp)
movb -0x1249(%rbp), %al
testb $0x1, %al
jne 0x55a6
jmp 0x55d9
leaq -0x1020(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x1000, %esi           # imm = 0x1000
callq 0x1120
cmpq $0x0, %rax
je 0x55d5
leaq -0x1020(%rbp), %rdi
callq 0x10a0
movl %eax, -0x1248(%rbp)
jmp 0x55d7
jmp 0x55d9
jmp 0x555b
jmp 0x5477
jmp 0x55e0
movsbl -0x1020(%rbp), %eax
cmpl $0x23, %eax
jne 0x55f1
jmp 0x5477
leaq 0x1ec08(%rip), %rdi     # 0x24200
xorl %esi, %esi
movl $0x2000, %edx           # imm = 0x2000
callq 0x1100
leaq -0x1020(%rbp), %rdx
leaq 0x1ebee(%rip), %rdi     # 0x24200
movl $0xfff, %esi            # imm = 0xFFF
movl $0x1000, %ecx           # imm = 0x1000
xorl %eax, %eax
movl %eax, %r8d
callq 0x16c0
leaq 0x1ebd3(%rip), %rdi     # 0x24200
callq 0x5770
cmpl $0x0, %eax
jne 0x563c
jmp 0x5477
leaq 0x18d04(%rip), %rdi     # 0x1e347
movl $0x4, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x5654
jmp 0x56a1
leaq 0x19384(%rip), %rdi     # 0x1e9df
movl $0x7, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x5678
movq -0x1240(%rbp), %rdi
callq 0x5820
jmp 0x569c
leaq 0x19377(%rip), %rdi     # 0x1e9f6
movl $0x7, %esi
callq 0x57f0
cmpl $0x0, %eax
je 0x569a
movq -0x1240(%rbp), %rdi
callq 0x58e0
jmp 0x569c
jmp 0x5477
movq -0x18(%rbp), %rdi
callq 0x1090
cmpl $0x0, 0x1eaef(%rip)     # 0x241a0
jne 0x56cd
movq 0x1eaa6(%rip), %rax     # 0x24160
movq 0x10(%rax), %rdi
callq 0x1040
movq $0x0, -0x8(%rbp)
jmp 0x56fc
callq 0x4660
movq %rax, -0x1240(%rbp)
movq -0x1240(%rbp), %rdi
leaq -0x1238(%rbp), %rsi
movl $0x218, %edx            # imm = 0x218
callq 0x1150
movq -0x1240(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1250, %rsp           # imm = 0x1250
popq %rbp
retq
nopl (%rax)