LLVMFuzzerTestOneInput:
   20|  1.37k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size){
   21|  1.37k|    char *nullt_string = (char *)malloc(size+1);
   22|  1.37k|    if (nullt_string == NULL){
  ------------------
  |  Branch (22:9): [True: 0, False: 1.37k]
  ------------------
   23|      0|            return 0;
   24|      0|    }
   25|  1.37k|    memcpy(nullt_string, data, size);
   26|  1.37k|    nullt_string[size] = '\0';
   27|  1.37k|    std::ofstream fuzz_file;
   28|  1.37k|    fuzz_file.open ("fuzz_file.msh");
   29|  1.37k|    fuzz_file << nullt_string;
   30|  1.37k|    fuzz_file.close();
   31|  1.37k|    try {
   32|  1.37k|    	igl::MshLoader msh_loader("fuzz_file.msh");
   33|  1.37k|    } catch (...) {}
   34|  1.37k|    free(nullt_string);
   35|  1.37k|    return 0;
   36|  1.37k|}

_ZN3igl9MshLoaderC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   30|  1.37k|IGL_INLINE igl::MshLoader::MshLoader(const std::string &filename) {
   31|  1.37k|    std::ifstream fin(filename, std::ios::in | std::ios::binary);
   32|       |
   33|  1.37k|    if (!fin.is_open()) {
  ------------------
  |  Branch (33:9): [True: 0, False: 1.37k]
  ------------------
   34|      0|        std::stringstream err_msg;
   35|      0|        err_msg << "failed to open file \"" << filename << "\"";
   36|      0|        throw std::ios_base::failure(err_msg.str());
   37|      0|    }
   38|       |    // Parse header
   39|  1.37k|    std::string buf;
   40|  1.37k|    double version;
   41|  1.37k|    int type;
   42|  1.37k|    fin >> buf;
   43|  1.37k|    if (buf != "$MeshFormat") { throw std::runtime_error("Unexpected .msh format"); }
  ------------------
  |  Branch (43:9): [True: 31, False: 1.34k]
  ------------------
   44|       |
   45|  1.34k|    fin >> version >> type >> m_data_size;
   46|  1.34k|    m_binary = (type == 1);
   47|  1.34k|    if(version>2.2 || version<2.0)
  ------------------
  |  Branch (47:8): [True: 0, False: 1.34k]
  |  Branch (47:23): [True: 1, False: 1.34k]
  ------------------
   48|      1|    {
   49|       |        // probably unsupported version
   50|      1|        std::stringstream err_msg;
   51|      1|        err_msg << "Error: Unsupported file version:" << version << std::endl;
   52|      1|        throw std::runtime_error(err_msg.str());
   53|       |
   54|      1|    }
   55|       |    // Some sanity check.
   56|  1.34k|    if (m_data_size != 8) {
  ------------------
  |  Branch (56:9): [True: 0, False: 1.34k]
  ------------------
   57|      0|        std::stringstream err_msg;
   58|      0|        err_msg << "Error: data size must be 8 bytes." << std::endl;
   59|      0|        throw std::runtime_error(err_msg.str());
   60|      0|    }
   61|  1.34k|    if (sizeof(int) != 4) {
  ------------------
  |  Branch (61:9): [Folded, False: 1.34k]
  ------------------
   62|      0|        std::stringstream err_msg;
   63|      0|        err_msg << "Error: code must be compiled with int size 4 bytes." << std::endl;
   64|      0|        throw std::runtime_error(err_msg.str());
   65|      0|    }
   66|       |
   67|       |    // Read in extra info from binary header.
   68|  1.34k|    if (m_binary) {
  ------------------
  |  Branch (68:9): [True: 4, False: 1.33k]
  ------------------
   69|      4|        int one;
   70|      4|        igl::_msh_eat_white_space(fin);
   71|      4|        fin.read(reinterpret_cast<char*>(&one), sizeof(int));
   72|      4|        if (one != 1) {
  ------------------
  |  Branch (72:13): [True: 4, False: 0]
  ------------------
   73|      4|            std::stringstream err_msg;
   74|      4|                err_msg << "Binary msh file " << filename
   75|      4|                << " is saved with different endianness than this machine."
   76|      4|                << std::endl;
   77|      4|            throw std::runtime_error(err_msg.str());
   78|      4|        }
   79|      4|    }
   80|       |
   81|  1.33k|    fin >> buf;
   82|  1.33k|    if (buf != "$EndMeshFormat") 
  ------------------
  |  Branch (82:9): [True: 15, False: 1.32k]
  ------------------
   83|     15|    { 
   84|     15|        std::stringstream err_msg;
   85|     15|        err_msg << "Unexpected contents in the file header." << std::endl;
   86|     15|        throw std::runtime_error(err_msg.str());
   87|     15|    }
   88|       |
   89|  18.8k|    while (!fin.eof()) {
  ------------------
  |  Branch (89:12): [True: 17.9k, False: 919]
  ------------------
   90|  17.9k|        buf.clear();
   91|  17.9k|        fin >> buf;
   92|  17.9k|        if (buf == "$Nodes") {
  ------------------
  |  Branch (92:13): [True: 4.24k, False: 13.7k]
  ------------------
   93|  4.24k|            parse_nodes(fin);
   94|  4.24k|            fin >> buf;
   95|  4.24k|            if (buf != "$EndNodes") { throw std::runtime_error("Unexpected tag"); }
  ------------------
  |  Branch (95:17): [True: 78, False: 4.16k]
  ------------------
   96|  13.7k|        } else if (buf == "$Elements") {
  ------------------
  |  Branch (96:20): [True: 523, False: 13.1k]
  ------------------
   97|    523|            parse_elements(fin);
   98|    523|            fin >> buf;
   99|    523|            if (buf != "$EndElements") { throw std::runtime_error("Unexpected tag"); }
  ------------------
  |  Branch (99:17): [True: 32, False: 491]
  ------------------
  100|  13.1k|        } else if (buf == "$NodeData") {
  ------------------
  |  Branch (100:20): [True: 8.94k, False: 4.23k]
  ------------------
  101|  8.94k|            parse_node_field(fin);
  102|  8.94k|            fin >> buf;
  103|  8.94k|            if (buf != "$EndNodeData") { throw std::runtime_error("Unexpected tag"); }
  ------------------
  |  Branch (103:17): [True: 150, False: 8.79k]
  ------------------
  104|  8.94k|        } else if (buf == "$ElementData") {
  ------------------
  |  Branch (104:20): [True: 1.88k, False: 2.35k]
  ------------------
  105|  1.88k|            parse_element_field(fin);
  106|  1.88k|            fin >> buf;
  107|  1.88k|            if (buf != "$EndElementData") { throw std::runtime_error("Unexpected tag"); }
  ------------------
  |  Branch (107:17): [True: 89, False: 1.79k]
  ------------------
  108|  2.35k|        } else if (fin.eof()) {
  ------------------
  |  Branch (108:20): [True: 56, False: 2.29k]
  ------------------
  109|     56|            break;
  110|  2.29k|        } else {
  111|  2.29k|            parse_unknown_field(fin, buf);
  112|  2.29k|        }
  113|  17.9k|    }
  114|    975|    fin.close();
  115|    975|}
