// File: /workspace/github_c_makefile_star2_O3/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 0x7fbe(%rip), %rdi      # 0xd423
leaq 0x7fca(%rip), %r15      # 0xd436
leaq 0x7bac(%rip), %rdx      # 0xd01f
leaq 0x7bab(%rip), %r14      # 0xd025
movq %r15, %rsi
movq %r13, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x20d0
movl $0x50, %edi
callq 0x2140
movq %rax, %rbx
movl $0xa, %edi
callq 0x6b58
movq %rax, 0x8(%rbx)
movl $0xa, %edi
callq 0x6b58
movq %rax, (%rbx)
movl $0xa, %edi
callq 0x6b58
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movups %xmm0, 0x28(%rbx)
movups %xmm0, 0x38(%rbx)
movq $0x0, 0x48(%rbx)
movq %r13, %rdi
movl %ebp, %esi
movq %r12, %rdx
movq %rbx, %rcx
callq 0xb780
movq %rax, %r12
movq %rdx, %r13
leaq 0x7f48(%rip), %rdi      # 0xd43c
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x20d0
leaq 0x876a(%rip), %rdi      # 0xdc72
leaq 0x7f72(%rip), %r15      # 0xd481
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x20d0
movsbl %r13b, %ecx
leaq 0x875d(%rip), %rdi      # 0xdc87
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x20d0
movq %r12, %rdi
callq 0x2030
movq 0x8(%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x558a
leaq 0x874b(%rip), %r14      # 0xdc9c
leaq 0x7ac1(%rip), %r15      # 0xd019
leaq 0x7ac6(%rip), %r12      # 0xd025
xorl %r13d, %r13d
movq %r13, %rsi
callq 0x6d0c
movq (%rax), %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x20d0
incq %r13
movq 0x8(%rbx), %rdi
cmpq 0x8(%rdi), %r13
jb 0x5562
movq (%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x55d3
leaq 0x871e(%rip), %r14      # 0xdcb9
leaq 0x7a77(%rip), %r15      # 0xd019
leaq 0x7a7c(%rip), %r12      # 0xd025
xorl %r13d, %r13d
movq %r13, %rsi
callq 0x6d0c
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x20d0
incq %r13
movq (%rbx), %rdi
cmpq 0x8(%rdi), %r13
jb 0x55ac
movq 0x10(%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x561e
leaq 0x86f1(%rip), %r14      # 0xdcd6
leaq 0x7a2d(%rip), %r15      # 0xd019
leaq 0x7a32(%rip), %r12      # 0xd025
xorl %r13d, %r13d
movq %r13, %rsi
callq 0x6d0c
movq (%rax), %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x20d0
incq %r13
movq 0x10(%rbx), %rdi
cmpq 0x8(%rdi), %r13
jb 0x55f6
movq 0x8(%rbx), %rdi
callq 0x6991
movq 0x10(%rbx), %rdi
callq 0x6953
movq (%rbx), %rdi
movl $0x1, %esi
callq 0x6d97
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030