Fixture 183

sentinel list search

C · 5 functions · 4 lanes · 20 of 20 function-lanes behave identically

All 4 lanes recompile and return the same results as the original.

A NULL-sentinel search over a linked structure.

COVERAGE TARGET: ir::loop_form::recover_sentinel_search_loops. That pass matches a compiler-rotated search — if (head == NULL) return NULL; p = head; q = head; while (!match(q)) { p = next(q); q = p; if (p == NULL) return NULL; } return p; — and rewrites it back to the source's while (p != NULL) { if (match(p)) return p; p = p->next; }. It has never fired on a corpus lane, because nothing in the corpus is a sentinel-terminated search: every existing traversal is bounded by a COUNT, which rotates into an entirely different shape.

The list is an INDEX list in a caller-owned array rather than a pointer list, so the harness can build it from an ordinary integer buffer and every input is in bounds. -1 is the sentinel — the same "impossible value ends the walk" structure as a NULL next, and the one the rotation applies to. A second function uses a real const char * NUL walk so the pointer form is covered too.

tests/decompiler_fixtures/src/183_sentinel_list_search.c source
#include <stdint.h>

/* A NULL-sentinel search over a linked structure.
 *
 * COVERAGE TARGET: `ir::loop_form::recover_sentinel_search_loops`. That pass
 * matches a compiler-rotated search — `if (head == NULL) return NULL; p = head;
 * q = head; while (!match(q)) { p = next(q); q = p; if (p == NULL) return NULL;
 * } return p;` — and rewrites it back to the source's `while (p != NULL) { if
 * (match(p)) return p; p = p->next; }`. It has never fired on a corpus lane,
 * because nothing in the corpus is a sentinel-terminated search: every existing
 * traversal is bounded by a COUNT, which rotates into an entirely different
 * shape.
 *
 * The list is an INDEX list in a caller-owned array rather than a pointer list,
 * so the harness can build it from an ordinary integer buffer and every input is
 * in bounds. `-1` is the sentinel — the same "impossible value ends the walk"
 * structure as a NULL `next`, and the one the rotation applies to. A second
 * function uses a real `const char *` NUL walk so the pointer form is covered
 * too. */

#define LIST183_LIMIT 32

/* Walk `next[]` from `start` until the sentinel, returning the first node whose
 * key matches. -1 when the sentinel is reached first. This is the exact shape
 * the rotation recovery targets. */
__attribute__((noinline)) int32_t find_by_key(const int32_t *nodes,
                                              int32_t count, int32_t key) {
    int32_t cursor = 0;
    int32_t steps = 0;
    if (nodes == 0 || count <= 0 || count > LIST183_LIMIT) {
        return -1;
    }
    /* `nodes[i]` is the key; the successor is simply `i + 1`, and `count` ends
     * the walk. Bounded by `steps` so a corrupted input cannot loop forever. */
    while (cursor < count && steps <= LIST183_LIMIT) {
        if (nodes[cursor] == key) {
            return cursor;
        }
        cursor += 1;
        steps += 1;
    }
    return -1;
}

/* The sentinel form: the walk ends on a value, not on a bound. */
__attribute__((noinline)) int32_t find_terminated_by_sentinel(
    const int32_t *values, int32_t count, int32_t key) {
    int32_t index = 0;
    if (values == 0 || count <= 0 || count > LIST183_LIMIT) {
        return -1;
    }
    /* The final element is forced to the sentinel by the caller contract; the
     * bound is present only so a malformed buffer cannot run away, and is not
     * the loop's real exit test. */
    while (index < count) {
        int32_t value = values[index];
        if (value == 0) {
            /* The sentinel: not found. */
            return -1;
        }
        if (value == key) {
            return index;
        }
        index += 1;
    }
    return -1;
}

/* The pointer form of the same walk: a NUL-terminated string, searched for a
 * byte. Returns the index, or -1. */
__attribute__((noinline)) int32_t find_byte_before_nul(const char *text,
                                                       int32_t wanted) {
    const char *cursor = text;
    int32_t steps = 0;
    if (text == 0) {
        return -1;
    }
    while (*cursor != '\0') {
        if ((int32_t)(unsigned char)*cursor == (wanted & 0xff)) {
            return (int32_t)(cursor - text);
        }
        cursor += 1;
        steps += 1;
        if (steps > LIST183_LIMIT) {
            return -1;
        }
    }
    return -1;
}

