// File: /workspace/github_c_makefile_star2_O2/System-Glitch[P]ESGILinter-C/src/rules/parsing.c
// Function: parse_and_check
unsigned int parse_and_check(scope_t *root_scope, arraylist_t *file, arraylist_t *functions, arraylist_t *variables, arraylist_t *conf, arraylist_t *real_file) {

	type_t type;
	unsigned int result        = 0;
	unsigned int breaks        = 0;
	scope_t *scope             = NULL;
	char *line                 = NULL;
	char *message              = NULL;
	char *display              = NULL;
	function_t     *function   = NULL;
	field_t        *field      = NULL;
	invalid_call_t *call       = NULL;
	wrong_type_t   *wrong_type = NULL;
	line_t         *line_info  = NULL;
	messages_t     *messages   = malloc(sizeof(messages_t));

	if(messages == NULL) exit(1);

	if(root_scope->parent == NULL) {
		messages->functions_list = arraylist_init(root_scope->functions->size);
		messages->variables_list = arraylist_init(ARRAYLIST_DEFAULT_CAPACITY);
		fill_functions_list(root_scope, messages->functions_list);
		fill_variables_list(root_scope, messages->variables_list);
	} else {
		messages->functions_list = functions;
		messages->variables_list = variables;
	}

	for(int i = root_scope->from_line ; i <= root_scope->to_line ; i++) {
		scope = get_child_scope(root_scope, i);
		if(scope != root_scope) {
			if(i == scope->from_line) {
				result += parse_and_check(scope, file, messages->functions_list, messages->variables_list, conf, real_file);
			}
		} else {
			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        = arraylist_init(ARRAYLIST_DEFAULT_CAPACITY);
			messages->wrong_assignment     = arraylist_init(ARRAYLIST_DEFAULT_CAPACITY);
			messages->wrong_return         = arraylist_init(ARRAYLIST_DEFAULT_CAPACITY);
			messages->ternary_types        = arraylist_init(ARRAYLIST_DEFAULT_CAPACITY);
			messages->operator_spacing     = arraylist_init(ARRAYLIST_DEFAULT_CAPACITY);

			line_info = get_line(file, i);
			line = line_info->line;
			breaks = strcount_heading_line_breaks(line) + (line_info->start_real_line == 0 ? 1 : 0);
			type = parse_expression(line, i, scope, messages);
			if(!strcmp(type.name, "NULL")) {
				type = parse_operation(line, i, scope, messages);
			}

			if(conf == NULL || check_rule(conf, "undeclared-function")) {
				for(size_t j = 0 ; j < messages->undeclared_functions->size ; j++) {
					function = arraylist_get(messages->undeclared_functions, j);
					message = strconcat("Undeclared function: ", function->name);
					display = trim(arraylist_get(real_file, line_info->start_real_line + breaks - 1));
					print_error(line_info->source, line_info->start_real_line + breaks, display, message);
					free(display);
					free(message);
					result++;
				}
			}

			if(conf == NULL || check_rule(conf, "undeclared-variable")) {
				for(size_t j = 0 ; j < messages->undeclared_variables->size ; j++) {
					message = strconcat("Undeclared variable: ", arraylist_get(messages->undeclared_variables, j));
					display = trim(arraylist_get(real_file, line_info->start_real_line + breaks - 1));
					print_error(line_info->source, line_info->start_real_line + breaks, display, message);
					free(display);
					free(message);
					result++;
				}
			}

			if(conf == NULL || check_rule(conf, "arguments-count")) {
				for(size_t j = 0 ; j < messages->invalid_calls->size ; j++) {
					call = arraylist_get(messages->invalid_calls, j);
					message = strconcat(call->more > 0 ? "Too many arguments for function: " : "Too few arguments for function: ", call->name);
					display = trim(arraylist_get(real_file, line_info->start_real_line + breaks - 1));
					print_error(line_info->source, line_info->start_real_line + breaks, display, message);
					free(display);
					free(message);
					free(call->name);
					result++;
				}
			}

			if(conf == NULL || check_rule(conf, "function-parameters-type")) {
				for(size_t j = 0 ; j < messages->invalid_params->size ; j++) {
					field = arraylist_get(messages->invalid_params, j);
					message = strconcat("Invalid parameter type: ", field->name);
					display = trim(arraylist_get(real_file, line_info->start_real_line + breaks - 1));
					print_error(line_info->source, line_info->start_real_line + breaks, display, message);
					free(display);
					free(message);
					result++;
				}
			}

			if(conf == NULL || check_rule(conf, "variable-assignment-type")) {
				for(size_t j = 0 ; j < messages->wrong_assignment->size ; j++) {
					wrong_type = arraylist_get(messages->wrong_assignment, j);
					message = build_wrong_type_message(wrong_type, WRONG_TYPE_ASSIGNMENT);
					display = trim(arraylist_get(real_file, line_info->start_real_line + breaks - 1));
					print_error(line_info->source, line_info->start_real_line + breaks, display, message);
					free(display);
					free(message);
					result++;
				}
			}

			if(conf == NULL || check_rule(conf, "return-type")) {
				for(size_t j = 0 ; j < messages->wrong_return->size ; j++) {
					wrong_type = arraylist_get(messages->wrong_return, j);
					message = build_wrong_type_message(wrong_type, WRONG_TYPE_RETURN);
					display = trim(arraylist_get(real_file, line_info->start_real_line + breaks - 1));
					print_error(line_info->source, line_info->start_real_line + breaks, display, message);
					free(display);
					free(message);
					result++;
				}
			}

			if(conf == NULL || check_rule(conf, "ternary-types")) {
				for(size_t j = 0 ; j < messages->ternary_types->size ; j++) {
					wrong_type = arraylist_get(messages->ternary_types, j);
					message = build_wrong_type_message(wrong_type, WRONG_TYPE_TERNARY);
					display = trim(arraylist_get(real_file, line_info->start_real_line + breaks - 1));
					print_error(line_info->source, line_info->start_real_line + breaks, display, message);
					free(display);
					free(message);
					result++;
				}
			}

			if(conf == NULL || check_rule(conf, "operators-spacing")) {
				for(size_t j = 0 ; j < messages->operator_spacing->size ; j++) {
					message = strconcat("Missing operator spacing: ", arraylist_get(messages->operator_spacing, j));
					display = trim(arraylist_get(real_file, line_info->start_real_line + breaks - 1));
					print_warning(line_info->source, line_info->start_real_line + breaks, display, message);
					free(display);
					free(message);
					result++;
				}
			}

			function_list_free(messages->undeclared_functions);
			field_list_free(messages->invalid_params);
			arraylist_free(messages->undeclared_variables, 1);
			arraylist_free(messages->invalid_calls, 1);
			arraylist_free(messages->operator_spacing, 1);
			free_wrong_type_list(messages->wrong_assignment);
			free_wrong_type_list(messages->wrong_return);
			free_wrong_type_list(messages->ternary_types);
			free(type.name);

		}
		
	}

	if(root_scope->parent == NULL) {

		if(conf == NULL || check_rule(conf, "unused-variable")) {
			for(size_t j = 0 ; j < messages->variables_list->size ; j++) {
				field = arraylist_get(messages->variables_list, j);
				line_info = get_line(file, field->line);
				message = field->is_param ? strconcat("Unused parameter: ", field->name) : strconcat("Unused variable: ", field->name);
				breaks = strcount_heading_line_breaks(line_info->line) + (line_info->start_real_line == 0 ? 1 : 0);
				display = trim(arraylist_get(real_file, line_info->start_real_line + breaks - 1));
				print_warning(line_info->source, line_info->start_real_line + breaks, display, message);
				free(display);
				free(message);
				result++;
			}
		}

		if(conf == NULL || check_rule(conf, "unused-function")) {
			for(size_t j = 0 ; j < messages->functions_list->size ; j++) {
				function = arraylist_get(messages->functions_list, j);
				line_info = get_line(file, function->line);
				message = strconcat("Unused function: ", function->name);
				breaks = strcount_heading_line_breaks(line_info->line) + (line_info->start_real_line == 0 ? 1 : 0);
				display = trim(arraylist_get(real_file, line_info->start_real_line + breaks - 1));
				print_warning(line_info->source, line_info->start_real_line + breaks, display, message);
				free(display);
				free(message);
				result++;
			}
		}

		arraylist_free(messages->functions_list, 0);
		arraylist_free(messages->variables_list, 0);

		free(messages);
	}

	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x28(%rsp)
movq %r8, 0x20(%rsp)
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, 0x38(%rsp)
movq %rdi, %r12
pushq $0x50
popq %rdi
callq 0x2130
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0xa216
cmpq $0x0, (%r12)
movq %r12, 0x40(%rsp)
je 0x9841
movq 0x30(%rsp), %rax
movq %r15, 0x48(%rax)
movq %r14, 0x40(%rax)
movq %rax, %r14
jmp 0x98c6
movq 0x10(%r12), %rax
movl 0x8(%rax), %edi
callq 0x67e4
movq 0x30(%rsp), %r14
movq %rax, 0x48(%r14)
pushq $0xa
popq %rdi
callq 0x67e4
movq %rax, 0x40(%r14)
movq 0x48(%r14), %r15
xorl %r12d, %r12d
leaq 0x4fc5(%rip), %r13      # 0xe836
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rdi
cmpq 0x8(%rdi), %r12
jae 0x98b5
movq %r12, %rsi
callq 0x6978
cmpb $0x0, 0x18(%rax)
jne 0x98ab
movq %rax, %r14
movq (%rax), %rdi
movq %r13, %rsi
callq 0x2110
testl %eax, %eax
je 0x98ab
movq %r15, %rdi
movq %r14, %rsi
callq 0x68b5
incq %r12
movq 0x30(%rsp), %r14
jmp 0x9871
movq 0x40(%r14), %rsi
movq 0x40(%rsp), %r12
movq %r12, %rdi
callq 0xa21e
movl 0x20(%r12), %ebp
movq $0x0, 0x8(%rsp)
movq 0x20(%rsp), %rbx
movl 0x8(%rsp), %r15d
cmpl 0x28(%r12), %ebp
movq %r15, 0x48(%rsp)
jg 0xa030
movq %r12, %rdi
movl %ebp, %esi
callq 0x5f77
movq %rax, %r15
testq %rax, %rax
cmoveq %r12, %r15
cmpq %r12, %r15
je 0x9944
cmpl 0x20(%r15), %ebp
jne 0x9ab6
movq 0x40(%r14), %rcx
movq 0x48(%r14), %rdx
movq %r15, %rdi
movq 0x38(%rsp), %rsi
movq 0x20(%rsp), %rbx
movq %rbx, %r8
movq 0x28(%rsp), %r9
callq 0x97e4
movq 0x8(%rsp), %rcx
addl %eax, %ecx
movq %rcx, 0x8(%rsp)
jmp 0xa029
pushq $0xa
popq %rbx
movl %ebx, %edi
callq 0x67e4
movq %rax, 0x8(%r14)
movl %ebx, %edi
callq 0x67e4
movq %rax, (%r14)
movl %ebx, %edi
callq 0x67e4
movq %rax, 0x10(%r14)
movl %ebx, %edi
callq 0x67e4
movq %rax, 0x18(%r14)
movl %ebx, %edi
callq 0x67e4
movq %rax, 0x20(%r14)
movl %ebx, %edi
callq 0x67e4
movq %rax, 0x28(%r14)
movl %ebx, %edi
callq 0x67e4
movq %rax, 0x30(%r14)
movl %ebx, %edi
callq 0x67e4
movq %rax, 0x38(%r14)
movq 0x38(%rsp), %rdi
movl %ebp, %esi
callq 0x2a1e
movq %rax, %r12
movq %r14, %rbx
movq (%rax), %r14
movq %r14, %rdi
callq 0x7af0
cmpl $0x1, 0x10(%r12)
adcl $0x0, %eax
movq %rax, 0x18(%rsp)
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
movq %rbx, %rcx
callq 0xaf1c
movq %rax, %rbx
movq %rax, %rdi
leaq 0x4eca(%rip), %rsi      # 0xe8b0
callq 0x2110
testl %eax, %eax
jne 0x9a04
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
movq 0x30(%rsp), %rcx
callq 0x6ce0
movq %rax, %rbx
movq %rbx, 0x50(%rsp)
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
movq 0x30(%rsp), %r14
movl %ebp, 0x14(%rsp)
je 0x9a33
movq %rbx, %rdi
leaq 0x5023(%rip), %rsi      # 0xea49
callq 0x5eca
testb %al, %al
je 0x9adb
movq 0x18(%rsp), %rax
leal -0x1(%rax), %r13d
xorl %r15d, %r15d
leaq 0x5017(%rip), %rbx      # 0xea5d
movq 0x8(%r14), %rdi
cmpq 0x8(%rdi), %r15
jae 0x9ac0
movq %r15, %rsi
callq 0x6978
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x7bab
movq %rax, %r14
movl 0x10(%r12), %esi
addl %r13d, %esi
movq 0x28(%rsp), %rdi
callq 0x6978
movq %rax, %rdi
callq 0x7daf
movq %rax, %rbp
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x18(%rsp), %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x568d
movq %rbp, %rdi
callq 0x2030
movq %r14, %rdi
movq 0x30(%rsp), %r14
callq 0x2030
incq %r15
jmp 0x9a46
movq 0x20(%rsp), %rbx
jmp 0xa029
movq 0x48(%rsp), %rax
addq %r15, %rax
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x9afd
movq %rax, 0x8(%rsp)
movl 0x14(%rsp), %ebp
movq %rbx, %rdi
leaq 0x4f8e(%rip), %rsi      # 0xea73
callq 0x5eca
testb %al, %al
je 0x9b98
movq 0x18(%rsp), %rax
leal -0x1(%rax), %r13d
jmp 0x9b02
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
leaq 0x4f7b(%rip), %rbx      # 0xea87
movq (%r14), %rdi
cmpq 0x8(%rdi), %r15
jae 0x9b7b
movq %r15, %rsi
callq 0x6978
movq %rbx, %rdi
movq %rax, %rsi
callq 0x7bab
movq %rax, %r14
movl 0x10(%r12), %esi
addl %r13d, %esi
movq 0x28(%rsp), %rdi
callq 0x6978
movq %rax, %rdi
callq 0x7daf
movq %rax, %rbp
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x18(%rsp), %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x568d
movq %rbp, %rdi
callq 0x2030
movq %r14, %rdi
movq 0x30(%rsp), %r14
callq 0x2030
incq %r15
jmp 0x9b0c
movq 0x8(%rsp), %rax
movl %eax, %eax
addq %r15, %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x9bb8
movl 0x14(%rsp), %ebp
movq %rbx, %rdi
leaq 0x4efb(%rip), %rsi      # 0xea9d
callq 0x5eca
testb %al, %al
je 0x9c6f
movq 0x18(%rsp), %rax
leal -0x1(%rax), %r13d
xorl %r15d, %r15d
movq 0x18(%r14), %rdi
cmpq 0x8(%rdi), %r15
jae 0x9c52
movq %r15, %rsi
callq 0x6978
movq %rax, %rbp
cmpl $0x0, 0x8(%rax)
leaq 0x4ef0(%rip), %rdi      # 0xeacf
leaq 0x4ec7(%rip), %rax      # 0xeaad
cmovgq %rax, %rdi
movq (%rbp), %rsi
callq 0x7bab
movq %rax, %r14
movl 0x10(%r12), %esi
addl %r13d, %esi
movq 0x28(%rsp), %rdi
callq 0x6978
movq %rax, %rdi
callq 0x7daf
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x18(%rsp), %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x568d
movq %rbx, %rdi
callq 0x2030
movq %r14, %rdi
movq 0x30(%rsp), %r14
callq 0x2030
movq (%rbp), %rdi
callq 0x2030
incq %r15
jmp 0x9bbb
movq 0x8(%rsp), %rax
movl %eax, %eax
addq %r15, %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x9c8f
movl 0x14(%rsp), %ebp
movq %rbx, %rdi
leaq 0x4e77(%rip), %rsi      # 0xeaf0
callq 0x5eca
testb %al, %al
je 0x9d1e
movq 0x18(%rsp), %rax
leal -0x1(%rax), %r13d
xorl %r15d, %r15d
movq 0x10(%r14), %rdi
cmpq 0x8(%rdi), %r15
jae 0x9d01
movq %r15, %rsi
callq 0x6978
movq (%rax), %rsi
leaq 0x4e5b(%rip), %rdi      # 0xeb09
callq 0x7bab
movq %rax, %rbp
movl 0x10(%r12), %esi
addl %r13d, %esi
movq 0x28(%rsp), %rdi
callq 0x6978
movq %rax, %rdi
callq 0x7daf
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x18(%rsp), %esi
movq %rax, %rdx
movq %rbp, %rcx
callq 0x568d
movq %rbx, %rdi
callq 0x2030
movq %rbp, %rdi
callq 0x2030
incq %r15
jmp 0x9c92
movq 0x8(%rsp), %rax
movl %eax, %eax
addq %r15, %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x9d3e
movl 0x14(%rsp), %ebp
movq %rbx, %rdi
leaq 0x4dfa(%rip), %rsi      # 0xeb22
callq 0x5eca
testb %al, %al
je 0x9dc8
movq 0x18(%rsp), %rax
leal -0x1(%rax), %r13d
xorl %r15d, %r15d
movq 0x20(%r14), %rdi
cmpq 0x8(%rdi), %r15
jae 0x9dab
movq %r15, %rsi
callq 0x6978
movq %rax, %rdi
xorl %esi, %esi
callq 0xa27b
movq %rax, %rbp
movl 0x10(%r12), %esi
addl %r13d, %esi
movq 0x28(%rsp), %rdi
callq 0x6978
movq %rax, %rdi
callq 0x7daf
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x18(%rsp), %esi
movq %rax, %rdx
movq %rbp, %rcx
callq 0x568d
movq %rbx, %rdi
callq 0x2030
movq %rbp, %rdi
callq 0x2030
incq %r15
jmp 0x9d41
movq 0x8(%rsp), %rax
movl %eax, %eax
addq %r15, %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x9de8
movl 0x14(%rsp), %ebp
movq %rbx, %rdi
leaq 0x4d69(%rip), %rsi      # 0xeb3b
callq 0x5eca
testb %al, %al
je 0x9e73
movq 0x18(%rsp), %rax
leal -0x1(%rax), %r13d
xorl %r15d, %r15d
movq 0x28(%r14), %rdi
cmpq 0x8(%rdi), %r15
jae 0x9e56
movq %r15, %rsi
callq 0x6978
movq %rax, %rdi
pushq $0x1
popq %rsi
callq 0xa27b
movq %rax, %rbp
movl 0x10(%r12), %esi
addl %r13d, %esi
movq 0x28(%rsp), %rdi
callq 0x6978
movq %rax, %rdi
callq 0x7daf
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x18(%rsp), %esi
movq %rax, %rdx
movq %rbp, %rcx
callq 0x568d
movq %rbx, %rdi
callq 0x2030
movq %rbp, %rdi
callq 0x2030
incq %r15
jmp 0x9deb
movq 0x8(%rsp), %rax
movl %eax, %eax
addq %r15, %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x9e93
movl 0x14(%rsp), %ebp
movq %rbx, %rdi
leaq 0x4cca(%rip), %rsi      # 0xeb47
callq 0x5eca
testb %al, %al
je 0x9f1e
movq 0x18(%rsp), %rax
leal -0x1(%rax), %r13d
xorl %r15d, %r15d
movq 0x30(%r14), %rdi
cmpq 0x8(%rdi), %r15
jae 0x9f01
movq %r15, %rsi
callq 0x6978
movq %rax, %rdi
pushq $0x2
popq %rsi
callq 0xa27b
movq %rax, %rbp
movl 0x10(%r12), %esi
addl %r13d, %esi
movq 0x28(%rsp), %rdi
callq 0x6978
movq %rax, %rdi
callq 0x7daf
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x18(%rsp), %esi
movq %rax, %rdx
movq %rbp, %rcx
callq 0x568d
movq %rbx, %rdi
callq 0x2030
movq %rbp, %rdi
callq 0x2030
incq %r15
jmp 0x9e96
movq 0x8(%rsp), %rax
movl %eax, %eax
addq %r15, %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x9f3e
movl 0x14(%rsp), %ebp
movq %rbx, %rdi
leaq 0x4c2d(%rip), %rsi      # 0xeb55
callq 0x5eca
testb %al, %al
je 0x9fc6
movq 0x18(%rsp), %rax
leal -0x1(%rax), %r13d
xorl %r15d, %r15d
movq 0x38(%r14), %rdi
cmpq 0x8(%rdi), %r15
jae 0x9fb0
movq %r15, %rsi
callq 0x6978
leaq 0x4c0d(%rip), %rdi      # 0xeb67
movq %rax, %rsi
callq 0x7bab
movq %rax, %rbp
movl 0x10(%r12), %esi
addl %r13d, %esi
movq 0x28(%rsp), %rdi
callq 0x6978
movq %rax, %rdi
callq 0x7daf
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x18(%rsp), %esi
movq %rax, %rdx
movq %rbp, %rcx
callq 0x560c
movq %rbx, %rdi
callq 0x2030
movq %rbp, %rdi
callq 0x2030
incq %r15
jmp 0x9f41
movq 0x8(%rsp), %rax
addl %r15d, %eax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rbx
movl 0x14(%rsp), %ebp
movq 0x8(%r14), %rdi
callq 0x6641
movq 0x10(%r14), %rdi
callq 0x6605
movq (%r14), %rdi
pushq $0x1
popq %r15
movl %r15d, %esi
callq 0x69f4
movq 0x18(%r14), %rdi
movl %r15d, %esi
callq 0x69f4
movq 0x38(%r14), %rdi
movl %r15d, %esi
callq 0x69f4
movq 0x20(%r14), %rdi
callq 0xa361
movq 0x28(%r14), %rdi
callq 0xa361
movq 0x30(%r14), %rdi
callq 0xa361
movq 0x50(%rsp), %rdi
callq 0x2030
movq 0x40(%rsp), %r12
incl %ebp
jmp 0x98d9
cmpq $0x0, (%r12)
jne 0xa202
testq %rbx, %rbx
je 0xa057
leaq 0x4b3b(%rip), %rsi      # 0xeb82
movq %rbx, %rdi
callq 0x5eca
testb %al, %al
je 0xa11b
xorl %r15d, %r15d
movq 0x40(%r14), %rdi
cmpq 0x8(%rdi), %r15
jae 0xa104
movq %r15, %rsi
callq 0x6978
movq %rax, %rbx
movl 0x20(%rax), %esi
movq 0x38(%rsp), %rdi
callq 0x2a1e
movq %rax, %r13
cmpb $0x0, 0x24(%rbx)
movq (%rbx), %rsi
leaq 0x4b01(%rip), %rdi      # 0xeb92
leaq 0x4b0d(%rip), %rax      # 0xeba5
cmoveq %rax, %rdi
callq 0x7bab
movq %rax, %r12
movq (%r13), %rdi
callq 0x7af0
movl %eax, %ebx
movl 0x10(%r13), %ebp
movl %ebp, %esi
subl $0x1, %esi
adcl %eax, %esi
movq 0x28(%rsp), %rdi
callq 0x6978
movq %rax, %rdi
callq 0x7daf
movq %rax, %r14
cmpl $0x1, %ebp
movq 0x8(%r13), %rdi
adcl 0x10(%r13), %ebx
movl %ebx, %esi
movq %rax, %rdx
movq %r12, %rcx
callq 0x560c
movq %r14, %rdi
movq 0x30(%rsp), %r14
callq 0x2030
movq %r12, %rdi
callq 0x2030
incq %r15
jmp 0xa05a
movq 0x48(%rsp), %rax
addq %r15, %rax
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0xa137
movq %rax, 0x8(%rsp)
leaq 0x4a95(%rip), %rsi      # 0xebb7
movq %rbx, %rdi
callq 0x5eca
testb %al, %al
jne 0xa13c
movq 0x48(%r14), %rdi
jmp 0xa1e8
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
movq 0x48(%r14), %rdi
cmpq 0x8(%rdi), %r15
jae 0xa1db
movq %r15, %rsi
callq 0x6978
movq %rax, %rbx
movl 0x28(%rax), %esi
movq 0x38(%rsp), %rdi
callq 0x2a1e
movq %rax, %rbp
movq (%rbx), %rsi
leaq 0x4a55(%rip), %rdi      # 0xebc7
callq 0x7bab
movq %rax, %r13
movq (%rbp), %rdi
callq 0x7af0
movl %eax, %ebx
movl 0x10(%rbp), %r12d
movl %r12d, %esi
subl $0x1, %esi
adcl %eax, %esi
movq 0x28(%rsp), %rdi
callq 0x6978
movq %rax, %rdi
callq 0x7daf
movq %rax, %r14
cmpl $0x1, %r12d
movq 0x8(%rbp), %rdi
adcl 0x10(%rbp), %ebx
movl %ebx, %esi
movq %rax, %rdx
movq %r13, %rcx
callq 0x560c
movq %r14, %rdi
movq 0x30(%rsp), %r14
callq 0x2030
movq %r13, %rdi
callq 0x2030
incq %r15
jmp 0xa13f
movq 0x8(%rsp), %rax
addl %r15d, %eax
movq %rax, 0x8(%rsp)
xorl %esi, %esi
callq 0x69f4
movq 0x40(%r14), %rdi
xorl %esi, %esi
callq 0x69f4
movq %r14, %rdi
callq 0x2030
movq 0x8(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rdi
callq 0x2190