fuzzer_parser_init:
   33|  1.30k|readstat_parser_t *fuzzer_parser_init(const uint8_t *Data, size_t Size) {
   34|  1.30k|    readstat_parser_t *parser = readstat_parser_init();
   35|  1.30k|    readstat_set_open_handler(parser, rt_open_handler);
   36|  1.30k|    readstat_set_close_handler(parser, rt_close_handler);
   37|  1.30k|    readstat_set_seek_handler(parser, rt_seek_handler);
   38|  1.30k|    readstat_set_read_handler(parser, rt_read_handler);
   39|  1.30k|    readstat_set_update_handler(parser, rt_update_handler);
   40|       |
   41|  1.30k|    readstat_set_metadata_handler(parser, &handle_metadata);
   42|  1.30k|    readstat_set_note_handler(parser, &handle_note);
   43|  1.30k|    readstat_set_variable_handler(parser, &handle_variable);
   44|  1.30k|    readstat_set_fweight_handler(parser, &handle_fweight);
   45|  1.30k|    readstat_set_value_handler(parser, &handle_value);
   46|  1.30k|    readstat_set_value_label_handler(parser, &handle_value_label);
   47|       |
   48|  1.30k|    return parser;
   49|  1.30k|}
fuzz_format.c:handle_variable:
   21|    866|                           const char *val_labels, void *ctx) {
   22|    866|    return READSTAT_HANDLER_OK;
   23|    866|}
fuzz_format.c:handle_value_label:
   29|  11.3M|static int handle_value_label(const char *val_labels, readstat_value_t value, const char *label, void *ctx) {
   30|  11.3M|    return READSTAT_HANDLER_OK;
   31|  11.3M|}

LLVMFuzzerTestOneInput:
   11|  1.30k|int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   12|  1.30k|    rt_buffer_t buffer = { .bytes = (char *)Data, .size = Size, .used = Size };
   13|  1.30k|    rt_buffer_ctx_t buffer_ctx = { .buffer = &buffer };
   14|       |
   15|  1.30k|    readstat_parser_t *parser = fuzzer_parser_init(Data, Size);
   16|  1.30k|    readstat_set_io_ctx(parser, &buffer_ctx);
   17|       |
   18|  1.30k|    readstat_schema_t *schema = readstat_parse_sas_commands(parser, NULL, NULL, NULL);
   19|  1.30k|    if (schema)
  ------------------
  |  Branch (19:9): [True: 234, False: 1.07k]
  ------------------
   20|    234|        readstat_schema_free(schema);
   21|  1.30k|    readstat_parser_free(parser);
   22|       |
   23|  1.30k|    return 0;
   24|  1.30k|}

unistd_io_init:
  121|  1.30k|readstat_error_t unistd_io_init(readstat_parser_t *parser) {
  122|  1.30k|    readstat_error_t retval = READSTAT_OK;
  123|  1.30k|    unistd_io_ctx_t *io_ctx = NULL;
  124|       |
  125|  1.30k|    if ((retval = readstat_set_open_handler(parser, unistd_open_handler)) != READSTAT_OK)
  ------------------
  |  Branch (125:9): [True: 0, False: 1.30k]
  ------------------
  126|      0|        return retval;
  127|       |
  128|  1.30k|    if ((retval = readstat_set_close_handler(parser, unistd_close_handler)) != READSTAT_OK)
  ------------------
  |  Branch (128:9): [True: 0, False: 1.30k]
  ------------------
  129|      0|        return retval;
  130|       |
  131|  1.30k|    if ((retval = readstat_set_seek_handler(parser, unistd_seek_handler)) != READSTAT_OK)
  ------------------
  |  Branch (131:9): [True: 0, False: 1.30k]
  ------------------
  132|      0|        return retval;
  133|       |
  134|  1.30k|    if ((retval = readstat_set_read_handler(parser, unistd_read_handler)) != READSTAT_OK)
  ------------------
  |  Branch (134:9): [True: 0, False: 1.30k]
  ------------------
  135|      0|        return retval;
  136|       |
  137|  1.30k|    if ((readstat_set_update_handler(parser, unistd_update_handler)) != READSTAT_OK)
  ------------------
  |  Branch (137:9): [True: 0, False: 1.30k]
  ------------------
  138|      0|        return retval;
  139|       |
  140|  1.30k|    io_ctx = calloc(1, sizeof(unistd_io_ctx_t));
  141|  1.30k|    io_ctx->fd = -1;
  142|       |
  143|  1.30k|    retval = readstat_set_io_ctx(parser, (void*) io_ctx);
  144|  1.30k|    parser->io->io_ctx_needs_free = 1;
  145|       |
  146|  1.30k|    return retval;
  147|  1.30k|}

readstat_parser_init:
    6|  1.30k|readstat_parser_t *readstat_parser_init(void) {
    7|  1.30k|    readstat_parser_t *parser = calloc(1, sizeof(readstat_parser_t));
    8|  1.30k|    parser->io = calloc(1, sizeof(readstat_io_t));
    9|  1.30k|    if (unistd_io_init(parser) != READSTAT_OK) {
  ------------------
  |  Branch (9:9): [True: 0, False: 1.30k]
  ------------------
   10|      0|        readstat_parser_free(parser);
   11|      0|        return NULL;
   12|      0|    }
   13|  1.30k|    parser->output_encoding = "UTF-8";
   14|  1.30k|    return parser;
   15|  1.30k|}
readstat_parser_free:
   17|  1.30k|void readstat_parser_free(readstat_parser_t *parser) {
   18|  1.30k|    if (parser) {
  ------------------
  |  Branch (18:9): [True: 1.30k, False: 0]
  ------------------
   19|  1.30k|        if (parser->io) {
  ------------------
  |  Branch (19:13): [True: 1.30k, False: 0]
  ------------------
   20|       |            readstat_set_io_ctx(parser, NULL);
   21|  1.30k|            free(parser->io);
   22|  1.30k|        }
   23|  1.30k|        free(parser);
   24|  1.30k|    }
   25|  1.30k|}
readstat_set_metadata_handler:
   27|  1.30k|readstat_error_t readstat_set_metadata_handler(readstat_parser_t *parser, readstat_metadata_handler metadata_handler) {
   28|  1.30k|    parser->handlers.metadata = metadata_handler;
   29|  1.30k|    return READSTAT_OK;
   30|  1.30k|}
readstat_set_note_handler:
   32|  1.30k|readstat_error_t readstat_set_note_handler(readstat_parser_t *parser, readstat_note_handler note_handler) {
   33|  1.30k|    parser->handlers.note = note_handler;
   34|  1.30k|    return READSTAT_OK;
   35|  1.30k|}
readstat_set_variable_handler:
   37|  1.30k|readstat_error_t readstat_set_variable_handler(readstat_parser_t *parser, readstat_variable_handler variable_handler) {
   38|  1.30k|    parser->handlers.variable = variable_handler;
   39|  1.30k|    return READSTAT_OK;
   40|  1.30k|}
readstat_set_value_handler:
   42|  1.30k|readstat_error_t readstat_set_value_handler(readstat_parser_t *parser, readstat_value_handler value_handler) {
   43|  1.30k|    parser->handlers.value = value_handler;
   44|  1.30k|    return READSTAT_OK;
   45|  1.30k|}
readstat_set_value_label_handler:
   47|  1.30k|readstat_error_t readstat_set_value_label_handler(readstat_parser_t *parser, readstat_value_label_handler label_handler) {
   48|  1.30k|    parser->handlers.value_label = label_handler;
   49|  1.30k|    return READSTAT_OK;
   50|  1.30k|}
