// File: /workspace/github_c_makefile_star2_O1/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 0x8074(%rip), %rdi      # 0xd426
leaq 0x8080(%rip), %r15      # 0xd439
leaq 0x7c5f(%rip), %rdx      # 0xd01f
leaq 0x7c5e(%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 0x6ac8
movq %rax, 0x8(%rbx)
movl $0xa, %edi
callq 0x6ac8
movq %rax, (%rbx)
movl $0xa, %edi
callq 0x6ac8
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 0xb680
movq %rax, %r12
movq %rdx, %r13
leaq 0x7ffe(%rip), %rdi      # 0xd43f
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x20d0
leaq 0x8820(%rip), %rdi      # 0xdc75
leaq 0x8028(%rip), %r15      # 0xd484
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x20d0
movsbl %r13b, %ecx
leaq 0x8813(%rip), %rdi      # 0xdc8a
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 0x54d7
leaq 0x8801(%rip), %r14      # 0xdc9f
leaq 0x7b74(%rip), %r15      # 0xd019
leaq 0x7b79(%rip), %r12      # 0xd025
xorl %r13d, %r13d
movq %r13, %rsi
callq 0x6c76
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 0x54af
movq (%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x5520
leaq 0x87d4(%rip), %r14      # 0xdcbc
leaq 0x7b2a(%rip), %r15      # 0xd019
leaq 0x7b2f(%rip), %r12      # 0xd025
xorl %r13d, %r13d
movq %r13, %rsi
callq 0x6c76
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 0x54f9
movq 0x10(%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x556b
leaq 0x87a7(%rip), %r14      # 0xdcd9
leaq 0x7ae0(%rip), %r15      # 0xd019
leaq 0x7ae5(%rip), %r12      # 0xd025
xorl %r13d, %r13d
movq %r13, %rsi
callq 0x6c76
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 0x5543
movq 0x8(%rbx), %rdi
callq 0x68d7
movq 0x10(%rbx), %rdi
callq 0x6899
movq (%rbx), %rdi
movl $0x1, %esi
callq 0x6d0a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030