janet_abstract_begin:
 1338|   140k|void *janet_abstract_begin(const JanetAbstractType *atype, size_t size) {
 1339|   140k|    JanetAbstractHead *header = janet_gcalloc(JANET_MEMORY_NONE,
 1340|   140k|        sizeof(JanetAbstractHead) + size);
 1341|   140k|    header->size = size;
 1342|   140k|    header->type = atype;
 1343|   140k|    return (void *) & (header->data);
 1344|   140k|}
janet_abstract_end:
 1346|   140k|void *janet_abstract_end(void *x) {
 1347|   140k|    janet_gc_settype((void *)(janet_abstract_head(x)), JANET_MEMORY_ABSTRACT);
  ------------------
  |  |  634|   140k|#define janet_gc_settype(m, t) ((janet_gc_header(m)->flags |= (0xFF & (t))))
  |  |  ------------------
  |  |  |  |  628|   140k|#define janet_gc_header(mem) ((JanetGCObject *)(mem))
  |  |  ------------------
  ------------------
 1348|   140k|    return x;
 1349|   140k|}
janet_abstract:
 1351|   140k|void *janet_abstract(const JanetAbstractType *atype, size_t size) {
 1352|   140k|    return janet_abstract_end(janet_abstract_begin(atype, size));
 1353|   140k|}
janet_array:
 1570|    525|JanetArray *janet_array(int32_t capacity) {
 1571|    525|    JanetArray *array = janet_gcalloc(JANET_MEMORY_ARRAY, sizeof(JanetArray));
 1572|    525|    janet_array_impl(array, capacity);
 1573|    525|    return array;
 1574|    525|}
janet_buffer_deinit:
 3157|  3.55M|void janet_buffer_deinit(JanetBuffer *buffer) {
 3158|  3.55M|    if (!(buffer->gc.flags & JANET_BUFFER_FLAG_NO_REALLOC)) {
  ------------------
  |  | 1779|  3.55M|#define JANET_BUFFER_FLAG_NO_REALLOC 0x10000
  ------------------
  |  Branch (3158:9): [True: 3.55M, False: 0]
  ------------------
 3159|  3.55M|        janet_free(buffer->data);
  ------------------
  |  | 2415|  3.55M|#define janet_free(X) free((X))
  ------------------
 3160|       |        buffer->data = NULL;
 3161|  3.55M|    }
 3162|  3.55M|}
janet_buffer:
 3165|  3.55M|JanetBuffer *janet_buffer(int32_t capacity) {
 3166|  3.55M|    JanetBuffer *buffer = janet_gcalloc(JANET_MEMORY_BUFFER, sizeof(JanetBuffer));
 3167|  3.55M|    return janet_buffer_init_impl(buffer, capacity);
 3168|  3.55M|}
janet_buffer_extra:
 3201|  65.2k|void janet_buffer_extra(JanetBuffer *buffer, int32_t n) {
 3202|       |    /* Check for buffer overflow */
 3203|  65.2k|    if ((int64_t)n + buffer->count > INT32_MAX) {
  ------------------
  |  Branch (3203:9): [True: 0, False: 65.2k]
  ------------------
 3204|      0|        janet_panic("buffer overflow");
 3205|      0|    }
 3206|  65.2k|    int32_t new_size = buffer->count + n;
 3207|  65.2k|    if (new_size > buffer->capacity) {
  ------------------
  |  Branch (3207:9): [True: 71, False: 65.2k]
  ------------------
 3208|     71|        janet_buffer_can_realloc(buffer);
 3209|     71|        int32_t new_capacity = (new_size > (INT32_MAX / 2)) ? INT32_MAX : (new_size * 2);
  ------------------
  |  Branch (3209:32): [True: 0, False: 71]
  ------------------
 3210|     71|        uint8_t *new_data = janet_realloc(buffer->data, new_capacity * sizeof(uint8_t));
  ------------------
  |  | 2409|     71|#define janet_realloc(X, Y) realloc((X), (Y))
  ------------------
 3211|     71|        janet_gcpressure(new_capacity - buffer->capacity);
 3212|     71|        if (NULL == new_data) {
  ------------------
  |  Branch (3212:13): [True: 0, False: 71]
  ------------------
 3213|      0|            JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3214|      0|        }
 3215|     71|        buffer->data = new_data;
 3216|     71|        buffer->capacity = new_capacity;
 3217|     71|    }
 3218|  65.2k|}
janet_buffer_push_cstring:
 3221|    420|void janet_buffer_push_cstring(JanetBuffer *buffer, const char *cstring) {
 3222|    420|    int32_t len = (int32_t) strlen(cstring);
 3223|    420|    janet_buffer_push_bytes(buffer, (const uint8_t *) cstring, len);
 3224|    420|}
janet_buffer_push_bytes:
 3227|  3.55M|void janet_buffer_push_bytes(JanetBuffer *buffer, const uint8_t *string, int32_t length) {
 3228|  3.55M|    if (0 == length) return;
  ------------------
  |  Branch (3228:9): [True: 3.48M, False: 63.1k]
  ------------------
 3229|  63.1k|    janet_buffer_extra(buffer, length);
 3230|  63.1k|    memcpy(buffer->data + buffer->count, string, length);
 3231|  63.1k|    buffer->count += length;
 3232|  63.1k|}
janet_buffer_push_u8:
 3239|  2.16k|void janet_buffer_push_u8(JanetBuffer *buffer, uint8_t byte) {
 3240|  2.16k|    janet_buffer_extra(buffer, 1);
 3241|  2.16k|    buffer->data[buffer->count] = byte;
 3242|  2.16k|    buffer->count++;
 3243|  2.16k|}
janet_ev_init_common:
 9576|  6.23k|void janet_ev_init_common(void) {
 9577|  6.23k|    janet_q_init(&janet_vm.spawn);
 9578|  6.23k|    janet_vm.tq = NULL;
 9579|  6.23k|    janet_vm.tq_count = 0;
 9580|  6.23k|    janet_vm.tq_capacity = 0;
 9581|  6.23k|    janet_table_init_raw(&janet_vm.threaded_abstracts, 0);
 9582|  6.23k|    janet_table_init_raw(&janet_vm.active_tasks, 0);
 9583|  6.23k|    janet_table_init_raw(&janet_vm.signal_handlers, 0);
 9584|  6.23k|    janet_rng_seed(&janet_vm.ev_rng, 0);
 9585|  6.23k|#ifndef JANET_WINDOWS
 9586|  6.23k|    pthread_attr_init(&janet_vm.new_thread_attr);
 9587|       |    pthread_attr_setdetachstate(&janet_vm.new_thread_attr, PTHREAD_CREATE_DETACHED);
 9588|  6.23k|#endif
 9589|  6.23k|}
janet_ev_deinit_common:
 9622|  6.23k|void janet_ev_deinit_common(void) {
 9623|  6.23k|    JanetTimeout to;
 9624|  6.23k|    while (peek_timeout(&to)) {
  ------------------
  |  Branch (9624:12): [True: 0, False: 6.23k]
  ------------------
 9625|      0|        handle_timeout_worker(to, 1);
 9626|      0|        pop_timeout(0);
 9627|      0|    }
 9628|  6.23k|    janet_q_deinit(&janet_vm.spawn);
 9629|  6.23k|    janet_free(janet_vm.tq);
  ------------------
  |  | 2415|  6.23k|#define janet_free(X) free((X))
  ------------------
 9630|  6.23k|    janet_table_deinit(&janet_vm.threaded_abstracts);
 9631|  6.23k|    janet_table_deinit(&janet_vm.active_tasks);
 9632|  6.23k|    janet_table_deinit(&janet_vm.signal_handlers);
 9633|  6.23k|#ifndef JANET_WINDOWS
 9634|  6.23k|    pthread_attr_destroy(&janet_vm.new_thread_attr);
 9635|  6.23k|#endif
 9636|  6.23k|}
janet_ev_init:
10844|  6.23k|void janet_ev_init(void) {
10845|  6.23k|    janet_ev_init_common();
10846|  6.23k|    janet_ev_setup_selfpipe();
10847|  6.23k|    janet_vm.epoll = epoll_create1(EPOLL_CLOEXEC);
10848|  6.23k|    janet_vm.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
10849|  6.23k|    janet_vm.timer_enabled = 0;
10850|  6.23k|    if (janet_vm.epoll == -1 || janet_vm.timerfd == -1) goto error;
  ------------------
  |  Branch (10850:9): [True: 0, False: 6.23k]
  |  Branch (10850:33): [True: 0, False: 6.23k]
  ------------------
10851|  6.23k|    struct epoll_event ev;
10852|  6.23k|    ev.events = EPOLLIN | EPOLLET;
10853|  6.23k|    ev.data.ptr = &janet_vm.timerfd;
10854|  6.23k|    if (-1 == epoll_ctl(janet_vm.epoll, EPOLL_CTL_ADD, janet_vm.timerfd, &ev)) goto error;
  ------------------
  |  Branch (10854:9): [True: 0, False: 6.23k]
  ------------------
10855|  6.23k|    ev.events = EPOLLIN | EPOLLET;
10856|  6.23k|    ev.data.ptr = janet_vm.selfpipe;
10857|  6.23k|    if (-1 == epoll_ctl(janet_vm.epoll, EPOLL_CTL_ADD, janet_vm.selfpipe[0], &ev)) goto error;
  ------------------
  |  Branch (10857:9): [True: 0, False: 6.23k]
  ------------------
10858|  6.23k|    return;
10859|  6.23k|error:
10860|       |    JANET_EXIT("failed to initialize event loop");
  ------------------
  |  |  378|      0|#define JANET_EXIT(m) do { \
  |  |  379|      0|    fprintf(stderr, "janet abort at %s:%d: %s\n",\
  |  |  380|      0|        __FILE__,\
  |  |  381|      0|        __LINE__,\
  |  |  382|      0|        (m));\
  |  |  383|      0|    abort();\
  |  |  384|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (384:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
10861|      0|}
janet_ev_deinit:
10863|  6.23k|void janet_ev_deinit(void) {
10864|  6.23k|    janet_ev_deinit_common();
10865|  6.23k|    close(janet_vm.epoll);
10866|  6.23k|    close(janet_vm.timerfd);
10867|  6.23k|    janet_ev_cleanup_selfpipe();
10868|  6.23k|    janet_vm.epoll = 0;
10869|  6.23k|}
janet_make_pipe:
11966|  6.23k|int janet_make_pipe(JanetHandle handles[2], int mode) {
11967|       |#ifdef JANET_WINDOWS
11968|       |    /*
11969|       |     * On windows, the built in CreatePipe function doesn't support overlapped IO
11970|       |     * so we lift from the windows source code and modify for our own version.
11971|       |     */
11972|       |    JanetHandle shandle, chandle;
11973|       |    CHAR PipeNameBuffer[MAX_PATH];
11974|       |    SECURITY_ATTRIBUTES saAttr;
11975|       |    memset(&saAttr, 0, sizeof(saAttr));
11976|       |    saAttr.nLength = sizeof(saAttr);
11977|       |    saAttr.bInheritHandle = TRUE;
11978|       |    if (mode == 3) {
11979|       |        /* No overlapped IO involved, just call CreatePipe */
11980|       |        if (!CreatePipe(handles, handles + 1, &saAttr, 0)) return -1;
11981|       |        return 0;
11982|       |    }
11983|       |    snprintf(PipeNameBuffer,
11984|       |             sizeof(PipeNameBuffer),
11985|       |             "\\\\.\\Pipe\\JanetPipeFile.%08x.%08x",
11986|       |             (unsigned int) GetCurrentProcessId(),
11987|       |             (unsigned int) InterlockedIncrement(&PipeSerialNumber));
11988|       |
11989|       |    /* server handle goes to subprocess */
11990|       |    shandle = CreateNamedPipeA(
11991|       |                  PipeNameBuffer,
11992|       |                  (mode == 2 ? PIPE_ACCESS_INBOUND : PIPE_ACCESS_OUTBOUND) | FILE_FLAG_OVERLAPPED,
11993|       |                  PIPE_TYPE_BYTE | PIPE_WAIT,
11994|       |                  255,           /* Max number of pipes for duplication. */
11995|       |                  4096,          /* Out buffer size */
11996|       |                  4096,          /* In buffer size */
11997|       |                  120 * 1000,    /* Timeout in ms */
11998|       |                  &saAttr);
11999|       |    if (shandle == INVALID_HANDLE_VALUE) {
12000|       |        return -1;
12001|       |    }
12002|       |
12003|       |    /* we keep client handle */
12004|       |    chandle = CreateFileA(
12005|       |                  PipeNameBuffer,
12006|       |                  (mode == 2 ? GENERIC_WRITE : GENERIC_READ),
12007|       |                  0,
12008|       |                  &saAttr,
12009|       |                  OPEN_EXISTING,
12010|       |                  FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
12011|       |                  NULL);
12012|       |
12013|       |    if (chandle == INVALID_HANDLE_VALUE) {
12014|       |        CloseHandle(shandle);
12015|       |        return -1;
12016|       |    }
12017|       |    if (mode == 2) {
12018|       |        handles[0] = shandle;
12019|       |        handles[1] = chandle;
12020|       |    } else {
12021|       |        handles[0] = chandle;
12022|       |        handles[1] = shandle;
12023|       |    }
12024|       |    return 0;
12025|       |#else
12026|  6.23k|    if (pipe(handles)) return -1;
  ------------------
  |  Branch (12026:9): [True: 0, False: 6.23k]
  ------------------
12027|  6.23k|    if (mode != 2 && fcntl(handles[0], F_SETFD, FD_CLOEXEC)) goto error;
  ------------------
  |  Branch (12027:9): [True: 6.23k, False: 0]
  |  Branch (12027:22): [True: 0, False: 6.23k]
  ------------------
12028|  6.23k|    if (mode != 1 && fcntl(handles[1], F_SETFD, FD_CLOEXEC)) goto error;
  ------------------
  |  Branch (12028:9): [True: 0, False: 6.23k]
  |  Branch (12028:22): [True: 0, False: 0]
  ------------------
12029|  6.23k|    if (mode != 2 && mode != 3 && fcntl(handles[0], F_SETFL, O_NONBLOCK)) goto error;
  ------------------
  |  Branch (12029:9): [True: 6.23k, False: 0]
  |  Branch (12029:22): [True: 6.23k, False: 0]
  |  Branch (12029:35): [True: 0, False: 6.23k]
  ------------------
12030|  6.23k|    if (mode != 1 && mode != 3 && fcntl(handles[1], F_SETFL, O_NONBLOCK)) goto error;
  ------------------
  |  Branch (12030:9): [True: 0, False: 6.23k]
  |  Branch (12030:22): [True: 0, False: 0]
  |  Branch (12030:35): [True: 0, False: 0]
  ------------------
12031|  6.23k|    return 0;
12032|      0|error:
12033|      0|    close(handles[0]);
12034|      0|    close(handles[1]);
12035|      0|    return -1;
12036|  6.23k|#endif
12037|  6.23k|}
janet_gcpressure:
16307|  3.55M|void janet_gcpressure(size_t s) {
16308|  3.55M|    janet_vm.next_collection += s;
16309|  3.55M|}
janet_gcalloc:
16781|  15.4M|void *janet_gcalloc(enum JanetMemoryType type, size_t size) {
16782|  15.4M|    JanetGCObject *mem;
16783|       |
16784|       |    /* Make sure everything is inited */
16785|  15.4M|    janet_assert(NULL != janet_vm.cache, "please initialize janet before use");
  ------------------
  |  |  389|  15.4M|#define janet_assert(c, m) do { \
  |  |  390|  15.4M|    if (!(c)) JANET_EXIT((m)); \
  |  |  ------------------
  |  |  |  |  378|      0|#define JANET_EXIT(m) do { \
  |  |  |  |  379|      0|    fprintf(stderr, "janet abort at %s:%d: %s\n",\
  |  |  |  |  380|      0|        __FILE__,\
  |  |  |  |  381|      0|        __LINE__,\
  |  |  |  |  382|      0|        (m));\
  |  |  |  |  383|      0|    abort();\
  |  |  |  |  384|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:10): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (390:9): [True: 0, False: 15.4M]
  |  |  ------------------
  |  |  391|  15.4M|} while (0)
  |  |  ------------------
  |  |  |  Branch (391:10): [Folded, False: 15.4M]
  |  |  ------------------
  ------------------
16786|  15.4M|    mem = janet_malloc(size);
  ------------------
  |  | 2406|  15.4M|#define janet_malloc(X) malloc((X))
  ------------------
