fuzzer_parser_init:
   33|     77|readstat_parser_t *fuzzer_parser_init(const uint8_t *Data, size_t Size) {
   34|     77|    readstat_parser_t *parser = readstat_parser_init();
   35|     77|    readstat_set_open_handler(parser, rt_open_handler);
   36|     77|    readstat_set_close_handler(parser, rt_close_handler);
   37|     77|    readstat_set_seek_handler(parser, rt_seek_handler);
   38|     77|    readstat_set_read_handler(parser, rt_read_handler);
   39|     77|    readstat_set_update_handler(parser, rt_update_handler);
   40|       |
   41|     77|    readstat_set_metadata_handler(parser, &handle_metadata);
   42|     77|    readstat_set_note_handler(parser, &handle_note);
   43|     77|    readstat_set_variable_handler(parser, &handle_variable);
   44|     77|    readstat_set_fweight_handler(parser, &handle_fweight);
   45|     77|    readstat_set_value_handler(parser, &handle_value);
   46|     77|    readstat_set_value_label_handler(parser, &handle_value_label);
   47|       |
   48|     77|    return parser;
   49|     77|}

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

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

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

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

readstat_schema_free:
    7|     77|void readstat_schema_free(readstat_schema_t *schema) {
    8|     77|    if (schema) {
  ------------------
  |  Branch (8:9): [True: 77, False: 0]
  ------------------
    9|     77|        free(schema->entries);
   10|     77|        free(schema);
   11|     77|    }
   12|     77|}

