// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq %r8, 0x28(%rsp)
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movl $0x50, %edi
callq 0x2140
testq %rax, %rax
je 0xa9a8
movq %rax, %rbp
cmpq $0x0, (%r13)
movq %rax, 0x18(%rsp)
movq %r12, 0x38(%rsp)
movq %r13, 0x48(%rsp)
je 0x9eba
movq %r15, 0x48(%rbp)
movq %r14, 0x40(%rbp)
movq %r13, %r14
jmp 0x9f4c
movq 0x10(%r13), %rax
movl 0x8(%rax), %edi
callq 0x6b58
movq %rax, 0x48(%rbp)
movl $0xa, %edi
callq 0x6b58
movq %rax, 0x40(%rbp)
movq 0x10(%r13), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x9f3e
movq 0x48(%rbp), %r15
xorl %r12d, %r12d
leaq 0x4945(%rip), %r13      # 0xe836
movq %r12, %rsi
callq 0x6d0c
cmpb $0x0, 0x18(%rax)
jne 0x9f1c
movq %rax, %r14
movq (%rax), %rdi
movq %r13, %rsi
callq 0x2120
testl %eax, %eax
je 0x9f1c
movq %r15, %rdi
movq %r14, %rsi
callq 0x6c26
incq %r12
movq 0x48(%rsp), %r14
movq 0x10(%r14), %rdi
cmpq 0x8(%rdi), %r12
jb 0x9ef1
movq 0x18(%rsp), %rbp
movq 0x40(%rbp), %rax
movq 0x38(%rsp), %r12
jmp 0x9f41
movq %r13, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0xa9b2
movl 0x20(%r14), %r15d
movq $0x0, 0x10(%rsp)
cmpl 0x28(%r14), %r15d
jg 0xa79f
movq $0x0, 0x10(%rsp)
movq %rbx, 0x20(%rsp)
movq %r14, %rdi
movl %r15d, %esi
callq 0x61fc
movq %rax, %rbp
testq %rax, %rax
cmoveq %r14, %rbp
cmpq %r14, %rbp
je 0x9fd2
cmpl 0x20(%rbp), %r15d
movq %r15, %rsi
jne 0xa195
movq 0x18(%rsp), %r15
movq 0x40(%r15), %rcx
movq 0x48(%r15), %rdx
movq %rbp, %rdi
movq %r15, %rbp
movq %rsi, %r15
movq %r12, %rsi
movq 0x28(%rsp), %r8
movq %rbx, %r9
callq 0x9e5c
movq %r15, %rsi
movq 0x10(%rsp), %rcx
addl %eax, %ecx
movq %rcx, 0x10(%rsp)
jmp 0xa78f
movl $0xa, %edi
callq 0x6b58
movq 0x18(%rsp), %r13
movq %rax, 0x8(%r13)
movl $0xa, %edi
callq 0x6b58
movq %rax, (%r13)
movl $0xa, %edi
callq 0x6b58
movq %rax, 0x10(%r13)
movl $0xa, %edi
callq 0x6b58
movq %rax, 0x18(%r13)
movl $0xa, %edi
callq 0x6b58
movq %rax, 0x20(%r13)
movl $0xa, %edi
callq 0x6b58
movq %rax, 0x28(%r13)
movl $0xa, %edi
callq 0x6b58
movq %rax, 0x30(%r13)
movl $0xa, %edi
callq 0x6b58
movq %rax, 0x38(%r13)
movq %r12, %rdi
movl %r15d, %esi
callq 0x2a78
movq %rax, %r12
movq (%rax), %r14
movq %r14, %rdi
callq 0x7f5c
cmpl $0x1, 0x10(%r12)
adcl $0x0, %eax
movq %rax, 0x30(%rsp)
movq %r14, %rdi
movq %r15, 0x40(%rsp)
movl %r15d, %esi
movq %rbp, %rdx
movq %r13, %rcx
callq 0xb780
movq %rax, %r15
movq %rax, %rdi
leaq 0x481f(%rip), %rsi      # 0xe8b0
callq 0x2120
testl %eax, %eax
jne 0xa0b2
movq %r14, %rdi
movq 0x40(%rsp), %rsi
movq %rbp, %rdx
movq 0x18(%rsp), %rcx
callq 0x70b0
movq %rax, %r15
movq %r15, 0x50(%rsp)
movq 0x28(%rsp), %r15
testq %r15, %r15
movq 0x10(%rsp), %r14
movq 0x30(%rsp), %r13
je 0xa0e2
movq %r15, %rdi
leaq 0x4974(%rip), %rsi      # 0xea49
callq 0x6142
testb %al, %al
je 0xa19f
movq 0x18(%rsp), %rbp
movq 0x8(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa18e
leal -0x1(%r13), %eax
movl %eax, 0xc(%rsp)
movq %rbp, %r13
xorl %ebp, %ebp
leaq 0x4953(%rip), %rbx      # 0xea5d
movq %rbp, %rsi
callq 0x6d0c
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x8026
movq %rax, %r15
movl 0x10(%r12), %esi
addl 0xc(%rsp), %esi
movq 0x20(%rsp), %rdi
callq 0x6d0c
movq %rax, %rdi
callq 0x8239
movq %rax, %r14
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x30(%rsp), %esi
movq %rax, %rdx
movq %r15, %rcx
callq 0x58dd
movq %r14, %rdi
callq 0x2030
movq %r15, %rdi
callq 0x2030
incq %rbp
movq 0x8(%r13), %rdi
cmpq 0x8(%rdi), %rbp
jb 0xa10a
movq 0x10(%rsp), %r14
addl %ebp, %r14d
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r15
movq %r13, %rbp
movq 0x30(%rsp), %r13
testq %r15, %r15
jne 0xa1a4
jmp 0xa1bb
movq 0x18(%rsp), %rbp
jmp 0xa78f
movq 0x18(%rsp), %rbp
movq %r15, %rdi
leaq 0x48c5(%rip), %rsi      # 0xea73
callq 0x6142
testb %al, %al
je 0xa269
movq (%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa264
movq %r14, 0x10(%rsp)
leal -0x1(%r13), %ebx
xorl %ebp, %ebp
leaq 0x48ab(%rip), %r13      # 0xea87
movq %rbp, %rsi
callq 0x6d0c
movq %r13, %rdi
movq %rax, %rsi
callq 0x8026
movq %rax, %r15
movl 0x10(%r12), %esi
addl %ebx, %esi
movq 0x20(%rsp), %rdi
callq 0x6d0c
movq %rax, %rdi
callq 0x8239
movq %rax, %r14
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x30(%rsp), %esi
movq %rax, %rdx
movq %r15, %rcx
callq 0x58dd
movq %r14, %rdi
callq 0x2030
movq %r15, %rdi
callq 0x2030
incq %rbp
movq 0x18(%rsp), %rax
movq (%rax), %rdi
cmpq 0x8(%rdi), %rbp
jb 0xa1dc
movq 0x10(%rsp), %r14
addl %ebp, %r14d
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r15
movq 0x18(%rsp), %rbp
movq 0x30(%rsp), %r13
testq %r15, %r15
je 0xa280
movq %r15, %rdi
leaq 0x482a(%rip), %rsi      # 0xea9d
callq 0x6142
testb %al, %al
je 0xa351
movq 0x18(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa34c
movq %r14, 0x10(%rsp)
leal -0x1(%r13), %eax
movl %eax, 0xc(%rsp)
xorl %ebp, %ebp
leaq 0x482a(%rip), %r13      # 0xeacf
movq %rbp, %rsi
callq 0x6d0c
movq %rax, %r15
cmpl $0x0, 0x8(%rax)
movq %r13, %rdi
leaq 0x47ef(%rip), %rax      # 0xeaad
cmovgq %rax, %rdi
movq (%r15), %rsi
callq 0x8026
movq %rax, %r14
movl 0x10(%r12), %esi
addl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0x6d0c
movq %rax, %rdi
callq 0x8239
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x30(%rsp), %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x58dd
movq %rbx, %rdi
movq 0x20(%rsp), %rbx
callq 0x2030
movq %r14, %rdi
callq 0x2030
movq (%r15), %rdi
callq 0x2030
incq %rbp
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
cmpq 0x8(%rdi), %rbp
jb 0xa2a5
movq 0x10(%rsp), %r14
addl %ebp, %r14d
movq 0x18(%rsp), %rbp
movq 0x28(%rsp), %r15
movq 0x30(%rsp), %r13
testq %r15, %r15
je 0xa368
movq %r15, %rdi
leaq 0x4795(%rip), %rsi      # 0xeaf0
callq 0x6142
testb %al, %al
je 0xa417
movq 0x10(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa412
movq %r14, 0x10(%rsp)
leal -0x1(%r13), %eax
movl %eax, 0xc(%rsp)
movq %rbp, %r13
xorl %ebp, %ebp
leaq 0x4779(%rip), %r15      # 0xeb09
movq %rbp, %rsi
callq 0x6d0c
movq (%rax), %rsi
movq %r15, %rdi
callq 0x8026
movq %rax, %r14
movl 0x10(%r12), %esi
addl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0x6d0c
movq %rax, %rdi
callq 0x8239
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl 0x30(%rsp), %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x58dd
movq %rbx, %rdi
movq 0x20(%rsp), %rbx
callq 0x2030
movq %r14, %rdi
callq 0x2030
incq %rbp
movq 0x10(%r13), %rdi
cmpq 0x8(%rdi), %rbp
jb 0xa390
movq 0x10(%rsp), %r14
addl %ebp, %r14d
movq 0x28(%rsp), %r15
movq %r13, %rbp
movq 0x30(%rsp), %r13
testq %r15, %r15
je 0xa42e
movq %r15, %rdi
leaq 0x4701(%rip), %rsi      # 0xeb22
callq 0x6142
testb %al, %al
je 0xa4d8
movq 0x20(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa4d3
movq %r14, 0x10(%rsp)
leal -0x1(%r13), %eax
movl %eax, 0xc(%rsp)
movq %r13, %r15
movq %rbp, %r13
xorl %ebp, %ebp
movq %rbp, %rsi
callq 0x6d0c
movq %rax, %rdi
xorl %esi, %esi
callq 0xaa1a
movq %rax, %r14
movl 0x10(%r12), %esi
addl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0x6d0c
movq %rax, %rdi
callq 0x8239
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl %r15d, %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x58dd
movq %rbx, %rdi
movq 0x20(%rsp), %rbx
callq 0x2030
movq %r14, %rdi
callq 0x2030
incq %rbp
movq 0x20(%r13), %rdi
cmpq 0x8(%rdi), %rbp
jb 0xa452
movq 0x10(%rsp), %r14
addl %ebp, %r14d
movq 0x28(%rsp), %rax
movq %r13, %rbp
movq %r15, %r13
movq %rax, %r15
testq %r15, %r15
je 0xa4ef
movq %r15, %rdi
leaq 0x4659(%rip), %rsi      # 0xeb3b
callq 0x6142
testb %al, %al
je 0xa59c
movq 0x28(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa597
movq %r14, 0x10(%rsp)
leal -0x1(%r13), %eax
movl %eax, 0xc(%rsp)
movq %r13, %r15
movq %rbp, %r13
xorl %ebp, %ebp
movq %rbp, %rsi
callq 0x6d0c
movq %rax, %rdi
movl $0x1, %esi
callq 0xaa1a
movq %rax, %r14
movl 0x10(%r12), %esi
addl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0x6d0c
movq %rax, %rdi
callq 0x8239
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl %r15d, %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x58dd
movq %rbx, %rdi
movq 0x20(%rsp), %rbx
callq 0x2030
movq %r14, %rdi
callq 0x2030
incq %rbp
movq 0x28(%r13), %rdi
cmpq 0x8(%rdi), %rbp
jb 0xa513
movq 0x10(%rsp), %r14
addl %ebp, %r14d
movq 0x28(%rsp), %rax
movq %r13, %rbp
movq %r15, %r13
movq %rax, %r15
testq %r15, %r15
je 0xa5b3
movq %r15, %rdi
leaq 0x45a1(%rip), %rsi      # 0xeb47
callq 0x6142
testb %al, %al
je 0xa660
movq 0x30(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa65b
movq %r14, 0x10(%rsp)
leal -0x1(%r13), %eax
movl %eax, 0xc(%rsp)
movq %r13, %r15
movq %rbp, %r13
xorl %ebp, %ebp
movq %rbp, %rsi
callq 0x6d0c
movq %rax, %rdi
movl $0x2, %esi
callq 0xaa1a
movq %rax, %r14
movl 0x10(%r12), %esi
addl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0x6d0c
movq %rax, %rdi
callq 0x8239
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl %r15d, %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x58dd
movq %rbx, %rdi
movq 0x20(%rsp), %rbx
callq 0x2030
movq %r14, %rdi
callq 0x2030
incq %rbp
movq 0x30(%r13), %rdi
cmpq 0x8(%rdi), %rbp
jb 0xa5d7
movq 0x10(%rsp), %r14
addl %ebp, %r14d
movq 0x28(%rsp), %rax
movq %r13, %rbp
movq %r15, %r13
movq %rax, %r15
testq %r15, %r15
je 0xa677
movq %r15, %rdi
leaq 0x44eb(%rip), %rsi      # 0xeb55
callq 0x6142
testb %al, %al
je 0xa71a
movq 0x38(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa71a
movq %r14, 0x10(%rsp)
leal -0x1(%r13), %eax
movl %eax, 0xc(%rsp)
xorl %ebp, %ebp
leaq 0x44cb(%rip), %r15      # 0xeb67
movq %rbp, %rsi
callq 0x6d0c
movq %r15, %rdi
movq %rax, %rsi
callq 0x8026
movq %rax, %r14
movl 0x10(%r12), %esi
addl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0x6d0c
movq %rax, %rdi
callq 0x8239
movq %rax, %rbx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
addl %r13d, %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x585c
movq %rbx, %rdi
movq 0x20(%rsp), %rbx
callq 0x2030
movq %r14, %rdi
callq 0x2030
incq %rbp
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rdi
cmpq 0x8(%rdi), %rbp
jb 0xa69c
movq 0x10(%rsp), %r14
addl %ebp, %r14d
movq 0x18(%rsp), %rbp
movq %r14, 0x10(%rsp)
movq 0x8(%rbp), %rdi
callq 0x6991
movq 0x10(%rbp), %rdi
callq 0x6953
movq (%rbp), %rdi
movl $0x1, %esi
callq 0x6d97
movq 0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x6d97
movq 0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x6d97
movq 0x20(%rbp), %rdi
callq 0xaaf8
movq 0x28(%rbp), %rdi
callq 0xaaf8
movq 0x30(%rbp), %rdi
callq 0xaaf8
movq 0x50(%rsp), %rdi
callq 0x2030
movq 0x38(%rsp), %r12
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %r14
leal 0x1(%rsi), %eax
cmpl 0x28(%r14), %esi
movl %eax, %r15d
jl 0x9f71
cmpq $0x0, (%r14)
je 0xa7af
movq 0x10(%rsp), %r14
jmp 0xa996
movq 0x28(%rsp), %r15
testq %r15, %r15
movq 0x10(%rsp), %r14
movq %rbx, 0x20(%rsp)
je 0xa7da
leaq 0x43b8(%rip), %rsi      # 0xeb82
movq %r15, %rdi
callq 0x6142
testb %al, %al
je 0xa8a6
movq 0x40(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa8a1
xorl %r15d, %r15d
movq %r15, %rsi
callq 0x6d0c
movq %rax, %rbx
movl 0x20(%rax), %esi
movq %r12, %rdi
callq 0x2a78
movq %rax, %r13
cmpb $0x0, 0x24(%rbx)
movq (%rbx), %rsi
leaq 0x437f(%rip), %rdi      # 0xeb92
leaq 0x438b(%rip), %rax      # 0xeba5
cmoveq %rax, %rdi
callq 0x8026
movq %rax, %r12
movq (%r13), %rdi
callq 0x7f5c
movl %eax, %ebx
movl 0x10(%r13), %ebp
movl %ebp, %esi
subl $0x1, %esi
adcl %eax, %esi
movq 0x20(%rsp), %rdi
callq 0x6d0c
movq %rax, %rdi
callq 0x8239
movq %rax, %r14
cmpl $0x1, %ebp
movq 0x8(%r13), %rdi
adcl 0x10(%r13), %ebx
movq 0x18(%rsp), %rbp
movl %ebx, %esi
movq %rax, %rdx
movq %r12, %rcx
callq 0x585c
movq %r14, %rdi
callq 0x2030
movq %r12, %rdi
movq 0x38(%rsp), %r12
callq 0x2030
incq %r15
movq 0x40(%rbp), %rdi
cmpq 0x8(%rdi), %r15
jb 0xa7ec
movq 0x10(%rsp), %r14
addl %r15d, %r14d
movq 0x28(%rsp), %r15
testq %r15, %r15
je 0xa8bd
leaq 0x430a(%rip), %rsi      # 0xebb7
movq %r15, %rdi
callq 0x6142
testb %al, %al
je 0xa978
movq 0x48(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa97c
movq %r14, 0x10(%rsp)
xorl %r15d, %r15d
movq %r15, %rsi
callq 0x6d0c
movq %rax, %rbx
movl 0x28(%rax), %esi
movq %r12, %rdi
callq 0x2a78
movq %rax, %rbp
movq (%rbx), %rsi
leaq 0x42d0(%rip), %rdi      # 0xebc7
callq 0x8026
movq %rax, %r13
movq (%rbp), %rdi
callq 0x7f5c
movl %eax, %ebx
movl 0x10(%rbp), %r12d
movl %r12d, %esi
subl $0x1, %esi
adcl %eax, %esi
movq 0x20(%rsp), %rdi
callq 0x6d0c
movq %rax, %rdi
callq 0x8239
movq %rax, %r14
cmpl $0x1, %r12d
movq 0x38(%rsp), %r12
movq 0x8(%rbp), %rdi
adcl 0x10(%rbp), %ebx
movl %ebx, %esi
movq %rax, %rdx
movq %r13, %rcx
callq 0x585c
movq %r14, %rdi
callq 0x2030
movq %r13, %rdi
movq 0x18(%rsp), %rbp
callq 0x2030
incq %r15
movq 0x48(%rbp), %rdi
cmpq 0x8(%rdi), %r15
jb 0xa8d4
movq 0x10(%rsp), %r14
addl %r15d, %r14d
jmp 0xa97c
movq 0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x6d97
movq 0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x6d97
movq %rbp, %rdi
callq 0x2030
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x21a0