16787|       |
16788|       |    /* Check for bad malloc */
16789|  15.4M|    if (NULL == mem) {
  ------------------
  |  Branch (16789:9): [True: 0, False: 15.4M]
  ------------------
16790|      0|        JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
16791|      0|    }
16792|       |
16793|       |    /* Configure block */
16794|  15.4M|    mem->flags = type;
16795|       |
16796|       |    /* Prepend block to heap list */
16797|  15.4M|    janet_vm.next_collection += size;
16798|  15.4M|    if (type < JANET_MEMORY_TABLE_WEAKK) {
  ------------------
  |  Branch (16798:9): [True: 15.4M, False: 0]
  ------------------
16799|       |        /* normal heap */
16800|  15.4M|        mem->data.next = janet_vm.blocks;
16801|  15.4M|        janet_vm.blocks = mem;
16802|  15.4M|    } else {
16803|       |        /* weak heap */
16804|      0|        mem->data.next = janet_vm.weak_blocks;
16805|      0|        janet_vm.weak_blocks = mem;
16806|      0|    }
16807|  15.4M|    janet_vm.block_count++;
16808|       |
16809|  15.4M|    return (void *)mem;
16810|  15.4M|}
janet_gcroot:
16868|  6.23k|void janet_gcroot(Janet root) {
16869|  6.23k|    size_t newcount = janet_vm.root_count + 1;
16870|  6.23k|    if (newcount > janet_vm.root_capacity) {
  ------------------
  |  Branch (16870:9): [True: 6.23k, False: 0]
  ------------------
16871|  6.23k|        size_t newcap = 2 * newcount;
16872|  6.23k|        janet_vm.roots = janet_realloc(janet_vm.roots, sizeof(Janet) * newcap);
  ------------------
  |  | 2409|  6.23k|#define janet_realloc(X, Y) realloc((X), (Y))
  ------------------
16873|  6.23k|        if (NULL == janet_vm.roots) {
  ------------------
  |  Branch (16873:13): [True: 0, False: 6.23k]
  ------------------
16874|      0|            JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
16875|      0|        }
16876|  6.23k|        janet_vm.root_capacity = newcap;
16877|  6.23k|    }
16878|  6.23k|    janet_vm.roots[janet_vm.root_count] = root;
16879|  6.23k|    janet_vm.root_count = newcount;
16880|  6.23k|}
janet_clear_memory:
16927|  6.23k|void janet_clear_memory(void) {
16928|  6.23k|#ifdef JANET_EV
16929|  6.23k|    JanetKV *items = janet_vm.threaded_abstracts.data;
16930|  12.4k|    for (int32_t i = 0; i < janet_vm.threaded_abstracts.capacity; i++) {
  ------------------
  |  Branch (16930:25): [True: 6.23k, False: 6.23k]
  ------------------
16931|  6.23k|        if (janet_checktype(items[i].key, JANET_ABSTRACT)) {
  ------------------
  |  |  806|  6.23k|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 0, False: 6.23k]
  |  |  |  Branch (806:6): [Folded, False: 6.23k]
  |  |  ------------------
  |  |  807|  6.23k|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  6.23k|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  6.23k|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  6.23k|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  6.23k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  6.23k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
16932|      0|            void *abst = janet_unwrap_abstract(items[i].key);
  ------------------
  |  |  866|      0|#define janet_unwrap_abstract(x) (janet_nanbox_to_pointer(x))
  ------------------
16933|      0|            JanetAbstractHead *head = janet_abstract_head(abst);
  ------------------
  |  | 1896|      0|#define janet_abstract_head(u) ((JanetAbstractHead *)((char *)u - offsetof(JanetAbstractHead, data)))
  ------------------
16934|      0|            if (head->type->gcperthread) {
  ------------------
  |  Branch (16934:17): [True: 0, False: 0]
  ------------------
16935|      0|                janet_assert(!head->type->gcperthread(head->data, head->size), "per-thread finalizer failed");
  ------------------
  |  |  389|      0|#define janet_assert(c, m) do { \
  |  |  390|      0|    if (!(c)) JANET_EXIT((m)); \
  |  |  ------------------
  |  |  |  |  378|      0|#define JANET_EXIT(m) do { \
  |  |  |  |  379|      0|    fprintf(stderr, "janet abort at %s:%d: %s\n",\
  |  |  |  |  380|      0|        __FILE__,\
  |  |  |  |  381|      0|        __LINE__,\
  |  |  |  |  382|      0|        (m));\
  |  |  |  |  383|      0|    abort();\
  |  |  |  |  384|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:10): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (390:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  391|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (391:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
16936|      0|            }
16937|      0|            janet_abstract_decref_maybe_free(abst);
16938|      0|        }
16939|  6.23k|    }
16940|  6.23k|#endif
16941|  6.23k|    JanetGCObject *current = janet_vm.blocks;
16942|  15.4M|    while (NULL != current) {
  ------------------
  |  Branch (16942:12): [True: 15.4M, False: 6.23k]
  ------------------
16943|  15.4M|        janet_deinit_block(current);
16944|  15.4M|        JanetGCObject *next = current->data.next;
16945|  15.4M|        janet_free(current);
  ------------------
  |  | 2415|  15.4M|#define janet_free(X) free((X))
  ------------------
16946|  15.4M|        current = next;
16947|  15.4M|    }
16948|  6.23k|    janet_vm.blocks = NULL;
16949|  6.23k|    janet_free_all_scratch();
16950|  6.23k|    janet_free(janet_vm.scratch_mem);
  ------------------
  |  | 2415|  6.23k|#define janet_free(X) free((X))
  ------------------
16951|  6.23k|}
janet_wrap_s64:
17217|   136k|Janet janet_wrap_s64(int64_t x) {
17218|   136k|    int64_t *box = janet_abstract(&janet_s64_type, sizeof(int64_t));
17219|   136k|    *box = (int64_t)x;
17220|   136k|    return janet_wrap_abstract(box);
  ------------------
  |  |  851|   136k|#define janet_wrap_abstract(s) janet_nanbox_wrap_((s), JANET_ABSTRACT)
  |  |  ------------------
  |  |  |  |  825|   136k|    janet_nanbox_from_pointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|   136k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|   136k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
17221|   136k|}
janet_wrap_u64:
17223|  4.20k|Janet janet_wrap_u64(uint64_t x) {
17224|  4.20k|    uint64_t *box = janet_abstract(&janet_u64_type, sizeof(uint64_t));
17225|  4.20k|    *box = (uint64_t)x;
17226|  4.20k|    return janet_wrap_abstract(box);
  ------------------
  |  |  851|  4.20k|#define janet_wrap_abstract(s) janet_nanbox_wrap_((s), JANET_ABSTRACT)
  |  |  ------------------
  |  |  |  |  825|  4.20k|    janet_nanbox_from_pointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  4.20k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  4.20k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
17227|  4.20k|}
janet_default_rng:
20407|  6.23k|JanetRNG *janet_default_rng(void) {
20408|  6.23k|    return &janet_vm.rng;
20409|  6.23k|}
janet_rng_seed:
20411|  12.4k|void janet_rng_seed(JanetRNG *rng, uint32_t seed) {
20412|  12.4k|    rng->a = seed;
20413|  12.4k|    rng->b = 0x97654321u;
20414|  12.4k|    rng->c = 123871873u;
20415|  12.4k|    rng->d = 0xf23f56c8u;
20416|  12.4k|    rng->counter = 0u;
20417|       |    /* First several numbers aren't that random. */
20418|   211k|    for (int i = 0; i < 16; i++) janet_rng_u32(rng);
  ------------------
  |  Branch (20418:21): [True: 199k, False: 12.4k]
  ------------------
20419|  12.4k|}
janet_rng_u32:
20435|   199k|uint32_t janet_rng_u32(JanetRNG *rng) {
20436|       |    /* Algorithm "xorwow" from p. 5 of Marsaglia, "Xorshift RNGs" */
20437|   199k|    uint32_t t = rng->d;
20438|   199k|    uint32_t const s = rng->a;
20439|   199k|    rng->d = rng->c;
20440|   199k|    rng->c = rng->b;
20441|   199k|    rng->b = s;
20442|   199k|    t ^= t >> 2;
20443|   199k|    t ^= t << 1;
20444|   199k|    t ^= s ^ (s << 4);
20445|   199k|    rng->a = t;
20446|   199k|    rng->counter += 362437;
20447|   199k|    return t + rng->counter;
20448|   199k|}
janet_net_init:
22070|  6.23k|void janet_net_init(void) {
22071|       |#ifdef JANET_WINDOWS
22072|       |    WSADATA wsaData;
22073|       |    janet_assert(!WSAStartup(MAKEWORD(2, 2), &wsaData), "could not start winsock");
22074|       |    janet_vm.connect_ex_loaded = 0;
22075|       |    janet_vm.connect_ex = NULL;
22076|       |#endif
22077|  6.23k|}
janet_net_deinit:
22079|  6.23k|void janet_net_deinit(void) {
22080|       |#ifdef JANET_WINDOWS
22081|       |    WSACleanup();
22082|       |#endif
22083|  6.23k|}
janet_is_symbol_char:
25219|  27.8M|int janet_is_symbol_char(uint8_t c) {
25220|  27.8M|    return symchars[c >> 5] & ((uint32_t)1 << (c & 0x1F));
25221|  27.8M|}
janet_valid_utf8:
25226|  3.63k|int janet_valid_utf8(const uint8_t *str, int32_t len) {
25227|  3.63k|    int32_t i = 0;
25228|  3.63k|    int32_t j;
25229|  6.45M|    while (i < len) {
  ------------------
  |  Branch (25229:12): [True: 6.45M, False: 3.38k]
  ------------------
25230|  6.45M|        int32_t nexti;
25231|  6.45M|        uint8_t c = str[i];
25232|       |
25233|       |        /* Check the number of bytes in code point */
25234|  6.45M|        if (c < 0x80) nexti = i + 1;
  ------------------
  |  Branch (25234:13): [True: 6.42M, False: 25.4k]
  ------------------
25235|  25.4k|        else if ((c >> 5) == 0x06) nexti = i + 2;
  ------------------
  |  Branch (25235:18): [True: 2.38k, False: 23.0k]
  ------------------
25236|  23.0k|        else if ((c >> 4) == 0x0E) nexti = i + 3;
  ------------------
  |  Branch (25236:18): [True: 1.18k, False: 21.9k]
  ------------------
25237|  21.9k|        else if ((c >> 3) == 0x1E) nexti = i + 4;
  ------------------
  |  Branch (25237:18): [True: 21.7k, False: 114]
  ------------------
25238|       |        /* Don't allow 5 or 6 byte code points */
25239|    114|        else return 0;
25240|       |
25241|       |        /* No overflow */
25242|  6.45M|        if (nexti > len) return 0;
  ------------------
  |  Branch (25242:13): [True: 71, False: 6.45M]
  ------------------
25243|       |
25244|       |        /* Ensure trailing bytes are well formed (10XX XXXX) */
25245|  6.52M|        for (j = i + 1; j < nexti; j++) {
  ------------------
  |  Branch (25245:25): [True: 69.9k, False: 6.45M]
  ------------------
25246|  69.9k|            if ((str[j] >> 6) != 2) return 0;
  ------------------
  |  Branch (25246:17): [True: 44, False: 69.9k]
  ------------------
25247|  69.9k|        }
25248|       |
25249|       |        /* Check for overlong encoding */
25250|  6.45M|        if ((nexti == i + 2) && str[i] < 0xC2) return 0;
  ------------------
  |  Branch (25250:13): [True: 2.31k, False: 6.45M]
  |  Branch (25250:33): [True: 4, False: 2.30k]
  ------------------
25251|  6.45M|        if ((str[i] == 0xE0) && str[i + 1] < 0xA0) return 0;
  ------------------
  |  Branch (25251:13): [True: 839, False: 6.45M]
  |  Branch (25251:33): [True: 10, False: 829]
  ------------------
25252|  6.45M|        if ((str[i] == 0xF0) && str[i + 1] < 0x90) return 0;
  ------------------
  |  Branch (25252:13): [True: 733, False: 6.45M]
  |  Branch (25252:33): [True: 3, False: 730]
  ------------------
25253|       |
25254|  6.45M|        i = nexti;
25255|  6.45M|    }
25256|  3.38k|    return 1;
25257|  3.63k|}
janet_parser_consume:
25861|  88.9M|void janet_parser_consume(JanetParser *parser, uint8_t c) {
25862|  88.9M|    int consumed = 0;
25863|  88.9M|    janet_parser_checkdead(parser);
25864|  88.9M|    if (c == '\r') {
  ------------------
  |  Branch (25864:9): [True: 2.44M, False: 86.4M]
  ------------------
25865|  2.44M|        parser->line++;
25866|  2.44M|        parser->column = 0;
25867|  86.4M|    } else if (c == '\n') {
  ------------------
  |  Branch (25867:16): [True: 47.3k, False: 86.4M]
  ------------------
25868|  47.3k|        parser->column = 0;
25869|  47.3k|        if (parser->lookback != '\r')
  ------------------
  |  Branch (25869:13): [True: 40.3k, False: 6.90k]
  ------------------
25870|  40.3k|            parser->line++;
25871|  86.4M|    } else {
25872|  86.4M|        parser->column++;
25873|  86.4M|    }
25874|   186M|    while (!consumed && !parser->error) {
  ------------------
  |  Branch (25874:12): [True: 97.2M, False: 88.9M]
  |  Branch (25874:25): [True: 97.2M, False: 701]
  ------------------
25875|  97.2M|        JanetParseState *state = parser->states + parser->statecount - 1;
25876|  97.2M|        consumed = state->consumer(parser, state, c);
25877|  97.2M|    }
25878|  88.9M|    parser->lookback = c;
25879|  88.9M|}
janet_parser_status:
25894|  88.9M|enum JanetParserStatus janet_parser_status(JanetParser *parser) {
25895|  88.9M|    if (parser->error) return JANET_PARSE_ERROR;
  ------------------
  |  Branch (25895:9): [True: 181, False: 88.9M]
  ------------------
25896|  88.9M|    if (parser->flag) return JANET_PARSE_DEAD;
  ------------------
  |  Branch (25896:9): [True: 0, False: 88.9M]
  ------------------
25897|  88.9M|    if (parser->statecount > 1) return JANET_PARSE_PENDING;
  ------------------
  |  Branch (25897:9): [True: 88.9M, False: 42.1k]
  ------------------
25898|  42.1k|    return JANET_PARSE_ROOT;
25899|  88.9M|}
janet_parser_init:
25948|  6.23k|void janet_parser_init(JanetParser *parser) {
25949|  6.23k|    parser->args = NULL;
25950|  6.23k|    parser->states = NULL;
25951|  6.23k|    parser->buf = NULL;
25952|  6.23k|    parser->argcount = 0;
25953|  6.23k|    parser->argcap = 0;
25954|  6.23k|    parser->bufcount = 0;
25955|  6.23k|    parser->bufcap = 0;
25956|  6.23k|    parser->statecount = 0;
25957|  6.23k|    parser->statecap = 0;
25958|  6.23k|    parser->error = NULL;
25959|  6.23k|    parser->lookback = -1;
25960|  6.23k|    parser->line = 1;
25961|  6.23k|    parser->column = 0;
25962|  6.23k|    parser->pending = 0;
25963|  6.23k|    parser->flag = 0;
25964|       |
25965|  6.23k|    pushstate(parser, root, PFLAG_CONTAINER);
  ------------------
  |  |25298|  6.23k|#define PFLAG_CONTAINER 0x100
  ------------------
25966|  6.23k|}
janet_parser_deinit:
25968|  6.23k|void janet_parser_deinit(JanetParser *parser) {
25969|  6.23k|    janet_free(parser->args);
  ------------------
  |  | 2415|  6.23k|#define janet_free(X) free((X))
  ------------------
25970|  6.23k|    janet_free(parser->buf);
  ------------------
  |  | 2415|  6.23k|#define janet_free(X) free((X))
  ------------------
25971|  6.23k|    janet_free(parser->states);
  ------------------
  |  | 2415|  6.23k|#define janet_free(X) free((X))
  ------------------
25972|  6.23k|}
janet_formatbv:
29575|     71|void janet_formatbv(JanetBuffer *b, const char *format, va_list args) {
29576|     71|    const char *format_end = format + strlen(format);
29577|     71|    const char *c = format;
29578|     71|    int32_t startlen = b->count;
29579|  1.98k|    while (c < format_end) {
  ------------------
  |  Branch (29579:12): [True: 1.91k, False: 71]
  ------------------
29580|  1.91k|        if (*c != '%') {
  ------------------
  |  Branch (29580:13): [True: 1.77k, False: 142]
  ------------------
29581|  1.77k|            janet_buffer_push_u8(b, (uint8_t) *c++);
29582|  1.77k|        } else if (*++c == '%') {
  ------------------
  |  Branch (29582:20): [True: 0, False: 142]
  ------------------
29583|      0|            janet_buffer_push_u8(b, (uint8_t) *c++);
29584|    142|        } else {
29585|    142|            char form[MAX_FORMAT], item[MAX_ITEM];
29586|    142|            char width[3], precision[3];
29587|    142|            int nb = 0; /* number of bytes in added item */
29588|    142|            c = scanformat(c, form, width, precision);
29589|    142|            switch (*c++) {
29590|      0|                case 'c': {
  ------------------
  |  Branch (29590:17): [True: 0, False: 142]
  ------------------
29591|      0|                    int n = va_arg(args, int);
29592|      0|                    nb = snprintf(item, MAX_ITEM, form, n);
  ------------------
  |  |29498|      0|#define MAX_ITEM  256
  ------------------
29593|      0|                    break;
29594|      0|                }
29595|    142|                case 'd':
  ------------------
  |  Branch (29595:17): [True: 142, False: 0]
  ------------------
29596|    142|                case 'i': {
  ------------------
  |  Branch (29596:17): [True: 0, False: 142]
  ------------------
29597|    142|                    int64_t n = (int64_t) va_arg(args, int32_t);
29598|    142|                    nb = snprintf(item, MAX_ITEM, form, n);
  ------------------
  |  |29498|    142|#define MAX_ITEM  256
  ------------------
29599|    142|                    break;
29600|    142|                }
29601|      0|                case 'D':
  ------------------
  |  Branch (29601:17): [True: 0, False: 142]
  ------------------
29602|      0|                case 'I': {
  ------------------
  |  Branch (29602:17): [True: 0, False: 142]
  ------------------
29603|      0|                    int64_t n = va_arg(args, int64_t);
29604|      0|                    nb = snprintf(item, MAX_ITEM, form, n);
  ------------------
  |  |29498|      0|#define MAX_ITEM  256
  ------------------
29605|      0|                    break;
29606|      0|                }
29607|      0|                case 'x':
  ------------------
  |  Branch (29607:17): [True: 0, False: 142]
  ------------------
29608|      0|                case 'X':
  ------------------
  |  Branch (29608:17): [True: 0, False: 142]
  ------------------
29609|      0|                case 'o':
  ------------------
  |  Branch (29609:17): [True: 0, False: 142]
  ------------------
29610|      0|                case 'u': {
  ------------------
  |  Branch (29610:17): [True: 0, False: 142]
  ------------------
29611|      0|                    uint64_t n = va_arg(args, uint64_t);
29612|      0|                    nb = snprintf(item, MAX_ITEM, form, n);
  ------------------
  |  |29498|      0|#define MAX_ITEM  256
  ------------------
29613|      0|                    break;
29614|      0|                }
29615|      0|                case 'a':
  ------------------
  |  Branch (29615:17): [True: 0, False: 142]
  ------------------
29616|      0|                case 'A':
  ------------------
  |  Branch (29616:17): [True: 0, False: 142]
  ------------------
29617|      0|                case 'e':
  ------------------
  |  Branch (29617:17): [True: 0, False: 142]
  ------------------
29618|      0|                case 'E':
  ------------------
  |  Branch (29618:17): [True: 0, False: 142]
  ------------------
29619|      0|                case 'f':
  ------------------
  |  Branch (29619:17): [True: 0, False: 142]
  ------------------
29620|      0|                case 'g':
  ------------------
  |  Branch (29620:17): [True: 0, False: 142]
  ------------------
29621|      0|                case 'G': {
  ------------------
  |  Branch (29621:17): [True: 0, False: 142]
  ------------------
29622|      0|                    double d = va_arg(args, double);
29623|      0|                    nb = snprintf(item, MAX_ITEM, form, d);
  ------------------
  |  |29498|      0|#define MAX_ITEM  256
  ------------------
29624|      0|                    break;
29625|      0|                }
29626|      0|                case 's':
  ------------------
  |  Branch (29626:17): [True: 0, False: 142]
  ------------------
29627|      0|                case 'S': {
  ------------------
  |  Branch (29627:17): [True: 0, False: 142]
  ------------------
29628|      0|                    const char *str = va_arg(args, const char *);
29629|      0|                    int32_t len = (c[-1] == 's')
  ------------------
  |  Branch (29629:35): [True: 0, False: 0]
  ------------------
29630|      0|                                  ? (int32_t) strlen(str)
29631|      0|                                  : janet_string_length((JanetString) str);
  ------------------
  |  | 1812|      0|#define janet_string_length(s) (janet_string_head(s)->length)
  |  |  ------------------
  |  |  |  | 1811|      0|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  ------------------
  ------------------
29632|      0|                    if (form[2] == '\0')
  ------------------
  |  Branch (29632:25): [True: 0, False: 0]
  ------------------
29633|      0|                        janet_buffer_push_bytes(b, (const uint8_t *) str, len);
29634|      0|                    else {
29635|      0|                        if (len != (int32_t) strlen((const char *) str))
  ------------------
  |  Branch (29635:29): [True: 0, False: 0]
  ------------------
29636|      0|                            janet_panic("string contains zeros");
29637|      0|                        if (!strchr(form, '.') && len >= 100) {
  ------------------
  |  Branch (29637:29): [True: 0, False: 0]
  |  Branch (29637:51): [True: 0, False: 0]
  ------------------
29638|      0|                            janet_panic("no precision and string is too long to be formatted");
29639|      0|                        } else {
29640|      0|                            nb = snprintf(item, MAX_ITEM, form, str);
  ------------------
  |  |29498|      0|#define MAX_ITEM  256
  ------------------
29641|      0|                        }
29642|      0|                    }
29643|      0|                    break;
29644|      0|                }
29645|      0|                case 'V':
  ------------------
  |  Branch (29645:17): [True: 0, False: 142]
  ------------------
29646|      0|                    janet_to_string_b(b, va_arg(args, Janet));
29647|      0|                    break;
29648|      0|                case 'v':
  ------------------
  |  Branch (29648:17): [True: 0, False: 142]
  ------------------
29649|      0|                    janet_description_b(b, va_arg(args, Janet));
29650|      0|                    break;
29651|      0|                case 't':
  ------------------
  |  Branch (29651:17): [True: 0, False: 142]
  ------------------
29652|      0|                    janet_buffer_push_cstring(b, typestr(va_arg(args, Janet)));
29653|      0|                    break;
29654|      0|                case 'T': {
  ------------------
  |  Branch (29654:17): [True: 0, False: 142]
  ------------------
29655|      0|                    int types = va_arg(args, int);
29656|      0|                    pushtypes(b, types);
29657|      0|                    break;
29658|      0|                }
29659|      0|                case 'M':
  ------------------
  |  Branch (29659:17): [True: 0, False: 142]
  ------------------
29660|      0|                case 'm':
  ------------------
  |  Branch (29660:17): [True: 0, False: 142]
  ------------------
29661|      0|                case 'N':
  ------------------
  |  Branch (29661:17): [True: 0, False: 142]
  ------------------
29662|      0|                case 'n':
  ------------------
  |  Branch (29662:17): [True: 0, False: 142]
  ------------------
29663|      0|                case 'Q':
  ------------------
  |  Branch (29663:17): [True: 0, False: 142]
  ------------------
29664|      0|                case 'q':
  ------------------
  |  Branch (29664:17): [True: 0, False: 142]
  ------------------
29665|      0|                case 'P':
  ------------------
  |  Branch (29665:17): [True: 0, False: 142]
  ------------------
29666|      0|                case 'p': { /* janet pretty , precision = depth */
  ------------------
  |  Branch (29666:17): [True: 0, False: 142]
  ------------------
29667|      0|                    int depth = atoi(precision);
29668|      0|                    if (depth < 1) depth = JANET_RECURSION_GUARD;
  ------------------
  |  |  296|      0|#define JANET_RECURSION_GUARD 1024
  ------------------
  |  Branch (29668:25): [True: 0, False: 0]
  ------------------
29669|      0|                    char d = c[-1];
29670|      0|                    int has_color = (d == 'P') || (d == 'Q') || (d == 'M') || (d == 'N');
  ------------------
  |  Branch (29670:37): [True: 0, False: 0]
  |  Branch (29670:51): [True: 0, False: 0]
  |  Branch (29670:65): [True: 0, False: 0]
  |  Branch (29670:79): [True: 0, False: 0]
  ------------------
29671|      0|                    int has_oneline = (d == 'Q') || (d == 'q') || (d == 'N') || (d == 'n');
  ------------------
  |  Branch (29671:39): [True: 0, False: 0]
  |  Branch (29671:53): [True: 0, False: 0]
  |  Branch (29671:67): [True: 0, False: 0]
  |  Branch (29671:81): [True: 0, False: 0]
  ------------------
29672|      0|                    int has_notrunc = (d == 'M') || (d == 'm') || (d == 'N') || (d == 'n');
  ------------------
  |  Branch (29672:39): [True: 0, False: 0]
  |  Branch (29672:53): [True: 0, False: 0]
  |  Branch (29672:67): [True: 0, False: 0]
  |  Branch (29672:81): [True: 0, False: 0]
  ------------------
29673|      0|                    int columns = atoi(width);
29674|      0|                    if (columns == 0) {
  ------------------
  |  Branch (29674:25): [True: 0, False: 0]
  ------------------
29675|      0|                        columns = JANET_COLUMNS;
  ------------------
  |  |29411|      0|#define JANET_COLUMNS 80
  ------------------
29676|      0|                    } else if (columns < 0) {
  ------------------
  |  Branch (29676:32): [True: 0, False: 0]
  ------------------
29677|      0|                        has_oneline = 1;
29678|      0|                    }
29679|      0|                    int flags = 0;
29680|      0|                    flags |= has_color ? JANET_PRETTY_COLOR : 0;
  ------------------
  |  | 1966|      0|#define JANET_PRETTY_COLOR 1
  ------------------
  |  Branch (29680:30): [True: 0, False: 0]
  ------------------
29681|      0|                    flags |= has_oneline ? JANET_PRETTY_ONELINE : 0;
  ------------------
  |  | 1967|      0|#define JANET_PRETTY_ONELINE 2
  ------------------
  |  Branch (29681:30): [True: 0, False: 0]
  ------------------
29682|      0|                    flags |= has_notrunc ? JANET_PRETTY_NOTRUNC : 0;
  ------------------
  |  | 1968|      0|#define JANET_PRETTY_NOTRUNC 4
  ------------------
  |  Branch (29682:30): [True: 0, False: 0]
  ------------------
29683|      0|                    janet_pretty_(b, depth, columns, flags,
29684|      0|                                  va_arg(args, Janet), startlen, b->count);
29685|      0|                    break;
29686|      0|                }
29687|      0|                case 'j': {
  ------------------
  |  Branch (29687:17): [True: 0, False: 142]
  ------------------
29688|      0|                    int depth = atoi(precision);
29689|      0|                    if (depth < 1) {
  ------------------
  |  Branch (29689:25): [True: 0, False: 0]
  ------------------
29690|      0|                        depth = JANET_RECURSION_GUARD;
  ------------------
  |  |  296|      0|#define JANET_RECURSION_GUARD 1024
  ------------------
29691|      0|                    }
29692|      0|                    janet_jdn_(b, depth, va_arg(args, Janet), startlen, b->count);
29693|      0|                    break;
29694|      0|                }
29695|      0|                default: {
  ------------------
  |  Branch (29695:17): [True: 0, False: 142]
  ------------------
29696|       |                    /* also treat cases 'nLlh' */
29697|      0|                    janet_panicf("invalid conversion '%s' to 'format'",
29698|      0|                                 form);
29699|      0|                }
29700|    142|            }
29701|    142|            if (nb >= MAX_ITEM)
  ------------------
  |  |29498|    142|#define MAX_ITEM  256
  ------------------
  |  Branch (29701:17): [True: 0, False: 142]
  ------------------
29702|      0|                janet_panic("format buffer overflow");
29703|    142|            if (nb > 0)
  ------------------
  |  Branch (29703:17): [True: 142, False: 0]
  ------------------
29704|    142|                janet_buffer_push_bytes(b, (uint8_t *) item, nb);
29705|    142|        }
29706|       |
29707|  1.91k|    }
29708|     71|}
janet_formatb:
29734|     71|JanetBuffer *janet_formatb(JanetBuffer *buffer, const char *format, ...) {
29735|     71|    va_list args;
29736|     71|    va_start(args, format);
29737|     71|    janet_formatbv(buffer, format, args);
29738|       |    va_end(args);
29739|     71|    return buffer;
29740|     71|}
janet_string:
31608|  4.19M|const uint8_t *janet_string(const uint8_t *buf, int32_t len) {
31609|  4.19M|    JanetStringHead *head = janet_gcalloc(JANET_MEMORY_STRING, sizeof(JanetStringHead) + (size_t) len + 1);
31610|  4.19M|    head->length = len;
31611|  4.19M|    head->hash = janet_string_calchash(buf, len);
31612|  4.19M|    uint8_t *data = (uint8_t *)head->data;
31613|  4.19M|    safe_memcpy(data, buf, len);
31614|  4.19M|    data[len] = 0;
31615|  4.19M|    return data;
31616|  4.19M|}
janet_string_compare:
31619|  1.32M|int janet_string_compare(const uint8_t *lhs, const uint8_t *rhs) {
31620|  1.32M|    int32_t xlen = janet_string_length(lhs);
  ------------------
  |  | 1812|  1.32M|#define janet_string_length(s) (janet_string_head(s)->length)
  |  |  ------------------
  |  |  |  | 1811|  1.32M|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  ------------------
  ------------------
31621|  1.32M|    int32_t ylen = janet_string_length(rhs);
  ------------------
  |  | 1812|  1.32M|#define janet_string_length(s) (janet_string_head(s)->length)
  |  |  ------------------
  |  |  |  | 1811|  1.32M|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  ------------------
  ------------------
31622|  1.32M|    int32_t len = xlen > ylen ? ylen : xlen;
  ------------------
  |  Branch (31622:19): [True: 941, False: 1.32M]
  ------------------
31623|  1.32M|    int res = memcmp(lhs, rhs, len);
31624|  1.32M|    if (res) return res > 0 ? 1 : -1;
  ------------------
  |  Branch (31624:9): [True: 865, False: 1.32M]
  |  Branch (31624:21): [True: 333, False: 532]
  ------------------
31625|  1.32M|    if (xlen == ylen) return 0;
  ------------------
  |  Branch (31625:9): [True: 1.32M, False: 1.19k]
  ------------------
31626|  1.19k|    return xlen < ylen ? -1 : 1;
  ------------------
  |  Branch (31626:12): [True: 257, False: 937]
  ------------------
31627|  1.32M|}
janet_string_equalconst:
31630|  8.60M|int janet_string_equalconst(const uint8_t *lhs, const uint8_t *rhs, int32_t rlen, int32_t rhash) {
31631|  8.60M|    int32_t lhash = janet_string_hash(lhs);
  ------------------
  |  | 1813|  8.60M|#define janet_string_hash(s) (janet_string_head(s)->hash)
  |  |  ------------------
  |  |  |  | 1811|  8.60M|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  ------------------
  ------------------
31632|  8.60M|    int32_t llen = janet_string_length(lhs);
  ------------------
  |  | 1812|  8.60M|#define janet_string_length(s) (janet_string_head(s)->length)
  |  |  ------------------
  |  |  |  | 1811|  8.60M|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  ------------------
  ------------------
31633|  8.60M|    if (lhash != rhash || llen != rlen)
  ------------------
  |  Branch (31633:9): [True: 860k, False: 7.74M]
  |  Branch (31633:27): [True: 893, False: 7.74M]
  ------------------
31634|   861k|        return 0;
31635|  7.74M|    if (lhs == rhs)
  ------------------
  |  Branch (31635:9): [True: 35.0k, False: 7.71M]
  ------------------
31636|  35.0k|        return 1;
31637|  7.71M|    return !memcmp(lhs, rhs, rlen);
31638|  7.74M|}
janet_string_equal:
31641|   148k|int janet_string_equal(const uint8_t *lhs, const uint8_t *rhs) {
31642|   148k|    return janet_string_equalconst(lhs, rhs,
31643|   148k|                                   janet_string_length(rhs), janet_string_hash(rhs));
  ------------------
  |  | 1812|   148k|#define janet_string_length(s) (janet_string_head(s)->length)
  |  |  ------------------
  |  |  |  | 1811|   148k|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  ------------------
  ------------------
                                                 janet_string_length(rhs), janet_string_hash(rhs));
  ------------------
  |  | 1813|   148k|#define janet_string_hash(s) (janet_string_head(s)->hash)
  |  |  ------------------
  |  |  |  | 1811|   148k|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  ------------------
  ------------------
31644|   148k|}
janet_scan_number_base:
32485|   199k|    double *out) {
32486|   199k|    const uint8_t *end = str + len;
32487|   199k|    int seenadigit = 0;
32488|   199k|    int ex = 0;
32489|   199k|    int seenpoint = 0;
32490|   199k|    int foundexp = 0;
32491|   199k|    int neg = 0;
32492|   199k|    struct BigNat mant;
32493|   199k|    bignat_zero(&mant);
32494|       |
32495|       |    /* Prevent some kinds of overflow bugs relating to the exponent
32496|       |     * overflowing.  For example, if a string was passed 2GB worth of 0s after
32497|       |     * the decimal point, exponent could wrap around and become positive. It's
32498|       |     * easier to reject ridiculously large inputs than to check for overflows.
32499|       |     * */
32500|   199k|    if (len > JANET_NUMBER_LENGTH_RIDICULOUS) goto error;
  ------------------
  |  |32281|   199k|#define JANET_NUMBER_LENGTH_RIDICULOUS 0xFFFF
  ------------------
  |  Branch (32500:9): [True: 23, False: 199k]
  ------------------
32501|       |
32502|       |    /* Get sign */
32503|   199k|    if (str >= end) goto error;
  ------------------
  |  Branch (32503:9): [True: 0, False: 199k]
  ------------------
32504|   199k|    if (*str == '-') {
  ------------------
  |  Branch (32504:9): [True: 147k, False: 51.9k]
  ------------------
32505|   147k|        neg = 1;
32506|   147k|        str++;
32507|   147k|    } else if (*str == '+') {
  ------------------
  |  Branch (32507:16): [True: 3.35k, False: 48.6k]
  ------------------
32508|  3.35k|        str++;
32509|  3.35k|    }
32510|       |
32511|       |    /* Check for leading 0x or digit digit r */
32512|   199k|    if (base == 0) {
  ------------------
  |  Branch (32512:9): [True: 199k, False: 0]
  ------------------
32513|   199k|        if (str + 1 < end && str[0] == '0' && str[1] == 'x') {
  ------------------
  |  Branch (32513:13): [True: 112k, False: 86.9k]
  |  Branch (32513:30): [True: 22.7k, False: 89.8k]
  |  Branch (32513:47): [True: 1.10k, False: 21.6k]
  ------------------
32514|  1.10k|            base = 16;
32515|  1.10k|            str += 2;
32516|   198k|        } else if (str + 1 < end  &&
  ------------------
  |  Branch (32516:20): [True: 111k, False: 86.9k]
  ------------------
32517|   111k|                   str[0] >= '0' && str[0] <= '9' &&
  ------------------
  |  Branch (32517:20): [True: 99.1k, False: 12.3k]
  |  Branch (32517:37): [True: 95.5k, False: 3.63k]
  ------------------
32518|  95.5k|                   str[1] == 'r') {
  ------------------
  |  Branch (32518:20): [True: 15.1k, False: 80.3k]
  ------------------
32519|  15.1k|            base = str[0] - '0';
32520|  15.1k|            str += 2;
32521|   183k|        } else if (str + 2 < end  &&
  ------------------
  |  Branch (32521:20): [True: 81.6k, False: 101k]
  ------------------
32522|  81.6k|                   str[0] >= '0' && str[0] <= '9' &&
  ------------------
  |  Branch (32522:20): [True: 75.1k, False: 6.51k]
  |  Branch (32522:37): [True: 73.4k, False: 1.67k]
  ------------------
32523|  73.4k|                   str[1] >= '0' && str[1] <= '9' &&
  ------------------
  |  Branch (32523:20): [True: 68.4k, False: 5.01k]
  |  Branch (32523:37): [True: 66.3k, False: 2.06k]
  ------------------
32524|  66.3k|                   str[2] == 'r') {
  ------------------
  |  Branch (32524:20): [True: 43.4k, False: 22.9k]
  ------------------
32525|  43.4k|            base = 10 * (str[0] - '0') + (str[1] - '0');
32526|  43.4k|            if (base < 2 || base > 36) goto error;
  ------------------
  |  Branch (32526:17): [True: 207, False: 43.2k]
  |  Branch (32526:29): [True: 27.4k, False: 15.8k]
  ------------------
32527|  15.8k|            str += 3;
32528|  15.8k|        }
32529|   199k|    }
32530|       |
32531|       |    /* If still base is 0, set to default (10) */
32532|   171k|    if (base == 0) {
  ------------------
  |  Branch (32532:9): [True: 151k, False: 20.8k]
  ------------------
32533|   151k|        base = 10;
32534|   151k|    }
32535|   171k|    int exp_base = base;
32536|       |
32537|       |    /* Skip leading zeros */
32538|   218k|    while (str < end && (*str == '0' || *str == '.')) {
  ------------------
  |  Branch (32538:12): [True: 148k, False: 69.8k]
  |  Branch (32538:26): [True: 35.2k, False: 113k]
  |  Branch (32538:41): [True: 12.6k, False: 100k]
  ------------------
32539|  47.8k|        if (seenpoint) ex--;
  ------------------
  |  Branch (32539:13): [True: 1.72k, False: 46.1k]
  ------------------
32540|  47.8k|        if (*str == '.') {
  ------------------
  |  Branch (32540:13): [True: 12.6k, False: 35.2k]
  ------------------
32541|  12.6k|            if (seenpoint) goto error;
  ------------------
  |  Branch (32541:17): [True: 1.26k, False: 11.3k]
  ------------------
32542|  11.3k|            seenpoint = 1;
32543|  35.2k|        } else {
32544|  35.2k|            seenadigit = 1;
32545|  35.2k|        }
32546|  46.5k|        str++;
32547|  46.5k|    }
32548|       |
32549|       |    /* Parse significant digits */
32550|   956k|    while (str < end) {
  ------------------
  |  Branch (32550:12): [True: 840k, False: 115k]
  ------------------
32551|   840k|        if (*str == '.') {
  ------------------
  |  Branch (32551:13): [True: 1.40k, False: 839k]
  ------------------
32552|  1.40k|            if (seenpoint) goto error;
  ------------------
  |  Branch (32552:17): [True: 445, False: 960]
  ------------------
32553|    960|            seenpoint = 1;
32554|   839k|        } else if (*str == '&') {
  ------------------
  |  Branch (32554:20): [True: 10.2k, False: 828k]
  ------------------
32555|  10.2k|            foundexp = 1;
32556|  10.2k|            break;
32557|   828k|        } else if (base == 16 && (*str == 'P' || *str == 'p')) { /* IEEE hex float */
  ------------------
  |  Branch (32557:20): [True: 364k, False: 464k]
  |  Branch (32557:35): [True: 220, False: 363k]
  |  Branch (32557:50): [True: 623, False: 363k]
  ------------------
32558|    843|            foundexp = 1;
32559|    843|            exp_base = 10;
32560|    843|            base = 2;
32561|    843|            ex *= 4; /* We need to correct the current exponent after we change the base */
32562|    843|            break;
32563|   827k|        } else if (base == 10 && (*str == 'E' || *str == 'e')) {
  ------------------
  |  Branch (32563:20): [True: 167k, False: 660k]
  |  Branch (32563:35): [True: 2.15k, False: 165k]
  |  Branch (32563:50): [True: 854, False: 164k]
  ------------------
32564|  3.00k|            foundexp = 1;
32565|  3.00k|            break;
32566|   824k|        } else if (*str == '_') {
  ------------------
  |  Branch (32566:20): [True: 2.25k, False: 822k]
  ------------------
32567|  2.25k|            if (!seenadigit) goto error;
  ------------------
  |  Branch (32567:17): [True: 1.37k, False: 872]
  ------------------
32568|   822k|        } else {
32569|   822k|            int digit = digit_lookup[*str & 0x7F];
32570|   822k|            if (*str > 127 || digit >= base) goto error;
  ------------------
  |  Branch (32570:17): [True: 619, False: 822k]
  |  Branch (32570:31): [True: 38.2k, False: 783k]
  ------------------
32571|   783k|            if (seenpoint) ex--;
  ------------------
  |  Branch (32571:17): [True: 544k, False: 239k]
  ------------------
32572|   783k|            bignat_muladd(&mant, base, digit);
32573|   783k|            seenadigit = 1;
32574|   783k|        }
32575|   785k|        str++;
32576|   785k|    }
32577|       |
32578|   129k|    if (!seenadigit)
  ------------------
  |  Branch (32578:9): [True: 54.6k, False: 75.3k]
  ------------------
32579|  54.6k|        goto error;
32580|       |
32581|       |    /* Read exponent */
32582|  75.3k|    if (str < end && foundexp) {
  ------------------
  |  Branch (32582:9): [True: 9.58k, False: 65.7k]
  |  Branch (32582:22): [True: 9.58k, False: 0]
  ------------------
32583|  9.58k|        int eneg = 0;
32584|  9.58k|        int32_t ee = 0;
32585|  9.58k|        seenadigit = 0;
32586|  9.58k|        str++;
32587|  9.58k|        if (str >= end) goto error;
  ------------------
  |  Branch (32587:13): [True: 1.28k, False: 8.30k]
  ------------------
32588|  8.30k|        if (*str == '-') {
  ------------------
  |  Branch (32588:13): [True: 1.04k, False: 7.25k]
  ------------------
32589|  1.04k|            eneg = 1;
32590|  1.04k|            str++;
32591|  7.25k|        } else if (*str == '+') {
  ------------------
  |  Branch (32591:20): [True: 1.82k, False: 5.43k]
  ------------------
32592|  1.82k|            str++;
32593|  1.82k|        }
32594|       |        /* Skip leading 0s in exponent */
32595|  10.4k|        while (str < end && *str == '0') {
  ------------------
  |  Branch (32595:16): [True: 9.98k, False: 450]
  |  Branch (32595:29): [True: 2.12k, False: 7.85k]
  ------------------
32596|  2.12k|            str++;
32597|  2.12k|            seenadigit = 1;
32598|  2.12k|        }
32599|  24.9k|        while (str < end) {
  ------------------
  |  Branch (32599:16): [True: 17.8k, False: 7.11k]
  ------------------
32600|  17.8k|            int digit = digit_lookup[*str & 0x7F];
32601|  17.8k|            if (*str > 127 || digit >= exp_base) goto error;
  ------------------
  |  Branch (32601:17): [True: 201, False: 17.6k]
  |  Branch (32601:31): [True: 990, False: 16.6k]
  ------------------
32602|  16.6k|            if (ee < (INT32_MAX / 40)) {
  ------------------
  |  Branch (32602:17): [True: 16.0k, False: 623]
  ------------------
32603|  16.0k|                ee = exp_base * ee + digit;
32604|  16.0k|            }
32605|  16.6k|            str++;
32606|  16.6k|            seenadigit = 1;
32607|  16.6k|        }
32608|  7.11k|        if (eneg) ex -= ee;
  ------------------
  |  Branch (32608:13): [True: 1.04k, False: 6.07k]
  ------------------
32609|  6.07k|        else ex += ee;
32610|  7.11k|    }
32611|       |
32612|  72.8k|    if (!seenadigit)
  ------------------
  |  Branch (32612:9): [True: 223, False: 72.6k]
  ------------------
32613|    223|        goto error;
32614|       |
32615|  72.6k|    *out = convert(neg, &mant, base, ex);
32616|  72.6k|    janet_free(mant.digits);
  ------------------
  |  | 2415|  72.6k|#define janet_free(X) free((X))
  ------------------
32617|  72.6k|    return 0;
32618|       |
32619|   127k|error:
32620|   127k|    janet_free(mant.digits);
  ------------------
  |  | 2415|   127k|#define janet_free(X) free((X))
  ------------------
32621|   127k|    return 1;
32622|  72.8k|}
janet_scan_int64:
32695|   136k|int janet_scan_int64(const uint8_t *str, int32_t len, int64_t *out) {
32696|   136k|    int neg;
32697|   136k|    uint64_t bi;
32698|   136k|    if (scan_uint64(str, len, &bi, &neg)) {
  ------------------
  |  Branch (32698:9): [True: 96.5k, False: 39.9k]
  ------------------
32699|  96.5k|        if (neg && bi <= ((UINT64_MAX / 2) + 1)) {
  ------------------
  |  Branch (32699:13): [True: 66.5k, False: 29.9k]
  |  Branch (32699:20): [True: 65.1k, False: 1.42k]
  ------------------
32700|  65.1k|            if (bi > INT64_MAX) {
  ------------------
  |  Branch (32700:17): [True: 15.3k, False: 49.8k]
  ------------------
32701|  15.3k|                *out = INT64_MIN;
32702|  49.8k|            } else {
32703|  49.8k|                *out = -((int64_t) bi);
32704|  49.8k|            }
32705|  65.1k|            return 1;
32706|  65.1k|        }
32707|  31.4k|        if (!neg && bi <= INT64_MAX) {
  ------------------
  |  Branch (32707:13): [True: 29.9k, False: 1.42k]
  |  Branch (32707:21): [True: 29.4k, False: 536]
  ------------------
32708|  29.4k|            *out = (int64_t) bi;
32709|  29.4k|            return 1;
32710|  29.4k|        }
32711|  31.4k|    }
32712|  41.9k|    return 0;
32713|   136k|}
janet_scan_uint64:
32715|  4.20k|int janet_scan_uint64(const uint8_t *str, int32_t len, uint64_t *out) {
32716|  4.20k|    int neg;
32717|  4.20k|    uint64_t bi;
32718|  4.20k|    if (scan_uint64(str, len, &bi, &neg)) {
  ------------------
  |  Branch (32718:9): [True: 2.66k, False: 1.54k]
  ------------------
32719|  2.66k|        if (!neg) {
  ------------------
  |  Branch (32719:13): [True: 2.45k, False: 212]
  ------------------
32720|  2.45k|            *out = bi;
32721|  2.45k|            return 1;
32722|  2.45k|        }
32723|  2.66k|    }
32724|  1.75k|    return 0;
32725|  4.20k|}
janet_scan_numeric:
32732|   344k|    Janet *out) {
32733|   344k|    int result;
32734|   344k|    double num;
32735|   344k|    int64_t i64 = 0;
32736|   344k|    uint64_t u64 = 0;
32737|   344k|    if (len < 2 || str[len - 2] != ':') {
  ------------------
  |  Branch (32737:9): [True: 71.0k, False: 273k]
  |  Branch (32737:20): [True: 128k, False: 145k]
  ------------------
32738|   199k|        result = janet_scan_number_base(str, len, 0, &num);
32739|   199k|        *out = janet_wrap_number(num);
  ------------------
  |  |  835|   199k|#define janet_wrap_number(r) janet_nanbox_from_double(r)
  ------------------
32740|   199k|        return result;
32741|   199k|    }
32742|   145k|    switch (str[len - 1]) {
32743|  4.52k|        default:
  ------------------
  |  Branch (32743:9): [True: 4.52k, False: 141k]
  ------------------
32744|  4.52k|            return 1;
32745|    336|        case 'n':
  ------------------
  |  Branch (32745:9): [True: 336, False: 145k]
  ------------------
32746|    336|            result = janet_scan_number_base(str, len - 2, 0, &num);
32747|    336|            *out = janet_wrap_number(num);
  ------------------
  |  |  835|    336|#define janet_wrap_number(r) janet_nanbox_from_double(r)
  ------------------
32748|    336|            return result;
32749|       |        /* Condition is inverted janet_scan_int64 and janet_scan_uint64 */
32750|   136k|        case 's':
  ------------------
  |  Branch (32750:9): [True: 136k, False: 9.07k]
  ------------------
32751|   136k|            result = !janet_scan_int64(str, len - 2, &i64);
32752|   136k|            *out = janet_wrap_s64(i64);
32753|   136k|            return result;
32754|  4.20k|        case 'u':
  ------------------
  |  Branch (32754:9): [True: 4.20k, False: 141k]
  ------------------
32755|  4.20k|            result = !janet_scan_uint64(str, len - 2, &u64);
32756|  4.20k|            *out = janet_wrap_u64(u64);
32757|  4.20k|            return result;
32758|   145k|    }
32759|   145k|}
janet_struct_begin:
32813|  3.61M|JanetKV *janet_struct_begin(int32_t count) {
32814|       |    /* Calculate capacity as power of 2 after 2 * count. */
32815|  3.61M|    int32_t capacity = janet_tablen(2 * count);
32816|  3.61M|    if (capacity < 0) capacity = janet_tablen(count + 1);
  ------------------
  |  Branch (32816:9): [True: 0, False: 3.61M]
  ------------------
32817|       |
32818|  3.61M|    size_t size = sizeof(JanetStructHead) + (size_t) capacity * sizeof(JanetKV);
32819|  3.61M|    JanetStructHead *head = janet_gcalloc(JANET_MEMORY_STRUCT, size);
32820|  3.61M|    head->length = count;
32821|  3.61M|    head->capacity = capacity;
32822|  3.61M|    head->hash = 0;
32823|  3.61M|    head->proto = NULL;
32824|       |
32825|  3.61M|    JanetKV *st = (JanetKV *)(head->data);
32826|  3.61M|    janet_memempty(st, capacity);
32827|  3.61M|    return st;
32828|  3.61M|}
janet_struct_put_ext:
32853|  6.39M|void janet_struct_put_ext(JanetKV *st, Janet key, Janet value, int replace) {
32854|  6.39M|    int32_t cap = janet_struct_capacity(st);
  ------------------
  |  | 1848|  6.39M|#define janet_struct_capacity(t) (janet_struct_head(t)->capacity)
  |  |  ------------------
  |  |  |  | 1845|  6.39M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
32855|  6.39M|    int32_t hash = janet_hash(key);
32856|  6.39M|    int32_t index = janet_maphash(cap, hash);
  ------------------
  |  |  396|  6.39M|#define janet_maphash(cap, hash) ((uint32_t)(hash) & (cap - 1))
  ------------------
32857|  6.39M|    int32_t i, j, dist;
32858|  6.39M|    int32_t bounds[4] = {index, cap, 0, index};
32859|  6.39M|    if (janet_checktype(key, JANET_NIL) || janet_checktype(value, JANET_NIL)) return;
  ------------------
  |  |  806|  12.7M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 15.6k, False: 6.37M]
  |  |  |  Branch (806:6): [Folded, False: 6.39M]
  |  |  ------------------
  |  |  807|  12.7M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  12.7M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  6.39M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  6.39M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  6.39M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  6.39M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (janet_checktype(key, JANET_NIL) || janet_checktype(value, JANET_NIL)) return;
  ------------------
  |  |  806|  6.37M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 1.45k, False: 6.37M]
  |  |  |  Branch (806:6): [Folded, False: 6.37M]
  |  |  ------------------
  |  |  807|  6.37M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  6.37M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  6.37M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  6.37M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  6.37M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  6.37M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