/* Length by sentinel: the same walk with no match test, so the recovery sees a
 * loop whose body is only the advance. */
__attribute__((noinline)) int32_t length_to_nul(const char *text) {
    int32_t length = 0;
    if (text == 0) {
        return -1;
    }
    while (text[length] != '\0') {
        length += 1;
        if (length > LIST183_LIMIT) {
            return -1;
        }
    }
    return length;
}

/* Two sentinels: the walk ends on either, so the exit test is a disjunction and
 * the rotation must not collapse it to one comparison. */
__attribute__((noinline)) int32_t find_before_either_sentinel(
    const int32_t *values, int32_t count, int32_t key) {
    int32_t index = 0;
    if (values == 0 || count <= 0 || count > LIST183_LIMIT) {
        return -1;
    }
    while (index < count) {
        int32_t value = values[index];
        if (value == 0 || value == -1) {
            return -1;
        }
        if (value == key) {
            return index;
        }
        index += 1;
    }
    return -1;
}

Recovered C

Generated by glaurung decompile --style decbench at b47f6b43. baseline.json records the result after recompiling the C and calling it beside the original with seeded inputs.

clang -O0

5/5
find_before_either_sentinel pass 44 lines
// glaurung: find_before_either_sentinel @ 0x1390
int32_t find_before_either_sentinel(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int index;
    int value;
    int local_4;
    index = 0;
    if ((arg0 != 0)) {
        if (((((unsigned long)((unsigned int)(arg1)) == 0) | ((long)(arg1) < 0)) == 0)) {
            if ((((unsigned long)((unsigned int)(arg1)) == 32) | ((long)(arg1) < 32))) {
                goto L_13d0;
            }
        }
    }
    local_4 = -1;
    // x86-64 epilogue: restore rbp
    return (unsigned int)(local_4);
    L_13d0: ;
    goto L_13d5;
    L_13d5: ;
    if ((arg1 <= index)) {
        goto L_1434;
    }
    value = arg0[(long)(index)];
    if (((unsigned long)((unsigned int)(value)) != 0)) {
        if (((unsigned long)((unsigned int)(value)) != 0xffffffff)) {
            goto L_140f;
        }
    }
    local_4 = -1;
    // x86-64 epilogue: restore rbp
    return (unsigned int)(local_4);
    L_140f: ;
    if (((unsigned int)(value) == (unsigned int)(arg2))) {
        local_4 = index;
        // x86-64 epilogue: restore rbp
        return (unsigned int)(local_4);
    }
    index = ((unsigned int)(index) + 1);
    goto L_13d5;
    L_1434: ;
    local_4 = -1;
    // x86-64 epilogue: restore rbp
    return (unsigned int)(local_4);
}
find_by_key pass 39 lines
// glaurung: find_by_key @ 0x1100
int32_t find_by_key(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int cursor;
    int steps;
    signed char local_21;
    int local_4;
    cursor = 0;
    steps = 0;
    if ((arg0 != 0)) {
        if (((((unsigned long)((unsigned int)(arg1)) == 0) | ((long)(arg1) < 0)) == 0)) {
            if ((((unsigned long)((unsigned int)(arg1)) == 32) | ((long)(arg1) < 32))) {
                goto L_1147;
            }
        }
    }
    local_4 = -1;
    // x86-64 epilogue: restore rbp
    return (unsigned int)(local_4);
    L_1147: ;
    goto L_114c;
    L_114c: ;
    local_21 = 0;
    if ((cursor < arg1)) {
        local_21 = (((unsigned long)((unsigned int)(steps)) == 32) | ((long)(steps) < 32));
    }
    if (((unsigned long)((unsigned char)((local_21 & 1))) != 0)) {
        if (((unsigned int)(arg0[(long)(cursor)]) == (unsigned int)(arg2))) {
            local_4 = cursor;
            // x86-64 epilogue: restore rbp
            return (unsigned int)(local_4);
        }
        cursor = ((unsigned int)(cursor) + 1);
        steps = ((unsigned int)(steps) + 1);
        goto L_114c;
    }
    local_4 = -1;
    // x86-64 epilogue: restore rbp
    return (unsigned int)(local_4);
}
find_byte_before_nul pass 33 lines
// glaurung: find_byte_before_nul @ 0x1270
int32_t find_byte_before_nul(const char * arg0, int32_t arg1) {
    char * cursor;
    int steps;
    int local_4;
    cursor = (char *)arg0;
    steps = 0;
    if ((arg0 == 0)) {
        local_4 = -1;
        // x86-64 epilogue: restore rbp
        return (unsigned int)(local_4);
    }
    goto L_12a6;
    L_12a6: ;
    if (((unsigned long)((unsigned int)((signed char)(*(char *)(cursor)))) != 0)) {
        if (((unsigned int)((unsigned char)(*(char *)(cursor))) == (unsigned int)(((unsigned long)((unsigned int)(arg1)) & 255)))) {
            local_4 = ((long)cursor - (long)arg0);
            // x86-64 epilogue: restore rbp
            return (unsigned int)(local_4);
        }
        cursor = (char *)((cursor + 1));
        steps = ((unsigned int)(steps) + 1);
        if (((((unsigned long)((unsigned int)(steps)) == 32) | ((long)(steps) < 32)) == 0)) {
            local_4 = -1;
            // x86-64 epilogue: restore rbp
            return (unsigned int)(local_4);
        }
        goto L_12a6;
    }
    local_4 = -1;
    // x86-64 epilogue: restore rbp
    return (unsigned int)(local_4);
}
find_terminated_by_sentinel pass 38 lines
// glaurung: find_terminated_by_sentinel @ 0x11c0
int32_t find_terminated_by_sentinel(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int index;
    int value;
    int local_4;
    index = 0;
    if ((arg0 != 0)) {
        if (((((unsigned long)((unsigned int)(arg1)) == 0) | ((long)(arg1) < 0)) == 0)) {
            if ((((unsigned long)((unsigned int)(arg1)) == 32) | ((long)(arg1) < 32))) {
                goto L_1200;
            }
        }
    }
    local_4 = -1;
    // x86-64 epilogue: restore rbp
    return (unsigned int)(local_4);
    L_1200: ;
    goto L_1205;
    L_1205: ;
    if ((index < arg1)) {
        value = arg0[(long)(index)];
        if (((unsigned long)((unsigned int)(value)) == 0)) {
            local_4 = -1;
            // x86-64 epilogue: restore rbp
            return (unsigned int)(local_4);
        }
        if (((unsigned int)(value) == (unsigned int)(arg2))) {
            local_4 = index;
            // x86-64 epilogue: restore rbp
            return (unsigned int)(local_4);
        }
        index = ((unsigned int)(index) + 1);
        goto L_1205;
    }
    local_4 = -1;
    // x86-64 epilogue: restore rbp
    return (unsigned int)(local_4);
}
length_to_nul pass 25 lines
// glaurung: length_to_nul @ 0x1320
int32_t length_to_nul(const char * arg0) {
    int length;
    int local_4;
    length = 0;
    if ((arg0 == 0)) {
        local_4 = -1;
        // x86-64 epilogue: restore rbp
        return (unsigned int)(local_4);
    }
    goto L_134b;
    L_134b: ;
    if (((unsigned long)((unsigned int)((signed char)(arg0[length]))) != 0)) {
        length = ((unsigned int)(length) + 1);
        if (((((unsigned long)((unsigned int)(length)) == 32) | ((long)(length) < 32)) == 0)) {
            local_4 = -1;
            // x86-64 epilogue: restore rbp
            return (unsigned int)(local_4);
        }
        goto L_134b;
    }
    local_4 = length;
    // x86-64 epilogue: restore rbp
    return (unsigned int)(local_4);
}