_ZNK3igl9MshLoader16node_dense_indexEi:
  117|  10.8k|IGL_INLINE int igl::MshLoader::node_dense_index(int node_tag) const {
  118|  10.8k|    const auto it = m_node_tag_to_dense.find(node_tag);
  119|  10.8k|    if (it == m_node_tag_to_dense.end()) {
  ------------------
  |  Branch (119:9): [True: 168, False: 10.6k]
  ------------------
  120|    168|        std::stringstream err_msg;
  121|    168|        err_msg << "Unknown node tag: " << node_tag;
  122|    168|        throw std::runtime_error(err_msg.str());
  123|    168|    }
  124|  10.6k|	return it->second;
  125|  10.8k|}
_ZNK3igl9MshLoader19element_dense_indexEi:
  127|     36|IGL_INLINE int igl::MshLoader::element_dense_index(int elem_tag) const {
  128|     36|	const auto it = m_element_tag_to_dense.find(elem_tag);
  129|     36|    if (it == m_element_tag_to_dense.end()) {
  ------------------
  |  Branch (129:9): [True: 36, False: 0]
  ------------------
  130|     36|		std::stringstream err_msg;
  131|     36|        err_msg << "Unknown element tag: " << elem_tag;
  132|     36|		throw std::runtime_error(err_msg.str());
  133|     36|    }
  134|      0|	return it->second;
  135|     36|}
