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

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

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

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

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

submit_value_label:
   10|  3.00k|        uint64_t *range_values_remaining, void *user_ctx) {
   11|  3.00k|    if (!parser->handlers.value_label)
  ------------------
  |  Branch (11:9): [True: 0, False: 3.00k]
  ------------------
   12|      0|        return READSTAT_OK;
   13|       |
   14|  3.00k|    int cb_retval = READSTAT_HANDLER_OK;
  ------------------
  |  |   22|  3.00k|#define READSTAT_HANDLER_OK             0
  ------------------
   15|  3.00k|    if (label_type == LABEL_TYPE_RANGE) {
  ------------------
  |  Branch (15:9): [True: 1.07k, False: 1.92k]
  ------------------
   16|  1.07k|        if (first_integer > last_integer)
  ------------------
  |  Branch (16:13): [True: 427, False: 652]
  ------------------
   17|    427|            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|    652|        uint64_t span = (uint64_t)last_integer - (uint64_t)first_integer;
   23|    652|        if (span >= *range_values_remaining)
  ------------------
  |  Branch (23:13): [True: 101, False: 551]
  ------------------
   24|    101|            return READSTAT_ERROR_PARSE;
   25|    551|        *range_values_remaining -= span + 1;
   26|       |
   27|    551|        int64_t i = first_integer;
   28|  10.4M|        while (1) {
  ------------------
  |  Branch (28:16): [True: 10.4M, Folded]
  ------------------
   29|  10.4M|            readstat_value_t value = {
   30|  10.4M|                .type = READSTAT_TYPE_DOUBLE,
   31|  10.4M|                .v = { .double_value = i } };
   32|  10.4M|            cb_retval = parser->handlers.value_label(labelset, value, buf, user_ctx);
   33|  10.4M|            if (cb_retval != READSTAT_HANDLER_OK)
  ------------------
  |  |   22|  10.4M|#define READSTAT_HANDLER_OK             0
  ------------------
  |  Branch (33:17): [True: 0, False: 10.4M]
  ------------------
   34|      0|                goto cleanup;
   35|       |            /* Compare before incrementing so last_integer == INT64_MAX can't overflow */
   36|  10.4M|            if (i == last_integer)
  ------------------
  |  Branch (36:17): [True: 551, False: 10.4M]
  ------------------
   37|    551|                break;
   38|  10.4M|            i++;
   39|  10.4M|        }
   40|  1.92k|    } else if (label_type != LABEL_TYPE_OTHER) {
  ------------------
  |  Branch (40:16): [True: 1.54k, False: 380]
  ------------------
   41|       |
   42|  1.54k|        readstat_value_t value = { { 0 } };
   43|  1.54k|        if (label_type == LABEL_TYPE_DOUBLE) {
  ------------------
  |  Branch (43:13): [True: 567, False: 979]
  ------------------
   44|    567|            value.type = READSTAT_TYPE_DOUBLE;
   45|    567|            value.v.double_value = double_value;
   46|    979|        } else if (label_type == LABEL_TYPE_STRING) {
  ------------------
  |  Branch (46:20): [True: 567, False: 412]
  ------------------
   47|    567|            value.type = READSTAT_TYPE_STRING;
   48|    567|            value.v.string_value = string_value;
   49|    567|        } else if (label_type == LABEL_TYPE_NAN) {
  ------------------
  |  Branch (49:20): [True: 412, False: 0]
  ------------------
   50|    412|            value.type = READSTAT_TYPE_DOUBLE;
   51|    412|            value.v.double_value = NAN;
   52|    412|        }
   53|       |
   54|  1.54k|        cb_retval = parser->handlers.value_label(labelset, value, buf, user_ctx);
   55|  1.54k|    }
   56|       |
   57|  2.47k|cleanup:
   58|  2.47k|    return (cb_retval == READSTAT_HANDLER_OK) ? READSTAT_OK : READSTAT_ERROR_USER_ABORT;
  ------------------
  |  |   22|  2.47k|#define READSTAT_HANDLER_OK             0
  ------------------
  |  Branch (58:12): [True: 2.47k, False: 0]
  ------------------
   59|  3.00k|}
submit_columns:
   61|    222|readstat_error_t submit_columns(readstat_parser_t *parser, readstat_schema_t *dct, void *user_ctx) {
   62|    222|    int i;
   63|    222|    int partial_entry_count = 0;
   64|  1.25k|    for (i=0; i<dct->entry_count; i++) {
  ------------------
  |  Branch (64:15): [True: 1.03k, False: 222]
  ------------------
   65|  1.03k|        readstat_schema_entry_t *entry = &dct->entries[i];
   66|  1.03k|        if (dct->rows_per_observation < entry->row + 1) {
  ------------------
  |  Branch (66:13): [True: 80, False: 951]
  ------------------
   67|     80|            dct->rows_per_observation = entry->row + 1;
   68|     80|        }
   69|  1.03k|    }
   70|       |
   71|    222|    if (!parser->handlers.variable)
  ------------------
  |  Branch (71:9): [True: 0, False: 222]
  ------------------
   72|      0|        return READSTAT_OK;
   73|       |
   74|  1.25k|    for (i=0; i<dct->entry_count; i++) {
  ------------------
  |  Branch (74:15): [True: 1.03k, False: 222]
  ------------------
   75|  1.03k|        readstat_schema_entry_t *entry = &dct->entries[i];
   76|  1.03k|        entry->variable.index = i;
   77|  1.03k|        entry->variable.index_after_skipping = partial_entry_count;
   78|  1.03k|        if (entry->variable.type == READSTAT_TYPE_STRING)
  ------------------
  |  Branch (78:13): [True: 845, False: 186]
  ------------------
   79|    845|            entry->variable.storage_width = entry->len;
   80|  1.03k|        int cb_retval = parser->handlers.variable(i, &entry->variable,
   81|  1.03k|            entry->labelset[0] ? entry->labelset : NULL, user_ctx);
  ------------------
  |  Branch (81:13): [True: 70, False: 961]
  ------------------
   82|  1.03k|        if (cb_retval == READSTAT_HANDLER_SKIP_VARIABLE) {
  ------------------
  |  |   24|  1.03k|#define READSTAT_HANDLER_SKIP_VARIABLE  2
  ------------------
  |  Branch (82:13): [True: 0, False: 1.03k]
  ------------------
   83|      0|            entry->skip = 1;
   84|  1.03k|        } else if (cb_retval == READSTAT_HANDLER_ABORT) {
  ------------------
  |  |   23|  1.03k|#define READSTAT_HANDLER_ABORT          1
  ------------------
  |  Branch (84:20): [True: 0, False: 1.03k]
  ------------------
   85|      0|            return READSTAT_ERROR_USER_ABORT;
   86|  1.03k|        } else {
   87|  1.03k|            partial_entry_count++;
   88|  1.03k|        }
   89|  1.03k|    }
   90|    222|    return READSTAT_OK;
   91|    222|}

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

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

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

