<commit_before>using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GekkoAssembler
{
    public interface IGekkoDataSection
    {
		int Address { get; }
		byte[] Data { get; }
	}
	
	public static class IGekkoDataSectionExtensions
	{
		public static string ToCheat(this IGekkoDataSection dataSection)
        {
			var lines = new List<string>();
			var i = 0;
			
			while ((i + 4) <= dataSection.Data.Length)
			{
				lines.Add(string.Format("04{0:X6} {1:X2}{2:X2}{3:X2}{4:X2}", ((dataSection.Address + i) & 0xFFFFFF), dataSection.Data[i], dataSection.Data[i + 1], dataSection.Data[i + 2], dataSection.Data[i + 3]));
				i += 4;
			}
			
			if ((i + 2) <= dataSection.Data.Length)
			{
				lines.Add(string.Format("02{0:X6} 0000{1:X2}{2:X2}", ((dataSection.Address + i) & 0xFFFFFF), dataSection.Data[i], dataSection.Data[i + 1]));
				i += 4;
			}
			
			if (i < dataSection.Data.Length)
			{
				lines.Add(string.Format("00{0:X6} 000000{1:X2}", ((dataSection.Address + i) & 0xFFFFFF), dataSection.Data[i]));
			}
			
            return string.Join(Environment.NewLine, lines);
        }
		
		public static string ToCheat(this IEnumerable<IGekkoDataSection> dataSections)
        {
            dataSections = mergeDataSections(dataSections);
			
			return string.Join(Environment.NewLine, dataSections.Select(x => x.ToCheat()));
        }

        private static IEnumerable<IGekkoDataSection> mergeDataSections(IEnumerable<IGekkoDataSection> dataSections)
        {
			var replaced = true;<commit_msg>Fix a bug with writing out data<commit_after>using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GekkoAssembler
{
    public interface IGekkoDataSection
    {
		int Address { get; }
		byte[] Data { get; }
	}
	
	public static class IGekkoDataSectionExtensions
	{
		public static string ToCheat(this IGekkoDataSection dataSection)
        {
			var lines = new List<string>();
			var i = 0;
			
			while ((i + 4) <= dataSection.Data.Length)
			{
				lines.Add(string.Format("04{0:X6} {1:X2}{2:X2}{3:X2}{4:X2}", ((dataSection.Address + i) & 0xFFFFFF), dataSection.Data[i], dataSection.Data[i + 1], dataSection.Data[i + 2], dataSection.Data[i + 3]));
				i += 4;
			}
			
			if ((i + 2) <= dataSection.Data.Length)
			{
				lines.Add(string.Format("02{0:X6} 0000{1:X2}{2:X2}", ((dataSection.Address + i) & 0xFFFFFF), dataSection.Data[i], dataSection.Data[i + 1]));
				i += 2;
			}
			
			if (i < dataSection.Data.Length)
			{
				lines.Add(string.Format("00{0:X6} 000000{1:X2}", ((dataSection.Address + i) & 0xFFFFFF), dataSection.Data[i]));
			}
			
            return string.Join(Environment.NewLine, lines);
        }
		
		public static string ToCheat(this IEnumerable<IGekkoDataSection> dataSections)
        {
            dataSections = mergeDataSections(dataSections);
			
			return string.Join(Environment.NewLine, dataSections.Select(x => x.ToCheat()));
        }

        private static IEnumerable<IGekkoDataSection> mergeDataSections(IEnumerable<IGekkoDataSection> dataSections)
        {
			var replaced = true;
{'fraction_non_alphanumeric': 0.1407315561066336, 'fraction_numerical': 0.029758214507129573, 'mean_word_length': 3.4881780250347707, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 13, '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': '4607175', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1089, 'n_words': 213}