<commit_before>#include <stdlib.h>

#include "function.h"
#include "datastructs.h"

function* init_function (function* to_init, unsigned int start_addr)
{
	to_init->start_addr = start_addr;
	next_flags = 0;

	//The following is code meant for the spider disassembler (currently inoperational)
	//See spider.c
	jump_block* root;
	jump_block* current;
	jump_block* temp;

	root = init_jump_block (malloc (sizeof (jump_block)), start_addr);
	current = root;

	//Find all jump blocks
	while (num_push_ebp != 2)
	{
		temp = init_jump_block (malloc (sizeof (jump_block)), current->end);
		link (current, temp);
		current = current->next;
	}
	num_push_ebp = 0;

	//Get jump addresses
	to_init->num_jump_addrs = 0;
	to_init->jump_addrs_buf_size = 8 * sizeof (unsigned int);
	to_init->jump_addrs = malloc (to_init->jump_addrs_buf_size);
	to_init->orig_addrs = malloc (to_init->jump_addrs_buf_size);
	list_loop (resolve_jumps, root, root, to_init);

	//Memory management for "}" placement algorithms
	to_init->num_dups = 0;
	to_init->dup_targets_buf_size = 8 * sizeof (unsigned int);
	to_init->dup_targets = malloc (to_init->dup_targets_buf_size);
	to_init->else_starts = malloc (to_init->dup_targets_buf_size);
	to_init->pivots = malloc (to_init->dup_targets_buf_size);

	//Split jump blocks 
	struct search_params params;
	int i;

	for (i = 0; i < to_init->num_jump_addrs; i ++)
	{
		current = NULL;
		params.ret = (void**)&current;
		params.key = to_init->jump_addrs [i];
		list_loop (search_start_addrs, root, root, params);
	
		if (!current)
		{
			printf ("Error: invalid jump instruction at %p\n", to_init->orig_addrs [i]);
			exit (1);
		}
	
		split_jump_blocks (current, params.key);
	}

	to_init->jump_block_list = root;

	//Free some memory for the time being
	list_loop (cleanup_instruction_list, root, root, 1);
	<commit_msg>Made invalid jump addresses non-fatal errors<commit_after>#include <stdlib.h>

#include "function.h"
#include "datastructs.h"

function* init_function (function* to_init, unsigned int start_addr)
{
	to_init->start_addr = start_addr;
	next_flags = 0;

	//The following is code meant for the spider disassembler (currently inoperational)
	//See spider.c
	jump_block* root;
	jump_block* current;
	jump_block* temp;

	root = init_jump_block (malloc (sizeof (jump_block)), start_addr);
	current = root;

	//Find all jump blocks
	while (num_push_ebp != 2)
	{
		temp = init_jump_block (malloc (sizeof (jump_block)), current->end);
		link (current, temp);
		current = current->next;
	}
	num_push_ebp = 0;

	//Get jump addresses
	to_init->num_jump_addrs = 0;
	to_init->jump_addrs_buf_size = 8 * sizeof (unsigned int);
	to_init->jump_addrs = malloc (to_init->jump_addrs_buf_size);
	to_init->orig_addrs = malloc (to_init->jump_addrs_buf_size);
	list_loop (resolve_jumps, root, root, to_init);

	//Memory management for "}" placement algorithms
	to_init->num_dups = 0;
	to_init->dup_targets_buf_size = 8 * sizeof (unsigned int);
	to_init->dup_targets = malloc (to_init->dup_targets_buf_size);
	to_init->else_starts = malloc (to_init->dup_targets_buf_size);
	to_init->pivots = malloc (to_init->dup_targets_buf_size);

	//Split jump blocks 
	struct search_params params;
	int i;

	for (i = 0; i < to_init->num_jump_addrs; i ++)
	{
		current = NULL;
		params.ret = (void**)&current;
		params.key = to_init->jump_addrs [i];
		list_loop (search_start_addrs, root, root, params);
	
		if (!current)
		{
			printf ("Error: invalid jump instruction at %p\n", to_init->orig_addrs [i]);
			continue;
		}
	
		split_jump_blocks (current, params.key);
	}

	to_init->jump_block_list = root;

	//Free some memory for the time being
	list_loop (cleanup_instruction_list, root, root, 1);
	
{'fraction_non_alphanumeric': 0.12557634933550313, 'fraction_numerical': 0.005153241117439653, 'mean_word_length': 4.726708074534161, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2909230', 'n_tokens_mistral': 1484, 'n_tokens_neox': 1348, 'n_words': 328}