// File: /workspace/github_c_makefile_star2_O2/System-Glitch[P]ESGILinter-C/src/test.c
// Function: test_expression
static void test_expression(char *line, unsigned int line_index, scope_t *scope) {
	printf("%sInput: %s\"%s\"%s\n", COLOR_BLUE, COLOR_YELLOW, line, FORMAT_RESET);

	messages_t *messages = malloc(sizeof(messages_t));
	messages->undeclared_functions = arraylist_init(ARRAYLIST_DEFAULT_CAPACITY);
	messages->undeclared_variables = arraylist_init(ARRAYLIST_DEFAULT_CAPACITY);
	messages->invalid_params       = arraylist_init(ARRAYLIST_DEFAULT_CAPACITY);
	messages->invalid_calls        = NULL;
	messages->variables_list       = NULL;
	messages->functions_list       = NULL;
	messages->wrong_assignment     = NULL;
	messages->wrong_return         = NULL;
	messages->ternary_types        = NULL;
	messages->operator_spacing     = NULL;
	type_t type = parse_expression(line, line_index, scope, messages);
	printf("%sOutput: %s\n", COLOR_BLUE, FORMAT_RESET);
	printf("\t%sType:       %s%s\n", COLOR_CYAN, FORMAT_RESET, type.name);
	printf("\t%sIs pointer: %s%d\n", COLOR_CYAN, FORMAT_RESET, type.is_pointer);

	free(type.name);

	for(size_t i = 0 ; i < messages->undeclared_functions->size ; i++) {
		printf("\t%sUndefined function: %s%s\n", COLOR_RED, FORMAT_RESET, ((function_t*)arraylist_get(messages->undeclared_functions, i))->name);
	}

	for(size_t i = 0 ; i < messages->undeclared_variables->size ; i++) {
		printf("\t%sUndefined variable: %s%s\n", COLOR_RED, FORMAT_RESET, (char*)arraylist_get(messages->undeclared_variables, i));
	}

	for(size_t i = 0 ; i < messages->invalid_params->size ; i++) {
		printf("\t%sInvalid param: %s%s\n", COLOR_RED, FORMAT_RESET, ((field_t*)arraylist_get(messages->invalid_params, i))->name);
	}

	function_list_free(messages->undeclared_functions);
	field_list_free(messages->invalid_params);
	arraylist_free(messages->undeclared_variables, 1);
	free(messages);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r13
leaq 0x81bb(%rip), %rdi      # 0xd423
leaq 0x81c7(%rip), %rsi      # 0xd436
leaq 0x7da9(%rip), %rdx      # 0xd01f
leaq 0x7da8(%rip), %r14      # 0xd025
movq %r13, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x20d0
pushq $0x50
popq %rdi
callq 0x2130
movq %rax, %rbx
pushq $0xa
popq %r15
movl %r15d, %edi
callq 0x67e4
movq %rax, 0x8(%rbx)
movl %r15d, %edi
callq 0x67e4
movq %rax, (%rbx)
movl %r15d, %edi
callq 0x67e4
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movups %xmm0, 0x28(%rbx)
movups %xmm0, 0x38(%rbx)
andq $0x0, 0x48(%rbx)
movq %r13, %rdi
movl %ebp, %esi
movq %r12, %rdx
movq %rbx, %rcx
callq 0xaf1c
movq %rax, %r12
movq %rdx, %r15
leaq 0x814f(%rip), %rdi      # 0xd43c
leaq 0x8142(%rip), %rsi      # 0xd436
movq %r14, %rdx
xorl %eax, %eax
callq 0x20d0
leaq 0x896d(%rip), %rdi      # 0xdc72
leaq 0x8175(%rip), %r13      # 0xd481
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x20d0
movsbl %r15b, %ecx
leaq 0x8960(%rip), %rdi      # 0xdc87
movq %r13, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x20d0
movq %r12, %rdi
callq 0x2030
leaq 0x8959(%rip), %r15      # 0xdc9c
leaq 0x7ccf(%rip), %r12      # 0xd019
xorl %r13d, %r13d
movq 0x8(%rbx), %rdi
cmpq 0x8(%rdi), %r13
jae 0x5377
movq %r13, %rsi
callq 0x6978
movq (%rax), %rcx
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x20d0
incq %r13
jmp 0x534d
leaq 0x893b(%rip), %r14      # 0xdcb9
leaq 0x7c94(%rip), %r15      # 0xd019
leaq 0x7c99(%rip), %r12      # 0xd025
xorl %r13d, %r13d
movq (%rbx), %rdi
cmpq 0x8(%rdi), %r13
jae 0x53b8
movq %r13, %rsi
callq 0x6978
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x20d0
incq %r13
jmp 0x538f
leaq 0x8917(%rip), %r14      # 0xdcd6
leaq 0x7c53(%rip), %r15      # 0xd019
leaq 0x7c58(%rip), %r12      # 0xd025
xorl %r13d, %r13d
movq 0x10(%rbx), %rdi
cmpq 0x8(%rdi), %r13
jae 0x53fa
movq %r13, %rsi
callq 0x6978
movq (%rax), %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x20d0
incq %r13
jmp 0x53d0
movq 0x8(%rbx), %rdi
callq 0x6641
movq 0x10(%rbx), %rdi
callq 0x6605
movq (%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x69f4
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030