#include <stdint.h>
#include <stdio.h>

extern uint32_t check_license(const char *license);

int main(int argc, char **argv) {
    if (argc > 1) {
        printf("%u\n", check_license(argv[1]));
        return 0;
    }
    /* FNV-1a of the demonstration license, VEILCC-OK. */
    uint32_t hash = 2166136261u;
    for (const char *s = "VEILCC-OK"; *s; ++s)
        hash = (hash ^ (unsigned char)*s) * 16777619u;
    int valid = check_license("VEILCC-OK") == hash;
    puts(valid ? "license check: passed" : "license check: failed");
    return valid ? 0 : 1;
}