readstat_parse_stata_dictionary:
  495|     77|const char *filepath, void *user_ctx, readstat_error_t *outError) {
  496|     77|	if (parser->io->open(filepath, parser->io->io_ctx) == -1) {
  ------------------
  |  Branch (496:6): [True: 0, False: 77]
  ------------------
  497|      0|		if (outError)
  ------------------
  |  Branch (497:7): [True: 0, False: 0]
  ------------------
  498|      0|			*outError = READSTAT_ERROR_OPEN;
  499|      0|		return NULL;
  500|      0|	}
  501|     77|	readstat_schema_t *schema = NULL;
  502|     77|	unsigned char *bytes = NULL;
  503|     77|	int cb_return_value = READSTAT_HANDLER_OK;
  504|     77|	int total_entry_count = 0;
  505|     77|	int partial_entry_count = 0;
  506|     77|	readstat_error_t error = READSTAT_OK;
  507|     77|	ssize_t len = parser->io->seek(0, READSTAT_SEEK_END, parser->io->io_ctx);
  508|     77|	if (len == -1) {
  ------------------
  |  Branch (508:6): [True: 0, False: 77]
  ------------------
  509|      0|		error = READSTAT_ERROR_SEEK;
  510|      0|		goto cleanup;
  511|      0|	}
  512|     77|	parser->io->seek(0, READSTAT_SEEK_SET, parser->io->io_ctx);
  513|       |	
  514|     77|	bytes = malloc(len);
  515|       |	
  516|     77|	parser->io->read(bytes, len, parser->io->io_ctx);
  517|       |	
  518|     77|	unsigned char *p = bytes;
  519|     77|	unsigned char *pe = bytes + len;
  520|       |	
  521|     77|	unsigned char *str_start = NULL;
  522|       |	
  523|     77|	size_t str_len = 0;
  524|       |	
  525|     77|	int cs;
  526|       |	//    u_char *eof = pe;
  527|       |	
  528|     77|	int integer = 0;
  529|     77|	int current_row = 0;
  530|     77|	int current_col = 0;
  531|     77|	int line_no = 0;
  532|     77|	unsigned char *line_start = p;
  533|       |	
  534|     77|	readstat_schema_entry_t current_entry;
  535|       |	
  536|     77|	if ((schema = calloc(1, sizeof(readstat_schema_t))) == NULL) {
  ------------------
  |  Branch (536:6): [True: 0, False: 77]
  ------------------
  537|      0|		error = READSTAT_ERROR_MALLOC;
  538|      0|		goto cleanup;
  539|      0|	}
  540|       |	
  541|     77|	schema->rows_per_observation = 1;
  542|       |	
  543|       |	
  544|     77|#line 545 "src/txt/readstat_stata_dictionary_read.c"
  545|     77|	{
  546|     77|		cs = (int)stata_dictionary_start;
  547|     77|	}
  548|       |	
  549|     77|#line 550 "src/txt/readstat_stata_dictionary_read.c"
  550|     77|	{
  551|     77|		int _klen;
  552|     77|		unsigned int _trans = 0;
  553|     77|		const char * _keys;
  554|     77|		const signed char * _acts;
  555|     77|		unsigned int _nacts;
  556|  2.16k|		_resume: {}
  557|  2.16k|		if ( p == pe )
  ------------------
  |  Branch (557:8): [True: 45, False: 2.12k]
  ------------------
  558|     45|			goto _out;
  559|  2.12k|		_keys = ( _stata_dictionary_trans_keys + (_stata_dictionary_key_offsets[cs]));
  560|  2.12k|		_trans = (unsigned int)_stata_dictionary_index_offsets[cs];
  561|       |		
  562|  2.12k|		_klen = (int)_stata_dictionary_single_lengths[cs];
  563|  2.12k|		if ( _klen > 0 ) {
  ------------------
  |  Branch (563:8): [True: 2.12k, False: 0]
  ------------------
  564|  2.12k|			const char *_lower = _keys;
  565|  2.12k|			const char *_upper = _keys + _klen - 1;
  566|  2.12k|			const char *_mid;
  567|  5.22k|			while ( 1 ) {
  ------------------
  |  Branch (567:12): [True: 5.22k, Folded]
  ------------------
  568|  5.22k|				if ( _upper < _lower ) {
  ------------------
  |  Branch (568:10): [True: 1.44k, False: 3.78k]
  ------------------
  569|  1.44k|					_keys += _klen;
  570|  1.44k|					_trans += (unsigned int)_klen;
  571|  1.44k|					break;
  572|  1.44k|				}
  573|       |				
  574|  3.78k|				_mid = _lower + ((_upper-_lower) >> 1);
  575|  3.78k|				if ( ( (*( p))) < (*( _mid)) )
  ------------------
  |  Branch (575:10): [True: 1.25k, False: 2.52k]
  ------------------
  576|  1.25k|					_upper = _mid - 1;
  577|  2.52k|				else if ( ( (*( p))) > (*( _mid)) )
  ------------------
  |  Branch (577:15): [True: 1.85k, False: 676]
  ------------------
  578|  1.85k|					_lower = _mid + 1;
  579|    676|				else {
  580|    676|					_trans += (unsigned int)(_mid - _keys);
  581|    676|					goto _match;
  582|    676|				}
  583|  3.78k|			}
  584|  2.12k|		}
  585|       |		
  586|  1.44k|		_klen = (int)_stata_dictionary_range_lengths[cs];
  587|  1.44k|		if ( _klen > 0 ) {
  ------------------
  |  Branch (587:8): [True: 0, False: 1.44k]
  ------------------
  588|      0|			const char *_lower = _keys;
  589|      0|			const char *_upper = _keys + (_klen<<1) - 2;
  590|      0|			const char *_mid;
  591|      0|			while ( 1 ) {
  ------------------
  |  Branch (591:12): [True: 0, Folded]
  ------------------
  592|      0|				if ( _upper < _lower ) {
  ------------------
  |  Branch (592:10): [True: 0, False: 0]
  ------------------
  593|      0|					_trans += (unsigned int)_klen;
  594|      0|					break;
  595|      0|				}
  596|       |				
  597|      0|				_mid = _lower + (((_upper-_lower) >> 1) & ~1);
  598|      0|				if ( ( (*( p))) < (*( _mid)) )
  ------------------
  |  Branch (598:10): [True: 0, False: 0]
  ------------------
  599|      0|					_upper = _mid - 2;
  600|      0|				else if ( ( (*( p))) > (*( _mid + 1)) )
  ------------------
  |  Branch (600:15): [True: 0, False: 0]
  ------------------
  601|      0|					_lower = _mid + 2;
  602|      0|				else {
  603|      0|					_trans += (unsigned int)((_mid - _keys)>>1);
  604|      0|					break;
  605|      0|				}
  606|      0|			}
  607|      0|		}
  608|       |		
  609|  2.12k|		_match: {}
  610|  2.12k|		cs = (int)_stata_dictionary_cond_targs[_trans];
  611|       |		
  612|  2.12k|		if ( _stata_dictionary_cond_actions[_trans] != 0 ) {
  ------------------
  |  Branch (612:8): [True: 326, False: 1.79k]
  ------------------
  613|       |			
  614|    326|			_acts = ( _stata_dictionary_actions + (_stata_dictionary_cond_actions[_trans]));
  615|    326|			_nacts = (unsigned int)(*( _acts));
  616|    326|			_acts += 1;
  617|    652|			while ( _nacts > 0 ) {
  ------------------
  |  Branch (617:12): [True: 326, False: 326]
  ------------------
  618|    326|				switch ( (*( _acts)) )
  ------------------
  |  Branch (618:14): [True: 326, False: 0]
  ------------------
  619|    326|				{
  620|      0|					case 0:  {
  ------------------
  |  Branch (620:6): [True: 0, False: 326]
  ------------------
  621|      0|						{
  622|      0|#line 63 "src/txt/readstat_stata_dictionary_read.rl"
  623|       |							
  624|      0|							integer = 0;
  625|      0|						}
  626|       |						
  627|      0|#line 628 "src/txt/readstat_stata_dictionary_read.c"
  628|       |						
  629|      0|						break; 
  630|      0|					}
  631|      0|					case 1:  {
  ------------------
  |  Branch (631:6): [True: 0, False: 326]
  ------------------
  632|      0|						{
  633|      0|#line 67 "src/txt/readstat_stata_dictionary_read.rl"
  634|       |							
  635|      0|							integer = 10 * integer + ((( (*( p)))) - '0');
  636|      0|						}
  637|       |						
  638|      0|#line 639 "src/txt/readstat_stata_dictionary_read.c"
  639|       |						
  640|      0|						break; 
  641|      0|					}
  642|      0|					case 2:  {
  ------------------
  |  Branch (642:6): [True: 0, False: 326]
  ------------------
  643|      0|						{
  644|      0|#line 71 "src/txt/readstat_stata_dictionary_read.rl"
  645|       |							
  646|      0|							memset(&current_entry, 0, sizeof(readstat_schema_entry_t));
  647|      0|							current_entry.decimal_separator = '.';
  648|      0|							current_entry.variable.type = READSTAT_TYPE_DOUBLE;
  649|      0|							current_entry.variable.index = total_entry_count;
  650|      0|						}
  651|       |						
  652|      0|#line 653 "src/txt/readstat_stata_dictionary_read.c"
  653|       |						
  654|      0|						break; 
  655|      0|					}
  656|      0|					case 3:  {
  ------------------
  |  Branch (656:6): [True: 0, False: 326]
  ------------------
  657|      0|						{
  658|      0|#line 78 "src/txt/readstat_stata_dictionary_read.rl"
  659|       |							
  660|      0|							current_entry.row = current_row;
  661|      0|							current_entry.col = current_col;
  662|      0|							current_col += current_entry.len;
  663|      0|							cb_return_value = READSTAT_HANDLER_OK;
  664|      0|							if (parser->handlers.variable) {
  ------------------
  |  Branch (664:12): [True: 0, False: 0]
  ------------------
  665|      0|								current_entry.variable.index_after_skipping = partial_entry_count;
  666|      0|								cb_return_value = parser->handlers.variable(total_entry_count, &current_entry.variable, NULL, user_ctx);
  667|      0|								if (cb_return_value == READSTAT_HANDLER_ABORT) {
  ------------------
  |  Branch (667:13): [True: 0, False: 0]
  ------------------
  668|      0|									error = READSTAT_ERROR_USER_ABORT;
  669|      0|									goto cleanup;
  670|      0|								}
  671|      0|							}
  672|      0|							if (cb_return_value == READSTAT_HANDLER_SKIP_VARIABLE) {
  ------------------
  |  Branch (672:12): [True: 0, False: 0]
  ------------------
  673|      0|								current_entry.skip = 1;
  674|      0|							} else {
  675|      0|								partial_entry_count++;
  676|      0|							} 
  677|      0|							schema->entries = realloc(schema->entries, sizeof(readstat_schema_entry_t) * (schema->entry_count+1));
  678|      0|							memcpy(&schema->entries[schema->entry_count++], &current_entry, sizeof(readstat_schema_entry_t));
  679|      0|							total_entry_count++;
  680|      0|						}
  681|       |						
  682|      0|#line 683 "src/txt/readstat_stata_dictionary_read.c"
  683|       |						
  684|      0|						break; 
  685|      0|					}
  686|      0|					case 4:  {
  ------------------
  |  Branch (686:6): [True: 0, False: 326]
  ------------------
  687|      0|						{
  688|      0|#line 101 "src/txt/readstat_stata_dictionary_read.rl"
  689|       |							
  690|      0|							readstat_copy(schema->filename, sizeof(schema->filename), (char *)str_start, str_len);
  691|      0|						}
  692|       |						
  693|      0|#line 694 "src/txt/readstat_stata_dictionary_read.c"
  694|       |						
  695|      0|						break; 
  696|      0|					}
  697|      0|					case 5:  {
  ------------------
  |  Branch (697:6): [True: 0, False: 326]
  ------------------
  698|      0|						{
  699|      0|#line 105 "src/txt/readstat_stata_dictionary_read.rl"
  700|       |							
  701|      0|							readstat_copy(current_entry.variable.name, sizeof(current_entry.variable.name),
  702|      0|							(char *)str_start, str_len);
  703|      0|						}
  704|       |						
  705|      0|#line 706 "src/txt/readstat_stata_dictionary_read.c"
  706|       |						
  707|      0|						break; 
  708|      0|					}
  709|      0|					case 6:  {
  ------------------
  |  Branch (709:6): [True: 0, False: 326]
  ------------------
  710|      0|						{
  711|      0|#line 110 "src/txt/readstat_stata_dictionary_read.rl"
  712|       |							
  713|      0|							readstat_copy(current_entry.variable.label, sizeof(current_entry.variable.label),
  714|      0|							(char *)str_start, str_len);
  715|      0|						}
  716|       |						
  717|      0|#line 718 "src/txt/readstat_stata_dictionary_read.c"
  718|       |						
  719|      0|						break; 
  720|      0|					}
  721|      0|					case 7:  {
  ------------------
  |  Branch (721:6): [True: 0, False: 326]
  ------------------
  722|      0|						{
  723|      0|#line 115 "src/txt/readstat_stata_dictionary_read.rl"
  724|      0|							str_start = p; }
  725|       |						
  726|      0|#line 727 "src/txt/readstat_stata_dictionary_read.c"
  727|       |						
  728|      0|						break; 
  729|      0|					}
  730|      0|					case 8:  {
  ------------------
  |  Branch (730:6): [True: 0, False: 326]
  ------------------
  731|      0|						{
  732|      0|#line 115 "src/txt/readstat_stata_dictionary_read.rl"
  733|      0|							str_len = p - str_start; }
  734|       |						
  735|      0|#line 736 "src/txt/readstat_stata_dictionary_read.c"
  736|       |						
  737|      0|						break; 
  738|      0|					}
  739|      0|					case 9:  {
  ------------------
  |  Branch (739:6): [True: 0, False: 326]
  ------------------
  740|      0|						{
  741|      0|#line 117 "src/txt/readstat_stata_dictionary_read.rl"
  742|      0|							str_start = p; }
  743|       |						
  744|      0|#line 745 "src/txt/readstat_stata_dictionary_read.c"
  745|       |						
  746|      0|						break; 
  747|      0|					}
  748|      0|					case 10:  {
  ------------------
  |  Branch (748:6): [True: 0, False: 326]
  ------------------
  749|      0|						{
  750|      0|#line 117 "src/txt/readstat_stata_dictionary_read.rl"
  751|      0|							str_len = p - str_start; }
  752|       |						
  753|      0|#line 754 "src/txt/readstat_stata_dictionary_read.c"
  754|       |						
  755|      0|						break; 
  756|      0|					}
  757|      0|					case 11:  {
  ------------------
  |  Branch (757:6): [True: 0, False: 326]
  ------------------
  758|      0|						{
  759|      0|#line 119 "src/txt/readstat_stata_dictionary_read.rl"
  760|      0|							str_start = p; }
  761|       |						
  762|      0|#line 763 "src/txt/readstat_stata_dictionary_read.c"
  763|       |						
  764|      0|						break; 
  765|      0|					}
  766|      0|					case 12:  {
  ------------------
  |  Branch (766:6): [True: 0, False: 326]
  ------------------
  767|      0|						{
  768|      0|#line 119 "src/txt/readstat_stata_dictionary_read.rl"
  769|      0|							str_len = p - str_start; }
  770|       |						
  771|      0|#line 772 "src/txt/readstat_stata_dictionary_read.c"
  772|       |						
  773|      0|						break; 
  774|      0|					}
  775|    326|					case 13:  {
  ------------------
  |  Branch (775:6): [True: 326, False: 0]
  ------------------
  776|    326|						{
  777|    326|#line 121 "src/txt/readstat_stata_dictionary_read.rl"
  778|    326|							line_no++; line_start = p; }
  779|       |						
  780|    326|#line 781 "src/txt/readstat_stata_dictionary_read.c"
  781|       |						
  782|    326|						break; 
  783|      0|					}
  784|      0|					case 14:  {
  ------------------
  |  Branch (784:6): [True: 0, False: 326]
  ------------------
  785|      0|						{
  786|      0|#line 131 "src/txt/readstat_stata_dictionary_read.rl"
  787|      0|							schema->rows_per_observation = integer; }
  788|       |						
  789|      0|#line 790 "src/txt/readstat_stata_dictionary_read.c"
  790|       |						
  791|      0|						break; 
  792|      0|					}
  793|      0|					case 15:  {
  ------------------
  |  Branch (793:6): [True: 0, False: 326]
  ------------------
  794|      0|						{
  795|      0|#line 133 "src/txt/readstat_stata_dictionary_read.rl"
  796|      0|							current_row = integer - 1; }
  797|       |						
  798|      0|#line 799 "src/txt/readstat_stata_dictionary_read.c"
  799|       |						
  800|      0|						break; 
  801|      0|					}
  802|      0|					case 16:  {
  ------------------
  |  Branch (802:6): [True: 0, False: 326]
  ------------------
  803|      0|						{
  804|      0|#line 135 "src/txt/readstat_stata_dictionary_read.rl"
  805|      0|							current_col = integer - 1; }
  806|       |						
  807|      0|#line 808 "src/txt/readstat_stata_dictionary_read.c"
  808|       |						
  809|      0|						break; 
  810|      0|					}
  811|      0|					case 17:  {
  ------------------
  |  Branch (811:6): [True: 0, False: 326]
  ------------------
  812|      0|						{
  813|      0|#line 137 "src/txt/readstat_stata_dictionary_read.rl"
  814|      0|							current_row++; }
  815|       |						
  816|      0|#line 817 "src/txt/readstat_stata_dictionary_read.c"
  817|       |						
  818|      0|						break; 
  819|      0|					}
  820|      0|					case 18:  {
  ------------------
  |  Branch (820:6): [True: 0, False: 326]
  ------------------
  821|      0|						{
  822|      0|#line 137 "src/txt/readstat_stata_dictionary_read.rl"
  823|      0|							current_row += (integer - 1); }
  824|       |						
  825|      0|#line 826 "src/txt/readstat_stata_dictionary_read.c"
  826|       |						
  827|      0|						break; 
  828|      0|					}
  829|      0|					case 19:  {
  ------------------
  |  Branch (829:6): [True: 0, False: 326]
  ------------------
  830|      0|						{
  831|      0|#line 141 "src/txt/readstat_stata_dictionary_read.rl"
  832|      0|							schema->cols_per_observation = integer; }
  833|       |						
  834|      0|#line 835 "src/txt/readstat_stata_dictionary_read.c"
  835|       |						
  836|      0|						break; 
  837|      0|					}
  838|      0|					case 20:  {
  ------------------
  |  Branch (838:6): [True: 0, False: 326]
  ------------------
  839|      0|						{
  840|      0|#line 143 "src/txt/readstat_stata_dictionary_read.rl"
  841|      0|							schema->first_line = integer - 1; }
  842|       |						
  843|      0|#line 844 "src/txt/readstat_stata_dictionary_read.c"
  844|       |						
  845|      0|						break; 
  846|      0|					}
  847|      0|					case 21:  {
  ------------------
  |  Branch (847:6): [True: 0, False: 326]
  ------------------
  848|      0|						{
  849|      0|#line 147 "src/txt/readstat_stata_dictionary_read.rl"
  850|      0|							current_entry.variable.type = READSTAT_TYPE_INT8; }
  851|       |						
  852|      0|#line 853 "src/txt/readstat_stata_dictionary_read.c"
  853|       |						
  854|      0|						break; 
  855|      0|					}
  856|      0|					case 22:  {
  ------------------
  |  Branch (856:6): [True: 0, False: 326]
  ------------------
  857|      0|						{
  858|      0|#line 148 "src/txt/readstat_stata_dictionary_read.rl"
  859|      0|							current_entry.variable.type = READSTAT_TYPE_INT16; }
  860|       |						
  861|      0|#line 862 "src/txt/readstat_stata_dictionary_read.c"
  862|       |						
  863|      0|						break; 
  864|      0|					}
  865|      0|					case 23:  {
  ------------------
  |  Branch (865:6): [True: 0, False: 326]
  ------------------
  866|      0|						{
  867|      0|#line 149 "src/txt/readstat_stata_dictionary_read.rl"
  868|      0|							current_entry.variable.type = READSTAT_TYPE_INT32; }
  869|       |						
  870|      0|#line 871 "src/txt/readstat_stata_dictionary_read.c"
  871|       |						
  872|      0|						break; 
  873|      0|					}
  874|      0|					case 24:  {
  ------------------
  |  Branch (874:6): [True: 0, False: 326]
  ------------------
  875|      0|						{
  876|      0|#line 150 "src/txt/readstat_stata_dictionary_read.rl"
  877|      0|							current_entry.variable.type = READSTAT_TYPE_FLOAT; }
  878|       |						
  879|      0|#line 880 "src/txt/readstat_stata_dictionary_read.c"
  880|       |						
  881|      0|						break; 
  882|      0|					}
  883|      0|					case 25:  {
  ------------------
  |  Branch (883:6): [True: 0, False: 326]
  ------------------
  884|      0|						{
  885|      0|#line 151 "src/txt/readstat_stata_dictionary_read.rl"
  886|      0|							current_entry.variable.type = READSTAT_TYPE_DOUBLE; }
  887|       |						
  888|      0|#line 889 "src/txt/readstat_stata_dictionary_read.c"
  889|       |						
  890|      0|						break; 
  891|      0|					}
  892|      0|					case 26:  {
  ------------------
  |  Branch (892:6): [True: 0, False: 326]
  ------------------
  893|      0|						{
  894|      0|#line 152 "src/txt/readstat_stata_dictionary_read.rl"
  895|      0|							current_entry.variable.type = READSTAT_TYPE_STRING;
  896|      0|							current_entry.variable.storage_width = integer; }
  897|       |						
  898|      0|#line 899 "src/txt/readstat_stata_dictionary_read.c"
  899|       |						
  900|      0|						break; 
  901|      0|					}
  902|      0|					case 27:  {
  ------------------
  |  Branch (902:6): [True: 0, False: 326]
  ------------------
  903|      0|						{
  904|      0|#line 159 "src/txt/readstat_stata_dictionary_read.rl"
  905|      0|							current_entry.len = integer; }
  906|       |						
  907|      0|#line 908 "src/txt/readstat_stata_dictionary_read.c"
  908|       |						
  909|      0|						break; 
  910|      0|					}
  911|      0|					case 28:  {
  ------------------
  |  Branch (911:6): [True: 0, False: 326]
  ------------------
  912|      0|						{
  913|      0|#line 160 "src/txt/readstat_stata_dictionary_read.rl"
  914|      0|							current_entry.decimal_separator = ','; }
  915|       |						
  916|      0|#line 917 "src/txt/readstat_stata_dictionary_read.c"
  917|       |						
  918|      0|						break; 
  919|      0|					}
  920|    326|				}
  921|    326|				_nacts -= 1;
  922|    326|				_acts += 1;
  923|    326|			}
  924|       |			
  925|    326|		}
  926|       |		
  927|  2.12k|		if ( cs != 0 ) {
  ------------------
  |  Branch (927:8): [True: 2.09k, False: 32]
  ------------------
  928|  2.09k|			p += 1;
  929|  2.09k|			goto _resume;
  930|  2.09k|		}
  931|     77|		_out: {}
  932|     77|	}
  933|       |	
  934|      0|#line 174 "src/txt/readstat_stata_dictionary_read.rl"
  935|       |	
  936|       |	
  937|       |	/* suppress warnings */
  938|      0|	(void)stata_dictionary_en_main;
  939|       |	
  940|     77|	if (cs < 
  ------------------
  |  Branch (940:6): [True: 77, False: 0]
  ------------------
  941|     77|#line 942 "src/txt/readstat_stata_dictionary_read.c"
  942|     77|	156
  943|     77|#line 179 "src/txt/readstat_stata_dictionary_read.rl"
  944|     77|	) {
  945|     77|		char error_buf[1024];
  946|     77|		if (p == pe) {
  ------------------
  |  Branch (946:7): [True: 45, False: 32]
  ------------------
  947|     45|			snprintf(error_buf, sizeof(error_buf), "Error parsing .dct file (end-of-file unexpectedly reached)");
  948|     45|		} else {
  949|     32|			snprintf(error_buf, sizeof(error_buf), "Error parsing .dct file around line #%d, col #%ld (%c)",
  950|     32|			line_no + 1, (long)(p - line_start + 1), *p);
  951|     32|		}
  952|     77|		if (parser->handlers.error) {
  ------------------
  |  Branch (952:7): [True: 0, False: 77]
  ------------------
  953|      0|			parser->handlers.error(error_buf, user_ctx);
  954|      0|		}
  955|     77|		error = READSTAT_ERROR_PARSE;
  956|     77|		goto cleanup;
  957|     77|	}
  958|       |	
  959|     77|	cleanup:
  960|     77|	parser->io->close(parser->io->io_ctx);
  961|     77|	free(bytes);
  962|     77|	if (error != READSTAT_OK) {
  ------------------
  |  Branch (962:6): [True: 77, False: 0]
  ------------------
  963|     77|		if (outError)
  ------------------
  |  Branch (963:7): [True: 0, False: 77]
  ------------------
  964|      0|			*outError = error;
  965|     77|		readstat_schema_free(schema);
  966|     77|		schema = NULL;
  967|     77|	}
  968|       |	
  969|     77|	return schema;
  970|     77|}