32860|  6.37M|    if (janet_checktype(key, JANET_NUMBER) && isnan(janet_unwrap_number(key))) return;
  ------------------
  |  |  806|  12.7M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 11.6k, False: 6.36M]
  |  |  |  Branch (806:6): [True: 6.37M, Folded]
  |  |  ------------------
  |  |  807|  12.7M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|  6.37M|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 11.6k, False: 6.36M]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 6.36M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  12.7M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|      0|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|      0|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|      0|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (32860:47): [True: 0, False: 11.6k]
  ------------------
32861|       |    /* Avoid extra items */
32862|  6.37M|    if (janet_struct_hash(st) == janet_struct_length(st)) return;
  ------------------
  |  | 1849|  6.37M|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|  6.37M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
                  if (janet_struct_hash(st) == janet_struct_length(st)) return;
  ------------------
  |  | 1847|  6.37M|#define janet_struct_length(t) (janet_struct_head(t)->length)
  |  |  ------------------
  |  |  |  | 1845|  6.37M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
  |  Branch (32862:9): [True: 0, False: 6.37M]
  ------------------
32863|  6.37M|    for (dist = 0, j = 0; j < 4; j += 2)
  ------------------
  |  Branch (32863:27): [True: 6.37M, False: 0]
  ------------------
32864|  8.12M|        for (i = bounds[j]; i < bounds[j + 1]; i++, dist++) {
  ------------------
  |  Branch (32864:29): [True: 8.12M, False: 2.95k]
  ------------------
32865|  8.12M|            int status;
32866|  8.12M|            int32_t otherhash;
32867|  8.12M|            int32_t otherindex, otherdist;
32868|  8.12M|            JanetKV *kv = st + i;
32869|       |            /* We found an empty slot, so just add key and value */
32870|  8.12M|            if (janet_checktype(kv->key, JANET_NIL)) {
  ------------------
  |  |  806|  8.12M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 4.58M, False: 3.53M]
  |  |  |  Branch (806:6): [Folded, False: 8.12M]
  |  |  ------------------
  |  |  807|  8.12M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  8.12M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  8.12M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  8.12M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  8.12M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  8.12M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
32871|  4.58M|                kv->key = key;
32872|  4.58M|                kv->value = value;
32873|       |                /* Update the temporary count */
32874|  4.58M|                janet_struct_hash(st)++;
  ------------------
  |  | 1849|  4.58M|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|  4.58M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
32875|  4.58M|                return;
32876|  4.58M|            }
32877|       |            /* Robinhood hashing - check if colliding kv pair
32878|       |             * is closer to their source than current. We use robinhood
32879|       |             * hashing to ensure that equivalent structs that are constructed
32880|       |             * with different order have the same internal layout, and therefor
32881|       |             * will compare properly - i.e., {1 2 3 4} should equal {3 4 1 2}.
32882|       |             * Collisions are resolved via an insertion sort insertion. */
32883|  3.53M|            otherhash = janet_hash(kv->key);
32884|  3.53M|            otherindex = janet_maphash(cap, otherhash);
  ------------------
  |  |  396|  3.53M|#define janet_maphash(cap, hash) ((uint32_t)(hash) & (cap - 1))
  ------------------
32885|  3.53M|            otherdist = (i + cap - otherindex) & (cap - 1);
32886|  3.53M|            if (dist < otherdist)
  ------------------
  |  Branch (32886:17): [True: 417k, False: 3.11M]
  ------------------
32887|   417k|                status = -1;
32888|  3.11M|            else if (otherdist < dist)
  ------------------
  |  Branch (32888:22): [True: 228k, False: 2.89M]
  ------------------
32889|   228k|                status = 1;
32890|  2.89M|            else if (hash < otherhash)
  ------------------
  |  Branch (32890:22): [True: 646k, False: 2.24M]
  ------------------
32891|   646k|                status = -1;
32892|  2.24M|            else if (otherhash < hash)
  ------------------
  |  Branch (32892:22): [True: 289k, False: 1.95M]
  ------------------
32893|   289k|                status = 1;
32894|  1.95M|            else
32895|  1.95M|                status = janet_compare(key, kv->key);
32896|       |            /* If other is closer to their ideal slot */
32897|  3.53M|            if (status == 1) {
  ------------------
  |  Branch (32897:17): [True: 520k, False: 3.01M]
  ------------------
32898|       |                /* Swap current kv pair with pair in slot */
32899|   520k|                JanetKV temp = *kv;
32900|   520k|                kv->key = key;
32901|   520k|                kv->value = value;
32902|   520k|                key = temp.key;
32903|   520k|                value = temp.value;
32904|       |                /* Save dist and hash of new kv pair */
32905|   520k|                dist = otherdist;
32906|   520k|                hash = otherhash;
32907|  3.01M|            } else if (status == 0) {
  ------------------
  |  Branch (32907:24): [True: 1.78M, False: 1.22M]
  ------------------
32908|  1.78M|                if (replace) {
  ------------------
  |  Branch (32908:21): [True: 1.78M, False: 0]
  ------------------
32909|       |                    /* A key was added to the struct more than once - replace old value */
32910|  1.78M|                    kv->value = value;
32911|  1.78M|                }
32912|  1.78M|                return;
32913|  1.78M|            }
32914|  3.53M|        }
32915|  6.37M|}
janet_struct_put:
32917|  6.39M|void janet_struct_put(JanetKV *st, Janet key, Janet value) {
32918|  6.39M|    janet_struct_put_ext(st, key, value, 1);
32919|  6.39M|}
janet_struct_end:
32922|  3.61M|const JanetKV *janet_struct_end(JanetKV *st) {
32923|  3.61M|    if (janet_struct_hash(st) != janet_struct_length(st)) {
  ------------------
  |  | 1849|  3.61M|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|  3.61M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
                  if (janet_struct_hash(st) != janet_struct_length(st)) {
  ------------------
  |  | 1847|  3.61M|#define janet_struct_length(t) (janet_struct_head(t)->length)
  |  |  ------------------
  |  |  |  | 1845|  3.61M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
  |  Branch (32923:9): [True: 2.70k, False: 3.61M]
  ------------------
32924|       |        /* Error building struct, probably duplicate values. We need to rebuild
32925|       |         * the struct using only the values that went in. The second creation should always
32926|       |         * succeed. */
32927|  2.70k|        JanetKV *newst = janet_struct_begin(janet_struct_hash(st));
  ------------------
  |  | 1849|  2.70k|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|  2.70k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
32928|  12.1M|        for (int32_t i = 0; i < janet_struct_capacity(st); i++) {
  ------------------
  |  | 1848|  12.1M|#define janet_struct_capacity(t) (janet_struct_head(t)->capacity)
  |  |  ------------------
  |  |  |  | 1845|  12.1M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
  |  Branch (32928:29): [True: 12.1M, False: 2.70k]
  ------------------
32929|  12.1M|            JanetKV *kv = st + i;
32930|  12.1M|            if (!janet_checktype(kv->key, JANET_NIL)) {
  ------------------
  |  |  806|  12.1M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:6): [Folded, False: 12.1M]
  |  |  ------------------
  |  |  807|  12.1M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  12.1M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  12.1M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  12.1M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  12.1M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  12.1M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (32930:17): [True: 2.28M, False: 9.88M]
  ------------------
32931|  2.28M|                janet_struct_put(newst, kv->key, kv->value);
32932|  2.28M|            }
32933|  12.1M|        }
32934|  2.70k|        janet_struct_proto(newst) = janet_struct_proto(st);
  ------------------
  |  | 1850|  2.70k|#define janet_struct_proto(t) (janet_struct_head(t)->proto)
  |  |  ------------------
  |  |  |  | 1845|  2.70k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
                      janet_struct_proto(newst) = janet_struct_proto(st);
  ------------------
  |  | 1850|  2.70k|#define janet_struct_proto(t) (janet_struct_head(t)->proto)
  |  |  ------------------
  |  |  |  | 1845|  2.70k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
32935|  2.70k|        st = newst;
32936|  2.70k|    }
32937|  3.61M|    janet_struct_hash(st) = janet_kv_calchash(st, janet_struct_capacity(st));
  ------------------
  |  | 1849|  3.61M|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|  3.61M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
                  janet_struct_hash(st) = janet_kv_calchash(st, janet_struct_capacity(st));
  ------------------
  |  | 1848|  3.61M|#define janet_struct_capacity(t) (janet_struct_head(t)->capacity)
  |  |  ------------------
  |  |  |  | 1845|  3.61M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
32938|  3.61M|    if (janet_struct_proto(st)) {
  ------------------
  |  | 1850|  3.61M|#define janet_struct_proto(t) (janet_struct_head(t)->proto)
  |  |  ------------------
  |  |  |  | 1845|  3.61M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  |  |  |  Branch (1850:31): [True: 0, False: 3.61M]
  |  |  ------------------
  ------------------
32939|      0|        janet_struct_hash(st) += 2654435761u * janet_struct_hash(janet_struct_proto(st));
  ------------------
  |  | 1849|      0|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|      0|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
                      janet_struct_hash(st) += 2654435761u * janet_struct_hash(janet_struct_proto(st));
  ------------------
  |  | 1849|      0|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|      0|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
32940|      0|    }
32941|  3.61M|    return (const JanetKV *)st;
32942|  3.61M|}
janet_symcache_init:
33144|  6.23k|void janet_symcache_init() {
33145|  6.23k|    janet_vm.cache_capacity = 1024;
33146|  6.23k|    janet_vm.cache = janet_calloc(1, (size_t) janet_vm.cache_capacity * sizeof(const uint8_t *));
  ------------------
  |  | 2412|  6.23k|#define janet_calloc(X, Y) calloc((X), (Y))
  ------------------
33147|  6.23k|    if (NULL == janet_vm.cache) {
  ------------------
  |  Branch (33147:9): [True: 0, False: 6.23k]
  ------------------
33148|      0|        JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
33149|      0|    }
33150|  6.23k|    memset(&janet_vm.gensym_counter, '0', sizeof(janet_vm.gensym_counter));
33151|  6.23k|    janet_vm.gensym_counter[0] = '_';
33152|  6.23k|    janet_vm.cache_count = 0;
33153|  6.23k|    janet_vm.cache_deleted = 0;
33154|  6.23k|}
janet_symcache_deinit:
33157|  6.23k|void janet_symcache_deinit() {
33158|  6.23k|    janet_free((void *)janet_vm.cache);
  ------------------
  |  | 2415|  6.23k|#define janet_free(X) free((X))
  ------------------
33159|       |    janet_vm.cache = NULL;
33160|  6.23k|    janet_vm.cache_capacity = 0;
33161|  6.23k|    janet_vm.cache_count = 0;
33162|  6.23k|    janet_vm.cache_deleted = 0;
33163|  6.23k|}
janet_symbol_deinit:
33265|  35.0k|void janet_symbol_deinit(const uint8_t *sym) {
33266|  35.0k|    int status = 0;
33267|  35.0k|    const uint8_t **bucket = janet_symcache_find(sym, &status);
  ------------------
  |  |33220|  35.0k|    janet_symcache_findmem((str), janet_string_length(str), janet_string_hash(str), (success))
  |  |  ------------------
  |  |  |  | 1812|  35.0k|#define janet_string_length(s) (janet_string_head(s)->length)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1811|  35.0k|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   janet_symcache_findmem((str), janet_string_length(str), janet_string_hash(str), (success))
  |  |  ------------------
  |  |  |  | 1813|  35.0k|#define janet_string_hash(s) (janet_string_head(s)->hash)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1811|  35.0k|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
33268|  35.0k|    if (status) {
  ------------------
  |  Branch (33268:9): [True: 35.0k, False: 0]
  ------------------
33269|  35.0k|        janet_vm.cache_count--;
33270|  35.0k|        janet_vm.cache_deleted++;
33271|  35.0k|        *bucket = JANET_SYMCACHE_DELETED;
33272|  35.0k|    }
33273|  35.0k|}
janet_symbol:
33276|  7.59M|const uint8_t *janet_symbol(const uint8_t *str, int32_t len) {
33277|  7.59M|    int32_t hash = janet_string_calchash(str, len);
33278|  7.59M|    uint8_t *newstr;
33279|  7.59M|    int success = 0;
33280|  7.59M|    const uint8_t **bucket = janet_symcache_findmem(str, len, hash, &success);
33281|  7.59M|    if (success)
  ------------------
  |  Branch (33281:9): [True: 7.55M, False: 35.0k]
  ------------------
33282|  7.55M|        return *bucket;
33283|  35.0k|    JanetStringHead *head = janet_gcalloc(JANET_MEMORY_SYMBOL, sizeof(JanetStringHead) + (size_t) len + 1);
33284|  35.0k|    head->hash = hash;
33285|  35.0k|    head->length = len;
33286|  35.0k|    newstr = (uint8_t *)(head->data);
33287|  35.0k|    safe_memcpy(newstr, str, len);
33288|  35.0k|    newstr[len] = 0;
33289|  35.0k|    janet_symcache_put((const uint8_t *)newstr, bucket);
33290|  35.0k|    return newstr;
33291|  7.59M|}
janet_csymbol:
33294|  3.64M|const uint8_t *janet_csymbol(const char *cstr) {
33295|  3.64M|    return janet_symbol((const uint8_t *)cstr, (int32_t) strlen(cstr));
33296|  3.64M|}
janet_table_init_raw:
33425|  18.7k|JanetTable *janet_table_init_raw(JanetTable *table, int32_t capacity) {
33426|  18.7k|    return janet_table_init_impl(table, capacity, 0);
33427|  18.7k|}
janet_table_deinit:
33430|  18.7k|void janet_table_deinit(JanetTable *table) {
33431|  18.7k|    if (table->gc.flags & JANET_TABLE_FLAG_STACK) {
  ------------------
  |  |33380|  18.7k|#define JANET_TABLE_FLAG_STACK 0x10000
  ------------------
  |  Branch (33431:9): [True: 0, False: 18.7k]
  ------------------
33432|      0|        janet_sfree(table->data);
33433|  18.7k|    } else {
33434|  18.7k|        janet_free(table->data);
  ------------------
  |  | 2415|  18.7k|#define janet_free(X) free((X))
  ------------------
33435|  18.7k|    }
33436|  18.7k|}
janet_table:
33440|   162k|JanetTable *janet_table(int32_t capacity) {
33441|   162k|    JanetTable *table = janet_gcalloc(JANET_MEMORY_TABLE, sizeof(JanetTable));
33442|   162k|    return janet_table_init_impl(table, capacity, 0);
33443|   162k|}
janet_table_find:
33462|  4.97M|JanetKV *janet_table_find(JanetTable *t, Janet key) {
33463|  4.97M|    return (JanetKV *) janet_dict_find(t->data, t->capacity, key);
33464|  4.97M|}
janet_table_remove:
33541|  2.04k|Janet janet_table_remove(JanetTable *t, Janet key) {
33542|  2.04k|    JanetKV *bucket = janet_table_find(t, key);
33543|  2.04k|    if (NULL != bucket && !janet_checktype(bucket->key, JANET_NIL)) {
  ------------------
  |  |  806|  2.04k|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:6): [Folded, False: 2.04k]
  |  |  ------------------
  |  |  807|  2.04k|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  2.04k|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  2.04k|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  2.04k|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  2.04k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  2.04k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (33543:9): [True: 2.04k, False: 0]
  |  Branch (33543:27): [True: 1.11k, False: 931]
  ------------------
33544|  1.11k|        Janet ret = bucket->value;
33545|  1.11k|        t->count--;
33546|  1.11k|        t->deleted++;
33547|  1.11k|        bucket->key = janet_wrap_nil();
  ------------------
  |  |  831|  1.11k|#define janet_wrap_nil() janet_nanbox_from_payload(JANET_NIL, 1)
  |  |  ------------------
  |  |  |  |  822|  1.11k|    janet_nanbox_from_bits(janet_nanbox_tag(t) | (p))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  1.11k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  1.11k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
33548|  1.11k|        bucket->value = janet_wrap_false();
  ------------------
  |  |  833|  1.11k|#define janet_wrap_false() janet_nanbox_from_payload(JANET_BOOLEAN, 0)
  |  |  ------------------
  |  |  |  |  822|  1.11k|    janet_nanbox_from_bits(janet_nanbox_tag(t) | (p))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  1.11k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  1.11k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
33549|  1.11k|        return ret;
33550|  1.11k|    } else {
33551|    931|        return janet_wrap_nil();
  ------------------
  |  |  831|    931|#define janet_wrap_nil() janet_nanbox_from_payload(JANET_NIL, 1)
  |  |  ------------------
  |  |  |  |  822|    931|    janet_nanbox_from_bits(janet_nanbox_tag(t) | (p))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|    931|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|    931|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
33552|    931|    }
33553|  2.04k|}
janet_table_put:
33556|  2.59M|void janet_table_put(JanetTable *t, Janet key, Janet value) {
33557|  2.59M|    if (janet_checktype(key, JANET_NIL)) return;
  ------------------
  |  |  806|  2.59M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 1.51k, False: 2.59M]
  |  |  |  Branch (806:6): [Folded, False: 2.59M]
  |  |  ------------------
  |  |  807|  2.59M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  2.59M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  2.59M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  2.59M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  2.59M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  2.59M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
33558|  2.59M|    if (janet_checktype(key, JANET_NUMBER) && isnan(janet_unwrap_number(key))) return;
  ------------------
  |  |  806|  5.19M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 10.8k, False: 2.58M]
  |  |  |  Branch (806:6): [True: 2.59M, Folded]
  |  |  ------------------
  |  |  807|  5.19M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|  2.59M|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 10.8k, False: 2.58M]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 2.58M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  5.19M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|      0|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|      0|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|      0|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (33558:47): [True: 0, False: 10.8k]
  ------------------
33559|  2.59M|    if (janet_checktype(value, JANET_NIL)) {
  ------------------
  |  |  806|  2.59M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 2.04k, False: 2.59M]
  |  |  |  Branch (806:6): [Folded, False: 2.59M]
  |  |  ------------------
  |  |  807|  2.59M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  2.59M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  2.59M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  2.59M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  2.59M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  2.59M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
33560|  2.04k|        janet_table_remove(t, key);
33561|  2.59M|    } else {
33562|  2.59M|        JanetKV *bucket = janet_table_find(t, key);
33563|  2.59M|        if (NULL != bucket && !janet_checktype(bucket->key, JANET_NIL)) {
  ------------------
  |  |  806|  2.59M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:6): [Folded, False: 2.59M]
  |  |  ------------------
  |  |  807|  2.59M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  2.59M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  2.59M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  2.59M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  2.59M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  2.59M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (33563:13): [True: 2.59M, False: 0]
  |  Branch (33563:31): [True: 1.55M, False: 1.03M]
  ------------------
33564|  1.55M|            bucket->value = value;
33565|  1.55M|        } else {
33566|  1.03M|            if (NULL == bucket || 2 * (t->count + t->deleted + 1) > t->capacity) {
  ------------------
  |  Branch (33566:17): [True: 0, False: 1.03M]
  |  Branch (33566:35): [True: 1.63k, False: 1.03M]
  ------------------
33567|  1.63k|                janet_table_rehash(t, janet_tablen(2 * t->count + 2));
33568|  1.63k|            }
33569|  1.03M|            bucket = janet_table_find(t, key);
33570|  1.03M|            if (janet_checktype(bucket->value, JANET_BOOLEAN))
  ------------------
  |  |  806|  1.03M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 0, False: 1.03M]
  |  |  |  Branch (806:6): [Folded, False: 1.03M]
  |  |  ------------------
  |  |  807|  1.03M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  1.03M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  1.03M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  1.03M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  1.03M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  1.03M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