_ZN3igl9MshLoader11parse_nodesERNSt3__114basic_ifstreamIcNS1_11char_traitsIcEEEE:
  137|  4.24k|IGL_INLINE void igl::MshLoader::parse_nodes(std::ifstream& fin) {
  138|  4.24k|    size_t num_nodes;
  139|  4.24k|    fin >> num_nodes;
  140|  4.24k|    m_nodes.resize(num_nodes*3);
  141|  4.24k|    m_node_tag_to_dense.clear();
  142|       |
  143|  4.24k|    if (m_binary) {
  ------------------
  |  Branch (143:9): [True: 0, False: 4.24k]
  ------------------
  144|      0|		size_t stride = (4+3*m_data_size);
  145|      0|        size_t num_bytes = stride * num_nodes;
  146|      0|        char* data = new char[num_bytes];
  147|      0|        igl::_msh_eat_white_space(fin);
  148|      0|        fin.read(data, num_bytes);
  149|       |
  150|      0|        for (size_t i=0; i<num_nodes; i++) {
  ------------------
  |  Branch (150:26): [True: 0, False: 0]
  ------------------
  151|      0|            int node_tag;
  152|      0|			memcpy(&node_tag, data+i*stride, sizeof(int));
  153|       |
  154|      0|            if (node_tag <= 0) {
  ------------------
  |  Branch (154:17): [True: 0, False: 0]
  ------------------
  155|      0|                throw std::runtime_error("Invalid node tag");
  156|      0|            }
  157|      0|            if (m_node_tag_to_dense.find(node_tag) != m_node_tag_to_dense.end()) {
  ------------------
  |  Branch (157:17): [True: 0, False: 0]
  ------------------
  158|      0|                throw std::runtime_error("Duplicate node tag");
  159|      0|            }
  160|      0|            m_node_tag_to_dense[node_tag] = static_cast<int>(i);
  161|       |            // directly move into vector storage
  162|       |            // this works only when m_data_size==sizeof(Float)==sizeof(double)
  163|      0|			memcpy(&m_nodes[i*3], data+i*stride + 4, m_data_size*3);
  164|      0|        }
  165|      0|        delete [] data;
  166|  4.24k|    } else {
  167|  4.24k|        int node_tag;
  168|  7.80k|        for (size_t i=0; i<num_nodes; i++) {
  ------------------
  |  Branch (168:26): [True: 3.81k, False: 3.99k]
  ------------------
  169|  3.81k|            fin >> node_tag;
  170|       |
  171|  3.81k|            if (node_tag <= 0) {
  ------------------
  |  Branch (171:17): [True: 32, False: 3.78k]
  ------------------
  172|     32|				throw std::runtime_error("Invalid node tag");
  173|     32|            }
  174|  3.78k|            if (m_node_tag_to_dense.find(node_tag) != m_node_tag_to_dense.end()) {
  ------------------
  |  Branch (174:17): [True: 220, False: 3.56k]
  ------------------
  175|    220|                throw std::runtime_error("Duplicate node tag");
  176|    220|            }
  177|  3.56k|            m_node_tag_to_dense[node_tag] = static_cast<int>(i);
  178|       |            // here it's 3D node explicitly
  179|  3.56k|            fin >> m_nodes[i*3]
  180|  3.56k|                >> m_nodes[i*3+1]
  181|  3.56k|                >> m_nodes[i*3+2];
  182|  3.56k|        }
  183|  4.24k|    }
  184|  4.24k|}
