<commit_before>#define MAX_ATEXIT 128

static void (*AtExit[MAX_ATEXIT])(void);
static unsigned NumAtExit;

void klee_report_error(const char *, int, const char *, const char *);
static void RunAtExit(void) __attribute__((destructor));
static void RunAtExit(void) {
    unsigned i;

    for (i = NumAtExit - 1; i < MAX_ATEXIT; --i) AtExit[i]();
}

int atexit(void (*fn)(void)) {
    if (NumAtExit == MAX_ATEXIT) {
        klee_report_error(__FILE__, __LINE__, "atexit: no room in array!",
                          "exec");
    }

    AtExit[NumAtExit] = fn;
    ++NumAtExit;
<commit_msg>libc/atexit: get rid of unsigned int underflow<commit_after>#define MAX_ATEXIT 128

static void (*AtExit[MAX_ATEXIT])(void);
static unsigned NumAtExit;

void klee_report_error(const char *, int, const char *, const char *);
static void RunAtExit(void) __attribute__((destructor));
static void RunAtExit(void) {
    unsigned i;

    for (i = NumAtExit; i > 0; --i) {
        AtExit[i-1]();
    }
}

int atexit(void (*fn)(void)) {
    if (NumAtExit == MAX_ATEXIT) {
        klee_report_error(__FILE__, __LINE__, "atexit: no room in array!",
                          "exec");
    }

    AtExit[NumAtExit] = fn;
    ++NumAtExit;

{'fraction_non_alphanumeric': 0.13673805601317957, 'fraction_numerical': 0.007413509060955519, 'mean_word_length': 3.3392857142857144, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '3346245', 'n_tokens_mistral': 434, 'n_tokens_neox': 421, 'n_words': 107}