readstat_set_fweight_handler:
   62|  1.30k|readstat_error_t readstat_set_fweight_handler(readstat_parser_t *parser, readstat_fweight_handler fweight_handler) {
   63|  1.30k|    parser->handlers.fweight = fweight_handler;
   64|  1.30k|    return READSTAT_OK;
   65|  1.30k|}
readstat_set_open_handler:
   67|  2.61k|readstat_error_t readstat_set_open_handler(readstat_parser_t *parser, readstat_open_handler open_handler) {
   68|  2.61k|    parser->io->open = open_handler;
   69|  2.61k|    return READSTAT_OK;
   70|  2.61k|}
readstat_set_close_handler:
   72|  2.61k|readstat_error_t readstat_set_close_handler(readstat_parser_t *parser, readstat_close_handler close_handler) {
   73|  2.61k|    parser->io->close = close_handler;
   74|  2.61k|    return READSTAT_OK;
   75|  2.61k|}
readstat_set_seek_handler:
   77|  2.61k|readstat_error_t readstat_set_seek_handler(readstat_parser_t *parser, readstat_seek_handler seek_handler) {
   78|  2.61k|    parser->io->seek = seek_handler;
   79|  2.61k|    return READSTAT_OK;
   80|  2.61k|}
readstat_set_read_handler:
   82|  2.61k|readstat_error_t readstat_set_read_handler(readstat_parser_t *parser, readstat_read_handler read_handler) {
   83|  2.61k|    parser->io->read = read_handler;
   84|  2.61k|    return READSTAT_OK;
   85|  2.61k|}
readstat_set_update_handler:
   87|  2.61k|readstat_error_t readstat_set_update_handler(readstat_parser_t *parser, readstat_update_handler update_handler) {
   88|  2.61k|    parser->io->update = update_handler;
   89|  2.61k|    return READSTAT_OK;
   90|  2.61k|}
readstat_set_io_ctx:
   92|  3.92k|readstat_error_t readstat_set_io_ctx(readstat_parser_t *parser, void *io_ctx) {
   93|  3.92k|    if (parser->io->io_ctx_needs_free) {
  ------------------
  |  Branch (93:9): [True: 1.30k, False: 2.61k]
  ------------------
   94|  1.30k|        free(parser->io->io_ctx);
   95|  1.30k|    }
   96|       |
   97|  3.92k|    parser->io->io_ctx = io_ctx;
   98|  3.92k|    parser->io->io_ctx_needs_free = 0;
   99|       |
  100|  3.92k|    return READSTAT_OK;
  101|  3.92k|}

rt_open_handler:
    8|  1.30k|int rt_open_handler(const char *path, void *io_ctx) {
    9|  1.30k|    return 0;
   10|  1.30k|}
rt_close_handler:
   12|  1.30k|int rt_close_handler(void *io_ctx) {
   13|  1.30k|    return 0;
   14|  1.30k|}
rt_seek_handler:
   17|  2.61k|        readstat_io_flags_t whence, void *io_ctx) {
   18|  2.61k|    rt_buffer_ctx_t *buffer_ctx = (rt_buffer_ctx_t *)io_ctx;
   19|  2.61k|    readstat_off_t newpos = -1;
   20|  2.61k|    if (whence == READSTAT_SEEK_SET) {
  ------------------
  |  Branch (20:9): [True: 1.30k, False: 1.30k]
  ------------------
   21|  1.30k|        newpos = offset;
   22|  1.30k|    } else if (whence == READSTAT_SEEK_CUR) {
  ------------------
  |  Branch (22:16): [True: 0, False: 1.30k]
  ------------------
   23|      0|        newpos = buffer_ctx->pos + offset;
   24|  1.30k|    } else if (whence == READSTAT_SEEK_END) {
  ------------------
  |  Branch (24:16): [True: 1.30k, False: 0]
  ------------------
   25|  1.30k|        newpos = buffer_ctx->buffer->used + offset;
   26|  1.30k|    }
   27|       |
   28|  2.61k|    if (newpos < 0)
  ------------------
  |  Branch (28:9): [True: 0, False: 2.61k]
  ------------------
   29|      0|        return -1;
   30|       |
   31|  2.61k|    if (newpos > buffer_ctx->buffer->used)
  ------------------
  |  Branch (31:9): [True: 0, False: 2.61k]
  ------------------
   32|      0|        return -1;
   33|       |
   34|  2.61k|    buffer_ctx->pos = newpos;
   35|  2.61k|    return newpos;
   36|  2.61k|}
rt_read_handler:
   38|  1.30k|ssize_t rt_read_handler(void *buf, size_t nbytes, void *io_ctx) {
   39|  1.30k|    rt_buffer_ctx_t *buffer_ctx = (rt_buffer_ctx_t *)io_ctx;
   40|  1.30k|    ssize_t bytes_copied = 0;
   41|  1.30k|    ssize_t bytes_left = buffer_ctx->buffer->used - buffer_ctx->pos;
   42|  1.30k|    if (nbytes <= bytes_left) {
  ------------------
  |  Branch (42:9): [True: 1.30k, False: 0]
  ------------------
   43|  1.30k|        memcpy(buf, buffer_ctx->buffer->bytes + buffer_ctx->pos, nbytes);
   44|  1.30k|        bytes_copied = nbytes;
   45|  1.30k|    } else if (bytes_left > 0) {
  ------------------
  |  Branch (45:16): [True: 0, False: 0]
  ------------------
   46|      0|        memcpy(buf, buffer_ctx->buffer->bytes + buffer_ctx->pos, bytes_left);
   47|      0|        bytes_copied = bytes_left;
   48|      0|    }
   49|  1.30k|    buffer_ctx->pos += bytes_copied;
   50|  1.30k|    return bytes_copied;
   51|  1.30k|}

