// File: kernel.cpp
#include "loop_034.h"
#include <cstring>
#include <stdint.h>

extern "C" void inner_loop_034(struct loop_034_data *data) {
    uint8_t *p1 = data->a; uint8_t *p2 = data->b; uint8_t *lmt = data->lmt;
    uint32_t res = 0, cnt = 0; int length = 13;
    while (p1 < lmt) {
        int64_t r = strcmp((const char *)p1, (const char *)p2);
        uint32_t cmp = 1; if (r > 0) cmp = 2; if (r < 0) cmp = 3;
        res += cnt * cmp; p1 += length; p2 += length; cnt++;
        length = 3 + (length + 11) % 43;
    }
    data->checksum = res;
}