// File: /workspace/github_c_makefile_star2_O0/MikeGray-APH[P]LibLouisAPH/source/translate.c
// Function: translate_output_to_input
int translate_output_to_input(struct translate *translate)
{
	FREE(translate->input);
	FREE(translate->input_mask);
	translate->input = translate->output;
	translate->input_mask = translate->output_mask;
	translate->input_len = translate->output_len;
	translate->input_crs = 0;

	translate->output = MALLOC(translate->output_max * sizeof(unichar));
	if(!translate->output)
	{
		LOG_ALLOCATE_FAIL
		return 0;
	}
	DB_MEMSET(translate->output, 0, translate->output_max * sizeof(unichar));
	translate->output_len = 0;

	translate->output_mask = MALLOC(translate->output_max);
	if(!translate->output_mask)
	{
		LOG_ALLOCATE_FAIL
		return -1;
	}
	memset(translate->output_mask, 0, translate->output_max);

	if(!translate->maps_use)
		return 1;

	FREE(translate->input_map);
	translate->input_map = translate->output_to_input_map;

	translate->output_to_input_map = MALLOC(translate->output_max * sizeof(int));
	if(!translate->output_to_input_map)
	{
		LOG_ALLOCATE_FAIL
		return 0;
	}
	DB_MEMSET(translate->output_to_input_map, -1, translate->output_max * sizeof(int));

	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x1040
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x1040
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
movl 0x68(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x40(%rax)
movq -0x10(%rbp), %rax
movslq 0x6c(%rax), %rdi
shlq %rdi
callq 0x1160
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
jne 0xb423
movl $0x7, %edi
leaq 0x12e74(%rip), %rsi     # 0x1e278
leaq 0x13649(%rip), %rdx     # 0x1ea54
movl $0x134, %ecx            # imm = 0x134
movb $0x0, %al
callq 0xf610
movl $0x0, -0x4(%rbp)
jmp 0xb560
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0x6c(%rax), %rdx
shlq %rdx
xorl %esi, %esi
callq 0x1100
movq -0x10(%rbp), %rax
movl $0x0, 0x68(%rax)
movq -0x10(%rbp), %rax
movslq 0x6c(%rax), %rdi
callq 0x1160
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x80(%rax)
jne 0xb49c
movl $0x7, %edi
leaq 0x12dfb(%rip), %rsi     # 0x1e278
leaq 0x135d0(%rip), %rdx     # 0x1ea54
movl $0x13d, %ecx            # imm = 0x13D
movb $0x0, %al
callq 0xf610
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb560
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0x6c(%rax), %rdx
xorl %esi, %esi
callq 0x1100
movq -0x10(%rbp), %rax
cmpl $0x0, 0x90(%rax)
jne 0xb4cf
movl $0x1, -0x4(%rbp)
jmp 0xb560
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x1040
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
movslq 0x6c(%rax), %rdi
shlq $0x2, %rdi
callq 0x1160
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x78(%rax)
jne 0xb53b
movl $0x7, %edi
leaq 0x12d59(%rip), %rsi     # 0x1e278
leaq 0x1352e(%rip), %rdx     # 0x1ea54
movl $0x14b, %ecx            # imm = 0x14B
movb $0x0, %al
callq 0xf610
movl $0x0, -0x4(%rbp)
jmp 0xb560
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0x6c(%rax), %rdx
shlq $0x2, %rdx
movl $0xff, %esi
callq 0x1100
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)