submit_value_label:
   10|  2.84k|        uint64_t *range_values_remaining, void *user_ctx) {
   11|  2.84k|    if (!parser->handlers.value_label)
  ------------------
  |  Branch (11:9): [True: 0, False: 2.84k]
  ------------------
   12|      0|        return READSTAT_OK;
   13|       |
   14|  2.84k|    int cb_retval = READSTAT_HANDLER_OK;
   15|  2.84k|    if (label_type == LABEL_TYPE_RANGE) {
  ------------------
  |  Branch (15:9): [True: 1.06k, False: 1.77k]
  ------------------
   16|  1.06k|        if (first_integer > last_integer)
  ------------------
  |  Branch (16:13): [True: 451, False: 616]
  ------------------
   17|    451|            return READSTAT_OK;
   18|       |
   19|       |        /* A range is expanded into one label per integer. Cap the running
   20|       |         * total across the whole file so a range like "0 - 99999999999999999"
   21|       |         * cannot spin (unsigned arithmetic: the span can exceed INT64_MAX). */
   22|    616|        uint64_t span = (uint64_t)last_integer - (uint64_t)first_integer;
   23|    616|        if (span >= *range_values_remaining)
  ------------------
  |  Branch (23:13): [True: 94, False: 522]
  ------------------
   24|     94|            return READSTAT_ERROR_PARSE;
   25|    522|        *range_values_remaining -= span + 1;
   26|       |
   27|    522|        int64_t i = first_integer;
   28|  11.3M|        while (1) {
  ------------------
  |  Branch (28:16): [True: 11.3M, Folded]
  ------------------
   29|  11.3M|            readstat_value_t value = {
   30|  11.3M|                .type = READSTAT_TYPE_DOUBLE,
   31|  11.3M|                .v = { .double_value = i } };
   32|  11.3M|            cb_retval = parser->handlers.value_label(labelset, value, buf, user_ctx);
   33|  11.3M|            if (cb_retval != READSTAT_HANDLER_OK)
  ------------------
  |  Branch (33:17): [True: 0, False: 11.3M]
  ------------------
   34|      0|                goto cleanup;
   35|       |            /* Compare before incrementing so last_integer == INT64_MAX can't overflow */
   36|  11.3M|            if (i == last_integer)
  ------------------
  |  Branch (36:17): [True: 522, False: 11.3M]
  ------------------
   37|    522|                break;
   38|  11.3M|            i++;
   39|  11.3M|        }
   40|  1.77k|    } else if (label_type != LABEL_TYPE_OTHER) {
  ------------------
  |  Branch (40:16): [True: 1.52k, False: 253]
  ------------------
   41|       |
   42|  1.52k|        readstat_value_t value = { { 0 } };
   43|  1.52k|        if (label_type == LABEL_TYPE_DOUBLE) {
  ------------------
  |  Branch (43:13): [True: 570, False: 951]
  ------------------
   44|    570|            value.type = READSTAT_TYPE_DOUBLE;
   45|    570|            value.v.double_value = double_value;
   46|    951|        } else if (label_type == LABEL_TYPE_STRING) {
  ------------------
  |  Branch (46:20): [True: 566, False: 385]
  ------------------
   47|    566|            value.type = READSTAT_TYPE_STRING;
   48|    566|            value.v.string_value = string_value;
   49|    566|        } else if (label_type == LABEL_TYPE_NAN) {
  ------------------
  |  Branch (49:20): [True: 385, False: 0]
  ------------------
   50|    385|            value.type = READSTAT_TYPE_DOUBLE;
   51|    385|            value.v.double_value = NAN;
   52|    385|        }
   53|       |
   54|  1.52k|        cb_retval = parser->handlers.value_label(labelset, value, buf, user_ctx);
   55|  1.52k|    }
   56|       |
   57|  2.29k|cleanup:
   58|  2.29k|    return (cb_retval == READSTAT_HANDLER_OK) ? READSTAT_OK : READSTAT_ERROR_USER_ABORT;
  ------------------
  |  Branch (58:12): [True: 2.29k, False: 0]
  ------------------
   59|  2.84k|}
submit_columns:
   61|    234|readstat_error_t submit_columns(readstat_parser_t *parser, readstat_schema_t *dct, void *user_ctx) {
   62|    234|    int i;
   63|    234|    int partial_entry_count = 0;
   64|  1.10k|    for (i=0; i<dct->entry_count; i++) {
  ------------------
  |  Branch (64:15): [True: 866, False: 234]
  ------------------
   65|    866|        readstat_schema_entry_t *entry = &dct->entries[i];
   66|    866|        if (dct->rows_per_observation < entry->row + 1) {
  ------------------
  |  Branch (66:13): [True: 77, False: 789]
  ------------------
   67|     77|            dct->rows_per_observation = entry->row + 1;
   68|     77|        }
   69|    866|    }
   70|       |
   71|    234|    if (!parser->handlers.variable)
  ------------------
  |  Branch (71:9): [True: 0, False: 234]
  ------------------
   72|      0|        return READSTAT_OK;
   73|       |
   74|  1.10k|    for (i=0; i<dct->entry_count; i++) {
  ------------------
  |  Branch (74:15): [True: 866, False: 234]
  ------------------
   75|    866|        readstat_schema_entry_t *entry = &dct->entries[i];
   76|    866|        entry->variable.index = i;
   77|    866|        entry->variable.index_after_skipping = partial_entry_count;
   78|    866|        if (entry->variable.type == READSTAT_TYPE_STRING)
  ------------------
  |  Branch (78:13): [True: 721, False: 145]
  ------------------
   79|    721|            entry->variable.storage_width = entry->len;
   80|    866|        int cb_retval = parser->handlers.variable(i, &entry->variable,
   81|    866|            entry->labelset[0] ? entry->labelset : NULL, user_ctx);
  ------------------
  |  Branch (81:13): [True: 70, False: 796]
  ------------------
   82|    866|        if (cb_retval == READSTAT_HANDLER_SKIP_VARIABLE) {
  ------------------
  |  Branch (82:13): [True: 0, False: 866]
  ------------------
   83|      0|            entry->skip = 1;
   84|    866|        } else if (cb_retval == READSTAT_HANDLER_ABORT) {
  ------------------
  |  Branch (84:20): [True: 0, False: 866]
  ------------------
   85|      0|            return READSTAT_ERROR_USER_ABORT;
   86|    866|        } else {
   87|    866|            partial_entry_count++;
   88|    866|        }
   89|    866|    }
   90|    234|    return READSTAT_OK;
   91|    234|}

readstat_copy:
    5|  12.5k|void readstat_copy(char *buf, size_t buf_len, const char *str_start, size_t str_len) {
    6|  12.5k|    size_t this_len = str_len;
    7|  12.5k|    if (this_len >= buf_len) {
  ------------------
  |  Branch (7:9): [True: 814, False: 11.7k]
  ------------------
    8|    814|        this_len = buf_len - 1;
    9|    814|    }
   10|  12.5k|    memcpy(buf, str_start, this_len);
   11|  12.5k|    buf[this_len] = '\0';
   12|  12.5k|}
readstat_copy_lower:
   14|  3.04k|void readstat_copy_lower(char *buf, size_t buf_len, const char *str_start, size_t str_len) {
   15|  3.04k|    int i;
   16|  3.04k|    readstat_copy(buf, buf_len, str_start, str_len);
   17|  15.6k|    for (i=0; i<buf_len && buf[i]; i++)
  ------------------
  |  Branch (17:15): [True: 15.6k, False: 0]
  |  Branch (17:28): [True: 12.5k, False: 3.04k]
  ------------------
   18|  12.5k|        buf[i] = tolower(buf[i]);
  ------------------
  |  Branch (18:18): [True: 0, False: 0]
  |  Branch (18:18): [True: 0, False: 0]
  |  Branch (18:18): [Folded, False: 12.5k]
  ------------------
   19|  3.04k|}