clang -O2

5/5
find_before_either_sentinel pass 29 lines
// glaurung: find_before_either_sentinel @ 0x1400
int32_t find_before_either_sentinel(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int index;
    int value;
    long ret;
    long var1;
    ret = 0xffffffff;
    if (((unsigned long)((unsigned long)((unsigned int)((arg1 - 1)))) <= (unsigned long)(31))) {
        if ((arg0 == 0)) {
            return ret;
        }
        var1 = (unsigned long)((unsigned int)(arg1));
        index = 0;
        while (1) {
            value = (unsigned long)((unsigned int)(*(int *)(((long)arg0 + index * 4))));
            if (((unsigned long)((unsigned long)((unsigned int)((value + 1)))) < (unsigned long)(2))) {
                break;
            }
            if (((unsigned int)(value) == (unsigned int)(arg2))) {
                return (unsigned int)(index);
            }
            index = (index + 1);
            if ((var1 == index)) {
                break;
            }
        }
    }
    return ret;
}
find_by_key pass 30 lines
// glaurung: find_by_key @ 0x1100
int32_t find_by_key(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int cursor;
    int steps;
    long ret;
    long t139;
    long var1;
    long var3;
    ret = 0xffffffff;
    if (((unsigned long)(31) < (unsigned long)((unsigned long)((unsigned int)((arg1 - 1)))))) {
        return ret;
    }
    if ((arg0 == 0)) {
        return ret;
    }
    var1 = (unsigned long)((unsigned int)(arg1));
    var3 = 0;
    while (((unsigned int)(*(int *)(((long)arg0 + var3 * 4))) != (unsigned int)(arg2))) {
        cursor = (var3 + 1);
        if (((unsigned long)(var1) <= (unsigned long)(cursor))) {
            return ret;
        }
        t139 = (unsigned long)((unsigned int)((var3 & -32)));
        var3 = (unsigned long)((unsigned int)(cursor));
        if ((t139 != 0)) {
            return ret;
        }
    }
    return (unsigned int)(var3);
}
find_byte_before_nul pass 45 lines
// glaurung: find_byte_before_nul @ 0x1180
int32_t find_byte_before_nul(const char * arg0, int32_t arg1) {
    int steps;
    long ret;
    long var1;
    long var2;
    int var3;
    int var4;
    int var5;
    int var7;
    ret = 0xffffffff;
    if ((arg0 != 0)) {
        var1 = 33;
        var2 = (long)((arg0 + 2));
        do {
            var3 = (unsigned int)((unsigned char)(*(char *)((var2 - 0x2))));
            if (((unsigned long)((unsigned char)((var3 & 255))) == 0)) {
                return ret;
            }
            if (((unsigned char)((var3 & 255)) == (unsigned char)((arg1 & 255)))) {
                var2 = (var2 - 2);
                return (unsigned int)((var2 - (long)arg0));
            }
            var4 = (unsigned int)((unsigned char)(*(char *)((var2 - 0x1))));
            if (((unsigned long)((unsigned char)((var4 & 255))) == 0)) {
                return ret;
            }
            if (((unsigned char)((var4 & 255)) == (unsigned char)((arg1 & 255)))) {
                var2 = (var2 - 1);
                return (unsigned int)((var2 - (long)arg0));
            }
            var5 = (unsigned int)((unsigned char)(*(char *)((var2))));
            if (((unsigned long)((unsigned char)((var5 & 255))) == 0)) {
                return ret;
            }
            if (((unsigned char)((var5 & 255)) == (unsigned char)((arg1 & 255)))) {
                return (unsigned int)((var2 - (long)arg0));
            }
            var7 = (var1 - 3);
            var1 = (unsigned long)((unsigned int)(var7));
            var2 = (var2 + 3);
        } while (((unsigned long)((unsigned int)(var7)) != 0));
    }
    return ret;
}
find_terminated_by_sentinel pass 29 lines
// glaurung: find_terminated_by_sentinel @ 0x1140
int32_t find_terminated_by_sentinel(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int index;
    int value;
    long ret;
    long var1;
    ret = 0xffffffff;
    if (((unsigned long)((unsigned long)((unsigned int)((arg1 - 1)))) <= (unsigned long)(31))) {
        if ((arg0 == 0)) {
            return ret;
        }
        var1 = (unsigned long)((unsigned int)(arg1));
        index = 0;
        while (1) {
            value = (unsigned long)((unsigned int)(*(int *)(((long)arg0 + index * 4))));
            if (((unsigned long)((unsigned int)(value)) == 0)) {
                break;
            }
            if (((unsigned int)(value) == (unsigned int)(arg2))) {
                return (unsigned int)(index);
            }
            index = (index + 1);
            if ((var1 == index)) {
                break;
            }
        }
    }
    return ret;
}
length_to_nul pass 104 lines
// glaurung: length_to_nul @ 0x11e0
int32_t length_to_nul(const char * arg0) {
    int length;
    if ((arg0 == 0)) {
        return 0xffffffff;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0)))) == 0)) {
        return 0;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x1)))) == 0)) {
        return 1;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x2)))) == 0)) {
        return 2;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x3)))) == 0)) {
        return 3;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x4)))) == 0)) {
        return 4;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x5)))) == 0)) {
        return 5;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x6)))) == 0)) {
        return 6;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x7)))) == 0)) {
        return 7;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x8)))) == 0)) {
        return 8;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x9)))) == 0)) {
        return 9;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0xa)))) == 0)) {
        return 10;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0xb)))) == 0)) {
        return 11;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0xc)))) == 0)) {
        return 12;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0xd)))) == 0)) {
        return 13;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0xe)))) == 0)) {
        return 14;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0xf)))) == 0)) {
        return 15;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x10)))) == 0)) {
        return 16;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x11)))) == 0)) {
        return 17;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x12)))) == 0)) {
        return 18;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x13)))) == 0)) {
        return 19;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x14)))) == 0)) {
        return 20;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x15)))) == 0)) {
        return 21;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x16)))) == 0)) {
        return 22;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x17)))) == 0)) {
        return 23;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x18)))) == 0)) {
        return 24;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x19)))) == 0)) {
        return 25;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x1a)))) == 0)) {
        return 26;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x1b)))) == 0)) {
        return 27;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x1c)))) == 0)) {
        return 28;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x1d)))) == 0)) {
        return 29;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x1e)))) == 0)) {
        return 30;
    }
    if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x1f)))) == 0)) {
        return 31;
    }
    return (unsigned int)(((unsigned int)((0 - ((unsigned long)(0) < (unsigned long)((unsigned long)((unsigned char)(*(char *)(((long)arg0 + 0x20)))))))) | 32));
}