_ZN3igl9MshLoader14parse_elementsERNSt3__114basic_ifstreamIcNS1_11char_traitsIcEEEE:
  186|    523|IGL_INLINE void igl::MshLoader::parse_elements(std::ifstream& fin) {
  187|    523|    m_elements_tags.resize(2); //hardcoded to have 2 tags
  188|    523|    size_t num_elements;
  189|    523|    fin >> num_elements;
  190|    523|    m_element_tag_to_dense.clear();
  191|       |
  192|    523|    size_t nodes_per_element;
  193|       |
  194|    523|    if (m_binary) {
  ------------------
  |  Branch (194:9): [True: 0, False: 523]
  ------------------
  195|      0|        igl::_msh_eat_white_space(fin);
  196|      0|        int elem_read = 0;
  197|      0|        while (elem_read < num_elements) {
  ------------------
  |  Branch (197:16): [True: 0, False: 0]
  ------------------
  198|       |            // Parse element header.
  199|      0|            int elem_type, num_elems, num_tags;
  200|      0|            fin.read((char*)&elem_type, sizeof(int));
  201|      0|            fin.read((char*)&num_elems, sizeof(int));
  202|      0|            fin.read((char*)&num_tags,  sizeof(int));
  203|      0|            nodes_per_element = num_nodes_per_elem_type(elem_type);
  204|       |
  205|       |            // store node info
  206|      0|            for (size_t i=0; i<num_elems; i++) {
  ------------------
  |  Branch (206:30): [True: 0, False: 0]
  ------------------
  207|      0|                int elem_tag;
  208|       |
  209|       |                // all elements in the segment share the same elem_type and number of nodes per element
  210|      0|                m_elements_types.push_back(elem_type);
  211|      0|                m_elements_lengths.push_back(nodes_per_element);
  212|       |
  213|      0|                fin.read((char*)&elem_tag, sizeof(int));
  214|       |
  215|      0|                if (elem_tag <= 0) {
  ------------------
  |  Branch (215:21): [True: 0, False: 0]
  ------------------
  216|      0|                    throw std::runtime_error("Invalid element tag");
  217|      0|                }
  218|      0|                if (m_element_tag_to_dense.find(elem_tag) != m_element_tag_to_dense.end()) {
  ------------------
  |  Branch (218:21): [True: 0, False: 0]
  ------------------
  219|      0|                    throw std::runtime_error("Duplicate element tag");
  220|      0|                }
  221|      0|                m_element_tag_to_dense[elem_tag] = static_cast<int>(m_elements_ids.size());
  222|       |
  223|      0|                elem_tag -= 1;
  224|      0|                m_elements_ids.push_back(elem_tag);
  225|       |
  226|       |                // read first two tags
  227|      0|                for (size_t j=0; j<num_tags; j++) {
  ------------------
  |  Branch (227:34): [True: 0, False: 0]
  ------------------
  228|      0|                    int tag;
  229|      0|                    fin.read((char*)&tag, sizeof(int));
  230|      0|                    if(j<2) m_elements_tags[j].push_back(tag);
  ------------------
  |  Branch (230:24): [True: 0, False: 0]
  ------------------
  231|      0|                }
  232|       |
  233|      0|                for (size_t j=num_tags; j<2; j++) 
  ------------------
  |  Branch (233:41): [True: 0, False: 0]
  ------------------
  234|      0|                    m_elements_tags[j].push_back(-1); // fill up tags if less then 2
  235|       |
  236|      0|                m_elements_nodes_idx.push_back(m_elements.size());
  237|       |                // Element values.
  238|      0|                for (size_t j=0; j<nodes_per_element; j++) {
  ------------------
  |  Branch (238:34): [True: 0, False: 0]
  ------------------
  239|      0|                    int node_tag;
  240|      0|                    fin.read((char*)&node_tag, sizeof(int));
  241|       |                    
  242|      0|                    m_elements.push_back(node_dense_index(node_tag));
  243|      0|                }
  244|      0|            }
  245|      0|            elem_read += num_elems;
  246|      0|        }
  247|    523|    } else {
  248|    770|        for (size_t i=0; i<num_elements; i++) {
  ------------------
  |  Branch (248:26): [True: 254, False: 516]
  ------------------
  249|       |            // Parse per element header
  250|    254|            int elem_tag, elem_type, num_tags;
  251|    254|            fin >> elem_tag >> elem_type >> num_tags;
  252|       |
  253|    254|            if (elem_tag <= 0) {
  ------------------
  |  Branch (253:17): [True: 7, False: 247]
  ------------------
  254|      7|                throw std::runtime_error("Invalid element tag");
  255|      7|            }
  256|    247|            if (m_element_tag_to_dense.find(elem_tag) != m_element_tag_to_dense.end()) {
  ------------------
  |  Branch (256:17): [True: 0, False: 247]
  ------------------
  257|      0|                throw std::runtime_error("Duplicate element tag");
  258|      0|            }
  259|    247|            m_element_tag_to_dense[elem_tag] = static_cast<int>(m_elements_ids.size());
  260|       |
  261|       |            // read tags.
  262|  4.11G|            for (size_t j=0; j<num_tags; j++) {
  ------------------
  |  Branch (262:30): [True: 4.11G, False: 247]
  ------------------
  263|  4.11G|                int tag;
  264|  4.11G|                fin >> tag;
  265|  4.11G|                if(j<2) m_elements_tags[j].push_back(tag);
  ------------------
  |  Branch (265:20): [True: 168, False: 4.11G]
  ------------------
  266|  4.11G|            }
  267|    573|            for (size_t j=num_tags; j<2; j++) 
  ------------------
  |  Branch (267:37): [True: 326, False: 247]
  ------------------
  268|    326|                m_elements_tags[j].push_back(-1); // fill up tags if less then 2
  269|       |            
  270|    247|            nodes_per_element = num_nodes_per_elem_type(elem_type);
  271|    247|            m_elements_types.push_back(elem_type);
  272|    247|            m_elements_lengths.push_back(nodes_per_element);
  273|       |
  274|    247|            elem_tag -= 1;
  275|    247|            m_elements_ids.push_back(elem_tag);
  276|    247|            m_elements_nodes_idx.push_back(m_elements.size());
  277|       |            // Parse node idx.
  278|    864|            for (size_t j=0; j<nodes_per_element; j++) {
  ------------------
  |  Branch (278:30): [True: 617, False: 247]
  ------------------
  279|    617|                int node_tag;
  280|    617|                fin >> node_tag;
  281|    617|                m_elements.push_back(node_dense_index(node_tag)); // msh index starts from 1.
  282|    617|            }
  283|    247|        }
  284|    523|    }
  285|       |    // debug
  286|    523|    assert(m_elements_types.size()   == m_elements_ids.size());
  ------------------
  |  Branch (286:5): [True: 378, False: 138]
  ------------------
  287|    516|    assert(m_elements_tags[0].size() == m_elements_ids.size());
  ------------------
  |  Branch (287:5): [True: 378, False: 0]
  ------------------
  288|    378|    assert(m_elements_tags[1].size() == m_elements_ids.size());
  ------------------
  |  Branch (288:5): [True: 378, False: 0]
  ------------------
  289|    378|    assert(m_elements_lengths.size() == m_elements_ids.size());
  ------------------
  |  Branch (289:5): [True: 378, False: 0]
  ------------------
  290|    378|}