readstat_parse_sas_commands:
 3641|  1.30k|const char *filepath, void *user_ctx, readstat_error_t *outError) {
 3642|  1.30k|	if (parser->io->open(filepath, parser->io->io_ctx) == -1) {
  ------------------
  |  Branch (3642:6): [True: 0, False: 1.30k]
  ------------------
 3643|      0|		if (outError)
  ------------------
  |  Branch (3643:7): [True: 0, False: 0]
  ------------------
 3644|      0|			*outError = READSTAT_ERROR_OPEN;
 3645|      0|		return NULL;
 3646|      0|	}
 3647|  1.30k|	readstat_schema_t *schema = NULL;
 3648|  1.30k|	unsigned char *bytes = NULL;
 3649|  1.30k|	readstat_error_t error = READSTAT_OK;
 3650|  1.30k|	ssize_t len = parser->io->seek(0, READSTAT_SEEK_END, parser->io->io_ctx);
 3651|  1.30k|	if (len == -1) {
  ------------------
  |  Branch (3651:6): [True: 0, False: 1.30k]
  ------------------
 3652|      0|		error = READSTAT_ERROR_SEEK;
 3653|      0|		goto cleanup;
 3654|      0|	}
 3655|  1.30k|	parser->io->seek(0, READSTAT_SEEK_SET, parser->io->io_ctx);
 3656|       |	
 3657|  1.30k|	bytes = malloc(len);
 3658|       |	
 3659|  1.30k|	parser->io->read(bytes, len, parser->io->io_ctx);
 3660|       |	
 3661|  1.30k|	unsigned char *p = bytes;
 3662|  1.30k|	unsigned char *pe = bytes + len;
 3663|       |	
 3664|  1.30k|	unsigned char *eof = pe;
 3665|       |	
 3666|  1.30k|	unsigned char *str_start = NULL;
 3667|       |	
 3668|  1.30k|	size_t str_len = 0;
 3669|       |	
 3670|  1.30k|	int cs;
 3671|       |	
 3672|  1.30k|	double double_value = NAN;
 3673|  1.30k|	uint64_t first_integer = 0;
 3674|  1.30k|	uint64_t integer = 0;
 3675|  1.30k|	uint64_t range_values_remaining = MAX_VALUE_LABEL_RANGE_VALUES;
  ------------------
  |  |   14|  1.30k|#define MAX_VALUE_LABEL_RANGE_VALUES (1 << 20)
  ------------------
 3676|  1.30k|	int line_no = 0;
 3677|  1.30k|	unsigned char *line_start = p;
 3678|       |	
 3679|  1.30k|	char varname[32];
 3680|  1.30k|	char argname[32];
 3681|  1.30k|	char labelset[32];
 3682|  1.30k|	char string_value[32];
 3683|  1.30k|	char buf[1024];
 3684|       |	
 3685|  1.30k|	readstat_type_t var_type = READSTAT_TYPE_DOUBLE;
 3686|  1.30k|	label_type_t label_type = LABEL_TYPE_DOUBLE;
 3687|  1.30k|	int var_row = 0, var_col = 0;
 3688|  1.30k|	int var_len = 0;
 3689|       |	
 3690|  1.30k|	if ((schema = calloc(1, sizeof(readstat_schema_t))) == NULL) {
  ------------------
  |  Branch (3690:6): [True: 0, False: 1.30k]
  ------------------
 3691|      0|		error = READSTAT_ERROR_MALLOC;
 3692|      0|		goto cleanup;
 3693|      0|	}
 3694|       |	
 3695|  1.30k|	schema->rows_per_observation = 1;
 3696|       |	
 3697|       |	
 3698|  1.30k|#line 3699 "src/txt/readstat_sas_commands_read.c"
 3699|  1.30k|	{
 3700|  1.30k|		cs = (int)sas_commands_start;
 3701|  1.30k|	}
 3702|       |	
 3703|  1.30k|#line 3704 "src/txt/readstat_sas_commands_read.c"
 3704|  1.30k|	{
 3705|  1.30k|		int _klen;
 3706|  1.30k|		unsigned int _trans = 0;
 3707|  1.30k|		const char * _keys;
 3708|  1.30k|		const signed char * _acts;
 3709|  1.30k|		unsigned int _nacts;
 3710|  7.81M|		_resume: {}
 3711|  7.81M|		if ( p == pe && p != eof )
  ------------------
  |  Branch (3711:8): [True: 1.17k, False: 7.81M]
  |  Branch (3711:19): [True: 0, False: 1.17k]
  ------------------
 3712|      0|			goto _out;
 3713|  7.81M|		if ( p == eof ) {
  ------------------
  |  Branch (3713:8): [True: 1.17k, False: 7.81M]
  ------------------
 3714|  1.17k|			if ( _sas_commands_eof_trans[cs] > 0 ) {
  ------------------
  |  Branch (3714:9): [True: 1.17k, False: 0]
  ------------------
 3715|  1.17k|				_trans = (unsigned int)_sas_commands_eof_trans[cs] - 1;
 3716|  1.17k|			}
 3717|  1.17k|		}
 3718|  7.81M|		else {
 3719|  7.81M|			_keys = ( _sas_commands_trans_keys + (_sas_commands_key_offsets[cs]));
 3720|  7.81M|			_trans = (unsigned int)_sas_commands_index_offsets[cs];
 3721|       |			
 3722|  7.81M|			_klen = (int)_sas_commands_single_lengths[cs];
 3723|  7.81M|			if ( _klen > 0 ) {
  ------------------
  |  Branch (3723:9): [True: 7.81M, False: 1.14k]
  ------------------
 3724|  7.81M|				const char *_lower = _keys;
 3725|  7.81M|				const char *_upper = _keys + _klen - 1;
 3726|  7.81M|				const char *_mid;
 3727|  23.2M|				while ( 1 ) {
  ------------------
  |  Branch (3727:13): [True: 23.2M, Folded]
  ------------------
 3728|  23.2M|					if ( _upper < _lower ) {
  ------------------
  |  Branch (3728:11): [True: 7.75M, False: 15.5M]
  ------------------
 3729|  7.75M|						_keys += _klen;
 3730|  7.75M|						_trans += (unsigned int)_klen;
 3731|  7.75M|						break;
 3732|  7.75M|					}
 3733|       |					
 3734|  15.5M|					_mid = _lower + ((_upper-_lower) >> 1);
 3735|  15.5M|					if ( ( (*( p))) < (*( _mid)) )
  ------------------
  |  Branch (3735:11): [True: 3.67M, False: 11.8M]
  ------------------
 3736|  3.67M|						_upper = _mid - 1;
 3737|  11.8M|					else if ( ( (*( p))) > (*( _mid)) )
  ------------------
  |  Branch (3737:16): [True: 11.7M, False: 55.3k]
  ------------------
 3738|  11.7M|						_lower = _mid + 1;
 3739|  55.3k|					else {
 3740|  55.3k|						_trans += (unsigned int)(_mid - _keys);
 3741|  55.3k|						goto _match;
 3742|  55.3k|					}
 3743|  15.5M|				}
 3744|  7.81M|			}
 3745|       |			
 3746|  7.75M|			_klen = (int)_sas_commands_range_lengths[cs];
 3747|  7.75M|			if ( _klen > 0 ) {
  ------------------
  |  Branch (3747:9): [True: 3.75M, False: 4.00M]
  ------------------
 3748|  3.75M|				const char *_lower = _keys;
 3749|  3.75M|				const char *_upper = _keys + (_klen<<1) - 2;
 3750|  3.75M|				const char *_mid;
 3751|  7.25M|				while ( 1 ) {
  ------------------
  |  Branch (3751:13): [True: 7.25M, Folded]
  ------------------
 3752|  7.25M|					if ( _upper < _lower ) {
  ------------------
  |  Branch (3752:11): [True: 219, False: 7.25M]
  ------------------
 3753|    219|						_trans += (unsigned int)_klen;
 3754|    219|						break;
 3755|    219|					}
 3756|       |					
 3757|  7.25M|					_mid = _lower + (((_upper-_lower) >> 1) & ~1);
 3758|  7.25M|					if ( ( (*( p))) < (*( _mid)) )
  ------------------
  |  Branch (3758:11): [True: 1.29M, False: 5.95M]
  ------------------
 3759|  1.29M|						_upper = _mid - 2;
 3760|  5.95M|					else if ( ( (*( p))) > (*( _mid + 1)) )
  ------------------
  |  Branch (3760:16): [True: 2.20M, False: 3.75M]
  ------------------
 3761|  2.20M|						_lower = _mid + 2;
 3762|  3.75M|					else {
 3763|  3.75M|						_trans += (unsigned int)((_mid - _keys)>>1);
 3764|  3.75M|						break;
 3765|  3.75M|					}
 3766|  7.25M|				}
 3767|  3.75M|			}
 3768|       |			
 3769|  7.81M|			_match: {}
 3770|  7.81M|		}
 3771|  7.81M|		cs = (int)_sas_commands_cond_targs[_trans];
 3772|       |		
 3773|  7.81M|		if ( _sas_commands_cond_actions[_trans] != 0 ) {
  ------------------
  |  Branch (3773:8): [True: 48.9k, False: 7.76M]
  ------------------
 3774|       |			
 3775|  48.9k|			_acts = ( _sas_commands_actions + (_sas_commands_cond_actions[_trans]));
 3776|  48.9k|			_nacts = (unsigned int)(*( _acts));
 3777|  48.9k|			_acts += 1;
 3778|   135k|			while ( _nacts > 0 ) {
  ------------------
  |  Branch (3778:12): [True: 86.2k, False: 48.8k]
  ------------------
 3779|  86.2k|				switch ( (*( _acts)) )
  ------------------
  |  Branch (3779:14): [True: 86.2k, False: 0]
  ------------------
 3780|  86.2k|				{
 3781|  8.00k|					case 0:  {
  ------------------
  |  Branch (3781:6): [True: 8.00k, False: 78.2k]
  ------------------
 3782|  8.00k|						{
 3783|  8.00k|#line 73 "src/txt/readstat_sas_commands_read.rl"
 3784|       |							
 3785|  8.00k|							integer = 0;
 3786|  8.00k|						}
 3787|       |						
 3788|  8.00k|#line 3789 "src/txt/readstat_sas_commands_read.c"
 3789|       |						
 3790|  8.00k|						break; 
 3791|      0|					}
 3792|  11.2k|					case 1:  {
  ------------------
  |  Branch (3792:6): [True: 11.2k, False: 75.0k]
  ------------------
 3793|  11.2k|						{
 3794|  11.2k|#line 77 "src/txt/readstat_sas_commands_read.rl"
 3795|       |							
 3796|       |							/* Saturate rather than wrap so an overlong literal reads as "too big" */
 3797|  11.2k|							if (integer > (INT64_MAX - ((( (*( p)))) - '0')) / 10) {
  ------------------
  |  Branch (3797:12): [True: 279, False: 10.9k]
  ------------------
 3798|    279|								integer = INT64_MAX;
 3799|  10.9k|							} else {
 3800|  10.9k|								integer = 10 * integer + ((( (*( p)))) - '0');
 3801|  10.9k|							}
 3802|  11.2k|						}
 3803|       |						
 3804|  11.2k|#line 3805 "src/txt/readstat_sas_commands_read.c"
 3805|       |						
 3806|  11.2k|						break; 
 3807|      0|					}
 3808|  2.36k|					case 2:  {
  ------------------
  |  Branch (3808:6): [True: 2.36k, False: 83.8k]
  ------------------
 3809|  2.36k|						{
 3810|  2.36k|#line 86 "src/txt/readstat_sas_commands_read.rl"
 3811|       |							
 3812|  2.36k|							int value = 0;
 3813|  2.36k|							if ((( (*( p)))) >= '0' && (( (*( p)))) <= '9') {
  ------------------
  |  Branch (3813:12): [True: 2.36k, False: 0]
  |  Branch (3813:35): [True: 472, False: 1.89k]
  ------------------
 3814|    472|								value = (( (*( p)))) - '0';
 3815|  1.89k|							} else if ((( (*( p)))) >= 'A' && (( (*( p)))) <= 'F') {
  ------------------
  |  Branch (3815:19): [True: 1.89k, False: 0]
  |  Branch (3815:42): [True: 877, False: 1.01k]
  ------------------
 3816|    877|								value = (( (*( p)))) - 'A' + 10;
 3817|  1.01k|							} else if ((( (*( p)))) >= 'a' && (( (*( p)))) <= 'f') {
  ------------------
  |  Branch (3817:19): [True: 1.01k, False: 0]
  |  Branch (3817:42): [True: 1.01k, False: 0]
  ------------------
 3818|  1.01k|								value = (( (*( p)))) - 'a' + 10;
 3819|  1.01k|							}
 3820|  2.36k|							integer = 16 * integer + value;
 3821|  2.36k|						}
 3822|       |						
 3823|  2.36k|#line 3824 "src/txt/readstat_sas_commands_read.c"
 3824|       |						
 3825|  2.36k|						break; 
 3826|      0|					}
 3827|    380|					case 3:  {
  ------------------
  |  Branch (3827:6): [True: 380, False: 85.8k]
  ------------------
 3828|    380|						{
 3829|    380|#line 98 "src/txt/readstat_sas_commands_read.rl"
 3830|       |							
 3831|    380|							var_col = integer - 1;
 3832|    380|							var_len = 1;
 3833|    380|						}
 3834|       |						
 3835|    380|#line 3836 "src/txt/readstat_sas_commands_read.c"
 3836|       |						
 3837|    380|						break; 
 3838|      0|					}
 3839|    372|					case 4:  {
  ------------------
  |  Branch (3839:6): [True: 372, False: 85.8k]
  ------------------
 3840|    372|						{
 3841|    372|#line 103 "src/txt/readstat_sas_commands_read.rl"
 3842|       |							
 3843|    372|							var_len = integer - var_col;
 3844|    372|						}
 3845|       |						
 3846|    372|#line 3847 "src/txt/readstat_sas_commands_read.c"
 3847|       |						
 3848|    372|						break; 
 3849|      0|					}
 3850|    297|					case 5:  {
  ------------------
  |  Branch (3850:6): [True: 297, False: 85.9k]
  ------------------
 3851|    297|						{
 3852|    297|#line 107 "src/txt/readstat_sas_commands_read.rl"
 3853|       |							
 3854|    297|							var_type = READSTAT_TYPE_STRING;
 3855|    297|						}
 3856|       |						
 3857|    297|#line 3858 "src/txt/readstat_sas_commands_read.c"
 3858|       |						
 3859|    297|						break; 
 3860|      0|					}
 3861|  1.55k|					case 6:  {
  ------------------
  |  Branch (3861:6): [True: 1.55k, False: 84.7k]
  ------------------
 3862|  1.55k|						{
 3863|  1.55k|#line 111 "src/txt/readstat_sas_commands_read.rl"
 3864|       |							
 3865|  1.55k|							var_type = READSTAT_TYPE_DOUBLE;
 3866|  1.55k|						}
 3867|       |						
 3868|  1.55k|#line 3869 "src/txt/readstat_sas_commands_read.c"
 3869|       |						
 3870|  1.55k|						break; 
 3871|      0|					}
 3872|  4.00k|					case 7:  {
  ------------------
  |  Branch (3872:6): [True: 4.00k, False: 82.2k]
  ------------------
 3873|  4.00k|						{
 3874|  4.00k|#line 115 "src/txt/readstat_sas_commands_read.rl"
 3875|       |							
 3876|  4.00k|							readstat_copy(buf, sizeof(buf), (char *)str_start, str_len);
 3877|  4.00k|						}
 3878|       |						
 3879|  4.00k|#line 3880 "src/txt/readstat_sas_commands_read.c"
 3880|       |						
 3881|  4.00k|						break; 
 3882|      0|					}
 3883|    661|					case 8:  {
  ------------------
  |  Branch (3883:6): [True: 661, False: 85.5k]
  ------------------
 3884|    661|						{
 3885|    661|#line 119 "src/txt/readstat_sas_commands_read.rl"
 3886|       |							
 3887|    661|							readstat_copy(labelset, sizeof(labelset), (char *)str_start, str_len);
 3888|    661|						}
 3889|       |						
 3890|    661|#line 3891 "src/txt/readstat_sas_commands_read.c"
 3891|       |						
 3892|    661|						break; 
 3893|      0|					}
 3894|    860|					case 9:  {
  ------------------
  |  Branch (3894:6): [True: 860, False: 85.3k]
  ------------------
 3895|    860|						{
 3896|    860|#line 123 "src/txt/readstat_sas_commands_read.rl"
 3897|       |							
 3898|    860|							readstat_copy(string_value, sizeof(string_value), (char *)str_start, str_len);
 3899|    860|						}
 3900|       |						
 3901|    860|#line 3902 "src/txt/readstat_sas_commands_read.c"
 3902|       |						
 3903|    860|						break; 
 3904|      0|					}
 3905|  2.32k|					case 10:  {
  ------------------
  |  Branch (3905:6): [True: 2.32k, False: 83.9k]
  ------------------
 3906|  2.32k|						{
 3907|  2.32k|#line 127 "src/txt/readstat_sas_commands_read.rl"
 3908|       |							
 3909|  2.32k|							readstat_copy(argname, sizeof(argname), (char *)str_start, str_len);
 3910|  2.32k|						}
 3911|       |						
 3912|  2.32k|#line 3913 "src/txt/readstat_sas_commands_read.c"
 3913|       |						
 3914|  2.32k|						break; 
 3915|      0|					}
 3916|  3.04k|					case 11:  {
  ------------------
  |  Branch (3916:6): [True: 3.04k, False: 83.2k]
  ------------------
 3917|  3.04k|						{
 3918|  3.04k|#line 131 "src/txt/readstat_sas_commands_read.rl"
 3919|       |							
 3920|  3.04k|							readstat_copy_lower(varname, sizeof(varname), (char *)str_start, str_len);
 3921|  3.04k|						}
 3922|       |						
 3923|  3.04k|#line 3924 "src/txt/readstat_sas_commands_read.c"
 3924|       |						
 3925|  3.04k|						break; 
 3926|      0|					}
 3927|  1.94k|					case 12:  {
  ------------------
  |  Branch (3927:6): [True: 1.94k, False: 84.3k]
  ------------------
 3928|  1.94k|						{
 3929|  1.94k|#line 135 "src/txt/readstat_sas_commands_read.rl"
 3930|       |							
 3931|  1.94k|							if (strcasecmp(argname, "firstobs") == 0) {
  ------------------
  |  Branch (3931:12): [True: 228, False: 1.71k]
  ------------------
 3932|    228|								schema->first_line = integer;
 3933|    228|							}
 3934|  1.94k|							if (strcasecmp(argname, "dlm") == 0) {
  ------------------
  |  Branch (3934:12): [True: 686, False: 1.25k]
  ------------------
 3935|    686|								schema->field_delimiter = integer ? integer : buf[0];
  ------------------
  |  Branch (3935:35): [True: 399, False: 287]
  ------------------
 3936|    686|							}
 3937|  1.94k|						}
 3938|       |						
 3939|  1.94k|#line 3940 "src/txt/readstat_sas_commands_read.c"
 3940|       |						
 3941|  1.94k|						break; 
 3942|      0|					}
 3943|    372|					case 13:  {
  ------------------
  |  Branch (3943:6): [True: 372, False: 85.8k]
  ------------------
 3944|    372|						{
 3945|    372|#line 144 "src/txt/readstat_sas_commands_read.rl"
 3946|       |							
 3947|    372|							readstat_schema_entry_t *entry = readstat_schema_find_or_create_entry(schema, varname);
 3948|    372|							entry->variable.type = var_type;
 3949|    372|							entry->variable.storage_width = var_len;
 3950|    372|							entry->row = var_row;
 3951|    372|							entry->col = var_col;
 3952|    372|							entry->len = var_len;
 3953|    372|						}
 3954|       |						
 3955|    372|#line 3956 "src/txt/readstat_sas_commands_read.c"
 3956|       |						
 3957|    372|						break; 
 3958|      0|					}
 3959|  1.47k|					case 14:  {
  ------------------
  |  Branch (3959:6): [True: 1.47k, False: 84.7k]
  ------------------
 3960|  1.47k|						{
 3961|  1.47k|#line 153 "src/txt/readstat_sas_commands_read.rl"
 3962|       |							
 3963|  1.47k|							readstat_schema_entry_t *entry = readstat_schema_find_or_create_entry(schema, varname);
 3964|  1.47k|							entry->variable.storage_width = var_len;
 3965|  1.47k|							entry->len = var_len;
 3966|  1.47k|						}
 3967|       |						
 3968|  1.47k|#line 3969 "src/txt/readstat_sas_commands_read.c"
 3969|       |						
 3970|  1.47k|						break; 
 3971|      0|					}
 3972|    211|					case 15:  {
  ------------------
  |  Branch (3972:6): [True: 211, False: 86.0k]
  ------------------
 3973|    211|						{
 3974|    211|#line 159 "src/txt/readstat_sas_commands_read.rl"
 3975|       |							
 3976|    211|							readstat_schema_entry_t *entry = readstat_schema_find_or_create_entry(schema, varname);
 3977|    211|							readstat_copy(entry->variable.label, sizeof(entry->variable.label), buf, sizeof(buf));
 3978|    211|						}
 3979|       |						
 3980|    211|#line 3981 "src/txt/readstat_sas_commands_read.c"
 3981|       |						
 3982|    211|						break; 
 3983|      0|					}
 3984|    274|					case 16:  {
  ------------------
  |  Branch (3984:6): [True: 274, False: 85.9k]
  ------------------
 3985|    274|						{
 3986|    274|#line 164 "src/txt/readstat_sas_commands_read.rl"
 3987|       |							
 3988|    274|							readstat_schema_entry_t *entry = readstat_schema_find_or_create_entry(schema, varname);
 3989|    274|							readstat_copy(entry->labelset, sizeof(entry->labelset), labelset, sizeof(labelset));
 3990|    274|						}
 3991|       |						
 3992|    274|#line 3993 "src/txt/readstat_sas_commands_read.c"
 3993|       |						
 3994|    274|						break; 
 3995|      0|					}
 3996|  2.84k|					case 17:  {
  ------------------
  |  Branch (3996:6): [True: 2.84k, False: 83.4k]
  ------------------
 3997|  2.84k|						{
 3998|  2.84k|#line 169 "src/txt/readstat_sas_commands_read.rl"
 3999|       |							
 4000|  2.84k|							error = submit_value_label(parser, labelset, label_type,
 4001|  2.84k|							first_integer, integer, double_value, string_value, buf,
 4002|  2.84k|							&range_values_remaining, user_ctx);
 4003|  2.84k|							if (error != READSTAT_OK)
  ------------------
  |  Branch (4003:12): [True: 94, False: 2.74k]
  ------------------
 4004|     94|							goto cleanup;
 4005|  2.84k|						}
 4006|       |						
 4007|  2.74k|#line 4008 "src/txt/readstat_sas_commands_read.c"
 4008|       |						
 4009|  2.74k|						break; 
 4010|  2.84k|					}
 4011|  3.24k|					case 18:  {
  ------------------
  |  Branch (4011:6): [True: 3.24k, False: 83.0k]
  ------------------
 4012|  3.24k|						{
 4013|  3.24k|#line 177 "src/txt/readstat_sas_commands_read.rl"
 4014|  3.24k|							str_start = p; }
 4015|       |						
 4016|  3.24k|#line 4017 "src/txt/readstat_sas_commands_read.c"
 4017|       |						
 4018|  3.24k|						break; 
 4019|  2.84k|					}
 4020|  3.95k|					case 19:  {
  ------------------
  |  Branch (4020:6): [True: 3.95k, False: 82.2k]
  ------------------
 4021|  3.95k|						{
 4022|  3.95k|#line 177 "src/txt/readstat_sas_commands_read.rl"
 4023|  3.95k|							str_len = p - str_start; }
 4024|       |						
 4025|  3.95k|#line 4026 "src/txt/readstat_sas_commands_read.c"
 4026|       |						
 4027|  3.95k|						break; 
 4028|  2.84k|					}
 4029|    819|					case 20:  {
  ------------------
  |  Branch (4029:6): [True: 819, False: 85.4k]
  ------------------
 4030|    819|						{
 4031|    819|#line 179 "src/txt/readstat_sas_commands_read.rl"
 4032|    819|							str_start = p; }
 4033|       |						
 4034|    819|#line 4035 "src/txt/readstat_sas_commands_read.c"
 4035|       |						
 4036|    819|						break; 
 4037|  2.84k|					}
 4038|  3.28k|					case 21:  {
  ------------------
  |  Branch (4038:6): [True: 3.28k, False: 82.9k]
  ------------------
 4039|  3.28k|						{
 4040|  3.28k|#line 179 "src/txt/readstat_sas_commands_read.rl"
 4041|  3.28k|							str_len = p - str_start; }
 4042|       |						
 4043|  3.28k|#line 4044 "src/txt/readstat_sas_commands_read.c"
 4044|       |						
 4045|  3.28k|						break; 
 4046|  2.84k|					}
 4047|  8.72k|					case 22:  {
  ------------------
  |  Branch (4047:6): [True: 8.72k, False: 77.5k]
  ------------------
 4048|  8.72k|						{
 4049|  8.72k|#line 187 "src/txt/readstat_sas_commands_read.rl"
 4050|  8.72k|							line_no++; line_start = p; }
 4051|       |						
 4052|  8.72k|#line 4053 "src/txt/readstat_sas_commands_read.c"
 4053|       |						
 4054|  8.72k|						break; 
 4055|  2.84k|					}
 4056|  7.58k|					case 23:  {
  ------------------
  |  Branch (4056:6): [True: 7.58k, False: 78.6k]
  ------------------
 4057|  7.58k|						{
 4058|  7.58k|#line 191 "src/txt/readstat_sas_commands_read.rl"
 4059|  7.58k|							str_start = p; }
 4060|       |						
 4061|  7.58k|#line 4062 "src/txt/readstat_sas_commands_read.c"
 4062|       |						
 4063|  7.58k|						break; 
 4064|  2.84k|					}
 4065|  7.63k|					case 24:  {
  ------------------
  |  Branch (4065:6): [True: 7.63k, False: 78.6k]
  ------------------
 4066|  7.63k|						{
 4067|  7.63k|#line 191 "src/txt/readstat_sas_commands_read.rl"
 4068|  7.63k|							str_len = p - str_start; }
 4069|       |						
 4070|  7.63k|#line 4071 "src/txt/readstat_sas_commands_read.c"
 4071|       |						
 4072|  7.63k|						break; 
 4073|  2.84k|					}
 4074|  1.09k|					case 25:  {
  ------------------
  |  Branch (4074:6): [True: 1.09k, False: 85.1k]
  ------------------
 4075|  1.09k|						{
 4076|  1.09k|#line 197 "src/txt/readstat_sas_commands_read.rl"
 4077|  1.09k|							str_start = p; }
 4078|       |						
 4079|  1.09k|#line 4080 "src/txt/readstat_sas_commands_read.c"
 4080|       |						
 4081|  1.09k|						break; 
 4082|  2.84k|					}
 4083|    194|					case 26:  {
  ------------------
  |  Branch (4083:6): [True: 194, False: 86.0k]
  ------------------
 4084|    194|						{
 4085|    194|#line 197 "src/txt/readstat_sas_commands_read.rl"
 4086|    194|							str_len = p - str_start; }
 4087|       |						
 4088|    194|#line 4089 "src/txt/readstat_sas_commands_read.c"
 4089|       |						
 4090|    194|						break; 
 4091|  2.84k|					}
 4092|    395|					case 27:  {
  ------------------
  |  Branch (4092:6): [True: 395, False: 85.8k]
  ------------------
 4093|    395|						{
 4094|    395|#line 234 "src/txt/readstat_sas_commands_read.rl"
 4095|    395|							label_type = -1; }
 4096|       |						
 4097|    395|#line 4098 "src/txt/readstat_sas_commands_read.c"
 4098|       |						
 4099|    395|						break; 
 4100|  2.84k|					}
 4101|    197|					case 28:  {
  ------------------
  |  Branch (4101:6): [True: 197, False: 86.0k]
  ------------------
 4102|    197|						{
 4103|    197|#line 236 "src/txt/readstat_sas_commands_read.rl"
 4104|    197|							label_type = LABEL_TYPE_DOUBLE; double_value = -(double)integer; }
 4105|       |						
 4106|    197|#line 4107 "src/txt/readstat_sas_commands_read.c"
 4107|       |						
 4108|    197|						break; 
 4109|  2.84k|					}
 4110|  1.47k|					case 29:  {
  ------------------
  |  Branch (4110:6): [True: 1.47k, False: 84.7k]
  ------------------
 4111|  1.47k|						{
 4112|  1.47k|#line 237 "src/txt/readstat_sas_commands_read.rl"
 4113|  1.47k|							label_type = LABEL_TYPE_DOUBLE; double_value = integer; }
 4114|       |						
 4115|  1.47k|#line 4116 "src/txt/readstat_sas_commands_read.c"
 4116|       |						
 4117|  1.47k|						break; 
 4118|  2.84k|					}
 4119|  1.08k|					case 30:  {
  ------------------
  |  Branch (4119:6): [True: 1.08k, False: 85.1k]
  ------------------
 4120|  1.08k|						{
 4121|  1.08k|#line 238 "src/txt/readstat_sas_commands_read.rl"
 4122|  1.08k|							first_integer = integer; }
 4123|       |						
 4124|  1.08k|#line 4125 "src/txt/readstat_sas_commands_read.c"
 4125|       |						
 4126|  1.08k|						break; 
 4127|  2.84k|					}
 4128|  1.07k|					case 31:  {
  ------------------
  |  Branch (4128:6): [True: 1.07k, False: 85.1k]
  ------------------
 4129|  1.07k|						{
 4130|  1.07k|#line 238 "src/txt/readstat_sas_commands_read.rl"
 4131|  1.07k|							label_type = LABEL_TYPE_RANGE; }
 4132|       |						
 4133|  1.07k|#line 4134 "src/txt/readstat_sas_commands_read.c"
 4134|       |						
 4135|  1.07k|						break; 
 4136|  2.84k|					}
 4137|    648|					case 32:  {
  ------------------
  |  Branch (4137:6): [True: 648, False: 85.6k]
  ------------------
 4138|    648|						{
 4139|    648|#line 239 "src/txt/readstat_sas_commands_read.rl"
 4140|    648|							label_type = LABEL_TYPE_STRING; }
 4141|       |						
 4142|    648|#line 4143 "src/txt/readstat_sas_commands_read.c"
 4143|       |						
 4144|    648|						break; 
 4145|  2.84k|					}
 4146|    212|					case 33:  {
  ------------------
  |  Branch (4146:6): [True: 212, False: 86.0k]
  ------------------
 4147|    212|						{
 4148|    212|#line 240 "src/txt/readstat_sas_commands_read.rl"
 4149|    212|							label_type = LABEL_TYPE_STRING; }
 4150|       |						
 4151|    212|#line 4152 "src/txt/readstat_sas_commands_read.c"
 4152|       |						
 4153|    212|						break; 
 4154|  2.84k|					}
 4155|    260|					case 34:  {
  ------------------
  |  Branch (4155:6): [True: 260, False: 85.9k]
  ------------------
 4156|    260|						{
 4157|    260|#line 241 "src/txt/readstat_sas_commands_read.rl"
 4158|    260|							label_type = LABEL_TYPE_OTHER; }
 4159|       |						
 4160|    260|#line 4161 "src/txt/readstat_sas_commands_read.c"
 4161|       |						
 4162|    260|						break; 
 4163|  2.84k|					}
 4164|  1.47k|					case 35:  {
  ------------------
  |  Branch (4164:6): [True: 1.47k, False: 84.7k]
  ------------------
 4165|  1.47k|						{
 4166|  1.47k|#line 244 "src/txt/readstat_sas_commands_read.rl"
 4167|  1.47k|							var_len = integer; }
 4168|       |						
 4169|  1.47k|#line 4170 "src/txt/readstat_sas_commands_read.c"
 4170|       |						
 4171|  1.47k|						break; 
 4172|  2.84k|					}
 4173|    274|					case 36:  {
  ------------------
  |  Branch (4173:6): [True: 274, False: 85.9k]
  ------------------
 4174|    274|						{
 4175|    274|#line 347 "src/txt/readstat_sas_commands_read.rl"
 4176|    274|							var_row = integer - 1; }
 4177|       |						
 4178|    274|#line 4179 "src/txt/readstat_sas_commands_read.c"
 4179|       |						
 4180|    274|						break; 
 4181|  2.84k|					}
 4182|    445|					case 37:  {
  ------------------
  |  Branch (4182:6): [True: 445, False: 85.8k]
  ------------------
 4183|    445|						{
 4184|    445|#line 351 "src/txt/readstat_sas_commands_read.rl"
 4185|    445|							var_row = 0; }
 4186|       |						
 4187|    445|#line 4188 "src/txt/readstat_sas_commands_read.c"
 4188|       |						
 4189|    445|						break; 
 4190|  2.84k|					}
 4191|  86.2k|				}
 4192|  86.1k|				_nacts -= 1;
 4193|  86.1k|				_acts += 1;
 4194|  86.1k|			}
 4195|       |			
 4196|  48.9k|		}
 4197|       |		
 4198|  7.81M|		if ( p == eof ) {
  ------------------
  |  Branch (4198:8): [True: 1.17k, False: 7.81M]
  ------------------
 4199|  1.17k|			if ( cs >= 1159 )
  ------------------
  |  Branch (4199:9): [True: 234, False: 941]
  ------------------
 4200|    234|				goto _out;
 4201|  1.17k|		}
 4202|  7.81M|		else {
 4203|  7.81M|			if ( cs != 0 ) {
  ------------------
  |  Branch (4203:9): [True: 7.81M, False: 39]
  ------------------
 4204|  7.81M|				p += 1;
 4205|  7.81M|				goto _resume;
 4206|  7.81M|			}
 4207|  7.81M|		}
 4208|  1.21k|		_out: {}
 4209|  1.21k|	}
 4210|       |	
 4211|      0|#line 410 "src/txt/readstat_sas_commands_read.rl"
 4212|       |	
 4213|       |	
 4214|       |	/* suppress warnings */
 4215|      0|	(void)sas_commands_en_main;
 4216|       |	
 4217|  1.21k|	if (cs < 
  ------------------
  |  Branch (4217:6): [True: 980, False: 234]
  ------------------
 4218|  1.21k|#line 4219 "src/txt/readstat_sas_commands_read.c"
 4219|  1.21k|	1159
 4220|  1.21k|#line 415 "src/txt/readstat_sas_commands_read.rl"
 4221|  1.21k|	) {
 4222|    980|		char error_buf[1024];
 4223|    980|		if (p == pe) {
  ------------------
  |  Branch (4223:7): [True: 941, False: 39]
  ------------------
 4224|    941|			snprintf(error_buf, sizeof(error_buf), "Error parsing SAS command file (end-of-file unexpectedly reached)");
 4225|    941|		} else {
 4226|     39|			snprintf(error_buf, sizeof(error_buf), "Error parsing SAS command file around line #%d, col #%ld (0x%02x = %c)",
 4227|     39|			line_no + 1, (long)(p - line_start + 1), *p, *p);
 4228|     39|		}
 4229|    980|		if (parser->handlers.error) {
  ------------------
  |  Branch (4229:7): [True: 0, False: 980]
  ------------------
 4230|      0|			parser->handlers.error(error_buf, user_ctx);
 4231|      0|		}
 4232|    980|		error = READSTAT_ERROR_PARSE;
 4233|    980|		goto cleanup;
 4234|    980|	}
 4235|       |	
 4236|    234|	error = submit_columns(parser, schema, user_ctx);
 4237|       |	
 4238|  1.30k|	cleanup:
 4239|  1.30k|	parser->io->close(parser->io->io_ctx);
 4240|  1.30k|	free(bytes);
 4241|  1.30k|	if (error != READSTAT_OK) {
  ------------------
  |  Branch (4241:6): [True: 1.07k, False: 234]
  ------------------
 4242|  1.07k|		if (outError)
  ------------------
  |  Branch (4242:7): [True: 0, False: 1.07k]
  ------------------
 4243|      0|			*outError = error;
 4244|  1.07k|		readstat_schema_free(schema);
 4245|  1.07k|		schema = NULL;
 4246|  1.07k|	}
 4247|       |	
 4248|  1.30k|	return schema;
 4249|    234|}