33571|      0|                --t->deleted;
33572|  1.03M|            bucket->key = key;
33573|  1.03M|            bucket->value = value;
33574|  1.03M|            ++t->count;
33575|  1.03M|        }
33576|  2.59M|    }
33577|  2.59M|}
janet_tuple_begin:
33841|  3.72M|Janet *janet_tuple_begin(int32_t length) {
33842|  3.72M|    size_t size = sizeof(JanetTupleHead) + ((size_t) length * sizeof(Janet));
33843|  3.72M|    JanetTupleHead *head = janet_gcalloc(JANET_MEMORY_TUPLE, size);
33844|  3.72M|    head->sm_line = -1;
33845|  3.72M|    head->sm_column = -1;
33846|  3.72M|    head->length = length;
33847|  3.72M|    return (Janet *)(head->data);
33848|  3.72M|}
janet_tuple_end:
33851|  3.72M|const Janet *janet_tuple_end(Janet *tuple) {
33852|  3.72M|    janet_tuple_hash(tuple) = janet_array_calchash(tuple, janet_tuple_length(tuple));
  ------------------
  |  | 1802|  3.72M|#define janet_tuple_hash(t) (janet_tuple_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1799|  3.72M|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
                  janet_tuple_hash(tuple) = janet_array_calchash(tuple, janet_tuple_length(tuple));
  ------------------
  |  | 1801|  3.72M|#define janet_tuple_length(t) (janet_tuple_head(t)->length)
  |  |  ------------------
  |  |  |  | 1799|  3.72M|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
33853|  3.72M|    return (const Janet *)tuple;
33854|  3.72M|}
janet_tuple_n:
33857|  54.5k|const Janet *janet_tuple_n(const Janet *values, int32_t n) {
33858|  54.5k|    Janet *t = janet_tuple_begin(n);
33859|  54.5k|    safe_memcpy(t, values, sizeof(Janet) * n);
33860|  54.5k|    return janet_tuple_end(t);
33861|  54.5k|}
janet_hash_mix:
34092|  33.8M|uint32_t janet_hash_mix(uint32_t input, uint32_t more) {
34093|  33.8M|    uint32_t mix1 = (more + 0x9e3779b9 + (input << 6) + (input >> 2));
34094|  33.8M|    return input ^ (0x9e3779b9 + (mix1 << 6) + (mix1 >> 2));
34095|  33.8M|}
janet_string_calchash:
34099|  11.7M|int32_t janet_string_calchash(const uint8_t *str, int32_t len) {
34100|  11.7M|    if (NULL == str || len == 0) return 5381;
  ------------------
  |  Branch (34100:9): [True: 581, False: 11.7M]
  |  Branch (34100:24): [True: 4.03M, False: 7.74M]
  ------------------
34101|  7.74M|    const uint8_t *end = str + len;
34102|  7.74M|    uint32_t hash = 5381;
34103|  53.8M|    while (str < end)
  ------------------
  |  Branch (34103:12): [True: 46.0M, False: 7.74M]
  ------------------
34104|  46.0M|        hash = (hash << 5) + hash + *str++;
34105|  7.74M|    hash = janet_hash_mix(hash, (uint32_t) len);
34106|  7.74M|    return (int32_t) hash;
34107|  11.7M|}
janet_array_calchash:
34222|  3.72M|int32_t janet_array_calchash(const Janet *array, int32_t len) {
34223|  3.72M|    const Janet *end = array + len;
34224|  3.72M|    uint32_t hash = 33;
34225|  11.6M|    while (array < end) {
  ------------------
  |  Branch (34225:12): [True: 7.92M, False: 3.72M]
  ------------------
34226|  7.92M|        hash = janet_hash_mix(hash, janet_hash(*array++));
34227|  7.92M|    }
34228|  3.72M|    return (int32_t) hash;
34229|  3.72M|}
janet_kv_calchash:
34232|  3.61M|int32_t janet_kv_calchash(const JanetKV *kvs, int32_t len) {
34233|  3.61M|    const JanetKV *end = kvs + len;
34234|  3.61M|    uint32_t hash = 33;
34235|  12.7M|    while (kvs < end) {
  ------------------
  |  Branch (34235:12): [True: 9.08M, False: 3.61M]
  ------------------
34236|  9.08M|        hash = janet_hash_mix(hash, janet_hash(kvs->key));
34237|  9.08M|        hash = janet_hash_mix(hash, janet_hash(kvs->value));
34238|  9.08M|        kvs++;
34239|  9.08M|    }
34240|  3.61M|    return (int32_t) hash;
34241|  3.61M|}
janet_tablen:
34245|  3.79M|int32_t janet_tablen(int32_t n) {
34246|  3.79M|    if (n < 0) return 0;
  ------------------
  |  Branch (34246:9): [True: 0, False: 3.79M]
  ------------------
34247|  3.79M|    n |= n >> 1;
34248|  3.79M|    n |= n >> 2;
34249|  3.79M|    n |= n >> 4;
34250|  3.79M|    n |= n >> 8;
34251|  3.79M|    n |= n >> 16;
34252|  3.79M|    return n == INT32_MAX ? INT32_MAX : n + 1;
  ------------------
  |  Branch (34252:12): [True: 0, False: 3.79M]
  ------------------
34253|  3.79M|}
safe_memcpy:
34256|  4.28M|void safe_memcpy(void *dest, const void *src, size_t len) {
34257|  4.28M|    if (!len) return;
  ------------------
  |  Branch (34257:9): [True: 4.03M, False: 246k]
  ------------------
34258|   246k|    memcpy(dest, src, len);
34259|   246k|}
janet_dict_find:
34263|  4.97M|const JanetKV *janet_dict_find(const JanetKV *buckets, int32_t cap, Janet key) {
34264|  4.97M|    int32_t index = janet_maphash(cap, janet_hash(key));
  ------------------
  |  |  396|  4.97M|#define janet_maphash(cap, hash) ((uint32_t)(hash) & (cap - 1))
  ------------------
34265|  4.97M|    int32_t i;
34266|  4.97M|    const JanetKV *first_bucket = NULL;
34267|       |    /* Higher half */
34268|  6.75M|    for (i = index; i < cap; i++) {
  ------------------
  |  Branch (34268:21): [True: 6.74M, False: 3.60k]
  ------------------
34269|  6.74M|        const JanetKV *kv = buckets + i;
34270|  6.74M|        if (janet_checktype(kv->key, JANET_NIL)) {
  ------------------
  |  |  806|  6.74M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 3.62M, False: 3.12M]
  |  |  |  Branch (806:6): [Folded, False: 6.74M]
  |  |  ------------------
  |  |  807|  6.74M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  6.74M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  6.74M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  6.74M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  6.74M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  6.74M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
34271|  3.62M|            if (janet_checktype(kv->value, JANET_NIL)) {
  ------------------
  |  |  806|  3.62M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 3.41M, False: 202k]
  |  |  |  Branch (806:6): [Folded, False: 3.62M]
  |  |  ------------------
  |  |  807|  3.62M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  3.62M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  3.62M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  3.62M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  3.62M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  3.62M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
34272|  3.41M|                return kv;
34273|  3.41M|            } else if (NULL == first_bucket) {
  ------------------
  |  Branch (34273:24): [True: 60.5k, False: 142k]
  ------------------
34274|  60.5k|                first_bucket = kv;
34275|  60.5k|            }
34276|  3.62M|        } else if (janet_equals(kv->key, key)) {
  ------------------
  |  Branch (34276:20): [True: 1.55M, False: 1.57M]
  ------------------
34277|  1.55M|            return buckets + i;
34278|  1.55M|        }
34279|  6.74M|    }
34280|       |    /* Lower half */
34281|  14.0k|    for (i = 0; i < index; i++) {
  ------------------
  |  Branch (34281:17): [True: 14.0k, False: 0]
  ------------------
34282|  14.0k|        const JanetKV *kv = buckets + i;
34283|  14.0k|        if (janet_checktype(kv->key, JANET_NIL)) {
  ------------------
  |  |  806|  14.0k|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 5.06k, False: 8.94k]
  |  |  |  Branch (806:6): [Folded, False: 14.0k]
  |  |  ------------------
  |  |  807|  14.0k|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  14.0k|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  14.0k|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  14.0k|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  14.0k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  14.0k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
34284|  5.06k|            if (janet_checktype(kv->value, JANET_NIL)) {
  ------------------
  |  |  806|  5.06k|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 2.21k, False: 2.85k]
  |  |  |  Branch (806:6): [Folded, False: 5.06k]
  |  |  ------------------
  |  |  807|  5.06k|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  5.06k|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  5.06k|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  5.06k|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  5.06k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  5.06k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
34285|  2.21k|                return kv;
34286|  2.85k|            } else if (NULL == first_bucket) {
  ------------------
  |  Branch (34286:24): [True: 712, False: 2.14k]
  ------------------
34287|    712|                first_bucket = kv;
34288|    712|            }
34289|  8.94k|        } else if (janet_equals(kv->key, key)) {
  ------------------
  |  Branch (34289:20): [True: 1.39k, False: 7.55k]
  ------------------
34290|  1.39k|            return buckets + i;
34291|  1.39k|        }
34292|  14.0k|    }
34293|      0|    return first_bucket;
34294|  3.60k|}
array_allocate:
35189|  3.73M|void *array_allocate(size_t element_size, int32_t count) {
35190|  3.73M|    if (count < 0) return NULL;
  ------------------
  |  Branch (35190:9): [True: 0, False: 3.73M]
  ------------------
35191|  3.73M|    if ((size_t) count > (SIZE_MAX / element_size)) return NULL;
  ------------------
  |  Branch (35191:9): [True: 0, False: 3.73M]
  ------------------
35192|  3.73M|    return janet_malloc(element_size * count);
  ------------------
  |  | 2406|  3.73M|#define janet_malloc(X) malloc((X))
  ------------------
35193|  3.73M|}
janet_equals:
35447|  3.13M|int janet_equals(Janet x, Janet y) {
35448|  3.13M|    janet_vm.traversal = janet_vm.traversal_base;
35449|  5.49M|    do {
35450|  5.49M|        if (janet_type(x) != janet_type(y)) return 0;
  ------------------
  |  |  795|  5.49M|    (isnan((x).number) \
  |  |  796|  5.49M|        ? (JanetType) (((x).u64 >> 47) & 0xF) \
  |  |  797|  5.49M|        : JANET_NUMBER)
  ------------------
                      if (janet_type(x) != janet_type(y)) return 0;
  ------------------
  |  |  795|  5.49M|    (isnan((x).number) \
  |  |  796|  5.49M|        ? (JanetType) (((x).u64 >> 47) & 0xF) \
  |  |  797|  5.49M|        : JANET_NUMBER)
  ------------------
  |  Branch (35450:13): [True: 5.47M, False: 17.8k]
  |  Branch (35450:13): [True: 209k, False: 5.28M]
  |  Branch (35450:30): [True: 5.45M, False: 34.5k]
  ------------------
35451|  5.28M|        switch (janet_type(x)) {
  ------------------
  |  |  795|  5.28M|    (isnan((x).number) \
  |  |  796|  5.28M|        ? (JanetType) (((x).u64 >> 47) & 0xF) \
  |  |  797|  5.28M|        : JANET_NUMBER)
  ------------------
  |  Branch (35451:17): [True: 5.26M, False: 14.2k]
  ------------------
35452|  1.51M|            case JANET_NIL:
  ------------------
  |  Branch (35452:13): [True: 1.51M, False: 3.76M]
  ------------------
35453|  1.51M|                break;
35454|  2.02k|            case JANET_BOOLEAN:
  ------------------
  |  Branch (35454:13): [True: 2.02k, False: 5.28M]
  ------------------
35455|  2.02k|                if (janet_unwrap_boolean(x) != janet_unwrap_boolean(y)) return 0;
  ------------------
  |  |  838|  2.02k|#define janet_unwrap_boolean(x) ((x).u64 & 0x1)
  ------------------
                              if (janet_unwrap_boolean(x) != janet_unwrap_boolean(y)) return 0;
  ------------------
  |  |  838|  2.02k|#define janet_unwrap_boolean(x) ((x).u64 & 0x1)
  ------------------
  |  Branch (35455:21): [True: 583, False: 1.44k]
  ------------------
35456|  1.44k|                break;
35457|  14.2k|            case JANET_NUMBER:
  ------------------
  |  Branch (35457:13): [True: 14.2k, False: 5.26M]
  ------------------
35458|  14.2k|                if (janet_unwrap_number(x) != janet_unwrap_number(y)) return 0;
  ------------------
  |  |  839|  14.2k|#define janet_unwrap_number(x) ((x).number)
  ------------------
                              if (janet_unwrap_number(x) != janet_unwrap_number(y)) return 0;
  ------------------
  |  |  839|  14.2k|#define janet_unwrap_number(x) ((x).number)
  ------------------
  |  Branch (35458:21): [True: 549, False: 13.7k]
  ------------------
35459|  13.7k|                break;
35460|   148k|            case JANET_STRING:
  ------------------
  |  Branch (35460:13): [True: 148k, False: 5.13M]
  ------------------
35461|   148k|                if (!janet_string_equal(janet_unwrap_string(x), janet_unwrap_string(y))) return 0;
  ------------------
  |  |  863|   148k|#define janet_unwrap_string(x) ((JanetString)janet_nanbox_to_pointer(x))
  ------------------
                              if (!janet_string_equal(janet_unwrap_string(x), janet_unwrap_string(y))) return 0;
  ------------------
  |  |  863|   148k|#define janet_unwrap_string(x) ((JanetString)janet_nanbox_to_pointer(x))
  ------------------
  |  Branch (35461:21): [True: 1.48k, False: 147k]
  ------------------
35462|   147k|                break;
35463|   147k|            case JANET_ABSTRACT:
  ------------------
  |  Branch (35463:13): [True: 62.6k, False: 5.21M]
  ------------------
35464|  62.6k|                if (janet_compare_abstract(janet_unwrap_abstract(x), janet_unwrap_abstract(y))) return 0;
  ------------------
  |  |  866|  62.6k|#define janet_unwrap_abstract(x) (janet_nanbox_to_pointer(x))
  ------------------
                              if (janet_compare_abstract(janet_unwrap_abstract(x), janet_unwrap_abstract(y))) return 0;
  ------------------
  |  |  866|  62.6k|#define janet_unwrap_abstract(x) (janet_nanbox_to_pointer(x))
  ------------------
  |  Branch (35464:21): [True: 38.6k, False: 24.0k]
  ------------------
35465|  24.0k|                break;
35466|  2.38M|            default:
  ------------------
  |  Branch (35466:13): [True: 2.38M, False: 2.89M]
  ------------------
35467|  2.38M|                if (janet_unwrap_pointer(x) != janet_unwrap_pointer(y)) return 0;
  ------------------
  |  |  867|  2.38M|#define janet_unwrap_pointer(x) (janet_nanbox_to_pointer(x))
  ------------------
                              if (janet_unwrap_pointer(x) != janet_unwrap_pointer(y)) return 0;
  ------------------
  |  |  867|  2.38M|#define janet_unwrap_pointer(x) (janet_nanbox_to_pointer(x))
  ------------------
  |  Branch (35467:21): [True: 1.32M, False: 1.06M]
  ------------------
35468|  1.06M|                break;
35469|  1.06M|            case JANET_TUPLE: {
  ------------------
  |  Branch (35469:13): [True: 393k, False: 4.88M]
  ------------------
35470|   393k|                const Janet *t1 = janet_unwrap_tuple(x);
  ------------------
  |  |  858|   393k|#define janet_unwrap_tuple(x) ((JanetTuple)janet_nanbox_to_pointer(x))
  ------------------
35471|   393k|                const Janet *t2 = janet_unwrap_tuple(y);
  ------------------
  |  |  858|   393k|#define janet_unwrap_tuple(x) ((JanetTuple)janet_nanbox_to_pointer(x))
  ------------------
35472|   393k|                if (t1 == t2) break;
  ------------------
  |  Branch (35472:21): [True: 0, False: 393k]
  ------------------
35473|   393k|                if (JANET_TUPLE_FLAG_BRACKETCTOR & (janet_tuple_flag(t1) ^ janet_tuple_flag(t2))) return 0;
  ------------------
  |  | 1797|   393k|#define JANET_TUPLE_FLAG_BRACKETCTOR 0x10000
  ------------------
                              if (JANET_TUPLE_FLAG_BRACKETCTOR & (janet_tuple_flag(t1) ^ janet_tuple_flag(t2))) return 0;
  ------------------
  |  | 1805|   393k|#define janet_tuple_flag(t) (janet_tuple_head(t)->gc.flags)
  |  |  ------------------
  |  |  |  | 1799|   393k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
                              if (JANET_TUPLE_FLAG_BRACKETCTOR & (janet_tuple_flag(t1) ^ janet_tuple_flag(t2))) return 0;
  ------------------
  |  | 1805|   393k|#define janet_tuple_flag(t) (janet_tuple_head(t)->gc.flags)
  |  |  ------------------
  |  |  |  | 1799|   393k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
  |  Branch (35473:21): [True: 774, False: 392k]
  ------------------
35474|   392k|                if (janet_tuple_hash(t1) != janet_tuple_hash(t2)) return 0;
  ------------------
  |  | 1802|   392k|#define janet_tuple_hash(t) (janet_tuple_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1799|   392k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
                              if (janet_tuple_hash(t1) != janet_tuple_hash(t2)) return 0;
  ------------------
  |  | 1802|   392k|#define janet_tuple_hash(t) (janet_tuple_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1799|   392k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
  |  Branch (35474:21): [True: 1.61k, False: 390k]
  ------------------
35475|   390k|                if (janet_tuple_length(t1) != janet_tuple_length(t2)) return 0;
  ------------------
  |  | 1801|   390k|#define janet_tuple_length(t) (janet_tuple_head(t)->length)
  |  |  ------------------
  |  |  |  | 1799|   390k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
                              if (janet_tuple_length(t1) != janet_tuple_length(t2)) return 0;
  ------------------
  |  | 1801|   390k|#define janet_tuple_length(t) (janet_tuple_head(t)->length)
  |  |  ------------------
  |  |  |  | 1799|   390k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
  |  Branch (35475:21): [True: 471, False: 390k]
  ------------------
35476|   390k|                push_traversal_node(janet_tuple_head(t1), janet_tuple_head(t2), 0);
  ------------------
  |  | 1799|   390k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  ------------------
                              push_traversal_node(janet_tuple_head(t1), janet_tuple_head(t2), 0);
  ------------------
  |  | 1799|   390k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  ------------------
35477|   390k|                break;
35478|   390k|            }
35479|      0|            break;
35480|   758k|            case JANET_STRUCT: {
  ------------------
  |  Branch (35480:13): [True: 758k, False: 4.52M]
  ------------------
35481|   758k|                const JanetKV *s1 = janet_unwrap_struct(x);
  ------------------
  |  |  857|   758k|#define janet_unwrap_struct(x) ((JanetStruct)janet_nanbox_to_pointer(x))
  ------------------
35482|   758k|                const JanetKV *s2 = janet_unwrap_struct(y);
  ------------------
  |  |  857|   758k|#define janet_unwrap_struct(x) ((JanetStruct)janet_nanbox_to_pointer(x))
  ------------------
35483|   758k|                if (s1 == s2) break;
  ------------------
  |  Branch (35483:21): [True: 0, False: 758k]
  ------------------
35484|   758k|                if (janet_struct_hash(s1) != janet_struct_hash(s2)) return 0;
  ------------------
  |  | 1849|   758k|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|   758k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
                              if (janet_struct_hash(s1) != janet_struct_hash(s2)) return 0;
  ------------------
  |  | 1849|   758k|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|   758k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
  |  Branch (35484:21): [True: 476, False: 758k]
  ------------------
35485|   758k|                if (janet_struct_length(s1) != janet_struct_length(s2)) return 0;
  ------------------
  |  | 1847|   758k|#define janet_struct_length(t) (janet_struct_head(t)->length)
  |  |  ------------------
  |  |  |  | 1845|   758k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
                              if (janet_struct_length(s1) != janet_struct_length(s2)) return 0;
  ------------------
  |  | 1847|   758k|#define janet_struct_length(t) (janet_struct_head(t)->length)
  |  |  ------------------
  |  |  |  | 1845|   758k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
  |  Branch (35485:21): [True: 791, False: 757k]
  ------------------
35486|   757k|                if (janet_struct_proto(s1) && !janet_struct_proto(s2)) return 0;
  ------------------
  |  | 1850|  1.51M|#define janet_struct_proto(t) (janet_struct_head(t)->proto)
  |  |  ------------------
  |  |  |  | 1845|   757k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  |  |  |  Branch (1850:31): [True: 0, False: 757k]
  |  |  ------------------
  ------------------
                              if (janet_struct_proto(s1) && !janet_struct_proto(s2)) return 0;
  ------------------
  |  | 1850|      0|#define janet_struct_proto(t) (janet_struct_head(t)->proto)
  |  |  ------------------
  |  |  |  | 1845|      0|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
  |  Branch (35486:47): [True: 0, False: 0]
  ------------------
35487|   757k|                if (!janet_struct_proto(s1) && janet_struct_proto(s2)) return 0;
  ------------------
  |  | 1850|  1.51M|#define janet_struct_proto(t) (janet_struct_head(t)->proto)
  |  |  ------------------
  |  |  |  | 1845|   757k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
                              if (!janet_struct_proto(s1) && janet_struct_proto(s2)) return 0;
  ------------------
  |  | 1850|   757k|#define janet_struct_proto(t) (janet_struct_head(t)->proto)
  |  |  ------------------
  |  |  |  | 1845|   757k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  |  |  |  Branch (1850:31): [True: 0, False: 757k]
  |  |  ------------------
  ------------------
  |  Branch (35487:21): [True: 757k, False: 0]
  ------------------
35488|   757k|                push_traversal_node(janet_struct_head(s1), janet_struct_head(s2), 0);
  ------------------
  |  | 1845|   757k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  ------------------
                              push_traversal_node(janet_struct_head(s1), janet_struct_head(s2), 0);
  ------------------
  |  | 1845|   757k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  ------------------
35489|   757k|                break;
35490|   757k|            }
35491|      0|            break;
35492|  5.28M|        }
35493|  5.28M|    } while (!traversal_next(&x, &y));
  ------------------
  |  Branch (35493:14): [True: 2.35M, False: 1.55M]
  ------------------
35494|  1.55M|    return 1;
35495|  3.13M|}
janet_hash:
35507|  41.0M|int32_t janet_hash(Janet x) {
35508|  41.0M|    int32_t hash = 0;
35509|  41.0M|    switch (janet_type(x)) {
  ------------------
  |  |  795|  41.0M|    (isnan((x).number) \
  |  |  796|  41.0M|        ? (JanetType) (((x).u64 >> 47) & 0xF) \
  |  |  797|  41.0M|        : JANET_NUMBER)
  ------------------
  |  Branch (35509:13): [True: 40.9M, False: 67.5k]
  ------------------
35510|  13.6M|        case JANET_NIL:
  ------------------
  |  Branch (35510:9): [True: 13.6M, False: 27.4M]
  ------------------
35511|  13.6M|            hash = 0;
35512|  13.6M|            break;
35513|  6.29k|        case JANET_BOOLEAN:
  ------------------
  |  Branch (35513:9): [True: 6.29k, False: 41.0M]
  ------------------
35514|  6.29k|            hash = janet_unwrap_boolean(x);
  ------------------
  |  |  838|  6.29k|#define janet_unwrap_boolean(x) ((x).u64 & 0x1)
  ------------------
35515|  6.29k|            break;
35516|  2.97M|        case JANET_STRING:
  ------------------
  |  Branch (35516:9): [True: 2.97M, False: 38.0M]
  ------------------
35517|  9.03M|        case JANET_SYMBOL:
  ------------------
  |  Branch (35517:9): [True: 6.06M, False: 34.9M]
  ------------------
35518|  9.20M|        case JANET_KEYWORD:
  ------------------
  |  Branch (35518:9): [True: 165k, False: 40.8M]
  ------------------
35519|  9.20M|            hash = janet_string_hash(janet_unwrap_string(x));
  ------------------
  |  | 1813|  9.20M|#define janet_string_hash(s) (janet_string_head(s)->hash)
  |  |  ------------------
  |  |  |  | 1811|  9.20M|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  ------------------
  ------------------
35520|  9.20M|            break;
35521|  3.63M|        case JANET_TUPLE:
  ------------------
  |  Branch (35521:9): [True: 3.63M, False: 37.3M]
  ------------------
35522|  3.63M|            hash = janet_tuple_hash(janet_unwrap_tuple(x));
  ------------------
  |  | 1802|  3.63M|#define janet_tuple_hash(t) (janet_tuple_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1799|  3.63M|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
35523|  3.63M|            uint32_t inc = (janet_tuple_flag(janet_unwrap_tuple(x)) & JANET_TUPLE_FLAG_BRACKETCTOR) ? 1 : 0;
  ------------------
  |  | 1805|  3.63M|#define janet_tuple_flag(t) (janet_tuple_head(t)->gc.flags)
  |  |  ------------------
  |  |  |  | 1799|  3.63M|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
                          uint32_t inc = (janet_tuple_flag(janet_unwrap_tuple(x)) & JANET_TUPLE_FLAG_BRACKETCTOR) ? 1 : 0;
  ------------------
  |  | 1797|  3.63M|#define JANET_TUPLE_FLAG_BRACKETCTOR 0x10000
  ------------------
  |  Branch (35523:28): [True: 16.7k, False: 3.61M]
  ------------------
35524|  3.63M|            hash = (int32_t)((uint32_t)hash + inc); /* avoid overflow undefined behavior */
35525|  3.63M|            break;
35526|  2.46M|        case JANET_STRUCT:
  ------------------
  |  Branch (35526:9): [True: 2.46M, False: 38.5M]
  ------------------
35527|  2.46M|            hash = janet_struct_hash(janet_unwrap_struct(x));
  ------------------
  |  | 1849|  2.46M|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|  2.46M|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
35528|  2.46M|            break;
35529|  67.5k|        case JANET_NUMBER: {
  ------------------
  |  Branch (35529:9): [True: 67.5k, False: 40.9M]
  ------------------
35530|  67.5k|            union {
35531|  67.5k|                double d;
35532|  67.5k|                uint64_t u;
35533|  67.5k|            } as;
35534|  67.5k|            as.d = janet_unwrap_number(x);
  ------------------
  |  |  839|  67.5k|#define janet_unwrap_number(x) ((x).number)
  ------------------
35535|  67.5k|            as.d += 0.0; /* normalize negative 0 */
35536|  67.5k|            as.u = murmur64(as.u);
35537|  67.5k|            uint32_t hi = (uint32_t)(as.u >> 32);
35538|  67.5k|            hash = (int32_t)hi;
35539|  67.5k|            break;
35540|  9.03M|        }
35541|   115k|        case JANET_ABSTRACT: {
  ------------------
  |  Branch (35541:9): [True: 115k, False: 40.8M]
  ------------------
35542|   115k|            JanetAbstract xx = janet_unwrap_abstract(x);
  ------------------
  |  |  866|   115k|#define janet_unwrap_abstract(x) (janet_nanbox_to_pointer(x))
  ------------------
35543|   115k|            const JanetAbstractType *at = janet_abstract_type(xx);
  ------------------
  |  | 1898|   115k|#define janet_abstract_type(u) (janet_abstract_head(u)->type)
  |  |  ------------------
  |  |  |  | 1896|   115k|#define janet_abstract_head(u) ((JanetAbstractHead *)((char *)u - offsetof(JanetAbstractHead, data)))
  |  |  ------------------
  ------------------
35544|   115k|            if (at->hash != NULL) {
  ------------------
  |  Branch (35544:17): [True: 115k, False: 0]
  ------------------
35545|   115k|                hash = at->hash(xx, janet_abstract_size(xx));
  ------------------
  |  | 1899|   115k|#define janet_abstract_size(u) (janet_abstract_head(u)->size)
  |  |  ------------------
  |  |  |  | 1896|   115k|#define janet_abstract_head(u) ((JanetAbstractHead *)((char *)u - offsetof(JanetAbstractHead, data)))
  |  |  ------------------
  ------------------
35546|   115k|                break;
35547|   115k|            }
35548|   115k|        }
35549|       |        /* fallthrough */
35550|  11.9M|        default:
  ------------------
  |  Branch (35550:9): [True: 11.9M, False: 29.0M]
  ------------------
35551|  11.9M|            if (sizeof(double) == sizeof(void *)) {
  ------------------
  |  Branch (35551:17): [True: 11.9M, Folded]
  ------------------
35552|       |                /* Assuming 8 byte pointer (8 byte aligned) */
35553|  11.9M|                uint64_t i = murmur64(janet_u64(x));
  ------------------
  |  |  788|  11.9M|#define janet_u64(x) ((x).u64)
  ------------------
35554|  11.9M|                hash = (int32_t)(i >> 32);
35555|  11.9M|            } else {
35556|       |                /* Assuming 4 byte pointer (or smaller) */
35557|      0|                uintptr_t diff = (uintptr_t) janet_unwrap_pointer(x);
  ------------------
  |  |  867|      0|#define janet_unwrap_pointer(x) (janet_nanbox_to_pointer(x))
  ------------------
35558|      0|                uint32_t hilo = (uint32_t) diff * 2654435769u;
35559|      0|                hash = (int32_t)((hilo << 16) | (hilo >> 16));
35560|      0|            }
35561|  11.9M|            break;
35562|  41.0M|    }
35563|  41.0M|    return hash;
35564|  41.0M|}
janet_compare:
35569|  1.95M|int janet_compare(Janet x, Janet y) {
35570|  1.95M|    janet_vm.traversal = janet_vm.traversal_base;
35571|  1.95M|    int status;
35572|  4.37M|    do {
35573|  4.37M|        JanetType tx = janet_type(x);
  ------------------
  |  |  795|  4.37M|    (isnan((x).number) \
  |  |  796|  4.37M|        ? (JanetType) (((x).u64 >> 47) & 0xF) \
  |  |  797|  4.37M|        : JANET_NUMBER)
  ------------------
  |  Branch (35573:24): [True: 4.36M, False: 11.6k]
  ------------------
35574|  4.37M|        JanetType ty = janet_type(y);
  ------------------
  |  |  795|  4.37M|    (isnan((x).number) \
  |  |  796|  4.37M|        ? (JanetType) (((x).u64 >> 47) & 0xF) \
  |  |  797|  4.37M|        : JANET_NUMBER)
  ------------------
  |  Branch (35574:24): [True: 4.36M, False: 10.5k]
  ------------------
35575|  4.37M|        if (tx != ty) return tx < ty ? -1 : 1;
  ------------------
  |  Branch (35575:13): [True: 160k, False: 4.21M]
  |  Branch (35575:30): [True: 158k, False: 1.25k]
  ------------------
35576|  4.21M|        switch (tx) {
35577|  1.64M|            case JANET_NIL:
  ------------------
  |  Branch (35577:13): [True: 1.64M, False: 2.56M]
  ------------------
35578|  1.64M|                break;
35579|    488|            case JANET_BOOLEAN: {
  ------------------
  |  Branch (35579:13): [True: 488, False: 4.21M]
  ------------------
35580|    488|                int diff = janet_unwrap_boolean(x) - janet_unwrap_boolean(y);
  ------------------
  |  |  838|    488|#define janet_unwrap_boolean(x) ((x).u64 & 0x1)
  ------------------
                              int diff = janet_unwrap_boolean(x) - janet_unwrap_boolean(y);
  ------------------
  |  |  838|    488|#define janet_unwrap_boolean(x) ((x).u64 & 0x1)
  ------------------
35581|    488|                if (diff) return diff;
  ------------------
  |  Branch (35581:21): [True: 0, False: 488]
  ------------------
35582|    488|                break;
35583|    488|            }
35584|  10.4k|            case JANET_NUMBER: {
  ------------------
  |  Branch (35584:13): [True: 10.4k, False: 4.20M]
  ------------------
35585|  10.4k|                double xx = janet_unwrap_number(x);
  ------------------
  |  |  839|  10.4k|#define janet_unwrap_number(x) ((x).number)
  ------------------
35586|  10.4k|                double yy = janet_unwrap_number(y);
  ------------------
  |  |  839|  10.4k|#define janet_unwrap_number(x) ((x).number)
  ------------------
35587|  10.4k|                if (xx == yy) {
  ------------------
  |  Branch (35587:21): [True: 10.4k, False: 0]
  ------------------
35588|  10.4k|                    break;
35589|  10.4k|                } else {
35590|      0|                    return (xx < yy) ? -1 : 1;
  ------------------
  |  Branch (35590:28): [True: 0, False: 0]
  ------------------
35591|      0|                }
35592|  10.4k|            }
35593|   167k|            case JANET_STRING:
  ------------------
  |  Branch (35593:13): [True: 167k, False: 4.04M]
  ------------------
35594|  1.32M|            case JANET_SYMBOL:
  ------------------
  |  Branch (35594:13): [True: 1.15M, False: 3.05M]
  ------------------
35595|  1.32M|            case JANET_KEYWORD: {
  ------------------
  |  Branch (35595:13): [True: 1.11k, False: 4.21M]
  ------------------
35596|  1.32M|                int diff = janet_string_compare(janet_unwrap_string(x), janet_unwrap_string(y));
  ------------------
  |  |  863|  1.32M|#define janet_unwrap_string(x) ((JanetString)janet_nanbox_to_pointer(x))
  ------------------
                              int diff = janet_string_compare(janet_unwrap_string(x), janet_unwrap_string(y));
  ------------------
  |  |  863|  1.32M|#define janet_unwrap_string(x) ((JanetString)janet_nanbox_to_pointer(x))
  ------------------
35597|  1.32M|                if (diff) return diff;
  ------------------
  |  Branch (35597:21): [True: 2.05k, False: 1.32M]
  ------------------
35598|  1.32M|                break;
35599|  1.32M|            }
35600|  1.32M|            case JANET_ABSTRACT: {
  ------------------
  |  Branch (35600:13): [True: 22.5k, False: 4.19M]
  ------------------
35601|  22.5k|                int diff = janet_compare_abstract(janet_unwrap_abstract(x), janet_unwrap_abstract(y));
  ------------------
  |  |  866|  22.5k|#define janet_unwrap_abstract(x) (janet_nanbox_to_pointer(x))
  ------------------
                              int diff = janet_compare_abstract(janet_unwrap_abstract(x), janet_unwrap_abstract(y));
  ------------------
  |  |  866|  22.5k|#define janet_unwrap_abstract(x) (janet_nanbox_to_pointer(x))
  ------------------
35602|  22.5k|                if (diff) return diff;
  ------------------
  |  Branch (35602:21): [True: 2.86k, False: 19.6k]
  ------------------
35603|  19.6k|                break;
35604|  22.5k|            }
35605|  19.6k|            default: {
  ------------------
  |  Branch (35605:13): [True: 57, False: 4.21M]
  ------------------
35606|     57|                if (janet_unwrap_pointer(x) == janet_unwrap_pointer(y)) {
  ------------------
  |  |  867|     57|#define janet_unwrap_pointer(x) (janet_nanbox_to_pointer(x))
  ------------------
                              if (janet_unwrap_pointer(x) == janet_unwrap_pointer(y)) {
  ------------------
  |  |  867|     57|#define janet_unwrap_pointer(x) (janet_nanbox_to_pointer(x))
  ------------------
  |  Branch (35606:21): [True: 0, False: 57]
  ------------------
35607|      0|                    break;
35608|     57|                } else {
35609|     57|                    return janet_unwrap_pointer(x) > janet_unwrap_pointer(y) ? 1 : -1;
  ------------------
  |  |  867|     57|#define janet_unwrap_pointer(x) (janet_nanbox_to_pointer(x))
  ------------------
                                  return janet_unwrap_pointer(x) > janet_unwrap_pointer(y) ? 1 : -1;
  ------------------
  |  |  867|     57|#define janet_unwrap_pointer(x) (janet_nanbox_to_pointer(x))
  ------------------
  |  Branch (35609:28): [True: 23, False: 34]
  ------------------
35610|     57|                }
35611|     57|            }
35612|   386k|            case JANET_TUPLE: {
  ------------------
  |  Branch (35612:13): [True: 386k, False: 3.82M]
  ------------------
35613|   386k|                const Janet *lhs = janet_unwrap_tuple(x);
  ------------------
  |  |  858|   386k|#define janet_unwrap_tuple(x) ((JanetTuple)janet_nanbox_to_pointer(x))
  ------------------
35614|   386k|                const Janet *rhs = janet_unwrap_tuple(y);
  ------------------
  |  |  858|   386k|#define janet_unwrap_tuple(x) ((JanetTuple)janet_nanbox_to_pointer(x))
  ------------------
35615|   386k|                if (JANET_TUPLE_FLAG_BRACKETCTOR & (janet_tuple_flag(lhs) ^ janet_tuple_flag(rhs))) {
  ------------------
  |  | 1797|   386k|#define JANET_TUPLE_FLAG_BRACKETCTOR 0x10000
  ------------------
                              if (JANET_TUPLE_FLAG_BRACKETCTOR & (janet_tuple_flag(lhs) ^ janet_tuple_flag(rhs))) {
  ------------------
  |  | 1805|   386k|#define janet_tuple_flag(t) (janet_tuple_head(t)->gc.flags)
  |  |  ------------------
  |  |  |  | 1799|   386k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
                              if (JANET_TUPLE_FLAG_BRACKETCTOR & (janet_tuple_flag(lhs) ^ janet_tuple_flag(rhs))) {
  ------------------
  |  | 1805|   386k|#define janet_tuple_flag(t) (janet_tuple_head(t)->gc.flags)
  |  |  ------------------
  |  |  |  | 1799|   386k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
  |  Branch (35615:21): [True: 0, False: 386k]
  ------------------
35616|      0|                    return (janet_tuple_flag(lhs) & JANET_TUPLE_FLAG_BRACKETCTOR) ? 1 : -1;
  ------------------
  |  | 1805|      0|#define janet_tuple_flag(t) (janet_tuple_head(t)->gc.flags)
  |  |  ------------------
  |  |  |  | 1799|      0|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
                                  return (janet_tuple_flag(lhs) & JANET_TUPLE_FLAG_BRACKETCTOR) ? 1 : -1;
  ------------------
  |  | 1797|      0|#define JANET_TUPLE_FLAG_BRACKETCTOR 0x10000
  ------------------
  |  Branch (35616:28): [True: 0, False: 0]
  ------------------
35617|      0|                }
35618|   386k|                push_traversal_node(janet_tuple_head(lhs), janet_tuple_head(rhs), 1);
  ------------------
  |  | 1799|   386k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  ------------------
                              push_traversal_node(janet_tuple_head(lhs), janet_tuple_head(rhs), 1);
  ------------------
  |  | 1799|   386k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  ------------------
35619|   386k|                break;
35620|   386k|            }
35621|   820k|            case JANET_STRUCT: {
  ------------------
  |  Branch (35621:13): [True: 820k, False: 3.39M]
  ------------------
35622|   820k|                const JanetKV *lhs = janet_unwrap_struct(x);
  ------------------
  |  |  857|   820k|#define janet_unwrap_struct(x) ((JanetStruct)janet_nanbox_to_pointer(x))
  ------------------
35623|   820k|                const JanetKV *rhs = janet_unwrap_struct(y);
  ------------------
  |  |  857|   820k|#define janet_unwrap_struct(x) ((JanetStruct)janet_nanbox_to_pointer(x))
  ------------------
35624|   820k|                int32_t llen = janet_struct_capacity(lhs);
  ------------------
  |  | 1848|   820k|#define janet_struct_capacity(t) (janet_struct_head(t)->capacity)
  |  |  ------------------
  |  |  |  | 1845|   820k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
35625|   820k|                int32_t rlen = janet_struct_capacity(rhs);
  ------------------
  |  | 1848|   820k|#define janet_struct_capacity(t) (janet_struct_head(t)->capacity)
  |  |  ------------------
  |  |  |  | 1845|   820k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
35626|   820k|                int32_t lhash = janet_struct_hash(lhs);
  ------------------
  |  | 1849|   820k|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|   820k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
35627|   820k|                int32_t rhash = janet_struct_hash(rhs);
  ------------------
  |  | 1849|   820k|#define janet_struct_hash(t) (janet_struct_head(t)->hash)
  |  |  ------------------
  |  |  |  | 1845|   820k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  |  |  ------------------
  ------------------
35628|   820k|                if (llen < rlen) return -1;
  ------------------
  |  Branch (35628:21): [True: 210, False: 820k]
  ------------------
35629|   820k|                if (llen > rlen) return 1;
  ------------------
  |  Branch (35629:21): [True: 196, False: 820k]
  ------------------
35630|   820k|                if (lhash < rhash) return -1;
  ------------------
  |  Branch (35630:21): [True: 0, False: 820k]
  ------------------
35631|   820k|                if (lhash > rhash) return 1;
  ------------------
  |  Branch (35631:21): [True: 0, False: 820k]
  ------------------
35632|   820k|                push_traversal_node(janet_struct_head(lhs), janet_struct_head(rhs), 0);
  ------------------
  |  | 1845|   820k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  ------------------
                              push_traversal_node(janet_struct_head(lhs), janet_struct_head(rhs), 0);
  ------------------
  |  | 1845|   820k|#define janet_struct_head(t) ((JanetStructHead *)((char *)t - offsetof(JanetStructHead, data)))
  ------------------
35633|   820k|                break;
35634|   820k|            }
35635|  4.21M|        }
35636|  4.21M|    } while (!(status = traversal_next(&x, &y)));
  ------------------
  |  Branch (35636:14): [True: 2.41M, False: 1.78M]
  ------------------
35637|  1.78M|    return status - 2;
35638|  1.95M|}
janet_init:
37732|  6.23k|int janet_init(void) {
37733|       |
37734|       |    /* Garbage collection */
37735|  6.23k|    janet_vm.blocks = NULL;
37736|  6.23k|    janet_vm.weak_blocks = NULL;
37737|  6.23k|    janet_vm.next_collection = 0;
37738|  6.23k|    janet_vm.gc_interval = 0x400000;
37739|  6.23k|    janet_vm.block_count = 0;
37740|  6.23k|    janet_vm.gc_mark_phase = 0;
37741|       |
37742|  6.23k|    janet_symcache_init();
37743|       |
37744|       |    /* Initialize gc roots */
37745|  6.23k|    janet_vm.roots = NULL;
37746|  6.23k|    janet_vm.root_count = 0;
37747|  6.23k|    janet_vm.root_capacity = 0;
37748|       |
37749|       |    /* Scratch memory */
37750|  6.23k|    janet_vm.user = NULL;
37751|  6.23k|    janet_vm.scratch_mem = NULL;
37752|  6.23k|    janet_vm.scratch_len = 0;
37753|  6.23k|    janet_vm.scratch_cap = 0;
37754|       |
37755|       |    /* Sandbox flags */
37756|  6.23k|    janet_vm.sandbox_flags = 0;
37757|       |
37758|       |    /* Initialize registry */
37759|  6.23k|    janet_vm.registry = NULL;
37760|  6.23k|    janet_vm.registry_cap = 0;
37761|  6.23k|    janet_vm.registry_count = 0;
37762|  6.23k|    janet_vm.registry_dirty = 0;
37763|       |
37764|       |    /* Initialize abstract registry */
37765|  6.23k|    janet_vm.abstract_registry = janet_table(0);
37766|  6.23k|    janet_gcroot(janet_wrap_table(janet_vm.abstract_registry));
  ------------------
  |  |  846|  6.23k|#define janet_wrap_table(s) janet_nanbox_wrap_((s), JANET_TABLE)
  |  |  ------------------
  |  |  |  |  825|  6.23k|    janet_nanbox_from_pointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  6.23k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  6.23k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
37767|       |
37768|       |    /* Traversal */
37769|  6.23k|    janet_vm.traversal = NULL;
37770|  6.23k|    janet_vm.traversal_base = NULL;
37771|  6.23k|    janet_vm.traversal_top = NULL;
37772|       |
37773|       |    /* Core env */
37774|  6.23k|    janet_vm.core_env = NULL;
37775|       |
37776|       |    /* Auto suspension */
37777|  6.23k|    janet_vm.auto_suspend = 0;
37778|       |
37779|       |    /* Dynamic bindings */
37780|  6.23k|    janet_vm.top_dyns = NULL;
37781|       |
37782|       |    /* Seed RNG */
37783|  6.23k|    janet_rng_seed(janet_default_rng(), 0);
37784|       |
37785|       |    /* Fibers */
37786|  6.23k|    janet_vm.fiber = NULL;
37787|  6.23k|    janet_vm.root_fiber = NULL;
37788|  6.23k|    janet_vm.stackn = 0;
37789|       |
37790|  6.23k|#ifdef JANET_EV
37791|  6.23k|    janet_ev_init();
37792|  6.23k|#endif
37793|  6.23k|#ifdef JANET_NET
37794|  6.23k|    janet_net_init();
37795|  6.23k|#endif
37796|  6.23k|    return 0;
37797|  6.23k|}
janet_deinit:
37812|  6.23k|void janet_deinit(void) {
37813|  6.23k|    janet_clear_memory();
37814|  6.23k|    janet_symcache_deinit();
37815|  6.23k|    janet_free(janet_vm.roots);
  ------------------
  |  | 2415|  6.23k|#define janet_free(X) free((X))
  ------------------
37816|  6.23k|    janet_vm.roots = NULL;
37817|  6.23k|    janet_vm.root_count = 0;
37818|  6.23k|    janet_vm.root_capacity = 0;
37819|  6.23k|    janet_vm.abstract_registry = NULL;
37820|  6.23k|    janet_vm.core_env = NULL;
37821|  6.23k|    janet_vm.top_dyns = NULL;
37822|  6.23k|    janet_vm.user = NULL;
37823|  6.23k|    janet_free(janet_vm.traversal_base);
  ------------------
  |  | 2415|  6.23k|#define janet_free(X) free((X))
  ------------------
37824|  6.23k|    janet_vm.fiber = NULL;
37825|  6.23k|    janet_vm.root_fiber = NULL;
37826|  6.23k|    janet_free(janet_vm.registry);
  ------------------
  |  | 2415|  6.23k|#define janet_free(X) free((X))
  ------------------
37827|       |    janet_vm.registry = NULL;
37828|  6.23k|#ifdef JANET_EV
37829|  6.23k|    janet_ev_deinit();
37830|  6.23k|#endif
37831|  6.23k|#ifdef JANET_NET
37832|  6.23k|    janet_net_deinit();
37833|  6.23k|#endif
37834|  6.23k|}
janet_memalloc_empty:
38002|   183k|void *janet_memalloc_empty(int32_t count) {
38003|   183k|    int32_t i;
38004|   183k|    void *mem = array_allocate(sizeof(JanetKV), count);
38005|   183k|    janet_vm.next_collection += (size_t) count * sizeof(JanetKV);
38006|   183k|    if (NULL == mem) {
  ------------------
  |  Branch (38006:9): [True: 0, False: 183k]
  ------------------
38007|      0|        JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
38008|      0|    }
38009|   183k|    JanetKV *mmem = (JanetKV *)mem;
38010|  8.89M|    for (i = 0; i < count; i++) {
  ------------------
  |  Branch (38010:17): [True: 8.71M, False: 183k]
  ------------------
38011|  8.71M|        JanetKV *kv = mmem + i;
38012|  8.71M|        kv->key = janet_wrap_nil();
  ------------------
  |  |  831|  8.71M|#define janet_wrap_nil() janet_nanbox_from_payload(JANET_NIL, 1)
  |  |  ------------------
  |  |  |  |  822|  8.71M|    janet_nanbox_from_bits(janet_nanbox_tag(t) | (p))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  8.71M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  8.71M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
38013|  8.71M|        kv->value = janet_wrap_nil();
  ------------------
  |  |  831|  8.71M|#define janet_wrap_nil() janet_nanbox_from_payload(JANET_NIL, 1)
  |  |  ------------------
  |  |  |  |  822|  8.71M|    janet_nanbox_from_bits(janet_nanbox_tag(t) | (p))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  8.71M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  8.71M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
38014|  8.71M|    }
38015|   183k|    return mem;
38016|   183k|}
janet_memempty:
38018|  3.61M|void janet_memempty(JanetKV *mem, int32_t count) {
38019|  3.61M|    int32_t i;
38020|  24.8M|    for (i = 0; i < count; i++) {
  ------------------
  |  Branch (38020:17): [True: 21.2M, False: 3.61M]
  ------------------
38021|  21.2M|        mem[i].key = janet_wrap_nil();
  ------------------
  |  |  831|  21.2M|#define janet_wrap_nil() janet_nanbox_from_payload(JANET_NIL, 1)
  |  |  ------------------
  |  |  |  |  822|  21.2M|    janet_nanbox_from_bits(janet_nanbox_tag(t) | (p))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  21.2M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  21.2M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
38022|  21.2M|        mem[i].value = janet_wrap_nil();
  ------------------
  |  |  831|  21.2M|#define janet_wrap_nil() janet_nanbox_from_payload(JANET_NIL, 1)
  |  |  ------------------
  |  |  |  |  822|  21.2M|    janet_nanbox_from_bits(janet_nanbox_tag(t) | (p))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  21.2M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  21.2M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
38023|  21.2M|    }
38024|  3.61M|}
janet_nanbox_to_pointer:
38034|  38.9M|void *janet_nanbox_to_pointer(Janet x) {
38035|  38.9M|    x.i64 &= JANET_NANBOX_PAYLOADBITS;
  ------------------
  |  |  791|  38.9M|#define JANET_NANBOX_PAYLOADBITS 0x00007FFFFFFFFFFFllu
  ------------------
38036|  38.9M|    x.u64 <<= JANET_NANBOX_64_POINTER_SHIFT; /* Alignment, usually 0 */
  ------------------
  |  |  341|  38.9M|#define JANET_NANBOX_64_POINTER_SHIFT 0
  ------------------
38037|  38.9M|    return x.pointer;
38038|  38.9M|}
janet_nanbox_from_pointer:
38040|  3.85M|Janet janet_nanbox_from_pointer(void *p, uint64_t tagmask) {
38041|  3.85M|    Janet ret;
38042|  3.85M|    ret.pointer = p;
38043|       |    /* Should be noop when pointer shift is 0 */
38044|       |    /*
38045|       |    janet_assert(!(ret.u64 & (uint64_t) ((1 << JANET_NANBOX_64_POINTER_SHIFT) - 1)), "unaligned pointer wrap");
38046|       |    */
38047|  3.85M|    ret.u64 >>= JANET_NANBOX_64_POINTER_SHIFT; /* Alignment, usually 0 */
  ------------------
  |  |  341|  3.85M|#define JANET_NANBOX_64_POINTER_SHIFT 0
  ------------------
38048|  3.85M|    ret.u64 |= tagmask;
38049|  3.85M|    return ret;
38050|  3.85M|}
janet_nanbox_from_cpointer:
38052|  19.1M|Janet janet_nanbox_from_cpointer(const void *p, uint64_t tagmask) {
38053|  19.1M|    Janet ret;
38054|  19.1M|    ret.pointer = (void *)p;
38055|       |    /* Should be noop when pointer shift is 0 */
38056|       |    /*
38057|       |    janet_assert(!(ret.u64 & (uint64_t) ((1 << JANET_NANBOX_64_POINTER_SHIFT) - 1)), "unaligned pointer wrap");
38058|       |    */
38059|  19.1M|    ret.u64 >>= JANET_NANBOX_64_POINTER_SHIFT; /* Alignment, usually 0 */
  ------------------
  |  |  341|  19.1M|#define JANET_NANBOX_64_POINTER_SHIFT 0
  ------------------
38060|  19.1M|    ret.u64 |= tagmask;
38061|  19.1M|    return ret;
38062|  19.1M|}
janet_nanbox_from_double:
38064|   199k|Janet janet_nanbox_from_double(double d) {
38065|   199k|    Janet ret;
38066|   199k|    ret.number = d;
38067|   199k|    return ret;
38068|   199k|}
janet_nanbox_from_bits:
38070|  59.9M|Janet janet_nanbox_from_bits(uint64_t bits) {
38071|  59.9M|    Janet ret;
38072|  59.9M|    ret.u64 = bits;
38073|  59.9M|    return ret;
38074|  59.9M|}
janet.c:janet_array_impl:
 1555|    525|static void janet_array_impl(JanetArray *array, int32_t capacity) {
 1556|    525|    Janet *data = NULL;
 1557|    525|    if (capacity > 0) {
  ------------------
  |  Branch (1557:9): [True: 304, False: 221]
  ------------------
 1558|    304|        janet_vm.next_collection += capacity * sizeof(Janet);
 1559|    304|        data = (Janet *) array_allocate(sizeof(Janet), capacity);
 1560|    304|        if (NULL == data) {
  ------------------
  |  Branch (1560:13): [True: 0, False: 304]
  ------------------
 1561|      0|            JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1562|      0|        }
 1563|    304|    }
 1564|    525|    array->count = 0;
 1565|    525|    array->capacity = capacity;
 1566|    525|    array->data = data;
 1567|    525|}
janet.c:janet_buffer_init_impl:
 3122|  3.55M|static JanetBuffer *janet_buffer_init_impl(JanetBuffer *buffer, int32_t capacity) {
 3123|  3.55M|    uint8_t *data = NULL;
 3124|  3.55M|    if (capacity < 4) capacity = 4;
  ------------------
  |  Branch (3124:9): [True: 3.55M, False: 1.25k]
  ------------------
 3125|  3.55M|    janet_gcpressure(capacity);
 3126|  3.55M|    data = array_allocate(sizeof(uint8_t), capacity);
 3127|  3.55M|    if (NULL == data) {
  ------------------
  |  Branch (3127:9): [True: 0, False: 3.55M]
  ------------------
 3128|      0|        JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3129|      0|    }
 3130|  3.55M|    buffer->count = 0;
 3131|  3.55M|    buffer->capacity = capacity;
 3132|  3.55M|    buffer->data = data;
 3133|  3.55M|    return buffer;
 3134|  3.55M|}
janet.c:janet_buffer_can_realloc:
 3115|     71|static void janet_buffer_can_realloc(JanetBuffer *buffer) {
 3116|     71|    if (buffer->gc.flags & JANET_BUFFER_FLAG_NO_REALLOC) {
  ------------------
  |  | 1779|     71|#define JANET_BUFFER_FLAG_NO_REALLOC 0x10000
  ------------------
  |  Branch (3116:9): [True: 0, False: 71]
  ------------------
 3117|      0|        janet_panic("buffer cannot reallocate foreign memory");
 3118|      0|    }
 3119|     71|}
janet.c:janet_q_init:
 9107|  6.23k|static void janet_q_init(JanetQueue *q) {
 9108|       |    q->data = NULL;
 9109|  6.23k|    q->head = 0;
 9110|  6.23k|    q->tail = 0;
 9111|  6.23k|    q->capacity = 0;
 9112|  6.23k|}
janet.c:peek_timeout:
 9189|  6.23k|static int peek_timeout(JanetTimeout *out) {
 9190|  6.23k|    if (janet_vm.tq_count == 0) return 0;
  ------------------
  |  Branch (9190:9): [True: 6.23k, False: 0]
  ------------------
 9191|      0|    *out = janet_vm.tq[0];
 9192|      0|    return 1;
 9193|  6.23k|}
janet.c:janet_q_deinit:
 9114|  6.23k|static void janet_q_deinit(JanetQueue *q) {
 9115|  6.23k|    janet_free(q->data);
  ------------------
  |  | 2415|  6.23k|#define janet_free(X) free((X))
  ------------------
 9116|  6.23k|}
janet.c:janet_ev_setup_selfpipe:
10607|  6.23k|static void janet_ev_setup_selfpipe(void) {
10608|  6.23k|    if (janet_make_pipe(janet_vm.selfpipe, 1)) {
  ------------------
  |  Branch (10608:9): [True: 0, False: 6.23k]
  ------------------
10609|       |        JANET_EXIT("failed to initialize self pipe in event loop");
  ------------------
  |  |  378|      0|#define JANET_EXIT(m) do { \
  |  |  379|      0|    fprintf(stderr, "janet abort at %s:%d: %s\n",\
  |  |  380|      0|        __FILE__,\
  |  |  381|      0|        __LINE__,\
  |  |  382|      0|        (m));\
  |  |  383|      0|    abort();\
  |  |  384|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (384:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
10610|      0|    }
10611|  6.23k|}
janet.c:janet_ev_cleanup_selfpipe:
10630|  6.23k|static void janet_ev_cleanup_selfpipe(void) {
10631|  6.23k|    close(janet_vm.selfpipe[0]);
10632|  6.23k|    close(janet_vm.selfpipe[1]);
10633|  6.23k|}
janet.c:janet_deinit_block:
16570|  15.4M|static void janet_deinit_block(JanetGCObject *mem) {
16571|  15.4M|    switch (mem->flags & JANET_MEM_TYPEBITS) {
  ------------------
  |  |  630|  15.4M|#define JANET_MEM_TYPEBITS 0xFF
  ------------------
16572|  11.5M|        default:
  ------------------
  |  Branch (16572:9): [True: 11.5M, False: 3.89M]
  ------------------
16573|  11.5M|        case JANET_MEMORY_FUNCTION:
  ------------------
  |  Branch (16573:9): [True: 0, False: 15.4M]
  ------------------
16574|  11.5M|            break; /* Do nothing for non gc types */
16575|  35.0k|        case JANET_MEMORY_SYMBOL:
  ------------------
  |  Branch (16575:9): [True: 35.0k, False: 15.3M]
  ------------------
16576|  35.0k|            janet_symbol_deinit(((JanetStringHead *) mem)->data);
16577|  35.0k|            break;
16578|    525|        case JANET_MEMORY_ARRAY:
  ------------------
  |  Branch (16578:9): [True: 525, False: 15.4M]
  ------------------
16579|    525|        case JANET_MEMORY_ARRAY_WEAK:
  ------------------
  |  Branch (16579:9): [True: 0, False: 15.4M]
  ------------------
16580|    525|            janet_free(((JanetArray *) mem)->data);
  ------------------
  |  | 2415|    525|#define janet_free(X) free((X))
  ------------------
16581|    525|            break;
16582|   162k|        case JANET_MEMORY_TABLE:
  ------------------
  |  Branch (16582:9): [True: 162k, False: 15.2M]
  ------------------
16583|   162k|        case JANET_MEMORY_TABLE_WEAKK:
  ------------------
  |  Branch (16583:9): [True: 0, False: 15.4M]
  ------------------
16584|   162k|        case JANET_MEMORY_TABLE_WEAKV:
  ------------------
  |  Branch (16584:9): [True: 0, False: 15.4M]
  ------------------
16585|   162k|        case JANET_MEMORY_TABLE_WEAKKV:
  ------------------
  |  Branch (16585:9): [True: 0, False: 15.4M]
  ------------------
16586|   162k|            janet_free(((JanetTable *) mem)->data);
  ------------------
  |  | 2415|   162k|#define janet_free(X) free((X))
  ------------------
16587|   162k|            break;
16588|      0|        case JANET_MEMORY_FIBER: {
  ------------------
  |  Branch (16588:9): [True: 0, False: 15.4M]
  ------------------
16589|      0|            JanetFiber *f = (JanetFiber *)mem;
16590|      0|#ifdef JANET_EV
16591|      0|            if (f->ev_state && !(f->flags & JANET_FIBER_EV_FLAG_IN_FLIGHT)) {
  ------------------
  |  |  802|      0|#define JANET_FIBER_EV_FLAG_IN_FLIGHT 0x1
  ------------------
  |  Branch (16591:17): [True: 0, False: 0]
  |  Branch (16591:32): [True: 0, False: 0]
  ------------------
16592|      0|                janet_ev_dec_refcount();
16593|      0|                janet_free(f->ev_state);
  ------------------
  |  | 2415|      0|#define janet_free(X) free((X))
  ------------------
16594|      0|            } else if (f->gc.flags & JANET_FIBER_EV_GCFLAG_SUSPENDED) {
  ------------------
  |  |  798|      0|#define JANET_FIBER_EV_GCFLAG_SUSPENDED 0x2000000
  ------------------
  |  Branch (16594:24): [True: 0, False: 0]
  ------------------
16595|      0|                janet_ev_dec_refcount();
16596|      0|            }
16597|      0|#endif
16598|      0|            janet_free(f->data);
  ------------------
  |  | 2415|      0|#define janet_free(X) free((X))
  ------------------
16599|      0|        }
16600|      0|        break;
16601|  3.55M|        case JANET_MEMORY_BUFFER:
  ------------------
  |  Branch (16601:9): [True: 3.55M, False: 11.8M]
  ------------------
16602|  3.55M|            janet_buffer_deinit((JanetBuffer *) mem);
16603|  3.55M|            break;
16604|   140k|        case JANET_MEMORY_ABSTRACT: {
  ------------------
  |  Branch (16604:9): [True: 140k, False: 15.2M]
  ------------------
16605|   140k|            JanetAbstractHead *head = (JanetAbstractHead *)mem;
16606|   140k|            if (head->type->gcperthread) {
  ------------------
  |  Branch (16606:17): [True: 0, False: 140k]
  ------------------
16607|      0|                janet_assert(!head->type->gcperthread(head->data, head->size), "per-thread finalizer failed");
  ------------------
  |  |  389|      0|#define janet_assert(c, m) do { \
  |  |  390|      0|    if (!(c)) JANET_EXIT((m)); \
  |  |  ------------------
  |  |  |  |  378|      0|#define JANET_EXIT(m) do { \
  |  |  |  |  379|      0|    fprintf(stderr, "janet abort at %s:%d: %s\n",\
  |  |  |  |  380|      0|        __FILE__,\
  |  |  |  |  381|      0|        __LINE__,\
  |  |  |  |  382|      0|        (m));\
  |  |  |  |  383|      0|    abort();\
  |  |  |  |  384|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:10): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (390:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  391|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (391:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
16608|      0|            }
16609|   140k|            if (head->type->gc) {
  ------------------
  |  Branch (16609:17): [True: 0, False: 140k]
  ------------------
16610|      0|                janet_assert(!head->type->gc(head->data, head->size), "finalizer failed");
  ------------------
  |  |  389|      0|#define janet_assert(c, m) do { \
  |  |  390|      0|    if (!(c)) JANET_EXIT((m)); \
  |  |  ------------------
  |  |  |  |  378|      0|#define JANET_EXIT(m) do { \
  |  |  |  |  379|      0|    fprintf(stderr, "janet abort at %s:%d: %s\n",\
  |  |  |  |  380|      0|        __FILE__,\
  |  |  |  |  381|      0|        __LINE__,\
  |  |  |  |  382|      0|        (m));\
  |  |  |  |  383|      0|    abort();\
  |  |  |  |  384|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:10): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (390:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  391|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (391:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
16611|      0|            }
16612|   140k|        }
16613|   140k|        break;
16614|   140k|        case JANET_MEMORY_FUNCENV: {
  ------------------
  |  Branch (16614:9): [True: 0, False: 15.4M]
  ------------------
16615|      0|            JanetFuncEnv *env = (JanetFuncEnv *)mem;
16616|      0|            if (0 == env->offset)
  ------------------
  |  Branch (16616:17): [True: 0, False: 0]
  ------------------
16617|      0|                janet_free(env->as.values);
  ------------------
  |  | 2415|      0|#define janet_free(X) free((X))
  ------------------
16618|      0|        }
16619|      0|        break;
16620|      0|        case JANET_MEMORY_FUNCDEF: {
  ------------------
  |  Branch (16620:9): [True: 0, False: 15.4M]
  ------------------
16621|      0|            JanetFuncDef *def = (JanetFuncDef *)mem;
16622|       |            /* TODO - get this all with one alloc and one free */
16623|      0|            janet_free(def->defs);
  ------------------
  |  | 2415|      0|#define janet_free(X) free((X))
  ------------------
16624|      0|            janet_free(def->environments);
  ------------------
  |  | 2415|      0|#define janet_free(X) free((X))
  ------------------
16625|      0|            janet_free(def->constants);
  ------------------
  |  | 2415|      0|#define janet_free(X) free((X))
  ------------------
16626|      0|            janet_free(def->bytecode);
  ------------------
  |  | 2415|      0|#define janet_free(X) free((X))
  ------------------
16627|      0|            janet_free(def->sourcemap);
  ------------------
  |  | 2415|      0|#define janet_free(X) free((X))
  ------------------
16628|      0|            janet_free(def->closure_bitset);
  ------------------
  |  | 2415|      0|#define janet_free(X) free((X))
  ------------------
16629|      0|            janet_free(def->symbolmap);
  ------------------
  |  | 2415|      0|#define janet_free(X) free((X))
  ------------------
16630|      0|        }
16631|      0|        break;
16632|  15.4M|    }
16633|  15.4M|}
janet.c:janet_free_all_scratch:
16820|  6.23k|static void janet_free_all_scratch(void) {
16821|  6.23k|    for (size_t i = 0; i < janet_vm.scratch_len; i++) {
  ------------------
  |  Branch (16821:24): [True: 0, False: 6.23k]
  ------------------
16822|      0|        free_one_scratch(janet_vm.scratch_mem[i]);
16823|      0|    }
16824|  6.23k|    janet_vm.scratch_len = 0;
16825|  6.23k|}
janet.c:janet_int64_compare:
17088|  63.4k|static int janet_int64_compare(void *p1, void *p2) {
17089|  63.4k|    int64_t x = *((int64_t *)p1);
17090|  63.4k|    int64_t y = *((int64_t *)p2);
17091|  63.4k|    return x == y ? 0 : x < y ? -1 : 1;
  ------------------
  |  Branch (17091:12): [True: 43.2k, False: 20.1k]
  |  Branch (17091:25): [True: 13.4k, False: 6.72k]
  ------------------
17092|  63.4k|}
janet.c:janet_int64_hash:
17082|   115k|static int32_t janet_int64_hash(void *p1, size_t size) {
17083|   115k|    (void) size;
17084|   115k|    int32_t *words = p1;
17085|   115k|    return words[0] ^ words[1];
17086|   115k|}
janet.c:janet_uint64_compare:
17094|  14.1k|static int janet_uint64_compare(void *p1, void *p2) {
17095|  14.1k|    uint64_t x = *((uint64_t *)p1);
17096|  14.1k|    uint64_t y = *((uint64_t *)p2);
17097|  14.1k|    return x == y ? 0 : x < y ? -1 : 1;
  ------------------
  |  Branch (17097:12): [True: 371, False: 13.7k]
  |  Branch (17097:25): [True: 4.10k, False: 9.65k]
  ------------------
17098|  14.1k|}
janet.c:janet_parser_checkdead:
25854|  88.9M|static void janet_parser_checkdead(JanetParser *parser) {
25855|  88.9M|    if (parser->flag) janet_panic("parser is dead, cannot consume");
  ------------------
  |  Branch (25855:9): [True: 0, False: 88.9M]
  ------------------
25856|  88.9M|    if (parser->error) janet_panic("parser has unchecked error, cannot consume");
  ------------------
  |  Branch (25856:9): [True: 0, False: 88.9M]
  ------------------
25857|  88.9M|}
janet.c:delim_error:
25364|    349|static void delim_error(JanetParser *parser, size_t stack_index, char c, const char *msg) {
25365|    349|    JanetParseState *s = parser->states + stack_index;
25366|    349|    JanetBuffer *buffer = janet_buffer(40);
25367|    349|    if (msg) {
  ------------------
  |  Branch (25367:9): [True: 349, False: 0]
  ------------------
25368|    349|        janet_buffer_push_cstring(buffer, msg);
25369|    349|    }
25370|    349|    if (c) {
  ------------------
  |  Branch (25370:9): [True: 349, False: 0]
  ------------------
25371|    349|        janet_buffer_push_u8(buffer, c);
25372|    349|    }
25373|    349|    if (stack_index > 0) {
  ------------------
  |  Branch (25373:9): [True: 71, False: 278]
  ------------------
25374|     71|        janet_buffer_push_cstring(buffer, ", ");
25375|     71|        if (s->flags & PFLAG_PARENS) {
  ------------------
  |  |25300|     71|#define PFLAG_PARENS 0x400
  ------------------
  |  Branch (25375:13): [True: 11, False: 60]
  ------------------
25376|     11|            janet_buffer_push_u8(buffer, '(');
25377|     60|        } else if (s->flags & PFLAG_SQRBRACKETS) {
  ------------------
  |  |25301|     60|#define PFLAG_SQRBRACKETS 0x800
  ------------------
  |  Branch (25377:20): [True: 15, False: 45]
  ------------------
25378|     15|            janet_buffer_push_u8(buffer, '[');
25379|     45|        } else if (s->flags & PFLAG_CURLYBRACKETS) {
  ------------------
  |  |25302|     45|#define PFLAG_CURLYBRACKETS 0x1000
  ------------------
  |  Branch (25379:20): [True: 16, False: 29]
  ------------------
25380|     16|            janet_buffer_push_u8(buffer, '{');
25381|     29|        } else if (s->flags & PFLAG_STRING) {
  ------------------
  |  |25303|     29|#define PFLAG_STRING 0x2000
  ------------------
  |  Branch (25381:20): [True: 0, False: 29]
  ------------------
25382|      0|            janet_buffer_push_u8(buffer, '"');
25383|     29|        } else if (s->flags & PFLAG_LONGSTRING) {
  ------------------
  |  |25304|     29|#define PFLAG_LONGSTRING 0x4000
  ------------------
  |  Branch (25383:20): [True: 0, False: 29]
  ------------------
25384|      0|            int32_t i;
25385|      0|            for (i = 0; i < s->argn; i++) {
  ------------------
  |  Branch (25385:25): [True: 0, False: 0]
  ------------------
25386|      0|                janet_buffer_push_u8(buffer, '`');
25387|      0|            }
25388|      0|        }
25389|     71|        janet_formatb(buffer, " opened at line %d, column %d", (int32_t) s->line, (int32_t) s->column);
25390|     71|    }
25391|    349|    parser->error = (const char *) janet_string(buffer->data, buffer->count);
25392|    349|    parser->flag |= JANET_PARSER_GENERATED_ERROR;
  ------------------
  |  |25194|    349|#define JANET_PARSER_GENERATED_ERROR 0x2
  ------------------
25393|    349|}
janet.c:pushstate:
25310|  31.3M|static void pushstate(JanetParser *p, Consumer consumer, int flags) {
25311|  31.3M|    JanetParseState s;
25312|  31.3M|    s.counter = 0;
25313|  31.3M|    s.argn = 0;
25314|  31.3M|    s.flags = flags;
25315|  31.3M|    s.consumer = consumer;
25316|  31.3M|    s.line = p->line;
25317|  31.3M|    s.column = p->column;
25318|  31.3M|    _pushstate(p, s);
25319|  31.3M|}
janet.c:root:
25781|  33.0M|static int root(JanetParser *p, JanetParseState *state, uint8_t c) {
25782|  33.0M|    switch (c) {
25783|  5.76M|        default:
  ------------------
  |  Branch (25783:9): [True: 5.76M, False: 27.2M]
  ------------------
25784|  5.76M|            if (is_whitespace(c)) return 1;
  ------------------
  |  Branch (25784:17): [True: 1.62M, False: 4.14M]
  ------------------
25785|  4.14M|            if (!janet_is_symbol_char(c)) {
  ------------------
  |  Branch (25785:17): [True: 347, False: 4.14M]
  ------------------
25786|    347|                p->error = "unexpected character";
25787|    347|                return 1;
25788|    347|            }
25789|  4.14M|            pushstate(p, tokenchar, PFLAG_TOKEN);
  ------------------
  |  |25308|  4.14M|#define PFLAG_TOKEN 0x40000
  ------------------
25790|  4.14M|            return 0;
25791|  36.5k|        case '\'':
  ------------------
  |  Branch (25791:9): [True: 36.5k, False: 32.9M]
  ------------------
25792|   527k|        case ',':
  ------------------
  |  Branch (25792:9): [True: 490k, False: 32.5M]
  ------------------
25793|  3.69M|        case ';':
  ------------------
  |  Branch (25793:9): [True: 3.16M, False: 29.8M]
  ------------------
25794|  3.71M|        case '~':
  ------------------
  |  Branch (25794:9): [True: 20.6k, False: 32.9M]
  ------------------
25795|  3.71M|        case '|':
  ------------------
  |  Branch (25795:9): [True: 3.43k, False: 33.0M]
  ------------------
25796|  3.71M|            pushstate(p, root, PFLAG_READERMAC | c);
  ------------------
  |  |25305|  3.71M|#define PFLAG_READERMAC 0x8000
  ------------------
25797|  3.71M|            return 1;
25798|  4.18M|        case '"':
  ------------------
  |  Branch (25798:9): [True: 4.18M, False: 28.8M]
  ------------------
25799|  4.18M|            pushstate(p, stringchar, PFLAG_STRING);
  ------------------
  |  |25303|  4.18M|#define PFLAG_STRING 0x2000
  ------------------
25800|  4.18M|            return 1;
25801|    547|        case '#':
  ------------------
  |  Branch (25801:9): [True: 547, False: 33.0M]
  ------------------
25802|    547|            pushstate(p, comment, PFLAG_COMMENT);
  ------------------
  |  |25307|    547|#define PFLAG_COMMENT 0x20000
  ------------------
25803|    547|            return 1;
25804|  3.78M|        case '@':
  ------------------
  |  Branch (25804:9): [True: 3.78M, False: 29.2M]
  ------------------
25805|  3.78M|            pushstate(p, atsign, PFLAG_ATSYM);
  ------------------
  |  |25306|  3.78M|#define PFLAG_ATSYM 0x10000
  ------------------
25806|  3.78M|            return 1;
25807|  12.5k|        case '`':
  ------------------
  |  Branch (25807:9): [True: 12.5k, False: 32.9M]
  ------------------
25808|  12.5k|            pushstate(p, longstring, PFLAG_LONGSTRING);
  ------------------
  |  |25304|  12.5k|#define PFLAG_LONGSTRING 0x4000
  ------------------
25809|  12.5k|            return 1;
25810|  1.10k|        case ')':
  ------------------
  |  Branch (25810:9): [True: 1.10k, False: 33.0M]
  ------------------
25811|  23.6k|        case ']':
  ------------------
  |  Branch (25811:9): [True: 22.5k, False: 32.9M]
  ------------------
25812|  3.79M|        case '}': {
  ------------------
  |  Branch (25812:9): [True: 3.77M, False: 29.2M]
  ------------------
25813|  3.79M|            Janet ds;
25814|  3.79M|            if (p->statecount == 1) {
  ------------------
  |  Branch (25814:17): [True: 278, False: 3.79M]
  ------------------
25815|    278|                delim_error(p, 0, c, "unexpected closing delimiter ");
25816|    278|                return 1;
25817|    278|            }
25818|  3.79M|            if ((c == ')' && (state->flags & PFLAG_PARENS)) ||
  ------------------
  |  |25300|  1.05k|#define PFLAG_PARENS 0x400
  ------------------
  |  Branch (25818:18): [True: 1.05k, False: 3.79M]
  |  Branch (25818:30): [True: 1.03k, False: 25]
  ------------------
25819|  3.79M|                    (c == ']' && (state->flags & PFLAG_SQRBRACKETS))) {
  ------------------
  |  |25301|  22.5k|#define PFLAG_SQRBRACKETS 0x800
  ------------------
  |  Branch (25819:22): [True: 22.5k, False: 3.77M]
  |  Branch (25819:34): [True: 22.5k, False: 16]
  ------------------
25820|  23.5k|                if (state->flags & PFLAG_ATSYM) {
  ------------------
  |  |25306|  23.5k|#define PFLAG_ATSYM 0x10000
  ------------------
  |  Branch (25820:21): [True: 525, False: 23.0k]
  ------------------
25821|    525|                    ds = close_array(p, state);
25822|  23.0k|                } else {
25823|  23.0k|                    ds = close_tuple(p, state, c == ']' ? JANET_TUPLE_FLAG_BRACKETCTOR : 0);
  ------------------
  |  | 1797|  22.1k|#define JANET_TUPLE_FLAG_BRACKETCTOR 0x10000
  ------------------
  |  Branch (25823:48): [True: 22.1k, False: 874]
  ------------------
25824|  23.0k|                }
25825|  3.77M|            } else if (c == '}' && (state->flags & PFLAG_CURLYBRACKETS)) {
  ------------------
  |  |25302|  3.77M|#define PFLAG_CURLYBRACKETS 0x1000
  ------------------
  |  Branch (25825:24): [True: 3.77M, False: 41]
  |  Branch (25825:36): [True: 3.77M, False: 30]
  ------------------
25826|  3.77M|                if (state->argn & 1) {
  ------------------
  |  Branch (25826:21): [True: 39, False: 3.77M]
  ------------------
25827|     39|                    p->error = "struct and table literals expect even number of arguments";
25828|     39|                    return 1;
25829|     39|                }
25830|  3.77M|                if (state->flags & PFLAG_ATSYM) {
  ------------------
  |  |25306|  3.77M|#define PFLAG_ATSYM 0x10000
  ------------------
  |  Branch (25830:21): [True: 156k, False: 3.61M]
  ------------------
25831|   156k|                    ds = close_table(p, state);
25832|  3.61M|                } else {
25833|  3.61M|                    ds = close_struct(p, state);
25834|  3.61M|                }
25835|  3.77M|            } else {
25836|     71|                delim_error(p, p->statecount - 1, c, "mismatched delimiter ");
25837|     71|                return 1;
25838|     71|            }
25839|  3.79M|            popstate(p, ds);
25840|  3.79M|        }
25841|      0|        return 1;
25842|  1.08M|        case '(':
  ------------------
  |  Branch (25842:9): [True: 1.08M, False: 31.9M]
  ------------------
25843|  1.08M|            pushstate(p, root, PFLAG_CONTAINER | PFLAG_PARENS);
  ------------------
  |  |25298|  1.08M|#define PFLAG_CONTAINER 0x100
  ------------------
                          pushstate(p, root, PFLAG_CONTAINER | PFLAG_PARENS);
  ------------------
  |  |25300|  1.08M|#define PFLAG_PARENS 0x400
  ------------------
25844|  1.08M|            return 1;
25845|  1.81M|        case '[':
  ------------------
  |  Branch (25845:9): [True: 1.81M, False: 31.1M]
  ------------------
25846|  1.81M|            pushstate(p, root, PFLAG_CONTAINER | PFLAG_SQRBRACKETS);
  ------------------
  |  |25298|  1.81M|#define PFLAG_CONTAINER 0x100
  ------------------
                          pushstate(p, root, PFLAG_CONTAINER | PFLAG_SQRBRACKETS);
  ------------------
  |  |25301|  1.81M|#define PFLAG_SQRBRACKETS 0x800
  ------------------
25847|  1.81M|            return 1;
25848|  8.84M|        case '{':
  ------------------
  |  Branch (25848:9): [True: 8.84M, False: 24.1M]
  ------------------
25849|  8.84M|            pushstate(p, root, PFLAG_CONTAINER | PFLAG_CURLYBRACKETS);
  ------------------
  |  |25298|  8.84M|#define PFLAG_CONTAINER 0x100
  ------------------
                          pushstate(p, root, PFLAG_CONTAINER | PFLAG_CURLYBRACKETS);
  ------------------
  |  |25302|  8.84M|#define PFLAG_CURLYBRACKETS 0x1000
  ------------------
25850|  8.84M|            return 1;
25851|  33.0M|    }
25852|  33.0M|}
janet.c:is_whitespace:
25197|  5.76M|static int is_whitespace(uint8_t c) {
25198|  5.76M|    return c == ' '
  ------------------
  |  Branch (25198:12): [True: 20.6k, False: 5.74M]
  ------------------
25199|  5.74M|           || c == '\t'
  ------------------
  |  Branch (25199:15): [True: 30.3k, False: 5.71M]
  ------------------
25200|  5.71M|           || c == '\n'
  ------------------
  |  Branch (25200:15): [True: 5.32k, False: 5.70M]
  ------------------
25201|  5.70M|           || c == '\r'
  ------------------
  |  Branch (25201:15): [True: 1.05M, False: 4.65M]
  ------------------
25202|  4.65M|           || c == '\0'
  ------------------
  |  Branch (25202:15): [True: 337k, False: 4.31M]
  ------------------
25203|  4.31M|           || c == '\v'
  ------------------
  |  Branch (25203:15): [True: 172k, False: 4.14M]
  ------------------
25204|  4.14M|           || c == '\f';
  ------------------
  |  Branch (25204:15): [True: 1.46k, False: 4.14M]
  ------------------
25205|  5.76M|}
janet.c:stringchar:
25576|  17.7M|static int stringchar(JanetParser *p, JanetParseState *state, uint8_t c) {
25577|       |    /* Enter escape */
25578|  17.7M|    if (c == '\\') {
  ------------------
  |  Branch (25578:9): [True: 43.7k, False: 17.6M]
  ------------------
25579|  43.7k|        state->consumer = escape1;
25580|  43.7k|        return 1;
25581|  43.7k|    }
25582|       |    /* String end */
25583|  17.6M|    if (c == '"') {
  ------------------
  |  Branch (25583:9): [True: 7.73M, False: 9.96M]
  ------------------
25584|  7.73M|        return stringend(p, state);
25585|  7.73M|    }
25586|       |    /* normal char */
25587|  9.96M|    if (c != '\n' && c != '\r')
  ------------------
  |  Branch (25587:9): [True: 9.94M, False: 15.5k]
  |  Branch (25587:22): [True: 8.86M, False: 1.08M]
  ------------------
25588|  8.86M|        push_buf(p, c);
25589|  9.96M|    return 1;
25590|  17.6M|}
janet.c:escape1:
25491|  43.7k|static int escape1(JanetParser *p, JanetParseState *state, uint8_t c) {
25492|  43.7k|    int e = checkescape(c);
25493|  43.7k|    if (e < 0) {
  ------------------
  |  Branch (25493:9): [True: 3, False: 43.7k]
  ------------------
25494|      3|        p->error = "invalid string escape sequence";
25495|      3|        return 1;
25496|      3|    }
25497|  43.7k|    if (c == 'x') {
  ------------------
  |  Branch (25497:9): [True: 840, False: 42.8k]
  ------------------
25498|    840|        state->counter = 2;
25499|    840|        state->argn = 0;
25500|    840|        state->consumer = escapeh;
25501|  42.8k|    } else if (c == 'u' || c == 'U') {
  ------------------
  |  Branch (25501:16): [True: 1.90k, False: 40.9k]
  |  Branch (25501:28): [True: 1.25k, False: 39.7k]
  ------------------
25502|  3.15k|        state->counter = c == 'u' ? 4 : 6;
  ------------------
  |  Branch (25502:26): [True: 1.90k, False: 1.25k]
  ------------------
25503|  3.15k|        state->argn = 0;
25504|  3.15k|        state->consumer = escapeu;
25505|  39.7k|    } else {
25506|  39.7k|        push_buf(p, (uint8_t) e);
25507|  39.7k|        state->consumer = stringchar;
25508|  39.7k|    }
25509|  43.7k|    return 1;
25510|  43.7k|}
janet.c:checkescape:
25395|  43.7k|static int checkescape(uint8_t c) {
25396|  43.7k|    switch (c) {
25397|      3|        default:
  ------------------
  |  Branch (25397:9): [True: 3, False: 43.7k]
  ------------------
25398|      3|            return -1;
25399|    840|        case 'x':
  ------------------
  |  Branch (25399:9): [True: 840, False: 42.8k]
  ------------------
25400|  2.74k|        case 'u':
  ------------------
  |  Branch (25400:9): [True: 1.90k, False: 41.8k]
  ------------------
25401|  3.99k|        case 'U':
  ------------------
  |  Branch (25401:9): [True: 1.25k, False: 42.4k]
  ------------------
25402|  3.99k|            return 1;
25403|    337|        case 'n':
  ------------------
  |  Branch (25403:9): [True: 337, False: 43.3k]
  ------------------
25404|    337|            return '\n';
25405|    256|        case 't':
  ------------------
  |  Branch (25405:9): [True: 256, False: 43.4k]
  ------------------
25406|    256|            return '\t';
25407|    214|        case 'r':
  ------------------
  |  Branch (25407:9): [True: 214, False: 43.5k]
  ------------------
25408|    214|            return '\r';
25409|    510|        case '0':
  ------------------
  |  Branch (25409:9): [True: 510, False: 43.2k]
  ------------------
25410|    510|            return '\0';
25411|    242|        case 'z':
  ------------------
  |  Branch (25411:9): [True: 242, False: 43.4k]
  ------------------
25412|    242|            return '\0';
25413|    756|        case 'f':
  ------------------
  |  Branch (25413:9): [True: 756, False: 42.9k]
  ------------------
25414|    756|            return '\f';
25415|    319|        case 'v':
  ------------------
  |  Branch (25415:9): [True: 319, False: 43.4k]
  ------------------
25416|    319|            return '\v';
25417|  34.7k|        case 'a':
  ------------------
  |  Branch (25417:9): [True: 34.7k, False: 9.01k]
  ------------------
25418|  34.7k|            return '\a';
25419|    208|        case 'b':
  ------------------
  |  Branch (25419:9): [True: 208, False: 43.5k]
  ------------------
25420|    208|            return '\b';
25421|    208|        case '\'':
  ------------------
  |  Branch (25421:9): [True: 208, False: 43.5k]
  ------------------
25422|    208|            return '\'';
25423|    213|        case '?':
  ------------------
  |  Branch (25423:9): [True: 213, False: 43.5k]
  ------------------
25424|    213|            return '?';
25425|    203|        case 'e':
  ------------------
  |  Branch (25425:9): [True: 203, False: 43.5k]
  ------------------
25426|    203|            return 27;
25427|    388|        case '"':
  ------------------
  |  Branch (25427:9): [True: 388, False: 43.3k]
  ------------------
25428|    388|            return '"';
25429|  1.16k|        case '\\':
  ------------------
  |  Branch (25429:9): [True: 1.16k, False: 42.5k]
  ------------------
25430|  1.16k|            return '\\';
25431|  43.7k|    }
25432|  43.7k|}
janet.c:escapeh:
25455|  1.60k|static int escapeh(JanetParser *p, JanetParseState *state, uint8_t c) {
25456|  1.60k|    int digit = to_hex(c);
25457|  1.60k|    if (digit < 0) {
  ------------------
  |  Branch (25457:9): [True: 40, False: 1.56k]
  ------------------
25458|     40|        p->error = "invalid hex digit in hex escape";
25459|     40|        return 1;
25460|     40|    }
25461|  1.56k|    state->argn = (state->argn << 4) + digit;
25462|  1.56k|    state->counter--;
25463|  1.56k|    if (!state->counter) {
  ------------------
  |  Branch (25463:9): [True: 771, False: 793]
  ------------------
25464|    771|        push_buf(p, (uint8_t)(state->argn & 0xFF));
25465|    771|        state->argn = 0;
25466|    771|        state->consumer = stringchar;
25467|    771|    }
25468|  1.56k|    return 1;
25469|  1.60k|}
janet.c:to_hex:
25260|  16.4k|static int to_hex(uint8_t c) {
25261|  16.4k|    if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (25261:9): [True: 16.4k, False: 21]
  |  Branch (25261:21): [True: 7.89k, False: 8.52k]
  ------------------
25262|  7.89k|        return c - '0';
25263|  8.54k|    } else if (c >= 'A' && c <= 'F') {
  ------------------
  |  Branch (25263:16): [True: 8.51k, False: 31]
  |  Branch (25263:28): [True: 4.02k, False: 4.48k]
  ------------------
25264|  4.02k|        return 10 + c - 'A';
25265|  4.51k|    } else if (c >= 'a' && c <= 'f') {
  ------------------
  |  Branch (25265:16): [True: 4.47k, False: 46]
  |  Branch (25265:28): [True: 4.43k, False: 36]
  ------------------
25266|  4.43k|        return 10 + c - 'a';
25267|  4.43k|    } else {
25268|     82|        return -1;
25269|     82|    }
25270|  16.4k|}
janet.c:escapeu:
25471|  14.8k|static int escapeu(JanetParser *p, JanetParseState *state, uint8_t c) {
25472|  14.8k|    int digit = to_hex(c);
25473|  14.8k|    if (digit < 0) {
  ------------------
  |  Branch (25473:9): [True: 42, False: 14.7k]
  ------------------
25474|     42|        p->error = "invalid hex digit in unicode escape";
25475|     42|        return 1;
25476|     42|    }
25477|  14.7k|    state->argn = (state->argn << 4) + digit;
25478|  14.7k|    state->counter--;
25479|  14.7k|    if (!state->counter) {
  ------------------
  |  Branch (25479:9): [True: 3.07k, False: 11.7k]
  ------------------
25480|  3.07k|        if (state->argn > 0x10FFFF) {
  ------------------
  |  Branch (25480:13): [True: 7, False: 3.06k]
  ------------------
25481|      7|            p->error = "invalid unicode codepoint";
25482|      7|            return 1;
25483|      7|        }
25484|  3.06k|        write_codepoint(p, state->argn);
25485|  3.06k|        state->argn = 0;
25486|  3.06k|        state->consumer = stringchar;
25487|  3.06k|    }
25488|  14.7k|    return 1;
25489|  14.7k|}
janet.c:write_codepoint:
25437|  3.06k|static void write_codepoint(JanetParser *p, int32_t codepoint) {
25438|  3.06k|    if (codepoint <= 0x7F) {
  ------------------
  |  Branch (25438:9): [True: 272, False: 2.79k]
  ------------------
25439|    272|        push_buf(p, (uint8_t) codepoint);
25440|  2.79k|    } else if (codepoint <= 0x7FF) {
  ------------------
  |  Branch (25440:16): [True: 471, False: 2.32k]
  ------------------
25441|    471|        push_buf(p, (uint8_t)((codepoint >>  6) & 0x1F) | 0xC0);
25442|    471|        push_buf(p, (uint8_t)((codepoint >>  0) & 0x3F) | 0x80);
25443|  2.32k|    } else if (codepoint <= 0xFFFF) {
  ------------------
  |  Branch (25443:16): [True: 1.12k, False: 1.19k]
  ------------------
25444|  1.12k|        push_buf(p, (uint8_t)((codepoint >> 12) & 0x0F) | 0xE0);
25445|  1.12k|        push_buf(p, (uint8_t)((codepoint >>  6) & 0x3F) | 0x80);
25446|  1.12k|        push_buf(p, (uint8_t)((codepoint >>  0) & 0x3F) | 0x80);
25447|  1.19k|    } else {
25448|  1.19k|        push_buf(p, (uint8_t)((codepoint >> 18) & 0x07) | 0xF0);
25449|  1.19k|        push_buf(p, (uint8_t)((codepoint >> 12) & 0x3F) | 0x80);
25450|  1.19k|        push_buf(p, (uint8_t)((codepoint >>  6) & 0x3F) | 0x80);
25451|  1.19k|        push_buf(p, (uint8_t)((codepoint >>  0) & 0x3F) | 0x80);
25452|  1.19k|    }
25453|  3.06k|}
janet.c:stringend:
25512|  7.74M|static int stringend(JanetParser *p, JanetParseState *state) {
25513|  7.74M|    Janet ret;
25514|  7.74M|    uint8_t *bufstart = p->buf;
25515|  7.74M|    int32_t buflen = (int32_t) p->bufcount;
25516|  7.74M|    if (state->flags & PFLAG_LONGSTRING) {
  ------------------
  |  |25304|  7.74M|#define PFLAG_LONGSTRING 0x4000
  ------------------
  |  Branch (25516:9): [True: 13.2k, False: 7.73M]
  ------------------
25517|       |        /* Post process to remove leading whitespace */
25518|  13.2k|        JanetParseState top = p->states[p->statecount - 1];
25519|  13.2k|        int32_t indent_col = (int32_t) top.column - 1;
25520|  13.2k|        uint8_t *r = bufstart, *end = r + buflen;
25521|       |        /* Unless there are only spaces before EOLs, disable reindenting */
25522|  13.2k|        int reindent = 1;
25523|  10.1M|        while (reindent && (r < end)) {
  ------------------
  |  Branch (25523:16): [True: 10.1M, False: 806]
  |  Branch (25523:28): [True: 10.1M, False: 12.4k]
  ------------------
25524|  10.1M|            if (*r++ == '\n') {
  ------------------
  |  Branch (25524:17): [True: 21.9k, False: 10.1M]
  ------------------
25525|  24.4k|                for (int32_t j = 0; (r < end) && (*r != '\n') && (j < indent_col); j++, r++) {
  ------------------
  |  Branch (25525:37): [True: 22.7k, False: 1.66k]
  |  Branch (25525:50): [True: 16.7k, False: 6.02k]
  |  Branch (25525:66): [True: 3.55k, False: 13.2k]
  ------------------
25526|  3.55k|                    if (*r != ' ') {
  ------------------
  |  Branch (25526:25): [True: 996, False: 2.55k]
  ------------------
25527|    996|                        reindent = 0;
25528|    996|                        break;
25529|    996|                    }
25530|  3.55k|                }
25531|  21.9k|                if ((r + 1) < end && *r == '\r' && *(r + 1) == '\n') reindent = 1;
  ------------------
  |  Branch (25531:21): [True: 19.4k, False: 2.41k]
  |  Branch (25531:38): [True: 8.28k, False: 11.2k]
  |  Branch (25531:52): [True: 4.16k, False: 4.12k]
  ------------------
25532|  21.9k|            }
25533|  10.1M|        }
25534|       |        /* Now reindent if able */
25535|  13.2k|        if (reindent) {
  ------------------
  |  Branch (25535:13): [True: 12.4k, False: 806]
  ------------------
25536|  12.4k|            uint8_t *w = bufstart;
25537|  12.4k|            r = bufstart;
25538|  9.84M|            while (r < end) {
  ------------------
  |  Branch (25538:20): [True: 9.83M, False: 12.4k]
  ------------------
25539|  9.83M|                if (*r == '\n') {
  ------------------
  |  Branch (25539:21): [True: 20.3k, False: 9.81M]
  ------------------
25540|  20.3k|                    *w++ = *r++;
25541|  21.4k|                    for (int32_t j = 0; (r < end) && (*r != '\n') && (j < indent_col); j++, r++);
  ------------------
  |  Branch (25541:41): [True: 19.7k, False: 1.66k]
  |  Branch (25541:54): [True: 14.3k, False: 5.49k]
  |  Branch (25541:70): [True: 1.09k, False: 13.2k]
  ------------------
25542|  20.3k|                    if ((r + 1) < end && *r == '\r' && *(r + 1) == '\n') *w++ = *r++;
  ------------------
  |  Branch (25542:25): [True: 18.2k, False: 2.09k]
  |  Branch (25542:42): [True: 8.06k, False: 10.1k]
  |  Branch (25542:56): [True: 3.97k, False: 4.09k]
  ------------------
25543|  9.81M|                } else {
25544|  9.81M|                    *w++ = *r++;
25545|  9.81M|                }
25546|  9.83M|            }
25547|  12.4k|            buflen = (int32_t)(w - bufstart);
25548|  12.4k|        }
25549|       |        /* Check for leading EOL so we can remove it */
25550|  13.2k|        if (buflen > 1 && bufstart[0] == '\r' && bufstart[1] == '\n') { /* Windows EOL */
  ------------------
  |  Branch (25550:13): [True: 8.49k, False: 4.72k]
  |  Branch (25550:27): [True: 3.65k, False: 4.84k]
  |  Branch (25550:50): [True: 495, False: 3.15k]
  ------------------
25551|    495|            buflen = buflen - 2;
25552|    495|            bufstart = bufstart + 2;
25553|  12.7k|        } else if (buflen > 0 && bufstart[0] == '\n') { /* Unix EOL */
  ------------------
  |  Branch (25553:20): [True: 12.7k, False: 0]
  |  Branch (25553:34): [True: 1.27k, False: 11.4k]
  ------------------
25554|  1.27k|            buflen--;
25555|  1.27k|            bufstart++;
25556|  1.27k|        }
25557|       |        /* Check for trailing EOL so we can remove it */
25558|  13.2k|        if (buflen > 1 && bufstart[buflen - 2] == '\r' && bufstart[buflen - 1] == '\n') { /* Windows EOL */
  ------------------
  |  Branch (25558:13): [True: 7.72k, False: 5.49k]
  |  Branch (25558:27): [True: 3.47k, False: 4.25k]
  |  Branch (25558:59): [True: 285, False: 3.18k]
  ------------------
25559|    285|            buflen = buflen - 2;
25560|  12.9k|        } else if (buflen > 0 && bufstart[buflen - 1] == '\n') { /* Unix EOL */
  ------------------
  |  Branch (25560:20): [True: 12.2k, False: 658]
  |  Branch (25560:34): [True: 749, False: 11.5k]
  ------------------
25561|    749|            buflen--;
25562|    749|        }
25563|  13.2k|    }
25564|  7.74M|    if (state->flags & PFLAG_BUFFER) {
  ------------------
  |  |25299|  7.74M|#define PFLAG_BUFFER 0x200
  ------------------
  |  Branch (25564:9): [True: 3.55M, False: 4.19M]
  ------------------
25565|  3.55M|        JanetBuffer *b = janet_buffer(buflen);
25566|  3.55M|        janet_buffer_push_bytes(b, bufstart, buflen);
25567|  3.55M|        ret = janet_wrap_buffer(b);
  ------------------
  |  |  847|  3.55M|#define janet_wrap_buffer(s) janet_nanbox_wrap_((s), JANET_BUFFER)
  |  |  ------------------
  |  |  |  |  825|  3.55M|    janet_nanbox_from_pointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  3.55M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  3.55M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25568|  4.19M|    } else {
25569|  4.19M|        ret = janet_wrap_string(janet_string(bufstart, buflen));
  ------------------
  |  |  848|  4.19M|#define janet_wrap_string(s) janet_nanbox_wrap_c((s), JANET_STRING)
  |  |  ------------------
  |  |  |  |  828|  4.19M|    janet_nanbox_from_cpointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  4.19M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  4.19M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25570|  4.19M|    }
25571|  7.74M|    p->bufcount = 0;
25572|  7.74M|    popstate(p, ret);
25573|  7.74M|    return 1;
25574|  7.74M|}
janet.c:comment:
25658|   994k|static int comment(JanetParser *p, JanetParseState *state, uint8_t c) {
25659|   994k|    (void) state;
25660|   994k|    if (c == '\n') {
  ------------------
  |  Branch (25660:9): [True: 449, False: 993k]
  ------------------
25661|    449|        p->statecount--;
25662|    449|        p->bufcount = 0;
25663|   993k|    } else {
25664|   993k|        push_buf(p, c);
25665|   993k|    }
25666|   994k|    return 1;
25667|   994k|}
janet.c:atsign:
25753|  3.78M|static int atsign(JanetParser *p, JanetParseState *state, uint8_t c) {
25754|  3.78M|    (void) state;
25755|  3.78M|    p->statecount--;
25756|  3.78M|    switch (c) {
25757|   158k|        case '{':
  ------------------
  |  Branch (25757:9): [True: 158k, False: 3.62M]
  ------------------
25758|   158k|            pushstate(p, root, PFLAG_CONTAINER | PFLAG_CURLYBRACKETS | PFLAG_ATSYM);
  ------------------
  |  |25298|   158k|#define PFLAG_CONTAINER 0x100
  ------------------
                          pushstate(p, root, PFLAG_CONTAINER | PFLAG_CURLYBRACKETS | PFLAG_ATSYM);
  ------------------
  |  |25302|   158k|#define PFLAG_CURLYBRACKETS 0x1000
  ------------------
                          pushstate(p, root, PFLAG_CONTAINER | PFLAG_CURLYBRACKETS | PFLAG_ATSYM);
  ------------------
  |  |25306|   158k|#define PFLAG_ATSYM 0x10000
  ------------------
25759|   158k|            return 1;
25760|  3.55M|        case '"':
  ------------------
  |  Branch (25760:9): [True: 3.55M, False: 233k]
  ------------------
25761|  3.55M|            pushstate(p, stringchar, PFLAG_BUFFER | PFLAG_STRING);
  ------------------
  |  |25299|  3.55M|#define PFLAG_BUFFER 0x200
  ------------------
                          pushstate(p, stringchar, PFLAG_BUFFER | PFLAG_STRING);
  ------------------
  |  |25303|  3.55M|#define PFLAG_STRING 0x2000
  ------------------
25762|  3.55M|            return 1;
25763|    929|        case '`':
  ------------------
  |  Branch (25763:9): [True: 929, False: 3.78M]
  ------------------
25764|    929|            pushstate(p, longstring, PFLAG_BUFFER | PFLAG_LONGSTRING);
  ------------------
  |  |25299|    929|#define PFLAG_BUFFER 0x200
  ------------------
                          pushstate(p, longstring, PFLAG_BUFFER | PFLAG_LONGSTRING);
  ------------------
  |  |25304|    929|#define PFLAG_LONGSTRING 0x4000
  ------------------
25765|    929|            return 1;
25766|  1.11k|        case '[':
  ------------------
  |  Branch (25766:9): [True: 1.11k, False: 3.78M]
  ------------------
25767|  1.11k|            pushstate(p, root, PFLAG_CONTAINER | PFLAG_SQRBRACKETS | PFLAG_ATSYM);
  ------------------
  |  |25298|  1.11k|#define PFLAG_CONTAINER 0x100
  ------------------
                          pushstate(p, root, PFLAG_CONTAINER | PFLAG_SQRBRACKETS | PFLAG_ATSYM);
  ------------------
  |  |25301|  1.11k|#define PFLAG_SQRBRACKETS 0x800
  ------------------
                          pushstate(p, root, PFLAG_CONTAINER | PFLAG_SQRBRACKETS | PFLAG_ATSYM);
  ------------------
  |  |25306|  1.11k|#define PFLAG_ATSYM 0x10000
  ------------------
25768|  1.11k|            return 1;
25769|  67.1k|        case '(':
  ------------------
  |  Branch (25769:9): [True: 67.1k, False: 3.71M]
  ------------------
25770|  67.1k|            pushstate(p, root, PFLAG_CONTAINER | PFLAG_PARENS | PFLAG_ATSYM);
  ------------------
  |  |25298|  67.1k|#define PFLAG_CONTAINER 0x100
  ------------------
                          pushstate(p, root, PFLAG_CONTAINER | PFLAG_PARENS | PFLAG_ATSYM);
  ------------------
  |  |25300|  67.1k|#define PFLAG_PARENS 0x400
  ------------------
                          pushstate(p, root, PFLAG_CONTAINER | PFLAG_PARENS | PFLAG_ATSYM);
  ------------------
  |  |25306|  67.1k|#define PFLAG_ATSYM 0x10000
  ------------------
25771|  67.1k|            return 1;
25772|  5.71k|        default:
  ------------------
  |  Branch (25772:9): [True: 5.71k, False: 3.77M]
  ------------------
25773|  5.71k|            break;
25774|  3.78M|    }
25775|  5.71k|    pushstate(p, tokenchar, PFLAG_TOKEN);
  ------------------
  |  |25308|  5.71k|#define PFLAG_TOKEN 0x40000
  ------------------
25776|  5.71k|    push_buf(p, '@'); /* Push the leading at-sign that was dropped */
25777|  5.71k|    return 0;
25778|  3.78M|}
janet.c:longstring:
25709|  17.9M|static int longstring(JanetParser *p, JanetParseState *state, uint8_t c) {
25710|  17.9M|    if (state->flags & PFLAG_INSTRING) {
  ------------------
  |  |25707|  17.9M|#define PFLAG_INSTRING 0x100000
  ------------------
  |  Branch (25710:9): [True: 16.9M, False: 1.02M]
  ------------------
25711|       |        /* We are inside the long string */
25712|  16.9M|        if (c == '`') {
  ------------------
  |  Branch (25712:13): [True: 15.6k, False: 16.9M]
  ------------------
25713|  15.6k|            state->flags |= PFLAG_END_CANDIDATE;
  ------------------
  |  |25708|  15.6k|#define PFLAG_END_CANDIDATE 0x200000
  ------------------
25714|  15.6k|            state->flags &= ~PFLAG_INSTRING;
  ------------------
  |  |25707|  15.6k|#define PFLAG_INSTRING 0x100000
  ------------------
25715|  15.6k|            state->counter = 1; /* Use counter to keep track of number of '=' seen */
25716|  15.6k|            return 1;
25717|  15.6k|        }
25718|  16.9M|        push_buf(p, c);
25719|  16.9M|        return 1;
25720|  16.9M|    } else if (state->flags & PFLAG_END_CANDIDATE) {
  ------------------
  |  |25708|  1.02M|#define PFLAG_END_CANDIDATE 0x200000
  ------------------
  |  Branch (25720:16): [True: 543k, False: 481k]
  ------------------
25721|   543k|        int i;
25722|       |        /* We are checking a potential end of the string */
25723|   543k|        if (state->counter == state->argn) {
  ------------------
  |  Branch (25723:13): [True: 13.2k, False: 530k]
  ------------------
25724|  13.2k|            stringend(p, state);
25725|  13.2k|            return 0;
25726|  13.2k|        }
25727|   530k|        if (c == '`' && state->counter < state->argn) {
  ------------------
  |  Branch (25727:13): [True: 528k, False: 2.36k]
  |  Branch (25727:25): [True: 528k, False: 0]
  ------------------
25728|   528k|            state->counter++;
25729|   528k|            return 1;
25730|   528k|        }
25731|       |        /* Failed end candidate */
25732|   424k|        for (i = 0; i < state->counter; i++) {
  ------------------
  |  Branch (25732:21): [True: 422k, False: 2.36k]
  ------------------
25733|   422k|            push_buf(p, '`');
25734|   422k|        }
25735|  2.36k|        push_buf(p, c);
25736|  2.36k|        state->counter = 0;
25737|  2.36k|        state->flags &= ~PFLAG_END_CANDIDATE;
  ------------------
  |  |25708|  2.36k|#define PFLAG_END_CANDIDATE 0x200000
  ------------------
25738|  2.36k|        state->flags |= PFLAG_INSTRING;
  ------------------
  |  |25707|  2.36k|#define PFLAG_INSTRING 0x100000
  ------------------
25739|  2.36k|        return 1;
25740|   530k|    } else {
25741|       |        /* We are at beginning of string */
25742|   481k|        state->argn++;
25743|   481k|        if (c != '`') {
  ------------------
  |  Branch (25743:13): [True: 13.3k, False: 468k]
  ------------------
25744|  13.3k|            state->flags |= PFLAG_INSTRING;
  ------------------
  |  |25707|  13.3k|#define PFLAG_INSTRING 0x100000
  ------------------
25745|  13.3k|            push_buf(p, c);
25746|  13.3k|        }
25747|   481k|        return 1;
25748|   481k|    }
25749|  17.9M|}
janet.c:close_array:
25677|    525|static Janet close_array(JanetParser *p, JanetParseState *state) {
25678|    525|    JanetArray *array = janet_array(state->argn);
25679|   151k|    for (int32_t i = state->argn - 1; i >= 0; i--)
  ------------------
  |  Branch (25679:39): [True: 151k, False: 525]
  ------------------
25680|   151k|        array->data[i] = p->args[--p->argcount];
25681|    525|    array->count = state->argn;
25682|    525|    return janet_wrap_array(array);
  ------------------
  |  |  845|    525|#define janet_wrap_array(s) janet_nanbox_wrap_((s), JANET_ARRAY)
  |  |  ------------------
  |  |  |  |  825|    525|    janet_nanbox_from_pointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|    525|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|    525|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25683|    525|}
janet.c:close_tuple:
25669|  23.0k|static Janet close_tuple(JanetParser *p, JanetParseState *state, int32_t flag) {
25670|  23.0k|    Janet *ret = janet_tuple_begin(state->argn);
25671|  23.0k|    janet_tuple_flag(ret) |= flag;
  ------------------
  |  | 1805|  23.0k|#define janet_tuple_flag(t) (janet_tuple_head(t)->gc.flags)
  |  |  ------------------
  |  |  |  | 1799|  23.0k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
25672|   603k|    for (int32_t i = state->argn - 1; i >= 0; i--)
  ------------------
  |  Branch (25672:39): [True: 580k, False: 23.0k]
  ------------------
25673|   580k|        ret[i] = p->args[--p->argcount];
25674|  23.0k|    return janet_wrap_tuple(janet_tuple_end(ret));
  ------------------
  |  |  843|  23.0k|#define janet_wrap_tuple(s) janet_nanbox_wrap_c((s), JANET_TUPLE)
  |  |  ------------------
  |  |  |  |  828|  23.0k|    janet_nanbox_from_cpointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  23.0k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  23.0k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25675|  23.0k|}
janet.c:close_table:
25696|   156k|static Janet close_table(JanetParser *p, JanetParseState *state) {
25697|   156k|    JanetTable *table = janet_table(state->argn >> 1);
25698|  2.75M|    for (size_t i = p->argcount - state->argn; i < p->argcount; i += 2) {
  ------------------
  |  Branch (25698:48): [True: 2.59M, False: 156k]
  ------------------
25699|  2.59M|        Janet key = p->args[i];
25700|  2.59M|        Janet value = p->args[i + 1];
25701|  2.59M|        janet_table_put(table, key, value);
25702|  2.59M|    }
25703|   156k|    p->argcount -= state->argn;
25704|   156k|    return janet_wrap_table(table);
  ------------------
  |  |  846|   156k|#define janet_wrap_table(s) janet_nanbox_wrap_((s), JANET_TABLE)
  |  |  ------------------
  |  |  |  |  825|   156k|    janet_nanbox_from_pointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|   156k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|   156k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25705|   156k|}
janet.c:close_struct:
25685|  3.61M|static Janet close_struct(JanetParser *p, JanetParseState *state) {
25686|  3.61M|    JanetKV *st = janet_struct_begin(state->argn >> 1);
25687|  7.71M|    for (size_t i = p->argcount - state->argn; i < p->argcount; i += 2) {
  ------------------
  |  Branch (25687:48): [True: 4.10M, False: 3.61M]
  ------------------
25688|  4.10M|        Janet key = p->args[i];
25689|  4.10M|        Janet value = p->args[i + 1];
25690|  4.10M|        janet_struct_put(st, key, value);
25691|  4.10M|    }
25692|  3.61M|    p->argcount -= state->argn;
25693|  3.61M|    return janet_wrap_struct(janet_struct_end(st));
  ------------------
  |  |  842|  3.61M|#define janet_wrap_struct(s) janet_nanbox_wrap_c((s), JANET_STRUCT)
  |  |  ------------------
  |  |  |  |  828|  3.61M|    janet_nanbox_from_cpointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  3.61M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  3.61M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25694|  3.61M|}
janet.c:popstate:
25321|  15.6M|static void popstate(JanetParser *p, Janet val) {
25322|  19.3M|    for (;;) {
25323|  19.3M|        JanetParseState top = p->states[--p->statecount];
25324|  19.3M|        JanetParseState *newtop = p->states + p->statecount - 1;
25325|       |        /* Source mapping info */
25326|  19.3M|        if (janet_checktype(val, JANET_TUPLE)) {
  ------------------
  |  |  806|  19.3M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:5): [True: 3.66M, False: 15.6M]
  |  |  |  Branch (806:6): [Folded, False: 19.3M]
  |  |  ------------------
  |  |  807|  19.3M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  19.3M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  19.3M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  19.3M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  19.3M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  19.3M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25327|  3.66M|            janet_tuple_sm_line(janet_unwrap_tuple(val)) = (int32_t) top.line;
  ------------------
  |  | 1803|  3.66M|#define janet_tuple_sm_line(t) (janet_tuple_head(t)->sm_line)
  |  |  ------------------
  |  |  |  | 1799|  3.66M|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
25328|  3.66M|            janet_tuple_sm_column(janet_unwrap_tuple(val)) = (int32_t) top.column;
  ------------------
  |  | 1804|  3.66M|#define janet_tuple_sm_column(t) (janet_tuple_head(t)->sm_column)
  |  |  ------------------
  |  |  |  | 1799|  3.66M|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
25329|  3.66M|        }
25330|  19.3M|        if (newtop->flags & PFLAG_CONTAINER) {
  ------------------
  |  |25298|  19.3M|#define PFLAG_CONTAINER 0x100
  ------------------
  |  Branch (25330:13): [True: 15.6M, False: 3.64M]
  ------------------
25331|  15.6M|            newtop->argn++;
25332|       |            /* Keep track of number of values in the root state */
25333|  15.6M|            if (p->statecount == 1) {
  ------------------
  |  Branch (25333:17): [True: 54.5k, False: 15.6M]
  ------------------
25334|  54.5k|                p->pending++;
25335|       |                /* Root items are always wrapped in a tuple for source map info. */
25336|  54.5k|                const Janet *tup = janet_tuple_n(&val, 1);
25337|  54.5k|                janet_tuple_sm_line(tup) = (int32_t) top.line;
  ------------------
  |  | 1803|  54.5k|#define janet_tuple_sm_line(t) (janet_tuple_head(t)->sm_line)
  |  |  ------------------
  |  |  |  | 1799|  54.5k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
25338|  54.5k|                janet_tuple_sm_column(tup) = (int32_t) top.column;
  ------------------
  |  | 1804|  54.5k|#define janet_tuple_sm_column(t) (janet_tuple_head(t)->sm_column)
  |  |  ------------------
  |  |  |  | 1799|  54.5k|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
25339|  54.5k|                val = janet_wrap_tuple(tup);
  ------------------
  |  |  843|  54.5k|#define janet_wrap_tuple(s) janet_nanbox_wrap_c((s), JANET_TUPLE)
  |  |  ------------------
  |  |  |  |  828|  54.5k|    janet_nanbox_from_cpointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  54.5k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  54.5k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25340|  54.5k|            }
25341|  15.6M|            push_arg(p, val);
25342|  15.6M|            return;
25343|  15.6M|        } else if (newtop->flags & PFLAG_READERMAC) {
  ------------------
  |  |25305|  3.64M|#define PFLAG_READERMAC 0x8000
  ------------------
  |  Branch (25343:20): [True: 3.64M, False: 0]
  ------------------
25344|  3.64M|            Janet *t = janet_tuple_begin(2);
25345|  3.64M|            int c = newtop->flags & 0xFF;
25346|  3.64M|            const char *which =
25347|  3.64M|                (c == '\'') ? "quote" :
  ------------------
  |  Branch (25347:17): [True: 20.4k, False: 3.62M]
  ------------------
25348|  3.64M|                (c == ',') ? "unquote" :
  ------------------
  |  Branch (25348:17): [True: 462k, False: 3.15M]
  ------------------
25349|  3.62M|                (c == ';') ? "splice" :
  ------------------
  |  Branch (25349:17): [True: 3.13M, False: 20.2k]
  ------------------
25350|  3.15M|                (c == '|') ? "short-fn" :
  ------------------
  |  Branch (25350:17): [True: 2.01k, False: 18.1k]
  ------------------
25351|  20.2k|                (c == '~') ? "quasiquote" : "<unknown>";
  ------------------
  |  Branch (25351:17): [True: 18.1k, False: 0]
  ------------------
25352|  3.64M|            t[0] = janet_csymbolv(which);
  ------------------
  |  | 1836|  3.64M|#define janet_csymbolv(cstr) janet_wrap_symbol(janet_csymbol(cstr))
  |  |  ------------------
  |  |  |  |  849|  3.64M|#define janet_wrap_symbol(s) janet_nanbox_wrap_c((s), JANET_SYMBOL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  828|  3.64M|    janet_nanbox_from_cpointer((p), janet_nanbox_tag(t))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  793|  3.64M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|  3.64M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25353|  3.64M|            t[1] = val;
25354|       |            /* Quote source mapping info */
25355|  3.64M|            janet_tuple_sm_line(t) = (int32_t) newtop->line;
  ------------------
  |  | 1803|  3.64M|#define janet_tuple_sm_line(t) (janet_tuple_head(t)->sm_line)
  |  |  ------------------
  |  |  |  | 1799|  3.64M|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
25356|  3.64M|            janet_tuple_sm_column(t) = (int32_t) newtop->column;
  ------------------
  |  | 1804|  3.64M|#define janet_tuple_sm_column(t) (janet_tuple_head(t)->sm_column)
  |  |  ------------------
  |  |  |  | 1799|  3.64M|#define janet_tuple_head(t) ((JanetTupleHead *)((char *)t - offsetof(JanetTupleHead, data)))
  |  |  ------------------
  ------------------
25357|  3.64M|            val = janet_wrap_tuple(janet_tuple_end(t));
  ------------------
  |  |  843|  3.64M|#define janet_wrap_tuple(s) janet_nanbox_wrap_c((s), JANET_TUPLE)
  |  |  ------------------
  |  |  |  |  828|  3.64M|    janet_nanbox_from_cpointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  3.64M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  3.64M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25358|  3.64M|        } else {
25359|      0|            return;
25360|      0|        }
25361|  19.3M|    }
25362|  15.6M|}
janet.c:tokenchar:
25605|  23.7M|static int tokenchar(JanetParser *p, JanetParseState *state, uint8_t c) {
25606|  23.7M|    Janet ret;
25607|  23.7M|    double numval;
25608|  23.7M|    int32_t blen;
25609|  23.7M|    if (janet_is_symbol_char(c)) {
  ------------------
  |  Branch (25609:9): [True: 19.5M, False: 4.14M]
  ------------------
25610|  19.5M|        push_buf(p, (uint8_t) c);
25611|  19.5M|        if (c > 127) state->argn = 1; /* Use to indicate non ascii */
  ------------------
  |  Branch (25611:13): [True: 140k, False: 19.4M]
  ------------------
25612|  19.5M|        return 1;
25613|  19.5M|    }
25614|       |    /* Token finished */
25615|  4.14M|    blen = (int32_t) p->bufcount;
25616|  4.14M|    int start_dig = p->buf[0] >= '0' && p->buf[0] <= '9';
  ------------------
  |  Branch (25616:21): [True: 3.84M, False: 303k]
  |  Branch (25616:41): [True: 72.2k, False: 3.77M]
  ------------------
25617|  4.14M|    int start_num = start_dig || p->buf[0] == '-' || p->buf[0] == '+' || p->buf[0] == '.';
  ------------------
  |  Branch (25617:21): [True: 72.2k, False: 4.07M]
  |  Branch (25617:34): [True: 255k, False: 3.82M]
  |  Branch (25617:54): [True: 5.20k, False: 3.81M]
  |  Branch (25617:74): [True: 12.4k, False: 3.80M]
  ------------------
25618|  4.14M|    if (p->buf[0] == ':') {
  ------------------
  |  Branch (25618:9): [True: 8.58k, False: 4.13M]
  ------------------
25619|       |        /* Don't do full utf-8 check unless we have seen non ascii characters. */
25620|  8.58k|        int valid = (!state->argn) || janet_valid_utf8(p->buf + 1, blen - 1);
  ------------------
  |  Branch (25620:21): [True: 8.25k, False: 328]
  |  Branch (25620:39): [True: 270, False: 58]
  ------------------
25621|  8.58k|        if (!valid) {
  ------------------
  |  Branch (25621:13): [True: 58, False: 8.52k]
  ------------------
25622|     58|            p->error = "invalid utf-8 in keyword";
25623|     58|            return 0;
25624|     58|        }
25625|  8.52k|        ret = janet_keywordv(p->buf + 1, blen - 1);
  ------------------
  |  | 1841|  8.52k|#define janet_keywordv(str, len) janet_wrap_keyword(janet_keyword((str), (len)))
  |  |  ------------------
  |  |  |  |  850|  8.52k|#define janet_wrap_keyword(s) janet_nanbox_wrap_c((s), JANET_KEYWORD)
  |  |  |  |  ------------------
  |  |  |  |  |  |  828|  8.52k|    janet_nanbox_from_cpointer((p), janet_nanbox_tag(t))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  793|  8.52k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|  8.52k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25626|  8.52k|#ifdef JANET_INT_TYPES
25627|  4.13M|    } else if (start_num && !janet_scan_numeric(p->buf, blen, &ret)) {
  ------------------
  |  Branch (25627:16): [True: 344k, False: 3.79M]
  |  Branch (25627:29): [True: 169k, False: 175k]
  ------------------
25628|   169k|        (void) numval;
25629|       |#else
25630|       |    } else if (start_num && !janet_scan_number(p->buf, blen, &numval)) {
25631|       |        ret = janet_wrap_number(numval);
25632|       |#endif
25633|  3.97M|    } else if (!check_str_const("nil", p->buf, blen)) {
  ------------------
  |  Branch (25633:16): [True: 21.3k, False: 3.94M]
  ------------------
25634|  21.3k|        ret = janet_wrap_nil();
  ------------------
  |  |  831|  21.3k|#define janet_wrap_nil() janet_nanbox_from_payload(JANET_NIL, 1)
  |  |  ------------------
  |  |  |  |  822|  21.3k|    janet_nanbox_from_bits(janet_nanbox_tag(t) | (p))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  21.3k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  21.3k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25635|  3.94M|    } else if (!check_str_const("false", p->buf, blen)) {
  ------------------
  |  Branch (25635:16): [True: 1.05k, False: 3.94M]
  ------------------
25636|  1.05k|        ret = janet_wrap_false();
  ------------------
  |  |  833|  1.05k|#define janet_wrap_false() janet_nanbox_from_payload(JANET_BOOLEAN, 0)
  |  |  ------------------
  |  |  |  |  822|  1.05k|    janet_nanbox_from_bits(janet_nanbox_tag(t) | (p))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  1.05k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  1.05k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25637|  3.94M|    } else if (!check_str_const("true", p->buf, blen)) {
  ------------------
  |  Branch (25637:16): [True: 4.57k, False: 3.94M]
  ------------------
25638|  4.57k|        ret = janet_wrap_true();
  ------------------
  |  |  832|  4.57k|#define janet_wrap_true() janet_nanbox_from_payload(JANET_BOOLEAN, 1)
  |  |  ------------------
  |  |  |  |  822|  4.57k|    janet_nanbox_from_bits(janet_nanbox_tag(t) | (p))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  4.57k|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  4.57k|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25639|  3.94M|    } else {
25640|  3.94M|        if (start_dig) {
  ------------------
  |  Branch (25640:13): [True: 455, False: 3.94M]
  ------------------
25641|    455|            p->error = "symbol literal cannot start with a digit";
25642|    455|            return 0;
25643|  3.94M|        } else {
25644|       |            /* Don't do full utf-8 check unless we have seen non ascii characters. */
25645|  3.94M|            int valid = (!state->argn) || janet_valid_utf8(p->buf, blen);
  ------------------
  |  Branch (25645:25): [True: 3.93M, False: 3.30k]
  |  Branch (25645:43): [True: 3.11k, False: 188]
  ------------------
25646|  3.94M|            if (!valid) {
  ------------------
  |  Branch (25646:17): [True: 188, False: 3.94M]
  ------------------
25647|    188|                p->error = "invalid utf-8 in symbol";
25648|    188|                return 0;
25649|    188|            }
25650|  3.94M|            ret = janet_symbolv(p->buf, blen);
  ------------------
  |  | 1835|  3.94M|#define janet_symbolv(str, len) janet_wrap_symbol(janet_symbol((str), (len)))
  |  |  ------------------
  |  |  |  |  849|  3.94M|#define janet_wrap_symbol(s) janet_nanbox_wrap_c((s), JANET_SYMBOL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  828|  3.94M|    janet_nanbox_from_cpointer((p), janet_nanbox_tag(t))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  793|  3.94M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|  3.94M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
25651|  3.94M|        }
25652|  3.94M|    }
25653|  4.14M|    p->bufcount = 0;
25654|  4.14M|    popstate(p, ret);
25655|  4.14M|    return 0;
25656|  4.14M|}
janet.c:check_str_const:
25593|  11.8M|static int check_str_const(const char *cstr, const uint8_t *str, int32_t len) {
25594|  11.8M|    int32_t index;
25595|  12.0M|    for (index = 0; index < len; index++) {
  ------------------
  |  Branch (25595:21): [True: 11.9M, False: 41.8k]
  ------------------
25596|  11.9M|        uint8_t c = str[index];
25597|  11.9M|        uint8_t k = ((const uint8_t *)cstr)[index];
25598|  11.9M|        if (c < k) return -1;
  ------------------
  |  Branch (25598:13): [True: 10.8M, False: 1.12M]
  ------------------
25599|  1.12M|        if (c > k) return 1;
  ------------------
  |  Branch (25599:13): [True: 980k, False: 140k]
  ------------------
25600|   140k|        if (k == '\0') break;
  ------------------
  |  Branch (25600:13): [True: 0, False: 140k]
  ------------------
25601|   140k|    }
25602|  41.8k|    return (cstr[index] == '\0') ? 0 : -1;
  ------------------
  |  Branch (25602:12): [True: 26.9k, False: 14.8k]
  ------------------
25603|  11.8M|}
janet.c:scanformat:
29533|    142|    char precision[3]) {
29534|    142|    const char *p = strfrmt;
29535|       |
29536|       |    /* Parse strfrmt */
29537|    142|    memset(width, '\0', 3);
29538|    142|    memset(precision, '\0', 3);
29539|    142|    while (*p != '\0' && strchr(FMT_FLAGS, *p) != NULL)
  ------------------
  |  |29499|    142|#define FMT_FLAGS "-+ #0"
  ------------------
  |  Branch (29539:12): [True: 142, False: 0]
  |  Branch (29539:26): [True: 0, False: 142]
  ------------------
29540|      0|        p++; /* skip flags */
29541|    142|    if ((size_t)(p - strfrmt) >= sizeof(FMT_FLAGS)) janet_panic("invalid format (repeated flags)");
  ------------------
  |  |29499|    142|#define FMT_FLAGS "-+ #0"
  ------------------
  |  Branch (29541:9): [True: 0, False: 142]
  ------------------
29542|    142|    if (isdigit((int)(*p)))
  ------------------
  |  Branch (29542:9): [True: 0, False: 142]
  ------------------
29543|      0|        width[0] = *p++; /* skip width */
29544|    142|    if (isdigit((int)(*p)))
  ------------------
  |  Branch (29544:9): [True: 0, False: 142]
  ------------------
29545|      0|        width[1] = *p++; /* (2 digits at most) */
29546|    142|    if (*p == '.') {
  ------------------
  |  Branch (29546:9): [True: 0, False: 142]
  ------------------
29547|      0|        p++;
29548|      0|        if (isdigit((int)(*p)))
  ------------------
  |  Branch (29548:13): [True: 0, False: 0]
  ------------------
29549|      0|            precision[0] = *p++; /* skip precision */
29550|      0|        if (isdigit((int)(*p)))
  ------------------
  |  Branch (29550:13): [True: 0, False: 0]
  ------------------
29551|      0|            precision[1] = *p++; /* (2 digits at most) */
29552|      0|    }
29553|    142|    if (isdigit((int)(*p)))
  ------------------
  |  Branch (29553:9): [True: 0, False: 142]
  ------------------
29554|      0|        janet_panic("invalid format (width or precision too long)");
29555|       |
29556|       |    /* Write to form - replace characters with fixed size stuff */
29557|    142|    *(form++) = '%';
29558|    142|    const char *p2 = strfrmt;
29559|    284|    while (p2 <= p) {
  ------------------
  |  Branch (29559:12): [True: 142, False: 142]
  ------------------
29560|    142|        char *loc = strchr(FMT_REPLACE_INTTYPES, *p2);
  ------------------
  |  |29500|    142|#define FMT_REPLACE_INTTYPES "diouxX"
  ------------------
29561|    142|        if (loc != NULL && *loc != '\0') {
  ------------------
  |  Branch (29561:13): [True: 142, False: 0]
  |  Branch (29561:28): [True: 142, False: 0]
  ------------------
29562|    142|            const char *mapping = get_fmt_mapping(*p2++);
29563|    142|            size_t len = strlen(mapping);
29564|    142|            memcpy(form, mapping, len);
29565|    142|            form += len;
29566|    142|        } else {
29567|      0|            *(form++) = *(p2++);
29568|      0|        }
29569|    142|    }
29570|    142|    *form = '\0';
29571|       |
29572|    142|    return p;
29573|    142|}
janet.c:get_fmt_mapping:
29521|    142|static const char *get_fmt_mapping(char c) {
29522|    426|    for (size_t i = 0; i < (sizeof(format_mappings) / sizeof(struct FmtMapping)); i++) {
  ------------------
  |  Branch (29522:24): [True: 426, False: 0]
  ------------------
29523|    426|        if (format_mappings[i].c == c)
  ------------------
  |  Branch (29523:13): [True: 142, False: 284]
  ------------------
29524|    142|            return format_mappings[i].mapping;
29525|    426|    }
29526|      0|    janet_assert(0, "bad format mapping");
  ------------------
  |  |  389|      0|#define janet_assert(c, m) do { \
  |  |  390|      0|    if (!(c)) JANET_EXIT((m)); \
  |  |  ------------------
  |  |  |  |  378|      0|#define JANET_EXIT(m) do { \
  |  |  |  |  379|      0|    fprintf(stderr, "janet abort at %s:%d: %s\n",\
  |  |  |  |  380|      0|        __FILE__,\
  |  |  |  |  381|      0|        __LINE__,\
  |  |  |  |  382|      0|        (m));\
  |  |  |  |  383|      0|    abort();\
  |  |  |  |  384|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:10): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (390:9): [True: 0, Folded]
  |  |  ------------------
  |  |  391|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (391:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
29527|      0|}
janet.c:bignat_zero:
32308|   199k|static void bignat_zero(struct BigNat *x) {
32309|   199k|    x->first_digit = 0;
32310|   199k|    x->n = 0;
32311|   199k|    x->cap = 0;
32312|       |    x->digits = NULL;
32313|   199k|}
janet.c:bignat_muladd:
32340|   900k|static void bignat_muladd(struct BigNat *mant, uint32_t factor, uint32_t term) {
32341|   900k|    int32_t i;
32342|   900k|    uint64_t carry = ((uint64_t) mant->first_digit) * factor + term;
32343|   900k|    mant->first_digit = carry % BIGNAT_BASE;
  ------------------
  |  |32297|   900k|#define BIGNAT_BASE 0x80000000U
  ------------------
32344|   900k|    carry /= BIGNAT_BASE;
  ------------------
  |  |32297|   900k|#define BIGNAT_BASE 0x80000000U
  ------------------
32345|   735M|    for (i = 0; i < mant->n; i++) {
  ------------------
  |  Branch (32345:17): [True: 734M, False: 900k]
  ------------------
32346|   734M|        carry += ((uint64_t) mant->digits[i]) * factor;
32347|   734M|        mant->digits[i] = carry % BIGNAT_BASE;
  ------------------
  |  |32297|   734M|#define BIGNAT_BASE 0x80000000U
  ------------------
32348|   734M|        carry /= BIGNAT_BASE;
  ------------------
  |  |32297|   734M|#define BIGNAT_BASE 0x80000000U
  ------------------
32349|   734M|    }
32350|   900k|    if (carry) bignat_append(mant, (uint32_t) carry);
  ------------------
  |  Branch (32350:9): [True: 133k, False: 766k]
  ------------------
32351|   900k|}
janet.c:bignat_append:
32333|   133k|static void bignat_append(struct BigNat *mant, uint32_t dig) {
32334|   133k|    bignat_extra(mant, 1)[0] = dig;
32335|   133k|}
janet.c:bignat_extra:
32316|   137k|static uint32_t *bignat_extra(struct BigNat *mant, int32_t n) {
32317|   137k|    int32_t oldn = mant->n;
32318|   137k|    int32_t newn = oldn + n;
32319|   137k|    if (mant->cap < newn) {
  ------------------
  |  Branch (32319:9): [True: 23.6k, False: 113k]
  ------------------
32320|  23.6k|        int32_t newcap = 2 * newn;
32321|  23.6k|        uint32_t *mem = janet_realloc(mant->digits, (size_t) newcap * sizeof(uint32_t));
  ------------------
  |  | 2409|  23.6k|#define janet_realloc(X, Y) realloc((X), (Y))
  ------------------
32322|  23.6k|        if (NULL == mem) {
  ------------------
  |  Branch (32322:13): [True: 0, False: 23.6k]
  ------------------
32323|      0|            JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
32324|      0|        }
32325|  23.6k|        mant->cap = newcap;
32326|  23.6k|        mant->digits = mem;
32327|  23.6k|    }
32328|   137k|    mant->n = newn;
32329|   137k|    return mant->digits + oldn;
32330|   137k|}
janet.c:convert:
32436|  72.6k|    int32_t exponent) {
32437|       |
32438|  72.6k|    int32_t exponent2 = 0;
32439|       |
32440|       |    /* Approximate exponent in base 2 of mant and exponent. This should get us a good estimate of the final size of the
32441|       |     * number, within * 2^32 or so. */
32442|  72.6k|    int64_t mant_exp2_approx = mant->n * 32 + 16;
32443|  72.6k|    int64_t exp_exp2_approx = (int64_t)(floor(log2(base) * exponent));
32444|  72.6k|    int64_t exp2_approx = mant_exp2_approx + exp_exp2_approx;
32445|       |
32446|       |    /* Short circuit zero, huge, and small numbers. We use the exponent range of valid IEEE754 doubles (-1022, 1023)
32447|       |     * with a healthy buffer to allow for inaccuracies in the approximation and denormailzed numbers. */
32448|  72.6k|    if (mant->n == 0 && mant->first_digit == 0)
  ------------------
  |  Branch (32448:9): [True: 65.0k, False: 7.57k]
  |  Branch (32448:25): [True: 19.9k, False: 45.1k]
  ------------------
32449|  19.9k|        return negative ? -0.0 : 0.0;
  ------------------
  |  Branch (32449:16): [True: 725, False: 19.1k]
  ------------------
32450|  52.6k|    if (exp2_approx > 1176)
  ------------------
  |  Branch (32450:9): [True: 500, False: 52.1k]
  ------------------
32451|    500|        return negative ? -INFINITY : INFINITY;
  ------------------
  |  Branch (32451:16): [True: 28, False: 472]
  ------------------
32452|  52.1k|    if (exp2_approx < -1175)
  ------------------
  |  Branch (32452:9): [True: 625, False: 51.5k]
  ------------------
32453|    625|        return negative ? -0.0 : 0.0;
  ------------------
  |  Branch (32453:16): [True: 366, False: 259]
  ------------------
32454|       |
32455|       |    /* Final value is X = mant * base ^ exponent * 2 ^ exponent2
32456|       |     * Get exponent to zero while holding X constant. */
32457|       |
32458|       |    /* Positive exponents are simple */
32459|   160k|    for (; exponent > 3; exponent -= 4) bignat_muladd(mant, base * base * base * base, 0);
  ------------------
  |  Branch (32459:12): [True: 109k, False: 51.5k]
  ------------------
32460|  55.8k|    for (; exponent > 1; exponent -= 2) bignat_muladd(mant, base * base, 0);
  ------------------
  |  Branch (32460:12): [True: 4.32k, False: 51.5k]
  ------------------
32461|  54.4k|    for (; exponent > 0; exponent -= 1) bignat_muladd(mant, base, 0);
  ------------------
  |  Branch (32461:12): [True: 2.88k, False: 51.5k]
  ------------------
32462|       |
32463|       |    /* Negative exponents are tricky - we don't want to loose bits
32464|       |     * from integer division, so we need to premultiply. */
32465|  51.5k|    if (exponent < 0) {
  ------------------
  |  Branch (32465:9): [True: 3.40k, False: 48.1k]
  ------------------
32466|  3.40k|        int32_t shamt = 5 - exponent / 4;
32467|  3.40k|        bignat_lshift_n(mant, shamt);
32468|  3.40k|        exponent2 -= shamt * BIGNAT_NBIT;
  ------------------
  |  |32296|  3.40k|#define BIGNAT_NBIT 31
  ------------------
32469|   334k|        for (; exponent < -3; exponent += 4) bignat_div(mant, base * base * base * base);
  ------------------
  |  Branch (32469:16): [True: 330k, False: 3.40k]
  ------------------
32470|  4.12k|        for (; exponent < -1; exponent += 2) bignat_div(mant, base * base);
  ------------------
  |  Branch (32470:16): [True: 723, False: 3.40k]
  ------------------
32471|  6.24k|        for (; exponent <  0; exponent += 1) bignat_div(mant, base);
  ------------------
  |  Branch (32471:16): [True: 2.84k, False: 3.40k]
  ------------------
32472|  3.40k|    }
32473|       |
32474|  51.5k|    return negative
  ------------------
  |  Branch (32474:12): [True: 29.5k, False: 21.9k]
  ------------------
32475|  51.5k|           ? -bignat_extract(mant, exponent2)
32476|  51.5k|           : bignat_extract(mant, exponent2);
32477|  52.1k|}
janet.c:bignat_lshift_n:
32372|  3.40k|static void bignat_lshift_n(struct BigNat *mant, int n) {
32373|  3.40k|    if (!n) return;
  ------------------
  |  Branch (32373:9): [True: 0, False: 3.40k]
  ------------------
32374|  3.40k|    int32_t oldn = mant->n;
32375|  3.40k|    bignat_extra(mant, n);
32376|  3.40k|    memmove(mant->digits + n, mant->digits, sizeof(uint32_t) * oldn);
32377|  3.40k|    memset(mant->digits, 0, sizeof(uint32_t) * (n - 1));
32378|  3.40k|    mant->digits[n - 1] = mant->first_digit;
32379|  3.40k|    mant->first_digit = 0;
32380|  3.40k|}
janet.c:bignat_div:
32354|   334k|static void bignat_div(struct BigNat *mant, uint32_t divisor) {
32355|   334k|    int32_t i;
32356|   334k|    uint32_t quotient, remainder;
32357|   334k|    uint64_t dividend;
32358|   334k|    remainder = 0, quotient = 0;
32359|  3.36G|    for (i = mant->n - 1; i >= 0; i--) {
  ------------------
  |  Branch (32359:27): [True: 3.36G, False: 334k]
  ------------------
32360|  3.36G|        dividend = ((uint64_t)remainder * BIGNAT_BASE) + mant->digits[i];
  ------------------
  |  |32297|  3.36G|#define BIGNAT_BASE 0x80000000U
  ------------------
32361|  3.36G|        if (i < mant->n - 1) mant->digits[i + 1] = quotient;
  ------------------
  |  Branch (32361:13): [True: 3.36G, False: 334k]
  ------------------
32362|  3.36G|        quotient = (uint32_t)(dividend / divisor);
32363|  3.36G|        remainder = (uint32_t)(dividend % divisor);
32364|  3.36G|        mant->digits[i] = remainder;
32365|  3.36G|    }
32366|   334k|    dividend = ((uint64_t)remainder * BIGNAT_BASE) + mant->first_digit;
  ------------------
  |  |32297|   334k|#define BIGNAT_BASE 0x80000000U
  ------------------
32367|   334k|    if (mant->n && mant->digits[mant->n - 1] == 0) mant->n--;
  ------------------
  |  Branch (32367:9): [True: 334k, False: 0]
  |  Branch (32367:20): [True: 49.0k, False: 285k]
  ------------------
32368|   334k|    mant->first_digit = (uint32_t)(dividend / divisor);
32369|   334k|}
janet.c:bignat_extract:
32397|  51.5k|static double bignat_extract(struct BigNat *mant, int32_t exponent2) {
32398|  51.5k|    uint64_t top53;
32399|  51.5k|    int32_t n = mant->n;
32400|       |    /* Get most significant 53 bits from mant. Bit 52 (0 indexed) should
32401|       |     * always be 1. This is essentially a large right shift on mant.*/
32402|  51.5k|    if (n) {
  ------------------
  |  Branch (32402:9): [True: 14.8k, False: 36.7k]
  ------------------
32403|       |        /* Two or more digits */
32404|  14.8k|        uint64_t d1 = mant->digits[n - 1]; /* MSD (non-zero) */
32405|  14.8k|        uint64_t d2 = (n == 1) ? mant->first_digit : mant->digits[n - 2];
  ------------------
  |  Branch (32405:23): [True: 7.63k, False: 7.16k]
  ------------------
32406|  14.8k|        uint64_t d3 = (n > 2) ? mant->digits[n - 3] : (n == 2) ? mant->first_digit : 0;
  ------------------
  |  Branch (32406:23): [True: 5.02k, False: 9.77k]
  |  Branch (32406:55): [True: 2.13k, False: 7.63k]
  ------------------
32407|  14.8k|        int lz = clz((uint32_t) d1);
  ------------------
  |  |32383|  14.8k|#define clz(x) __builtin_clz(x)
  ------------------
32408|  14.8k|        int nbits = 32 - lz;
32409|       |        /* First get 54 bits */
32410|  14.8k|        top53 = (d2 << (54 - BIGNAT_NBIT)) + (d3 >> (2 * BIGNAT_NBIT - 54));
  ------------------
  |  |32296|  14.8k|#define BIGNAT_NBIT 31
  ------------------
                      top53 = (d2 << (54 - BIGNAT_NBIT)) + (d3 >> (2 * BIGNAT_NBIT - 54));
  ------------------
  |  |32296|  14.8k|#define BIGNAT_NBIT 31
  ------------------
32411|  14.8k|        top53 >>= nbits;
32412|  14.8k|        top53 |= (d1 << (54 - nbits));
32413|       |        /* Rounding based on lowest bit of 54 */
32414|  14.8k|        if (top53 & 1) top53++;
  ------------------
  |  Branch (32414:13): [True: 7.64k, False: 7.15k]
  ------------------
32415|  14.8k|        top53 >>= 1;
32416|  14.8k|        if (top53 > 0x1FffffFFFFffffUL) {
  ------------------
  |  Branch (32416:13): [True: 4.35k, False: 10.4k]
  ------------------
32417|  4.35k|            top53 >>= 1;
32418|  4.35k|            exponent2++;
32419|  4.35k|        }
32420|       |        /* Correct exponent - to correct for large right shift to mantissa. */
32421|  14.8k|        exponent2 += (nbits - 53) + BIGNAT_NBIT * n;
  ------------------
  |  |32296|  14.8k|#define BIGNAT_NBIT 31
  ------------------
32422|  36.7k|    } else {
32423|       |        /* One digit */
32424|  36.7k|        top53 = mant->first_digit;
32425|  36.7k|    }
32426|  51.5k|    return ldexp((double)top53, exponent2);
32427|  51.5k|}
janet.c:scan_uint64:
32637|   140k|    int *neg) {
32638|   140k|    const uint8_t *end = str + len;
32639|   140k|    int seenadigit = 0;
32640|   140k|    int base = 10;
32641|   140k|    *neg = 0;
32642|   140k|    *out = 0;
32643|   140k|    uint64_t accum = 0;
32644|   140k|    if (len > JANET_NUMBER_LENGTH_RIDICULOUS) return 0;
  ------------------
  |  |32281|   140k|#define JANET_NUMBER_LENGTH_RIDICULOUS 0xFFFF
  ------------------
  |  Branch (32644:9): [True: 25, False: 140k]
  ------------------
32645|       |    /* Get sign */
32646|   140k|    if (str >= end) return 0;
  ------------------
  |  Branch (32646:9): [True: 0, False: 140k]
  ------------------
32647|   140k|    if (*str == '-') {
  ------------------
  |  Branch (32647:9): [True: 103k, False: 37.6k]
  ------------------
32648|   103k|        *neg = 1;
32649|   103k|        str++;
32650|   103k|    } else if (*str == '+') {
  ------------------
  |  Branch (32650:16): [True: 1.66k, False: 35.9k]
  ------------------
32651|  1.66k|        str++;
32652|  1.66k|    }
32653|       |    /* Check for leading 0x or digit digit r */
32654|   140k|    if (str + 1 < end && str[0] == '0' && str[1] == 'x') {
  ------------------
  |  Branch (32654:9): [True: 114k, False: 26.1k]
  |  Branch (32654:26): [True: 14.8k, False: 99.7k]
  |  Branch (32654:43): [True: 241, False: 14.6k]
  ------------------
32655|    241|        base = 16;
32656|    241|        str += 2;
32657|   140k|    } else if (str + 1 < end  &&
  ------------------
  |  Branch (32657:16): [True: 114k, False: 26.1k]
  ------------------
32658|   114k|               str[0] >= '0' && str[0] <= '9' &&
  ------------------
  |  Branch (32658:16): [True: 102k, False: 11.9k]
  |  Branch (32658:33): [True: 101k, False: 822]
  ------------------
32659|   101k|               str[1] == 'r') {
  ------------------
  |  Branch (32659:16): [True: 1.21k, False: 100k]
  ------------------
32660|  1.21k|        base = str[0] - '0';
32661|  1.21k|        str += 2;
32662|   139k|    } else if (str + 2 < end  &&
  ------------------
  |  Branch (32662:16): [True: 98.8k, False: 40.4k]
  ------------------
32663|  98.8k|               str[0] >= '0' && str[0] <= '9' &&
  ------------------
  |  Branch (32663:16): [True: 88.4k, False: 10.3k]
  |  Branch (32663:33): [True: 87.8k, False: 548]
  ------------------
32664|  87.8k|               str[1] >= '0' && str[1] <= '9' &&
  ------------------
  |  Branch (32664:16): [True: 87.6k, False: 277]
  |  Branch (32664:33): [True: 85.4k, False: 2.12k]
  ------------------
32665|  85.4k|               str[2] == 'r') {
  ------------------
  |  Branch (32665:16): [True: 44.7k, False: 40.7k]
  ------------------
32666|  44.7k|        base = 10 * (str[0] - '0') + (str[1] - '0');
32667|  44.7k|        if (base < 2 || base > 36) return 0;
  ------------------
  |  Branch (32667:13): [True: 195, False: 44.5k]
  |  Branch (32667:25): [True: 429, False: 44.1k]
  ------------------
32668|  44.1k|        str += 3;
32669|  44.1k|    }
32670|       |
32671|       |    /* Skip leading zeros */
32672|   173k|    while (str < end && *str == '0') {
  ------------------
  |  Branch (32672:12): [True: 159k, False: 13.9k]
  |  Branch (32672:25): [True: 33.5k, False: 126k]
  ------------------
32673|  33.5k|        seenadigit = 1;
32674|  33.5k|        str++;
32675|  33.5k|    }
32676|       |    /* Parse significant digits */
32677|   733k|    while (str < end) {
  ------------------
  |  Branch (32677:12): [True: 632k, False: 101k]
  ------------------
32678|   632k|        if (*str == '_') {
  ------------------
  |  Branch (32678:13): [True: 1.07k, False: 631k]
  ------------------
32679|  1.07k|            if (!seenadigit) return 0;
  ------------------
  |  Branch (32679:17): [True: 263, False: 807]
  ------------------
32680|   631k|        } else {
32681|   631k|            int digit = digit_lookup[*str & 0x7F];
32682|   631k|            if (*str > 127 || digit >= base) return 0;
  ------------------
  |  Branch (32682:17): [True: 293, False: 631k]
  |  Branch (32682:31): [True: 37.5k, False: 593k]
  ------------------
32683|   593k|            if (accum > (UINT64_MAX - digit) / base) return 0;
  ------------------
  |  Branch (32683:17): [True: 898, False: 592k]
  ------------------
32684|   592k|            accum = accum * base + digit;
32685|   592k|            seenadigit = 1;
32686|   592k|        }
32687|   593k|        str++;
32688|   593k|    }
32689|       |
32690|   101k|    if (!seenadigit) return 0;
  ------------------
  |  Branch (32690:9): [True: 1.87k, False: 99.2k]
  ------------------
32691|  99.2k|    *out = accum;
32692|  99.2k|    return 1;
32693|   101k|}
janet.c:janet_symcache_findmem:
33175|  7.64M|    int *success) {
33176|  7.64M|    uint32_t bounds[4];
33177|  7.64M|    uint32_t i, j, index;
33178|  7.64M|    const uint8_t **firstEmpty = NULL;
33179|       |
33180|       |    /* We will search two ranges - index to the end,
33181|       |     * and 0 to the index. */
33182|  7.64M|    index = (uint32_t)hash & (janet_vm.cache_capacity - 1);
33183|  7.64M|    bounds[0] = index;
33184|  7.64M|    bounds[1] = janet_vm.cache_capacity;
33185|  7.64M|    bounds[2] = 0;
33186|  7.64M|    bounds[3] = index;
33187|  7.65M|    for (j = 0; j < 4; j += 2)
  ------------------
  |  Branch (33187:17): [True: 7.65M, False: 0]
  ------------------
33188|  8.51M|        for (i = bounds[j]; i < bounds[j + 1]; ++i) {
  ------------------
  |  Branch (33188:29): [True: 8.51M, False: 892]
  ------------------
33189|  8.51M|            const uint8_t *test = janet_vm.cache[i];
33190|       |            /* Check empty spots */
33191|  8.51M|            if (NULL == test) {
  ------------------
  |  Branch (33191:17): [True: 56.0k, False: 8.45M]
  ------------------
33192|  56.0k|                if (NULL == firstEmpty)
  ------------------
  |  Branch (33192:21): [True: 56.0k, False: 0]
  ------------------
33193|  56.0k|                    firstEmpty = janet_vm.cache + i;
33194|  56.0k|                goto notfound;
33195|  56.0k|            }
33196|       |            /* Check for marked deleted */
33197|  8.45M|            if (JANET_SYMCACHE_DELETED == test) {
  ------------------
  |  Branch (33197:17): [True: 328, False: 8.45M]
  ------------------
33198|    328|                if (firstEmpty == NULL)
  ------------------
  |  Branch (33198:21): [True: 56, False: 272]
  ------------------
33199|     56|                    firstEmpty = janet_vm.cache + i;
33200|    328|                continue;
33201|    328|            }
33202|  8.45M|            if (janet_string_equalconst(test, str, len, hash)) {
  ------------------
  |  Branch (33202:17): [True: 7.59M, False: 865k]
  ------------------
33203|       |                /* Replace first deleted */
33204|  7.59M|                *success = 1;
33205|  7.59M|                if (firstEmpty != NULL) {
  ------------------
  |  Branch (33205:21): [True: 56, False: 7.59M]
  ------------------
33206|     56|                    *firstEmpty = test;
33207|     56|                    janet_vm.cache[i] = JANET_SYMCACHE_DELETED;
33208|     56|                    return firstEmpty;
33209|     56|                }
33210|  7.59M|                return janet_vm.cache + i;
33211|  7.59M|            }
33212|  8.45M|        }
33213|  56.0k|notfound:
33214|  56.0k|    *success = 0;
33215|  56.0k|    janet_assert(firstEmpty != NULL, "symcache failed to get memory");
  ------------------
  |  |  389|  56.0k|#define janet_assert(c, m) do { \
  |  |  390|  56.0k|    if (!(c)) JANET_EXIT((m)); \
  |  |  ------------------
  |  |  |  |  378|      0|#define JANET_EXIT(m) do { \
  |  |  |  |  379|      0|    fprintf(stderr, "janet abort at %s:%d: %s\n",\
  |  |  |  |  380|      0|        __FILE__,\
  |  |  |  |  381|      0|        __LINE__,\
  |  |  |  |  382|      0|        (m));\
  |  |  |  |  383|      0|    abort();\
  |  |  |  |  384|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:10): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (390:9): [True: 0, False: 56.0k]
  |  |  ------------------
  |  |  391|  56.0k|} while (0)
  |  |  ------------------
  |  |  |  Branch (391:10): [Folded, False: 56.0k]
  |  |  ------------------
  ------------------