_ZN3igl9MshLoader16parse_node_fieldERNSt3__114basic_ifstreamIcNS1_11char_traitsIcEEEE:
  292|  8.94k|IGL_INLINE void igl::MshLoader::parse_node_field( std::ifstream& fin ) {
  293|  8.94k|    size_t num_string_tags;
  294|  8.94k|    size_t num_real_tags;
  295|  8.94k|    size_t num_int_tags;
  296|       |
  297|  8.94k|    fin >> num_string_tags;
  298|  8.94k|    std::vector<std::string> str_tags(num_string_tags);
  299|       |
  300|   353k|    for (size_t i=0; i<num_string_tags; i++) {
  ------------------
  |  Branch (300:22): [True: 344k, False: 8.94k]
  ------------------
  301|   344k|        igl::_msh_eat_white_space(fin);
  302|   344k|        if (fin.peek() == '\"') {
  ------------------
  |  Branch (302:13): [True: 1.24k, False: 343k]
  ------------------
  303|       |            // Handle field name between quotes.
  304|  1.24k|            char buf[128];
  305|  1.24k|            fin.get(); // remove the quote at the beginning.
  306|  1.24k|            fin.getline(buf, 128, '\"');
  307|  1.24k|            str_tags[i] = std::string(buf);
  308|   343k|        } else {
  309|   343k|            fin >> str_tags[i];
  310|   343k|        }
  311|   344k|    }
  312|       |
  313|  8.94k|    fin >> num_real_tags;
  314|  8.94k|    std::vector<Float> real_tags(num_real_tags);
  315|   291M|    for (size_t i=0; i<num_real_tags; i++)
  ------------------
  |  Branch (315:22): [True: 291M, False: 8.94k]
  ------------------
  316|   291M|        fin >> real_tags[i];
  317|       |
  318|  8.94k|    fin >> num_int_tags;
  319|  8.94k|    std::vector<int> int_tags(num_int_tags);
  320|   133M|    for (size_t i=0; i<num_int_tags; i++)
  ------------------
  |  Branch (320:22): [True: 133M, False: 8.94k]
  ------------------
  321|   133M|        fin >> int_tags[i];
  322|       |
  323|  8.94k|    if (num_string_tags <= 0 || num_int_tags <= 2) {
  ------------------
  |  Branch (323:9): [True: 117, False: 8.82k]
  |  Branch (323:33): [True: 4, False: 8.82k]
  ------------------
  324|      5|        throw std::runtime_error("Unexpected number of field tags");
  325|      5|    }
  326|  8.94k|    std::string fieldname = str_tags[0];
  327|  8.94k|    int num_components    = int_tags[1];
  328|  8.94k|    int num_entries       = int_tags[2];
  329|       |
  330|  8.94k|    std::vector<Float> field((m_nodes.size()/3)*num_components);
  331|       |
  332|  8.94k|    if (m_binary) {
  ------------------
  |  Branch (332:9): [True: 0, False: 8.94k]
  ------------------
  333|      0|        size_t num_bytes = (num_components * m_data_size + 4) * num_entries;
  334|      0|        char* data = new char[num_bytes];
  335|      0|        igl::_msh_eat_white_space(fin);
  336|      0|        fin.read(data, num_bytes);
  337|      0|        for (size_t i=0; i<num_entries; i++) {
  ------------------
  |  Branch (337:26): [True: 0, False: 0]
  ------------------
  338|      0|			int node_tag;
  339|      0|			memcpy(&node_tag,&data[i*(4+num_components*m_data_size)],4);
  340|       |
  341|      0|            const int node_idx = node_dense_index(node_tag);
  342|      0|            size_t base_idx = i*(4+num_components*m_data_size) + 4;
  343|       |            // TODO: make this work when m_data_size != sizeof(double) ?
  344|      0|			memcpy(&field[node_idx*num_components], &data[base_idx], num_components*m_data_size);
  345|      0|        }
  346|      0|        delete [] data;
  347|  8.94k|    } else {
  348|  8.94k|        int node_tag;
  349|  19.1k|        for (size_t i=0; i<num_entries; i++) {
  ------------------
  |  Branch (349:26): [True: 10.2k, False: 8.94k]
  ------------------
  350|  10.2k|            fin >> node_tag;
  351|  10.2k|            const int node_idx = node_dense_index(node_tag);
  352|   544k|            for (size_t j=0; j<num_components; j++) {
  ------------------
  |  Branch (352:30): [True: 534k, False: 10.2k]
  ------------------
  353|   534k|                fin >> field[node_idx*num_components+j];
  354|   534k|            }
  355|  10.2k|        }
  356|  8.94k|    }
  357|       |    
  358|  8.94k|    m_node_fields_names.push_back(fieldname);
  359|  8.94k|    m_node_fields.push_back(field);
  360|  8.94k|    m_node_fields_components.push_back(num_components);
  361|  8.94k|}