readstat_schema_free:
    7|  1.30k|void readstat_schema_free(readstat_schema_t *schema) {
    8|  1.30k|    if (schema) {
  ------------------
  |  Branch (8:9): [True: 1.30k, False: 0]
  ------------------
    9|  1.30k|        free(schema->entries);
   10|  1.30k|        free(schema);
   11|  1.30k|    }
   12|  1.30k|}
readstat_schema_find_or_create_entry:
   14|  2.33k|readstat_schema_entry_t *readstat_schema_find_or_create_entry(readstat_schema_t *dct, const char *var_name) {
   15|  2.33k|    readstat_schema_entry_t *entry = NULL;
   16|  2.33k|    int i;
   17|       |    /* linear search. this is shitty, but whatever */
   18|  28.0k|    for (i=0; i<dct->entry_count; i++) {
  ------------------
  |  Branch (18:15): [True: 26.8k, False: 1.19k]
  ------------------
   19|  26.8k|        if (strcmp(dct->entries[i].variable.name, var_name) == 0) {
  ------------------
  |  Branch (19:13): [True: 1.14k, False: 25.7k]
  ------------------
   20|  1.14k|            entry = &dct->entries[i];
   21|  1.14k|            break;
   22|  1.14k|        }
   23|  26.8k|    }
   24|  2.33k|    if (!entry) {
  ------------------
  |  Branch (24:9): [True: 1.19k, False: 1.14k]
  ------------------
   25|  1.19k|        dct->entries = realloc(dct->entries, sizeof(readstat_schema_entry_t) * (dct->entry_count + 1));
   26|  1.19k|        entry = &dct->entries[dct->entry_count];
   27|  1.19k|        memset(entry, 0, sizeof(readstat_schema_entry_t));
   28|       |        
   29|  1.19k|        readstat_copy(entry->variable.name, sizeof(entry->variable.name), var_name, strlen(var_name));
   30|  1.19k|        entry->decimal_separator = '.';
   31|  1.19k|        entry->variable.index = dct->entry_count++;
   32|  1.19k|    }
   33|  2.33k|    return entry;
   34|  2.33k|}