gcc -O0

5/5
find_before_either_sentinel pass 36 lines
// glaurung: find_before_either_sentinel @ 0x12a6
int32_t find_before_either_sentinel(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int index;
    int value;
    index = 0;
    if ((arg0 != 0)) {
        if (((((unsigned long)((unsigned int)(arg1)) == 0) | ((long)(arg1) < 0)) == 0)) {
            if ((((unsigned long)((unsigned int)(arg1)) == 32) | ((long)(arg1) < 32))) {
                goto L_1316;
            }
        }
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
    L_12d9: ;
    value = arg0[(long)(index)];
    if (((unsigned long)((unsigned int)(value)) != 0)) {
        if (((unsigned long)((unsigned int)(value)) != 0xffffffff)) {
            goto L_1305;
        }
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
    L_1305: ;
    if (((unsigned int)(value) == (unsigned int)(arg2))) {
        // x86-64 epilogue: restore rbp
        return (unsigned int)(index);
    }
    index = (index + 1);
    L_1316: ;
    if ((index < arg1)) {
        goto L_12d9;
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
}
find_by_key pass 33 lines
// glaurung: find_by_key @ 0x10f9
int32_t find_by_key(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int cursor;
    int steps;
    cursor = 0;
    steps = 0;
    if ((arg0 != 0)) {
        if (((((unsigned long)((unsigned int)(arg1)) == 0) | ((long)(arg1) < 0)) == 0)) {
            if ((((unsigned long)((unsigned int)(arg1)) == 32) | ((long)(arg1) < 32))) {
                goto L_115b;
            }
        }
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
    L_1133: ;
    if (((unsigned int)(arg2) == (unsigned int)(arg0[(long)(cursor)]))) {
        // x86-64 epilogue: restore rbp
        return (unsigned int)(cursor);
    }
    cursor = (cursor + 1);
    steps = (steps + 1);
    L_115b: ;
    if ((arg1 <= cursor)) {
        // x86-64 epilogue: restore rbp
        return 0xffffffff;
    }
    if ((((unsigned long)((unsigned int)(steps)) == 32) | ((long)(steps) < 32))) {
        goto L_1133;
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
}
find_byte_before_nul pass 30 lines
// glaurung: find_byte_before_nul @ 0x11e9
int32_t find_byte_before_nul(const char * arg0, int32_t arg1) {
    char * cursor;
    int steps;
    cursor = (char *)arg0;
    steps = 0;
    if ((arg0 != 0)) {
        goto L_1249;
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
    L_1215: ;
    if (((unsigned int)((unsigned char)(((unsigned int)((unsigned char)(*(char *)(cursor))) & 255))) == (unsigned int)((unsigned char)(((unsigned long)((unsigned int)(arg1)) & 255))))) {
        // x86-64 epilogue: restore rbp
        return ((long)cursor - (long)arg0);
    }
    cursor = (char *)((cursor + 1));
    steps = (steps + 1);
    if ((((unsigned long)((unsigned int)(steps)) == 32) | ((long)(steps) < 32))) {
        goto L_1249;
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
    L_1249: ;
    if (((unsigned long)((unsigned char)(((unsigned int)((unsigned char)(*(char *)(cursor))) & 255))) != 0)) {
        goto L_1215;
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
}
find_terminated_by_sentinel pass 32 lines
// glaurung: find_terminated_by_sentinel @ 0x1170
int32_t find_terminated_by_sentinel(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int index;
    int value;
    index = 0;
    if ((arg0 != 0)) {
        if (((((unsigned long)((unsigned int)(arg1)) == 0) | ((long)(arg1) < 0)) == 0)) {
            if ((((unsigned long)((unsigned int)(arg1)) == 32) | ((long)(arg1) < 32))) {
                goto L_11da;
            }
        }
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
    L_11a3: ;
    value = arg0[(long)(index)];
    if (((unsigned long)((unsigned int)(value)) == 0)) {
        // x86-64 epilogue: restore rbp
        return 0xffffffff;
    }
    if (((unsigned int)(value) == (unsigned int)(arg2))) {
        // x86-64 epilogue: restore rbp
        return (unsigned int)(index);
    }
    index = (index + 1);
    L_11da: ;
    if ((index < arg1)) {
        goto L_11a3;
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
}
length_to_nul pass 23 lines
// glaurung: length_to_nul @ 0x125b
int32_t length_to_nul(const char * arg0) {
    int length;
    length = 0;
    if ((arg0 != 0)) {
        goto L_128d;
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
    L_127c: ;
    length = (length + 1);
    if ((((unsigned long)((unsigned int)(length)) == 32) | ((long)(length) < 32))) {
        goto L_128d;
    }
    // x86-64 epilogue: restore rbp
    return 0xffffffff;
    L_128d: ;
    if (((unsigned long)((unsigned char)(((unsigned int)((unsigned char)(arg0[length])) & 255))) != 0)) {
        goto L_127c;
    }
    // x86-64 epilogue: restore rbp
    return (unsigned int)(length);
}

gcc -O2

5/5
find_before_either_sentinel pass 32 lines
// glaurung: find_before_either_sentinel @ 0x1210
int32_t find_before_either_sentinel(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int value;
    int index;
    long var1;
    long var3;
    if (((unsigned long)(31) < (unsigned long)((unsigned long)((unsigned int)((arg1 - 1)))))) {
        var1 = 0xffffffff;
        return 0xffffffff;
    }
    if ((arg0 == 0)) {
        var1 = 0xffffffff;
        return 0xffffffff;
    }
    var3 = 0;
    while (1) {
        value = (unsigned long)((unsigned int)(*(int *)(((long)arg0 + var3 * 4))));
        var1 = (unsigned long)((unsigned int)(var3));
        if (((unsigned long)((unsigned long)((unsigned int)((value + 1)))) <= (unsigned long)(1))) {
            break;
        }
        if (((unsigned int)(value) == (unsigned int)(arg2))) {
            return (unsigned int)(var1);
        }
        var3 = (var3 + 1);
        if (((((unsigned int)(arg1) == (unsigned int)(var3)) | ((long)(arg1) < (long)((int)(var3)))) != 0)) {
            break;
        }
    }
    var1 = 0xffffffff;
    return 0xffffffff;
}
find_by_key pass 25 lines
// glaurung: find_by_key @ 0x1100
int32_t find_by_key(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int cursor;
    long var5;
    long var6;
    if (((unsigned long)(31) < (unsigned long)((unsigned long)((unsigned int)((arg1 - 1)))))) {
        return 0xffffffff;
    }
    if ((arg0 == 0)) {
        return 0xffffffff;
    }
    cursor = 0;
    while (1) {
        var5 = (unsigned long)((unsigned int)(cursor));
        if (((unsigned int)(*(int *)(((long)arg0 + cursor * 4))) == (unsigned int)(arg2))) {
            break;
        }
        var6 = ((unsigned long)((unsigned int)(cursor)) + 1);
        cursor = var6;
        if ((((unsigned int)(arg1) == (unsigned int)(var6)) | ((long)(arg1) < (long)((int)(var6))))) {
            return 0xffffffff;
        }
    }
    return (unsigned int)(var5);
}
find_byte_before_nul pass 29 lines
// glaurung: find_byte_before_nul @ 0x1180
int32_t find_byte_before_nul(const char * arg0, int32_t arg1) {
    char * cursor;
    int steps;
    long var0;
    int var2;
    long var3;
    int var4;
    if ((arg0 != 0)) {
        var0 = (long)((arg0 + 33));
        var2 = (unsigned int)((unsigned char)((arg1 & 255)));
        var3 = (long)arg0;
        while (1) {
            var4 = (unsigned int)((unsigned char)(*(char *)((var3))));
            if (((unsigned long)((unsigned char)((var4 & 255))) == 0)) {
                break;
            }
            if (((unsigned int)(var4) == (unsigned int)(var2))) {
                return (unsigned int)((var3 - (long)arg0));
            }
            cursor = (char *)((var3 + 1));
            var3 = (long)cursor;
            if ((cursor == var0)) {
                break;
            }
        }
    }
    return 0xffffffff;
}
find_terminated_by_sentinel pass 32 lines
// glaurung: find_terminated_by_sentinel @ 0x1140
int32_t find_terminated_by_sentinel(const int32_t * arg0, int32_t arg1, int32_t arg2) {
    int value;
    int index;
    long var1;
    long var3;
    if (((unsigned long)(31) < (unsigned long)((unsigned long)((unsigned int)((arg1 - 1)))))) {
        var1 = 0xffffffff;
        return 0xffffffff;
    }
    if ((arg0 == 0)) {
        var1 = 0xffffffff;
        return 0xffffffff;
    }
    var3 = 0;
    while (1) {
        value = (unsigned long)((unsigned int)(*(int *)(((long)arg0 + var3 * 4))));
        var1 = (unsigned long)((unsigned int)(var3));
        if (((unsigned long)((unsigned int)(value)) == 0)) {
            break;
        }
        if (((unsigned int)(value) == (unsigned int)(arg2))) {
            return (unsigned int)(var1);
        }
        var3 = (var3 + 1);
        if (((((unsigned int)(arg1) == (unsigned int)(var3)) | ((long)(arg1) < (long)((int)(var3)))) != 0)) {
            break;
        }
    }
    var1 = 0xffffffff;
    return 0xffffffff;
}
length_to_nul pass 21 lines
// glaurung: length_to_nul @ 0x11d0
int32_t length_to_nul(const char * arg0) {
    int length;
    long var2;
    long var3;
    if ((arg0 == 0)) {
        return 0xffffffff;
    }
    var2 = 0;
    while (1) {
        var3 = (unsigned long)((unsigned int)(var2));
        if (((unsigned long)((unsigned char)(*(char *)(((long)arg0 + var2)))) == 0)) {
            break;
        }
        var2 = (var2 + 1);
        if ((var2 == 33)) {
            return 0xffffffff;
        }
    }
    return (unsigned int)(var3);
}

← 213 fixtures