_ZN3igl9MshLoader19parse_element_fieldERNSt3__114basic_ifstreamIcNS1_11char_traitsIcEEEE:
  363|  1.88k|IGL_INLINE void igl::MshLoader::parse_element_field(std::ifstream& fin) {
  364|  1.88k|    size_t num_string_tags;
  365|  1.88k|    size_t num_real_tags;
  366|  1.88k|    size_t num_int_tags;
  367|       |
  368|  1.88k|    fin >> num_string_tags;
  369|  1.88k|    std::vector<std::string> str_tags(num_string_tags);
  370|  8.21k|    for (size_t i=0; i<num_string_tags; i++) {
  ------------------
  |  Branch (370:22): [True: 6.33k, False: 1.88k]
  ------------------
  371|  6.33k|        igl::_msh_eat_white_space(fin);
  372|  6.33k|        if (fin.peek() == '\"') {
  ------------------
  |  Branch (372:13): [True: 191, False: 6.14k]
  ------------------
  373|       |            // Handle field name between quoates.
  374|    191|            char buf[128];
  375|    191|            fin.get(); // remove the quote at the beginning.
  376|    191|            fin.getline(buf, 128, '\"');
  377|    191|            str_tags[i] = buf;
  378|  6.14k|        } else {
  379|  6.14k|            fin >> str_tags[i];
  380|  6.14k|        }
  381|  6.33k|    }
  382|       |
  383|  1.88k|    fin >> num_real_tags;
  384|  1.88k|    std::vector<Float> real_tags(num_real_tags);
  385|   276M|    for (size_t i=0; i<num_real_tags; i++)
  ------------------
  |  Branch (385:22): [True: 276M, False: 1.88k]
  ------------------
  386|   276M|        fin >> real_tags[i];
  387|       |
  388|  1.88k|    fin >> num_int_tags;
  389|  1.88k|    std::vector<int> int_tags(num_int_tags);
  390|  2.75M|    for (size_t i=0; i<num_int_tags; i++)
  ------------------
  |  Branch (390:22): [True: 2.75M, False: 1.88k]
  ------------------
  391|  2.75M|        fin >> int_tags[i];
  392|       |
  393|  1.88k|    if (num_string_tags <= 0 || num_int_tags <= 2) {
  ------------------
  |  Branch (393:9): [True: 39, False: 1.84k]
  |  Branch (393:33): [True: 3, False: 1.83k]
  ------------------
  394|      3|        throw std::runtime_error("Invalid file format");
  395|      3|    }
  396|  1.87k|    std::string fieldname = str_tags[0];
  397|  1.87k|    int num_components = int_tags[1];
  398|  1.87k|    int num_entries = int_tags[2];
  399|  1.87k|    std::vector<Float> field(m_elements_ids.size()*num_components);
  400|       |
  401|  1.87k|    if (m_binary) {
  ------------------
  |  Branch (401:9): [True: 0, False: 1.87k]
  ------------------
  402|      0|        size_t num_bytes = (num_components * m_data_size + 4) * num_entries;
  403|      0|        char* data = new char[num_bytes];
  404|      0|        igl::_msh_eat_white_space(fin);
  405|      0|        fin.read(data, num_bytes);
  406|      0|        for (int i=0; i<num_entries; i++) {
  ------------------
  |  Branch (406:23): [True: 0, False: 0]
  ------------------
  407|      0|			int elem_tag;
  408|       |			// works with sizeof(int)==4
  409|      0|			memcpy(&elem_tag, &data[i*(4+num_components*m_data_size)],4);
  410|      0|            const int elem_idx = element_dense_index(elem_tag);
  411|       |			
  412|       |			// directly copy data into vector storage space
  413|      0|			memcpy(&field[elem_idx*num_components], &data[i*(4+num_components*m_data_size) + 4], m_data_size*num_components);
  414|      0|        }
  415|      0|        delete [] data;
  416|  1.87k|    } else {
  417|  1.87k|        int elem_tag;
  418|  1.91k|        for (size_t i=0; i<num_entries; i++) {
  ------------------
  |  Branch (418:26): [True: 36, False: 1.87k]
  ------------------
  419|     36|            fin >> elem_tag;
  420|     36|            const int elem_idx = element_dense_index(elem_tag);
  421|     36|            for (size_t j=0; j<num_components; j++) {
  ------------------
  |  Branch (421:30): [True: 0, False: 36]
  ------------------
  422|      0|                fin >> field[elem_idx*num_components+j];
  423|      0|            }
  424|     36|        }
  425|  1.87k|    }
  426|  1.87k|    m_element_fields_names.push_back(fieldname);
  427|  1.87k|    m_element_fields.push_back(field);
  428|  1.87k|    m_element_fields_components.push_back(num_components);
  429|  1.87k|}