33216|  56.0k|    return firstEmpty;
33217|  56.0k|}
janet.c:janet_symcache_put:
33253|  35.0k|static void janet_symcache_put(const uint8_t *x, const uint8_t **bucket) {
33254|  35.0k|    if ((janet_vm.cache_count + janet_vm.cache_deleted) * 2 > janet_vm.cache_capacity) {
  ------------------
  |  Branch (33254:9): [True: 24, False: 35.0k]
  ------------------
33255|     24|        int status;
33256|     24|        janet_cache_resize(janet_tablen((2 * janet_vm.cache_count + 1)));
33257|     24|        bucket = janet_symcache_find(x, &status);
  ------------------
  |  |33220|     24|    janet_symcache_findmem((str), janet_string_length(str), janet_string_hash(str), (success))
  |  |  ------------------
  |  |  |  | 1812|     24|#define janet_string_length(s) (janet_string_head(s)->length)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1811|     24|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   janet_symcache_findmem((str), janet_string_length(str), janet_string_hash(str), (success))
  |  |  ------------------
  |  |  |  | 1813|     24|#define janet_string_hash(s) (janet_string_head(s)->hash)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1811|     24|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
33258|     24|    }
33259|       |    /* Add x to the cache */
33260|  35.0k|    janet_vm.cache_count++;
33261|  35.0k|    *bucket = x;
33262|  35.0k|}
janet.c:janet_cache_resize:
33223|     24|static void janet_cache_resize(uint32_t newCapacity) {
33224|     24|    uint32_t i, oldCapacity;
33225|     24|    const uint8_t **oldCache = janet_vm.cache;
33226|     24|    const uint8_t **newCache = janet_calloc(1, (size_t) newCapacity * sizeof(const uint8_t *));
  ------------------
  |  | 2412|     24|#define janet_calloc(X, Y) calloc((X), (Y))
  ------------------
33227|     24|    if (newCache == NULL) {
  ------------------
  |  Branch (33227:9): [True: 0, False: 24]
  ------------------
33228|      0|        JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
33229|      0|    }
33230|     24|    oldCapacity = janet_vm.cache_capacity;
33231|     24|    janet_vm.cache = newCache;
33232|     24|    janet_vm.cache_capacity = newCapacity;
33233|     24|    janet_vm.cache_deleted = 0;
33234|       |    /* Add all of the old cache entries back */
33235|  42.0k|    for (i = 0; i < oldCapacity; ++i) {
  ------------------
  |  Branch (33235:17): [True: 41.9k, False: 24]
  ------------------
33236|  41.9k|        int status;
33237|  41.9k|        const uint8_t **bucket;
33238|  41.9k|        const uint8_t *x = oldCache[i];
33239|  41.9k|        if (x != NULL && x != JANET_SYMCACHE_DELETED) {
  ------------------
  |  Branch (33239:13): [True: 21.0k, False: 20.9k]
  |  Branch (33239:26): [True: 21.0k, False: 0]
  ------------------
33240|  21.0k|            bucket = janet_symcache_find(x, &status);
  ------------------
  |  |33220|  21.0k|    janet_symcache_findmem((str), janet_string_length(str), janet_string_hash(str), (success))
  |  |  ------------------
  |  |  |  | 1812|  21.0k|#define janet_string_length(s) (janet_string_head(s)->length)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1811|  21.0k|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   janet_symcache_findmem((str), janet_string_length(str), janet_string_hash(str), (success))
  |  |  ------------------
  |  |  |  | 1813|  21.0k|#define janet_string_hash(s) (janet_string_head(s)->hash)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1811|  21.0k|#define janet_string_head(s) ((JanetStringHead *)((char *)s - offsetof(JanetStringHead, data)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
33241|  21.0k|            if (status || bucket == NULL) {
  ------------------
  |  Branch (33241:17): [True: 0, False: 21.0k]
  |  Branch (33241:27): [True: 0, False: 21.0k]
  ------------------
33242|       |                /* there was a problem with the algorithm. */
33243|      0|                break;
33244|      0|            }
33245|  21.0k|            *bucket = x;
33246|  21.0k|        }
33247|  41.9k|    }
33248|       |    /* Free the old cache */
33249|     24|    janet_free((void *)oldCache);
  ------------------
  |  | 2415|     24|#define janet_free(X) free((X))
  ------------------
33250|     24|}
janet.c:janet_table_init_impl:
33394|   181k|static JanetTable *janet_table_init_impl(JanetTable *table, int32_t capacity, int stackalloc) {
33395|   181k|    JanetKV *data;
33396|   181k|    capacity = janet_tablen(capacity);
33397|   181k|    if (stackalloc) table->gc.flags = JANET_TABLE_FLAG_STACK;
  ------------------
  |  |33380|      0|#define JANET_TABLE_FLAG_STACK 0x10000
  ------------------
  |  Branch (33397:9): [True: 0, False: 181k]
  ------------------
33398|   181k|    if (capacity) {
  ------------------
  |  Branch (33398:9): [True: 181k, False: 0]
  ------------------
33399|   181k|        if (stackalloc) {
  ------------------
  |  Branch (33399:13): [True: 0, False: 181k]
  ------------------
33400|      0|            data = janet_memalloc_empty_local(capacity);
33401|   181k|        } else {
33402|   181k|            data = (JanetKV *) janet_memalloc_empty(capacity);
33403|   181k|            if (NULL == data) {
  ------------------
  |  Branch (33403:17): [True: 0, False: 181k]
  ------------------
33404|      0|                JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
33405|      0|            }
33406|   181k|        }
33407|   181k|        table->data = data;
33408|   181k|        table->capacity = capacity;
33409|   181k|    } else {
33410|      0|        table->data = NULL;
33411|      0|        table->capacity = 0;
33412|      0|    }
33413|   181k|    table->count = 0;
33414|   181k|    table->deleted = 0;
33415|       |    table->proto = NULL;
33416|   181k|    return table;
33417|   181k|}
janet.c:janet_table_rehash:
33467|  1.63k|static void janet_table_rehash(JanetTable *t, int32_t size) {
33468|  1.63k|    JanetKV *olddata = t->data;
33469|  1.63k|    JanetKV *newdata;
33470|  1.63k|    int islocal = t->gc.flags & JANET_TABLE_FLAG_STACK;
  ------------------
  |  |33380|  1.63k|#define JANET_TABLE_FLAG_STACK 0x10000
  ------------------
33471|  1.63k|    if (islocal) {
  ------------------
  |  Branch (33471:9): [True: 0, False: 1.63k]
  ------------------
33472|      0|        newdata = (JanetKV *) janet_memalloc_empty_local(size);
33473|  1.63k|    } else {
33474|  1.63k|        newdata = (JanetKV *) janet_memalloc_empty(size);
33475|  1.63k|        if (NULL == newdata) {
  ------------------
  |  Branch (33475:13): [True: 0, False: 1.63k]
  ------------------
33476|      0|            JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
33477|      0|        }
33478|  1.63k|    }
33479|  1.63k|    int32_t oldcapacity = t->capacity;
33480|  1.63k|    t->data = newdata;
33481|  1.63k|    t->capacity = size;
33482|  1.63k|    t->deleted = 0;
33483|  2.68M|    for (int32_t i = 0; i < oldcapacity; i++) {
  ------------------
  |  Branch (33483:25): [True: 2.68M, False: 1.63k]
  ------------------
33484|  2.68M|        JanetKV *kv = olddata + i;
33485|  2.68M|        if (!janet_checktype(kv->key, JANET_NIL)) {
  ------------------
  |  |  806|  2.68M|    (((t) == JANET_NUMBER) \
  |  |  ------------------
  |  |  |  Branch (806:6): [Folded, False: 2.68M]
  |  |  ------------------
  |  |  807|  2.68M|        ? janet_nanbox_isnumber(x) \
  |  |  ------------------
  |  |  |  |  803|      0|    (!isnan((x).number) || ((((x).u64 >> 47) & 0xF) == JANET_NUMBER))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (803:6): [True: 0, False: 0]
  |  |  |  |  |  Branch (803:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  808|  2.68M|        : janet_nanbox_checkauxtype((x), (t)))
  |  |  ------------------
  |  |  |  |  800|  2.68M|    (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  2.68M|#define JANET_NANBOX_TAGBITS     0xFFFF800000000000llu
  |  |  |  |  ------------------
  |  |  |  |                   (((x).u64 & JANET_NANBOX_TAGBITS) == janet_nanbox_tag((type)))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|  2.68M|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|  2.68M|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (33485:13): [True: 1.34M, False: 1.34M]
  ------------------
33486|  1.34M|            JanetKV *newkv = janet_table_find(t, kv->key);
33487|  1.34M|            *newkv = *kv;
33488|  1.34M|        }
33489|  2.68M|    }
33490|  1.63k|    if (islocal) {
  ------------------
  |  Branch (33490:9): [True: 0, False: 1.63k]
  ------------------
33491|      0|        janet_sfree(olddata);
33492|  1.63k|    } else {
33493|  1.63k|        janet_free(olddata);
  ------------------
  |  | 2415|  1.63k|#define janet_free(X) free((X))
  ------------------
33494|  1.63k|    }
33495|  1.63k|}
janet.c:janet_compare_abstract:
35434|  85.1k|static int janet_compare_abstract(JanetAbstract xx, JanetAbstract yy) {
35435|  85.1k|    if (xx == yy) return 0;
  ------------------
  |  Branch (35435:9): [True: 0, False: 85.1k]
  ------------------
35436|  85.1k|    const JanetAbstractType *xt = janet_abstract_type(xx);
  ------------------
  |  | 1898|  85.1k|#define janet_abstract_type(u) (janet_abstract_head(u)->type)
  |  |  ------------------
  |  |  |  | 1896|  85.1k|#define janet_abstract_head(u) ((JanetAbstractHead *)((char *)u - offsetof(JanetAbstractHead, data)))
  |  |  ------------------
  ------------------
35437|  85.1k|    const JanetAbstractType *yt = janet_abstract_type(yy);
  ------------------
  |  | 1898|  85.1k|#define janet_abstract_type(u) (janet_abstract_head(u)->type)
  |  |  ------------------
  |  |  |  | 1896|  85.1k|#define janet_abstract_head(u) ((JanetAbstractHead *)((char *)u - offsetof(JanetAbstractHead, data)))
  |  |  ------------------
  ------------------
35438|  85.1k|    if (xt != yt) {
  ------------------
  |  Branch (35438:9): [True: 7.58k, False: 77.5k]
  ------------------
35439|  7.58k|        return xt > yt ? 1 : -1;
  ------------------
  |  Branch (35439:16): [True: 4.79k, False: 2.78k]
  ------------------
35440|  7.58k|    }
35441|  77.5k|    if (xt->compare == NULL) {
  ------------------
  |  Branch (35441:9): [True: 0, False: 77.5k]
  ------------------
35442|      0|        return xx > yy ? 1 : -1;
  ------------------
  |  Branch (35442:16): [True: 0, False: 0]
  ------------------
35443|      0|    }
35444|  77.5k|    return xt->compare(xx, yy);
35445|  77.5k|}
janet.c:push_traversal_node:
35232|  2.35M|static void push_traversal_node(void *lhs, void *rhs, int32_t index2) {
35233|  2.35M|    JanetTraversalNode node;
35234|  2.35M|    node.self = (JanetGCObject *) lhs;
35235|  2.35M|    node.other = (JanetGCObject *) rhs;
35236|  2.35M|    node.index = 0;
35237|  2.35M|    node.index2 = index2;
35238|  2.35M|    int is_new = janet_vm.traversal_base == NULL;
35239|  2.35M|    if (is_new || (janet_vm.traversal + 1 >= janet_vm.traversal_top)) {
  ------------------
  |  Branch (35239:9): [True: 327, False: 2.35M]
  |  Branch (35239:19): [True: 78, False: 2.35M]
  ------------------
35240|    405|        size_t oldsize = is_new ? 0 : (janet_vm.traversal - janet_vm.traversal_base);
  ------------------
  |  Branch (35240:26): [True: 327, False: 78]
  ------------------
35241|    405|        size_t newsize = 2 * oldsize + 1;
35242|    405|        if (newsize < 128) {
  ------------------
  |  Branch (35242:13): [True: 327, False: 78]
  ------------------
35243|    327|            newsize = 128;
35244|    327|        }
35245|    405|        JanetTraversalNode *tn = janet_realloc(janet_vm.traversal_base, newsize * sizeof(JanetTraversalNode));
  ------------------
  |  | 2409|    405|#define janet_realloc(X, Y) realloc((X), (Y))
  ------------------
35246|    405|        if (tn == NULL) {
  ------------------
  |  Branch (35246:13): [True: 0, False: 405]
  ------------------
35247|      0|            JANET_OUT_OF_MEMORY;
  ------------------
  |  |  419|      0|#define JANET_OUT_OF_MEMORY do { fprintf(stderr, "%s:%d - janet out of memory\n", __FILE__, __LINE__); exit(1); } while (0)
  |  |  ------------------
  |  |  |  Branch (419:122): [Folded, False: 0]
  |  |  ------------------
  ------------------
35248|      0|        }
35249|    405|        janet_vm.traversal_base = tn;
35250|    405|        janet_vm.traversal_top = janet_vm.traversal_base + newsize;
35251|    405|        janet_vm.traversal = janet_vm.traversal_base + oldsize;
35252|    405|    }
35253|  2.35M|    *(++janet_vm.traversal) = node;
35254|  2.35M|}
janet.c:traversal_next:
35264|  8.12M|static int traversal_next(Janet *x, Janet *y) {
35265|  8.12M|    JanetTraversalNode *t = janet_vm.traversal;
35266|  10.4M|    while (t && t > janet_vm.traversal_base) {
  ------------------
  |  Branch (35266:12): [True: 10.2M, False: 139k]
  |  Branch (35266:17): [True: 7.07M, False: 3.20M]
  ------------------
35267|  7.07M|        JanetGCObject *self = t->self;
35268|  7.07M|        JanetTupleHead *tself = (JanetTupleHead *)self;
35269|  7.07M|        JanetStructHead *sself = (JanetStructHead *)self;
35270|  7.07M|        JanetGCObject *other = t->other;
35271|  7.07M|        JanetTupleHead *tother = (JanetTupleHead *)other;
35272|  7.07M|        JanetStructHead *sother = (JanetStructHead *)other;
35273|  7.07M|        if ((self->flags & JANET_MEM_TYPEBITS) == JANET_MEMORY_TUPLE) {
  ------------------
  |  |  630|  7.07M|#define JANET_MEM_TYPEBITS 0xFF
  ------------------
  |  Branch (35273:13): [True: 2.32M, False: 4.75M]
  ------------------
35274|       |            /* Node is a tuple at index t->index */
35275|  2.32M|            if (t->index < tself->length && t->index < tother->length) {
  ------------------
  |  Branch (35275:17): [True: 1.59M, False: 724k]
  |  Branch (35275:45): [True: 1.59M, False: 0]
  ------------------
35276|  1.59M|                int32_t index = t->index++;
35277|  1.59M|                *x = tself->data[index];
35278|  1.59M|                *y = tother->data[index];
35279|  1.59M|                janet_vm.traversal = t;
35280|  1.59M|                return 0;
35281|  1.59M|            }
35282|   724k|            if (t->index2 && tself->length != tother->length) {
  ------------------
  |  Branch (35282:17): [True: 384k, False: 339k]
  |  Branch (35282:30): [True: 0, False: 384k]
  ------------------
35283|      0|                return tself->length > tother->length ? 3 : 1;
  ------------------
  |  Branch (35283:24): [True: 0, False: 0]
  ------------------
35284|      0|            }
35285|  4.75M|        } else {
35286|       |            /* Node is a struct at index t->index: if t->index2 is true, we should return the values. */
35287|  4.75M|            if (t->index2) {
  ------------------
  |  Branch (35287:17): [True: 1.58M, False: 3.16M]
  ------------------
35288|  1.58M|                t->index2 = 0;
35289|  1.58M|                int32_t index = t->index++;
35290|  1.58M|                *x = sself->data[index].value;
35291|  1.58M|                *y = sother->data[index].value;
35292|  1.58M|                janet_vm.traversal = t;
35293|  1.58M|                return 0;
35294|  1.58M|            }
35295|  3.16M|            for (int32_t i = t->index; i < sself->capacity; i++) {
  ------------------
  |  Branch (35295:40): [True: 1.58M, False: 1.57M]
  ------------------
35296|  1.58M|                t->index2 = 1;
35297|  1.58M|                *x = sself->data[t->index].key;
35298|  1.58M|                *y = sother->data[t->index].key;
35299|  1.58M|                janet_vm.traversal = t;
35300|  1.58M|                return 0;
35301|  1.58M|            }
35302|       |            /* Traverse prototype */
35303|  1.57M|            JanetStruct sproto = sself->proto;
35304|  1.57M|            JanetStruct oproto = sother->proto;
35305|  1.57M|            if (sproto && !oproto) return 3;
  ------------------
  |  Branch (35305:17): [True: 0, False: 1.57M]
  |  Branch (35305:27): [True: 0, False: 0]
  ------------------
35306|  1.57M|            if (!sproto && oproto) return 1;
  ------------------
  |  Branch (35306:17): [True: 1.57M, False: 0]
  |  Branch (35306:28): [True: 0, False: 1.57M]
  ------------------
35307|  1.57M|            if (oproto && sproto) {
  ------------------
  |  Branch (35307:17): [True: 0, False: 1.57M]
  |  Branch (35307:27): [True: 0, False: 0]
  ------------------
35308|      0|                *x = janet_wrap_struct(sproto);
  ------------------
  |  |  842|      0|#define janet_wrap_struct(s) janet_nanbox_wrap_c((s), JANET_STRUCT)
  |  |  ------------------
  |  |  |  |  828|      0|    janet_nanbox_from_cpointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|      0|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
35309|      0|                *y = janet_wrap_struct(oproto);
  ------------------
  |  |  842|      0|#define janet_wrap_struct(s) janet_nanbox_wrap_c((s), JANET_STRUCT)
  |  |  ------------------
  |  |  |  |  828|      0|    janet_nanbox_from_cpointer((p), janet_nanbox_tag(t))
  |  |  |  |  ------------------
  |  |  |  |  |  |  793|      0|#define janet_nanbox_tag(type) (janet_nanbox_lowtag(type) << 47)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define janet_nanbox_lowtag(type) ((uint64_t)(type) | 0x1FFF0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
35310|      0|                janet_vm.traversal = t - 1;
35311|      0|                return 0;
35312|      0|            }
35313|  1.57M|        }
35314|  2.29M|        t--;
35315|  2.29M|    }
35316|  3.34M|    janet_vm.traversal = t;
35317|  3.34M|    return 2;
35318|  8.12M|}
janet.c:murmur64:
35497|  11.9M|static uint64_t murmur64(uint64_t h) {
35498|  11.9M|    h ^= h >> 33;
35499|  11.9M|    h *= 0xff51afd7ed558ccdUL;
35500|  11.9M|    h ^= h >> 33;
35501|  11.9M|    h *= 0xc4ceb9fe1a85ec53UL;
35502|  11.9M|    h ^= h >> 33;
35503|  11.9M|    return h;
35504|  11.9M|}

LLVMFuzzerTestOneInput:
    5|  6.23k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
    6|       |
    7|       |    /* init Janet */
    8|  6.23k|    janet_init();
    9|       |
   10|       |    /* fuzz the parser */
   11|  6.23k|    JanetParser parser;
   12|  6.23k|    janet_parser_init(&parser);
   13|  88.9M|    for (int i = 0, done = 0; i < size; i++) {
  ------------------
  |  Branch (13:31): [True: 88.9M, False: 6.05k]
  ------------------
   14|  88.9M|        switch (janet_parser_status(&parser)) {
  ------------------
  |  Branch (14:17): [True: 88.9M, False: 0]
  ------------------
   15|      0|            case JANET_PARSE_DEAD:
  ------------------
  |  Branch (15:13): [True: 0, False: 88.9M]
  ------------------
   16|    181|            case JANET_PARSE_ERROR:
  ------------------
  |  Branch (16:13): [True: 181, False: 88.9M]
  ------------------
   17|    181|                done = 1;
   18|    181|                break;
   19|  88.9M|            case JANET_PARSE_PENDING:
  ------------------
  |  Branch (19:13): [True: 88.9M, False: 42.3k]
  ------------------
   20|  88.9M|                if (i == size) {
  ------------------
  |  Branch (20:21): [True: 0, False: 88.9M]
  ------------------
   21|      0|                    janet_parser_eof(&parser);
   22|  88.9M|                } else {
   23|  88.9M|                    janet_parser_consume(&parser, data[i]);
   24|  88.9M|                }
   25|  88.9M|                break;
   26|  42.1k|            case JANET_PARSE_ROOT:
  ------------------
  |  Branch (26:13): [True: 42.1k, False: 88.9M]
  ------------------
   27|  42.1k|                if (i >= size) {
  ------------------
  |  Branch (27:21): [True: 0, False: 42.1k]
  ------------------
   28|      0|                    janet_parser_eof(&parser);
   29|  42.1k|                } else {
   30|  42.1k|                    janet_parser_consume(&parser, data[i]);
   31|  42.1k|                }
   32|  42.1k|                break;
   33|  88.9M|        }
   34|       |
   35|  88.9M|        if (done == 1)
  ------------------
  |  Branch (35:13): [True: 181, False: 88.9M]
  ------------------
   36|    181|            break;
   37|  88.9M|    }
   38|  6.23k|    janet_parser_deinit(&parser);
   39|       |
   40|       |    /* cleanup Janet */
   41|  6.23k|    janet_deinit();
   42|       |
   43|  6.23k|    return 0;
   44|  6.23k|}

