<commit_before>#include <arch.h>
#include <fudge.h>

static unsigned int nextline(unsigned int start, unsigned int count, unsigned char *buffer)
{

    unsigned int i;

    for (i = start; i < count; i++)
    {

        if (buffer[i] == '\n')
            return i + 1 - start;

    }

    return 0;

}


void main()
{

    unsigned char buffer[FUDGE_BSIZE];
    unsigned int count;
    unsigned int offset;
    unsigned int offset2;
    unsigned int last = 0;
    unsigned int lines = 0;

    for (offset = 0; (count = call_read(CALL_DI, offset, FUDGE_BSIZE, buffer)); offset += offset2)
    {

        unsigned int count2;

        for (offset2 = 0; (count2 = nextline(offset2, count, buffer)); offset2 += count2)
        {

            unsigned char num[32];

            last += call_write(CALL_DO, last, memory_write_number(num, 32, lines, 10, 0), num);
            last += call_write(CALL_DO, last, 2, ": ");
            last += call_write(CALL_DO, last, count2, buffer + offset2);
            lines++;

        }

        if (!offset2)
            return;

    }

}

<commit_msg>more fixes<commit_after>#include <arch.h>
#include <fudge.h>

static unsigned int nextline(unsigned int start, unsigned int count, unsigned char *buffer)
{

    unsigned int i;

    for (i = start; i < count; i++)
    {

        if (buffer[i] == '\n')
            return i + 1 - start;

    }

    return 0;

}


void main()
{

    unsigned char buffer[FUDGE_BSIZE];
    unsigned int count;
    unsigned int offset;
    unsigned int offset2;
    unsigned int last = 0;
    unsigned int lines = 0;

    for (offset = 0; (count = call_read(CALL_DI, offset, FUDGE_BSIZE, buffer)); offset += offset2)
    {

        unsigned int count2;

        for (offset2 = 0; (count2 = nextline(offset2, count, buffer)); offset2 += count2)
        {

            unsigned char num[32];

            last += call_write(CALL_DO, last, memory_write_number(num, 32, lines++, 10, 0), num);
            last += call_write(CALL_DO, last, 2, ": ");
            last += call_write(CALL_DO, last, count2, buffer + offset2);

        }

        if (!offset2)
            return;

    }

}


{'fraction_non_alphanumeric': 0.12430167597765363, 'fraction_numerical': 0.023277467411545624, 'mean_word_length': 2.1649484536082473, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 7, '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': '7272632', 'n_tokens_mistral': 736, 'n_tokens_neox': 676, 'n_words': 208}