_ZN3igl9MshLoader19parse_unknown_fieldERNSt3__114basic_ifstreamIcNS1_11char_traitsIcEEEERKNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
  432|  2.29k|        const std::string& fieldname) {
  433|  2.29k|    std::cerr << "Warning: \"" << fieldname << "\" not supported yet.  Ignored." << std::endl;
  434|  2.29k|    std::string endmark = fieldname.substr(0,1) + "End"
  435|  2.29k|        + fieldname.substr(1,fieldname.size()-1);
  436|       |
  437|  2.29k|    std::string buf("");
  438|  11.4k|    while (buf != endmark && !fin.eof()) {
  ------------------
  |  Branch (438:12): [True: 9.38k, False: 2.05k]
  |  Branch (438:30): [True: 9.13k, False: 245]
  ------------------
  439|  9.13k|        fin >> buf;
  440|  9.13k|    }
  441|  2.29k|}
_ZN3igl9MshLoader23num_nodes_per_elem_typeEi:
  443|    247|IGL_INLINE int igl::MshLoader::num_nodes_per_elem_type(int elem_type) {
  444|    247|    int nodes_per_element = 0;
  445|    247|    switch (elem_type) {
  446|     81|        case ELEMENT_LINE:         // 2-node line
  ------------------
  |  Branch (446:9): [True: 81, False: 166]
  ------------------
  447|     81|            nodes_per_element = 2; 
  448|     81|            break;
  449|     18|        case ELEMENT_TRI:
  ------------------
  |  Branch (449:9): [True: 18, False: 229]
  ------------------
  450|     18|            nodes_per_element = 3; // 3-node triangle
  451|     18|            break;
  452|     25|        case ELEMENT_QUAD:
  ------------------
  |  Branch (452:9): [True: 25, False: 222]
  ------------------
  453|     25|            nodes_per_element = 4; // 5-node quad
  454|     25|            break;
  455|     12|        case ELEMENT_TET:
  ------------------
  |  Branch (455:9): [True: 12, False: 235]
  ------------------
  456|     12|            nodes_per_element = 4; // 4-node tetrahedra
  457|     12|            break;
  458|     15|        case ELEMENT_HEX:          // 8-node hexahedron
  ------------------
  |  Branch (458:9): [True: 15, False: 232]
  ------------------
  459|     15|            nodes_per_element = 8; 
  460|     15|            break;
  461|      4|        case ELEMENT_PRISM:        // 6-node prism
  ------------------
  |  Branch (461:9): [True: 4, False: 243]
  ------------------
  462|      4|            nodes_per_element = 6; 
  463|      4|            break;
  464|     20|        case ELEMENT_LINE_2ND_ORDER: 
  ------------------
  |  Branch (464:9): [True: 20, False: 227]
  ------------------
  465|     20|            nodes_per_element = 3;
  466|     20|            break;
  467|     16|        case ELEMENT_TRI_2ND_ORDER: 
  ------------------
  |  Branch (467:9): [True: 16, False: 231]
  ------------------
  468|     16|            nodes_per_element = 6;
  469|     16|            break;
  470|      3|        case ELEMENT_QUAD_2ND_ORDER: 
  ------------------
  |  Branch (470:9): [True: 3, False: 244]
  ------------------
  471|      3|            nodes_per_element = 9;
  472|      3|            break;
  473|      6|        case ELEMENT_TET_2ND_ORDER: 
  ------------------
  |  Branch (473:9): [True: 6, False: 241]
  ------------------
  474|      6|            nodes_per_element = 10;
  475|      6|            break;
  476|     10|        case ELEMENT_HEX_2ND_ORDER: 
  ------------------
  |  Branch (476:9): [True: 10, False: 237]
  ------------------
  477|     10|            nodes_per_element = 27;
  478|     10|            break;
  479|      4|        case ELEMENT_PRISM_2ND_ORDER: 
  ------------------
  |  Branch (479:9): [True: 4, False: 243]
  ------------------
  480|      4|            nodes_per_element = 18;
  481|      4|            break;
  482|      1|        case ELEMENT_PYRAMID_2ND_ORDER: 
  ------------------
  |  Branch (482:9): [True: 1, False: 246]
  ------------------
  483|      1|            nodes_per_element = 14;
  484|      1|            break;
  485|     13|        case ELEMENT_POINT:        // 1-node point
  ------------------
  |  Branch (485:9): [True: 13, False: 234]
  ------------------
  486|     13|            nodes_per_element = 1; 
  487|     13|            break;
  488|     19|        default:
  ------------------
  |  Branch (488:9): [True: 19, False: 228]
  ------------------
  489|     19|            std::stringstream err_msg;
  490|     19|                err_msg << "Element type (" << elem_type << ") is not supported yet."
  491|     19|                << std::endl;
  492|     19|            throw std::runtime_error(err_msg.str());
  493|    247|    }
  494|    228|    return nodes_per_element;
  495|    247|}
_ZN3igl20_msh_eat_white_spaceERNSt3__114basic_ifstreamIcNS0_11char_traitsIcEEEE:
   21|   351k|    void inline _msh_eat_white_space(std::ifstream& fin) {
   22|   351k|        char next = fin.peek();
   23|   358k|        while (next == '\n' || next == ' ' || next == '\t' || next == '\r') {
  ------------------
  |  Branch (23:16): [True: 2.00k, False: 356k]
  |  Branch (23:32): [True: 968, False: 355k]
  |  Branch (23:47): [True: 3.61k, False: 351k]
  |  Branch (23:63): [True: 321, False: 351k]
  ------------------
   24|  6.90k|            fin.get();
   25|  6.90k|            next = fin.peek();
   26|  6.90k|        }
   27|   351k|    }

