file_ms_alloc:
  552|      2|{
  553|      2|	struct magic_set *ms;
  554|      2|	size_t i, len;
  555|       |
  556|      2|	if ((ms = CAST(struct magic_set *, calloc(CAST(size_t, 1u),
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (556:6): [True: 0, False: 2]
  ------------------
  557|      2|	    sizeof(struct magic_set)))) == NULL)
  558|      0|		return NULL;
  559|       |
  560|      2|	if (magic_setflags(ms, flags) == -1) {
  ------------------
  |  Branch (560:6): [True: 0, False: 2]
  ------------------
  561|      0|		errno = EINVAL;
  562|      0|		goto free;
  563|      0|	}
  564|       |
  565|      2|	ms->o.buf = ms->o.pbuf = NULL;
  566|      2|	ms->o.blen = 0;
  567|      2|	len = (ms->c.len = 10) * sizeof(*ms->c.li);
  568|       |
  569|      2|	if ((ms->c.li = CAST(struct level_info *, malloc(len))) == NULL)
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (569:6): [True: 0, False: 2]
  ------------------
  570|      0|		goto free;
  571|       |
  572|      2|	ms->event_flags = 0;
  573|      2|	ms->error = -1;
  574|      6|	for (i = 0; i < MAGIC_SETS; i++)
  ------------------
  |  |  445|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (574:14): [True: 4, False: 2]
  ------------------
  575|      4|		ms->mlist[i] = NULL;
  576|      2|	ms->file = "unknown";
  577|      2|	ms->line = 0;
  578|      2|	ms->indir_max = FILE_INDIR_MAX;
  ------------------
  |  |  491|      2|#define	FILE_INDIR_MAX			50
  ------------------
  579|      2|	ms->name_max = FILE_NAME_MAX;
  ------------------
  |  |  492|      2|#define	FILE_NAME_MAX			50
  ------------------
  580|      2|	ms->elf_shnum_max = FILE_ELF_SHNUM_MAX;
  ------------------
  |  |  490|      2|#define	FILE_ELF_SHNUM_MAX		32768
  ------------------
  581|      2|	ms->elf_phnum_max = FILE_ELF_PHNUM_MAX;
  ------------------
  |  |  489|      2|#define	FILE_ELF_PHNUM_MAX		2048
  ------------------
  582|      2|	ms->elf_notes_max = FILE_ELF_NOTES_MAX;
  ------------------
  |  |  488|      2|#define	FILE_ELF_NOTES_MAX		256
  ------------------
  583|      2|	ms->regex_max = FILE_REGEX_MAX;
  ------------------
  |  |  493|      2|#define	FILE_REGEX_MAX			8192
  ------------------
  584|      2|	ms->bytes_max = FILE_BYTES_MAX;
  ------------------
  |  |  486|      2|# define FILE_BYTES_MAX (1024 * 1024)	/* how much of the file to look at */
  ------------------
  585|      2|	ms->encoding_max = FILE_ENCODING_MAX;
  ------------------
  |  |  494|      2|#define	FILE_ENCODING_MAX		(64 * 1024)
  ------------------
  586|      2|#ifdef USE_C_LOCALE
  587|      2|	ms->c_lc_ctype = newlocale(LC_CTYPE_MASK, "C", 0);
  588|      2|	assert(ms->c_lc_ctype != NULL);
  589|      2|#endif
  590|      2|	return ms;
  591|      0|free:
  592|      0|	free(ms);
  593|      0|	return NULL;
  594|      2|}
file_apprentice:
  735|      2|{
  736|      2|	char *p, *mfn;
  737|      2|	int fileerr, errs = -1;
  738|      2|	size_t i, j;
  739|       |
  740|      2|	(void)file_reset(ms, 0);
  741|       |
  742|      2|	if ((fn = magic_getpath(fn, action)) == NULL)
  ------------------
  |  Branch (742:6): [True: 0, False: 2]
  ------------------
  743|      0|		return -1;
  744|       |
  745|      2|	init_file_tables();
  746|       |
  747|      2|	if ((mfn = strdup(fn)) == NULL) {
  ------------------
  |  Branch (747:6): [True: 0, False: 2]
  ------------------
  748|      0|		file_oomem(ms, strlen(fn));
  749|      0|		return -1;
  750|      0|	}
  751|       |
  752|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  445|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (752:14): [True: 4, False: 2]
  ------------------
  753|      4|		mlist_free(ms->mlist[i]);
  754|      4|		if ((ms->mlist[i] = mlist_alloc()) == NULL) {
  ------------------
  |  Branch (754:7): [True: 0, False: 4]
  ------------------
  755|      0|			file_oomem(ms, sizeof(*ms->mlist[i]));
  756|      0|			for (j = 0; j < i; j++) {
  ------------------
  |  Branch (756:16): [True: 0, False: 0]
  ------------------
  757|      0|				mlist_free(ms->mlist[j]);
  758|      0|				ms->mlist[j] = NULL;
  759|      0|			}
  760|      0|			free(mfn);
  761|      0|			return -1;
  762|      0|		}
  763|      4|	}
  764|      2|	fn = mfn;
  765|       |
  766|      4|	while (fn) {
  ------------------
  |  Branch (766:9): [True: 2, False: 2]
  ------------------
  767|      2|		p = CCAST(char *, strchr(fn, PATHSEP));
  ------------------
  |  |  428|      2|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  768|      2|		if (p)
  ------------------
  |  Branch (768:7): [True: 0, False: 2]
  ------------------
  769|      0|			*p++ = '\0';
  770|      2|		if (*fn == '\0')
  ------------------
  |  Branch (770:7): [True: 0, False: 2]
  ------------------
  771|      0|			break;
  772|      2|		fileerr = apprentice_1(ms, fn, action);
  773|      2|		errs = MAX(errs, fileerr);
  774|      2|		fn = p;
  775|      2|	}
  776|       |
  777|      2|	free(mfn);
  778|       |
  779|      2|	if (errs == -1) {
  ------------------
  |  Branch (779:6): [True: 0, False: 2]
  ------------------
  780|      0|		for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  445|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (780:15): [True: 0, False: 0]
  ------------------
  781|      0|			mlist_free(ms->mlist[i]);
  782|      0|			ms->mlist[i] = NULL;
  783|      0|		}
  784|      0|		file_error(ms, 0, "could not find any valid magic files!");
  785|      0|		return -1;
  786|      0|	}
  787|       |
  788|       |#if 0
  789|       |	/*
  790|       |	 * Always leave the database loaded
  791|       |	 */
  792|       |	if (action == FILE_LOAD)
  793|       |		return 0;
  794|       |
  795|       |	for (i = 0; i < MAGIC_SETS; i++) {
  796|       |		mlist_free(ms->mlist[i]);
  797|       |		ms->mlist[i] = NULL;
  798|       |	}
  799|       |#endif
  800|       |
  801|      2|	switch (action) {
  802|      2|	case FILE_LOAD:
  ------------------
  |  |  169|      2|#define	FILE_LOAD	0
  ------------------
  |  Branch (802:2): [True: 2, False: 0]
  ------------------
  803|      2|	case FILE_COMPILE:
  ------------------
  |  |  171|      2|#define FILE_COMPILE	2
  ------------------
  |  Branch (803:2): [True: 0, False: 2]
  ------------------
  804|      2|	case FILE_CHECK:
  ------------------
  |  |  170|      2|#define FILE_CHECK	1
  ------------------
  |  Branch (804:2): [True: 0, False: 2]
  ------------------
  805|      2|	case FILE_LIST:
  ------------------
  |  |  172|      2|#define FILE_LIST	3
  ------------------
  |  Branch (805:2): [True: 0, False: 2]
  ------------------
  806|      2|		return 0;
  807|      0|	default:
  ------------------
  |  Branch (807:2): [True: 0, False: 2]
  ------------------
  808|      0|		file_error(ms, 0, "Invalid action %d", action);
  809|      0|		return -1;
  810|      2|	}
  811|      2|}
file_signextend:
 1629|  51.4M|{
 1630|  51.4M|	if (!(m->flag & UNSIGNED)) {
  ------------------
  |  |  208|  51.4M|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (1630:6): [True: 48.6M, False: 2.78M]
  ------------------
 1631|  48.6M|		switch(m->type) {
 1632|       |		/*
 1633|       |		 * Do not remove the casts below.  They are
 1634|       |		 * vital.  When later compared with the data,
 1635|       |		 * the sign extension must have happened.
 1636|       |		 */
 1637|   511k|		case FILE_BYTE:
  ------------------
  |  |  223|   511k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1637:3): [True: 511k, False: 48.1M]
  ------------------
 1638|   511k|			v = CAST(signed char,  v);
  ------------------
  |  |  426|   511k|#define CAST(T, b)	((T)(b))
  ------------------
 1639|   511k|			break;
 1640|   549k|		case FILE_SHORT:
  ------------------
  |  |  224|   549k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1640:3): [True: 549k, False: 48.0M]
  ------------------
 1641|  2.71M|		case FILE_BESHORT:
  ------------------
  |  |  229|  2.71M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1641:3): [True: 2.16M, False: 46.4M]
  ------------------
 1642|  4.27M|		case FILE_LESHORT:
  ------------------
  |  |  232|  4.27M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1642:3): [True: 1.55M, False: 47.0M]
  ------------------
 1643|  4.27M|			v = CAST(short, v);
  ------------------
  |  |  426|  4.27M|#define CAST(T, b)	((T)(b))
  ------------------
 1644|  4.27M|			break;
 1645|      0|		case FILE_DATE:
  ------------------
  |  |  228|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (1645:3): [True: 0, False: 48.6M]
  ------------------
 1646|    156|		case FILE_BEDATE:
  ------------------
  |  |  231|    156|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1646:3): [True: 156, False: 48.6M]
  ------------------
 1647|    445|		case FILE_LEDATE:
  ------------------
  |  |  234|    445|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1647:3): [True: 289, False: 48.6M]
  ------------------
 1648|    461|		case FILE_MEDATE:
  ------------------
  |  |  243|    461|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1648:3): [True: 16, False: 48.6M]
  ------------------
 1649|    461|		case FILE_LDATE:
  ------------------
  |  |  236|    461|#define				FILE_LDATE		14
  ------------------
  |  Branch (1649:3): [True: 0, False: 48.6M]
  ------------------
 1650|  5.63k|		case FILE_BELDATE:
  ------------------
  |  |  237|  5.63k|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1650:3): [True: 5.17k, False: 48.6M]
  ------------------
 1651|  5.63k|		case FILE_LELDATE:
  ------------------
  |  |  238|  5.63k|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1651:3): [True: 0, False: 48.6M]
  ------------------
 1652|  5.63k|		case FILE_MELDATE:
  ------------------
  |  |  244|  5.63k|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1652:3): [True: 0, False: 48.6M]
  ------------------
 1653|   901k|		case FILE_LONG:
  ------------------
  |  |  226|   901k|#define				FILE_LONG		4
  ------------------
  |  Branch (1653:3): [True: 895k, False: 47.7M]
  ------------------
 1654|  7.79M|		case FILE_BELONG:
  ------------------
  |  |  230|  7.79M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1654:3): [True: 6.89M, False: 41.7M]
  ------------------
 1655|  10.2M|		case FILE_LELONG:
  ------------------
  |  |  233|  10.2M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1655:3): [True: 2.45M, False: 46.1M]
  ------------------
 1656|  10.2M|		case FILE_MELONG:
  ------------------
  |  |  245|  10.2M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1656:3): [True: 0, False: 48.6M]
  ------------------
 1657|  10.2M|		case FILE_FLOAT:
  ------------------
  |  |  255|  10.2M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1657:3): [True: 0, False: 48.6M]
  ------------------
 1658|  10.2M|		case FILE_BEFLOAT:
  ------------------
  |  |  256|  10.2M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1658:3): [True: 0, False: 48.6M]
  ------------------
 1659|  10.2M|		case FILE_LEFLOAT:
  ------------------
  |  |  257|  10.2M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1659:3): [True: 0, False: 48.6M]
  ------------------
 1660|  10.2M|		case FILE_MSDOSDATE:
  ------------------
  |  |  275|  10.2M|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (1660:3): [True: 0, False: 48.6M]
  ------------------
 1661|  10.2M|		case FILE_BEMSDOSDATE:
  ------------------
  |  |  277|  10.2M|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (1661:3): [True: 0, False: 48.6M]
  ------------------
 1662|  10.2M|		case FILE_LEMSDOSDATE:
  ------------------
  |  |  276|  10.2M|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (1662:3): [True: 0, False: 48.6M]
  ------------------
 1663|  10.2M|		case FILE_MSDOSTIME:
  ------------------
  |  |  278|  10.2M|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (1663:3): [True: 0, False: 48.6M]
  ------------------
 1664|  10.2M|		case FILE_BEMSDOSTIME:
  ------------------
  |  |  280|  10.2M|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (1664:3): [True: 0, False: 48.6M]
  ------------------
 1665|  10.2M|		case FILE_LEMSDOSTIME:
  ------------------
  |  |  279|  10.2M|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (1665:3): [True: 0, False: 48.6M]
  ------------------
 1666|  10.2M|			v = CAST(int32_t, v);
  ------------------
  |  |  426|  10.2M|#define CAST(T, b)	((T)(b))
  ------------------
 1667|  10.2M|			break;
 1668|  39.6k|		case FILE_QUAD:
  ------------------
  |  |  246|  39.6k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1668:3): [True: 39.6k, False: 48.5M]
  ------------------
 1669|   420k|		case FILE_BEQUAD:
  ------------------
  |  |  248|   420k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1669:3): [True: 380k, False: 48.2M]
  ------------------
 1670|   611k|		case FILE_LEQUAD:
  ------------------
  |  |  247|   611k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1670:3): [True: 190k, False: 48.4M]
  ------------------
 1671|   611k|		case FILE_QDATE:
  ------------------
  |  |  249|   611k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1671:3): [True: 0, False: 48.6M]
  ------------------
 1672|   611k|		case FILE_QLDATE:
  ------------------
  |  |  252|   611k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1672:3): [True: 0, False: 48.6M]
  ------------------
 1673|   611k|		case FILE_QWDATE:
  ------------------
  |  |  264|   611k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1673:3): [True: 297, False: 48.6M]
  ------------------
 1674|   611k|		case FILE_BEQDATE:
  ------------------
  |  |  251|   611k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1674:3): [True: 0, False: 48.6M]
  ------------------
 1675|   611k|		case FILE_BEQLDATE:
  ------------------
  |  |  254|   611k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1675:3): [True: 0, False: 48.6M]
  ------------------
 1676|   611k|		case FILE_BEQWDATE:
  ------------------
  |  |  266|   611k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1676:3): [True: 0, False: 48.6M]
  ------------------
 1677|   611k|		case FILE_LEQDATE:
  ------------------
  |  |  250|   611k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1677:3): [True: 0, False: 48.6M]
  ------------------
 1678|   611k|		case FILE_LEQLDATE:
  ------------------
  |  |  253|   611k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1678:3): [True: 0, False: 48.6M]
  ------------------
 1679|   611k|		case FILE_LEQWDATE:
  ------------------
  |  |  265|   611k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1679:3): [True: 0, False: 48.6M]
  ------------------
 1680|   611k|		case FILE_DOUBLE:
  ------------------
  |  |  258|   611k|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1680:3): [True: 0, False: 48.6M]
  ------------------
 1681|   611k|		case FILE_BEDOUBLE:
  ------------------
  |  |  259|   611k|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1681:3): [True: 0, False: 48.6M]
  ------------------
 1682|   611k|		case FILE_LEDOUBLE:
  ------------------
  |  |  260|   611k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1682:3): [True: 0, False: 48.6M]
  ------------------
 1683|   612k|		case FILE_OFFSET:
  ------------------
  |  |  272|   612k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1683:3): [True: 1.12k, False: 48.6M]
  ------------------
 1684|   612k|		case FILE_BEVARINT:
  ------------------
  |  |  273|   612k|#define				FILE_BEVARINT		51
  ------------------
  |  Branch (1684:3): [True: 0, False: 48.6M]
  ------------------
 1685|   612k|		case FILE_LEVARINT:
  ------------------
  |  |  274|   612k|#define				FILE_LEVARINT		52
  ------------------
  |  Branch (1685:3): [True: 0, False: 48.6M]
  ------------------
 1686|   612k|			v = CAST(int64_t, v);
  ------------------
  |  |  426|   612k|#define CAST(T, b)	((T)(b))
  ------------------
 1687|   612k|			break;
 1688|  32.2M|		case FILE_STRING:
  ------------------
  |  |  227|  32.2M|#define				FILE_STRING		5
  ------------------
  |  Branch (1688:3): [True: 32.2M, False: 16.3M]
  ------------------
 1689|  32.3M|		case FILE_PSTRING:
  ------------------
  |  |  235|  32.3M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1689:3): [True: 17.2k, False: 48.6M]
  ------------------
 1690|  32.3M|		case FILE_BESTRING16:
  ------------------
  |  |  240|  32.3M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1690:3): [True: 119, False: 48.6M]
  ------------------
 1691|  32.3M|		case FILE_LESTRING16:
  ------------------
  |  |  241|  32.3M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1691:3): [True: 38.3k, False: 48.5M]
  ------------------
 1692|  32.5M|		case FILE_REGEX:
  ------------------
  |  |  239|  32.5M|#define				FILE_REGEX		17
  ------------------
  |  Branch (1692:3): [True: 189k, False: 48.4M]
  ------------------
 1693|  32.9M|		case FILE_SEARCH:
  ------------------
  |  |  242|  32.9M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1693:3): [True: 429k, False: 48.2M]
  ------------------
 1694|  32.9M|		case FILE_DEFAULT:
  ------------------
  |  |  225|  32.9M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1694:3): [True: 6.48k, False: 48.6M]
  ------------------
 1695|  32.9M|		case FILE_INDIRECT:
  ------------------
  |  |  263|  32.9M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1695:3): [True: 0, False: 48.6M]
  ------------------
 1696|  32.9M|		case FILE_NAME:
  ------------------
  |  |  267|  32.9M|#define				FILE_NAME		45
  ------------------
  |  Branch (1696:3): [True: 0, False: 48.6M]
  ------------------
 1697|  32.9M|		case FILE_USE:
  ------------------
  |  |  268|  32.9M|#define				FILE_USE		46
  ------------------
  |  Branch (1697:3): [True: 0, False: 48.6M]
  ------------------
 1698|  32.9M|		case FILE_CLEAR:
  ------------------
  |  |  269|  32.9M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1698:3): [True: 1.37k, False: 48.6M]
  ------------------
 1699|  32.9M|		case FILE_DER:
  ------------------
  |  |  270|  32.9M|#define				FILE_DER		48
  ------------------
  |  Branch (1699:3): [True: 0, False: 48.6M]
  ------------------
 1700|  32.9M|		case FILE_GUID:
  ------------------
  |  |  271|  32.9M|#define				FILE_GUID		49
  ------------------
  |  Branch (1700:3): [True: 19.3k, False: 48.6M]
  ------------------
 1701|  32.9M|		case FILE_OCTAL:
  ------------------
  |  |  281|  32.9M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1701:3): [True: 0, False: 48.6M]
  ------------------
 1702|  32.9M|			break;
 1703|      0|		default:
  ------------------
  |  Branch (1703:3): [True: 0, False: 48.6M]
  ------------------
 1704|      0|			if (ms->flags & MAGIC_CHECK)
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (1704:8): [True: 0, False: 0]
  ------------------
 1705|      0|			    file_magwarn(ms, "cannot happen: m->type=%d\n",
 1706|      0|				    m->type);
 1707|      0|			return FILE_BADSIZE;
  ------------------
  |  |  158|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1708|  48.6M|		}
 1709|  48.6M|	}
 1710|  51.4M|	return v;
 1711|  51.4M|}
file_pstring_length_size:
 3626|  23.1k|{
 3627|  23.1k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  357|  23.1k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  386|  23.1k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  378|  23.1k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  23.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  381|  23.1k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  23.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  380|  23.1k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  23.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  383|  23.1k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  23.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  382|  23.1k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  23.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3628|  22.1k|	case PSTRING_1_LE:
  ------------------
  |  |  379|  22.1k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  370|  22.1k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3628:2): [True: 22.1k, False: 984]
  ------------------
 3629|  22.1k|		return 1;
 3630|    126|	case PSTRING_2_LE:
  ------------------
  |  |  381|    126|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  370|    126|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3630:2): [True: 126, False: 22.9k]
  ------------------
 3631|    666|	case PSTRING_2_BE:
  ------------------
  |  |  380|    666|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  370|    666|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3631:2): [True: 540, False: 22.5k]
  ------------------
 3632|    666|		return 2;
 3633|     72|	case PSTRING_4_LE:
  ------------------
  |  |  383|     72|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  370|     72|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3633:2): [True: 72, False: 23.0k]
  ------------------
 3634|    318|	case PSTRING_4_BE:
  ------------------
  |  |  382|    318|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  370|    318|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3634:2): [True: 246, False: 22.8k]
  ------------------
 3635|    318|		return 4;
 3636|      0|	default:
  ------------------
  |  Branch (3636:2): [True: 0, False: 23.1k]
  ------------------
 3637|      0|		file_error(ms, 0, "corrupt magic file "
 3638|      0|		    "(bad pascal string length %d)",
 3639|      0|		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  357|      0|#define str_flags _u._s._flags
  ------------------
              		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  386|      0|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  378|      0|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  381|      0|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  380|      0|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  383|      0|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  382|      0|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3640|      0|		return FILE_BADSIZE;
  ------------------
  |  |  158|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 3641|  23.1k|	}
 3642|  23.1k|}
file_pstring_get_length:
 3646|  17.2k|{
 3647|  17.2k|	size_t len = 0;
 3648|  17.2k|	const unsigned char *s = RCAST(const unsigned char *, ss);
  ------------------
  |  |  427|  17.2k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 3649|  17.2k|	unsigned int s3, s2, s1, s0;
 3650|       |
 3651|  17.2k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  357|  17.2k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  386|  17.2k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  378|  17.2k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  17.2k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  381|  17.2k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  17.2k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  380|  17.2k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  17.2k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  383|  17.2k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  17.2k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  382|  17.2k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  17.2k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3652|  16.9k|	case PSTRING_1_LE:
  ------------------
  |  |  379|  16.9k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  370|  16.9k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3652:2): [True: 16.9k, False: 332]
  ------------------
 3653|  16.9k|		len = *s;
 3654|  16.9k|		break;
 3655|     42|	case PSTRING_2_LE:
  ------------------
  |  |  381|     42|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  370|     42|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3655:2): [True: 42, False: 17.2k]
  ------------------
 3656|     42|		s0 = s[0];
 3657|     42|		s1 = s[1];
 3658|     42|		len = (s1 << 8) | s0;
 3659|     42|		break;
 3660|    180|	case PSTRING_2_BE:
  ------------------
  |  |  380|    180|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  370|    180|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3660:2): [True: 180, False: 17.1k]
  ------------------
 3661|    180|		s0 = s[0];
 3662|    180|		s1 = s[1];
 3663|    180|		len = (s0 << 8) | s1;
 3664|    180|		break;
 3665|     28|	case PSTRING_4_LE:
  ------------------
  |  |  383|     28|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  370|     28|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3665:2): [True: 28, False: 17.2k]
  ------------------
 3666|     28|		s0 = s[0];
 3667|     28|		s1 = s[1];
 3668|     28|		s2 = s[2];
 3669|     28|		s3 = s[3];
 3670|     28|		len = (s3 << 24) | (s2 << 16) | (s1 << 8) | s0;
 3671|     28|		break;
 3672|     82|	case PSTRING_4_BE:
  ------------------
  |  |  382|     82|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  370|     82|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3672:2): [True: 82, False: 17.2k]
  ------------------
 3673|     82|		s0 = s[0];
 3674|     82|		s1 = s[1];
 3675|     82|		s2 = s[2];
 3676|     82|		s3 = s[3];
 3677|     82|		len = (s0 << 24) | (s1 << 16) | (s2 << 8) | s3;
 3678|     82|		break;
 3679|      0|	default:
  ------------------
  |  Branch (3679:2): [True: 0, False: 17.2k]
  ------------------
 3680|      0|		file_error(ms, 0, "corrupt magic file "
 3681|      0|		    "(bad pascal string length %d)",
 3682|      0|		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  357|      0|#define str_flags _u._s._flags
  ------------------
              		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  386|      0|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  378|      0|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  381|      0|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  380|      0|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  383|      0|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  382|      0|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3683|      0|		return FILE_BADSIZE;
  ------------------
  |  |  158|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 3684|  17.2k|	}
 3685|       |
 3686|  17.2k|	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  357|  17.2k|#define str_flags _u._s._flags
  ------------------
              	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  387|  17.2k|#define PSTRING_LENGTH_INCLUDES_ITSELF		BIT(12)
  |  |  ------------------
  |  |  |  |  370|  17.2k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3686:6): [True: 0, False: 17.2k]
  ------------------
 3687|      0|		size_t l = file_pstring_length_size(ms, m);
 3688|      0|		if (l == FILE_BADSIZE)
  ------------------
  |  |  158|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (3688:7): [True: 0, False: 0]
  ------------------
 3689|      0|			return l;
 3690|      0|		len -= l;
 3691|      0|	}
 3692|       |
 3693|  17.2k|	return len;
 3694|  17.2k|}
file_magicfind:
 3698|  12.9k|{
 3699|  12.9k|	uint32_t i, j;
 3700|  12.9k|	struct mlist *mlist, *ml;
 3701|       |
 3702|  12.9k|	mlist = ms->mlist[1];
 3703|       |
 3704|  12.9k|	for (ml = mlist->next; ml != mlist; ml = ml->next) {
  ------------------
  |  Branch (3704:25): [True: 12.9k, False: 0]
  ------------------
 3705|  12.9k|		struct magic *ma = ml->magic;
 3706|  36.9M|		for (i = 0; i < ml->nmagic; i++) {
  ------------------
  |  Branch (3706:15): [True: 36.9M, False: 0]
  ------------------
 3707|  36.9M|			if (ma[i].type != FILE_NAME)
  ------------------
  |  |  267|  36.9M|#define				FILE_NAME		45
  ------------------
  |  Branch (3707:8): [True: 35.4M, False: 1.51M]
  ------------------
 3708|  35.4M|				continue;
 3709|  1.51M|			if (strcmp(ma[i].value.s, name) == 0) {
  ------------------
  |  Branch (3709:8): [True: 12.9k, False: 1.50M]
  ------------------
 3710|  12.9k|				v->magic = &ma[i];
 3711|  12.9k|				v->magic_rxcomp = &(ml->magic_rxcomp[i]);
 3712|   704k|				for (j = i + 1; j < ml->nmagic; j++)
  ------------------
  |  Branch (3712:21): [True: 704k, False: 22]
  ------------------
 3713|   704k|				    if (ma[j].cont_level == 0)
  ------------------
  |  Branch (3713:13): [True: 12.9k, False: 691k]
  ------------------
 3714|  12.9k|					    break;
 3715|  12.9k|				v->nmagic = j - i;
 3716|  12.9k|				return 0;
 3717|  12.9k|			}
 3718|  1.51M|		}
 3719|  12.9k|	}
 3720|      0|	return -1;
 3721|  12.9k|}
apprentice.c:mlist_free:
  674|      4|{
  675|      4|	struct mlist *ml, *next;
  676|       |
  677|      4|	if (mlist == NULL)
  ------------------
  |  Branch (677:6): [True: 4, False: 0]
  ------------------
  678|      4|		return;
  679|       |
  680|      0|	for (ml = mlist->next; ml != mlist;) {
  ------------------
  |  Branch (680:25): [True: 0, False: 0]
  ------------------
  681|      0|		next = ml->next;
  682|      0|		mlist_free_one(ml);
  683|      0|		ml = next;
  684|      0|	}
  685|      0|	mlist_free_one(mlist);
  686|      0|}
apprentice.c:init_file_tables:
  427|      2|{
  428|      2|	static int done = 0;
  429|      2|	const struct type_tbl_s *p;
  430|       |
  431|      2|	if (done)
  ------------------
  |  Branch (431:6): [True: 0, False: 2]
  ------------------
  432|      0|		return;
  433|      2|	done++;
  434|       |
  435|    122|	for (p = type_tbl; p->len; p++) {
  ------------------
  |  Branch (435:21): [True: 120, False: 2]
  ------------------
  436|    120|		assert(p->type < FILE_NAMES_SIZE);
  437|    120|		file_names[p->type] = p->name;
  438|    120|		file_formats[p->type] = p->format;
  439|    120|	}
  440|      2|	assert(p - type_tbl == FILE_NAMES_SIZE);
  441|      2|}
apprentice.c:mlist_alloc:
  632|      4|{
  633|      4|	struct mlist *mlist;
  634|      4|	if ((mlist = CAST(struct mlist *, calloc(1, sizeof(*mlist)))) == NULL) {
  ------------------
  |  |  426|      4|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (634:6): [True: 0, False: 4]
  ------------------
  635|      0|		return NULL;
  636|      0|	}
  637|      4|	mlist->next = mlist->prev = mlist;
  638|      4|	return mlist;
  639|      4|}
apprentice.c:add_mlist:
  445|      4|{
  446|      4|	struct mlist *ml;
  447|       |
  448|      4|	mlp->map = NULL;
  449|      4|	if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL)
  ------------------
  |  |  426|      4|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (449:6): [True: 0, False: 4]
  ------------------
  450|      0|		return -1;
  451|       |
  452|      4|	ml->map = idx == 0 ? map : NULL;
  ------------------
  |  Branch (452:12): [True: 2, False: 2]
  ------------------
  453|      4|	ml->magic = map->magic[idx];
  454|      4|	ml->nmagic = map->nmagic[idx];
  455|      4|	if (ml->nmagic) {
  ------------------
  |  Branch (455:6): [True: 4, False: 0]
  ------------------
  456|      4|		ml->magic_rxcomp = CAST(file_regex_t **,
  ------------------
  |  |  426|      4|#define CAST(T, b)	((T)(b))
  ------------------
  457|      4|		    calloc(ml->nmagic, sizeof(*ml->magic_rxcomp)));
  458|      4|		if (ml->magic_rxcomp == NULL) {
  ------------------
  |  Branch (458:7): [True: 0, False: 4]
  ------------------
  459|      0|			free(ml);
  460|      0|			return -1;
  461|      0|		}
  462|      4|	} else
  463|      0|		ml->magic_rxcomp = NULL;
  464|      4|	mlp->prev->next = ml;
  465|      4|	ml->prev = mlp->prev;
  466|      4|	ml->next = mlp;
  467|      4|	mlp->prev = ml;
  468|      4|	return 0;
  469|      4|}
apprentice.c:apprentice_1:
  476|      2|{
  477|      2|	struct magic_map *map;
  478|      2|#ifndef COMPILE_ONLY
  479|      2|	size_t i;
  480|      2|#endif
  481|       |
  482|      2|	if (magicsize != FILE_MAGICSIZE) {
  ------------------
  |  |  165|      2|#define FILE_MAGICSIZE	376
  ------------------
  |  Branch (482:6): [True: 0, False: 2]
  ------------------
  483|      0|		file_error(ms, 0, "magic element size %lu != %lu",
  484|      0|		    CAST(unsigned long, sizeof(*map->magic[0])),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  485|      0|		    CAST(unsigned long, FILE_MAGICSIZE));
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  486|      0|		return -1;
  487|      0|	}
  488|       |
  489|      2|	if (action == FILE_COMPILE) {
  ------------------
  |  |  171|      2|#define FILE_COMPILE	2
  ------------------
  |  Branch (489:6): [True: 0, False: 2]
  ------------------
  490|      0|		map = apprentice_load(ms, fn, action);
  491|      0|		if (map == NULL)
  ------------------
  |  Branch (491:7): [True: 0, False: 0]
  ------------------
  492|      0|			return -1;
  493|      0|		return apprentice_compile(ms, map, fn);
  494|      0|	}
  495|       |
  496|      2|#ifndef COMPILE_ONLY
  497|      2|	map = apprentice_map(ms, fn);
  498|      2|	if (map == NULL) {
  ------------------
  |  Branch (498:6): [True: 0, False: 2]
  ------------------
  499|      0|		if (ms->flags & MAGIC_CHECK)
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (499:7): [True: 0, False: 0]
  ------------------
  500|      0|			file_magwarn(ms, "using regular magic file `%s'", fn);
  501|      0|		map = apprentice_load(ms, fn, action);
  502|      0|		if (map == NULL)
  ------------------
  |  Branch (502:7): [True: 0, False: 0]
  ------------------
  503|      0|			return -1;
  504|      0|	}
  505|       |
  506|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  445|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (506:14): [True: 4, False: 2]
  ------------------
  507|      4|		if (add_mlist(ms->mlist[i], map, i) == -1) {
  ------------------
  |  Branch (507:7): [True: 0, False: 4]
  ------------------
  508|       |			/* failed to add to any list, free explicitly */
  509|      0|			if (i == 0)
  ------------------
  |  Branch (509:8): [True: 0, False: 0]
  ------------------
  510|      0|				apprentice_unmap(map);
  511|      0|			else
  512|      0|				mlist_free_all(ms);
  513|      0|			file_oomem(ms, sizeof(*ms->mlist[0]));
  514|      0|			return -1;
  515|      0|		}
  516|      4|	}
  517|       |
  518|      2|	if (action == FILE_LIST) {
  ------------------
  |  |  172|      2|#define FILE_LIST	3
  ------------------
  |  Branch (518:6): [True: 0, False: 2]
  ------------------
  519|      0|		for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  445|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (519:15): [True: 0, False: 0]
  ------------------
  520|      0|			printf("Set %" SIZE_T_FORMAT "u:\nBinary patterns:\n",
  521|      0|			    i);
  522|      0|			apprentice_list(ms->mlist[i], BINTEST);
  ------------------
  |  |  210|      0|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  523|      0|			printf("Text patterns:\n");
  524|      0|			apprentice_list(ms->mlist[i], TEXTTEST);
  ------------------
  |  |  212|      0|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  525|      0|		}
  526|      0|	}
  527|      2|	return 0;
  528|       |#else
  529|       |	return 0;
  530|       |#endif /* COMPILE_ONLY */
  531|      2|}
apprentice.c:mkdbname:
 3458|      2|{
 3459|      2|	const char *p, *q;
 3460|      2|	char *buf;
 3461|       |
 3462|      2|	if (strip) {
  ------------------
  |  Branch (3462:6): [True: 0, False: 2]
  ------------------
 3463|      0|		if ((p = strrchr(fn, '/')) != NULL)
  ------------------
  |  Branch (3463:7): [True: 0, False: 0]
  ------------------
 3464|      0|			fn = ++p;
 3465|      0|	}
 3466|       |
 3467|     94|	for (q = fn; *q; q++)
  ------------------
  |  Branch (3467:15): [True: 92, False: 2]
  ------------------
 3468|     92|		continue;
 3469|       |	/* Look for .mgc */
 3470|      6|	for (p = ext + sizeof(ext) - 1; p >= ext && q >= fn; p--, q--)
  ------------------
  |  Branch (3470:34): [True: 6, False: 0]
  |  Branch (3470:46): [True: 6, False: 0]
  ------------------
 3471|      6|		if (*p != *q)
  ------------------
  |  Branch (3471:7): [True: 2, False: 4]
  ------------------
 3472|      2|			break;
 3473|       |
 3474|       |	/* Did not find .mgc, restore q */
 3475|      2|	if (p >= ext)
  ------------------
  |  Branch (3475:6): [True: 2, False: 0]
  ------------------
 3476|      6|		while (*q)
  ------------------
  |  Branch (3476:10): [True: 4, False: 2]
  ------------------
 3477|      4|			q++;
 3478|       |
 3479|      2|	q++;
 3480|       |	/* Compatibility with old code that looked in .mime */
 3481|      2|	if (ms->flags & MAGIC_MIME) {
  ------------------
  |  |   44|      2|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|      2|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|      2|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (3481:6): [True: 0, False: 2]
  ------------------
 3482|      0|		if (asprintf(&buf, "%.*s.mime%s", CAST(int, q - fn), fn, ext)
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3482:7): [True: 0, False: 0]
  ------------------
 3483|      0|		    < 0)
 3484|      0|			return NULL;
 3485|      0|		if (access(buf, R_OK) != -1) {
  ------------------
  |  Branch (3485:7): [True: 0, False: 0]
  ------------------
 3486|      0|			ms->flags &= MAGIC_MIME_TYPE;
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
 3487|      0|			return buf;
 3488|      0|		}
 3489|      0|		free(buf);
 3490|      0|	}
 3491|      2|	if (asprintf(&buf, "%.*s%s", CAST(int, q - fn), fn, ext) < 0)
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3491:6): [True: 0, False: 2]
  ------------------
 3492|      0|		return NULL;
 3493|       |
 3494|       |	/* Compatibility with old code that looked in .mime */
 3495|      2|	if (strstr(fn, ".mime") != NULL)
  ------------------
  |  Branch (3495:6): [True: 0, False: 2]
  ------------------
 3496|      0|		ms->flags &= MAGIC_MIME_TYPE;
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
 3497|      2|	return buf;
 3498|      2|}
apprentice.c:apprentice_map:
 3266|      2|{
 3267|      2|	int fd;
 3268|      2|	struct stat st;
 3269|      2|	char *dbname = NULL;
 3270|      2|	struct magic_map *map;
 3271|      2|	struct magic_map *rv = NULL;
 3272|       |
 3273|      2|	fd = -1;
 3274|      2|	if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3274:6): [True: 0, False: 2]
  ------------------
 3275|      0|		file_oomem(ms, sizeof(*map));
 3276|      0|		goto error;
 3277|      0|	}
 3278|      2|	map->type = MAP_TYPE_USER;	/* unspecified */
  ------------------
  |  |   86|      2|#define MAP_TYPE_USER	0
  ------------------
 3279|       |
 3280|      2|	dbname = mkdbname(ms, fn, 0);
 3281|      2|	if (dbname == NULL)
  ------------------
  |  Branch (3281:6): [True: 0, False: 2]
  ------------------
 3282|      0|		goto error;
 3283|       |
 3284|      2|	if ((fd = open(dbname, O_RDONLY|O_BINARY)) == -1)
  ------------------
  |  |  689|      2|#define O_BINARY	0
  ------------------
  |  Branch (3284:6): [True: 0, False: 2]
  ------------------
 3285|      0|		goto error;
 3286|       |
 3287|      2|	if (fstat(fd, &st) == -1) {
  ------------------
  |  Branch (3287:6): [True: 0, False: 2]
  ------------------
 3288|      0|		file_error(ms, errno, "cannot stat `%s'", dbname);
 3289|      0|		goto error;
 3290|      0|	}
 3291|      2|	if (st.st_size < 8 || st.st_size > maxoff_t()) {
  ------------------
  |  Branch (3291:6): [True: 0, False: 2]
  |  Branch (3291:24): [True: 0, False: 2]
  ------------------
 3292|      0|		file_error(ms, 0, "file `%s' is too %s", dbname,
 3293|      0|		    st.st_size < 8 ? "small" : "large");
  ------------------
  |  Branch (3293:7): [True: 0, False: 0]
  ------------------
 3294|      0|		goto error;
 3295|      0|	}
 3296|       |
 3297|      2|	map->len = CAST(size_t, st.st_size);
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3298|      2|#ifdef QUICK
 3299|      2|	map->type = MAP_TYPE_MMAP;
  ------------------
  |  |   88|      2|#define MAP_TYPE_MMAP	2
  ------------------
 3300|      2|	if ((map->p = mmap(0, CAST(size_t, st.st_size), PROT_READ|PROT_WRITE,
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3300:6): [True: 0, False: 2]
  ------------------
 3301|      2|	    MAP_PRIVATE|MAP_FILE, fd, CAST(off_t, 0))) == MAP_FAILED) {
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3302|      0|		file_error(ms, errno, "cannot map `%s'", dbname);
 3303|      0|		goto error;
 3304|      0|	}
 3305|       |#else
 3306|       |	map->type = MAP_TYPE_MALLOC;
 3307|       |	if ((map->p = CAST(void *, malloc(map->len))) == NULL) {
 3308|       |		file_oomem(ms, map->len);
 3309|       |		goto error;
 3310|       |	}
 3311|       |	if (read(fd, map->p, map->len) != (ssize_t)map->len) {
 3312|       |		file_badread(ms);
 3313|       |		goto error;
 3314|       |	}
 3315|       |#endif
 3316|      2|	(void)close(fd);
 3317|      2|	fd = -1;
 3318|       |
 3319|      2|	if (check_buffer(ms, map, dbname) != 0) {
  ------------------
  |  Branch (3319:6): [True: 0, False: 2]
  ------------------
 3320|      0|		goto error;
 3321|      0|	}
 3322|      2|#ifdef QUICK
 3323|      2|	if (mprotect(map->p, CAST(size_t, st.st_size), PROT_READ) == -1) {
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3323:6): [True: 0, False: 2]
  ------------------
 3324|      0|		file_error(ms, errno, "cannot mprotect `%s'", dbname);
 3325|      0|		goto error;
 3326|      0|	}
 3327|      2|#endif
 3328|       |
 3329|      2|	free(dbname);
 3330|      2|	return map;
 3331|       |
 3332|      0|error:
 3333|      0|	if (fd != -1)
  ------------------
  |  Branch (3333:6): [True: 0, False: 0]
  ------------------
 3334|      0|		(void)close(fd);
 3335|      0|	apprentice_unmap(map);
 3336|      0|	free(dbname);
 3337|      0|	return rv;
 3338|      2|}
apprentice.c:maxoff_t:
  332|      2|maxoff_t(void) {
  333|      2|	if (/*CONSTCOND*/sizeof(off_t) == sizeof(int))
  ------------------
  |  Branch (333:19): [Folded - Ignored]
  ------------------
  334|      0|		return CAST(off_t, INT_MAX);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  335|      2|	if (/*CONSTCOND*/sizeof(off_t) == sizeof(long))
  ------------------
  |  Branch (335:19): [Folded - Ignored]
  ------------------
  336|      2|		return CAST(off_t, LONG_MAX);
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
  337|      0|	return 0x7fffffff;
  338|      2|}
apprentice.c:check_buffer:
 3342|      2|{
 3343|      2|	uint32_t *ptr;
 3344|      2|	uint32_t entries, nentries;
 3345|      2|	uint32_t version;
 3346|      2|	int i, needsbyteswap;
 3347|       |
 3348|      2|	ptr = CAST(uint32_t *, map->p);
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3349|      2|	if (*ptr != MAGICNO) {
  ------------------
  |  |  163|      2|#define MAGICNO		0xF11E041C
  ------------------
  |  Branch (3349:6): [True: 0, False: 2]
  ------------------
 3350|      0|		if (swap4(*ptr) != MAGICNO) {
  ------------------
  |  |  137|      0|#define swap4(x)	bswap_32(x)
  ------------------
              		if (swap4(*ptr) != MAGICNO) {
  ------------------
  |  |  163|      0|#define MAGICNO		0xF11E041C
  ------------------
  |  Branch (3350:7): [True: 0, False: 0]
  ------------------
 3351|      0|			file_error(ms, 0, "bad magic in `%s'", dbname);
 3352|      0|			return -1;
 3353|      0|		}
 3354|      0|		needsbyteswap = 1;
 3355|      0|	} else
 3356|      2|		needsbyteswap = 0;
 3357|      2|	if (needsbyteswap)
  ------------------
  |  Branch (3357:6): [True: 0, False: 2]
  ------------------
 3358|      0|		version = swap4(ptr[1]);
  ------------------
  |  |  137|      0|#define swap4(x)	bswap_32(x)
  ------------------
 3359|      2|	else
 3360|      2|		version = ptr[1];
 3361|      2|	if (version != VERSIONNO) {
  ------------------
  |  |  164|      2|#define VERSIONNO	18
  ------------------
  |  Branch (3361:6): [True: 0, False: 2]
  ------------------
 3362|      0|		file_error(ms, 0, "File %s supports only version %d magic "
 3363|      0|		    "files. `%s' is version %d", VERSION,
  ------------------
  |  |  356|      0|#define VERSION "5.43"
  ------------------
 3364|      0|		    VERSIONNO, dbname, version);
  ------------------
  |  |  164|      0|#define VERSIONNO	18
  ------------------
 3365|      0|		return -1;
 3366|      0|	}
 3367|      2|	entries = CAST(uint32_t, map->len / sizeof(struct magic));
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3368|      2|	if ((entries * sizeof(struct magic)) != map->len) {
  ------------------
  |  Branch (3368:6): [True: 0, False: 2]
  ------------------
 3369|      0|		file_error(ms, 0, "Size of `%s' %" SIZE_T_FORMAT "u is not "
 3370|      0|		    "a multiple of %" SIZE_T_FORMAT "u",
 3371|      0|		    dbname, map->len, sizeof(struct magic));
 3372|      0|		return -1;
 3373|      0|	}
 3374|      2|	map->magic[0] = CAST(struct magic *, map->p) + 1;
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3375|      2|	nentries = 0;
 3376|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  445|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (3376:14): [True: 4, False: 2]
  ------------------
 3377|      4|		if (needsbyteswap)
  ------------------
  |  Branch (3377:7): [True: 0, False: 4]
  ------------------
 3378|      0|			map->nmagic[i] = swap4(ptr[i + 2]);
  ------------------
  |  |  137|      0|#define swap4(x)	bswap_32(x)
  ------------------
 3379|      4|		else
 3380|      4|			map->nmagic[i] = ptr[i + 2];
 3381|      4|		if (i != MAGIC_SETS - 1)
  ------------------
  |  |  445|      4|#define MAGIC_SETS	2
  ------------------
  |  Branch (3381:7): [True: 2, False: 2]
  ------------------
 3382|      2|			map->magic[i + 1] = map->magic[i] + map->nmagic[i];
 3383|      4|		nentries += map->nmagic[i];
 3384|      4|	}
 3385|      2|	if (entries != nentries + 1) {
  ------------------
  |  Branch (3385:6): [True: 0, False: 2]
  ------------------
 3386|      0|		file_error(ms, 0, "Inconsistent entries in `%s' %u != %u",
 3387|      0|		    dbname, entries, nentries + 1);
 3388|      0|		return -1;
 3389|      0|	}
 3390|      2|	if (needsbyteswap)
  ------------------
  |  Branch (3390:6): [True: 0, False: 2]
  ------------------
 3391|      0|		for (i = 0; i < MAGIC_SETS; i++)
  ------------------
  |  |  445|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (3391:15): [True: 0, False: 0]
  ------------------
 3392|      0|			byteswap(map->magic[i], map->nmagic[i]);
 3393|      2|	return 0;
 3394|      2|}

file_ascmagic:
   72|  11.3k|{
   73|  11.3k|	file_unichar_t *ubuf = NULL;
   74|  11.3k|	size_t ulen = 0;
   75|  11.3k|	int rv = 1;
   76|  11.3k|	struct buffer bb;
   77|       |
   78|  11.3k|	const char *code = NULL;
   79|  11.3k|	const char *code_mime = NULL;
   80|  11.3k|	const char *type = NULL;
   81|       |
   82|  11.3k|	bb = *b;
   83|  11.3k|	bb.flen = trim_nuls(CAST(const unsigned char *, b->fbuf), b->flen);
  ------------------
  |  |  426|  11.3k|#define CAST(T, b)	((T)(b))
  ------------------
   84|       |	/*
   85|       |	 * Avoid trimming at an odd byte if the original buffer was evenly
   86|       |	 * sized; this avoids losing the last character on UTF-16 LE text
   87|       |	 */
   88|  11.3k|	if ((bb.flen & 1) && !(b->flen & 1))
  ------------------
  |  Branch (88:6): [True: 4.88k, False: 6.47k]
  |  Branch (88:23): [True: 1.28k, False: 3.59k]
  ------------------
   89|  1.28k|		bb.flen++;
   90|       |
   91|       |	/* If file doesn't look like any sort of text, give up. */
   92|  11.3k|	if (file_encoding(ms, &bb, &ubuf, &ulen, &code, &code_mime,
  ------------------
  |  Branch (92:6): [True: 8.92k, False: 2.44k]
  ------------------
   93|  11.3k|	    &type) == 0)
   94|  8.92k|		rv = 0;
   95|  2.44k|        else
   96|  2.44k|		rv = file_ascmagic_with_encoding(ms, &bb,
   97|  2.44k|		    ubuf, ulen, code, type, text);
   98|       |
   99|  11.3k|	free(ubuf);
  100|       |
  101|  11.3k|	return rv;
  102|  11.3k|}
file_ascmagic_with_encoding:
  108|  2.44k|{
  109|  2.44k|	struct buffer bb;
  110|  2.44k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  2.44k|#define CAST(T, b)	((T)(b))
  ------------------
  111|  2.44k|	size_t nbytes = b->flen;
  112|  2.44k|	unsigned char *utf8_buf = NULL, *utf8_end;
  113|  2.44k|	size_t mlen, i, len;
  114|  2.44k|	int rv = -1;
  115|  2.44k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  2.44k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.44k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.44k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  116|  2.44k|	int need_separator = 0;
  117|       |
  118|  2.44k|	const char *subtype = NULL;
  119|       |
  120|  2.44k|	int has_escapes = 0;
  121|  2.44k|	int has_backspace = 0;
  122|  2.44k|	int seen_cr = 0;
  123|       |
  124|  2.44k|	int n_crlf = 0;
  125|  2.44k|	int n_lf = 0;
  126|  2.44k|	int n_cr = 0;
  127|  2.44k|	int n_nel = 0;
  128|  2.44k|	int executable = 0;
  129|       |
  130|  2.44k|	size_t last_line_end = CAST(size_t, -1);
  ------------------
  |  |  426|  2.44k|#define CAST(T, b)	((T)(b))
  ------------------
  131|  2.44k|	size_t has_long_lines = 0;
  132|       |
  133|  2.44k|	nbytes = trim_nuls(buf, nbytes);
  134|       |
  135|       |	/* If we have fewer than 2 bytes, give up. */
  136|  2.44k|	if (nbytes <= 1) {
  ------------------
  |  Branch (136:6): [True: 6, False: 2.43k]
  ------------------
  137|      6|		rv = 0;
  138|      6|		goto done;
  139|      6|	}
  140|       |
  141|  2.43k|	if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  2.37k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (141:6): [True: 2.37k, False: 58]
  |  Branch (141:18): [True: 2.37k, False: 0]
  ------------------
  142|       |		/* Convert ubuf to UTF-8 and try text soft magic */
  143|       |		/* malloc size is a conservative overestimate; could be
  144|       |		   improved, or at least realloced after conversion. */
  145|  2.37k|		mlen = ulen * 6;
  146|  2.37k|		if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  426|  2.37k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (146:7): [True: 0, False: 2.37k]
  ------------------
  147|      0|			file_oomem(ms, mlen);
  148|      0|			goto done;
  149|      0|		}
  150|  2.37k|		if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen))
  ------------------
  |  Branch (150:7): [True: 54, False: 2.32k]
  ------------------
  151|  2.37k|		    == NULL)
  152|     54|			goto done;
  153|  2.32k|		buffer_init(&bb, b->fd, &b->st, utf8_buf,
  154|  2.32k|		    CAST(size_t, utf8_end - utf8_buf));
  ------------------
  |  |  426|  2.32k|#define CAST(T, b)	((T)(b))
  ------------------
  155|       |
  156|  2.32k|		if ((rv = file_softmagic(ms, &bb, NULL, NULL,
  ------------------
  |  Branch (156:7): [True: 2.10k, False: 221]
  ------------------
  157|  2.32k|		    TEXTTEST, text)) == 0)
  ------------------
  |  |  212|  2.32k|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  158|  2.10k|			rv = -1;
  159|    221|		else
  160|    221|			need_separator = 1;
  161|  2.32k|		buffer_fini(&bb);
  162|  2.32k|		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  2.32k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  2.32k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (162:7): [True: 0, False: 2.32k]
  ------------------
  163|      0|			rv = rv == -1 ? 0 : 1;
  ------------------
  |  Branch (163:9): [True: 0, False: 0]
  ------------------
  164|      0|			goto done;
  165|      0|		}
  166|  2.32k|	}
  167|       |
  168|  2.38k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  2.38k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  2.38k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (168:6): [True: 0, False: 2.38k]
  ------------------
  169|      0|		rv = 0;
  170|      0|		goto done;
  171|      0|	}
  172|       |
  173|       |	/* Now try to discover other details about the file. */
  174|  7.25M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (174:14): [True: 7.25M, False: 2.38k]
  ------------------
  175|  7.25M|		if (ubuf[i] == '\n') {
  ------------------
  |  Branch (175:7): [True: 1.69M, False: 5.55M]
  ------------------
  176|  1.69M|			if (seen_cr)
  ------------------
  |  Branch (176:8): [True: 3.17k, False: 1.69M]
  ------------------
  177|  3.17k|				n_crlf++;
  178|  1.69M|			else
  179|  1.69M|				n_lf++;
  180|  1.69M|			last_line_end = i;
  181|  5.55M|		} else if (seen_cr)
  ------------------
  |  Branch (181:14): [True: 1.02M, False: 4.52M]
  ------------------
  182|  1.02M|			n_cr++;
  183|       |
  184|  7.25M|		seen_cr = (ubuf[i] == '\r');
  185|  7.25M|		if (seen_cr)
  ------------------
  |  Branch (185:7): [True: 1.02M, False: 6.22M]
  ------------------
  186|  1.02M|			last_line_end = i;
  187|       |
  188|  7.25M|		if (ubuf[i] == 0x85) { /* X3.64/ECMA-43 "next line" character */
  ------------------
  |  Branch (188:7): [True: 275k, False: 6.97M]
  ------------------
  189|   275k|			n_nel++;
  190|   275k|			last_line_end = i;
  191|   275k|		}
  192|       |
  193|       |		/* If this line is _longer_ than MAXLINELEN, remember it. */
  194|  7.25M|		if (i > last_line_end + MAXLINELEN) {
  ------------------
  |  |   49|  7.25M|#define MAXLINELEN 300	/* longest sane line length */
  ------------------
  |  Branch (194:7): [True: 4.04M, False: 3.20M]
  ------------------
  195|  4.04M|			size_t ll = i - last_line_end;
  196|  4.04M|			if (ll > has_long_lines)
  ------------------
  |  Branch (196:8): [True: 3.95M, False: 85.7k]
  ------------------
  197|  3.95M|				has_long_lines = ll;
  198|  4.04M|		}
  199|       |
  200|  7.25M|		if (ubuf[i] == '\033')
  ------------------
  |  Branch (200:7): [True: 562, False: 7.25M]
  ------------------
  201|    562|			has_escapes = 1;
  202|  7.25M|		if (ubuf[i] == '\b')
  ------------------
  |  Branch (202:7): [True: 102k, False: 7.14M]
  ------------------
  203|   102k|			has_backspace = 1;
  204|  7.25M|	}
  205|       |
  206|       |	/* Beware, if the data has been truncated, the final CR could have
  207|       |	   been followed by a LF.  If we have ms->bytes_max bytes, it indicates
  208|       |	   that the data might have been truncated, probably even before
  209|       |	   this function was called. */
  210|  2.38k|	if (seen_cr && nbytes < ms->bytes_max)
  ------------------
  |  Branch (210:6): [True: 73, False: 2.30k]
  |  Branch (210:17): [True: 72, False: 1]
  ------------------
  211|     72|		n_cr++;
  212|       |
  213|  2.38k|	if (strcmp(type, "binary") == 0) {
  ------------------
  |  Branch (213:6): [True: 0, False: 2.38k]
  ------------------
  214|      0|		rv = 0;
  215|      0|		goto done;
  216|      0|	}
  217|  2.38k|	len = file_printedlen(ms);
  218|  2.38k|	if (mime) {
  ------------------
  |  Branch (218:6): [True: 0, False: 2.38k]
  ------------------
  219|      0|		if ((mime & MAGIC_MIME_TYPE) != 0) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (219:7): [True: 0, False: 0]
  ------------------
  220|      0|			if (len) {
  ------------------
  |  Branch (220:8): [True: 0, False: 0]
  ------------------
  221|       |				/*
  222|       |				 * Softmagic printed something, we
  223|       |				 * are either done, or we need a separator
  224|       |				 */
  225|      0|				if ((ms->flags & MAGIC_CONTINUE) == 0) {
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (225:9): [True: 0, False: 0]
  ------------------
  226|      0|					rv = 1;
  227|      0|					goto done;
  228|      0|				}
  229|      0|				if (need_separator && file_separator(ms) == -1)
  ------------------
  |  Branch (229:9): [True: 0, False: 0]
  |  Branch (229:27): [True: 0, False: 0]
  ------------------
  230|      0|					goto done;
  231|      0|			} else {
  232|      0|				if (file_printf(ms, "text/plain") == -1)
  ------------------
  |  Branch (232:9): [True: 0, False: 0]
  ------------------
  233|      0|					goto done;
  234|      0|			}
  235|      0|		}
  236|  2.38k|	} else {
  237|  2.38k|		if (len) {
  ------------------
  |  Branch (237:7): [True: 644, False: 1.73k]
  ------------------
  238|    644|			switch (file_replace(ms, " text$", ", ")) {
  239|    578|			case 0:
  ------------------
  |  Branch (239:4): [True: 578, False: 66]
  ------------------
  240|    578|				switch (file_replace(ms, " text executable$",
  241|    578|				    ", ")) {
  242|    502|				case 0:
  ------------------
  |  Branch (242:5): [True: 502, False: 76]
  ------------------
  243|    502|					if (file_printf(ms, ", ") == -1)
  ------------------
  |  Branch (243:10): [True: 0, False: 502]
  ------------------
  244|      0|						goto done;
  245|    502|					break;
  246|    502|				case -1:
  ------------------
  |  Branch (246:5): [True: 0, False: 578]
  ------------------
  247|      0|					goto done;
  248|     76|				default:
  ------------------
  |  Branch (248:5): [True: 76, False: 502]
  ------------------
  249|     76|					executable = 1;
  250|     76|					break;
  251|    578|				}
  252|    578|				break;
  253|    578|			case -1:
  ------------------
  |  Branch (253:4): [True: 0, False: 644]
  ------------------
  254|      0|				goto done;
  255|     66|			default:
  ------------------
  |  Branch (255:4): [True: 66, False: 578]
  ------------------
  256|     66|				break;
  257|    644|			}
  258|    644|		}
  259|       |
  260|  2.38k|		if (file_printf(ms, "%s", code) == -1)
  ------------------
  |  Branch (260:7): [True: 0, False: 2.38k]
  ------------------
  261|      0|			goto done;
  262|       |
  263|  2.38k|		if (subtype) {
  ------------------
  |  Branch (263:7): [True: 0, False: 2.38k]
  ------------------
  264|      0|			if (file_printf(ms, " %s", subtype) == -1)
  ------------------
  |  Branch (264:8): [True: 0, False: 0]
  ------------------
  265|      0|				goto done;
  266|      0|		}
  267|       |
  268|  2.38k|		if (file_printf(ms, " %s", type) == -1)
  ------------------
  |  Branch (268:7): [True: 0, False: 2.38k]
  ------------------
  269|      0|			goto done;
  270|       |
  271|  2.38k|		if (executable)
  ------------------
  |  Branch (271:7): [True: 76, False: 2.30k]
  ------------------
  272|     76|			if (file_printf(ms, " executable") == -1)
  ------------------
  |  Branch (272:8): [True: 0, False: 76]
  ------------------
  273|      0|				goto done;
  274|       |
  275|  2.38k|		if (has_long_lines)
  ------------------
  |  Branch (275:7): [True: 168, False: 2.21k]
  ------------------
  276|    168|			if (file_printf(ms, ", with very long lines (%"
  ------------------
  |  Branch (276:8): [True: 0, False: 168]
  ------------------
  277|    168|			    SIZE_T_FORMAT "u)", has_long_lines) == -1)
  278|      0|				goto done;
  279|       |
  280|       |		/*
  281|       |		 * Only report line terminators if we find one other than LF,
  282|       |		 * or if we find none at all.
  283|       |		 */
  284|  2.38k|		if ((n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0) ||
  ------------------
  |  Branch (284:8): [True: 2.30k, False: 72]
  |  Branch (284:23): [True: 2.17k, False: 131]
  |  Branch (284:36): [True: 2.11k, False: 63]
  |  Branch (284:50): [True: 1.93k, False: 176]
  ------------------
  285|  2.38k|		    (n_crlf != 0 || n_cr != 0 || n_nel != 0)) {
  ------------------
  |  Branch (285:8): [True: 72, False: 370]
  |  Branch (285:23): [True: 131, False: 239]
  |  Branch (285:36): [True: 63, False: 176]
  ------------------
  286|  2.20k|			if (file_printf(ms, ", with") == -1)
  ------------------
  |  Branch (286:8): [True: 0, False: 2.20k]
  ------------------
  287|      0|				goto done;
  288|       |
  289|  2.20k|			if (n_crlf == 0 && n_cr == 0 &&
  ------------------
  |  Branch (289:8): [True: 2.13k, False: 72]
  |  Branch (289:23): [True: 2.00k, False: 131]
  ------------------
  290|  2.20k|			    n_nel == 0 && n_lf == 0) {
  ------------------
  |  Branch (290:8): [True: 1.93k, False: 63]
  |  Branch (290:22): [True: 1.93k, False: 0]
  ------------------
  291|  1.93k|				if (file_printf(ms, " no") == -1)
  ------------------
  |  Branch (291:9): [True: 0, False: 1.93k]
  ------------------
  292|      0|					goto done;
  293|  1.93k|			} else {
  294|    266|				if (n_crlf) {
  ------------------
  |  Branch (294:9): [True: 72, False: 194]
  ------------------
  295|     72|					if (file_printf(ms, " CRLF") == -1)
  ------------------
  |  Branch (295:10): [True: 0, False: 72]
  ------------------
  296|      0|						goto done;
  297|     72|					if (n_cr || n_lf || n_nel)
  ------------------
  |  Branch (297:10): [True: 27, False: 45]
  |  Branch (297:18): [True: 19, False: 26]
  |  Branch (297:26): [True: 5, False: 21]
  ------------------
  298|     51|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (298:11): [True: 0, False: 51]
  ------------------
  299|      0|							goto done;
  300|     72|				}
  301|    266|				if (n_cr) {
  ------------------
  |  Branch (301:9): [True: 158, False: 108]
  ------------------
  302|    158|					if (file_printf(ms, " CR") == -1)
  ------------------
  |  Branch (302:10): [True: 0, False: 158]
  ------------------
  303|      0|						goto done;
  304|    158|					if (n_lf || n_nel)
  ------------------
  |  Branch (304:10): [True: 30, False: 128]
  |  Branch (304:18): [True: 21, False: 107]
  ------------------
  305|     51|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (305:11): [True: 0, False: 51]
  ------------------
  306|      0|							goto done;
  307|    158|				}
  308|    266|				if (n_lf) {
  ------------------
  |  Branch (308:9): [True: 70, False: 196]
  ------------------
  309|     70|					if (file_printf(ms, " LF") == -1)
  ------------------
  |  Branch (309:10): [True: 0, False: 70]
  ------------------
  310|      0|						goto done;
  311|     70|					if (n_nel)
  ------------------
  |  Branch (311:10): [True: 23, False: 47]
  ------------------
  312|     23|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (312:11): [True: 0, False: 23]
  ------------------
  313|      0|							goto done;
  314|     70|				}
  315|    266|				if (n_nel)
  ------------------
  |  Branch (315:9): [True: 91, False: 175]
  ------------------
  316|     91|					if (file_printf(ms, " NEL") == -1)
  ------------------
  |  Branch (316:10): [True: 0, False: 91]
  ------------------
  317|      0|						goto done;
  318|    266|			}
  319|       |
  320|  2.20k|			if (file_printf(ms, " line terminators") == -1)
  ------------------
  |  Branch (320:8): [True: 0, False: 2.20k]
  ------------------
  321|      0|				goto done;
  322|  2.20k|		}
  323|       |
  324|  2.38k|		if (has_escapes)
  ------------------
  |  Branch (324:7): [True: 32, False: 2.34k]
  ------------------
  325|     32|			if (file_printf(ms, ", with escape sequences") == -1)
  ------------------
  |  Branch (325:8): [True: 0, False: 32]
  ------------------
  326|      0|				goto done;
  327|  2.38k|		if (has_backspace)
  ------------------
  |  Branch (327:7): [True: 121, False: 2.25k]
  ------------------
  328|    121|			if (file_printf(ms, ", with overstriking") == -1)
  ------------------
  |  Branch (328:8): [True: 0, False: 121]
  ------------------
  329|      0|				goto done;
  330|  2.38k|	}
  331|  2.38k|	rv = 1;
  332|  2.44k|done:
  333|  2.44k|	free(utf8_buf);
  334|       |
  335|  2.44k|	return rv;
  336|  2.38k|}
ascmagic.c:trim_nuls:
   63|  13.8k|{
   64|  14.6M|	while (nbytes > 1 && buf[nbytes - 1] == '\0')
  ------------------
  |  Branch (64:9): [True: 14.6M, False: 64]
  |  Branch (64:23): [True: 14.6M, False: 13.7k]
  ------------------
   65|  14.6M|		nbytes--;
   66|       |
   67|  13.8k|	return nbytes;
   68|  13.8k|}
ascmagic.c:encode_utf8:
  344|  2.37k|{
  345|  2.37k|	size_t i;
  346|  2.37k|	unsigned char *end = buf + len;
  347|       |
  348|  7.25M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (348:14): [True: 7.25M, False: 2.32k]
  ------------------
  349|  7.25M|		if (ubuf[i] <= 0x7f) {
  ------------------
  |  Branch (349:7): [True: 5.35M, False: 1.90M]
  ------------------
  350|  5.35M|			if (end - buf < 1)
  ------------------
  |  Branch (350:8): [True: 0, False: 5.35M]
  ------------------
  351|      0|				return NULL;
  352|  5.35M|			*buf++ = CAST(unsigned char, ubuf[i]);
  ------------------
  |  |  426|  5.35M|#define CAST(T, b)	((T)(b))
  ------------------
  353|  5.35M|			continue;
  354|  5.35M|		} 
  355|  1.90M|		if (ubuf[i] <= 0x7ff) {
  ------------------
  |  Branch (355:7): [True: 1.88M, False: 11.7k]
  ------------------
  356|  1.88M|			if (end - buf < 2)
  ------------------
  |  Branch (356:8): [True: 0, False: 1.88M]
  ------------------
  357|      0|				return NULL;
  358|  1.88M|			*buf++ = CAST(unsigned char, (ubuf[i] >> 6) + 0xc0);
  ------------------
  |  |  426|  1.88M|#define CAST(T, b)	((T)(b))
  ------------------
  359|  1.88M|			goto out1;
  360|  1.88M|		}
  361|  11.7k|		if (ubuf[i] <= 0xffff) {
  ------------------
  |  Branch (361:7): [True: 1.46k, False: 10.3k]
  ------------------
  362|  1.46k|			if (end - buf < 3)
  ------------------
  |  Branch (362:8): [True: 0, False: 1.46k]
  ------------------
  363|      0|				return NULL;
  364|  1.46k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 12) + 0xe0);
  ------------------
  |  |  426|  1.46k|#define CAST(T, b)	((T)(b))
  ------------------
  365|  1.46k|			goto out2;
  366|  1.46k|		}
  367|  10.3k|		if (ubuf[i] <= 0x1fffff) {
  ------------------
  |  Branch (367:7): [True: 8.40k, False: 1.89k]
  ------------------
  368|  8.40k|			if (end - buf < 4)
  ------------------
  |  Branch (368:8): [True: 0, False: 8.40k]
  ------------------
  369|      0|				return NULL;
  370|  8.40k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 18) + 0xf0);
  ------------------
  |  |  426|  8.40k|#define CAST(T, b)	((T)(b))
  ------------------
  371|  8.40k|			goto out3;
  372|  8.40k|		}
  373|  1.89k|		if (ubuf[i] <= 0x3ffffff) {
  ------------------
  |  Branch (373:7): [True: 299, False: 1.60k]
  ------------------
  374|    299|			if (end - buf < 5)
  ------------------
  |  Branch (374:8): [True: 0, False: 299]
  ------------------
  375|      0|				return NULL;
  376|    299|			*buf++ = CAST(unsigned char, (ubuf[i] >> 24) + 0xf8);
  ------------------
  |  |  426|    299|#define CAST(T, b)	((T)(b))
  ------------------
  377|    299|			goto out4;
  378|    299|		} 
  379|  1.60k|		if (ubuf[i] <= 0x7fffffff) {
  ------------------
  |  Branch (379:7): [True: 1.54k, False: 54]
  ------------------
  380|  1.54k|			if (end - buf < 6)
  ------------------
  |  Branch (380:8): [True: 0, False: 1.54k]
  ------------------
  381|      0|				return NULL;
  382|  1.54k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 30) + 0xfc);
  ------------------
  |  |  426|  1.54k|#define CAST(T, b)	((T)(b))
  ------------------
  383|  1.54k|			goto out5;
  384|  1.54k|		} 
  385|       |		/* Invalid character */
  386|     54|		return NULL;
  387|  1.54k|	out5:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 24) & 0x3f) + 0x80);
  ------------------
  |  |  426|  1.54k|#define CAST(T, b)	((T)(b))
  ------------------
  388|  1.84k|	out4:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80);
  ------------------
  |  |  426|  1.84k|#define CAST(T, b)	((T)(b))
  ------------------
  389|  10.2k|	out3:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80);
  ------------------
  |  |  426|  10.2k|#define CAST(T, b)	((T)(b))
  ------------------
  390|  11.7k|	out2:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  6) & 0x3f) + 0x80);
  ------------------
  |  |  426|  11.7k|#define CAST(T, b)	((T)(b))
  ------------------
  391|  1.90M|	out1:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  0) & 0x3f) + 0x80);
  ------------------
  |  |  426|  1.90M|#define CAST(T, b)	((T)(b))
  ------------------
  392|  1.90M|	}
  393|       |
  394|  2.32k|	return buf;
  395|  2.37k|}

buffer_init:
   42|  58.3M|{
   43|  58.3M|	b->fd = fd;
   44|  58.3M|	if (st)
  ------------------
  |  Branch (44:6): [True: 12.8k, False: 58.3M]
  ------------------
   45|  12.8k|		memcpy(&b->st, st, sizeof(b->st));
   46|  58.3M|	else if (b->fd == -1 || fstat(b->fd, &b->st) == -1)
  ------------------
  |  Branch (46:11): [True: 58.3M, False: 0]
  |  Branch (46:26): [True: 0, False: 0]
  ------------------
   47|  58.3M|		memset(&b->st, 0, sizeof(b->st));
   48|  58.3M|	b->fbuf = data;
   49|  58.3M|	b->flen = len;
   50|  58.3M|	b->eoff = 0;
   51|  58.3M|	b->ebuf = NULL;
   52|  58.3M|	b->elen = 0;
   53|  58.3M|}
buffer_fini:
   57|  14.9k|{
   58|  14.9k|	free(b->ebuf);
   59|  14.9k|}
buffer_fill:
   63|  96.5k|{
   64|  96.5k|	struct buffer *b = CCAST(struct buffer *, bb);
  ------------------
  |  |  428|  96.5k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
   65|       |
   66|  96.5k|	if (b->elen != 0)
  ------------------
  |  Branch (66:6): [True: 85.1k, False: 11.3k]
  ------------------
   67|  85.1k|		return b->elen == FILE_BADSIZE ? -1 : 0;
  ------------------
  |  |  158|  85.1k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|  85.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (67:10): [True: 9.02k, False: 76.1k]
  ------------------
   68|       |
   69|  11.3k|	if (!S_ISREG(b->st.st_mode))
  ------------------
  |  Branch (69:6): [True: 1.93k, False: 9.45k]
  ------------------
   70|  1.93k|		goto out;
   71|       |
   72|  9.45k|	b->elen =  CAST(size_t, b->st.st_size) < b->flen ?
  ------------------
  |  |  426|  9.45k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (72:13): [True: 0, False: 9.45k]
  ------------------
   73|  9.45k|	    CAST(size_t, b->st.st_size) : b->flen;
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
   74|  9.45k|	if ((b->ebuf = malloc(b->elen)) == NULL)
  ------------------
  |  Branch (74:6): [True: 0, False: 9.45k]
  ------------------
   75|      0|		goto out;
   76|       |
   77|  9.45k|	b->eoff = b->st.st_size - b->elen;
   78|  9.45k|	if (pread(b->fd, b->ebuf, b->elen, b->eoff) == -1) {
  ------------------
  |  Branch (78:6): [True: 0, False: 9.45k]
  ------------------
   79|      0|		free(b->ebuf);
   80|      0|		b->ebuf = NULL;
   81|      0|		goto out;
   82|      0|	}
   83|       |
   84|  9.45k|	return 0;
   85|  1.93k|out:
   86|  1.93k|	b->elen = FILE_BADSIZE;
  ------------------
  |  |  158|  1.93k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|  1.93k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
   87|  1.93k|	return -1;
   88|  9.45k|}

cdf_swap_header:
  230|  2.28k|{
  231|  2.28k|	size_t i;
  232|       |
  233|  2.28k|	h->h_magic = CDF_TOLE8(h->h_magic);
  ------------------
  |  |   82|  2.28k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|  2.28k|	h->h_uuid[0] = CDF_TOLE8(h->h_uuid[0]);
  ------------------
  |  |   82|  2.28k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  235|  2.28k|	h->h_uuid[1] = CDF_TOLE8(h->h_uuid[1]);
  ------------------
  |  |   82|  2.28k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  236|  2.28k|	h->h_revision = CDF_TOLE2(h->h_revision);
  ------------------
  |  |   86|  2.28k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  237|  2.28k|	h->h_version = CDF_TOLE2(h->h_version);
  ------------------
  |  |   86|  2.28k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  238|  2.28k|	h->h_byte_order = CDF_TOLE2(h->h_byte_order);
  ------------------
  |  |   86|  2.28k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  239|  2.28k|	h->h_sec_size_p2 = CDF_TOLE2(h->h_sec_size_p2);
  ------------------
  |  |   86|  2.28k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  240|  2.28k|	h->h_short_sec_size_p2 = CDF_TOLE2(h->h_short_sec_size_p2);
  ------------------
  |  |   86|  2.28k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|  2.28k|	h->h_num_sectors_in_sat = CDF_TOLE4(h->h_num_sectors_in_sat);
  ------------------
  |  |   84|  2.28k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  242|  2.28k|	h->h_secid_first_directory = CDF_TOLE4(h->h_secid_first_directory);
  ------------------
  |  |   84|  2.28k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  243|  2.28k|	h->h_min_size_standard_stream =
  244|  2.28k|	    CDF_TOLE4(h->h_min_size_standard_stream);
  ------------------
  |  |   84|  2.28k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  245|  2.28k|	h->h_secid_first_sector_in_short_sat =
  246|  2.28k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_short_sat));
  ------------------
  |  |   84|  2.28k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  247|  2.28k|	h->h_num_sectors_in_short_sat =
  248|  2.28k|	    CDF_TOLE4(h->h_num_sectors_in_short_sat);
  ------------------
  |  |   84|  2.28k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  249|  2.28k|	h->h_secid_first_sector_in_master_sat =
  250|  2.28k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_master_sat));
  ------------------
  |  |   84|  2.28k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  251|  2.28k|	h->h_num_sectors_in_master_sat =
  252|  2.28k|	    CDF_TOLE4(h->h_num_sectors_in_master_sat);
  ------------------
  |  |   84|  2.28k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 2.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  253|   251k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  123|   251k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (253:14): [True: 248k, False: 2.28k]
  ------------------
  254|   248k|		h->h_master_sat[i] =
  255|   248k|		    CDF_TOLE4(CAST(uint32_t, h->h_master_sat[i]));
  ------------------
  |  |   84|   248k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|   497k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 248k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  256|   248k|	}
  257|  2.28k|}
cdf_unpack_header:
  261|  2.28k|{
  262|  2.28k|	size_t i;
  263|  2.28k|	size_t len = 0;
  264|       |
  265|  2.28k|	CDF_UNPACK(h->h_magic);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  266|  2.28k|	CDF_UNPACKA(h->h_uuid);
  ------------------
  |  |  208|  2.28k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  267|  2.28k|	CDF_UNPACK(h->h_revision);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  268|  2.28k|	CDF_UNPACK(h->h_version);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  269|  2.28k|	CDF_UNPACK(h->h_byte_order);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  270|  2.28k|	CDF_UNPACK(h->h_sec_size_p2);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  271|  2.28k|	CDF_UNPACK(h->h_short_sec_size_p2);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  272|  2.28k|	CDF_UNPACKA(h->h_unused0);
  ------------------
  |  |  208|  2.28k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  273|  2.28k|	CDF_UNPACK(h->h_num_sectors_in_sat);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  274|  2.28k|	CDF_UNPACK(h->h_secid_first_directory);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  275|  2.28k|	CDF_UNPACKA(h->h_unused1);
  ------------------
  |  |  208|  2.28k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  276|  2.28k|	CDF_UNPACK(h->h_min_size_standard_stream);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  277|  2.28k|	CDF_UNPACK(h->h_secid_first_sector_in_short_sat);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  278|  2.28k|	CDF_UNPACK(h->h_num_sectors_in_short_sat);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  279|  2.28k|	CDF_UNPACK(h->h_secid_first_sector_in_master_sat);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  280|  2.28k|	CDF_UNPACK(h->h_num_sectors_in_master_sat);
  ------------------
  |  |  206|  2.28k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  281|   251k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  123|   251k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (281:14): [True: 248k, False: 2.28k]
  ------------------
  282|   248k|		CDF_UNPACK(h->h_master_sat[i]);
  ------------------
  |  |  206|   248k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  283|  2.28k|}
cdf_unpack_dir:
  312|  3.00k|{
  313|  3.00k|	size_t len = 0;
  314|       |
  315|  3.00k|	CDF_UNPACKA(d->d_name);
  ------------------
  |  |  208|  3.00k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  316|  3.00k|	CDF_UNPACK(d->d_namelen);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  317|  3.00k|	CDF_UNPACK(d->d_type);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  318|  3.00k|	CDF_UNPACK(d->d_color);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  319|  3.00k|	CDF_UNPACK(d->d_left_child);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  320|  3.00k|	CDF_UNPACK(d->d_right_child);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  321|  3.00k|	CDF_UNPACK(d->d_storage);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  322|  3.00k|	CDF_UNPACKA(d->d_storage_uuid);
  ------------------
  |  |  208|  3.00k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  323|  3.00k|	CDF_UNPACK(d->d_flags);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  324|  3.00k|	CDF_UNPACK(d->d_created);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  325|  3.00k|	CDF_UNPACK(d->d_modified);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  326|  3.00k|	CDF_UNPACK(d->d_stream_first_sector);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  327|  3.00k|	CDF_UNPACK(d->d_size);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  328|  3.00k|	CDF_UNPACK(d->d_unused0);
  ------------------
  |  |  206|  3.00k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  329|  3.00k|}
cdf_zero_stream:
  333|    453|{
  334|    453|	scn->sst_len = 0;
  335|    453|	scn->sst_dirlen = 0;
  336|    453|	scn->sst_ss = 0;
  337|    453|	free(scn->sst_tab);
  338|    453|	scn->sst_tab = NULL;
  339|    453|	return -1;
  340|    453|}
cdf_read_header:
  396|  11.3k|{
  397|  11.3k|	char buf[512];
  398|       |
  399|  11.3k|	(void)memcpy(cdf_bo.s, "\01\02\03\04", 4);
  400|  11.3k|	if (cdf_read(info, CAST(off_t, 0), buf, sizeof(buf)) == -1)
  ------------------
  |  |  426|  11.3k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (400:6): [True: 9.10k, False: 2.28k]
  ------------------
  401|  9.10k|		return -1;
  402|  2.28k|	cdf_unpack_header(h, buf);
  403|  2.28k|	cdf_swap_header(h);
  404|  2.28k|	if (h->h_magic != CDF_MAGIC) {
  ------------------
  |  |   61|  2.28k|#define CDF_MAGIC	0xE11AB1A1E011CFD0LL
  ------------------
  |  Branch (404:6): [True: 1.61k, False: 668]
  ------------------
  405|  1.61k|		DPRINTF(("Bad magic %#" INT64_T_FORMAT "x != %#"
  406|  1.61k|		    INT64_T_FORMAT "x\n",
  407|  1.61k|		    (unsigned long long)h->h_magic,
  408|  1.61k|		    (unsigned long long)CDF_MAGIC));
  409|  1.61k|		goto out;
  410|  1.61k|	}
  411|    668|	if (h->h_sec_size_p2 > 20) {
  ------------------
  |  Branch (411:6): [True: 12, False: 656]
  ------------------
  412|     12|		DPRINTF(("Bad sector size %hu\n", h->h_sec_size_p2));
  413|     12|		goto out;
  414|     12|	}
  415|    656|	if (h->h_short_sec_size_p2 > 20) {
  ------------------
  |  Branch (415:6): [True: 2, False: 654]
  ------------------
  416|      2|		DPRINTF(("Bad short sector size %hu\n",
  417|      2|		    h->h_short_sec_size_p2));
  418|      2|		goto out;
  419|      2|	}
  420|    654|	return 0;
  421|  1.63k|out:
  422|  1.63k|	errno = EFTYPE;
  ------------------
  |  |   59|  1.63k|#define EFTYPE EINVAL
  ------------------
  423|  1.63k|	return -1;
  424|    656|}
cdf_read_sector:
  430|   152k|{
  431|   152k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|   152k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|   152k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  432|   152k|	size_t pos;
  433|       |
  434|   152k|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   63|   152k|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  426|   152k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  426|   152k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (434:6): [True: 0, False: 152k]
  ------------------
  435|      0|		return -1;
  436|       |
  437|   152k|	pos = CDF_SEC_POS(h, id);
  ------------------
  |  |   81|   152k|#define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   80|   152k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|   152k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   80|   152k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|   152k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  438|   152k|	assert(ss == len);
  439|   152k|	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  426|   152k|#define CAST(T, b)	((T)(b))
  ------------------
              	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  427|   152k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  440|   152k|}
cdf_read_sat:
  473|    654|{
  474|    654|	size_t i, j, k;
  475|    654|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|    654|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    654|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  476|    654|	cdf_secid_t *msa, mid, sec;
  477|    654|	size_t nsatpersec = (ss / sizeof(mid)) - 1;
  478|       |
  479|  39.5k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  123|  39.5k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (479:14): [True: 39.4k, False: 188]
  ------------------
  480|  39.4k|		if (h->h_master_sat[i] == CDF_SECID_FREE)
  ------------------
  |  |   54|  39.4k|#define CDF_SECID_FREE					-1
  ------------------
  |  Branch (480:7): [True: 466, False: 38.9k]
  ------------------
  481|    466|			break;
  482|       |
  483|    654|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  484|    654|	if ((nsatpersec > 0 &&
  ------------------
  |  Branch (484:7): [True: 547, False: 107]
  ------------------
  485|    654|	    h->h_num_sectors_in_master_sat > CDF_SEC_LIMIT / nsatpersec) ||
  ------------------
  |  |  483|    547|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (485:6): [True: 23, False: 524]
  ------------------
  486|    654|	    i > CDF_SEC_LIMIT) {
  ------------------
  |  |  483|    631|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (486:6): [True: 3, False: 628]
  ------------------
  487|     26|		DPRINTF(("Number of sectors in master SAT too big %u %"
  488|     26|		    SIZE_T_FORMAT "u\n", h->h_num_sectors_in_master_sat, i));
  489|     26|		errno = EFTYPE;
  ------------------
  |  |   59|     26|#define EFTYPE EINVAL
  ------------------
  490|     26|		return -1;
  491|     26|	}
  492|       |
  493|    628|	sat->sat_len = h->h_num_sectors_in_master_sat * nsatpersec + i;
  494|    628|	DPRINTF(("sat_len = %" SIZE_T_FORMAT "u ss = %" SIZE_T_FORMAT "u\n",
  495|    628|	    sat->sat_len, ss));
  496|    628|	if ((sat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(sat->sat_len, ss)))
  ------------------
  |  |  426|    628|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (496:6): [True: 0, False: 628]
  ------------------
  497|    628|	    == NULL)
  498|      0|		return -1;
  499|       |
  500|  4.41k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  123|  4.41k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (500:14): [True: 4.41k, False: 4]
  ------------------
  501|  4.41k|		if (h->h_master_sat[i] < 0)
  ------------------
  |  Branch (501:7): [True: 591, False: 3.82k]
  ------------------
  502|    591|			break;
  503|  3.82k|		if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (503:7): [True: 33, False: 3.78k]
  ------------------
  504|  3.82k|		    h->h_master_sat[i]) != CAST(ssize_t, ss)) {
  ------------------
  |  |  426|  3.82k|#define CAST(T, b)	((T)(b))
  ------------------
  505|     33|			DPRINTF(("Reading sector %d", h->h_master_sat[i]));
  506|     33|			goto out1;
  507|     33|		}
  508|  3.82k|	}
  509|       |
  510|    595|	if ((msa = CAST(cdf_secid_t *, CDF_CALLOC(1, ss))) == NULL)
  ------------------
  |  |  426|    595|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (510:6): [True: 0, False: 595]
  ------------------
  511|      0|		goto out1;
  512|       |
  513|    595|	mid = h->h_secid_first_sector_in_master_sat;
  514|  74.3k|	for (j = 0; j < h->h_num_sectors_in_master_sat; j++) {
  ------------------
  |  Branch (514:14): [True: 73.9k, False: 328]
  ------------------
  515|  73.9k|		if (mid < 0)
  ------------------
  |  Branch (515:7): [True: 85, False: 73.8k]
  ------------------
  516|     85|			goto out;
  517|  73.8k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  73.8k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (517:7): [True: 4, False: 73.8k]
  ------------------
  518|      4|			DPRINTF(("Reading master sector loop limit"));
  519|      4|			goto out3;
  520|      4|		}
  521|  73.8k|		if (cdf_read_sector(info, msa, 0, ss, h, mid) !=
  ------------------
  |  Branch (521:7): [True: 56, False: 73.8k]
  ------------------
  522|  73.8k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  426|  73.8k|#define CAST(T, b)	((T)(b))
  ------------------
  523|     56|			DPRINTF(("Reading master sector %d", mid));
  524|     56|			goto out2;
  525|     56|		}
  526|   147k|		for (k = 0; k < nsatpersec; k++, i++) {
  ------------------
  |  Branch (526:15): [True: 73.7k, False: 73.7k]
  ------------------
  527|  73.7k|			sec = CDF_TOLE4(CAST(uint32_t, msa[k]));
  ------------------
  |  |   84|  73.7k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|   147k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 73.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  528|  73.7k|			if (sec < 0)
  ------------------
  |  Branch (528:8): [True: 89, False: 73.6k]
  ------------------
  529|     89|				goto out;
  530|  73.6k|			if (i >= sat->sat_len) {
  ------------------
  |  Branch (530:8): [True: 0, False: 73.6k]
  ------------------
  531|      0|			    DPRINTF(("Out of bounds reading MSA %"
  532|      0|				SIZE_T_FORMAT "u >= %" SIZE_T_FORMAT "u",
  533|      0|				i, sat->sat_len));
  534|      0|			    goto out3;
  535|      0|			}
  536|  73.6k|			if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (536:8): [True: 33, False: 73.6k]
  ------------------
  537|  73.6k|			    sec) != CAST(ssize_t, ss)) {
  ------------------
  |  |  426|  73.6k|#define CAST(T, b)	((T)(b))
  ------------------
  538|     33|				DPRINTF(("Reading sector %d",
  539|     33|				    CDF_TOLE4(msa[k])));
  540|     33|				goto out2;
  541|     33|			}
  542|  73.6k|		}
  543|  73.7k|		mid = CDF_TOLE4(CAST(uint32_t, msa[nsatpersec]));
  ------------------
  |  |   84|  73.7k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|   147k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 73.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  544|  73.7k|	}
  545|    502|out:
  546|    502|	sat->sat_len = i;
  547|    502|	free(msa);
  548|    502|	return 0;
  549|      4|out3:
  550|      4|	errno = EFTYPE;
  ------------------
  |  |   59|      4|#define EFTYPE EINVAL
  ------------------
  551|     93|out2:
  552|     93|	free(msa);
  553|    126|out1:
  554|    126|	free(sat->sat_tab);
  555|    126|	return -1;
  556|     93|}
cdf_count_chain:
  560|    939|{
  561|    939|	size_t i, j;
  562|    939|	cdf_secid_t maxsector = CAST(cdf_secid_t, (sat->sat_len * size)
  ------------------
  |  |  426|    939|#define CAST(T, b)	((T)(b))
  ------------------
  563|    939|	    / sizeof(maxsector));
  564|       |
  565|    939|	DPRINTF(("Chain:"));
  566|    939|	if (sid == CDF_SECID_END_OF_CHAIN) {
  ------------------
  |  |   55|    939|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (566:6): [True: 4, False: 935]
  ------------------
  567|       |		/* 0-length chain. */
  568|      4|		DPRINTF((" empty\n"));
  569|      4|		return 0;
  570|      4|	}
  571|       |
  572|   181k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (572:18): [True: 181k, False: 732]
  ------------------
  573|   181k|		DPRINTF((" %d", sid));
  574|   181k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|   181k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (574:7): [True: 18, False: 180k]
  ------------------
  575|     18|			DPRINTF(("Counting chain loop limit"));
  576|     18|			goto out;
  577|     18|		}
  578|   180k|		if (sid >= maxsector) {
  ------------------
  |  Branch (578:7): [True: 185, False: 180k]
  ------------------
  579|    185|			DPRINTF(("Sector %d >= %d\n", sid, maxsector));
  580|    185|			goto out;
  581|    185|		}
  582|   180k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|   180k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|   361k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 180k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  583|   180k|	}
  584|    732|	if (i == 0) {
  ------------------
  |  Branch (584:6): [True: 85, False: 647]
  ------------------
  585|     85|		DPRINTF((" none, sid: %d\n", sid));
  586|     85|		goto out;
  587|       |
  588|     85|	}
  589|    647|	DPRINTF(("\n"));
  590|    647|	return i;
  591|    288|out:
  592|    288|	errno = EFTYPE;
  ------------------
  |  |   59|    288|#define EFTYPE EINVAL
  ------------------
  593|    288|	return CAST(size_t, -1);
  ------------------
  |  |  426|    288|#define CAST(T, b)	((T)(b))
  ------------------
  594|    732|}
cdf_read_long_sector_chain:
  599|    137|{
  600|    137|	size_t ss = CDF_SEC_SIZE(h), i, j;
  ------------------
  |  |   80|    137|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    137|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  601|    137|	ssize_t nr;
  602|    137|	scn->sst_tab = NULL;
  603|    137|	scn->sst_len = cdf_count_chain(sat, sid, ss);
  604|    137|	scn->sst_dirlen = MAX(h->h_min_size_standard_stream, len);
  605|    137|	scn->sst_ss = ss;
  606|       |
  607|    137|	if (sid == CDF_SECID_END_OF_CHAIN || len == 0)
  ------------------
  |  |   55|    274|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (607:6): [True: 0, False: 137]
  |  Branch (607:39): [True: 15, False: 122]
  ------------------
  608|     15|		return cdf_zero_stream(scn);
  609|       |
  610|    122|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  426|    122|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (610:6): [True: 54, False: 68]
  ------------------
  611|     54|		goto out;
  612|       |
  613|     68|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   96|     68|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  614|     68|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (614:6): [True: 0, False: 68]
  ------------------
  615|      0|		return cdf_zero_stream(scn);
  616|       |
  617|    116|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (617:18): [True: 88, False: 28]
  ------------------
  618|     88|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|     88|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (618:7): [True: 0, False: 88]
  ------------------
  619|      0|			DPRINTF(("Read long sector chain loop limit"));
  620|      0|			goto out;
  621|      0|		}
  622|     88|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (622:7): [True: 0, False: 88]
  ------------------
  623|      0|			DPRINTF(("Out of bounds reading long sector chain "
  624|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
  625|      0|			    scn->sst_len));
  626|      0|			goto out;
  627|      0|		}
  628|     88|		if ((nr = cdf_read_sector(info, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (628:7): [True: 40, False: 48]
  ------------------
  629|     88|		    sid)) != CAST(ssize_t, ss)) {
  ------------------
  |  |  426|     88|#define CAST(T, b)	((T)(b))
  ------------------
  630|     40|			if (i == scn->sst_len - 1 && nr > 0) {
  ------------------
  |  Branch (630:8): [True: 28, False: 12]
  |  Branch (630:33): [True: 0, False: 28]
  ------------------
  631|       |				/* Last sector might be truncated */
  632|      0|				return 0;
  633|      0|			}
  634|     40|			DPRINTF(("Reading long sector chain %d", sid));
  635|     40|			goto out;
  636|     40|		}
  637|     48|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|     48|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|     96|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 48]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  638|     48|	}
  639|     28|	return 0;
  640|     94|out:
  641|     94|	errno = EFTYPE;
  ------------------
  |  |   59|     94|#define EFTYPE EINVAL
  ------------------
  642|     94|	return cdf_zero_stream(scn);
  643|     68|}
cdf_read_dir:
  703|    300|{
  704|    300|	size_t i, j;
  705|    300|	size_t ss = CDF_SEC_SIZE(h), ns, nd;
  ------------------
  |  |   80|    300|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    300|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  706|    300|	char *buf;
  707|    300|	cdf_secid_t sid = h->h_secid_first_directory;
  708|       |
  709|    300|	ns = cdf_count_chain(sat, sid, ss);
  710|    300|	if (ns == CAST(size_t, -1))
  ------------------
  |  |  426|    300|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (710:6): [True: 61, False: 239]
  ------------------
  711|     61|		return -1;
  712|       |
  713|    239|	nd = ss / CDF_DIRECTORY_SIZE;
  ------------------
  |  |  117|    239|#define CDF_DIRECTORY_SIZE	128
  ------------------
  714|       |
  715|    239|	dir->dir_len = ns * nd;
  716|    239|	dir->dir_tab = CAST(cdf_directory_t *,
  ------------------
  |  |  426|    239|#define CAST(T, b)	((T)(b))
  ------------------
  717|    239|	    CDF_CALLOC(dir->dir_len, sizeof(dir->dir_tab[0])));
  718|    239|	if (dir->dir_tab == NULL)
  ------------------
  |  Branch (718:6): [True: 0, False: 239]
  ------------------
  719|      0|		return -1;
  720|       |
  721|    239|	if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
  ------------------
  |  |  426|    239|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (721:6): [True: 0, False: 239]
  ------------------
  722|      0|		free(dir->dir_tab);
  723|      0|		return -1;
  724|      0|	}
  725|       |
  726|    496|	for (j = i = 0; i < ns; i++, j++) {
  ------------------
  |  Branch (726:18): [True: 263, False: 233]
  ------------------
  727|    263|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|    263|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (727:7): [True: 0, False: 263]
  ------------------
  728|      0|			DPRINTF(("Read dir loop limit"));
  729|      0|			goto out;
  730|      0|		}
  731|    263|		if (cdf_read_sector(info, buf, 0, ss, h, sid) !=
  ------------------
  |  Branch (731:7): [True: 6, False: 257]
  ------------------
  732|    263|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  426|    263|#define CAST(T, b)	((T)(b))
  ------------------
  733|      6|			DPRINTF(("Reading directory sector %d", sid));
  734|      6|			goto out;
  735|      6|		}
  736|  3.26k|		for (j = 0; j < nd; j++) {
  ------------------
  |  Branch (736:15): [True: 3.00k, False: 257]
  ------------------
  737|  3.00k|			cdf_unpack_dir(&dir->dir_tab[i * nd + j],
  738|  3.00k|			    &buf[j * CDF_DIRECTORY_SIZE]);
  ------------------
  |  |  117|  3.00k|#define CDF_DIRECTORY_SIZE	128
  ------------------
  739|  3.00k|		}
  740|    257|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|    257|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|    514|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 257]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  741|    257|	}
  742|    233|	if (NEED_SWAP)
  ------------------
  |  |   79|    233|#define NEED_SWAP	(cdf_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  426|    233|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (79:19): [True: 0, False: 233]
  |  |  ------------------
  ------------------
  743|      0|		for (i = 0; i < dir->dir_len; i++)
  ------------------
  |  Branch (743:15): [True: 0, False: 0]
  ------------------
  744|      0|			cdf_swap_dir(&dir->dir_tab[i]);
  745|    233|	free(buf);
  746|    233|	return 0;
  747|      6|out:
  748|      6|	free(dir->dir_tab);
  749|      6|	free(buf);
  750|      6|	errno = EFTYPE;
  ------------------
  |  |   59|      6|#define EFTYPE EINVAL
  ------------------
  751|      6|	return -1;
  752|    239|}
cdf_read_ssat:
  758|    502|{
  759|    502|	size_t i, j;
  760|    502|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|    502|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    502|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  761|    502|	cdf_secid_t sid = h->h_secid_first_sector_in_short_sat;
  762|       |
  763|    502|	ssat->sat_tab = NULL;
  764|    502|	ssat->sat_len = cdf_count_chain(sat, sid, ss);
  765|    502|	if (ssat->sat_len == CAST(size_t, -1))
  ------------------
  |  |  426|    502|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (765:6): [True: 162, False: 340]
  ------------------
  766|    162|		goto out;
  767|       |
  768|    340|	ssat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(ssat->sat_len, ss));
  ------------------
  |  |  426|    340|#define CAST(T, b)	((T)(b))
  ------------------
  769|    340|	if (ssat->sat_tab == NULL)
  ------------------
  |  Branch (769:6): [True: 0, False: 340]
  ------------------
  770|      0|		goto out1;
  771|       |
  772|    663|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (772:18): [True: 363, False: 300]
  ------------------
  773|    363|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|    363|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (773:7): [True: 0, False: 363]
  ------------------
  774|      0|			DPRINTF(("Read short sat sector loop limit"));
  775|      0|			goto out;
  776|      0|		}
  777|    363|		if (i >= ssat->sat_len) {
  ------------------
  |  Branch (777:7): [True: 0, False: 363]
  ------------------
  778|      0|			DPRINTF(("Out of bounds reading short sector chain "
  779|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
  780|      0|			    ssat->sat_len));
  781|      0|			goto out;
  782|      0|		}
  783|    363|		if (cdf_read_sector(info, ssat->sat_tab, i * ss, ss, h, sid) !=
  ------------------
  |  Branch (783:7): [True: 40, False: 323]
  ------------------
  784|    363|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  426|    363|#define CAST(T, b)	((T)(b))
  ------------------
  785|     40|			DPRINTF(("Reading short sat sector %d", sid));
  786|     40|			goto out1;
  787|     40|		}
  788|    323|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|    323|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|    646|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 323]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  789|    323|	}
  790|    300|	return 0;
  791|    162|out:
  792|    162|	errno = EFTYPE;
  ------------------
  |  |   59|    162|#define EFTYPE EINVAL
  ------------------
  793|    202|out1:
  794|    202|	free(ssat->sat_tab);
  795|    202|	return -1;
  796|    162|}
cdf_read_short_stream:
  802|    233|{
  803|    233|	size_t i;
  804|    233|	const cdf_directory_t *d;
  805|       |
  806|    233|	*root = NULL;
  807|  2.81k|	for (i = 0; i < dir->dir_len; i++)
  ------------------
  |  Branch (807:14): [True: 2.74k, False: 67]
  ------------------
  808|  2.74k|		if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_ROOT_STORAGE)
  ------------------
  |  |  101|  2.74k|#define CDF_DIR_TYPE_ROOT_STORAGE	5
  ------------------
  |  Branch (808:7): [True: 166, False: 2.58k]
  ------------------
  809|    166|			break;
  810|       |
  811|       |	/* If the it is not there, just fake it; some docs don't have it */
  812|    233|	if (i == dir->dir_len) {
  ------------------
  |  Branch (812:6): [True: 67, False: 166]
  ------------------
  813|     67|		DPRINTF(("Cannot find root storage dir\n"));
  814|     67|		goto out;
  815|     67|	}
  816|    166|	d = &dir->dir_tab[i];
  817|    166|	*root = d;
  818|       |
  819|       |	/* If the it is not there, just fake it; some docs don't have it */
  820|    166|	if (d->d_stream_first_sector < 0) {
  ------------------
  |  Branch (820:6): [True: 29, False: 137]
  ------------------
  821|     29|		DPRINTF(("No first secror in dir\n"));
  822|     29|		goto out;
  823|     29|	}
  824|       |
  825|    137|	return cdf_read_long_sector_chain(info, h, sat,
  826|    137|	    d->d_stream_first_sector, d->d_size, scn);
  827|     96|out:
  828|     96|	scn->sst_tab = NULL;
  829|     96|	(void)cdf_zero_stream(scn);
  830|     96|	return 0;
  831|    166|}
cdf_read_doc_summary_info:
  846|    124|{
  847|    124|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  848|    124|	    "\05DocumentSummaryInformation", scn);
  849|    124|}
cdf_read_summary_info:
  855|    124|{
  856|    124|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  857|    124|	    "\05SummaryInformation", scn);
  858|    124|}
cdf_read_user_stream:
  864|    372|{
  865|    372|	const cdf_directory_t *d;
  866|    372|	int i = cdf_find_stream(dir, name, CDF_DIR_TYPE_USER_STREAM);
  ------------------
  |  |   98|    372|#define CDF_DIR_TYPE_USER_STREAM	2
  ------------------
  867|       |
  868|    372|	if (i <= 0) {
  ------------------
  |  Branch (868:6): [True: 372, False: 0]
  ------------------
  869|    372|		memset(scn, 0, sizeof(*scn));
  870|    372|		return -1;
  871|    372|	}
  872|       |
  873|      0|	d = &dir->dir_tab[i - 1];
  874|      0|	return cdf_read_sector_chain(info, h, sat, ssat, sst,
  875|      0|	    d->d_stream_first_sector, d->d_size, scn);
  876|    372|}
cdf_find_stream:
  880|  1.48k|{
  881|  1.48k|	size_t i, name_len = strlen(name) + 1;
  882|       |
  883|  33.4k|	for (i = dir->dir_len; i > 0; i--)
  ------------------
  |  Branch (883:25): [True: 31.9k, False: 1.48k]
  ------------------
  884|  31.9k|		if (dir->dir_tab[i - 1].d_type == type &&
  ------------------
  |  Branch (884:7): [True: 1.37k, False: 30.6k]
  ------------------
  885|  31.9k|		    cdf_namecmp(name, dir->dir_tab[i - 1].d_name, name_len)
  ------------------
  |  Branch (885:7): [True: 0, False: 1.37k]
  ------------------
  886|  1.37k|		    == 0)
  887|      0|			break;
  888|  1.48k|	if (i > 0)
  ------------------
  |  Branch (888:6): [True: 0, False: 1.48k]
  ------------------
  889|      0|		return CAST(int, i);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  890|       |
  891|  1.48k|	DPRINTF(("Cannot find type %d `%s'\n", type, name));
  892|  1.48k|	errno = ESRCH;
  893|  1.48k|	return 0;
  894|  1.48k|}
cdf.c:cdf_read:
  371|   163k|{
  372|   163k|	size_t siz = CAST(size_t, off + len);
  ------------------
  |  |  426|   163k|#define CAST(T, b)	((T)(b))
  ------------------
  373|       |
  374|   163k|	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  426|   163k|#define CAST(T, b)	((T)(b))
  ------------------
              	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  426|   163k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (374:6): [True: 0, False: 163k]
  ------------------
  375|      0|		goto out;
  376|       |
  377|   163k|	if (info->i_buf != NULL && info->i_len >= siz) {
  ------------------
  |  Branch (377:6): [True: 163k, False: 0]
  |  Branch (377:29): [True: 154k, False: 9.31k]
  ------------------
  378|   154k|		(void)memcpy(buf, &info->i_buf[off], len);
  379|   154k|		return CAST(ssize_t, len);
  ------------------
  |  |  426|   154k|#define CAST(T, b)	((T)(b))
  ------------------
  380|   154k|	}
  381|       |
  382|  9.31k|	if (info->i_fd == -1)
  ------------------
  |  Branch (382:6): [True: 1.53k, False: 7.78k]
  ------------------
  383|  1.53k|		goto out;
  384|       |
  385|  7.78k|	if (pread(info->i_fd, buf, len, off) != CAST(ssize_t, len))
  ------------------
  |  |  426|  7.78k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (385:6): [True: 7.78k, False: 0]
  ------------------
  386|  7.78k|		return -1;
  387|       |
  388|      0|	return CAST(ssize_t, len);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  389|  1.53k|out:
  390|  1.53k|	errno = EINVAL;
  391|  1.53k|	return -1;
  392|  7.78k|}
cdf.c:cdf_calloc:
  125|  1.87k|{
  126|  1.87k|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u %"
  127|  1.87k|	    SIZE_T_FORMAT "u\n", file, line, __func__, n, u));
  128|  1.87k|	if (n == 0)
  ------------------
  |  Branch (128:6): [True: 40, False: 1.83k]
  ------------------
  129|     40|	    n++;
  130|  1.87k|	return calloc(n, u);
  131|  1.87k|}
cdf.c:cdf_malloc:
  103|    239|{
  104|    239|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u\n",
  105|    239|	    file, line, __func__, n));
  106|    239|	if (n == 0)
  ------------------
  |  Branch (106:6): [True: 0, False: 239]
  ------------------
  107|      0|	    n++;
  108|    239|	return malloc(n);
  109|    239|}
cdf.c:cdf_namecmp:
  835|  1.37k|{
  836|  1.39k|	for (; l--; d++, s++)
  ------------------
  |  Branch (836:9): [True: 1.39k, False: 0]
  ------------------
  837|  1.39k|		if (*d != CDF_TOLE2(*s))
  ------------------
  |  |   86|  1.39k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  2.78k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.39k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (837:7): [True: 1.37k, False: 20]
  ------------------
  838|  1.37k|			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |  426|  1.37k|#define CAST(T, b)	((T)(b))
  ------------------
              			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |   86|  1.37k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  2.74k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.37k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  839|      0|	return 0;
  840|  1.37k|}

cdf_timestamp_to_timespec:
  100|    297|{
  101|    297|	struct tm tm;
  102|    297|#ifdef HAVE_STRUCT_TM_TM_ZONE
  103|    297|	static char UTC[] = "UTC";
  104|    297|#endif
  105|    297|	int rdays;
  106|       |
  107|       |	/* Unit is 100's of nanoseconds */
  108|    297|	ts->tv_nsec = (t % CDF_TIME_PREC) * 100;
  ------------------
  |  |   90|    297|#define CDF_TIME_PREC	10000000
  ------------------
  109|       |
  110|    297|	t /= CDF_TIME_PREC;
  ------------------
  |  |   90|    297|#define CDF_TIME_PREC	10000000
  ------------------
  111|    297|	tm.tm_sec = CAST(int, t % 60);
  ------------------
  |  |  426|    297|#define CAST(T, b)	((T)(b))
  ------------------
  112|    297|	t /= 60;
  113|       |
  114|    297|	tm.tm_min = CAST(int, t % 60);
  ------------------
  |  |  426|    297|#define CAST(T, b)	((T)(b))
  ------------------
  115|    297|	t /= 60;
  116|       |
  117|    297|	tm.tm_hour = CAST(int, t % 24);
  ------------------
  |  |  426|    297|#define CAST(T, b)	((T)(b))
  ------------------
  118|    297|	t /= 24;
  119|       |
  120|       |	/* XXX: Approx */
  121|    297|	tm.tm_year = CAST(int, CDF_BASE_YEAR + (t / 365));
  ------------------
  |  |  426|    297|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|    297|	rdays = cdf_getdays(tm.tm_year);
  124|    297|	t -= rdays - 1;
  125|    297|	tm.tm_mday = cdf_getday(tm.tm_year, CAST(int, t));
  ------------------
  |  |  426|    297|#define CAST(T, b)	((T)(b))
  ------------------
  126|    297|	tm.tm_mon = cdf_getmonth(tm.tm_year, CAST(int, t));
  ------------------
  |  |  426|    297|#define CAST(T, b)	((T)(b))
  ------------------
  127|    297|	tm.tm_wday = 0;
  128|    297|	tm.tm_yday = 0;
  129|    297|	tm.tm_isdst = 0;
  130|    297|#ifdef HAVE_STRUCT_TM_TM_GMTOFF
  131|    297|	tm.tm_gmtoff = 0;
  132|    297|#endif
  133|    297|#ifdef HAVE_STRUCT_TM_TM_ZONE
  134|    297|	tm.tm_zone = UTC;
  135|    297|#endif
  136|    297|	tm.tm_year -= 1900;
  137|    297|	ts->tv_sec = mktime(&tm);
  138|    297|	if (ts->tv_sec == -1) {
  ------------------
  |  Branch (138:6): [True: 0, False: 297]
  ------------------
  139|      0|		errno = EINVAL;
  140|      0|		return -1;
  141|      0|	}
  142|    297|	return 0;
  143|    297|}
cdf_time.c:cdf_getdays:
   53|    297|{
   54|    297|	int days = 0;
   55|    297|	int y;
   56|       |
   57|   809k|	for (y = CDF_BASE_YEAR; y < year; y++)
  ------------------
  |  |   89|    297|#define CDF_BASE_YEAR	1601
  ------------------
  |  Branch (57:26): [True: 809k, False: 297]
  ------------------
   58|   809k|		days += isleap(y) + 365;
  ------------------
  |  |   41|   809k|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 202k, False: 607k]
  |  |  ------------------
  |  |   42|   809k|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 194k, False: 8.00k]
  |  |  |  Branch (42:28): [True: 1.95k, False: 6.05k]
  |  |  ------------------
  ------------------
   59|       |
   60|    297|	return days;
   61|    297|}
cdf_time.c:cdf_getday:
   68|    297|{
   69|    297|	size_t m;
   70|       |
   71|    891|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  123|    891|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (71:14): [True: 888, False: 3]
  ------------------
   72|    888|		int sub = mdays[m] + (m == 1 && isleap(year));
  ------------------
  |  |   41|    112|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 44, False: 68]
  |  |  ------------------
  |  |   42|    112|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 24, False: 20]
  |  |  |  Branch (42:28): [True: 10, False: 10]
  |  |  ------------------
  ------------------
  |  Branch (72:25): [True: 112, False: 776]
  ------------------
   73|    888|		if (days < sub)
  ------------------
  |  Branch (73:7): [True: 294, False: 594]
  ------------------
   74|    294|			return days;
   75|    594|		days -= sub;
   76|    594|	}
   77|      3|	return days;
   78|    297|}
cdf_time.c:cdf_getmonth:
   85|    297|{
   86|    297|	size_t m;
   87|       |
   88|    886|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  123|    886|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (88:14): [True: 886, False: 0]
  ------------------
   89|    886|		days -= mdays[m];
   90|    886|		if (m == 1 && isleap(year))
  ------------------
  |  |   41|    111|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 43, False: 68]
  |  |  ------------------
  |  |   42|    111|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 23, False: 20]
  |  |  |  Branch (42:28): [True: 10, False: 10]
  |  |  ------------------
  ------------------
  |  Branch (90:7): [True: 111, False: 775]
  ------------------
   91|     33|			days--;
   92|    886|		if (days <= 0)
  ------------------
  |  Branch (92:7): [True: 297, False: 589]
  ------------------
   93|    297|			return CAST(int, m);
  ------------------
  |  |  426|    297|#define CAST(T, b)	((T)(b))
  ------------------
   94|    886|	}
   95|      0|	return CAST(int, m);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
   96|    297|}

file_zmagic:
  271|  12.5k|{
  272|  12.5k|	unsigned char *newbuf = NULL;
  273|  12.5k|	size_t i, nsz;
  274|  12.5k|	char *rbuf;
  275|  12.5k|	file_pushbuf_t *pb;
  276|  12.5k|	int urv, prv, rv = 0;
  277|  12.5k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  12.5k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  12.5k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  12.5k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  278|  12.5k|	int fd = b->fd;
  279|  12.5k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  12.5k|#define CAST(T, b)	((T)(b))
  ------------------
  280|  12.5k|	size_t nbytes = b->flen;
  281|  12.5k|	int sa_saved = 0;
  282|  12.5k|	struct sigaction sig_act;
  283|       |
  284|  12.5k|	if ((ms->flags & MAGIC_COMPRESS) == 0)
  ------------------
  |  |   35|  12.5k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  |  Branch (284:6): [True: 1.93k, False: 10.5k]
  ------------------
  285|  1.93k|		return 0;
  286|       |
  287|   169k|	for (i = 0; i < ncompr; i++) {
  ------------------
  |  Branch (287:14): [True: 158k, False: 10.5k]
  ------------------
  288|   158k|		int zm;
  289|   158k|		if (nbytes < CAST(size_t, abs(compr[i].maglen)))
  ------------------
  |  |  426|   158k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (289:7): [True: 7.94k, False: 150k]
  ------------------
  290|  7.94k|			continue;
  291|   150k|		if (compr[i].maglen < 0) {
  ------------------
  |  Branch (291:7): [True: 18.1k, False: 132k]
  ------------------
  292|  18.1k|			zm = (*compr[i].u.func)(buf);
  293|   132k|		} else {
  294|   132k|			zm = memcmp(buf, compr[i].u.magic,
  295|   132k|			    CAST(size_t, compr[i].maglen)) == 0;
  ------------------
  |  |  426|   132k|#define CAST(T, b)	((T)(b))
  ------------------
  296|   132k|		}
  297|       |
  298|   150k|		if (!zm)
  ------------------
  |  Branch (298:7): [True: 149k, False: 1.20k]
  ------------------
  299|   149k|			continue;
  300|       |
  301|       |		/* Prevent SIGPIPE death if child dies unexpectedly */
  302|  1.20k|		if (!sa_saved) {
  ------------------
  |  Branch (302:7): [True: 1.11k, False: 92]
  ------------------
  303|       |			//We can use sig_act for both new and old, but
  304|  1.11k|			struct sigaction new_act;
  305|  1.11k|			memset(&new_act, 0, sizeof(new_act));
  306|  1.11k|			new_act.sa_handler = SIG_IGN;
  307|  1.11k|			sa_saved = sigaction(SIGPIPE, &new_act, &sig_act) != -1;
  308|  1.11k|		}
  309|       |
  310|  1.20k|		nsz = nbytes;
  311|  1.20k|		free(newbuf);
  312|  1.20k|		urv = uncompressbuf(fd, ms->bytes_max, i, 
  313|  1.20k|		    (ms->flags & MAGIC_NO_COMPRESS_FORK), buf, &newbuf, &nsz);
  ------------------
  |  |   50|  1.20k|#define MAGIC_NO_COMPRESS_FORK	0x4000000 /* Don't allow decompression that
  ------------------
  314|  1.20k|		DPRINTF("uncompressbuf = %d, %s, %" SIZE_T_FORMAT "u\n", urv,
  315|  1.20k|		    (char *)newbuf, nsz);
  316|  1.20k|		switch (urv) {
  317|    841|		case OKDATA:
  ------------------
  |  |  216|    841|#define OKDATA 	0
  ------------------
  |  Branch (317:3): [True: 841, False: 362]
  ------------------
  318|  1.20k|		case ERRDATA:
  ------------------
  |  |  218|  1.20k|#define ERRDATA	2
  ------------------
  |  Branch (318:3): [True: 362, False: 841]
  ------------------
  319|  1.20k|			ms->flags &= ~MAGIC_COMPRESS;
  ------------------
  |  |   35|  1.20k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  320|  1.20k|			if (urv == ERRDATA)
  ------------------
  |  |  218|  1.20k|#define ERRDATA	2
  ------------------
  |  Branch (320:8): [True: 362, False: 841]
  ------------------
  321|    362|				prv = format_decompression_error(ms, i, newbuf);
  322|    841|			else
  323|    841|				prv = file_buffer(ms, -1, NULL, name, newbuf,
  324|    841|				    nsz);
  325|  1.20k|			if (prv == -1)
  ------------------
  |  Branch (325:8): [True: 2, False: 1.20k]
  ------------------
  326|      2|				goto error;
  327|  1.20k|			rv = 1;
  328|  1.20k|			if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
  ------------------
  |  |   48|  1.20k|#define MAGIC_COMPRESS_TRANSP	0x2000000 /* Check inside compressed files
  ------------------
  |  Branch (328:8): [True: 0, False: 1.20k]
  ------------------
  329|      0|				goto out;
  330|  1.20k|			if (mime != MAGIC_MIME && mime != 0)
  ------------------
  |  |   44|  2.40k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.20k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.20k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (330:8): [True: 1.20k, False: 0]
  |  Branch (330:30): [True: 0, False: 1.20k]
  ------------------
  331|      0|				goto out;
  332|  1.20k|			if ((file_printf(ms,
  ------------------
  |  Branch (332:8): [True: 0, False: 1.20k]
  ------------------
  333|  1.20k|			    mime ? " compressed-encoding=" : " (")) == -1)
  ------------------
  |  Branch (333:8): [True: 0, False: 1.20k]
  ------------------
  334|      0|				goto error;
  335|  1.20k|			if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (335:8): [True: 2, False: 1.19k]
  ------------------
  336|      2|				goto error;
  337|       |			/*
  338|       |			 * XXX: If file_buffer fails here, we overwrite
  339|       |			 * the compressed text. FIXME.
  340|       |			 */
  341|  1.19k|			if (file_buffer(ms, -1, NULL, NULL, buf, nbytes) == -1)
  ------------------
  |  Branch (341:8): [True: 0, False: 1.19k]
  ------------------
  342|      0|			{
  343|      0|				if (file_pop_buffer(ms, pb) != NULL)
  ------------------
  |  Branch (343:9): [True: 0, False: 0]
  ------------------
  344|      0|					abort();
  345|      0|				goto error;
  346|      0|			}
  347|  1.19k|			if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
  ------------------
  |  Branch (347:8): [True: 1.19k, False: 0]
  ------------------
  348|  1.19k|				if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (348:9): [True: 1, False: 1.19k]
  ------------------
  349|      1|					free(rbuf);
  350|      1|					goto error;
  351|      1|				}
  352|  1.19k|				free(rbuf);
  353|  1.19k|			}
  354|  1.19k|			if (!mime && file_printf(ms, ")") == -1)
  ------------------
  |  Branch (354:8): [True: 1.19k, False: 0]
  |  Branch (354:17): [True: 0, False: 1.19k]
  ------------------
  355|      0|				goto error;
  356|       |			/*FALLTHROUGH*/
  357|  1.19k|		case NODATA:
  ------------------
  |  |  217|  1.19k|#define NODATA	1
  ------------------
  |  Branch (357:3): [True: 0, False: 1.20k]
  ------------------
  358|  1.19k|			break;
  359|      0|		default:
  ------------------
  |  Branch (359:3): [True: 0, False: 1.20k]
  ------------------
  360|      0|			abort();
  361|       |			/*NOTREACHED*/
  362|      5|		error:
  363|      5|			rv = -1;
  364|      5|			break;
  365|  1.20k|		}
  366|  1.20k|	}
  367|  10.5k|out:
  368|  10.5k|	DPRINTF("rv = %d\n", rv);
  369|       |
  370|  10.5k|	if (sa_saved && sig_act.sa_handler != SIG_IGN)
  ------------------
  |  Branch (370:6): [True: 1.11k, False: 9.45k]
  |  Branch (370:18): [True: 1.11k, False: 0]
  ------------------
  371|  1.11k|		(void)sigaction(SIGPIPE, &sig_act, NULL);
  372|       |
  373|  10.5k|	free(newbuf);
  374|  10.5k|	ms->flags |= MAGIC_COMPRESS;
  ------------------
  |  |   35|  10.5k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  375|  10.5k|	DPRINTF("Zmagic returns %d\n", rv);
  376|  10.5k|	return rv;
  377|  10.5k|}
sread:
  409|    579|{
  410|    579|	ssize_t rv;
  411|    579|#ifdef FIONREAD
  412|    579|	int t = 0;
  413|    579|#endif
  414|    579|	size_t rn = n;
  415|       |
  416|    579|	if (fd == STDIN_FILENO)
  ------------------
  |  Branch (416:6): [True: 0, False: 579]
  ------------------
  417|      0|		goto nocheck;
  418|       |
  419|    579|#ifdef FIONREAD
  420|    579|	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
  ------------------
  |  Branch (420:6): [True: 0, False: 579]
  |  Branch (420:20): [True: 0, False: 0]
  |  Branch (420:53): [True: 0, False: 0]
  ------------------
  421|      0|#ifdef FD_ZERO
  422|      0|		ssize_t cnt;
  423|      0|		for (cnt = 0;; cnt++) {
  424|      0|			fd_set check;
  425|      0|			struct timeval tout = {0, 100 * 1000};
  426|      0|			int selrv;
  427|       |
  428|      0|			FD_ZERO(&check);
  429|      0|			FD_SET(fd, &check);
  430|       |
  431|       |			/*
  432|       |			 * Avoid soft deadlock: do not read if there
  433|       |			 * is nothing to read from sockets and pipes.
  434|       |			 */
  435|      0|			selrv = select(fd + 1, &check, NULL, NULL, &tout);
  436|      0|			if (selrv == -1) {
  ------------------
  |  Branch (436:8): [True: 0, False: 0]
  ------------------
  437|      0|				if (errno == EINTR || errno == EAGAIN)
  ------------------
  |  Branch (437:9): [True: 0, False: 0]
  |  Branch (437:27): [True: 0, False: 0]
  ------------------
  438|      0|					continue;
  439|      0|			} else if (selrv == 0 && cnt >= 5) {
  ------------------
  |  Branch (439:15): [True: 0, False: 0]
  |  Branch (439:29): [True: 0, False: 0]
  ------------------
  440|      0|				return 0;
  441|      0|			} else
  442|      0|				break;
  443|      0|		}
  444|      0|#endif
  445|      0|		(void)ioctl(fd, FIONREAD, &t);
  446|      0|	}
  447|       |
  448|    579|	if (t > 0 && CAST(size_t, t) < n) {
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (448:6): [True: 0, False: 579]
  |  Branch (448:15): [True: 0, False: 0]
  ------------------
  449|      0|		n = t;
  450|      0|		rn = n;
  451|      0|	}
  452|    579|#endif
  453|       |
  454|    579|nocheck:
  455|    579|	do
  456|  1.47k|		switch ((rv = read(fd, buf, n))) {
  457|      0|		case -1:
  ------------------
  |  Branch (457:3): [True: 0, False: 1.47k]
  ------------------
  458|      0|			if (errno == EINTR)
  ------------------
  |  Branch (458:8): [True: 0, False: 0]
  ------------------
  459|      0|				continue;
  460|      0|			return -1;
  461|    564|		case 0:
  ------------------
  |  Branch (461:3): [True: 564, False: 914]
  ------------------
  462|    564|			return rn - n;
  463|    914|		default:
  ------------------
  |  Branch (463:3): [True: 914, False: 564]
  ------------------
  464|    914|			n -= rv;
  465|    914|			buf = CAST(char *, CCAST(void *, buf)) + rv;
  ------------------
  |  |  426|    914|#define CAST(T, b)	((T)(b))
  ------------------
  466|    914|			break;
  467|  1.47k|		}
  468|    914|	while (n > 0);
  ------------------
  |  Branch (468:9): [True: 899, False: 15]
  ------------------
  469|     15|	return rn;
  470|    579|}
compress.c:lzmacmp:
  137|  7.55k|{
  138|  7.55k|	if (buf[0] != 0x5d || buf[1] || buf[2])
  ------------------
  |  Branch (138:6): [True: 7.51k, False: 32]
  |  Branch (138:24): [True: 10, False: 22]
  |  Branch (138:34): [True: 1, False: 21]
  ------------------
  139|  7.52k|		return 0;
  140|     21|	if (buf[12] && buf[12] != 0xff)
  ------------------
  |  Branch (140:6): [True: 13, False: 8]
  |  Branch (140:17): [True: 12, False: 1]
  ------------------
  141|     12|		return 0;
  142|      9|	return 1;
  143|     21|}
compress.c:zlibcmp:
  119|  10.5k|{
  120|  10.5k|	unsigned short x = 1;
  121|  10.5k|	unsigned char *s = CAST(unsigned char *, CAST(void *, &x));
  ------------------
  |  |  426|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|  10.5k|	if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
  ------------------
  |  Branch (123:6): [True: 9.79k, False: 772]
  |  Branch (123:29): [True: 37, False: 735]
  ------------------
  124|  9.83k|		return 0;
  125|    735|	if (s[0] != 1)	/* endianness test */
  ------------------
  |  Branch (125:6): [True: 0, False: 735]
  ------------------
  126|      0|		x = buf[0] | (buf[1] << 8);
  127|    735|	else
  128|    735|		x = buf[1] | (buf[0] << 8);
  129|    735|	if (x % 31)
  ------------------
  |  Branch (129:6): [True: 215, False: 520]
  ------------------
  130|    215|		return 0;
  131|    520|	return 1;
  132|    735|}
compress.c:format_decompression_error:
  254|    362|{
  255|    362|	unsigned char *p;
  256|    362|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|    362|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    362|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    362|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  257|       |
  258|    362|	if (!mime)
  ------------------
  |  Branch (258:6): [True: 362, False: 0]
  ------------------
  259|    362|		return file_printf(ms, "ERROR:[%s: %s]", methodname(i), buf);
  260|       |
  261|      0|	for (p = buf; *p; p++)
  ------------------
  |  Branch (261:16): [True: 0, False: 0]
  ------------------
  262|      0|		if (!isalnum(*p))
  ------------------
  |  Branch (262:7): [True: 0, False: 0]
  ------------------
  263|      0|			*p = '-';
  264|       |
  265|      0|	return file_printf(ms, "application/x-decompression-error-%s-%s",
  266|      0|	    methodname(i), buf);
  267|    362|}
compress.c:methodname:
  980|    362|{
  981|    362|	switch (method) {
  982|      0|#ifdef BUILTIN_DECOMPRESS
  983|    131|	case METH_FROZEN:
  ------------------
  |  |  186|    131|#define METH_FROZEN	2
  ------------------
  |  Branch (983:2): [True: 131, False: 231]
  ------------------
  984|    147|	case METH_ZLIB:
  ------------------
  |  |  192|    147|#define METH_ZLIB	14
  ------------------
  |  Branch (984:2): [True: 16, False: 346]
  ------------------
  985|    147|		return "zlib";
  986|      0|#endif
  987|      0|#ifdef BUILTIN_BZLIB
  988|      5|	case METH_BZIP:
  ------------------
  |  |  187|      5|#define METH_BZIP	7
  ------------------
  |  Branch (988:2): [True: 5, False: 357]
  ------------------
  989|      5|		return "bzlib";
  990|      0|#endif
  991|      0|#ifdef BUILTIN_XZLIB
  992|      2|	case METH_XZ:
  ------------------
  |  |  188|      2|#define METH_XZ		9
  ------------------
  |  Branch (992:2): [True: 2, False: 360]
  ------------------
  993|      4|	case METH_LZMA:
  ------------------
  |  |  191|      4|#define METH_LZMA	13
  ------------------
  |  Branch (993:2): [True: 2, False: 360]
  ------------------
  994|      4|		return "xzlib";
  995|      0|#endif
  996|      0|#ifdef BUILTIN_ZSTDLIB
  997|      2|	case METH_ZSTD:
  ------------------
  |  |  190|      2|#define METH_ZSTD	12
  ------------------
  |  Branch (997:2): [True: 2, False: 360]
  ------------------
  998|      2|		return "zstd";
  999|      0|#endif
 1000|       |#ifdef BUILTIN_LZLIB
 1001|       |	case METH_LZIP:
 1002|       |		return "lzlib";
 1003|       |#endif
 1004|    204|	default:
  ------------------
  |  Branch (1004:2): [True: 204, False: 158]
  ------------------
 1005|    204|		return compr[method].argv[0];
 1006|    362|	}
 1007|    362|}
compress.c:uncompressbuf:
 1045|  1.20k|{
 1046|  1.20k|	int fdp[3][2];
 1047|  1.20k|	int status, rv, w;
 1048|  1.20k|	pid_t pid;
 1049|  1.20k|	pid_t writepid = -1;
 1050|  1.20k|	size_t i;
 1051|  1.20k|	ssize_t r;
 1052|  1.20k|	char *const *args;
 1053|  1.20k|#ifdef HAVE_POSIX_SPAWNP
 1054|  1.20k|	posix_spawn_file_actions_t fa;
 1055|  1.20k|#endif
 1056|  1.20k|	int (*decompress)(const unsigned char *, unsigned char **,
 1057|  1.20k|	    size_t, size_t *, int) = getdecompressor(method);
 1058|       |
 1059|  1.20k|	*newch = CAST(unsigned char *, malloc(bytes_max + 1));
  ------------------
  |  |  426|  1.20k|#define CAST(T, b)	((T)(b))
  ------------------
 1060|  1.20k|	if (*newch == NULL)
  ------------------
  |  Branch (1060:6): [True: 0, False: 1.20k]
  ------------------
 1061|      0|		return makeerror(newch, n, "No buffer, %s", strerror(errno));
 1062|       |
 1063|  1.20k|	if (decompress) {
  ------------------
  |  Branch (1063:6): [True: 906, False: 297]
  ------------------
 1064|    906|		if (nofork) {
  ------------------
  |  Branch (1064:7): [True: 0, False: 906]
  ------------------
 1065|      0|			return makeerror(newch, n,
 1066|      0|			    "Fork is required to uncompress, but disabled");
 1067|      0|		}
 1068|    906|		return (*decompress)(old, newch, bytes_max, n, 1);
 1069|    906|	}
 1070|       |
 1071|    297|	(void)fflush(stdout);
 1072|    297|	(void)fflush(stderr);
 1073|       |
 1074|  1.18k|	for (i = 0; i < __arraycount(fdp); i++)
  ------------------
  |  |  123|  1.18k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1074:14): [True: 891, False: 297]
  ------------------
 1075|    891|		fdp[i][0] = fdp[i][1] = -1;
 1076|       |
 1077|       |	/*
 1078|       |	 * There are multithreaded users who run magic_file()
 1079|       |	 * from dozens of threads. If two parallel magic_file() calls
 1080|       |	 * analyze two large compressed files, both will spawn
 1081|       |	 * an uncompressing child here, which writes out uncompressed data.
 1082|       |	 * We read some portion, then close the pipe, then waitpid() the child.
 1083|       |	 * If uncompressed data is larger, child shound get EPIPE and exit.
 1084|       |	 * However, with *parallel* calls OTHER child may unintentionally
 1085|       |	 * inherit pipe fds, thus keeping pipe open and making writes in
 1086|       |	 * our child block instead of failing with EPIPE!
 1087|       |	 * (For the bug to occur, two threads must mutually inherit their pipes,
 1088|       |	 * and both must have large outputs. Thus it happens not that often).
 1089|       |	 * To avoid this, be sure to create pipes with O_CLOEXEC.
 1090|       |	 */
 1091|    297|	if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) ||
  ------------------
  |  Branch (1091:7): [True: 0, False: 297]
  |  Branch (1091:19): [True: 0, False: 0]
  ------------------
 1092|    297|	    file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 ||
  ------------------
  |  Branch (1092:6): [True: 0, False: 297]
  ------------------
 1093|    297|	    file_pipe_closexec(fdp[STDERR_FILENO]) == -1) {
  ------------------
  |  Branch (1093:6): [True: 0, False: 297]
  ------------------
 1094|      0|		closep(fdp[STDIN_FILENO]);
 1095|      0|		closep(fdp[STDOUT_FILENO]);
 1096|      0|		return makeerror(newch, n, "Cannot create pipe, %s",
 1097|      0|		    strerror(errno));
 1098|      0|	}
 1099|       |
 1100|    297|	args = RCAST(char *const *, RCAST(intptr_t, compr[method].argv));
  ------------------
  |  |  427|    297|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1101|    297|#ifdef HAVE_POSIX_SPAWNP
 1102|    297|	posix_spawn_file_actions_init(&fa);
 1103|       |
 1104|    297|	handledesc(&fa, fd, fdp);
 1105|       |
 1106|    297|	status = posix_spawnp(&pid, compr[method].argv[0], &fa, NULL,
 1107|    297|	    args, NULL);
 1108|       |
 1109|    297|	posix_spawn_file_actions_destroy(&fa);
 1110|       |
 1111|    297|	if (status == -1) {
  ------------------
  |  Branch (1111:6): [True: 0, False: 297]
  ------------------
 1112|      0|		return makeerror(newch, n, "Cannot posix_spawn `%s', %s",
 1113|      0|		    compr[method].argv[0], strerror(errno));
 1114|      0|	}
 1115|       |#else
 1116|       |	/* For processes with large mapped virtual sizes, vfork
 1117|       |	 * may be _much_ faster (10-100 times) than fork.
 1118|       |	 */
 1119|       |	pid = vfork();
 1120|       |	if (pid == -1) {
 1121|       |		return makeerror(newch, n, "Cannot vfork, %s",
 1122|       |		    strerror(errno));
 1123|       |	}
 1124|       |	if (pid == 0) {
 1125|       |		/* child */
 1126|       |		/* Note: we are after vfork, do not modify memory
 1127|       |		 * in a way which confuses parent. In particular,
 1128|       |		 * do not modify fdp[i][j].
 1129|       |		 */
 1130|       |		handledesc(NULL, fd, fdp);
 1131|       |
 1132|       |		(void)execvp(compr[method].argv[0], args);
 1133|       |		dprintf(STDERR_FILENO, "exec `%s' failed, %s",
 1134|       |		    compr[method].argv[0], strerror(errno));
 1135|       |		_exit(EXIT_FAILURE); /* _exit(), not exit(), because of vfork */
 1136|       |	}
 1137|       |#endif
 1138|       |	/* parent */
 1139|       |	/* Close write sides of child stdout/err pipes */
 1140|    891|	for (i = 1; i < __arraycount(fdp); i++)
  ------------------
  |  |  123|    891|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1140:14): [True: 594, False: 297]
  ------------------
 1141|    594|		closefd(fdp[i], 1);
 1142|       |	/* Write the buffer data to child stdin, if we don't have fd */
 1143|    297|	if (fd == -1) {
  ------------------
  |  Branch (1143:6): [True: 0, False: 297]
  ------------------
 1144|      0|		closefd(fdp[STDIN_FILENO], 0);
 1145|      0|		writepid = writechild(fdp[STDIN_FILENO][1], old, *n);
 1146|      0|		if (writepid == (pid_t)-1) {
  ------------------
  |  Branch (1146:7): [True: 0, False: 0]
  ------------------
 1147|      0|			rv = makeerror(newch, n, "Write to child failed, %s",
 1148|      0|			    strerror(errno));
 1149|      0|			goto err;
 1150|      0|		}
 1151|      0|		closefd(fdp[STDIN_FILENO], 1);
 1152|      0|	}
 1153|       |
 1154|    297|	rv = OKDATA;
  ------------------
  |  |  216|    297|#define OKDATA 	0
  ------------------
 1155|    297|	r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
 1156|    297|	if (r < 0) {
  ------------------
  |  Branch (1156:6): [True: 0, False: 297]
  ------------------
 1157|      0|		rv = ERRDATA;
  ------------------
  |  |  218|      0|#define ERRDATA	2
  ------------------
 1158|      0|		DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
 1159|      0|		        strerror(errno));
 1160|      0|		goto err;
 1161|      0|	} 
 1162|    297|	if (CAST(size_t, r) == bytes_max) {
  ------------------
  |  |  426|    297|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1162:6): [True: 15, False: 282]
  ------------------
 1163|       |		/*
 1164|       |		 * close fd so that the child exits with sigpipe and ignore
 1165|       |		 * errors, otherwise we risk the child blocking and never
 1166|       |		 * exiting.
 1167|       |		 */
 1168|     15|		closefd(fdp[STDOUT_FILENO], 0);
 1169|     15|		goto ok;
 1170|     15|	}
 1171|    282|	if ((r = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0) {
  ------------------
  |  Branch (1171:6): [True: 201, False: 81]
  ------------------
 1172|    201|		rv = ERRDATA;
  ------------------
  |  |  218|    201|#define ERRDATA	2
  ------------------
 1173|    201|		r = filter_error(*newch, r);
 1174|    201|		goto ok;
 1175|    201|	}
 1176|     81|	if  (r == 0)
  ------------------
  |  Branch (1176:7): [True: 81, False: 0]
  ------------------
 1177|     81|		goto ok;
 1178|      0|	rv = makeerror(newch, n, "Read stderr failed, %s",
 1179|      0|	    strerror(errno));
 1180|      0|	goto err;
 1181|    297|ok:
 1182|    297|	*n = r;
 1183|       |	/* NUL terminate, as every buffer is handled here. */
 1184|    297|	(*newch)[*n] = '\0';
 1185|    297|err:
 1186|    297|	closefd(fdp[STDIN_FILENO], 1);
 1187|    297|	closefd(fdp[STDOUT_FILENO], 0);
 1188|    297|	closefd(fdp[STDERR_FILENO], 0);
 1189|       |
 1190|    297|	w = waitpid(pid, &status, 0);
 1191|    297|wait_err:
 1192|    297|	if (w == -1) {
  ------------------
  |  Branch (1192:6): [True: 3, False: 294]
  ------------------
 1193|      3|		rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
 1194|      3|		DPRINTF("Child wait return %#x\n", status);
 1195|    294|	} else if (!WIFEXITED(status)) {
  ------------------
  |  Branch (1195:13): [True: 0, False: 294]
  ------------------
 1196|      0|		DPRINTF("Child not exited (%#x)\n", status);
 1197|    294|	} else if (WEXITSTATUS(status) != 0) {
  ------------------
  |  Branch (1197:13): [True: 216, False: 78]
  ------------------
 1198|    216|		DPRINTF("Child exited (%#x)\n", WEXITSTATUS(status));
 1199|    216|	}
 1200|    297|	if (writepid > 0) {
  ------------------
  |  Branch (1200:6): [True: 0, False: 297]
  ------------------
 1201|       |		/* _After_ we know decompressor has exited, our input writer
 1202|       |		 * definitely will exit now (at worst, writing fails in it,
 1203|       |		 * since output fd is closed now on the reading size).
 1204|       |		 */
 1205|      0|		w = waitpid(writepid, &status, 0);
 1206|      0|		writepid = -1;
 1207|      0|		goto wait_err;
 1208|      0|	}
 1209|       |
 1210|    297|	closefd(fdp[STDIN_FILENO], 0); //why? it is already closed here!
 1211|    297|	DPRINTF("Returning %p n=%" SIZE_T_FORMAT "u rv=%d\n", *newch, *n, rv);
 1212|       |
 1213|    297|	return rv;
 1214|    297|}
compress.c:getdecompressor:
 1012|  1.20k|{
 1013|  1.20k|	switch (method) {
 1014|      0|#ifdef BUILTIN_DECOMPRESS
 1015|    177|	case METH_FROZEN:
  ------------------
  |  |  186|    177|#define METH_FROZEN	2
  ------------------
  |  Branch (1015:2): [True: 177, False: 1.02k]
  ------------------
 1016|    177|		return uncompressgzipped;
 1017|    520|	case METH_ZLIB:
  ------------------
  |  |  192|    520|#define METH_ZLIB	14
  ------------------
  |  Branch (1017:2): [True: 520, False: 683]
  ------------------
 1018|    520|		return uncompresszlib;
 1019|      0|#endif
 1020|      0|#ifdef BUILTIN_BZLIB
 1021|      6|	case METH_BZIP:
  ------------------
  |  |  187|      6|#define METH_BZIP	7
  ------------------
  |  Branch (1021:2): [True: 6, False: 1.19k]
  ------------------
 1022|      6|		return uncompressbzlib;
 1023|      0|#endif
 1024|      0|#ifdef BUILTIN_XZLIB
 1025|      3|	case METH_XZ:
  ------------------
  |  |  188|      3|#define METH_XZ		9
  ------------------
  |  Branch (1025:2): [True: 3, False: 1.20k]
  ------------------
 1026|     12|	case METH_LZMA:
  ------------------
  |  |  191|     12|#define METH_LZMA	13
  ------------------
  |  Branch (1026:2): [True: 9, False: 1.19k]
  ------------------
 1027|     12|		return uncompressxzlib;
 1028|      0|#endif
 1029|      0|#ifdef BUILTIN_ZSTDLIB
 1030|    191|	case METH_ZSTD:
  ------------------
  |  |  190|    191|#define METH_ZSTD	12
  ------------------
  |  Branch (1030:2): [True: 191, False: 1.01k]
  ------------------
 1031|    191|		return uncompresszstd;
 1032|      0|#endif
 1033|       |#ifdef BUILTIN_LZLIB
 1034|       |	case METH_LZIP:
 1035|       |		return uncompresslzlib;
 1036|       |#endif
 1037|    297|	default:
  ------------------
  |  Branch (1037:2): [True: 297, False: 906]
  ------------------
 1038|    297|		return NULL;
 1039|  1.20k|	}
 1040|  1.20k|}
compress.c:uncompressgzipped:
  567|    177|{
  568|    177|	unsigned char flg;
  569|    177|	size_t data_start = 10;
  570|       |
  571|    177|	if (*n < 4) {
  ------------------
  |  Branch (571:6): [True: 2, False: 175]
  ------------------
  572|      2|		goto err;	
  573|      2|	}
  574|       |
  575|    175|	flg = old[3];
  576|       |
  577|    175|	if (flg & FEXTRA) {
  ------------------
  |  |  559|    175|#define FEXTRA		(1 << 2)
  ------------------
  |  Branch (577:6): [True: 77, False: 98]
  ------------------
  578|     77|		if (data_start + 1 >= *n)
  ------------------
  |  Branch (578:7): [True: 11, False: 66]
  ------------------
  579|     11|			goto err;
  580|     66|		data_start += 2 + old[data_start] + old[data_start + 1] * 256;
  581|     66|	}
  582|    164|	if (flg & FNAME) {
  ------------------
  |  |  560|    164|#define FNAME		(1 << 3)
  ------------------
  |  Branch (582:6): [True: 79, False: 85]
  ------------------
  583|   422k|		while(data_start < *n && old[data_start])
  ------------------
  |  Branch (583:9): [True: 422k, False: 57]
  |  Branch (583:28): [True: 422k, False: 22]
  ------------------
  584|   422k|			data_start++;
  585|     79|		data_start++;
  586|     79|	}
  587|    164|	if (flg & FCOMMENT) {
  ------------------
  |  |  561|    164|#define FCOMMENT	(1 << 4)
  ------------------
  |  Branch (587:6): [True: 90, False: 74]
  ------------------
  588|   632k|		while(data_start < *n && old[data_start])
  ------------------
  |  Branch (588:9): [True: 632k, False: 73]
  |  Branch (588:28): [True: 632k, False: 17]
  ------------------
  589|   632k|			data_start++;
  590|     90|		data_start++;
  591|     90|	}
  592|    164|	if (flg & FHCRC)
  ------------------
  |  |  558|    164|#define FHCRC		(1 << 1)
  ------------------
  |  Branch (592:6): [True: 74, False: 90]
  ------------------
  593|     74|		data_start += 2;
  594|       |
  595|    164|	if (data_start >= *n)
  ------------------
  |  Branch (595:6): [True: 99, False: 65]
  ------------------
  596|     99|		goto err;
  597|       |
  598|     65|	*n -= data_start;
  599|     65|	old += data_start;
  600|     65|	return uncompresszlib(old, newch, bytes_max, n, 0);
  601|    112|err:
  602|    112|	return makeerror(newch, n, "File too short");
  603|    164|}
compress.c:uncompresszlib:
  608|    585|{
  609|    585|	int rc;
  610|    585|	z_stream z;
  611|       |
  612|    585|	z.next_in = CCAST(Bytef *, old);
  ------------------
  |  |  428|    585|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  613|    585|	z.avail_in = CAST(uint32_t, *n);
  ------------------
  |  |  426|    585|#define CAST(T, b)	((T)(b))
  ------------------
  614|    585|	z.next_out = *newch;
  615|    585|	z.avail_out = CAST(unsigned int, bytes_max);
  ------------------
  |  |  426|    585|#define CAST(T, b)	((T)(b))
  ------------------
  616|    585|	z.zalloc = Z_NULL;
  617|    585|	z.zfree = Z_NULL;
  618|    585|	z.opaque = Z_NULL;
  619|       |
  620|       |	/* LINTED bug in header macro */
  621|    585|	rc = zlib ? inflateInit(&z) : inflateInit2(&z, -15);
  ------------------
  |  Branch (621:7): [True: 520, False: 65]
  ------------------
  622|    585|	if (rc != Z_OK)
  ------------------
  |  Branch (622:6): [True: 0, False: 585]
  ------------------
  623|      0|		goto err;
  624|       |
  625|    585|	rc = inflate(&z, Z_SYNC_FLUSH);
  626|    585|	if (rc != Z_OK && rc != Z_STREAM_END) {
  ------------------
  |  Branch (626:6): [True: 39, False: 546]
  |  Branch (626:20): [True: 35, False: 4]
  ------------------
  627|     35|		inflateEnd(&z);
  628|     35|		goto err;
  629|     35|	}
  630|       |
  631|    550|	*n = CAST(size_t, z.total_out);
  ------------------
  |  |  426|    550|#define CAST(T, b)	((T)(b))
  ------------------
  632|    550|	rc = inflateEnd(&z);
  633|    550|	if (rc != Z_OK)
  ------------------
  |  Branch (633:6): [True: 0, False: 550]
  ------------------
  634|      0|		goto err;
  635|       |
  636|       |	/* let's keep the nul-terminate tradition */
  637|    550|	(*newch)[*n] = '\0';
  638|       |
  639|    550|	return OKDATA;
  ------------------
  |  |  216|    550|#define OKDATA 	0
  ------------------
  640|     35|err:
  641|     35|	return makeerror(newch, n, "%s", z.msg ? z.msg : zError(rc));
  ------------------
  |  Branch (641:35): [True: 30, False: 5]
  ------------------
  642|    550|}
compress.c:uncompressbzlib:
  649|      6|{
  650|      6|	int rc;
  651|      6|	bz_stream bz;
  652|       |
  653|      6|	memset(&bz, 0, sizeof(bz));
  654|      6|	rc = BZ2_bzDecompressInit(&bz, 0, 0);
  655|      6|	if (rc != BZ_OK)
  ------------------
  |  Branch (655:6): [True: 0, False: 6]
  ------------------
  656|      0|		goto err;
  657|       |
  658|      6|	bz.next_in = CCAST(char *, RCAST(const char *, old));
  ------------------
  |  |  428|      6|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  659|      6|	bz.avail_in = CAST(uint32_t, *n);
  ------------------
  |  |  426|      6|#define CAST(T, b)	((T)(b))
  ------------------
  660|      6|	bz.next_out = RCAST(char *, *newch);
  ------------------
  |  |  427|      6|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  661|      6|	bz.avail_out = CAST(unsigned int, bytes_max);
  ------------------
  |  |  426|      6|#define CAST(T, b)	((T)(b))
  ------------------
  662|       |
  663|      6|	rc = BZ2_bzDecompress(&bz);
  664|      6|	if (rc != BZ_OK && rc != BZ_STREAM_END) {
  ------------------
  |  Branch (664:6): [True: 5, False: 1]
  |  Branch (664:21): [True: 5, False: 0]
  ------------------
  665|      5|		BZ2_bzDecompressEnd(&bz);
  666|      5|		goto err;
  667|      5|	}
  668|       |
  669|       |	/* Assume byte_max is within 32bit */
  670|       |	/* assert(bz.total_out_hi32 == 0); */
  671|      1|	*n = CAST(size_t, bz.total_out_lo32);
  ------------------
  |  |  426|      1|#define CAST(T, b)	((T)(b))
  ------------------
  672|      1|	rc = BZ2_bzDecompressEnd(&bz);
  673|      1|	if (rc != BZ_OK)
  ------------------
  |  Branch (673:6): [True: 0, False: 1]
  ------------------
  674|      0|		goto err;
  675|       |
  676|       |	/* let's keep the nul-terminate tradition */
  677|      1|	(*newch)[*n] = '\0';
  678|       |
  679|      1|	return OKDATA;
  ------------------
  |  |  216|      1|#define OKDATA 	0
  ------------------
  680|      5|err:
  681|      5|	return makeerror(newch, n, "bunzip error %d", rc);
  682|      1|}
compress.c:uncompressxzlib:
  689|     12|{
  690|     12|	int rc;
  691|     12|	lzma_stream xz;
  692|       |
  693|     12|	memset(&xz, 0, sizeof(xz));
  694|     12|	rc = lzma_auto_decoder(&xz, UINT64_MAX, 0);
  695|     12|	if (rc != LZMA_OK)
  ------------------
  |  Branch (695:6): [True: 0, False: 12]
  ------------------
  696|      0|		goto err;
  697|       |
  698|     12|	xz.next_in = CCAST(const uint8_t *, old);
  ------------------
  |  |  428|     12|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  699|     12|	xz.avail_in = CAST(uint32_t, *n);
  ------------------
  |  |  426|     12|#define CAST(T, b)	((T)(b))
  ------------------
  700|     12|	xz.next_out = RCAST(uint8_t *, *newch);
  ------------------
  |  |  427|     12|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  701|     12|	xz.avail_out = CAST(unsigned int, bytes_max);
  ------------------
  |  |  426|     12|#define CAST(T, b)	((T)(b))
  ------------------
  702|       |
  703|     12|	rc = lzma_code(&xz, LZMA_RUN);
  704|     12|	if (rc != LZMA_OK && rc != LZMA_STREAM_END) {
  ------------------
  |  Branch (704:6): [True: 5, False: 7]
  |  Branch (704:23): [True: 4, False: 1]
  ------------------
  705|      4|		lzma_end(&xz);
  706|      4|		goto err;
  707|      4|	}
  708|       |
  709|      8|	*n = CAST(size_t, xz.total_out);
  ------------------
  |  |  426|      8|#define CAST(T, b)	((T)(b))
  ------------------
  710|       |
  711|      8|	lzma_end(&xz);
  712|       |
  713|       |	/* let's keep the nul-terminate tradition */
  714|      8|	(*newch)[*n] = '\0';
  715|       |
  716|      8|	return OKDATA;
  ------------------
  |  |  216|      8|#define OKDATA 	0
  ------------------
  717|      4|err:
  718|      4|	return makeerror(newch, n, "unxz error %d", rc);
  719|     12|}
compress.c:uncompresszstd:
  726|    191|{
  727|    191|	size_t rc;
  728|    191|	ZSTD_DStream *zstd;
  729|    191|	ZSTD_inBuffer in;
  730|    191|	ZSTD_outBuffer out;
  731|       |
  732|    191|	if ((zstd = ZSTD_createDStream()) == NULL) {
  ------------------
  |  Branch (732:6): [True: 0, False: 191]
  ------------------
  733|      0|		return makeerror(newch, n, "No ZSTD decompression stream, %s",
  734|      0|		    strerror(errno));
  735|      0|	}
  736|       |
  737|    191|	rc = ZSTD_DCtx_reset(zstd, ZSTD_reset_session_only);
  738|    191|	if (ZSTD_isError(rc))
  ------------------
  |  Branch (738:6): [True: 0, False: 191]
  ------------------
  739|      0|		goto err;
  740|       |
  741|    191|	in.src = CCAST(const void *, old);
  ------------------
  |  |  428|    191|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  742|    191|	in.size = *n;
  743|    191|	in.pos = 0;
  744|    191|	out.dst = RCAST(void *, *newch);
  ------------------
  |  |  427|    191|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  745|    191|	out.size = bytes_max;
  746|    191|	out.pos = 0;
  747|       |
  748|    191|	rc = ZSTD_decompressStream(zstd, &out, &in);
  749|    191|	if (ZSTD_isError(rc))
  ------------------
  |  Branch (749:6): [True: 2, False: 189]
  ------------------
  750|      2|		goto err;
  751|       |
  752|    189|	*n = out.pos;
  753|       |
  754|    189|	ZSTD_freeDStream(zstd);
  755|       |
  756|       |	/* let's keep the nul-terminate tradition */
  757|    189|	(*newch)[*n] = '\0';
  758|       |
  759|    189|	return OKDATA;
  ------------------
  |  |  216|    189|#define OKDATA 	0
  ------------------
  760|      2|err:
  761|      2|	ZSTD_freeDStream(zstd);
  762|      2|	return makeerror(newch, n, "zstd error %d", ZSTD_getErrorCode(rc));
  763|    191|}
compress.c:makeerror:
  831|    161|{
  832|    161|	char *msg;
  833|    161|	va_list ap;
  834|    161|	int rv;
  835|       |
  836|    161|	free(*buf);
  837|    161|	va_start(ap, fmt);
  838|    161|	rv = vasprintf(&msg, fmt, ap);
  839|    161|	va_end(ap);
  840|    161|	if (rv < 0) {
  ------------------
  |  Branch (840:6): [True: 0, False: 161]
  ------------------
  841|      0|		*buf = NULL;
  842|      0|		*len = 0;
  843|      0|		return NODATA;
  ------------------
  |  |  217|      0|#define NODATA	1
  ------------------
  844|      0|	}
  845|    161|	*buf = RCAST(unsigned char *, msg);
  ------------------
  |  |  427|    161|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  846|    161|	*len = strlen(msg);
  847|    161|	return ERRDATA;
  ------------------
  |  |  218|    161|#define ERRDATA	2
  ------------------
  848|    161|}
compress.c:handledesc:
  898|    297|{
  899|    297|	if (fd != -1) {
  ------------------
  |  Branch (899:6): [True: 297, False: 0]
  ------------------
  900|    297|		(void) lseek(fd, CAST(off_t, 0), SEEK_SET);
  ------------------
  |  |  426|    297|#define CAST(T, b)	((T)(b))
  ------------------
  901|    297|		movedesc(v, STDIN_FILENO, fd);
  902|    297|	} else {
  903|      0|		movedesc(v, STDIN_FILENO, fdp[STDIN_FILENO][0]);
  904|      0|		if (fdp[STDIN_FILENO][1] > 2)
  ------------------
  |  Branch (904:7): [True: 0, False: 0]
  ------------------
  905|      0|		    closedesc(v, fdp[STDIN_FILENO][1]);
  906|      0|	}
  907|       |
  908|    297|	file_clear_closexec(STDIN_FILENO);
  909|       |
  910|       |///FIXME: if one of the fdp[i][j] is 0 or 1, this can bomb spectacularly
  911|    297|	movedesc(v, STDOUT_FILENO, fdp[STDOUT_FILENO][1]);
  912|    297|	if (fdp[STDOUT_FILENO][0] > 2)
  ------------------
  |  Branch (912:6): [True: 297, False: 0]
  ------------------
  913|    297|		closedesc(v, fdp[STDOUT_FILENO][0]);
  914|       |
  915|    297|	file_clear_closexec(STDOUT_FILENO);
  916|       |
  917|    297|	movedesc(v, STDERR_FILENO, fdp[STDERR_FILENO][1]);
  918|    297|	if (fdp[STDERR_FILENO][0] > 2)
  ------------------
  |  Branch (918:6): [True: 297, False: 0]
  ------------------
  919|    297|		closedesc(v, fdp[STDERR_FILENO][0]);
  920|       |
  921|    297|	file_clear_closexec(STDERR_FILENO);
  922|    297|}
compress.c:movedesc:
  869|    891|{
  870|    891|	if (fd == i)
  ------------------
  |  Branch (870:6): [True: 0, False: 891]
  ------------------
  871|      0|		return; /* "no dup was necessary" */
  872|    891|#ifdef HAVE_POSIX_SPAWNP
  873|    891|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  427|    891|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  874|    891|	posix_spawn_file_actions_adddup2(fa, fd, i);
  875|    891|	posix_spawn_file_actions_addclose(fa, fd);
  876|       |#else
  877|       |	if (dup2(fd, i) == -1) {
  878|       |		DPRINTF("dup(%d, %d) failed (%s)\n", fd, i, strerror(errno));
  879|       |		exit(EXIT_FAILURE);
  880|       |	}
  881|       |	close(v ? fd : fd);
  882|       |#endif
  883|    891|}
compress.c:closedesc:
  887|    594|{
  888|    594|#ifdef HAVE_POSIX_SPAWNP
  889|    594|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  427|    594|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  890|    594|	posix_spawn_file_actions_addclose(fa, fd);
  891|       |#else
  892|       |	close(v ? fd : fd);
  893|       |#endif
  894|    594|}
compress.c:closefd:
  852|  1.79k|{
  853|  1.79k|	if (fd[i] == -1)
  ------------------
  |  Branch (853:6): [True: 609, False: 1.18k]
  ------------------
  854|    609|		return;
  855|  1.18k|	(void) close(fd[i]);
  856|  1.18k|	fd[i] = -1;
  857|  1.18k|}
compress.c:filter_error:
  952|    201|{
  953|    201|	char *p;
  954|    201|	char *buf;
  955|       |
  956|    201|	ubuf[n] = '\0';
  957|    201|	buf = RCAST(char *, ubuf);
  ------------------
  |  |  427|    201|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  958|    201|	while (isspace(CAST(unsigned char, *buf)))
  959|    198|		buf++;
  960|    201|	DPRINTF("Filter error[[[%s]]]\n", buf);
  961|    201|	if ((p = strchr(CAST(char *, buf), '\n')) != NULL)
  ------------------
  |  |  426|    201|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (961:6): [True: 201, False: 0]
  ------------------
  962|    201|		*p = '\0';
  963|    201|	if ((p = strchr(CAST(char *, buf), ';')) != NULL)
  ------------------
  |  |  426|    201|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (963:6): [True: 0, False: 201]
  ------------------
  964|      0|		*p = '\0';
  965|    201|	if ((p = strrchr(CAST(char *, buf), ':')) != NULL) {
  ------------------
  |  |  426|    201|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (965:6): [True: 200, False: 1]
  ------------------
  966|    200|		++p;
  967|    200|		while (isspace(CAST(unsigned char, *p)))
  968|    200|			p++;
  969|    200|		n = strlen(p);
  970|    200|		memmove(ubuf, p, CAST(size_t, n + 1));
  ------------------
  |  |  426|    200|#define CAST(T, b)	((T)(b))
  ------------------
  971|    200|	}
  972|    201|	DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
  973|    201|	if (islower(*ubuf))
  974|    183|		*ubuf = toupper(*ubuf);
  975|    201|	return n;
  976|    201|}

der_offs:
  265|  12.8k|{
  266|  12.8k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  427|  12.8k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  267|  12.8k|	size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
  ------------------
  |  Branch (267:25): [True: 12.8k, False: 0]
  ------------------
  268|       |
  269|  12.8k|	if (gettag(b, &offs, len) == DER_BAD) {
  ------------------
  |  |   62|  12.8k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  12.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (269:6): [True: 0, False: 12.8k]
  ------------------
  270|      0|		DPRINTF(("%s: bad tag 1\n", __func__));
  271|      0|		return -1;
  272|      0|	}
  273|  12.8k|	DPRINTF(("%s1: %u %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  274|  12.8k|	    offs, m->offset));
  275|       |
  276|  12.8k|	uint32_t tlen = getlength(b, &offs, len);
  277|  12.8k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|  12.8k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  12.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (277:6): [True: 0, False: 12.8k]
  ------------------
  278|      0|		DPRINTF(("%s: bad tag 2\n", __func__));
  279|      0|		return -1;
  280|      0|	}
  281|  12.8k|	DPRINTF(("%s2: %u %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
  282|  12.8k|	    offs, tlen));
  283|       |
  284|  12.8k|	offs += ms->offset + m->offset;
  285|  12.8k|	DPRINTF(("cont_level = %d\n", m->cont_level));
  286|       |#ifdef DEBUG_DER
  287|       |	size_t i;
  288|       |	for (i = 0; i < m->cont_level; i++)
  289|       |		printf("cont_level[%" SIZE_T_FORMAT "u] = %d\n", i,
  290|       |		    ms->c.li[i].off);
  291|       |#endif
  292|  12.8k|	if (m->cont_level != 0) {
  ------------------
  |  Branch (292:6): [True: 2.18k, False: 10.7k]
  ------------------
  293|  2.18k|		if (offs + tlen > nbytes)
  ------------------
  |  Branch (293:7): [True: 0, False: 2.18k]
  ------------------
  294|      0|			return -1;
  295|  2.18k|		ms->c.li[m->cont_level - 1].off = CAST(int, offs + tlen);
  ------------------
  |  |  426|  2.18k|#define CAST(T, b)	((T)(b))
  ------------------
  296|  2.18k|		DPRINTF(("cont_level[%u] = %d\n", m->cont_level - 1,
  297|  2.18k|		    ms->c.li[m->cont_level - 1].off));
  298|  2.18k|	}
  299|  12.8k|	return CAST(int32_t, offs);
  ------------------
  |  |  426|  12.8k|#define CAST(T, b)	((T)(b))
  ------------------
  300|  12.8k|}
der_cmp:
  304|   216k|{
  305|   216k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  427|   216k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  306|   216k|	const char *s = m->value.s;
  307|   216k|	size_t offs = 0, len = ms->search.s_len;
  308|   216k|	uint32_t tag, tlen;
  309|   216k|	char buf[128];
  310|       |
  311|   216k|	DPRINTF(("%s: compare %zu bytes\n", __func__, len));
  312|       |
  313|   216k|	tag = gettag(b, &offs, len);
  314|   216k|	if (tag == DER_BAD) {
  ------------------
  |  |   62|   216k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|   216k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (314:6): [True: 2.65k, False: 213k]
  ------------------
  315|  2.65k|		DPRINTF(("%s: bad tag 1\n", __func__));
  316|  2.65k|		return -1;
  317|  2.65k|	}
  318|       |
  319|   213k|	DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  320|   213k|	    offs, m->offset));
  321|       |
  322|   213k|	tlen = getlength(b, &offs, len);
  323|   213k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|   213k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|   213k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (323:6): [True: 64.4k, False: 149k]
  ------------------
  324|  64.4k|		DPRINTF(("%s: bad tag 2\n", __func__));
  325|  64.4k|		return -1;
  326|  64.4k|	}
  327|       |
  328|   149k|	der_tag(buf, sizeof(buf), tag);
  329|   149k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   149k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (329:6): [True: 0, False: 149k]
  ------------------
  330|      0|		fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
  331|      0|		    buf, s);
  332|   149k|	size_t slen = strlen(buf);
  333|       |
  334|   149k|	if (strncmp(buf, s, slen) != 0) {
  ------------------
  |  Branch (334:6): [True: 134k, False: 14.9k]
  ------------------
  335|   134k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  336|   134k|		return 0;
  337|   134k|	}
  338|       |
  339|  14.9k|	s += slen;
  340|       |
  341|  15.6k|again:
  342|  15.6k|	switch (*s) {
  343|  12.5k|	case '\0':
  ------------------
  |  Branch (343:2): [True: 12.5k, False: 3.07k]
  ------------------
  344|  12.5k|		DPRINTF(("%s: EOF match\n", __func__));
  345|  12.5k|		return 1;
  346|    766|	case '=':
  ------------------
  |  Branch (346:2): [True: 766, False: 14.8k]
  ------------------
  347|    766|		s++;
  348|    766|		goto val;
  349|  2.30k|	default:
  ------------------
  |  Branch (349:2): [True: 2.30k, False: 13.3k]
  ------------------
  350|  2.30k|		if (!isdigit(CAST(unsigned char, *s))) {
  ------------------
  |  Branch (350:7): [True: 0, False: 2.30k]
  ------------------
  351|      0|			DPRINTF(("%s: no digit %c\n", __func__, *s));
  352|      0|			return 0;
  353|      0|		}
  354|       |
  355|  2.30k|		slen = 0;
  356|  2.30k|		do
  357|  3.63k|			slen = slen * 10 + *s - '0';
  358|  2.30k|		while (isdigit(CAST(unsigned char, *++s)));
  359|  2.30k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  2.30k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (359:7): [True: 0, False: 2.30k]
  ------------------
  360|      0|			fprintf(stderr, "%s: len %" SIZE_T_FORMAT "u %u\n",
  361|      0|			    __func__, slen, tlen);
  362|  2.30k|		if (tlen != slen) {
  ------------------
  |  Branch (362:7): [True: 1.58k, False: 715]
  ------------------
  363|  1.58k|			DPRINTF(("%s: len %u != %zu\n", __func__, tlen, slen));
  364|  1.58k|			return 0;
  365|  1.58k|		}
  366|    715|		goto again;
  367|  15.6k|	}
  368|    766|val:
  369|    766|	DPRINTF(("%s: before data %" SIZE_T_FORMAT "u %u\n", __func__, offs,
  370|    766|	    tlen));
  371|    766|	der_data(buf, sizeof(buf), tag, b + offs, tlen);
  372|    766|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    766|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (372:6): [True: 0, False: 766]
  ------------------
  373|      0|		fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
  374|    766|	if (strcmp(buf, s) != 0 && strcmp("x", s) != 0) {
  ------------------
  |  Branch (374:6): [True: 511, False: 255]
  |  Branch (374:29): [True: 414, False: 97]
  ------------------
  375|    414|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  376|    414|		return 0;
  377|    414|	}
  378|    352|	strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
  379|    352|	DPRINTF(("%s: complete match\n", __func__));
  380|    352|	return 1;
  381|    766|}
der.c:gettag:
  150|   229k|{
  151|   229k|	uint32_t tag;
  152|       |
  153|   229k|	if (*p >= l)
  ------------------
  |  Branch (153:6): [True: 621, False: 228k]
  ------------------
  154|    621|		return DER_BAD;
  ------------------
  |  |   62|    621|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|    621|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  155|       |
  156|   228k|	tag = c[(*p)++] & 0x1f;
  157|       |
  158|   228k|	if (tag != 0x1f)
  ------------------
  |  Branch (158:6): [True: 168k, False: 60.6k]
  ------------------
  159|   168k|		return tag;
  160|       |
  161|  60.6k|	if (*p >= l)
  ------------------
  |  Branch (161:6): [True: 280, False: 60.3k]
  ------------------
  162|    280|		return DER_BAD;
  ------------------
  |  |   62|    280|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|    280|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  163|       |
  164|  2.48M|	while (c[*p] >= 0x80) {
  ------------------
  |  Branch (164:9): [True: 2.42M, False: 58.9k]
  ------------------
  165|  2.42M|		tag = tag * 128 + c[(*p)++] - 0x80;
  166|  2.42M|		if (*p >= l)
  ------------------
  |  Branch (166:7): [True: 1.38k, False: 2.42M]
  ------------------
  167|  1.38k|			return DER_BAD;
  ------------------
  |  |   62|  1.38k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  1.38k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  168|  2.42M|	}
  169|  58.9k|	return tag;
  170|  60.3k|}
der.c:getlength:
  183|   226k|{
  184|   226k|	uint8_t digits, i;
  185|   226k|	size_t len;
  186|   226k|	int is_onebyte_result;
  187|       |
  188|   226k|	if (*p >= l) {
  ------------------
  |  Branch (188:6): [True: 1.36k, False: 225k]
  ------------------
  189|  1.36k|		DPRINTF(("%s:[1] %zu >= %zu\n", __func__, *p, l));
  190|  1.36k|		return DER_BAD;
  ------------------
  |  |   62|  1.36k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  1.36k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  191|  1.36k|	}
  192|       |
  193|       |	/*
  194|       |	 * Digits can either be 0b0 followed by the result, or 0b1
  195|       |	 * followed by the number of digits of the result. In either case,
  196|       |	 * we verify that we can read so many bytes from the input.
  197|       |	 */
  198|   225k|	is_onebyte_result = (c[*p] & 0x80) == 0;
  199|   225k|	digits = c[(*p)++] & 0x7f;
  200|   225k|	if (*p + digits >= l) {
  ------------------
  |  Branch (200:6): [True: 55.2k, False: 170k]
  ------------------
  201|  55.2k|		DPRINTF(("%s:[2] %zu + %u >= %zu\n", __func__, *p, digits, l));
  202|  55.2k|		return DER_BAD;
  ------------------
  |  |   62|  55.2k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  55.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  203|  55.2k|	}
  204|       |
  205|   170k|	if (is_onebyte_result)
  ------------------
  |  Branch (205:6): [True: 148k, False: 21.7k]
  ------------------
  206|   148k|		return digits;
  207|       |
  208|       |	/*
  209|       |	 * Decode len. We've already verified that we're allowed to read
  210|       |	 * `digits` bytes.
  211|       |	 */
  212|  21.7k|	len = 0;
  213|  1.19M|	for (i = 0; i < digits; i++)
  ------------------
  |  Branch (213:14): [True: 1.16M, False: 21.7k]
  ------------------
  214|  1.16M|		len = (len << 8) | c[(*p)++];
  215|       |
  216|  21.7k|	if (len > UINT32_MAX - *p || *p + len > l) {
  ------------------
  |  Branch (216:6): [True: 6.10k, False: 15.6k]
  |  Branch (216:31): [True: 1.72k, False: 13.9k]
  ------------------
  217|  7.82k|		DPRINTF(("%s:[3] bad len %zu + %zu >= %zu\n",
  218|  7.82k|		    __func__, *p, len, l));
  219|  7.82k|		return DER_BAD;
  ------------------
  |  |   62|  7.82k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  7.82k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  220|  7.82k|	}
  221|  13.9k|	return CAST(uint32_t, len);
  ------------------
  |  |  426|  13.9k|#define CAST(T, b)	((T)(b))
  ------------------
  222|  21.7k|}
der.c:der_tag:
  226|   149k|{
  227|   149k|	if (tag < DER_TAG_LAST)
  ------------------
  |  |  115|   149k|#define	DER_TAG_LAST			0x25
  ------------------
  |  Branch (227:6): [True: 144k, False: 5.32k]
  ------------------
  228|   144k|		strlcpy(buf, der__tag[tag], len);
  229|  5.32k|	else
  230|  5.32k|		snprintf(buf, len, "%#x", tag);
  231|   149k|	return buf;
  232|   149k|}
der.c:der_data:
  237|    766|{
  238|    766|	uint32_t i;
  239|    766|	const uint8_t *d = CAST(const uint8_t *, q);
  ------------------
  |  |  426|    766|#define CAST(T, b)	((T)(b))
  ------------------
  240|    766|	switch (tag) {
  241|     20|	case DER_TAG_PRINTABLE_STRING:
  ------------------
  |  |   97|     20|#define	DER_TAG_PRINTABLE_STRING	0x13
  ------------------
  |  Branch (241:2): [True: 20, False: 746]
  ------------------
  242|     48|	case DER_TAG_UTF8_STRING:
  ------------------
  |  |   90|     48|#define	DER_TAG_UTF8_STRING		0x0c
  ------------------
  |  Branch (242:2): [True: 28, False: 738]
  ------------------
  243|     51|	case DER_TAG_IA5_STRING:
  ------------------
  |  |  100|     51|#define	DER_TAG_IA5_STRING		0x16
  ------------------
  |  Branch (243:2): [True: 3, False: 763]
  ------------------
  244|     51|		return snprintf(buf, blen, "%.*s", len, RCAST(const char *, q));
  ------------------
  |  |  427|     51|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  245|      0|	case DER_TAG_UTCTIME:
  ------------------
  |  |  101|      0|#define	DER_TAG_UTCTIME			0x17
  ------------------
  |  Branch (245:2): [True: 0, False: 766]
  ------------------
  246|      0|		if (len < 12)
  ------------------
  |  Branch (246:7): [True: 0, False: 0]
  ------------------
  247|      0|			break;
  248|      0|		return snprintf(buf, blen,
  249|      0|		    "20%c%c-%c%c-%c%c %c%c:%c%c:%c%c GMT", d[0], d[1], d[2],
  250|      0|		    d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11]);
  251|    715|	default:
  ------------------
  |  Branch (251:2): [True: 715, False: 51]
  ------------------
  252|    715|		break;
  253|    766|	}
  254|       |
  255|  3.72k|	for (i = 0; i < len; i++) {
  ------------------
  |  Branch (255:14): [True: 3.00k, False: 715]
  ------------------
  256|  3.00k|		uint32_t z = i << 1;
  257|  3.00k|		if (z < blen - 2)
  ------------------
  |  Branch (257:7): [True: 2.77k, False: 234]
  ------------------
  258|  2.77k|			snprintf(buf + z, blen - z, "%.2x", d[i]);
  259|  3.00k|	}
  260|    715|	return len * 2;
  261|    766|}

file_encoding:
   78|  23.8k|{
   79|  23.8k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  23.8k|#define CAST(T, b)	((T)(b))
  ------------------
   80|  23.8k|	size_t nbytes = b->flen;
   81|  23.8k|	size_t mlen;
   82|  23.8k|	int rv = 1, ucs_type;
   83|  23.8k|	file_unichar_t *udefbuf;
   84|  23.8k|	size_t udeflen;
   85|       |
   86|  23.8k|	if (ubuf == NULL)
  ------------------
  |  Branch (86:6): [True: 12.5k, False: 11.3k]
  ------------------
   87|  12.5k|		ubuf = &udefbuf;
   88|  23.8k|	if (ulen == NULL)
  ------------------
  |  Branch (88:6): [True: 12.5k, False: 11.3k]
  ------------------
   89|  12.5k|		ulen = &udeflen;
   90|       |
   91|  23.8k|	*type = "text";
   92|  23.8k|	*ulen = 0;
   93|  23.8k|	*code = "unknown";
   94|  23.8k|	*code_mime = "binary";
   95|       |
   96|  23.8k|	if (nbytes > ms->encoding_max)
  ------------------
  |  Branch (96:6): [True: 503, False: 23.3k]
  ------------------
   97|    503|		nbytes = ms->encoding_max;
   98|       |
   99|  23.8k|	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
  100|  23.8k|	*ubuf = CAST(file_unichar_t *, calloc(CAST(size_t, 1), mlen));
  ------------------
  |  |  426|  23.8k|#define CAST(T, b)	((T)(b))
  ------------------
  101|  23.8k|	if (*ubuf == NULL) {
  ------------------
  |  Branch (101:6): [True: 0, False: 23.8k]
  ------------------
  102|      0|		file_oomem(ms, mlen);
  103|      0|		goto done;
  104|      0|	}
  105|  23.8k|	if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (105:6): [True: 1.63k, False: 22.2k]
  ------------------
  106|  1.63k|		if (looks_utf7(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (106:7): [True: 12, False: 1.62k]
  ------------------
  107|     12|			DPRINTF(("utf-7 %" SIZE_T_FORMAT "u\n", *ulen));
  108|     12|			*code = "Unicode text, UTF-7";
  109|     12|			*code_mime = "utf-7";
  110|  1.62k|		} else {
  111|  1.62k|			DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
  112|  1.62k|			*code = "ASCII";
  113|  1.62k|			*code_mime = "us-ascii";
  114|  1.62k|		}
  115|  22.2k|	} else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (115:13): [True: 7, False: 22.2k]
  ------------------
  116|      7|		DPRINTF(("utf8/bom %" SIZE_T_FORMAT "u\n", *ulen));
  117|      7|		*code = "Unicode text, UTF-8 (with BOM)";
  118|      7|		*code_mime = "utf-8";
  119|  22.2k|	} else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) {
  ------------------
  |  Branch (119:13): [True: 240, False: 21.9k]
  ------------------
  120|    240|		DPRINTF(("utf8 %" SIZE_T_FORMAT "u\n", *ulen));
  121|    240|		*code = "Unicode text, UTF-8";
  122|    240|		*code_mime = "utf-8";
  123|  21.9k|	} else if ((ucs_type = looks_ucs32(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (123:13): [True: 459, False: 21.5k]
  ------------------
  124|    459|		if (ucs_type == 1) {
  ------------------
  |  Branch (124:7): [True: 180, False: 279]
  ------------------
  125|    180|			*code = "Unicode text, UTF-32, little-endian";
  126|    180|			*code_mime = "utf-32le";
  127|    279|		} else {
  128|    279|			*code = "Unicode text, UTF-32, big-endian";
  129|    279|			*code_mime = "utf-32be";
  130|    279|		}
  131|    459|		DPRINTF(("ucs32 %" SIZE_T_FORMAT "u\n", *ulen));
  132|  21.5k|	} else if ((ucs_type = looks_ucs16(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (132:13): [True: 335, False: 21.1k]
  ------------------
  133|    335|		if (ucs_type == 1) {
  ------------------
  |  Branch (133:7): [True: 202, False: 133]
  ------------------
  134|    202|			*code = "Unicode text, UTF-16, little-endian";
  135|    202|			*code_mime = "utf-16le";
  136|    202|		} else {
  137|    133|			*code = "Unicode text, UTF-16, big-endian";
  138|    133|			*code_mime = "utf-16be";
  139|    133|		}
  140|    335|		DPRINTF(("ucs16 %" SIZE_T_FORMAT "u\n", *ulen));
  141|  21.1k|	} else if (looks_latin1(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (141:13): [True: 1.17k, False: 20.0k]
  ------------------
  142|  1.17k|		DPRINTF(("latin1 %" SIZE_T_FORMAT "u\n", *ulen));
  143|  1.17k|		*code = "ISO-8859";
  144|  1.17k|		*code_mime = "iso-8859-1";
  145|  20.0k|	} else if (looks_extended(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (145:13): [True: 845, False: 19.1k]
  ------------------
  146|    845|		DPRINTF(("extended %" SIZE_T_FORMAT "u\n", *ulen));
  147|    845|		*code = "Non-ISO extended-ASCII";
  148|    845|		*code_mime = "unknown-8bit";
  149|  19.1k|	} else {
  150|  19.1k|		unsigned char *nbuf;
  151|       |
  152|  19.1k|		mlen = (nbytes + 1) * sizeof(nbuf[0]);
  153|  19.1k|		if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  426|  19.1k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (153:7): [True: 0, False: 19.1k]
  ------------------
  154|      0|			file_oomem(ms, mlen);
  155|      0|			goto done;
  156|      0|		}
  157|  19.1k|		from_ebcdic(buf, nbytes, nbuf);
  158|       |
  159|  19.1k|		if (looks_ascii(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (159:7): [True: 98, False: 19.0k]
  ------------------
  160|     98|			DPRINTF(("ebcdic %" SIZE_T_FORMAT "u\n", *ulen));
  161|     98|			*code = "EBCDIC";
  162|     98|			*code_mime = "ebcdic";
  163|  19.0k|		} else if (looks_latin1(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (163:14): [True: 150, False: 18.9k]
  ------------------
  164|    150|			DPRINTF(("ebcdic/international %" SIZE_T_FORMAT "u\n",
  165|    150|			    *ulen));
  166|    150|			*code = "International EBCDIC";
  167|    150|			*code_mime = "ebcdic";
  168|  18.9k|		} else { /* Doesn't look like text at all */
  169|  18.9k|			DPRINTF(("binary\n"));
  170|  18.9k|			rv = 0;
  171|  18.9k|			*type = "binary";
  172|  18.9k|		}
  173|  19.1k|		free(nbuf);
  174|  19.1k|	}
  175|       |
  176|  23.8k| done:
  177|  23.8k|	if (ubuf == &udefbuf)
  ------------------
  |  Branch (177:6): [True: 12.5k, False: 11.3k]
  ------------------
  178|  12.5k|		free(udefbuf);
  179|       |
  180|  23.8k|	return rv;
  181|  23.8k|}
file_looks_utf8:
  352|  22.2k|{
  353|  22.2k|	size_t i;
  354|  22.2k|	int n;
  355|  22.2k|	file_unichar_t c;
  356|  22.2k|	int gotone = 0, ctrl = 0;
  357|       |
  358|  22.2k|	if (ubuf)
  ------------------
  |  Branch (358:6): [True: 22.2k, False: 0]
  ------------------
  359|  22.2k|		*ulen = 0;
  360|       |
  361|  6.02M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (361:14): [True: 6.02M, False: 1.30k]
  ------------------
  362|  6.02M|		if ((buf[i] & 0x80) == 0) {	   /* 0xxxxxxx is plain ASCII */
  ------------------
  |  Branch (362:7): [True: 5.98M, False: 39.1k]
  ------------------
  363|       |			/*
  364|       |			 * Even if the whole file is valid UTF-8 sequences,
  365|       |			 * still reject it if it uses weird control characters.
  366|       |			 */
  367|       |
  368|  5.98M|			if (text_chars[buf[i]] != T)
  ------------------
  |  |  236|  5.98M|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (368:8): [True: 5.00M, False: 979k]
  ------------------
  369|  5.00M|				ctrl = 1;
  370|       |
  371|  5.98M|			if (ubuf)
  ------------------
  |  Branch (371:8): [True: 5.98M, False: 0]
  ------------------
  372|  5.98M|				ubuf[(*ulen)++] = buf[i];
  373|  5.98M|		} else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */
  ------------------
  |  Branch (373:14): [True: 6.31k, False: 32.8k]
  ------------------
  374|  6.31k|			return -1;
  375|  32.8k|		} else {			   /* 11xxxxxx begins UTF-8 */
  376|  32.8k|			int following;
  377|  32.8k|			uint8_t x = first[buf[i]];
  378|  32.8k|			const struct accept_range *ar =
  379|  32.8k|			    &accept_ranges[(unsigned int)x >> 4];
  380|  32.8k|			if (x == XX)
  ------------------
  |  |  300|  32.8k|#define	XX 0xF1 // invalid: size 1
  ------------------
  |  Branch (380:8): [True: 7.05k, False: 25.7k]
  ------------------
  381|  7.05k|				return -1;
  382|       |
  383|  25.7k|			if ((buf[i] & 0x20) == 0) {		/* 110xxxxx */
  ------------------
  |  Branch (383:8): [True: 3.94k, False: 21.8k]
  ------------------
  384|  3.94k|				c = buf[i] & 0x1f;
  385|  3.94k|				following = 1;
  386|  21.8k|			} else if ((buf[i] & 0x10) == 0) {	/* 1110xxxx */
  ------------------
  |  Branch (386:15): [True: 4.19k, False: 17.6k]
  ------------------
  387|  4.19k|				c = buf[i] & 0x0f;
  388|  4.19k|				following = 2;
  389|  17.6k|			} else if ((buf[i] & 0x08) == 0) {	/* 11110xxx */
  ------------------
  |  Branch (389:15): [True: 17.6k, False: 0]
  ------------------
  390|  17.6k|				c = buf[i] & 0x07;
  391|  17.6k|				following = 3;
  392|  17.6k|			} else if ((buf[i] & 0x04) == 0) {	/* 111110xx */
  ------------------
  |  Branch (392:15): [True: 0, False: 0]
  ------------------
  393|      0|				c = buf[i] & 0x03;
  394|      0|				following = 4;
  395|      0|			} else if ((buf[i] & 0x02) == 0) {	/* 1111110x */
  ------------------
  |  Branch (395:15): [True: 0, False: 0]
  ------------------
  396|      0|				c = buf[i] & 0x01;
  397|      0|				following = 5;
  398|      0|			} else
  399|      0|				return -1;
  400|       |
  401|  78.4k|			for (n = 0; n < following; n++) {
  ------------------
  |  Branch (401:16): [True: 60.1k, False: 18.2k]
  ------------------
  402|  60.1k|				i++;
  403|  60.1k|				if (i >= nbytes)
  ------------------
  |  Branch (403:9): [True: 215, False: 59.9k]
  ------------------
  404|    215|					goto done;
  405|       |
  406|  59.9k|				if (n == 0 &&
  ------------------
  |  Branch (406:9): [True: 25.6k, False: 34.3k]
  ------------------
  407|  59.9k|				     (buf[i] < ar->lo || buf[i] > ar->hi))
  ------------------
  |  Branch (407:11): [True: 4.42k, False: 21.1k]
  |  Branch (407:30): [True: 2.72k, False: 18.4k]
  ------------------
  408|  7.14k|					return -1;
  409|       |
  410|  52.8k|				if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40))
  ------------------
  |  Branch (410:9): [True: 189, False: 52.6k]
  |  Branch (410:33): [True: 28, False: 52.6k]
  ------------------
  411|    217|					return -1;
  412|       |
  413|  52.6k|				c = (c << 6) + (buf[i] & 0x3f);
  414|  52.6k|			}
  415|       |
  416|  18.2k|			if (ubuf)
  ------------------
  |  Branch (416:8): [True: 18.2k, False: 0]
  ------------------
  417|  18.2k|				ubuf[(*ulen)++] = c;
  418|  18.2k|			gotone = 1;
  419|  18.2k|		}
  420|  6.02M|	}
  421|  1.52k|done:
  422|  1.52k|	return ctrl ? 0 : (gotone ? 2 : 1);
  ------------------
  |  Branch (422:9): [True: 1.17k, False: 349]
  |  Branch (422:21): [True: 242, False: 107]
  ------------------
  423|  22.2k|}
encoding.c:looks_ascii:
  265|  43.0k|    size_t *ulen) \
  266|  43.0k|{ \
  267|  43.0k|	size_t i; \
  268|  43.0k|\
  269|  43.0k|	*ulen = 0; \
  270|  43.0k|\
  271|  8.60M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 8.60M, False: 1.73k]
  ------------------
  272|  8.60M|		int t = text_chars[buf[i]]; \
  273|  8.60M|\
  274|  8.60M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 41.3k, False: 8.55M]
  ------------------
  275|  8.60M|			return 0; \
  276|  8.60M|\
  277|  8.60M|		ubuf[(*ulen)++] = buf[i]; \
  278|  8.55M|	} \
  279|  43.0k|	return 1; \
  280|  43.0k|}
encoding.c:looks_latin1:
  265|  40.2k|    size_t *ulen) \
  266|  40.2k|{ \
  267|  40.2k|	size_t i; \
  268|  40.2k|\
  269|  40.2k|	*ulen = 0; \
  270|  40.2k|\
  271|  4.23M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 4.22M, False: 1.32k]
  ------------------
  272|  4.22M|		int t = text_chars[buf[i]]; \
  273|  4.22M|\
  274|  11.5M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 3.09M, False: 1.13M]
  |  Branch (274:7): [True: 38.9k, False: 3.05M]
  ------------------
  275|  4.22M|			return 0; \
  276|  4.22M|\
  277|  4.22M|		ubuf[(*ulen)++] = buf[i]; \
  278|  4.19M|	} \
  279|  40.2k|	return 1; \
  280|  40.2k|}
encoding.c:looks_extended:
  265|  20.0k|    size_t *ulen) \
  266|  20.0k|{ \
  267|  20.0k|	size_t i; \
  268|  20.0k|\
  269|  20.0k|	*ulen = 0; \
  270|  20.0k|\
  271|  2.77M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 2.77M, False: 845]
  ------------------
  272|  2.77M|		int t = text_chars[buf[i]]; \
  273|  2.77M|\
  274|  8.79M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 414k, False: 2.35M]
  |  Branch (274:7): [True: 66.5k, False: 347k]
  |  Branch (274:7): [True: 19.1k, False: 47.4k]
  ------------------
  275|  2.77M|			return 0; \
  276|  2.77M|\
  277|  2.77M|		ubuf[(*ulen)++] = buf[i]; \
  278|  2.75M|	} \
  279|  20.0k|	return 1; \
  280|  20.0k|}
encoding.c:looks_utf8_with_BOM:
  433|  22.2k|{
  434|  22.2k|	if (nbytes > 3 && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
  ------------------
  |  Branch (434:6): [True: 21.0k, False: 1.15k]
  |  Branch (434:20): [True: 76, False: 21.0k]
  |  Branch (434:38): [True: 46, False: 30]
  |  Branch (434:56): [True: 25, False: 21]
  ------------------
  435|     25|		return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen);
  436|  22.2k|	else
  437|  22.2k|		return -1;
  438|  22.2k|}
encoding.c:looks_utf7:
  443|  1.63k|{
  444|  1.63k|	if (nbytes > 4 && buf[0] == '+' && buf[1] == '/' && buf[2] == 'v')
  ------------------
  |  Branch (444:6): [True: 1.08k, False: 545]
  |  Branch (444:20): [True: 41, False: 1.04k]
  |  Branch (444:37): [True: 18, False: 23]
  |  Branch (444:54): [True: 15, False: 3]
  ------------------
  445|     15|		switch (buf[3]) {
  446|      3|		case '8':
  ------------------
  |  Branch (446:3): [True: 3, False: 12]
  ------------------
  447|      6|		case '9':
  ------------------
  |  Branch (447:3): [True: 3, False: 12]
  ------------------
  448|      9|		case '+':
  ------------------
  |  Branch (448:3): [True: 3, False: 12]
  ------------------
  449|     12|		case '/':
  ------------------
  |  Branch (449:3): [True: 3, False: 12]
  ------------------
  450|     12|			if (ubuf)
  ------------------
  |  Branch (450:8): [True: 12, False: 0]
  ------------------
  451|     12|				*ulen = 0;
  452|     12|			return 1;
  453|      3|		default:
  ------------------
  |  Branch (453:3): [True: 3, False: 12]
  ------------------
  454|      3|			return -1;
  455|     15|		}
  456|  1.61k|	else
  457|  1.61k|		return -1;
  458|  1.63k|}
encoding.c:looks_ucs16:
  467|  21.5k|{
  468|  21.5k|	int bigend;
  469|  21.5k|	uint32_t hi;
  470|  21.5k|	size_t i;
  471|       |
  472|  21.5k|	if (nbytes < 2)
  ------------------
  |  Branch (472:6): [True: 14, False: 21.5k]
  ------------------
  473|     14|		return 0;
  474|       |
  475|  21.5k|	if (bf[0] == 0xff && bf[1] == 0xfe)
  ------------------
  |  Branch (475:6): [True: 573, False: 20.9k]
  |  Branch (475:23): [True: 306, False: 267]
  ------------------
  476|    306|		bigend = 0;
  477|  21.2k|	else if (bf[0] == 0xfe && bf[1] == 0xff)
  ------------------
  |  Branch (477:11): [True: 241, False: 20.9k]
  |  Branch (477:28): [True: 202, False: 39]
  ------------------
  478|    202|		bigend = 1;
  479|  21.0k|	else
  480|  21.0k|		return 0;
  481|       |
  482|    508|	*ulen = 0;
  483|    508|	hi = 0;
  484|       |
  485|  4.18k|	for (i = 2; i + 1 < nbytes; i += 2) {
  ------------------
  |  Branch (485:14): [True: 3.85k, False: 335]
  ------------------
  486|  3.85k|		uint32_t uc;
  487|       |
  488|  3.85k|		if (bigend)
  ------------------
  |  Branch (488:7): [True: 1.00k, False: 2.84k]
  ------------------
  489|  1.00k|			uc = CAST(uint32_t,
  ------------------
  |  |  426|  1.00k|#define CAST(T, b)	((T)(b))
  ------------------
  490|  3.85k|			    bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8));
  491|  2.84k|		else
  492|  2.84k|			uc = CAST(uint32_t,
  ------------------
  |  |  426|  2.84k|#define CAST(T, b)	((T)(b))
  ------------------
  493|  3.85k|			    bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8));
  494|       |
  495|  3.85k|		uc &= 0xffff;
  496|       |
  497|  3.85k|		switch (uc) {
  498|      0|		case 0xfffe:
  ------------------
  |  Branch (498:3): [True: 0, False: 3.85k]
  ------------------
  499|     16|		case 0xffff:
  ------------------
  |  Branch (499:3): [True: 16, False: 3.83k]
  ------------------
  500|     16|			return 0;
  501|  3.83k|		default:
  ------------------
  |  Branch (501:3): [True: 3.83k, False: 16]
  ------------------
  502|  3.83k|			if (UCS16_NOCHAR(uc))
  ------------------
  |  |  460|  3.83k|#define UCS16_NOCHAR(c) ((c) >= 0xfdd0 && (c) <= 0xfdef)
  |  |  ------------------
  |  |  |  Branch (460:26): [True: 981, False: 2.85k]
  |  |  |  Branch (460:43): [True: 12, False: 969]
  |  |  ------------------
  ------------------
  503|     12|				return 0;
  504|  3.82k|			break;
  505|  3.85k|		}
  506|  3.82k|		if (hi) {
  ------------------
  |  Branch (506:7): [True: 310, False: 3.51k]
  ------------------
  507|    310|			if (!UCS16_LOSURR(uc))
  ------------------
  |  |  462|    310|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (462:26): [True: 259, False: 51]
  |  |  |  Branch (462:43): [True: 254, False: 5]
  |  |  ------------------
  ------------------
  508|     56|				return 0;
  509|    254|			uc = 0x10000 + 0x400 * (hi - 1) + (uc - 0xdc00);
  510|    254|			hi = 0;
  511|    254|		}
  512|  3.76k|		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  426|    318|#define CAST(T, b)	((T)(b))
  ------------------
              		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  236|    318|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (512:7): [True: 318, False: 3.45k]
  |  Branch (512:19): [True: 58, False: 260]
  ------------------
  513|     58|			return 0;
  514|  3.71k|		ubf[(*ulen)++] = uc;
  515|  3.71k|		if (UCS16_HISURR(uc))
  ------------------
  |  |  461|  3.71k|#define UCS16_HISURR(c) ((c) >= 0xd800 && (c) <= 0xdbff)
  |  |  ------------------
  |  |  |  Branch (461:26): [True: 1.74k, False: 1.96k]
  |  |  |  Branch (461:43): [True: 350, False: 1.39k]
  |  |  ------------------
  ------------------
  516|    350|			hi = uc - 0xd800 + 1;
  517|  3.71k|		if (UCS16_LOSURR(uc))
  ------------------
  |  |  462|  3.71k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (462:26): [True: 1.39k, False: 2.31k]
  |  |  |  Branch (462:43): [True: 31, False: 1.36k]
  |  |  ------------------
  ------------------
  518|     31|			return 0;
  519|  3.71k|	}
  520|       |
  521|    335|	return 1 + bigend;
  522|    508|}
encoding.c:looks_ucs32:
  527|  21.9k|{
  528|  21.9k|	int bigend;
  529|  21.9k|	size_t i;
  530|       |
  531|  21.9k|	if (nbytes < 4)
  ------------------
  |  Branch (531:6): [True: 1.05k, False: 20.9k]
  ------------------
  532|  1.05k|		return 0;
  533|       |
  534|  20.9k|	if (bf[0] == 0xff && bf[1] == 0xfe && bf[2] == 0 && bf[3] == 0)
  ------------------
  |  Branch (534:6): [True: 687, False: 20.2k]
  |  Branch (534:23): [True: 473, False: 214]
  |  Branch (534:40): [True: 250, False: 223]
  |  Branch (534:54): [True: 206, False: 44]
  ------------------
  535|    206|		bigend = 0;
  536|  20.7k|	else if (bf[0] == 0 && bf[1] == 0 && bf[2] == 0xfe && bf[3] == 0xff)
  ------------------
  |  Branch (536:11): [True: 2.28k, False: 18.4k]
  |  Branch (536:25): [True: 703, False: 1.58k]
  |  Branch (536:39): [True: 349, False: 354]
  |  Branch (536:56): [True: 288, False: 61]
  ------------------
  537|    288|		bigend = 1;
  538|  20.4k|	else
  539|  20.4k|		return 0;
  540|       |
  541|    494|	*ulen = 0;
  542|       |
  543|  93.5k|	for (i = 4; i + 3 < nbytes; i += 4) {
  ------------------
  |  Branch (543:14): [True: 93.0k, False: 459]
  ------------------
  544|       |		/* XXX fix to properly handle chars > 65536 */
  545|       |
  546|  93.0k|		if (bigend)
  ------------------
  |  Branch (546:7): [True: 49.5k, False: 43.4k]
  ------------------
  547|  49.5k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 3])
  ------------------
  |  |  426|  49.5k|#define CAST(T, b)	((T)(b))
  ------------------
  548|  49.5k|			    | (CAST(file_unichar_t, bf[i + 2]) << 8)
  ------------------
  |  |  426|  49.5k|#define CAST(T, b)	((T)(b))
  ------------------
  549|  49.5k|			    | (CAST(file_unichar_t, bf[i + 1]) << 16)
  ------------------
  |  |  426|  49.5k|#define CAST(T, b)	((T)(b))
  ------------------
  550|  49.5k|			    | (CAST(file_unichar_t, bf[i]) << 24);
  ------------------
  |  |  426|  49.5k|#define CAST(T, b)	((T)(b))
  ------------------
  551|  43.4k|		else
  552|  43.4k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 0])
  ------------------
  |  |  426|  43.4k|#define CAST(T, b)	((T)(b))
  ------------------
  553|  43.4k|			    | (CAST(file_unichar_t, bf[i + 1]) << 8) 
  ------------------
  |  |  426|  43.4k|#define CAST(T, b)	((T)(b))
  ------------------
  554|  43.4k|			    | (CAST(file_unichar_t, bf[i + 2]) << 16)
  ------------------
  |  |  426|  43.4k|#define CAST(T, b)	((T)(b))
  ------------------
  555|  43.4k|			    | (CAST(file_unichar_t, bf[i + 3]) << 24);
  ------------------
  |  |  426|  43.4k|#define CAST(T, b)	((T)(b))
  ------------------
  556|       |
  557|  93.0k|		if (ubf[*ulen - 1] == 0xfffe)
  ------------------
  |  Branch (557:7): [True: 3, False: 93.0k]
  ------------------
  558|      3|			return 0;
  559|  93.0k|		if (ubf[*ulen - 1] < 128 &&
  ------------------
  |  Branch (559:7): [True: 243, False: 92.8k]
  ------------------
  560|  93.0k|		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  426|    243|#define CAST(T, b)	((T)(b))
  ------------------
              		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  236|    243|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (560:7): [True: 32, False: 211]
  ------------------
  561|     32|			return 0;
  562|  93.0k|	}
  563|       |
  564|    459|	return 1 + bigend;
  565|    494|}
encoding.c:from_ebcdic:
  652|  19.1k|{
  653|  19.1k|	size_t i;
  654|       |
  655|  41.5M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (655:14): [True: 41.5M, False: 19.1k]
  ------------------
  656|  41.5M|		out[i] = ebcdic_to_ascii[buf[i]];
  657|  41.5M|	}
  658|  19.1k|}

fmtcheck:
  236|  46.2k|{
  237|  46.2k|	const char	*f1p, *f2p;
  238|  46.2k|	EFT		f1t, f2t;
  239|       |
  240|  46.2k|	if (!f1) return f2;
  ------------------
  |  Branch (240:6): [True: 0, False: 46.2k]
  ------------------
  241|       |
  242|  46.2k|	f1p = f1;
  243|  46.2k|	f1t = FMTCHECK_START;
  244|  46.2k|	f2p = f2;
  245|  46.2k|	f2t = FMTCHECK_START;
  246|  92.5k|	while ((f1t = get_next_format(&f1p, f1t)) != FMTCHECK_DONE) {
  ------------------
  |  Branch (246:9): [True: 46.2k, False: 46.2k]
  ------------------
  247|  46.2k|		if (f1t == FMTCHECK_UNKNOWN)
  ------------------
  |  Branch (247:7): [True: 0, False: 46.2k]
  ------------------
  248|      0|			return f2;
  249|  46.2k|		f2t = get_next_format(&f2p, f2t);
  250|  46.2k|		if (f1t != f2t)
  ------------------
  |  Branch (250:7): [True: 0, False: 46.2k]
  ------------------
  251|      0|			return f2;
  252|  46.2k|	}
  253|  46.2k|	return f1;
  254|  46.2k|}
fmtcheck.c:get_next_format:
  190|   138k|{
  191|   138k|	int		infmt;
  192|   138k|	const char	*f;
  193|       |
  194|   138k|	if (eft == FMTCHECK_WIDTH) {
  ------------------
  |  Branch (194:6): [True: 0, False: 138k]
  ------------------
  195|      0|		(*pf)++;
  196|      0|		return get_next_format_from_width(pf);
  197|   138k|	} else if (eft == FMTCHECK_PRECISION) {
  ------------------
  |  Branch (197:13): [True: 0, False: 138k]
  ------------------
  198|      0|		(*pf)++;
  199|      0|		return get_next_format_from_precision(pf);
  200|      0|	}
  201|       |
  202|   138k|	f = *pf;
  203|   138k|	infmt = 0;
  204|   231k|	while (!infmt) {
  ------------------
  |  Branch (204:9): [True: 138k, False: 92.5k]
  ------------------
  205|   138k|		f = strchr(f, '%');
  206|   138k|		if (f == NULL)
  ------------------
  |  Branch (206:7): [True: 46.2k, False: 92.5k]
  ------------------
  207|  46.2k|			RETURN(pf,f,FMTCHECK_DONE);
  ------------------
  |  |   60|  46.2k|#define RETURN(pf,f,r) do { \
  |  |   61|  46.2k|			*(pf) = (f); \
  |  |   62|  46.2k|			return r; \
  |  |   63|  46.2k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  208|  92.5k|		f++;
  209|  92.5k|		if (!*f)
  ------------------
  |  Branch (209:7): [True: 0, False: 92.5k]
  ------------------
  210|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  211|  92.5k|		if (*f != '%')
  ------------------
  |  Branch (211:7): [True: 92.5k, False: 0]
  ------------------
  212|  92.5k|			infmt = 1;
  213|      0|		else
  214|      0|			f++;
  215|  92.5k|	}
  216|       |
  217|       |	/* Eat any of the flags */
  218|  99.8k|	while (*f && (strchr("#0- +", *f)))
  ------------------
  |  Branch (218:9): [True: 99.8k, False: 0]
  |  Branch (218:15): [True: 7.33k, False: 92.5k]
  ------------------
  219|  7.33k|		f++;
  220|       |
  221|  92.5k|	if (*f == '*') {
  ------------------
  |  Branch (221:6): [True: 0, False: 92.5k]
  ------------------
  222|      0|		RETURN(pf,f,FMTCHECK_WIDTH);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  223|      0|	}
  224|       |	/* eat any width */
  225|  92.5k|	while (isdigit((unsigned char)*f)) f++;
  226|  92.5k|	if (!*f) {
  ------------------
  |  Branch (226:6): [True: 0, False: 92.5k]
  ------------------
  227|      0|		RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  228|      0|	}
  229|       |
  230|  92.5k|	RETURN(pf,f,get_next_format_from_width(pf));
  ------------------
  |  |   60|  92.5k|#define RETURN(pf,f,r) do { \
  |  |   61|  92.5k|			*(pf) = (f); \
  |  |   62|  92.5k|			return r; \
  |  |   63|  92.5k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  231|       |	/*NOTREACHED*/
  232|  92.5k|}
fmtcheck.c:get_next_format_from_width:
  171|  92.5k|{
  172|  92.5k|	const char	*f;
  173|       |
  174|  92.5k|	f = *pf;
  175|  92.5k|	if (*f == '.') {
  ------------------
  |  Branch (175:6): [True: 4.25k, False: 88.2k]
  ------------------
  176|  4.25k|		f++;
  177|  4.25k|		if (*f == '*') {
  ------------------
  |  Branch (177:7): [True: 0, False: 4.25k]
  ------------------
  178|      0|			RETURN(pf,f,FMTCHECK_PRECISION);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  179|      0|		}
  180|       |		/* eat any precision (empty is allowed) */
  181|  4.53k|		while (isdigit((unsigned char)*f)) f++;
  182|  4.25k|		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (182:7): [True: 0, False: 4.25k]
  ------------------
  183|  4.25k|	}
  184|  92.5k|	RETURN(pf,f,get_next_format_from_precision(pf));
  ------------------
  |  |   60|  92.5k|#define RETURN(pf,f,r) do { \
  |  |   61|  92.5k|			*(pf) = (f); \
  |  |   62|  92.5k|			return r; \
  |  |   63|  92.5k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  185|       |	/*NOTREACHED*/
  186|  92.5k|}
fmtcheck.c:get_next_format_from_precision:
   67|  92.5k|{
   68|  92.5k|	int		sh, lg, quad, longdouble;
   69|  92.5k|	const char	*f;
   70|       |
   71|  92.5k|	sh = lg = quad = longdouble = 0;
   72|       |
   73|  92.5k|	f = *pf;
   74|  92.5k|	switch (*f) {
   75|      0|	case 'h':
  ------------------
  |  Branch (75:2): [True: 0, False: 92.5k]
  ------------------
   76|      0|		f++;
   77|      0|		sh = 1;
   78|      0|		break;
   79|    630|	case 'l':
  ------------------
  |  Branch (79:2): [True: 630, False: 91.8k]
  ------------------
   80|    630|		f++;
   81|    630|		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (81:7): [True: 0, False: 630]
  ------------------
   82|    630|		if (*f == 'l') {
  ------------------
  |  Branch (82:7): [True: 630, False: 0]
  ------------------
   83|    630|			f++;
   84|    630|			quad = 1;
   85|    630|		} else {
   86|      0|			lg = 1;
   87|      0|		}
   88|    630|		break;
   89|      0|	case 'q':
  ------------------
  |  Branch (89:2): [True: 0, False: 92.5k]
  ------------------
   90|      0|		f++;
   91|      0|		quad = 1;
   92|      0|		break;
   93|      0|	case 'L':
  ------------------
  |  Branch (93:2): [True: 0, False: 92.5k]
  ------------------
   94|      0|		f++;
   95|      0|		longdouble = 1;
   96|      0|		break;
   97|       |#ifdef WIN32
   98|       |	case 'I':
   99|       |		f++;
  100|       |		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  101|       |		if (*f == '3' && f[1] == '2') {
  102|       |			f += 2;
  103|       |		} else if (*f == '6' && f[1] == '4') {
  104|       |			f += 2;
  105|       |			quad = 1;
  106|       |		}
  107|       |#ifdef _WIN64
  108|       |		else {
  109|       |			quad = 1;
  110|       |		}
  111|       |#endif
  112|       |		break;
  113|       |#endif
  114|  91.8k|	default:
  ------------------
  |  Branch (114:2): [True: 91.8k, False: 630]
  ------------------
  115|  91.8k|		break;
  116|  92.5k|	}
  117|  92.5k|	if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (117:6): [True: 0, False: 92.5k]
  ------------------
  118|  92.5k|	if (strchr("diouxX", *f)) {
  ------------------
  |  Branch (118:6): [True: 62.8k, False: 29.6k]
  ------------------
  119|  62.8k|		if (longdouble)
  ------------------
  |  Branch (119:7): [True: 0, False: 62.8k]
  ------------------
  120|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  121|  62.8k|		if (lg)
  ------------------
  |  Branch (121:7): [True: 0, False: 62.8k]
  ------------------
  122|      0|			RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  123|  62.8k|		if (quad)
  ------------------
  |  Branch (123:7): [True: 630, False: 62.2k]
  ------------------
  124|    630|			RETURN(pf,f,FMTCHECK_QUAD);
  ------------------
  |  |   60|    630|#define RETURN(pf,f,r) do { \
  |  |   61|    630|			*(pf) = (f); \
  |  |   62|    630|			return r; \
  |  |   63|    630|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  125|  62.2k|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|  62.2k|#define RETURN(pf,f,r) do { \
  |  |   61|  62.2k|			*(pf) = (f); \
  |  |   62|  62.2k|			return r; \
  |  |   63|  62.2k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  126|  62.2k|	}
  127|  29.6k|	if (*f == 'n') {
  ------------------
  |  Branch (127:6): [True: 0, False: 29.6k]
  ------------------
  128|      0|		if (longdouble)
  ------------------
  |  Branch (128:7): [True: 0, False: 0]
  ------------------
  129|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  130|      0|		if (sh)
  ------------------
  |  Branch (130:7): [True: 0, False: 0]
  ------------------
  131|      0|			RETURN(pf,f,FMTCHECK_SHORTPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  132|      0|		if (lg)
  ------------------
  |  Branch (132:7): [True: 0, False: 0]
  ------------------
  133|      0|			RETURN(pf,f,FMTCHECK_LONGPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|      0|		if (quad)
  ------------------
  |  Branch (134:7): [True: 0, False: 0]
  ------------------
  135|      0|			RETURN(pf,f,FMTCHECK_QUADPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  136|      0|		RETURN(pf,f,FMTCHECK_INTPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  137|      0|	}
  138|  29.6k|	if (strchr("DOU", *f)) {
  ------------------
  |  Branch (138:6): [True: 0, False: 29.6k]
  ------------------
  139|      0|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (139:7): [True: 0, False: 0]
  ------------------
  140|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  141|      0|		RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  142|      0|	}
  143|  29.6k|	if (strchr("eEfg", *f)) {
  ------------------
  |  Branch (143:6): [True: 596, False: 29.0k]
  ------------------
  144|    596|		if (longdouble)
  ------------------
  |  Branch (144:7): [True: 0, False: 596]
  ------------------
  145|      0|			RETURN(pf,f,FMTCHECK_LONGDOUBLE);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  146|    596|		if (sh + lg + quad)
  ------------------
  |  Branch (146:7): [True: 0, False: 596]
  ------------------
  147|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  148|    596|		RETURN(pf,f,FMTCHECK_DOUBLE);
  ------------------
  |  |   60|    596|#define RETURN(pf,f,r) do { \
  |  |   61|    596|			*(pf) = (f); \
  |  |   62|    596|			return r; \
  |  |   63|    596|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  149|    596|	}
  150|  29.0k|	if (*f == 'c') {
  ------------------
  |  Branch (150:6): [True: 211, False: 28.8k]
  ------------------
  151|    211|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (151:7): [True: 0, False: 211]
  ------------------
  152|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  153|    211|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|    211|#define RETURN(pf,f,r) do { \
  |  |   61|    211|			*(pf) = (f); \
  |  |   62|    211|			return r; \
  |  |   63|    211|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  154|    211|	}
  155|  28.8k|	if (*f == 's') {
  ------------------
  |  Branch (155:6): [True: 28.8k, False: 0]
  ------------------
  156|  28.8k|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (156:7): [True: 0, False: 28.8k]
  ------------------
  157|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  158|  28.8k|		RETURN(pf,f,FMTCHECK_STRING);
  ------------------
  |  |   60|  28.8k|#define RETURN(pf,f,r) do { \
  |  |   61|  28.8k|			*(pf) = (f); \
  |  |   62|  28.8k|			return r; \
  |  |   63|  28.8k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  159|  28.8k|	}
  160|      0|	if (*f == 'p') {
  ------------------
  |  Branch (160:6): [True: 0, False: 0]
  ------------------
  161|      0|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (161:7): [True: 0, False: 0]
  ------------------
  162|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  163|      0|		RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  164|      0|	}
  165|      0|	RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  166|       |	/*NOTREACHED*/
  167|      0|}

file_fsmagic:
  107|  10.5k|{
  108|  10.5k|	int ret, did = 0;
  109|  10.5k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  10.5k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  10.5k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  10.5k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  110|  10.5k|	int silent = ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION);
  ------------------
  |  |   45|  10.5k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	int silent = ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION);
  ------------------
  |  |   46|  10.5k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  111|  10.5k|#ifdef	S_IFLNK
  112|  10.5k|	char buf[BUFSIZ+4];
  113|  10.5k|	ssize_t nch;
  114|  10.5k|	struct stat tstatbuf;
  115|  10.5k|#endif
  116|       |
  117|  10.5k|	if (fn == NULL)
  ------------------
  |  Branch (117:6): [True: 10.5k, False: 0]
  ------------------
  118|  10.5k|		return 0;
  119|       |
  120|      0|#define COMMA	(did++ ? ", " : "")
  121|       |	/*
  122|       |	 * Fstat is cheaper but fails for files you don't have read perms on.
  123|       |	 * On 4.2BSD and similar systems, use lstat() to identify symlinks.
  124|       |	 */
  125|      0|#ifdef	S_IFLNK
  126|      0|	if ((ms->flags & MAGIC_SYMLINK) == 0)
  ------------------
  |  |   34|      0|#define	MAGIC_SYMLINK		0x0000002 /* Follow symlinks */
  ------------------
  |  Branch (126:6): [True: 0, False: 0]
  ------------------
  127|      0|		ret = lstat(fn, sb);
  128|      0|	else
  129|      0|#endif
  130|      0|	ret = stat(fn, sb);	/* don't merge into if; see "ret =" above */
  131|       |
  132|       |#ifdef WIN32
  133|       |	{
  134|       |		HANDLE hFile = CreateFile((LPCSTR)fn, 0, FILE_SHARE_DELETE |
  135|       |		    FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0,
  136|       |		    NULL);
  137|       |		if (hFile != INVALID_HANDLE_VALUE) {
  138|       |			/*
  139|       |			 * Stat failed, but we can still open it - assume it's
  140|       |			 * a block device, if nothing else.
  141|       |			 */
  142|       |			if (ret) {
  143|       |				sb->st_mode = S_IFBLK;
  144|       |				ret = 0;
  145|       |			}
  146|       |			switch (GetFileType(hFile)) {
  147|       |			case FILE_TYPE_CHAR:
  148|       |				sb->st_mode |= S_IFCHR;
  149|       |				sb->st_mode &= ~S_IFREG;
  150|       |				break;
  151|       |			case FILE_TYPE_PIPE:
  152|       |				sb->st_mode |= S_IFIFO;
  153|       |				sb->st_mode &= ~S_IFREG;
  154|       |				break;
  155|       |			}
  156|       |			CloseHandle(hFile);
  157|       |		}
  158|       |	}
  159|       |#endif
  160|       |
  161|      0|	if (ret) {
  ------------------
  |  Branch (161:6): [True: 0, False: 0]
  ------------------
  162|      0|		if (ms->flags & MAGIC_ERROR) {
  ------------------
  |  |   42|      0|#define	MAGIC_ERROR		0x0000200 /* Handle ENOENT etc as real errors */
  ------------------
  |  Branch (162:7): [True: 0, False: 0]
  ------------------
  163|      0|			file_error(ms, errno, "cannot stat `%s'", fn);
  164|      0|			return -1;
  165|      0|		}
  166|      0|		if (file_printf(ms, "cannot open `%s' (%s)",
  ------------------
  |  Branch (166:7): [True: 0, False: 0]
  ------------------
  167|      0|		    fn, strerror(errno)) == -1)
  168|      0|			return -1;
  169|      0|		return 0;
  170|      0|	}
  171|       |
  172|      0|	ret = 1;
  173|      0|	if (!mime && !silent) {
  ------------------
  |  Branch (173:6): [True: 0, False: 0]
  |  Branch (173:15): [True: 0, False: 0]
  ------------------
  174|      0|#ifdef S_ISUID
  175|      0|		if (sb->st_mode & S_ISUID)
  ------------------
  |  Branch (175:7): [True: 0, False: 0]
  ------------------
  176|      0|			if (file_printf(ms, "%ssetuid", COMMA) == -1)
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (176:8): [True: 0, False: 0]
  ------------------
  177|      0|				return -1;
  178|      0|#endif
  179|      0|#ifdef S_ISGID
  180|      0|		if (sb->st_mode & S_ISGID)
  ------------------
  |  Branch (180:7): [True: 0, False: 0]
  ------------------
  181|      0|			if (file_printf(ms, "%ssetgid", COMMA) == -1)
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (181:8): [True: 0, False: 0]
  ------------------
  182|      0|				return -1;
  183|      0|#endif
  184|      0|#ifdef S_ISVTX
  185|      0|		if (sb->st_mode & S_ISVTX)
  ------------------
  |  Branch (185:7): [True: 0, False: 0]
  ------------------
  186|      0|			if (file_printf(ms, "%ssticky", COMMA) == -1)
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (186:8): [True: 0, False: 0]
  ------------------
  187|      0|				return -1;
  188|      0|#endif
  189|      0|	}
  190|       |
  191|      0|	switch (sb->st_mode & S_IFMT) {
  192|      0|	case S_IFDIR:
  ------------------
  |  Branch (192:2): [True: 0, False: 0]
  ------------------
  193|      0|		if (mime) {
  ------------------
  |  Branch (193:7): [True: 0, False: 0]
  ------------------
  194|      0|			if (handle_mime(ms, mime, "directory") == -1)
  ------------------
  |  Branch (194:8): [True: 0, False: 0]
  ------------------
  195|      0|				return -1;
  196|      0|		} else if (silent) {
  ------------------
  |  Branch (196:14): [True: 0, False: 0]
  ------------------
  197|      0|		} else if (file_printf(ms, "%sdirectory", COMMA) == -1)
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (197:14): [True: 0, False: 0]
  ------------------
  198|      0|			return -1;
  199|      0|		break;
  200|      0|#ifdef S_IFCHR
  201|      0|	case S_IFCHR:
  ------------------
  |  Branch (201:2): [True: 0, False: 0]
  ------------------
  202|       |		/*
  203|       |		 * If -s has been specified, treat character special files
  204|       |		 * like ordinary files.  Otherwise, just report that they
  205|       |		 * are block special files and go on to the next file.
  206|       |		 */
  207|      0|		if ((ms->flags & MAGIC_DEVICES) != 0) {
  ------------------
  |  |   36|      0|#define	MAGIC_DEVICES		0x0000008 /* Look at the contents of devices */
  ------------------
  |  Branch (207:7): [True: 0, False: 0]
  ------------------
  208|      0|			ret = 0;
  209|      0|			break;
  210|      0|		}
  211|      0|		if (mime) {
  ------------------
  |  Branch (211:7): [True: 0, False: 0]
  ------------------
  212|      0|			if (handle_mime(ms, mime, "chardevice") == -1)
  ------------------
  |  Branch (212:8): [True: 0, False: 0]
  ------------------
  213|      0|				return -1;
  214|      0|		} else if (silent) {
  ------------------
  |  Branch (214:14): [True: 0, False: 0]
  ------------------
  215|      0|		} else {
  216|      0|#ifdef HAVE_STRUCT_STAT_ST_RDEV
  217|       |# ifdef dv_unit
  218|       |			if (file_printf(ms, "%scharacter special (%d/%d/%d)",
  219|       |			    COMMA, major(sb->st_rdev), dv_unit(sb->st_rdev),
  220|       |					dv_subunit(sb->st_rdev)) == -1)
  221|       |				return -1;
  222|       |# else
  223|      0|			if (file_printf(ms, "%scharacter special (%ld/%ld)",
  ------------------
  |  Branch (223:8): [True: 0, False: 0]
  ------------------
  224|      0|			    COMMA, (long)major(sb->st_rdev),
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  225|      0|			    (long)minor(sb->st_rdev)) == -1)
  226|      0|				return -1;
  227|      0|# endif
  228|       |#else
  229|       |			if (file_printf(ms, "%scharacter special", COMMA) == -1)
  230|       |				return -1;
  231|       |#endif
  232|      0|		}
  233|      0|		break;
  234|      0|#endif
  235|      0|#ifdef S_IFBLK
  236|      0|	case S_IFBLK:
  ------------------
  |  Branch (236:2): [True: 0, False: 0]
  ------------------
  237|       |		/*
  238|       |		 * If -s has been specified, treat block special files
  239|       |		 * like ordinary files.  Otherwise, just report that they
  240|       |		 * are block special files and go on to the next file.
  241|       |		 */
  242|      0|		if ((ms->flags & MAGIC_DEVICES) != 0) {
  ------------------
  |  |   36|      0|#define	MAGIC_DEVICES		0x0000008 /* Look at the contents of devices */
  ------------------
  |  Branch (242:7): [True: 0, False: 0]
  ------------------
  243|      0|			ret = 0;
  244|      0|			break;
  245|      0|		}
  246|      0|		if (mime) {
  ------------------
  |  Branch (246:7): [True: 0, False: 0]
  ------------------
  247|      0|			if (handle_mime(ms, mime, "blockdevice") == -1)
  ------------------
  |  Branch (247:8): [True: 0, False: 0]
  ------------------
  248|      0|				return -1;
  249|      0|		} else if (silent) {
  ------------------
  |  Branch (249:14): [True: 0, False: 0]
  ------------------
  250|      0|		} else {
  251|      0|#ifdef HAVE_STRUCT_STAT_ST_RDEV
  252|       |# ifdef dv_unit
  253|       |			if (file_printf(ms, "%sblock special (%d/%d/%d)",
  254|       |			    COMMA, major(sb->st_rdev), dv_unit(sb->st_rdev),
  255|       |			    dv_subunit(sb->st_rdev)) == -1)
  256|       |				return -1;
  257|       |# else
  258|      0|			if (file_printf(ms, "%sblock special (%ld/%ld)",
  ------------------
  |  Branch (258:8): [True: 0, False: 0]
  ------------------
  259|      0|			    COMMA, (long)major(sb->st_rdev),
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  260|      0|			    (long)minor(sb->st_rdev)) == -1)
  261|      0|				return -1;
  262|      0|# endif
  263|       |#else
  264|       |			if (file_printf(ms, "%sblock special", COMMA) == -1)
  265|       |				return -1;
  266|       |#endif
  267|      0|		}
  268|      0|		break;
  269|      0|#endif
  270|       |	/* TODO add code to handle V7 MUX and Blit MUX files */
  271|      0|#ifdef	S_IFIFO
  272|      0|	case S_IFIFO:
  ------------------
  |  Branch (272:2): [True: 0, False: 0]
  ------------------
  273|      0|		if((ms->flags & MAGIC_DEVICES) != 0)
  ------------------
  |  |   36|      0|#define	MAGIC_DEVICES		0x0000008 /* Look at the contents of devices */
  ------------------
  |  Branch (273:6): [True: 0, False: 0]
  ------------------
  274|      0|			break;
  275|      0|		if (mime) {
  ------------------
  |  Branch (275:7): [True: 0, False: 0]
  ------------------
  276|      0|			if (handle_mime(ms, mime, "fifo") == -1)
  ------------------
  |  Branch (276:8): [True: 0, False: 0]
  ------------------
  277|      0|				return -1;
  278|      0|		} else if (silent) {
  ------------------
  |  Branch (278:14): [True: 0, False: 0]
  ------------------
  279|      0|		} else if (file_printf(ms, "%sfifo (named pipe)", COMMA) == -1)
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (279:14): [True: 0, False: 0]
  ------------------
  280|      0|			return -1;
  281|      0|		break;
  282|      0|#endif
  283|       |#ifdef	S_IFDOOR
  284|       |	case S_IFDOOR:
  285|       |		if (mime) {
  286|       |			if (handle_mime(ms, mime, "door") == -1)
  287|       |				return -1;
  288|       |		} else if (silent) {
  289|       |		} else if (file_printf(ms, "%sdoor", COMMA) == -1)
  290|       |			return -1;
  291|       |		break;
  292|       |#endif
  293|      0|#ifdef	S_IFLNK
  294|      0|	case S_IFLNK:
  ------------------
  |  Branch (294:2): [True: 0, False: 0]
  ------------------
  295|      0|		if ((nch = readlink(fn, buf, BUFSIZ-1)) <= 0) {
  ------------------
  |  Branch (295:7): [True: 0, False: 0]
  ------------------
  296|      0|			if (ms->flags & MAGIC_ERROR) {
  ------------------
  |  |   42|      0|#define	MAGIC_ERROR		0x0000200 /* Handle ENOENT etc as real errors */
  ------------------
  |  Branch (296:8): [True: 0, False: 0]
  ------------------
  297|      0|			    file_error(ms, errno, "unreadable symlink `%s'",
  298|      0|				fn);
  299|      0|			    return -1;
  300|      0|			}
  301|      0|			if (mime) {
  ------------------
  |  Branch (301:8): [True: 0, False: 0]
  ------------------
  302|      0|				if (handle_mime(ms, mime, "symlink") == -1)
  ------------------
  |  Branch (302:9): [True: 0, False: 0]
  ------------------
  303|      0|					return -1;
  304|      0|			} else if (silent) {
  ------------------
  |  Branch (304:15): [True: 0, False: 0]
  ------------------
  305|      0|			} else if (file_printf(ms,
  ------------------
  |  Branch (305:15): [True: 0, False: 0]
  ------------------
  306|      0|			    "%sunreadable symlink `%s' (%s)", COMMA, fn,
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  307|      0|			    strerror(errno)) == -1)
  308|      0|				return -1;
  309|      0|			break;
  310|      0|		}
  311|      0|		buf[nch] = '\0';	/* readlink(2) does not do this */
  312|       |
  313|       |		/* If broken symlink, say so and quit early. */
  314|      0|#ifdef __linux__
  315|       |		/*
  316|       |		 * linux procfs/devfs makes symlinks like pipe:[3515864880]
  317|       |		 * that we can't stat their readlink output, so stat the
  318|       |		 * original filename instead.
  319|       |		 */
  320|      0|		if (stat(fn, &tstatbuf) < 0)
  ------------------
  |  Branch (320:7): [True: 0, False: 0]
  ------------------
  321|      0|			return bad_link(ms, errno, buf);
  322|       |#else
  323|       |		if (*buf == '/') {
  324|       |			if (stat(buf, &tstatbuf) < 0)
  325|       |				return bad_link(ms, errno, buf);
  326|       |		} else {
  327|       |			char *tmp;
  328|       |			char buf2[BUFSIZ+BUFSIZ+4];
  329|       |
  330|       |			if ((tmp = CCAST(char *, strrchr(fn,  '/'))) == NULL) {
  331|       |				tmp = buf; /* in current directory anyway */
  332|       |			} else {
  333|       |				if (tmp - fn + 1 > BUFSIZ) {
  334|       |					if (ms->flags & MAGIC_ERROR) {
  335|       |						file_error(ms, 0,
  336|       |						    "path too long: `%s'", buf);
  337|       |						return -1;
  338|       |					}
  339|       |					if (mime) {
  340|       |						if (handle_mime(ms, mime,
  341|       |						    "x-path-too-long") == -1)
  342|       |							return -1;
  343|       |					} else if (silent) {
  344|       |					} else if (file_printf(ms,
  345|       |					    "%spath too long: `%s'", COMMA,
  346|       |					    fn) == -1)
  347|       |						return -1;
  348|       |					break;
  349|       |				}
  350|       |				/* take dir part */
  351|       |				(void)strlcpy(buf2, fn, sizeof buf2);
  352|       |				buf2[tmp - fn + 1] = '\0';
  353|       |				/* plus (rel) link */
  354|       |				(void)strlcat(buf2, buf, sizeof buf2);
  355|       |				tmp = buf2;
  356|       |			}
  357|       |			if (stat(tmp, &tstatbuf) < 0)
  358|       |				return bad_link(ms, errno, buf);
  359|       |		}
  360|       |#endif
  361|       |
  362|       |		/* Otherwise, handle it. */
  363|      0|		if ((ms->flags & MAGIC_SYMLINK) != 0) {
  ------------------
  |  |   34|      0|#define	MAGIC_SYMLINK		0x0000002 /* Follow symlinks */
  ------------------
  |  Branch (363:7): [True: 0, False: 0]
  ------------------
  364|      0|			const char *p;
  365|      0|			ms->flags &= MAGIC_SYMLINK;
  ------------------
  |  |   34|      0|#define	MAGIC_SYMLINK		0x0000002 /* Follow symlinks */
  ------------------
  366|      0|			p = magic_file(ms, buf);
  367|      0|			ms->flags |= MAGIC_SYMLINK;
  ------------------
  |  |   34|      0|#define	MAGIC_SYMLINK		0x0000002 /* Follow symlinks */
  ------------------
  368|      0|			if (p == NULL)
  ------------------
  |  Branch (368:8): [True: 0, False: 0]
  ------------------
  369|      0|				return -1;
  370|      0|		} else { /* just print what it points to */
  371|      0|			if (mime) {
  ------------------
  |  Branch (371:8): [True: 0, False: 0]
  ------------------
  372|      0|				if (handle_mime(ms, mime, "symlink") == -1)
  ------------------
  |  Branch (372:9): [True: 0, False: 0]
  ------------------
  373|      0|					return -1;
  374|      0|			} else if (silent) {
  ------------------
  |  Branch (374:15): [True: 0, False: 0]
  ------------------
  375|      0|			} else if (file_printf(ms, "%ssymbolic link to %s",
  ------------------
  |  Branch (375:15): [True: 0, False: 0]
  ------------------
  376|      0|			    COMMA, buf) == -1)
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  377|      0|				return -1;
  378|      0|		}
  379|      0|		break;
  380|      0|#endif
  381|      0|#ifdef	S_IFSOCK
  382|      0|#ifndef __COHERENT__
  383|      0|	case S_IFSOCK:
  ------------------
  |  Branch (383:2): [True: 0, False: 0]
  ------------------
  384|      0|		if (mime) {
  ------------------
  |  Branch (384:7): [True: 0, False: 0]
  ------------------
  385|      0|			if (handle_mime(ms, mime, "socket") == -1)
  ------------------
  |  Branch (385:8): [True: 0, False: 0]
  ------------------
  386|      0|				return -1;
  387|      0|		} else if (silent) {
  ------------------
  |  Branch (387:14): [True: 0, False: 0]
  ------------------
  388|      0|		} else if (file_printf(ms, "%ssocket", COMMA) == -1)
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (388:14): [True: 0, False: 0]
  ------------------
  389|      0|			return -1;
  390|      0|		break;
  391|      0|#endif
  392|      0|#endif
  393|      0|	case S_IFREG:
  ------------------
  |  Branch (393:2): [True: 0, False: 0]
  ------------------
  394|       |		/*
  395|       |		 * regular file, check next possibility
  396|       |		 *
  397|       |		 * If stat() tells us the file has zero length, report here that
  398|       |		 * the file is empty, so we can skip all the work of opening and
  399|       |		 * reading the file.
  400|       |		 * But if the -s option has been given, we skip this
  401|       |		 * optimization, since on some systems, stat() reports zero
  402|       |		 * size for raw disk partitions. (If the block special device
  403|       |		 * really has zero length, the fact that it is empty will be
  404|       |		 * detected and reported correctly when we read the file.)
  405|       |		 */
  406|      0|		if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) {
  ------------------
  |  |   36|      0|#define	MAGIC_DEVICES		0x0000008 /* Look at the contents of devices */
  ------------------
  |  Branch (406:7): [True: 0, False: 0]
  |  Branch (406:43): [True: 0, False: 0]
  ------------------
  407|      0|			if (mime) {
  ------------------
  |  Branch (407:8): [True: 0, False: 0]
  ------------------
  408|      0|				if (handle_mime(ms, mime, "x-empty") == -1)
  ------------------
  |  Branch (408:9): [True: 0, False: 0]
  ------------------
  409|      0|					return -1;
  410|      0|			} else if (silent) {
  ------------------
  |  Branch (410:15): [True: 0, False: 0]
  ------------------
  411|      0|			} else if (file_printf(ms, "%sempty", COMMA) == -1)
  ------------------
  |  |  120|      0|#define COMMA	(did++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (120:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (411:15): [True: 0, False: 0]
  ------------------
  412|      0|				return -1;
  413|      0|			break;
  414|      0|		}
  415|      0|		ret = 0;
  416|      0|		break;
  417|       |
  418|      0|	default:
  ------------------
  |  Branch (418:2): [True: 0, False: 0]
  ------------------
  419|      0|		file_error(ms, 0, "invalid mode 0%o", sb->st_mode);
  420|      0|		return -1;
  421|       |		/*NOTREACHED*/
  422|      0|	}
  423|       |
  424|      0|	if (!silent && !mime && did && ret == 0) {
  ------------------
  |  Branch (424:6): [True: 0, False: 0]
  |  Branch (424:17): [True: 0, False: 0]
  |  Branch (424:26): [True: 0, False: 0]
  |  Branch (424:33): [True: 0, False: 0]
  ------------------
  425|      0|	    if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (425:10): [True: 0, False: 0]
  ------------------
  426|      0|		    return -1;
  427|      0|	}
  428|       |	/*
  429|       |	 * If we were looking for extensions or apple (silent) it is not our
  430|       |	 * job to print here, so don't count this as a match.
  431|       |	 */
  432|      0|	if (ret == 1 && silent)
  ------------------
  |  Branch (432:6): [True: 0, False: 0]
  |  Branch (432:18): [True: 0, False: 0]
  ------------------
  433|      0|		return 0;
  434|      0|	return ret;
  435|      0|}

file_copystr:
   56|    181|{
   57|    181|	if (blen == 0)
  ------------------
  |  Branch (57:6): [True: 0, False: 181]
  ------------------
   58|      0|		return buf;
   59|    181|	if (width >= blen)
  ------------------
  |  Branch (59:6): [True: 1, False: 180]
  ------------------
   60|      1|		width = blen - 1;
   61|    181|	memcpy(buf, str, width);
   62|    181|	buf[width] = '\0';
   63|    181|	return buf;
   64|    181|}
file_checkfmt:
   95|   249k|{
   96|   249k|	const char *p;
   97|  2.79M|	for (p = fmt; *p; p++) {
  ------------------
  |  Branch (97:16): [True: 2.54M, False: 249k]
  ------------------
   98|  2.54M|		if (*p != '%')
  ------------------
  |  Branch (98:7): [True: 2.38M, False: 157k]
  ------------------
   99|  2.38M|			continue;
  100|   157k|		if (*++p == '%')
  ------------------
  |  Branch (100:7): [True: 0, False: 157k]
  ------------------
  101|      0|			continue;
  102|       |		// Skip uninteresting.
  103|   228k|		while (strchr("#0.'+- ", *p) != NULL)
  ------------------
  |  Branch (103:10): [True: 71.6k, False: 157k]
  ------------------
  104|  71.6k|			p++;
  105|   157k|		if (*p == '*') {
  ------------------
  |  Branch (105:7): [True: 0, False: 157k]
  ------------------
  106|      0|			if (msg)
  ------------------
  |  Branch (106:8): [True: 0, False: 0]
  ------------------
  107|      0|				snprintf(msg, mlen, "* not allowed in format");
  108|      0|			return -1;
  109|      0|		}
  110|       |
  111|   157k|		if (!file_checkfield(msg, mlen, "width", &p))
  ------------------
  |  Branch (111:7): [True: 0, False: 157k]
  ------------------
  112|      0|			return -1;
  113|       |
  114|   157k|		if (*p == '.') {
  ------------------
  |  Branch (114:7): [True: 3.91k, False: 153k]
  ------------------
  115|  3.91k|			p++;
  116|  3.91k|			if (!file_checkfield(msg, mlen, "precision", &p))
  ------------------
  |  Branch (116:8): [True: 0, False: 3.91k]
  ------------------
  117|      0|				return -1;
  118|  3.91k|		}
  119|       |
  120|   157k|		if (!isalpha((unsigned char)*p)) {
  ------------------
  |  Branch (120:7): [True: 0, False: 157k]
  ------------------
  121|      0|			if (msg)
  ------------------
  |  Branch (121:8): [True: 0, False: 0]
  ------------------
  122|      0|				snprintf(msg, mlen, "bad format char: %c", *p);
  123|      0|			return -1;
  124|      0|		}
  125|   157k|	}
  126|   249k|	return 0;
  127|   249k|}
file_vprintf:
  134|   251k|{
  135|   251k|	int len;
  136|   251k|	char *buf, *newstr;
  137|   251k|	char tbuf[1024];
  138|       |
  139|   251k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  461|   251k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (139:6): [True: 1.84k, False: 249k]
  ------------------
  140|  1.84k|		return 0;
  141|       |
  142|   249k|	if (file_checkfmt(tbuf, sizeof(tbuf), fmt)) {
  ------------------
  |  Branch (142:6): [True: 0, False: 249k]
  ------------------
  143|      0|		file_clearbuf(ms);
  144|      0|		file_error(ms, 0, "Bad magic format `%s' (%s)", fmt, tbuf);
  145|      0|		return -1;
  146|      0|	}
  147|       |
  148|   249k|	len = vasprintf(&buf, fmt, ap);
  149|   249k|	if (len < 0 || (size_t)len > 1024 || len + ms->o.blen > 1024 * 1024) {
  ------------------
  |  Branch (149:6): [True: 0, False: 249k]
  |  Branch (149:17): [True: 139, False: 249k]
  |  Branch (149:39): [True: 0, False: 249k]
  ------------------
  150|    139|		size_t blen = ms->o.blen;
  151|    139|		free(buf);
  152|    139|		file_clearbuf(ms);
  153|    139|		file_error(ms, 0, "Output buffer space exceeded %d+%"
  154|    139|		    SIZE_T_FORMAT "u", len, blen);
  155|    139|		return -1;
  156|    139|	}
  157|       |
  158|   249k|	if (ms->o.buf != NULL) {
  ------------------
  |  Branch (158:6): [True: 226k, False: 23.0k]
  ------------------
  159|   226k|		len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
  160|   226k|		free(buf);
  161|   226k|		if (len < 0)
  ------------------
  |  Branch (161:7): [True: 0, False: 226k]
  ------------------
  162|      0|			goto out;
  163|   226k|		free(ms->o.buf);
  164|   226k|		buf = newstr;
  165|   226k|	}
  166|   249k|	ms->o.buf = buf;
  167|   249k|	ms->o.blen = len;
  168|   249k|	return 0;
  169|      0|out:
  170|      0|	file_clearbuf(ms);
  171|      0|	file_error(ms, errno, "vasprintf failed");
  172|      0|	return -1;
  173|   249k|}
file_printf:
  177|   251k|{
  178|   251k|	int rv;
  179|   251k|	va_list ap;
  180|       |
  181|   251k|	va_start(ap, fmt);
  182|   251k|	rv = file_vprintf(ms, fmt, ap);
  183|   251k|	va_end(ap);
  184|   251k|	return rv;
  185|   251k|}
file_error:
  215|    281|{
  216|    281|	va_list va;
  217|    281|	va_start(va, f);
  218|    281|	file_error_core(ms, error, f, va, 0);
  219|    281|	va_end(va);
  220|    281|}
file_badseek:
  244|      1|{
  245|      1|	file_error(ms, errno, "error seeking");
  246|      1|}
file_badread:
  250|     84|{
  251|     84|	file_error(ms, errno, "error reading");
  252|     84|}
file_separator:
  259|  15.9k|{
  260|  15.9k|	return file_printf(ms, FILE_SEPARATOR);
  ------------------
  |  |  255|  15.9k|#define FILE_SEPARATOR "\n- "
  ------------------
  261|  15.9k|}
file_default:
  294|  9.03k|{
  295|  9.03k|	if (ms->flags & MAGIC_MIME) {
  ------------------
  |  |   44|  9.03k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  9.03k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  9.03k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (295:6): [True: 0, False: 9.03k]
  ------------------
  296|      0|		if ((ms->flags & MAGIC_MIME_TYPE) &&
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (296:7): [True: 0, False: 0]
  ------------------
  297|      0|		    file_printf(ms, "application/%s",
  ------------------
  |  Branch (297:7): [True: 0, False: 0]
  ------------------
  298|      0|			nb ? "octet-stream" : "x-empty") == -1)
  ------------------
  |  Branch (298:4): [True: 0, False: 0]
  ------------------
  299|      0|			return -1;
  300|      0|		return 1;
  301|      0|	}
  302|  9.03k|	if (ms->flags & MAGIC_APPLE) {
  ------------------
  |  |   45|  9.03k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (302:6): [True: 0, False: 9.03k]
  ------------------
  303|      0|		if (file_printf(ms, "UNKNUNKN") == -1)
  ------------------
  |  Branch (303:7): [True: 0, False: 0]
  ------------------
  304|      0|			return -1;
  305|      0|		return 1;
  306|      0|	}
  307|  9.03k|	if (ms->flags & MAGIC_EXTENSION) {
  ------------------
  |  |   46|  9.03k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (307:6): [True: 0, False: 9.03k]
  ------------------
  308|      0|		if (file_printf(ms, "???") == -1)
  ------------------
  |  Branch (308:7): [True: 0, False: 0]
  ------------------
  309|      0|			return -1;
  310|      0|		return 1;
  311|      0|	}
  312|  9.03k|	return 0;
  313|  9.03k|}
file_buffer:
  326|  12.6k|{
  327|  12.6k|	int m = 0, rv = 0, looks_text = 0;
  328|  12.6k|	const char *code = NULL;
  329|  12.6k|	const char *code_mime = "binary";
  330|  12.6k|	const char *def = "data";
  331|  12.6k|	const char *ftype = NULL;
  332|  12.6k|	char *rbuf = NULL;
  333|  12.6k|	struct buffer b;
  334|       |
  335|  12.6k|	buffer_init(&b, fd, st, buf, nb);
  336|  12.6k|	ms->mode = b.st.st_mode;
  337|       |
  338|  12.6k|	if (nb == 0) {
  ------------------
  |  Branch (338:6): [True: 105, False: 12.5k]
  ------------------
  339|    105|		def = "empty";
  340|    105|		goto simple;
  341|  12.5k|	} else if (nb == 1) {
  ------------------
  |  Branch (341:13): [True: 5, False: 12.5k]
  ------------------
  342|      5|		def = "very short file (no magic)";
  343|      5|		goto simple;
  344|      5|	}
  345|       |
  346|  12.5k|	if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
  ------------------
  |  |   63|  12.5k|#define MAGIC_NO_CHECK_ENCODING 0x0200000 /* Don't check text encodings */
  ------------------
  |  Branch (346:6): [True: 12.5k, False: 0]
  ------------------
  347|  12.5k|		looks_text = file_encoding(ms, &b, NULL, 0,
  348|  12.5k|		    &code, &code_mime, &ftype);
  349|  12.5k|	}
  350|       |
  351|       |#ifdef __EMX__
  352|       |	if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
  353|       |		m = file_os2_apptype(ms, inname, &b);
  354|       |		if ((ms->flags & MAGIC_DEBUG) != 0)
  355|       |			(void)fprintf(stderr, "[try os2_apptype %d]\n", m);
  356|       |		switch (m) {
  357|       |		case -1:
  358|       |			return -1;
  359|       |		case 0:
  360|       |			break;
  361|       |		default:
  362|       |			return 1;
  363|       |		}
  364|       |	}
  365|       |#endif
  366|  12.5k|#if HAVE_FORK
  367|       |	/* try compression stuff */
  368|  12.5k|	if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0) {
  ------------------
  |  |   54|  12.5k|#define	MAGIC_NO_CHECK_COMPRESS	0x0001000 /* Don't check for compressed files */
  ------------------
  |  Branch (368:6): [True: 12.5k, False: 0]
  ------------------
  369|  12.5k|		m = file_zmagic(ms, &b, inname);
  370|  12.5k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  12.5k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (370:7): [True: 0, False: 12.5k]
  ------------------
  371|      0|			(void)fprintf(stderr, "[try zmagic %d]\n", m);
  372|  12.5k|		if (m) {
  ------------------
  |  Branch (372:7): [True: 1.11k, False: 11.3k]
  ------------------
  373|  1.11k|			goto done_encoding;
  374|  1.11k|		}
  375|  12.5k|	}
  376|  11.3k|#endif
  377|       |	/* Check if we have a tar file */
  378|  11.3k|	if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0) {
  ------------------
  |  |   55|  11.3k|#define	MAGIC_NO_CHECK_TAR	0x0002000 /* Don't check for tar files */
  ------------------
  |  Branch (378:6): [True: 11.3k, False: 0]
  ------------------
  379|  11.3k|		m = file_is_tar(ms, &b);
  380|  11.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  11.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (380:7): [True: 0, False: 11.3k]
  ------------------
  381|      0|			(void)fprintf(stderr, "[try tar %d]\n", m);
  382|  11.3k|		if (m) {
  ------------------
  |  Branch (382:7): [True: 9, False: 11.3k]
  ------------------
  383|      9|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (383:8): [True: 0, False: 9]
  ------------------
  384|      0|				goto done;
  385|      9|		}
  386|  11.3k|	}
  387|       |
  388|       |	/* Check if we have a JSON file */
  389|  11.3k|	if ((ms->flags & MAGIC_NO_CHECK_JSON) == 0) {
  ------------------
  |  |   64|  11.3k|#define MAGIC_NO_CHECK_JSON	0x0400000 /* Don't check for JSON files */
  ------------------
  |  Branch (389:6): [True: 11.3k, False: 0]
  ------------------
  390|  11.3k|		m = file_is_json(ms, &b);
  391|  11.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  11.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (391:7): [True: 0, False: 11.3k]
  ------------------
  392|      0|			(void)fprintf(stderr, "[try json %d]\n", m);
  393|  11.3k|		if (m) {
  ------------------
  |  Branch (393:7): [True: 25, False: 11.3k]
  ------------------
  394|     25|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (394:8): [True: 0, False: 25]
  ------------------
  395|      0|				goto done;
  396|     25|		}
  397|  11.3k|	}
  398|       |
  399|       |	/* Check if we have a CSV file */
  400|  11.3k|	if ((ms->flags & MAGIC_NO_CHECK_CSV) == 0) {
  ------------------
  |  |   61|  11.3k|#define MAGIC_NO_CHECK_CSV	0x0080000 /* Don't check for CSV files */
  ------------------
  |  Branch (400:6): [True: 11.3k, False: 0]
  ------------------
  401|  11.3k|		m = file_is_csv(ms, &b, looks_text);
  402|  11.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  11.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (402:7): [True: 0, False: 11.3k]
  ------------------
  403|      0|			(void)fprintf(stderr, "[try csv %d]\n", m);
  404|  11.3k|		if (m) {
  ------------------
  |  Branch (404:7): [True: 7, False: 11.3k]
  ------------------
  405|      7|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (405:8): [True: 0, False: 7]
  ------------------
  406|      0|				goto done;
  407|      7|		}
  408|  11.3k|	}
  409|       |
  410|       |	/* Check if we have a CDF file */
  411|  11.3k|	if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) {
  ------------------
  |  |   60|  11.3k|#define	MAGIC_NO_CHECK_CDF	0x0040000 /* Don't check for cdf files */
  ------------------
  |  Branch (411:6): [True: 11.3k, False: 0]
  ------------------
  412|  11.3k|		m = file_trycdf(ms, &b);
  413|  11.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  11.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (413:7): [True: 0, False: 11.3k]
  ------------------
  414|      0|			(void)fprintf(stderr, "[try cdf %d]\n", m);
  415|  11.3k|		if (m) {
  ------------------
  |  Branch (415:7): [True: 654, False: 10.7k]
  ------------------
  416|    654|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (416:8): [True: 0, False: 654]
  ------------------
  417|      0|				goto done;
  418|    654|		}
  419|  11.3k|	}
  420|  11.3k|#ifdef BUILTIN_ELF
  421|  11.3k|	if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && nb > 5 && fd != -1) {
  ------------------
  |  |   58|  11.3k|#define	MAGIC_NO_CHECK_ELF	0x0010000 /* Don't check for elf details */
  ------------------
  |  Branch (421:6): [True: 11.3k, False: 0]
  |  Branch (421:47): [True: 9.94k, False: 1.44k]
  |  Branch (421:57): [True: 8.28k, False: 1.66k]
  ------------------
  422|  8.28k|		file_pushbuf_t *pb;
  423|       |		/*
  424|       |		 * We matched something in the file, so this
  425|       |		 * *might* be an ELF file, and the file is at
  426|       |		 * least 5 bytes long, so if it's an ELF file
  427|       |		 * it has at least one byte past the ELF magic
  428|       |		 * number - try extracting information from the
  429|       |		 * ELF headers that cannot easily be  extracted
  430|       |		 * with rules in the magic file. We we don't
  431|       |		 * print the information yet.
  432|       |		 */
  433|  8.28k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (433:7): [True: 0, False: 8.28k]
  ------------------
  434|      0|			return -1;
  435|       |
  436|  8.28k|		rv = file_tryelf(ms, &b);
  437|  8.28k|		rbuf = file_pop_buffer(ms, pb);
  438|  8.28k|		if (rv == -1) {
  ------------------
  |  Branch (438:7): [True: 100, False: 8.18k]
  ------------------
  439|    100|			free(rbuf);
  440|    100|			rbuf = NULL;
  441|    100|		}
  442|  8.28k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  8.28k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (442:7): [True: 0, False: 8.28k]
  ------------------
  443|      0|			(void)fprintf(stderr, "[try elf %d]\n", m);
  444|  8.28k|	}
  445|  11.3k|#endif
  446|       |
  447|       |	/* try soft magic tests */
  448|  11.3k|	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  11.3k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (448:6): [True: 11.3k, False: 0]
  ------------------
  449|  11.3k|		m = file_softmagic(ms, &b, NULL, NULL, BINTEST, looks_text);
  ------------------
  |  |  210|  11.3k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  450|  11.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  11.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (450:7): [True: 0, False: 11.3k]
  ------------------
  451|      0|			(void)fprintf(stderr, "[try softmagic %d]\n", m);
  452|  11.3k|		if (m == 1 && rbuf) {
  ------------------
  |  Branch (452:7): [True: 8.24k, False: 3.14k]
  |  Branch (452:17): [True: 4.35k, False: 3.89k]
  ------------------
  453|  4.35k|			if (file_printf(ms, "%s", rbuf) == -1)
  ------------------
  |  Branch (453:8): [True: 31, False: 4.32k]
  ------------------
  454|     31|				goto done;
  455|  4.35k|		}
  456|  11.3k|		if (m) {
  ------------------
  |  Branch (456:7): [True: 8.32k, False: 3.03k]
  ------------------
  457|  8.32k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (457:8): [True: 0, False: 8.32k]
  ------------------
  458|      0|				goto done;
  459|  8.32k|		}
  460|  11.3k|	}
  461|       |
  462|       |	/* try text properties */
  463|  11.3k|	if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
  ------------------
  |  |   59|  11.3k|#define	MAGIC_NO_CHECK_TEXT	0x0020000 /* Don't check for text files */
  ------------------
  |  Branch (463:6): [True: 11.3k, False: 0]
  ------------------
  464|       |
  465|  11.3k|		m = file_ascmagic(ms, &b, looks_text);
  466|  11.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  11.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (466:7): [True: 0, False: 11.3k]
  ------------------
  467|      0|			(void)fprintf(stderr, "[try ascmagic %d]\n", m);
  468|  11.3k|		if (m) {
  ------------------
  |  Branch (468:7): [True: 2.43k, False: 8.92k]
  ------------------
  469|  2.43k|			goto done;
  470|  2.43k|		}
  471|  11.3k|	}
  472|       |
  473|  9.03k|simple:
  474|       |	/* give up */
  475|  9.03k|	if (m == 0) {
  ------------------
  |  Branch (475:6): [True: 9.03k, False: 0]
  ------------------
  476|  9.03k|		m = 1;
  477|  9.03k|		rv = file_default(ms, nb);
  478|  9.03k|		if (rv == 0)
  ------------------
  |  Branch (478:7): [True: 9.03k, False: 0]
  ------------------
  479|  9.03k|			if (file_printf(ms, "%s", def) == -1)
  ------------------
  |  Branch (479:8): [True: 0, False: 9.03k]
  ------------------
  480|      0|				rv = -1;
  481|  9.03k|	}
  482|  11.5k| done:
  483|  11.5k|	trim_separator(ms);
  484|  11.5k|	if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {
  ------------------
  |  |   43|  11.5k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (484:6): [True: 0, False: 11.5k]
  ------------------
  485|      0|		if (ms->flags & MAGIC_MIME_TYPE)
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (485:7): [True: 0, False: 0]
  ------------------
  486|      0|			if (file_printf(ms, "; charset=") == -1)
  ------------------
  |  Branch (486:8): [True: 0, False: 0]
  ------------------
  487|      0|				rv = -1;
  488|      0|		if (file_printf(ms, "%s", code_mime) == -1)
  ------------------
  |  Branch (488:7): [True: 0, False: 0]
  ------------------
  489|      0|			rv = -1;
  490|      0|	}
  491|  11.5k|#if HAVE_FORK
  492|  12.6k| done_encoding:
  493|  12.6k|#endif
  494|  12.6k|	free(rbuf);
  495|  12.6k|	buffer_fini(&b);
  496|  12.6k|	if (rv)
  ------------------
  |  Branch (496:6): [True: 31, False: 12.5k]
  ------------------
  497|     31|		return rv;
  498|       |
  499|  12.5k|	return m;
  500|  12.6k|}
file_reset:
  505|  10.5k|{
  506|  10.5k|	if (checkloaded && ms->mlist[0] == NULL) {
  ------------------
  |  Branch (506:6): [True: 10.5k, False: 2]
  |  Branch (506:21): [True: 0, False: 10.5k]
  ------------------
  507|      0|		file_error(ms, 0, "no magic files loaded");
  508|      0|		return -1;
  509|      0|	}
  510|  10.5k|	file_clearbuf(ms);
  511|  10.5k|	if (ms->o.pbuf) {
  ------------------
  |  Branch (511:6): [True: 10.2k, False: 338]
  ------------------
  512|  10.2k|		free(ms->o.pbuf);
  513|  10.2k|		ms->o.pbuf = NULL;
  514|  10.2k|	}
  515|  10.5k|	ms->event_flags &= ~EVENT_HAD_ERR;
  ------------------
  |  |  461|  10.5k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  516|  10.5k|	ms->error = -1;
  517|  10.5k|	return 0;
  518|  10.5k|}
file_getbuffer:
  530|  10.5k|{
  531|  10.5k|	char *pbuf, *op, *np;
  532|  10.5k|	size_t psize, len;
  533|       |
  534|  10.5k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  461|  10.5k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (534:6): [True: 278, False: 10.2k]
  ------------------
  535|    278|		return NULL;
  536|       |
  537|  10.2k|	if (ms->flags & MAGIC_RAW)
  ------------------
  |  |   41|  10.2k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (537:6): [True: 0, False: 10.2k]
  ------------------
  538|      0|		return ms->o.buf;
  539|       |
  540|  10.2k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (540:6): [True: 0, False: 10.2k]
  ------------------
  541|      0|		return NULL;
  542|       |
  543|       |	/* * 4 is for octal representation, + 1 is for NUL */
  544|  10.2k|	len = strlen(ms->o.buf);
  545|  10.2k|	if (len > (SIZE_MAX - 1) / 4) {
  ------------------
  |  Branch (545:6): [True: 0, False: 10.2k]
  ------------------
  546|      0|		file_oomem(ms, len);
  547|      0|		return NULL;
  548|      0|	}
  549|  10.2k|	psize = len * 4 + 1;
  550|  10.2k|	if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
  ------------------
  |  |  426|  10.2k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (550:6): [True: 0, False: 10.2k]
  ------------------
  551|      0|		file_oomem(ms, psize);
  552|      0|		return NULL;
  553|      0|	}
  554|  10.2k|	ms->o.pbuf = pbuf;
  555|       |
  556|  10.2k|#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
  557|  10.2k|	{
  558|  10.2k|		mbstate_t state;
  559|  10.2k|		wchar_t nextchar;
  560|  10.2k|		int mb_conv = 1;
  561|  10.2k|		size_t bytesconsumed;
  562|  10.2k|		char *eop;
  563|  10.2k|		(void)memset(&state, 0, sizeof(mbstate_t));
  564|       |
  565|  10.2k|		np = ms->o.pbuf;
  566|  10.2k|		op = ms->o.buf;
  567|  10.2k|		eop = op + len;
  568|       |
  569|  1.63M|		while (op < eop) {
  ------------------
  |  Branch (569:10): [True: 1.62M, False: 10.2k]
  ------------------
  570|  1.62M|			bytesconsumed = mbrtowc(&nextchar, op,
  571|  1.62M|			    CAST(size_t, eop - op), &state);
  ------------------
  |  |  426|  1.62M|#define CAST(T, b)	((T)(b))
  ------------------
  572|  1.62M|			if (bytesconsumed == CAST(size_t, -1) ||
  ------------------
  |  |  426|  3.24M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (572:8): [True: 37, False: 1.62M]
  ------------------
  573|  1.62M|			    bytesconsumed == CAST(size_t, -2)) {
  ------------------
  |  |  426|  1.62M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (573:8): [True: 0, False: 1.62M]
  ------------------
  574|     37|				mb_conv = 0;
  575|     37|				break;
  576|     37|			}
  577|       |
  578|  1.62M|			if (iswprint(nextchar)) {
  ------------------
  |  Branch (578:8): [True: 1.60M, False: 13.5k]
  ------------------
  579|  1.60M|				(void)memcpy(np, op, bytesconsumed);
  580|  1.60M|				op += bytesconsumed;
  581|  1.60M|				np += bytesconsumed;
  582|  1.60M|			} else {
  583|  27.1k|				while (bytesconsumed-- > 0)
  ------------------
  |  Branch (583:12): [True: 13.5k, False: 13.5k]
  ------------------
  584|  13.5k|					OCTALIFY(np, op);
  ------------------
  |  |  522|  13.5k|	(void)(*(n)++ = '\\', \
  |  |  523|  13.5k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  426|  13.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  524|  13.5k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  426|  13.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  525|  13.5k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  426|  13.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  526|  13.5k|	(o)++)
  ------------------
  585|  13.5k|			}
  586|  1.62M|		}
  587|  10.2k|		*np = '\0';
  588|       |
  589|       |		/* Parsing succeeded as a multi-byte sequence */
  590|  10.2k|		if (mb_conv != 0)
  ------------------
  |  Branch (590:7): [True: 10.2k, False: 37]
  ------------------
  591|  10.2k|			return ms->o.pbuf;
  592|  10.2k|	}
  593|     37|#endif
  594|       |
  595|  8.44k|	for (np = ms->o.pbuf, op = ms->o.buf; *op;) {
  ------------------
  |  Branch (595:40): [True: 8.40k, False: 37]
  ------------------
  596|  8.40k|		if (isprint(CAST(unsigned char, *op))) {
  597|  8.04k|			*np++ = *op++;
  598|  8.04k|		} else {
  599|    359|			OCTALIFY(np, op);
  ------------------
  |  |  522|    359|	(void)(*(n)++ = '\\', \
  |  |  523|    359|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  426|    359|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  524|    359|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  426|    359|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  525|    359|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  426|    359|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  526|    359|	(o)++)
  ------------------
  600|    359|		}
  601|  8.40k|	}
  602|     37|	*np = '\0';
  603|     37|	return ms->o.pbuf;
  604|  10.2k|}
file_check_mem:
  608|   433k|{
  609|   433k|	size_t len;
  610|       |
  611|   433k|	if (level >= ms->c.len) {
  ------------------
  |  Branch (611:6): [True: 1, False: 433k]
  ------------------
  612|      1|		len = (ms->c.len = 20 + level) * sizeof(*ms->c.li);
  613|      1|		ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
  ------------------
  |  |  426|      2|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  614|      1|		    malloc(len) :
  615|      1|		    realloc(ms->c.li, len));
  616|      1|		if (ms->c.li == NULL) {
  ------------------
  |  Branch (616:7): [True: 0, False: 1]
  ------------------
  617|      0|			file_oomem(ms, len);
  618|      0|			return -1;
  619|      0|		}
  620|      1|	}
  621|   433k|	ms->c.li[level].got_match = 0;
  622|   433k|#ifdef ENABLE_CONDITIONALS
  623|   433k|	ms->c.li[level].last_match = 0;
  624|   433k|	ms->c.li[level].last_cond = COND_NONE;
  ------------------
  |  |  335|   433k|#define				COND_NONE	0
  ------------------
  625|   433k|#endif /* ENABLE_CONDITIONALS */
  626|   433k|	return 0;
  627|   433k|}
file_printedlen:
  631|  2.38k|{
  632|  2.38k|	return ms->o.blen;
  633|  2.38k|}
file_replace:
  637|  1.22k|{
  638|  1.22k|	file_regex_t rx;
  639|  1.22k|	int rc, rv = -1;
  640|       |
  641|  1.22k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED);
  642|  1.22k|	if (rc == 0) {
  ------------------
  |  Branch (642:6): [True: 1.22k, False: 0]
  ------------------
  643|  1.22k|		regmatch_t rm;
  644|  1.22k|		int nm = 0;
  645|  1.36k|		while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
  ------------------
  |  Branch (645:10): [True: 142, False: 1.22k]
  ------------------
  646|    142|			ms->o.buf[rm.rm_so] = '\0';
  647|    142|			if (file_printf(ms, "%s%s", rep,
  ------------------
  |  Branch (647:8): [True: 0, False: 142]
  ------------------
  648|    142|			    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
  ------------------
  |  Branch (648:8): [True: 142, False: 0]
  ------------------
  649|      0|				goto out;
  650|    142|			nm++;
  651|    142|		}
  652|  1.22k|		rv = nm;
  653|  1.22k|	}
  654|  1.22k|out:
  655|  1.22k|	file_regfree(&rx);
  656|  1.22k|	return rv;
  657|  1.22k|}
file_regcomp:
  692|  33.2k|{
  693|  33.2k|	if (check_regex(ms, pat) == -1)
  ------------------
  |  Branch (693:6): [True: 0, False: 33.2k]
  ------------------
  694|      0|		return -1;
  695|       |
  696|  33.2k|#ifdef USE_C_LOCALE
  697|  33.2k|	locale_t old = uselocale(ms->c_lc_ctype);
  698|  33.2k|	assert(old != NULL);
  699|       |#else
  700|       |	char old[1024];
  701|       |	strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
  702|       |	(void)setlocale(LC_CTYPE, "C");
  703|       |#endif
  704|  33.2k|	int rc;
  705|  33.2k|	rc = regcomp(rx, pat, flags);
  706|       |
  707|  33.2k|#ifdef USE_C_LOCALE
  708|  33.2k|	uselocale(old);
  709|       |#else
  710|       |	(void)setlocale(LC_CTYPE, old);
  711|       |#endif
  712|  33.2k|	if (rc > 0 && (ms->flags & MAGIC_CHECK)) {
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (712:6): [True: 0, False: 33.2k]
  |  Branch (712:16): [True: 0, False: 0]
  ------------------
  713|      0|		char errmsg[512], buf[512];
  714|       |
  715|      0|		(void)regerror(rc, rx, errmsg, sizeof(errmsg));
  716|      0|		file_magerror(ms, "regex error %d for `%s', (%s)", rc, 
  717|      0|		    file_printable(ms, buf, sizeof(buf), pat, strlen(pat)),
  718|      0|		    errmsg);
  719|      0|	}
  720|  33.2k|	return rc;
  721|  33.2k|}
file_regexec:
  727|   223k|{
  728|   223k|#ifdef USE_C_LOCALE
  729|   223k|	locale_t old = uselocale(ms->c_lc_ctype);
  730|   223k|	assert(old != NULL);
  731|       |#else
  732|       |	char old[1024];
  733|       |	strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
  734|       |	(void)setlocale(LC_CTYPE, "C");
  735|       |#endif
  736|   223k|	int rc;
  737|       |	/* XXX: force initialization because glibc does not always do this */
  738|   223k|	if (nmatch != 0)
  ------------------
  |  Branch (738:6): [True: 191k, False: 31.8k]
  ------------------
  739|   191k|		memset(pmatch, 0, nmatch * sizeof(*pmatch));
  740|   223k|	rc = regexec(rx, str, nmatch, pmatch, eflags);
  741|   223k|#ifdef USE_C_LOCALE
  742|   223k|	uselocale(old);
  743|       |#else
  744|       |	(void)setlocale(LC_CTYPE, old);
  745|       |#endif
  746|   223k|	return rc;
  747|   223k|}
file_regfree:
  751|  33.0k|{
  752|  33.0k|	regfree(rx);
  753|  33.0k|}
file_push_buffer:
  757|  17.1k|{
  758|  17.1k|	file_pushbuf_t *pb;
  759|       |
  760|  17.1k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  461|  17.1k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (760:6): [True: 2, False: 17.1k]
  ------------------
  761|      2|		return NULL;
  762|       |
  763|  17.1k|	if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL)
  ------------------
  |  |  426|  17.1k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (763:6): [True: 0, False: 17.1k]
  ------------------
  764|      0|		return NULL;
  765|       |
  766|  17.1k|	pb->buf = ms->o.buf;
  767|  17.1k|	pb->blen = ms->o.blen;
  768|  17.1k|	pb->offset = ms->offset;
  769|       |
  770|  17.1k|	ms->o.buf = NULL;
  771|  17.1k|	ms->o.blen = 0;
  772|  17.1k|	ms->offset = 0;
  773|       |
  774|  17.1k|	return pb;
  775|  17.1k|}
file_pop_buffer:
  779|  17.1k|{
  780|  17.1k|	char *rbuf;
  781|       |
  782|  17.1k|	if (ms->event_flags & EVENT_HAD_ERR) {
  ------------------
  |  |  461|  17.1k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (782:6): [True: 1.25k, False: 15.8k]
  ------------------
  783|  1.25k|		free(pb->buf);
  784|  1.25k|		free(pb);
  785|  1.25k|		return NULL;
  786|  1.25k|	}
  787|       |
  788|  15.8k|	rbuf = ms->o.buf;
  789|       |
  790|  15.8k|	ms->o.buf = pb->buf;
  791|  15.8k|	ms->o.blen = pb->blen;
  792|  15.8k|	ms->offset = pb->offset;
  793|       |
  794|  15.8k|	free(pb);
  795|  15.8k|	return rbuf;
  796|  17.1k|}
file_printable:
  804|  15.7k|{
  805|  15.7k|	char *ptr, *eptr = buf + bufsiz - 1;
  806|  15.7k|	const unsigned char *s = RCAST(const unsigned char *, str);
  ------------------
  |  |  427|  15.7k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  807|  15.7k|	const unsigned char *es = s + slen;
  808|       |
  809|   113k|	for (ptr = buf;  ptr < eptr && s < es && *s; s++) {
  ------------------
  |  Branch (809:19): [True: 113k, False: 47]
  |  Branch (809:33): [True: 112k, False: 232]
  |  Branch (809:43): [True: 97.3k, False: 15.4k]
  ------------------
  810|  97.3k|		if ((ms->flags & MAGIC_RAW) != 0 ||
  ------------------
  |  |   41|  97.3k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (810:7): [True: 0, False: 97.3k]
  ------------------
  811|  97.3k|		    (isprint(*s) && !isspace(*s))) {
  ------------------
  |  Branch (811:23): [True: 52.2k, False: 5.15k]
  ------------------
  812|  52.2k|			*ptr++ = *s;
  813|  52.2k|			continue;
  814|  52.2k|		}
  815|  45.1k|		if (ptr >= eptr - 3)
  ------------------
  |  Branch (815:7): [True: 38, False: 45.1k]
  ------------------
  816|     38|			break;
  817|  45.1k|		*ptr++ = '\\';
  818|  45.1k|		*ptr++ = ((CAST(unsigned int, *s) >> 6) & 7) + '0';
  ------------------
  |  |  426|  45.1k|#define CAST(T, b)	((T)(b))
  ------------------
  819|  45.1k|		*ptr++ = ((CAST(unsigned int, *s) >> 3) & 7) + '0';
  ------------------
  |  |  426|  45.1k|#define CAST(T, b)	((T)(b))
  ------------------
  820|  45.1k|		*ptr++ = ((CAST(unsigned int, *s) >> 0) & 7) + '0';
  ------------------
  |  |  426|  45.1k|#define CAST(T, b)	((T)(b))
  ------------------
  821|  45.1k|	}
  822|  15.7k|	*ptr = '\0';
  823|  15.7k|	return buf;
  824|  15.7k|}
file_print_guid:
  860|    186|{
  861|    186|	const struct guid *g = CAST(const struct guid *,
  ------------------
  |  |  426|    186|#define CAST(T, b)	((T)(b))
  ------------------
  862|    186|	    CAST(const void *, guid));
  863|       |
  864|    186|#ifndef WIN32
  865|    186|	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hhX%.2hhX-"
  866|    186|	    "%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX",
  867|    186|	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  868|    186|	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  869|    186|	    g->data4[6], g->data4[7]);
  870|       |#else
  871|       |	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hX%.2hX-"
  872|       |	    "%.2hX%.2hX%.2hX%.2hX%.2hX%.2hX",
  873|       |	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  874|       |	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  875|       |	    g->data4[6], g->data4[7]);
  876|       |#endif
  877|    186|}
file_pipe_closexec:
  881|    594|{
  882|    594|#ifdef HAVE_PIPE2
  883|    594|	return pipe2(fds, O_CLOEXEC);
  884|       |#else
  885|       |	if (pipe(fds) == -1)
  886|       |		return -1;
  887|       |# ifdef F_SETFD
  888|       |	(void)fcntl(fds[0], F_SETFD, FD_CLOEXEC);
  889|       |	(void)fcntl(fds[1], F_SETFD, FD_CLOEXEC);
  890|       |# endif
  891|       |	return 0;
  892|       |#endif
  893|    594|}
file_clear_closexec:
  896|    891|file_clear_closexec(int fd) {
  897|    891|#ifdef F_SETFD
  898|    891|	return fcntl(fd, F_SETFD, 0);
  899|       |#else
  900|       |	return 0;
  901|       |#endif
  902|    891|}
file_strtrim:
  906|    107|{
  907|    107|	char *last;
  908|       |
  909|    107|	while (isspace(CAST(unsigned char, *str)))
  910|    171|		str++;
  911|    107|	last = str;
  912|  3.91k|	while (*last)
  ------------------
  |  Branch (912:9): [True: 3.81k, False: 107]
  ------------------
  913|  3.81k|		last++;
  914|    107|	--last;
  915|    107|	while (isspace(CAST(unsigned char, *last)))
  916|    158|		last--;
  917|    107|	*++last = '\0';
  918|    107|	return str;
  919|    107|}
funcs.c:file_checkfield:
   76|   161k|{
   77|   161k|	const char *p = *pp;
   78|   161k|	int fw = 0;
   79|       |
   80|   169k|	while (*p && isdigit((unsigned char)*p))
  ------------------
  |  Branch (80:9): [True: 169k, False: 0]
  ------------------
   81|  8.81k|		fw = fw * 10 + (*p++ - '0');
   82|       |
   83|   161k|	*pp = p;
   84|       |
   85|   161k|	if (fw < 1024)
  ------------------
  |  Branch (85:6): [True: 161k, False: 0]
  ------------------
   86|   161k|		return 1;
   87|      0|	if (msg)
  ------------------
  |  Branch (87:6): [True: 0, False: 0]
  ------------------
   88|      0|		snprintf(msg, mlen, "field %s too large: %d", what, fw);
   89|       |
   90|      0|	return 0;
   91|   161k|}
funcs.c:file_clearbuf:
   68|  10.7k|{
   69|  10.7k|	free(ms->o.buf);
   70|  10.7k|	ms->o.buf = NULL;
   71|  10.7k|	ms->o.blen = 0;
   72|  10.7k|}
funcs.c:file_error_core:
  195|    281|{
  196|       |	/* Only the first error is ok */
  197|    281|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  461|    281|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (197:6): [True: 0, False: 281]
  ------------------
  198|      0|		return;
  199|    281|	if (lineno != 0) {
  ------------------
  |  Branch (199:6): [True: 0, False: 281]
  ------------------
  200|      0|		file_clearbuf(ms);
  201|      0|		(void)file_printf(ms, "line %" SIZE_T_FORMAT "u:", lineno);
  202|      0|	}
  203|    281|	if (ms->o.buf && *ms->o.buf)
  ------------------
  |  Branch (203:6): [True: 137, False: 144]
  |  Branch (203:19): [True: 137, False: 0]
  ------------------
  204|    137|		(void)file_printf(ms, " ");
  205|    281|	(void)file_vprintf(ms, f, va);
  206|    281|	if (error > 0)
  ------------------
  |  Branch (206:6): [True: 98, False: 183]
  ------------------
  207|     98|		(void)file_printf(ms, " (%s)", strerror(error));
  208|    281|	ms->event_flags |= EVENT_HAD_ERR;
  ------------------
  |  |  461|    281|#define 		EVENT_HAD_ERR		0x01
  ------------------
  209|    281|	ms->error = error;
  210|    281|}
funcs.c:checkdone:
  284|  9.02k|{
  285|  9.02k|	if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  9.02k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (285:6): [True: 0, False: 9.02k]
  ------------------
  286|      0|		return 1;
  287|  9.02k|	if (file_separator(ms) == -1)
  ------------------
  |  Branch (287:6): [True: 0, False: 9.02k]
  ------------------
  288|      0|		*rv = -1;
  289|  9.02k|	return 0;
  290|  9.02k|}
funcs.c:trim_separator:
  265|  11.5k|{
  266|  11.5k|	size_t l;
  267|       |
  268|  11.5k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (268:6): [True: 0, False: 11.5k]
  ------------------
  269|      0|		return;
  270|       |
  271|  11.5k|	l = strlen(ms->o.buf);
  272|  11.5k|	if (l < sizeof(FILE_SEPARATOR))
  ------------------
  |  |  255|  11.5k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (272:6): [True: 0, False: 11.5k]
  ------------------
  273|      0|		return;
  274|       |
  275|  11.5k|	l -= sizeof(FILE_SEPARATOR) - 1;
  ------------------
  |  |  255|  11.5k|#define FILE_SEPARATOR "\n- "
  ------------------
  276|  11.5k|	if (strcmp(ms->o.buf + l, FILE_SEPARATOR) != 0)
  ------------------
  |  |  255|  11.5k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (276:6): [True: 11.4k, False: 54]
  ------------------
  277|  11.4k|		return;
  278|       |
  279|     54|	ms->o.buf[l] = '\0';
  280|     54|}
funcs.c:check_regex:
  661|  33.2k|{
  662|  33.2k|	char sbuf[512];
  663|  33.2k|	unsigned char oc = '\0';
  664|       |
  665|   400k|	for (const char *p = pat; *p; p++) {
  ------------------
  |  Branch (665:28): [True: 367k, False: 33.2k]
  ------------------
  666|   367k|		unsigned char c = *p;
  667|       |		// Avoid repetition
  668|   367k|		if (c == oc && strchr("?*+{", c) != NULL) {
  ------------------
  |  Branch (668:7): [True: 129, False: 367k]
  |  Branch (668:18): [True: 0, False: 129]
  ------------------
  669|      0|			size_t len = strlen(pat);
  670|      0|			file_magwarn(ms,
  671|      0|			    "repetition-operator operand `%c' "
  672|      0|			    "invalid in regex `%s'", c,
  673|      0|			    file_printable(ms, sbuf, sizeof(sbuf), pat, len));
  674|      0|			return -1;
  675|      0|		}
  676|   367k|		oc = c;
  677|   367k|		if (isprint(c) || isspace(c) || c == '\b'
  ------------------
  |  Branch (677:35): [True: 4, False: 1]
  ------------------
  678|   367k|		    || c == 0x8a) // XXX: apple magic fixme
  ------------------
  |  Branch (678:10): [True: 1, False: 0]
  ------------------
  679|   367k|			continue;
  680|      0|		size_t len = strlen(pat);
  681|      0|		file_magwarn(ms,
  682|      0|		    "non-ascii characters in regex \\%#o `%s'",
  683|      0|		    c, file_printable(ms, sbuf, sizeof(sbuf), pat, len));
  684|      0|		return -1;
  685|   367k|	}
  686|  33.2k|	return 0;
  687|  33.2k|}

file_is_csv:
  134|  11.3k|{
  135|  11.3k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  11.3k|#define CAST(T, b)	((T)(b))
  ------------------
  136|  11.3k|	const unsigned char *ue = uc + b->flen;
  137|  11.3k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  11.3k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  11.3k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  11.3k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  138|       |
  139|  11.3k|	if (!looks_text)
  ------------------
  |  Branch (139:6): [True: 9.09k, False: 2.29k]
  ------------------
  140|  9.09k|		return 0;
  141|       |
  142|  2.29k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  2.29k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  2.29k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (142:6): [True: 0, False: 2.29k]
  ------------------
  143|      0|		return 0;
  144|       |
  145|  2.29k|	if (!csv_parse(uc, ue))
  ------------------
  |  Branch (145:6): [True: 2.28k, False: 7]
  ------------------
  146|  2.28k|		return 0;
  147|       |
  148|      7|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|      7|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (148:6): [True: 0, False: 7]
  ------------------
  149|      0|		return 1;
  150|       |
  151|      7|	if (mime) {
  ------------------
  |  Branch (151:6): [True: 0, False: 7]
  ------------------
  152|      0|		if (file_printf(ms, "text/csv") == -1)
  ------------------
  |  Branch (152:7): [True: 0, False: 0]
  ------------------
  153|      0|			return -1;
  154|      0|		return 1;
  155|      0|	}
  156|       |
  157|      7|	if (file_printf(ms, "CSV text") == -1)
  ------------------
  |  Branch (157:6): [True: 0, False: 7]
  ------------------
  158|      0|		return -1;
  159|       |
  160|      7|	return 1;
  161|      7|}
is_csv.c:csv_parse:
   93|  2.29k|{
   94|  2.29k|	size_t nf = 0, tf = 0, nl = 0;
   95|       |
   96|  12.8M|	while (uc < ue) {
  ------------------
  |  Branch (96:9): [True: 12.8M, False: 2.01k]
  ------------------
   97|  12.8M|		switch (*uc++) {
   98|  1.60k|		case '"':
  ------------------
  |  Branch (98:3): [True: 1.60k, False: 12.8M]
  ------------------
   99|       |			// Eat until the matching quote
  100|  1.60k|			uc = eatquote(uc, ue);
  101|  1.60k|			break;
  102|  4.38M|		case ',':
  ------------------
  |  Branch (102:3): [True: 4.38M, False: 8.49M]
  ------------------
  103|  4.38M|			nf++;
  104|  4.38M|			break;
  105|    419|		case '\n':
  ------------------
  |  Branch (105:3): [True: 419, False: 12.8M]
  ------------------
  106|    419|			DPRINTF("%zu %zu %zu\n", nl, nf, tf);
  107|    419|			nl++;
  108|    419|#if CSV_LINES
  109|    419|			if (nl == CSV_LINES)
  ------------------
  |  |   61|    419|#define CSV_LINES 10
  ------------------
  |  Branch (109:8): [True: 6, False: 413]
  ------------------
  110|      6|				return tf != 0 && tf == nf;
  ------------------
  |  Branch (110:12): [True: 6, False: 0]
  |  Branch (110:23): [True: 0, False: 6]
  ------------------
  111|    413|#endif
  112|    413|			if (tf == 0) {
  ------------------
  |  Branch (112:8): [True: 308, False: 105]
  ------------------
  113|       |				// First time and no fields, give up
  114|    308|				if (nf == 0) 
  ------------------
  |  Branch (114:9): [True: 251, False: 57]
  ------------------
  115|    251|					return 0;
  116|       |				// First time, set the number of fields
  117|     57|				tf = nf;
  118|    105|			} else if (tf != nf) {
  ------------------
  |  Branch (118:15): [True: 23, False: 82]
  ------------------
  119|       |				// Field number mismatch, we are done.
  120|     23|				return 0;
  121|     23|			}
  122|    139|			nf = 0;
  123|    139|			break;
  124|  8.49M|		default:
  ------------------
  |  Branch (124:3): [True: 8.49M, False: 4.38M]
  ------------------
  125|  8.49M|			break;
  126|  12.8M|		}
  127|  12.8M|	}
  128|  2.01k|	return tf && nl > 2;
  ------------------
  |  Branch (128:9): [True: 28, False: 1.98k]
  |  Branch (128:15): [True: 7, False: 21]
  ------------------
  129|  2.29k|}
is_csv.c:eatquote:
   68|  1.60k|{
   69|  1.60k|	int quote = 0;
   70|       |
   71|   205k|	while (uc < ue) {
  ------------------
  |  Branch (71:9): [True: 205k, False: 204]
  ------------------
   72|   205k|		unsigned char c = *uc++;
   73|   205k|		if (c != '"') {
  ------------------
  |  Branch (73:7): [True: 71.0k, False: 134k]
  ------------------
   74|       |			// We already got one, done.
   75|  71.0k|			if (quote) {
  ------------------
  |  Branch (75:8): [True: 1.39k, False: 69.6k]
  ------------------
   76|  1.39k|				return --uc;
   77|  1.39k|			}
   78|  69.6k|			continue;
   79|  71.0k|		}
   80|   134k|		if (quote) {
  ------------------
  |  Branch (80:7): [True: 66.3k, False: 67.7k]
  ------------------
   81|       |			// quote-quote escapes
   82|  66.3k|			quote = 0;
   83|  66.3k|			continue;
   84|  66.3k|		}
   85|       |		// first quote
   86|  67.7k|		quote = 1;
   87|  67.7k|	}
   88|    204|	return ue;
   89|  1.60k|}

file_is_json:
  423|  11.3k|{
  424|  11.3k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  11.3k|#define CAST(T, b)	((T)(b))
  ------------------
  425|  11.3k|	const unsigned char *ue = uc + b->flen;
  426|  11.3k|	size_t st[JSON_MAX];
  427|  11.3k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  11.3k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  11.3k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  11.3k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  428|  11.3k|	int jt;
  429|       |
  430|       |
  431|  11.3k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  11.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  11.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (431:6): [True: 0, False: 11.3k]
  ------------------
  432|      0|		return 0;
  433|       |
  434|  11.3k|	memset(st, 0, sizeof(st));
  435|       |
  436|  11.3k|	if ((jt = json_parse(&uc, ue, st, 0)) == 0)
  ------------------
  |  Branch (436:6): [True: 11.3k, False: 25]
  ------------------
  437|  11.3k|		return 0;
  438|       |
  439|     25|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     25|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (439:6): [True: 0, False: 25]
  ------------------
  440|      0|		return 1;
  441|     25|	if (mime) {
  ------------------
  |  Branch (441:6): [True: 0, False: 25]
  ------------------
  442|      0|		if (file_printf(ms, "application/%s",
  ------------------
  |  Branch (442:7): [True: 0, False: 0]
  ------------------
  443|      0|		    jt == 1 ? "json" : "x-ndjson") == -1)
  ------------------
  |  Branch (443:7): [True: 0, False: 0]
  ------------------
  444|      0|			return -1;
  445|      0|		return 1;
  446|      0|	}
  447|     25|	if (file_printf(ms, "%sJSON text data",
  ------------------
  |  Branch (447:6): [True: 0, False: 25]
  ------------------
  448|     25|	    jt == 1 ? "" : "New Line Delimited ") == -1)
  ------------------
  |  Branch (448:6): [True: 13, False: 12]
  ------------------
  449|      0|		return -1;
  450|       |#if JSON_COUNT
  451|       |#define P(n) st[n], st[n] > 1 ? "s" : ""
  452|       |	if (file_printf(ms, " (%" SIZE_T_FORMAT "u object%s, %" SIZE_T_FORMAT
  453|       |	    "u array%s, %" SIZE_T_FORMAT "u string%s, %" SIZE_T_FORMAT
  454|       |	    "u constant%s, %" SIZE_T_FORMAT "u number%s, %" SIZE_T_FORMAT
  455|       |	    "u >1array%s)",
  456|       |	    P(JSON_OBJECT), P(JSON_ARRAY), P(JSON_STRING), P(JSON_CONSTANT),
  457|       |	    P(JSON_NUMBER), P(JSON_ARRAYN))
  458|       |	    == -1)
  459|       |		return -1;
  460|       |#endif
  461|     25|	return 1;
  462|     25|}
is_json.c:json_parse:
  348|  21.0k|{
  349|  21.0k|	const unsigned char *uc, *ouc;
  350|  21.0k|	int rv = 0;
  351|  21.0k|	int t;
  352|       |
  353|  21.0k|	ouc = uc = json_skip_space(*ucp, ue);
  354|  21.0k|	if (uc == ue)
  ------------------
  |  Branch (354:6): [True: 62, False: 20.9k]
  ------------------
  355|     62|		goto out;
  356|       |
  357|       |	// Avoid recursion
  358|  20.9k|	if (lvl > 500) {
  ------------------
  |  Branch (358:6): [True: 4, False: 20.9k]
  ------------------
  359|      4|		DPRINTF("Too many levels", uc, *ucp);
  ------------------
  |  |   52|      4|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  360|      4|		return 0;
  361|      4|	}
  362|       |#if JSON_COUNT
  363|       |	/* bail quickly if not counting */
  364|       |	if (lvl > 1 && (st[JSON_OBJECT] || st[JSON_ARRAYN]))
  365|       |		return 1;
  366|       |#endif
  367|       |
  368|  20.9k|	DPRINTF("Parse general: ", uc, *ucp);
  ------------------
  |  |   52|  20.9k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  369|  20.9k|	switch (*uc++) {
  370|    257|	case '"':
  ------------------
  |  Branch (370:2): [True: 257, False: 20.7k]
  ------------------
  371|    257|		rv = json_parse_string(&uc, ue, lvl + 1);
  372|    257|		t = JSON_STRING;
  ------------------
  |  |   60|    257|#define JSON_STRING	4
  ------------------
  373|    257|		break;
  374|  6.58k|	case '[':
  ------------------
  |  Branch (374:2): [True: 6.58k, False: 14.3k]
  ------------------
  375|  6.58k|		rv = json_parse_array(&uc, ue, st, lvl + 1);
  376|  6.58k|		t = JSON_ARRAY;
  ------------------
  |  |   56|  6.58k|#define JSON_ARRAY	0
  ------------------
  377|  6.58k|		break;
  378|    589|	case '{': /* '}' */
  ------------------
  |  Branch (378:2): [True: 589, False: 20.3k]
  ------------------
  379|    589|		rv = json_parse_object(&uc, ue, st, lvl + 1);
  380|    589|		t = JSON_OBJECT;
  ------------------
  |  |   59|    589|#define JSON_OBJECT	3
  ------------------
  381|    589|		break;
  382|     20|	case 't':
  ------------------
  |  Branch (382:2): [True: 20, False: 20.9k]
  ------------------
  383|     20|		rv = json_parse_const(&uc, ue, "true", sizeof("true"), lvl + 1);
  384|     20|		t = JSON_CONSTANT;
  ------------------
  |  |   57|     20|#define JSON_CONSTANT	1
  ------------------
  385|     20|		break;
  386|     19|	case 'f':
  ------------------
  |  Branch (386:2): [True: 19, False: 20.9k]
  ------------------
  387|     19|		rv = json_parse_const(&uc, ue, "false", sizeof("false"),
  388|     19|		    lvl + 1);
  389|     19|		t = JSON_CONSTANT;
  ------------------
  |  |   57|     19|#define JSON_CONSTANT	1
  ------------------
  390|     19|		break;
  391|     20|	case 'n':
  ------------------
  |  Branch (391:2): [True: 20, False: 20.9k]
  ------------------
  392|     20|		rv = json_parse_const(&uc, ue, "null", sizeof("null"), lvl + 1);
  393|     20|		t = JSON_CONSTANT;
  ------------------
  |  |   57|     20|#define JSON_CONSTANT	1
  ------------------
  394|     20|		break;
  395|  13.4k|	default:
  ------------------
  |  Branch (395:2): [True: 13.4k, False: 7.49k]
  ------------------
  396|  13.4k|		--uc;
  397|  13.4k|		rv = json_parse_number(&uc, ue, lvl + 1);
  398|  13.4k|		t = JSON_NUMBER;
  ------------------
  |  |   58|  13.4k|#define JSON_NUMBER	2
  ------------------
  399|  13.4k|		break;
  400|  20.9k|	}
  401|  20.9k|	if (rv)
  ------------------
  |  Branch (401:6): [True: 4.00k, False: 16.9k]
  ------------------
  402|  4.00k|		st[t]++;
  403|  20.9k|	uc = json_skip_space(uc, ue);
  404|  21.0k|out:
  405|  21.0k|	DPRINTF("End general: ", uc, *ucp);
  ------------------
  |  |   52|  21.0k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  406|  21.0k|	*ucp = uc;
  407|  21.0k|	if (lvl == 0) {
  ------------------
  |  Branch (407:6): [True: 11.3k, False: 9.62k]
  ------------------
  408|  11.3k|		if (!rv)
  ------------------
  |  Branch (408:7): [True: 10.9k, False: 415]
  ------------------
  409|  10.9k|			return 0;
  410|    415|		if (uc == ue)
  ------------------
  |  Branch (410:7): [True: 77, False: 338]
  ------------------
  411|     77|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   61|     77|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   59|     71|#define JSON_OBJECT	3
  ------------------
  |  Branch (411:12): [True: 6, False: 71]
  |  Branch (411:31): [True: 7, False: 64]
  ------------------
  412|    338|		if (*ouc == *uc && json_parse(&uc, ue, st, 1))
  ------------------
  |  Branch (412:7): [True: 51, False: 287]
  |  Branch (412:22): [True: 40, False: 11]
  ------------------
  413|     40|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   61|     40|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   59|     30|#define JSON_OBJECT	3
  ------------------
  |  Branch (413:12): [True: 10, False: 30]
  |  Branch (413:31): [True: 2, False: 28]
  ------------------
  414|    298|		else
  415|    298|			return 0;
  416|    338|	}
  417|  9.62k|	return rv;
  418|  21.0k|}
is_json.c:json_skip_space:
  119|  52.5k|{
  120|  6.93M|	while (uc < ue && json_isspace(*uc))
  ------------------
  |  Branch (120:9): [True: 6.93M, False: 4.70k]
  |  Branch (120:20): [True: 6.88M, False: 47.8k]
  ------------------
  121|  6.88M|		uc++;
  122|  52.5k|	return uc;
  123|  52.5k|}
is_json.c:json_isspace:
   79|  6.93M|{
   80|  6.93M|	switch (uc) {
   81|  23.0k|	case ' ':
  ------------------
  |  Branch (81:2): [True: 23.0k, False: 6.90M]
  ------------------
   82|  5.71M|	case '\n':
  ------------------
  |  Branch (82:2): [True: 5.69M, False: 1.23M]
  ------------------
   83|  6.88M|	case '\r':
  ------------------
  |  Branch (83:2): [True: 1.16M, False: 5.76M]
  ------------------
   84|  6.88M|	case '\t':
  ------------------
  |  Branch (84:2): [True: 1.87k, False: 6.93M]
  ------------------
   85|  6.88M|		return 1;
   86|  47.8k|	default:
  ------------------
  |  Branch (86:2): [True: 47.8k, False: 6.88M]
  ------------------
   87|  47.8k|		return 0;
   88|  6.93M|	}
   89|  6.93M|}
is_json.c:json_parse_string:
  129|    721|{
  130|    721|	const unsigned char *uc = *ucp;
  131|    721|	size_t i;
  132|       |
  133|    721|	DPRINTF("Parse string: ", uc, *ucp);
  ------------------
  |  |   52|    721|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|  12.3k|	while (uc < ue) {
  ------------------
  |  Branch (134:9): [True: 12.2k, False: 107]
  ------------------
  135|  12.2k|		switch (*uc++) {
  136|      6|		case '\0':
  ------------------
  |  Branch (136:3): [True: 6, False: 12.2k]
  ------------------
  137|      6|			goto out;
  138|  2.64k|		case '\\':
  ------------------
  |  Branch (138:3): [True: 2.64k, False: 9.60k]
  ------------------
  139|  2.64k|			if (uc == ue)
  ------------------
  |  Branch (139:8): [True: 10, False: 2.63k]
  ------------------
  140|     10|				goto out;
  141|  2.63k|			switch (*uc++) {
  142|      1|			case '\0':
  ------------------
  |  Branch (142:4): [True: 1, False: 2.63k]
  ------------------
  143|      1|				goto out;
  144|    202|			case '"':
  ------------------
  |  Branch (144:4): [True: 202, False: 2.43k]
  ------------------
  145|    594|			case '\\':
  ------------------
  |  Branch (145:4): [True: 392, False: 2.24k]
  ------------------
  146|    789|			case '/':
  ------------------
  |  Branch (146:4): [True: 195, False: 2.44k]
  ------------------
  147|  1.11k|			case 'b':
  ------------------
  |  Branch (147:4): [True: 326, False: 2.31k]
  ------------------
  148|  1.36k|			case 'f':
  ------------------
  |  Branch (148:4): [True: 250, False: 2.38k]
  ------------------
  149|  1.61k|			case 'n':
  ------------------
  |  Branch (149:4): [True: 252, False: 2.38k]
  ------------------
  150|  1.86k|			case 'r':
  ------------------
  |  Branch (150:4): [True: 248, False: 2.38k]
  ------------------
  151|  2.14k|			case 't':
  ------------------
  |  Branch (151:4): [True: 284, False: 2.35k]
  ------------------
  152|  2.14k|				continue;
  153|    483|			case 'u':
  ------------------
  |  Branch (153:4): [True: 483, False: 2.15k]
  ------------------
  154|    483|				if (ue - uc < 4) {
  ------------------
  |  Branch (154:9): [True: 3, False: 480]
  ------------------
  155|      3|					uc = ue;
  156|      3|					goto out;
  157|      3|				}
  158|  2.32k|				for (i = 0; i < 4; i++)
  ------------------
  |  Branch (158:17): [True: 1.87k, False: 449]
  ------------------
  159|  1.87k|					if (!json_isxdigit(*uc++))
  ------------------
  |  Branch (159:10): [True: 31, False: 1.84k]
  ------------------
  160|     31|						goto out;
  161|    449|				continue;
  162|    449|			default:
  ------------------
  |  Branch (162:4): [True: 3, False: 2.63k]
  ------------------
  163|      3|				goto out;
  164|  2.63k|			}
  165|    560|		case '"':
  ------------------
  |  Branch (165:3): [True: 560, False: 11.6k]
  ------------------
  166|    560|			DPRINTF("Good string: ", uc, *ucp);
  ------------------
  |  |   52|    560|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  167|    560|			*ucp = uc;
  168|    560|			return 1;
  169|  9.03k|		default:
  ------------------
  |  Branch (169:3): [True: 9.03k, False: 3.21k]
  ------------------
  170|  9.03k|			continue;
  171|  12.2k|		}
  172|  12.2k|	}
  173|    161|out:
  174|    161|	DPRINTF("Bad string: ", uc, *ucp);
  ------------------
  |  |   52|    161|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  175|    161|	*ucp = uc;
  176|    161|	return 0;
  177|    721|}
is_json.c:json_isxdigit:
  105|  1.87k|{
  106|  1.87k|	if (json_isdigit(uc))
  ------------------
  |  Branch (106:6): [True: 434, False: 1.44k]
  ------------------
  107|    434|		return 1;
  108|  1.44k|	switch (uc) {
  109|    763|	case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
  ------------------
  |  Branch (109:2): [True: 180, False: 1.26k]
  |  Branch (109:12): [True: 116, False: 1.32k]
  |  Branch (109:22): [True: 17, False: 1.42k]
  |  Branch (109:32): [True: 37, False: 1.40k]
  |  Branch (109:42): [True: 326, False: 1.11k]
  |  Branch (109:52): [True: 87, False: 1.35k]
  ------------------
  110|  1.40k|	case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
  ------------------
  |  Branch (110:2): [True: 4, False: 1.43k]
  |  Branch (110:12): [True: 22, False: 1.41k]
  |  Branch (110:22): [True: 400, False: 1.04k]
  |  Branch (110:32): [True: 28, False: 1.41k]
  |  Branch (110:42): [True: 23, False: 1.41k]
  |  Branch (110:52): [True: 169, False: 1.27k]
  ------------------
  111|  1.40k|		return 1;
  112|     31|	default:
  ------------------
  |  Branch (112:2): [True: 31, False: 1.40k]
  ------------------
  113|     31|		return 0;
  114|  1.44k|	}
  115|  1.44k|}
is_json.c:json_isdigit:
   93|  1.84M|{
   94|  1.84M|	switch (uc) {
   95|  1.60M|	case '0': case '1': case '2': case '3': case '4':
  ------------------
  |  Branch (95:2): [True: 452k, False: 1.39M]
  |  Branch (95:12): [True: 92.5k, False: 1.75M]
  |  Branch (95:22): [True: 964, False: 1.84M]
  |  Branch (95:32): [True: 9.87k, False: 1.83M]
  |  Branch (95:42): [True: 1.05M, False: 795k]
  ------------------
   96|  1.81M|	case '5': case '6': case '7': case '8': case '9':
  ------------------
  |  Branch (96:2): [True: 121k, False: 1.72M]
  |  Branch (96:12): [True: 279, False: 1.84M]
  |  Branch (96:22): [True: 82.5k, False: 1.76M]
  |  Branch (96:32): [True: 5.56k, False: 1.84M]
  |  Branch (96:42): [True: 106, False: 1.84M]
  ------------------
   97|  1.81M|		return 1;
   98|  29.6k|	default:
  ------------------
  |  Branch (98:2): [True: 29.6k, False: 1.81M]
  ------------------
   99|  29.6k|		return 0;
  100|  1.84M|	}
  101|  1.84M|}
is_json.c:json_parse_array:
  182|  6.58k|{
  183|  6.58k|	const unsigned char *uc = *ucp;
  184|       |
  185|  6.58k|	DPRINTF("Parse array: ", uc, *ucp);
  ------------------
  |  |   52|  6.58k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  186|  9.41k|	while (uc < ue) {
  ------------------
  |  Branch (186:9): [True: 9.36k, False: 48]
  ------------------
  187|  9.36k|		uc = json_skip_space(uc, ue);
  188|  9.36k|		if (uc == ue)
  ------------------
  |  Branch (188:7): [True: 9, False: 9.35k]
  ------------------
  189|      9|			goto out;
  190|  9.35k|		if (*uc == ']')
  ------------------
  |  Branch (190:7): [True: 212, False: 9.14k]
  ------------------
  191|    212|			goto done;
  192|  9.14k|		if (!json_parse(&uc, ue, st, lvl + 1))
  ------------------
  |  Branch (192:7): [True: 5.79k, False: 3.35k]
  ------------------
  193|  5.79k|			goto out;
  194|  3.35k|		if (uc == ue)
  ------------------
  |  Branch (194:7): [True: 26, False: 3.32k]
  ------------------
  195|     26|			goto out;
  196|  3.32k|		switch (*uc) {
  197|  2.83k|		case ',':
  ------------------
  |  Branch (197:3): [True: 2.83k, False: 499]
  ------------------
  198|  2.83k|			uc++;
  199|  2.83k|			continue;
  200|    484|		case ']':
  ------------------
  |  Branch (200:3): [True: 484, False: 2.84k]
  ------------------
  201|    696|		done:
  202|    696|			st[JSON_ARRAYN]++;
  ------------------
  |  |   61|    696|#define JSON_ARRAYN	5
  ------------------
  203|    696|			DPRINTF("Good array: ", uc, *ucp);
  ------------------
  |  |   52|    696|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  204|    696|			*ucp = uc + 1;
  205|    696|			return 1;
  206|     15|		default:
  ------------------
  |  Branch (206:3): [True: 15, False: 3.31k]
  ------------------
  207|     15|			goto out;
  208|  3.32k|		}
  209|  3.32k|	}
  210|  5.88k|out:
  211|  5.88k|	DPRINTF("Bad array: ", uc,  *ucp);
  ------------------
  |  |   52|  5.88k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  212|  5.88k|	*ucp = uc;
  213|  5.88k|	return 0;
  214|  6.58k|}
is_json.c:json_parse_object:
  219|    589|{
  220|    589|	const unsigned char *uc = *ucp;
  221|    589|	DPRINTF("Parse object: ", uc, *ucp);
  ------------------
  |  |   52|    589|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  222|    709|	while (uc < ue) {
  ------------------
  |  Branch (222:9): [True: 702, False: 7]
  ------------------
  223|    702|		uc = json_skip_space(uc, ue);
  224|    702|		if (uc == ue)
  ------------------
  |  Branch (224:7): [True: 10, False: 692]
  ------------------
  225|     10|			goto out;
  226|    692|		if (*uc == '}') {
  ------------------
  |  Branch (226:7): [True: 204, False: 488]
  ------------------
  227|    204|			uc++;
  228|    204|			goto done;
  229|    204|		}
  230|    488|		if (*uc++ != '"') {
  ------------------
  |  Branch (230:7): [True: 24, False: 464]
  ------------------
  231|     24|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|     24|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  232|     24|			goto out;
  233|     24|		}
  234|    464|		DPRINTF("next field", uc, *ucp);
  ------------------
  |  |   52|    464|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  235|    464|		if (!json_parse_string(&uc, ue, lvl)) {
  ------------------
  |  Branch (235:7): [True: 9, False: 455]
  ------------------
  236|      9|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|      9|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  237|      9|			goto out;
  238|      9|		}
  239|    455|		uc = json_skip_space(uc, ue);
  240|    455|		if (uc == ue)
  ------------------
  |  Branch (240:7): [True: 8, False: 447]
  ------------------
  241|      8|			goto out;
  242|    447|		if (*uc++ != ':') {
  ------------------
  |  Branch (242:7): [True: 12, False: 435]
  ------------------
  243|     12|			DPRINTF("not colon", uc, *ucp);
  ------------------
  |  |   52|     12|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  244|     12|			goto out;
  245|     12|		}
  246|    435|		if (!json_parse(&uc, ue, st, lvl + 1)) {
  ------------------
  |  Branch (246:7): [True: 245, False: 190]
  ------------------
  247|    245|			DPRINTF("not json", uc, *ucp);
  ------------------
  |  |   52|    245|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  248|    245|			goto out;
  249|    245|		}
  250|    190|		if (uc == ue)
  ------------------
  |  Branch (250:7): [True: 2, False: 188]
  ------------------
  251|      2|			goto out;
  252|    188|		switch (*uc++) {
  253|    120|		case ',':
  ------------------
  |  Branch (253:3): [True: 120, False: 68]
  ------------------
  254|    120|			continue;
  255|     67|		case '}': /* { */
  ------------------
  |  Branch (255:3): [True: 67, False: 121]
  ------------------
  256|    271|		done:
  257|    271|			DPRINTF("Good object: ", uc, *ucp);
  ------------------
  |  |   52|    271|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  258|    271|			*ucp = uc;
  259|    271|			return 1;
  260|      1|		default:
  ------------------
  |  Branch (260:3): [True: 1, False: 187]
  ------------------
  261|      1|			DPRINTF("not more", uc, *ucp);
  ------------------
  |  |   52|      1|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  262|      1|			*ucp = uc - 1;
  263|      1|			goto out;
  264|    188|		}
  265|    188|	}
  266|    318|out:
  267|    318|	DPRINTF("Bad object: ", uc, *ucp);
  ------------------
  |  |   52|    318|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  268|    318|	*ucp = uc;
  269|    318|	return 0;
  270|    589|}
is_json.c:json_parse_const:
  328|     59|{
  329|     59|	const unsigned char *uc = *ucp;
  330|       |
  331|     59|	DPRINTF("Parse const: ", uc, *ucp);
  ------------------
  |  |   52|     59|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  332|     59|	*ucp += --len - 1;
  333|     59|	if (*ucp > ue)
  ------------------
  |  Branch (333:6): [True: 25, False: 34]
  ------------------
  334|     25|		*ucp = ue;
  335|    160|	for (; uc < ue && --len;) {
  ------------------
  |  Branch (335:9): [True: 138, False: 22]
  |  Branch (335:20): [True: 122, False: 16]
  ------------------
  336|    122|		if (*uc++ != *++str) {
  ------------------
  |  Branch (336:7): [True: 21, False: 101]
  ------------------
  337|     21|			DPRINTF("Bad const: ", uc, *ucp);
  ------------------
  |  |   52|     21|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  338|     21|			return 0;
  339|     21|		}
  340|    122|	}
  341|     38|	DPRINTF("Good const: ", uc, *ucp);
  ------------------
  |  |   52|     38|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  342|     38|	return 1;
  343|     59|}
is_json.c:json_parse_number:
  276|  13.4k|{
  277|  13.4k|	const unsigned char *uc = *ucp;
  278|  13.4k|	int got = 0;
  279|       |
  280|  13.4k|	DPRINTF("Parse number: ", uc, *ucp);
  ------------------
  |  |   52|  13.4k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  281|  13.4k|	if (uc == ue)
  ------------------
  |  Branch (281:6): [True: 0, False: 13.4k]
  ------------------
  282|      0|		return 0;
  283|  13.4k|	if (*uc == '-')
  ------------------
  |  Branch (283:6): [True: 247, False: 13.2k]
  ------------------
  284|    247|		uc++;
  285|       |
  286|  1.82M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (286:9): [True: 1.82M, False: 36]
  ------------------
  287|  1.82M|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (287:7): [True: 13.4k, False: 1.80M]
  ------------------
  288|  13.4k|			break;
  289|  1.80M|		got = 1;
  290|  1.80M|	}
  291|  13.4k|	if (uc == ue)
  ------------------
  |  Branch (291:6): [True: 36, False: 13.4k]
  ------------------
  292|     36|		goto out;
  293|  13.4k|	if (*uc == '.')
  ------------------
  |  Branch (293:6): [True: 536, False: 12.8k]
  ------------------
  294|    536|		uc++;
  295|  14.9k|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (295:9): [True: 14.9k, False: 19]
  ------------------
  296|  14.9k|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (296:7): [True: 13.4k, False: 1.50k]
  ------------------
  297|  13.4k|			break;
  298|  1.50k|		got = 1;
  299|  1.50k|	}
  300|  13.4k|	if (uc == ue)
  ------------------
  |  Branch (300:6): [True: 19, False: 13.4k]
  ------------------
  301|     19|		goto out;
  302|  13.4k|	if (got && (*uc == 'e' || *uc == 'E')) {
  ------------------
  |  Branch (302:6): [True: 2.89k, False: 10.5k]
  |  Branch (302:14): [True: 527, False: 2.36k]
  |  Branch (302:28): [True: 829, False: 1.53k]
  ------------------
  303|  1.35k|		uc++;
  304|  1.35k|		got = 0;
  305|  1.35k|		if (uc == ue)
  ------------------
  |  Branch (305:7): [True: 13, False: 1.34k]
  ------------------
  306|     13|			goto out;
  307|  1.34k|		if (*uc == '+' || *uc == '-')
  ------------------
  |  Branch (307:7): [True: 340, False: 1.00k]
  |  Branch (307:21): [True: 648, False: 355]
  ------------------
  308|    988|			uc++;
  309|  6.23k|		for (; uc < ue; uc++) {
  ------------------
  |  Branch (309:10): [True: 6.21k, False: 22]
  ------------------
  310|  6.21k|			if (!json_isdigit(*uc))
  ------------------
  |  Branch (310:8): [True: 1.32k, False: 4.89k]
  ------------------
  311|  1.32k|				break;
  312|  4.89k|			got = 1;
  313|  4.89k|		}
  314|  1.34k|	}
  315|  13.4k|out:
  316|  13.4k|	if (!got)
  ------------------
  |  Branch (316:6): [True: 10.5k, False: 2.89k]
  ------------------
  317|  10.5k|		DPRINTF("Bad number: ", uc, *ucp);
  ------------------
  |  |   52|  10.5k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  318|  2.89k|	else
  319|  2.89k|		DPRINTF("Good number: ", uc, *ucp);
  ------------------
  |  |   52|  2.89k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  320|  13.4k|	*ucp = uc;
  321|  13.4k|	return got;
  322|  13.4k|}

file_is_tar:
   64|  11.3k|{
   65|  11.3k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  11.3k|#define CAST(T, b)	((T)(b))
  ------------------
   66|  11.3k|	size_t nbytes = b->flen;
   67|       |	/*
   68|       |	 * Do the tar test first, because if the first file in the tar
   69|       |	 * archive starts with a dot, we can confuse it with an nroff file.
   70|       |	 */
   71|  11.3k|	int tar;
   72|  11.3k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  11.3k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  11.3k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  11.3k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
   73|       |
   74|  11.3k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  11.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  11.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (74:6): [True: 0, False: 11.3k]
  ------------------
   75|      0|		return 0;
   76|       |
   77|  11.3k|	tar = is_tar(buf, nbytes);
   78|  11.3k|	if (tar < 1 || tar > 3)
  ------------------
  |  Branch (78:6): [True: 11.3k, False: 9]
  |  Branch (78:17): [True: 0, False: 9]
  ------------------
   79|  11.3k|		return 0;
   80|       |
   81|      9|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|      9|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (81:6): [True: 0, False: 9]
  ------------------
   82|      0|		return 1;
   83|       |
   84|      9|	if (file_printf(ms, "%s", mime ? "application/x-tar" :
  ------------------
  |  Branch (84:6): [True: 0, False: 9]
  |  Branch (84:28): [True: 0, False: 9]
  ------------------
   85|      9|	    tartype[tar - 1]) == -1)
   86|      0|		return -1;
   87|       |
   88|      9|	return 1;
   89|      9|}
is_tar.c:is_tar:
  100|  11.3k|{
  101|  11.3k|	static const char gpkg_match[] = "/gpkg-1";
  102|       |
  103|  11.3k|	const union record *header = RCAST(const union record *,
  ------------------
  |  |  427|  11.3k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  104|  11.3k|	    RCAST(const void *, buf));
  105|  11.3k|	size_t i;
  106|  11.3k|	int sum, recsum;
  107|  11.3k|	const unsigned char *p, *ep;
  108|  11.3k|	const char *nulp;
  109|       |
  110|  11.3k|	if (nbytes < sizeof(*header))
  ------------------
  |  Branch (110:6): [True: 9.10k, False: 2.28k]
  ------------------
  111|  9.10k|		return 0;
  112|       |
  113|       |	/* If the file looks like Gentoo GLEP 78 binary package (GPKG),
  114|       |	 * don't waste time on further checks and fall back to magic rules.
  115|       |	 */
  116|  2.28k|	nulp = CAST(const char *,
  ------------------
  |  |  426|  2.28k|#define CAST(T, b)	((T)(b))
  ------------------
  117|  2.28k|	    memchr(header->header.name, 0, sizeof(header->header.name)));
  118|  2.28k|	if (nulp != NULL && nulp >= header->header.name + sizeof(gpkg_match) &&
  ------------------
  |  Branch (118:6): [True: 1.99k, False: 294]
  |  Branch (118:22): [True: 1.17k, False: 814]
  ------------------
  119|  2.28k|	    memcmp(nulp - sizeof(gpkg_match) + 1, gpkg_match,
  ------------------
  |  Branch (119:6): [True: 7, False: 1.16k]
  ------------------
  120|  1.17k|	    sizeof(gpkg_match)) == 0)
  121|      7|	    return 0;
  122|       |
  123|  2.27k|	recsum = from_oct(header->header.chksum, sizeof(header->header.chksum));
  124|       |
  125|  2.27k|	sum = 0;
  126|  2.27k|	p = header->charptr;
  127|  2.27k|	ep = header->charptr + sizeof(*header);
  128|  1.16M|	while (p < ep)
  ------------------
  |  Branch (128:9): [True: 1.16M, False: 2.27k]
  ------------------
  129|  1.16M|		sum += *p++;
  130|       |
  131|       |	/* Adjust checksum to count the "chksum" field as blanks. */
  132|  20.4k|	for (i = 0; i < sizeof(header->header.chksum); i++)
  ------------------
  |  Branch (132:14): [True: 18.2k, False: 2.27k]
  ------------------
  133|  18.2k|		sum -= header->header.chksum[i];
  134|  2.27k|	sum += ' ' * sizeof(header->header.chksum);
  135|       |
  136|  2.27k|	if (sum != recsum)
  ------------------
  |  Branch (136:6): [True: 2.26k, False: 9]
  ------------------
  137|  2.26k|		return 0;	/* Not a tar archive */
  138|       |
  139|      9|	if (strncmp(header->header.magic, GNUTMAGIC,
  ------------------
  |  |   73|      9|#define	GNUTMAGIC	"ustar  "	/* 7 chars and a null */
  ------------------
  |  Branch (139:6): [True: 0, False: 9]
  ------------------
  140|      9|	    sizeof(header->header.magic)) == 0)
  141|      0|		return 3;		/* GNU Unix Standard tar archive */
  142|       |
  143|      9|	if (strncmp(header->header.magic, TMAGIC,
  ------------------
  |  |   72|      9|#define	TMAGIC		"ustar"		/* 5 chars and a null */
  ------------------
  |  Branch (143:6): [True: 0, False: 9]
  ------------------
  144|      9|	    sizeof(header->header.magic)) == 0)
  145|      0|		return 2;		/* Unix Standard tar archive */
  146|       |
  147|      9|	return 1;			/* Old fashioned tar archive */
  148|      9|}
is_tar.c:from_oct:
  158|  2.27k|{
  159|  2.27k|	int	value;
  160|       |
  161|  2.27k|	if (digs == 0)
  ------------------
  |  Branch (161:6): [True: 0, False: 2.27k]
  ------------------
  162|      0|		return -1;
  163|       |
  164|  2.27k|	while (isspace(CAST(unsigned char, *where))) {	/* Skip spaces */
  165|    716|		where++;
  166|    716|		if (digs-- == 0)
  ------------------
  |  Branch (166:7): [True: 66, False: 650]
  ------------------
  167|     66|			return -1;		/* All blank field */
  168|    716|	}
  169|  2.21k|	value = 0;
  170|  2.60k|	while (digs > 0 && isodigit(*where)) {	/* Scan til non-octal */
  ------------------
  |  |   51|  2.56k|#define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
  |  |  ------------------
  |  |  |  Branch (51:23): [True: 853, False: 1.71k]
  |  |  |  Branch (51:39): [True: 389, False: 464]
  |  |  ------------------
  ------------------
  |  Branch (170:9): [True: 2.56k, False: 37]
  ------------------
  171|    389|		value = (value << 3) | (*where++ - '0');
  172|    389|		digs--;
  173|    389|	}
  174|       |
  175|  2.21k|	if (digs > 0 && *where && !isspace(CAST(unsigned char, *where)))
  ------------------
  |  Branch (175:6): [True: 2.17k, False: 37]
  |  Branch (175:18): [True: 1.35k, False: 824]
  |  Branch (175:28): [True: 1.33k, False: 12]
  ------------------
  176|  1.33k|		return -1;			/* Ended on non-(space/NUL) */
  177|       |
  178|    873|	return value;
  179|  2.21k|}

magic_getpath:
  255|      2|{
  256|      2|	if (magicfile != NULL)
  ------------------
  |  Branch (256:6): [True: 2, False: 0]
  ------------------
  257|      2|		return magicfile;
  258|       |
  259|      0|	magicfile = getenv("MAGIC");
  260|      0|	if (magicfile != NULL)
  ------------------
  |  Branch (260:6): [True: 0, False: 0]
  ------------------
  261|      0|		return magicfile;
  262|       |
  263|      0|	return action == FILE_LOAD ? get_default_magic() : MAGIC;
  ------------------
  |  |  169|      0|#define	FILE_LOAD	0
  ------------------
  |  Branch (263:9): [True: 0, False: 0]
  ------------------
  264|      0|}
magic_open:
  268|      2|{
  269|      2|	return file_ms_alloc(flags);
  270|      2|}
magic_load:
  318|      2|{
  319|      2|	if (ms == NULL)
  ------------------
  |  Branch (319:6): [True: 0, False: 2]
  ------------------
  320|      0|		return -1;
  321|      2|	return file_apprentice(ms, magicfile, FILE_LOAD);
  ------------------
  |  |  169|      2|#define	FILE_LOAD	0
  ------------------
  322|      2|}
magic_descriptor:
  403|  10.5k|{
  404|  10.5k|	if (ms == NULL)
  ------------------
  |  Branch (404:6): [True: 0, False: 10.5k]
  ------------------
  405|      0|		return NULL;
  406|  10.5k|	return file_or_fd(ms, NULL, fd);
  407|  10.5k|}
magic_setflags:
  593|      2|{
  594|      2|	if (ms == NULL)
  ------------------
  |  Branch (594:6): [True: 0, False: 2]
  ------------------
  595|      0|		return -1;
  596|       |#if !defined(HAVE_UTIME) && !defined(HAVE_UTIMES)
  597|       |	if (flags & MAGIC_PRESERVE_ATIME)
  598|       |		return -1;
  599|       |#endif
  600|      2|	ms->flags = flags;
  601|      2|	return 0;
  602|      2|}
magic.c:file_or_fd:
  422|  10.5k|{
  423|  10.5k|	int	rv = -1;
  424|  10.5k|	unsigned char *buf;
  425|  10.5k|	struct stat	sb;
  426|  10.5k|	ssize_t nbytes = 0;	/* number of bytes read from a datafile */
  427|  10.5k|	int	ispipe = 0;
  428|  10.5k|	int	okstat = 0;
  429|  10.5k|	off_t	pos = CAST(off_t, -1);
  ------------------
  |  |  426|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  430|       |
  431|  10.5k|	if (file_reset(ms, 1) == -1)
  ------------------
  |  Branch (431:6): [True: 0, False: 10.5k]
  ------------------
  432|      0|		goto out;
  433|       |
  434|       |	/*
  435|       |	 * one extra for terminating '\0', and
  436|       |	 * some overlapping space for matches near EOF
  437|       |	 */
  438|  10.5k|#define SLOP (1 + sizeof(union VALUETYPE))
  439|  10.5k|	if ((buf = CAST(unsigned char *, malloc(ms->bytes_max + SLOP))) == NULL)
  ------------------
  |  |  426|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (439:6): [True: 0, False: 10.5k]
  ------------------
  440|      0|		return NULL;
  441|       |
  442|  10.5k|	switch (file_fsmagic(ms, inname, &sb)) {
  443|      0|	case -1:		/* error */
  ------------------
  |  Branch (443:2): [True: 0, False: 10.5k]
  ------------------
  444|      0|		goto done;
  445|  10.5k|	case 0:			/* nothing found */
  ------------------
  |  Branch (445:2): [True: 10.5k, False: 0]
  ------------------
  446|  10.5k|		break;
  447|      0|	default:		/* matched it and printed type */
  ------------------
  |  Branch (447:2): [True: 0, False: 10.5k]
  ------------------
  448|      0|		rv = 0;
  449|      0|		goto done;
  450|  10.5k|	}
  451|       |
  452|       |#ifdef WIN32
  453|       |	/* Place stdin in binary mode, so EOF (Ctrl+Z) doesn't stop early. */
  454|       |	if (fd == STDIN_FILENO)
  455|       |		_setmode(STDIN_FILENO, O_BINARY);
  456|       |#endif
  457|  10.5k|	if (inname != NULL) {
  ------------------
  |  Branch (457:6): [True: 0, False: 10.5k]
  ------------------
  458|      0|		int flags = O_RDONLY|O_BINARY|O_NONBLOCK|O_CLOEXEC;
  ------------------
  |  |  689|      0|#define O_BINARY	0
  ------------------
  459|      0|		errno = 0;
  460|      0|		if ((fd = open(inname, flags)) < 0) {
  ------------------
  |  Branch (460:7): [True: 0, False: 0]
  ------------------
  461|      0|			okstat = stat(inname, &sb) == 0;
  462|       |#ifdef WIN32
  463|       |			/*
  464|       |			 * Can't stat, can't open.  It may have been opened in
  465|       |			 * fsmagic, so if the user doesn't have read permission,
  466|       |			 * allow it to say so; otherwise an error was probably
  467|       |			 * displayed in fsmagic.
  468|       |			 */
  469|       |			if (!okstat && errno == EACCES) {
  470|       |				sb.st_mode = S_IFBLK;
  471|       |				okstat = 1;
  472|       |			}
  473|       |#endif
  474|      0|			if (okstat &&
  ------------------
  |  Branch (474:8): [True: 0, False: 0]
  ------------------
  475|      0|			    unreadable_info(ms, sb.st_mode, inname) == -1)
  ------------------
  |  Branch (475:8): [True: 0, False: 0]
  ------------------
  476|      0|				goto done;
  477|      0|			rv = 0;
  478|      0|			goto done;
  479|      0|		}
  480|       |#if O_CLOEXEC == 0 && defined(F_SETFD)
  481|       |		(void)fcntl(fd, F_SETFD, FD_CLOEXEC);
  482|       |#endif
  483|      0|	}
  484|       |
  485|  10.5k|	if (fd != -1) {
  ------------------
  |  Branch (485:6): [True: 10.5k, False: 0]
  ------------------
  486|  10.5k|		okstat = fstat(fd, &sb) == 0;
  487|  10.5k|		if (okstat && S_ISFIFO(sb.st_mode))
  ------------------
  |  Branch (487:7): [True: 10.5k, False: 0]
  ------------------
  488|      0|			ispipe = 1;
  489|  10.5k|		if (inname == NULL)
  ------------------
  |  Branch (489:7): [True: 10.5k, False: 0]
  ------------------
  490|  10.5k|			pos = lseek(fd, CAST(off_t, 0), SEEK_CUR);
  ------------------
  |  |  426|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  491|  10.5k|	}
  492|       |
  493|       |	/*
  494|       |	 * try looking at the first ms->bytes_max bytes
  495|       |	 */
  496|  10.5k|	if (ispipe) {
  ------------------
  |  Branch (496:6): [True: 0, False: 10.5k]
  ------------------
  497|      0|		if (fd != -1) {
  ------------------
  |  Branch (497:7): [True: 0, False: 0]
  ------------------
  498|      0|			ssize_t r = 0;
  499|       |
  500|      0|			while ((r = sread(fd, RCAST(void *, &buf[nbytes]),
  ------------------
  |  |  427|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (500:11): [True: 0, False: 0]
  ------------------
  501|      0|			    CAST(size_t, ms->bytes_max - nbytes), 1)) > 0) {
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  502|      0|				nbytes += r;
  503|      0|				if (r < PIPE_BUF) break;
  ------------------
  |  Branch (503:9): [True: 0, False: 0]
  ------------------
  504|      0|			}
  505|      0|		}
  506|       |
  507|      0|		if (nbytes == 0 && inname) {
  ------------------
  |  Branch (507:7): [True: 0, False: 0]
  |  Branch (507:22): [True: 0, False: 0]
  ------------------
  508|       |			/* We can not read it, but we were able to stat it. */
  509|      0|			if (unreadable_info(ms, sb.st_mode, inname) == -1)
  ------------------
  |  Branch (509:8): [True: 0, False: 0]
  ------------------
  510|      0|				goto done;
  511|      0|			rv = 0;
  512|      0|			goto done;
  513|      0|		}
  514|       |
  515|  10.5k|	} else if (fd != -1) {
  ------------------
  |  Branch (515:13): [True: 10.5k, False: 0]
  ------------------
  516|       |		/* Windows refuses to read from a big console buffer. */
  517|  10.5k|		size_t howmany =
  518|       |#ifdef WIN32
  519|       |		    _isatty(fd) ? 8 * 1024 :
  520|       |#endif
  521|  10.5k|		    ms->bytes_max;
  522|  10.5k|		if ((nbytes = read(fd, RCAST(void *, buf), howmany)) == -1) {
  ------------------
  |  |  427|  10.5k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (522:7): [True: 0, False: 10.5k]
  ------------------
  523|      0|			if (inname == NULL && fd != STDIN_FILENO)
  ------------------
  |  Branch (523:8): [True: 0, False: 0]
  |  Branch (523:26): [True: 0, False: 0]
  ------------------
  524|      0|				file_error(ms, errno, "cannot read fd %d", fd);
  525|      0|			else
  526|      0|				file_error(ms, errno, "cannot read `%s'",
  527|      0|				    inname == NULL ? "/dev/stdin" : inname);
  ------------------
  |  Branch (527:9): [True: 0, False: 0]
  ------------------
  528|      0|			goto done;
  529|      0|		}
  530|  10.5k|	}
  531|       |
  532|  10.5k|	(void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
  ------------------
  |  |  438|  10.5k|#define SLOP (1 + sizeof(union VALUETYPE))
  ------------------
  533|  10.5k|	if (file_buffer(ms, fd, okstat ? &sb : NULL, inname, buf, CAST(size_t, nbytes)) == -1)
  ------------------
  |  |  426|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (533:6): [True: 57, False: 10.5k]
  |  Branch (533:26): [True: 10.5k, False: 0]
  ------------------
  534|     57|		goto done;
  535|  10.5k|	rv = 0;
  536|  10.5k|done:
  537|  10.5k|	free(buf);
  538|  10.5k|	if (fd != -1) {
  ------------------
  |  Branch (538:6): [True: 10.5k, False: 0]
  ------------------
  539|  10.5k|		if (pos != CAST(off_t, -1))
  ------------------
  |  |  426|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (539:7): [True: 10.5k, False: 0]
  ------------------
  540|  10.5k|			(void)lseek(fd, pos, SEEK_SET);
  541|  10.5k|		close_and_restore(ms, inname, fd, &sb);
  542|  10.5k|	}
  543|  10.5k|out:
  544|  10.5k|	return rv == 0 ? file_getbuffer(ms) : NULL;
  ------------------
  |  Branch (544:9): [True: 10.5k, False: 57]
  ------------------
  545|  10.5k|}
magic.c:close_and_restore:
  366|  10.5k|{
  367|  10.5k|	if (fd == STDIN_FILENO || name == NULL)
  ------------------
  |  Branch (367:6): [True: 0, False: 10.5k]
  |  Branch (367:28): [True: 10.5k, False: 0]
  ------------------
  368|  10.5k|		return;
  369|      0|	(void) close(fd);
  370|       |
  371|      0|	if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) {
  ------------------
  |  |   40|      0|#define	MAGIC_PRESERVE_ATIME	0x0000080 /* Restore access time on exit */
  ------------------
  |  Branch (371:6): [True: 0, False: 0]
  ------------------
  372|       |		/*
  373|       |		 * Try to restore access, modification times if read it.
  374|       |		 * This is really *bad* because it will modify the status
  375|       |		 * time of the file... And of course this will affect
  376|       |		 * backup programs
  377|       |		 */
  378|      0|#ifdef HAVE_UTIMES
  379|      0|		struct timeval  utsbuf[2];
  380|      0|		(void)memset(utsbuf, 0, sizeof(utsbuf));
  381|      0|		utsbuf[0].tv_sec = sb->st_atime;
  382|      0|		utsbuf[1].tv_sec = sb->st_mtime;
  383|       |
  384|      0|		(void) utimes(name, utsbuf); /* don't care if loses */
  385|       |#elif defined(HAVE_UTIME_H) || defined(HAVE_SYS_UTIME_H)
  386|       |		struct utimbuf  utbuf;
  387|       |
  388|       |		(void)memset(&utbuf, 0, sizeof(utbuf));
  389|       |		utbuf.actime = sb->st_atime;
  390|       |		utbuf.modtime = sb->st_mtime;
  391|       |		(void) utime(name, &utbuf); /* don't care if loses */
  392|       |#endif
  393|      0|	}
  394|      0|}

file_fmtdatetime:
  273|  5.74k|{
  274|  5.74k|	char *pp;
  275|  5.74k|	time_t t;
  276|  5.74k|	struct tm *tm, tmz;
  277|       |
  278|  5.74k|	if (flags & FILE_T_WINDOWS) {
  ------------------
  |  |  509|  5.74k|#define FILE_T_WINDOWS	2
  ------------------
  |  Branch (278:6): [True: 297, False: 5.44k]
  ------------------
  279|    297|		struct timespec ts;
  280|    297|		cdf_timestamp_to_timespec(&ts, CAST(cdf_timestamp_t, v));
  ------------------
  |  |  426|    297|#define CAST(T, b)	((T)(b))
  ------------------
  281|    297|		t = ts.tv_sec;
  282|  5.44k|	} else {
  283|       |		// XXX: perhaps detect and print something if overflow
  284|       |		// on 32 bit time_t?
  285|  5.44k|		t = CAST(time_t, v);
  ------------------
  |  |  426|  5.44k|#define CAST(T, b)	((T)(b))
  ------------------
  286|  5.44k|	}
  287|       |
  288|  5.74k|	if (flags & FILE_T_LOCAL) {
  ------------------
  |  |  508|  5.74k|#define FILE_T_LOCAL	1
  ------------------
  |  Branch (288:6): [True: 5.17k, False: 575]
  ------------------
  289|  5.17k|		tm = localtime_r(&t, &tmz);
  290|  5.17k|	} else {
  291|    575|		tm = gmtime_r(&t, &tmz);
  292|    575|	}
  293|  5.74k|	if (tm == NULL)
  ------------------
  |  Branch (293:6): [True: 0, False: 5.74k]
  ------------------
  294|      0|		goto out;
  295|  5.74k|	pp = asctime_r(tm, buf);
  296|       |
  297|  5.74k|	if (pp == NULL)
  ------------------
  |  Branch (297:6): [True: 104, False: 5.64k]
  ------------------
  298|    104|		goto out;
  299|  5.64k|	pp[strcspn(pp, "\n")] = '\0';
  300|  5.64k|	return pp;
  301|    104|out:
  302|    104|	strlcpy(buf, "*Invalid datetime*", bsize);
  303|    104|	return buf;
  304|  5.74k|}

file_trycdf:
  542|  11.3k|{
  543|  11.3k|	int fd = b->fd;
  544|  11.3k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  11.3k|#define CAST(T, b)	((T)(b))
  ------------------
  545|  11.3k|	size_t nbytes = b->flen;
  546|  11.3k|	cdf_info_t info;
  547|  11.3k|	cdf_header_t h;
  548|  11.3k|	cdf_sat_t sat, ssat;
  549|  11.3k|	cdf_stream_t sst, scn;
  550|  11.3k|	cdf_dir_t dir;
  551|  11.3k|	int i;
  552|  11.3k|	const char *expn = "";
  553|  11.3k|	const cdf_directory_t *root_storage;
  554|       |
  555|  11.3k|	scn.sst_tab = NULL;
  556|  11.3k|	info.i_fd = fd;
  557|  11.3k|	info.i_buf = buf;
  558|  11.3k|	info.i_len = nbytes;
  559|  11.3k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  11.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  11.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (559:6): [True: 0, False: 11.3k]
  ------------------
  560|      0|		return 0;
  561|  11.3k|	if (cdf_read_header(&info, &h) == -1)
  ------------------
  |  Branch (561:6): [True: 10.7k, False: 654]
  ------------------
  562|  10.7k|		return 0;
  563|       |#ifdef CDF_DEBUG
  564|       |	cdf_dump_header(&h);
  565|       |#endif
  566|       |
  567|    654|	if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
  ------------------
  |  Branch (567:6): [True: 152, False: 502]
  ------------------
  568|    152|		expn = "Can't read SAT";
  569|    152|		goto out0;
  570|    152|	}
  571|       |#ifdef CDF_DEBUG
  572|       |	cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
  573|       |#endif
  574|       |
  575|    502|	if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
  ------------------
  |  Branch (575:6): [True: 202, False: 300]
  ------------------
  576|    202|		expn = "Can't read SSAT";
  577|    202|		goto out1;
  578|    202|	}
  579|       |#ifdef CDF_DEBUG
  580|       |	cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
  581|       |#endif
  582|       |
  583|    300|	if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
  ------------------
  |  Branch (583:6): [True: 67, False: 233]
  ------------------
  584|     67|		expn = "Can't read directory";
  585|     67|		goto out2;
  586|     67|	}
  587|       |
  588|    233|	if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
  ------------------
  |  Branch (588:6): [True: 109, False: 124]
  ------------------
  589|    233|	    &root_storage)) == -1) {
  590|    109|		expn = "Cannot read short stream";
  591|    109|		goto out3;
  592|    109|	}
  593|       |#ifdef CDF_DEBUG
  594|       |	cdf_dump_dir(&info, &h, &sat, &ssat, &sst, &dir);
  595|       |#endif
  596|       |#ifdef notdef
  597|       |	if (root_storage) {
  598|       |		if (NOTMIME(ms)) {
  599|       |			char clsbuf[128];
  600|       |			if (file_printf(ms, "CLSID %s, ",
  601|       |			    format_clsid(clsbuf, sizeof(clsbuf),
  602|       |			    root_storage->d_storage_uuid)) == -1)
  603|       |				return -1;
  604|       |		}
  605|       |	}
  606|       |#endif
  607|       |
  608|    124|	if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (608:6): [True: 0, False: 124]
  ------------------
  609|    124|	    "FileHeader", &scn) != -1) {
  610|      0|#define HWP5_SIGNATURE "HWP Document File"
  611|      0|		if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1
  ------------------
  |  |  610|      0|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (611:7): [True: 0, False: 0]
  ------------------
  612|      0|		    && memcmp(scn.sst_tab, HWP5_SIGNATURE,
  ------------------
  |  |  610|      0|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (612:10): [True: 0, False: 0]
  ------------------
  613|      0|		    sizeof(HWP5_SIGNATURE) - 1) == 0) {
  ------------------
  |  |  610|      0|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  614|      0|		    if (NOTMIME(ms)) {
  ------------------
  |  |   42|      0|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|      0|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  615|      0|			if (file_printf(ms,
  ------------------
  |  Branch (615:8): [True: 0, False: 0]
  ------------------
  616|      0|			    "Hangul (Korean) Word Processor File 5.x") == -1)
  617|      0|			    return -1;
  618|      0|		    } else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (618:18): [True: 0, False: 0]
  ------------------
  619|      0|			if (file_printf(ms, "application/x-hwp") == -1)
  ------------------
  |  Branch (619:8): [True: 0, False: 0]
  ------------------
  620|      0|			    return -1;
  621|      0|		    }
  622|      0|		    i = 1;
  623|      0|		    goto out5;
  624|      0|		} else {
  625|      0|		    cdf_zero_stream(&scn);
  626|      0|		}
  627|      0|	}
  628|       |
  629|    124|	if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (629:6): [True: 124, False: 0]
  ------------------
  630|    124|	    &scn)) == -1) {
  631|    124|		if (errno != ESRCH) {
  ------------------
  |  Branch (631:7): [True: 0, False: 124]
  ------------------
  632|      0|			expn = "Cannot read summary info";
  633|      0|		}
  634|    124|	} else {
  635|      0|		i = cdf_check_summary_info(ms, &info, &h,
  636|      0|		    &sat, &ssat, &sst, &dir, &scn, root_storage, &expn);
  637|      0|		cdf_zero_stream(&scn);
  638|      0|	}
  639|    124|	if (i <= 0) {
  ------------------
  |  Branch (639:6): [True: 124, False: 0]
  ------------------
  640|    124|		if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat,
  ------------------
  |  Branch (640:7): [True: 124, False: 0]
  ------------------
  641|    124|		    &sst, &dir, &scn)) == -1) {
  642|    124|			if (errno != ESRCH) {
  ------------------
  |  Branch (642:8): [True: 0, False: 124]
  ------------------
  643|      0|				expn = "Cannot read summary info";
  644|      0|			}
  645|    124|		} else {
  646|      0|			i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat,
  647|      0|			    &sst, &dir, &scn, root_storage, &expn);
  648|      0|		}
  649|    124|	}
  650|    124|	if (i <= 0) {
  ------------------
  |  Branch (650:6): [True: 124, False: 0]
  ------------------
  651|    124|		i = cdf_file_dir_info(ms, &dir);
  652|    124|		if (i < 0)
  ------------------
  |  Branch (652:7): [True: 124, False: 0]
  ------------------
  653|    124|			expn = "Cannot read section info";
  654|    124|	}
  655|    124|out5:
  656|    124|	cdf_zero_stream(&scn);
  657|    124|	cdf_zero_stream(&sst);
  658|    233|out3:
  659|    233|	free(dir.dir_tab);
  660|    300|out2:
  661|    300|	free(ssat.sat_tab);
  662|    502|out1:
  663|    502|	free(sat.sat_tab);
  664|    654|out0:
  665|       |	/* If we handled it already, return */
  666|    654|	if (i != -1)
  ------------------
  |  Branch (666:6): [True: 0, False: 654]
  ------------------
  667|      0|		return i;
  668|       |	/* Provide a default handler */
  669|    654|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|    654|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    654|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    654|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    654|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 654, False: 0]
  |  |  ------------------
  ------------------
  670|    654|		if (file_printf(ms,
  ------------------
  |  Branch (670:7): [True: 0, False: 654]
  ------------------
  671|    654|		    "Composite Document File V2 Document") == -1)
  672|      0|			return -1;
  673|    654|		if (*expn)
  ------------------
  |  Branch (673:7): [True: 654, False: 0]
  ------------------
  674|    654|			if (file_printf(ms, ", %s", expn) == -1)
  ------------------
  |  Branch (674:8): [True: 0, False: 654]
  ------------------
  675|      0|				return -1;
  676|    654|	} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (676:13): [True: 0, False: 0]
  ------------------
  677|       |		/* https://reposcope.com/mimetype/application/x-ole-storage */
  678|      0|		if (file_printf(ms, "application/x-ole-storage") == -1)
  ------------------
  |  Branch (678:7): [True: 0, False: 0]
  ------------------
  679|      0|			return -1;
  680|      0|	}
  681|    654|	return 1;
  682|    654|}
readcdf.c:cdf_file_dir_info:
  513|    124|{
  514|    124|	size_t sd, j;
  515|       |
  516|    868|	for (sd = 0; sd < __arraycount(sectioninfo); sd++) {
  ------------------
  |  |  123|    868|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (516:15): [True: 744, False: 124]
  ------------------
  517|    744|		const struct sinfo *si = &sectioninfo[sd];
  518|  1.86k|		for (j = 0; si->sections[j]; j++) {
  ------------------
  |  Branch (518:15): [True: 1.11k, False: 744]
  ------------------
  519|  1.11k|			if (cdf_find_stream(dir, si->sections[j], si->types[j])
  ------------------
  |  Branch (519:8): [True: 0, False: 1.11k]
  ------------------
  520|  1.11k|			    > 0)
  521|      0|				break;
  522|       |#ifdef CDF_DEBUG
  523|       |			fprintf(stderr, "Can't read %s\n", si->sections[j]);
  524|       |#endif
  525|  1.11k|		}
  526|    744|		if (si->sections[j] == NULL)
  ------------------
  |  Branch (526:7): [True: 744, False: 0]
  ------------------
  527|    744|			continue;
  528|      0|		if (NOTMIME(ms)) {
  ------------------
  |  |   42|      0|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|      0|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  529|      0|			if (file_printf(ms, "CDFV2 %s", si->name) == -1)
  ------------------
  |  Branch (529:8): [True: 0, False: 0]
  ------------------
  530|      0|				return -1;
  531|      0|		} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (531:14): [True: 0, False: 0]
  ------------------
  532|      0|			if (file_printf(ms, "application/%s", si->mime) == -1)
  ------------------
  |  Branch (532:8): [True: 0, False: 0]
  ------------------
  533|      0|				return -1;
  534|      0|		}
  535|      0|		return 1;
  536|      0|	}
  537|    124|	return -1;
  538|    124|}

file_tryelf:
 1818|  8.28k|{
 1819|  8.28k|	int fd = b->fd;
 1820|  8.28k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  8.28k|#define CAST(T, b)	((T)(b))
  ------------------
 1821|  8.28k|	size_t nbytes = b->flen;
 1822|  8.28k|	union {
 1823|  8.28k|		int32_t l;
 1824|  8.28k|		char c[sizeof(int32_t)];
 1825|  8.28k|	} u;
 1826|  8.28k|	int clazz;
 1827|  8.28k|	int swap;
 1828|  8.28k|	struct stat st;
 1829|  8.28k|	const struct stat *stp;
 1830|  8.28k|	off_t fsize;
 1831|  8.28k|	int flags = 0;
 1832|  8.28k|	Elf32_Ehdr elf32hdr;
 1833|  8.28k|	Elf64_Ehdr elf64hdr;
 1834|  8.28k|	uint16_t type, phnum, shnum, notecount;
 1835|       |
 1836|  8.28k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  8.28k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  8.28k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (1836:6): [True: 0, False: 8.28k]
  ------------------
 1837|      0|		return 0;
 1838|       |	/*
 1839|       |	 * ELF executables have multiple section headers in arbitrary
 1840|       |	 * file locations and thus file(1) cannot determine it from easily.
 1841|       |	 * Instead we traverse thru all section headers until a symbol table
 1842|       |	 * one is found or else the binary is stripped.
 1843|       |	 * Return immediately if it's not ELF (so we avoid pipe2file unless
 1844|       |	 * needed).
 1845|       |	 */
 1846|  8.28k|	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  157|  8.28k|#define	EI_MAG0		0		/* e_ident[] indexes */
  ------------------
              	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  166|  16.5k|#define	ELFMAG0		0x7f		/* EI_MAG */
  ------------------
  |  Branch (1846:6): [True: 3.68k, False: 4.59k]
  ------------------
 1847|  8.28k|	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  4.59k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  167|  9.18k|#define	ELFMAG1		'E'
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  2.34k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  172|  2.34k|#define	OLFMAG1		'O'
  ------------------
  |  Branch (1847:10): [True: 2.34k, False: 2.24k]
  |  Branch (1847:37): [True: 23, False: 2.32k]
  ------------------
 1848|  8.28k|	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  159|  4.57k|#define	EI_MAG2		2
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  168|  12.8k|#define	ELFMAG2		'L'
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  160|  4.55k|#define	EI_MAG3		3
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  169|  4.55k|#define	ELFMAG3		'F'
  ------------------
  |  Branch (1848:9): [True: 12, False: 4.55k]
  |  Branch (1848:36): [True: 13, False: 4.54k]
  ------------------
 1849|  3.73k|		return 0;
 1850|       |
 1851|       |	/*
 1852|       |	 * If we cannot seek, it must be a pipe, socket or fifo.
 1853|       |	 */
 1854|  4.54k|	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  426|  4.54k|#define CAST(T, b)	((T)(b))
  ------------------
              	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  426|  4.54k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1854:5): [True: 0, False: 4.54k]
  ------------------
 1855|  4.54k|	    && (errno == ESPIPE))
  ------------------
  |  Branch (1855:9): [True: 0, False: 0]
  ------------------
 1856|      0|		fd = file_pipe2file(ms, fd, buf, nbytes);
 1857|       |
 1858|  4.54k|	if (fd == -1) {
  ------------------
  |  Branch (1858:6): [True: 0, False: 4.54k]
  ------------------
 1859|      0|		file_badread(ms);
 1860|      0|		return -1;
 1861|      0|	}
 1862|       |
 1863|  4.54k|	stp = &b->st;
 1864|       |	/*
 1865|       |	 * b->st.st_size != 0 if previous fstat() succeeded,
 1866|       |	 * which is likely, we can avoid extra stat() call.
 1867|       |	 */
 1868|  4.54k|	if (b->st.st_size == 0) {
  ------------------
  |  Branch (1868:6): [True: 0, False: 4.54k]
  ------------------
 1869|      0|		stp = &st;
 1870|      0|		if (fstat(fd, &st) == -1) {
  ------------------
  |  Branch (1870:7): [True: 0, False: 0]
  ------------------
 1871|      0|			file_badread(ms);
 1872|      0|			return -1;
 1873|      0|		}
 1874|      0|	}
 1875|  4.54k|	if (S_ISREG(stp->st_mode) || stp->st_size != 0)
  ------------------
  |  Branch (1875:31): [True: 0, False: 0]
  ------------------
 1876|  4.54k|		fsize = stp->st_size;
 1877|      0|	else
 1878|      0|		fsize = SIZE_UNKNOWN;
  ------------------
  |  |   66|      0|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1879|       |
 1880|  4.54k|	clazz = buf[EI_CLASS];
  ------------------
  |  |  161|  4.54k|#define	EI_CLASS	4
  ------------------
 1881|       |
 1882|  4.54k|	switch (clazz) {
 1883|  3.06k|	case ELFCLASS32:
  ------------------
  |  |  153|  3.06k|#define	ELFCLASS32	1
  ------------------
  |  Branch (1883:2): [True: 3.06k, False: 1.48k]
  ------------------
 1884|  3.06k|#undef elf_getu
 1885|  3.06k|#define elf_getu(a, b)	elf_getu32(a, b)
 1886|  3.06k|#undef elfhdr
 1887|  3.06k|#define elfhdr elf32hdr
 1888|  3.06k|#include "elfclass.h"
  ------------------
  |  |    1|       |/*
  |  |    2|       | * Copyright (c) Christos Zoulas 2008.
  |  |    3|       | * All Rights Reserved.
  |  |    4|       | *
  |  |    5|       | * Redistribution and use in source and binary forms, with or without
  |  |    6|       | * modification, are permitted provided that the following conditions
  |  |    7|       | * are met:
  |  |    8|       | * 1. Redistributions of source code must retain the above copyright
  |  |    9|       | *    notice immediately at the beginning of the file, without modification,
  |  |   10|       | *    this list of conditions, and the following disclaimer.
  |  |   11|       | * 2. Redistributions in binary form must reproduce the above copyright
  |  |   12|       | *    notice, this list of conditions and the following disclaimer in the
  |  |   13|       | *    documentation and/or other materials provided with the distribution.
  |  |   14|       | *
  |  |   15|       | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  |  |   16|       | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  |  |   17|       | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  |  |   18|       | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  |  |   19|       | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  |  |   20|       | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  |  |   21|       | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  |  |   22|       | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  |  |   23|       | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  |  |   24|       | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  |  |   25|       | * SUCH DAMAGE.
  |  |   26|       | */
  |  |   27|  3.06k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1887|  3.06k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 10, False: 3.05k]
  |  |  ------------------
  |  |   28|     10|		return 0;
  |  |   29|       |
  |  |   30|  3.05k|	u.l = 1;
  |  |   31|  3.05k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1887|  3.05k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1887|  3.05k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |   32|  3.05k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1887|  3.05k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  3.05k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  3.05k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  143|  3.05k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  3.05k|	notecount = ms->elf_notes_max;
  |  |   36|  3.05k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|  1.46k|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|  1.46k|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 1.46k, False: 1.58k]
  |  |  ------------------
  |  |   39|  1.46k|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  143|  1.46k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|  1.46k|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 23, False: 1.44k]
  |  |  ------------------
  |  |   41|     23|			return toomany(ms, "program headers", phnum);
  |  |   42|  1.44k|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  346|  1.44k|#define FLAGS_IS_CORE			0x0800
  |  |  ------------------
  |  |   43|  1.44k|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 1.44k]
  |  |  ------------------
  |  |   44|  1.44k|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  426|  1.44k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|  1.44k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  426|  1.44k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|  1.44k|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|  1.44k|		break;
  |  |   49|  1.44k|#endif
  |  |   50|  1.44k|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|  1.44k|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 1.44k, False: 1.60k]
  |  |  ------------------
  |  |   51|  1.56k|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|  1.56k|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 114, False: 2.94k]
  |  |  ------------------
  |  |   52|  1.56k|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  143|  1.56k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|  1.56k|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 8, False: 1.55k]
  |  |  ------------------
  |  |   54|      8|			return toomany(ms, "program", phnum);
  |  |   55|  1.55k|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  143|  1.55k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|  1.55k|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 11, False: 1.54k]
  |  |  ------------------
  |  |   57|     11|			return toomany(ms, "section", shnum);
  |  |   58|  1.54k|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 1, False: 1.54k]
  |  |  ------------------
  |  |   59|  1.54k|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  426|  1.54k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|  1.54k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  426|  1.54k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|  1.54k|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      1|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|  1.56k|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|  1.56k|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 20, False: 3.03k]
  |  |  ------------------
  |  |   65|  1.56k|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  143|  1.56k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|  1.56k|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 15, False: 1.54k]
  |  |  ------------------
  |  |   67|     15|			return toomany(ms, "section headers", shnum);
  |  |   68|  1.54k|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 40, False: 1.50k]
  |  |  ------------------
  |  |   69|  1.54k|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  426|  1.54k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|  1.54k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  426|  1.54k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|  1.54k|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  143|  1.54k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|  1.54k|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  426|  1.54k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|  1.54k|		    &flags, &notecount) == -1)
  |  |   74|     40|			return -1;
  |  |   75|  1.50k|		break;
  |  |   76|       |
  |  |   77|  1.50k|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 6, False: 3.04k]
  |  |  ------------------
  |  |   78|      6|		break;
  |  |   79|  3.05k|	}
  |  |   80|  2.95k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 18, False: 2.93k]
  |  |  ------------------
  |  |   81|     18|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  2.93k|	return 1;
  ------------------
 1889|  1.47k|	case ELFCLASS64:
  ------------------
  |  |  154|  1.47k|#define	ELFCLASS64	2
  ------------------
  |  Branch (1889:2): [True: 1.47k, False: 3.07k]
  ------------------
 1890|  1.47k|#undef elf_getu
 1891|  1.47k|#define elf_getu(a, b)	elf_getu64(a, b)
 1892|  1.47k|#undef elfhdr
 1893|  1.47k|#define elfhdr elf64hdr
 1894|  1.47k|#include "elfclass.h"
  ------------------
  |  |    1|       |/*
  |  |    2|       | * Copyright (c) Christos Zoulas 2008.
  |  |    3|       | * All Rights Reserved.
  |  |    4|       | *
  |  |    5|       | * Redistribution and use in source and binary forms, with or without
  |  |    6|       | * modification, are permitted provided that the following conditions
  |  |    7|       | * are met:
  |  |    8|       | * 1. Redistributions of source code must retain the above copyright
  |  |    9|       | *    notice immediately at the beginning of the file, without modification,
  |  |   10|       | *    this list of conditions, and the following disclaimer.
  |  |   11|       | * 2. Redistributions in binary form must reproduce the above copyright
  |  |   12|       | *    notice, this list of conditions and the following disclaimer in the
  |  |   13|       | *    documentation and/or other materials provided with the distribution.
  |  |   14|       | *
  |  |   15|       | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  |  |   16|       | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  |  |   17|       | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  |  |   18|       | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  |  |   19|       | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  |  |   20|       | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  |  |   21|       | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  |  |   22|       | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  |  |   23|       | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  |  |   24|       | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  |  |   25|       | * SUCH DAMAGE.
  |  |   26|       | */
  |  |   27|  1.47k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1893|  1.47k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 4, False: 1.46k]
  |  |  ------------------
  |  |   28|      4|		return 0;
  |  |   29|       |
  |  |   30|  1.46k|	u.l = 1;
  |  |   31|  1.46k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1893|  1.46k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1893|  1.46k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |   32|  1.46k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1893|  1.46k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  1.46k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  1.46k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  143|  1.46k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  1.46k|	notecount = ms->elf_notes_max;
  |  |   36|  1.46k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|    296|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|    296|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 296, False: 1.17k]
  |  |  ------------------
  |  |   39|    296|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  143|    296|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|    296|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 23, False: 273]
  |  |  ------------------
  |  |   41|     23|			return toomany(ms, "program headers", phnum);
  |  |   42|    273|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  346|    273|#define FLAGS_IS_CORE			0x0800
  |  |  ------------------
  |  |   43|    273|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 273]
  |  |  ------------------
  |  |   44|    273|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  426|    273|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|    273|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  426|    273|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|    273|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|    273|		break;
  |  |   49|    273|#endif
  |  |   50|    273|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|    267|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 267, False: 1.20k]
  |  |  ------------------
  |  |   51|  1.14k|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|  1.14k|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 880, False: 588]
  |  |  ------------------
  |  |   52|  1.14k|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  143|  1.14k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|  1.14k|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 22, False: 1.12k]
  |  |  ------------------
  |  |   54|     22|			return toomany(ms, "program", phnum);
  |  |   55|  1.12k|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  143|  1.12k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|  1.12k|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 5, False: 1.12k]
  |  |  ------------------
  |  |   57|      5|			return toomany(ms, "section", shnum);
  |  |   58|  1.12k|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 1, False: 1.11k]
  |  |  ------------------
  |  |   59|  1.12k|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  426|  1.12k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|  1.12k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  426|  1.12k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|  1.12k|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      1|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|  1.14k|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|  1.14k|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 22, False: 1.44k]
  |  |  ------------------
  |  |   65|  1.14k|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  143|  1.14k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|  1.14k|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 19, False: 1.12k]
  |  |  ------------------
  |  |   67|     19|			return toomany(ms, "section headers", shnum);
  |  |   68|  1.12k|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 58, False: 1.06k]
  |  |  ------------------
  |  |   69|  1.12k|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  426|  1.12k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|  1.12k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  426|  1.12k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|  1.12k|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  143|  1.12k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|  1.12k|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  426|  1.12k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|  1.12k|		    &flags, &notecount) == -1)
  |  |   74|     58|			return -1;
  |  |   75|  1.06k|		break;
  |  |   76|       |
  |  |   77|  1.06k|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 3, False: 1.46k]
  |  |  ------------------
  |  |   78|      3|		break;
  |  |   79|  1.46k|	}
  |  |   80|  1.34k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 1, False: 1.33k]
  |  |  ------------------
  |  |   81|      1|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  1.33k|	return 1;
  ------------------
 1895|     10|	default:
  ------------------
  |  Branch (1895:2): [True: 10, False: 4.53k]
  ------------------
 1896|     10|	    if (file_printf(ms, ", unknown class %d", clazz) == -1)
  ------------------
  |  Branch (1896:10): [True: 0, False: 10]
  ------------------
 1897|      0|		    return -1;
 1898|     10|	    break;
 1899|  4.54k|	}
 1900|     10|	return 0;
 1901|  4.54k|}
readelf.c:getu16:
   80|  26.7k|{
   81|  26.7k|	union {
   82|  26.7k|		uint16_t ui;
   83|  26.7k|		char c[2];
   84|  26.7k|	} retval, tmpval;
   85|       |
   86|  26.7k|	if (swap) {
  ------------------
  |  Branch (86:6): [True: 16.7k, False: 9.97k]
  ------------------
   87|  16.7k|		tmpval.ui = value;
   88|       |
   89|  16.7k|		retval.c[0] = tmpval.c[1];
   90|  16.7k|		retval.c[1] = tmpval.c[0];
   91|       |
   92|  16.7k|		return retval.ui;
   93|  16.7k|	} else
   94|  9.97k|		return value;
   95|  26.7k|}
readelf.c:toomany:
   70|    145|{
   71|    145|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|    145|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    145|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    145|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (71:6): [True: 0, False: 145]
  ------------------
   72|      0|		return 1;
   73|    145|	if (file_printf(ms, ", too many %s (%u)", name, num) == -1)
  ------------------
  |  Branch (73:6): [True: 0, False: 145]
  ------------------
   74|      0|		return -1;
   75|    145|	return 1;
   76|    145|}
readelf.c:dophn_core:
  352|  1.71k|{
  353|  1.71k|	Elf32_Phdr ph32;
  354|  1.71k|	Elf64_Phdr ph64;
  355|  1.71k|	size_t offset, len;
  356|  1.71k|	unsigned char nbuf[BUFSIZ];
  357|  1.71k|	ssize_t bufsize;
  358|  1.71k|	off_t ph_off = off, offs;
  359|  1.71k|	int ph_num = num;
  360|       |
  361|  1.71k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  1.71k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.71k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.71k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (361:6): [True: 0, False: 1.71k]
  ------------------
  362|      0|		return 0;
  363|       |
  364|  1.71k|	if (num == 0) {
  ------------------
  |  Branch (364:6): [True: 4, False: 1.71k]
  ------------------
  365|      4|		if (file_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (365:7): [True: 0, False: 4]
  ------------------
  366|      0|			return -1;
  367|      4|		return 0;
  368|      4|	}
  369|  1.71k|	if (size != xph_sizeof) {
  ------------------
  |  |  169|  1.71k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.71k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (169:21): [True: 1.44k, False: 271]
  |  |  ------------------
  |  |  170|  1.71k|			 ? sizeof(ph32)				\
  |  |  171|  1.71k|			 : sizeof(ph64))
  ------------------
  |  Branch (369:6): [True: 27, False: 1.68k]
  ------------------
  370|     27|		if (file_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (370:7): [True: 0, False: 27]
  ------------------
  371|      0|			return -1;
  372|     27|		return 0;
  373|     27|	}
  374|       |
  375|       |	/*
  376|       |	 * Loop through all the program headers.
  377|       |	 */
  378|  43.2k|	for ( ; num; num--) {
  ------------------
  |  Branch (378:10): [True: 43.1k, False: 82]
  ------------------
  379|  43.1k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  166|  43.1k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  43.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (166:19): [True: 31.3k, False: 11.8k]
  |  |  ------------------
  |  |  167|  43.1k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  426|  31.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  168|  43.1k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  426|  11.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  169|  43.1k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  43.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (169:21): [True: 31.3k, False: 11.8k]
  |  |  ------------------
  |  |  170|  43.1k|			 ? sizeof(ph32)				\
  |  |  171|  43.1k|			 : sizeof(ph64))
  ------------------
  |  Branch (379:7): [True: 1.53k, False: 41.6k]
  ------------------
  380|  43.1k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  426|  86.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 31.3k, False: 11.8k]
  |  |  ------------------
  ------------------
  381|  1.53k|			if (file_printf(ms, 
  ------------------
  |  Branch (381:8): [True: 0, False: 1.53k]
  ------------------
  382|  1.53k|			    ", can't read elf program headers at %jd",
  383|  1.53k|			    (intmax_t)off) == -1)
  384|      0|				return -1;
  385|  1.53k|			return 0;
  386|  1.53k|		}
  387|  41.6k|		off += size;
  388|       |
  389|  41.6k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   66|  41.6k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  426|  83.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  175|  41.6k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  83.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 30.0k, False: 11.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  176|  41.6k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  177|  41.6k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (389:7): [True: 41.6k, False: 0]
  |  Branch (389:32): [True: 21.2k, False: 20.3k]
  ------------------
  390|       |			/* Perhaps warn here */
  391|  21.2k|			continue;
  392|  21.2k|		}
  393|       |
  394|  20.3k|		if (xph_type != PT_NOTE)
  ------------------
  |  |  172|  20.3k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (172:19): [True: 15.8k, False: 4.52k]
  |  |  ------------------
  |  |  173|  20.3k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  144|  15.8k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  174|  20.3k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  144|  4.52k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
              		if (xph_type != PT_NOTE)
  ------------------
  |  |  201|  20.3k|#define	PT_NOTE		4
  ------------------
  |  Branch (394:7): [True: 15.0k, False: 5.35k]
  ------------------
  395|  15.0k|			continue;
  396|       |
  397|       |		/*
  398|       |		 * This is a PT_NOTE section; loop through all the notes
  399|       |		 * in the section.
  400|       |		 */
  401|  5.35k|		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  188|  5.35k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  10.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 4.70k, False: 651]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  5.35k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  190|  5.35k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  188|    574|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  1.14k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 471, False: 103]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  5.35k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  190|  5.35k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (401:9): [True: 574, False: 4.78k]
  ------------------
  402|  5.35k|		offs = xph_offset;
  ------------------
  |  |  175|  5.35k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  10.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 4.70k, False: 651]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  176|  5.35k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  177|  5.35k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  403|  5.35k|		if ((bufsize = pread(fd, nbuf, len, offs)) == -1) {
  ------------------
  |  Branch (403:7): [True: 68, False: 5.28k]
  ------------------
  404|     68|			if (file_printf(ms, " can't read note section at %jd",
  ------------------
  |  Branch (404:8): [True: 0, False: 68]
  ------------------
  405|     68|			    (intmax_t)offs) == -1)
  406|      0|				return -1;
  407|     68|			return 0;
  408|     68|		}
  409|  5.28k|		offset = 0;
  410|  16.3k|		for (;;) {
  411|  16.3k|			if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  426|  16.3k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (411:8): [True: 4.13k, False: 12.2k]
  ------------------
  412|  4.13k|				break;
  413|  12.2k|			offset = donote(ms, nbuf, offset, CAST(size_t, bufsize),
  ------------------
  |  |  426|  12.2k|#define CAST(T, b)	((T)(b))
  ------------------
  414|  12.2k|			    clazz, swap, 4, flags, notecount, fd, ph_off,
  415|  12.2k|			    ph_num, fsize);
  416|  12.2k|			if (offset == 0)
  ------------------
  |  Branch (416:8): [True: 1.14k, False: 11.1k]
  ------------------
  417|  1.14k|				break;
  418|       |
  419|  12.2k|		}
  420|  5.28k|	}
  421|     82|	return 0;
  422|  1.68k|}
readelf.c:donote:
 1162|  22.5k|{
 1163|  22.5k|	Elf32_Nhdr nh32;
 1164|  22.5k|	Elf64_Nhdr nh64;
 1165|  22.5k|	size_t noff, doff;
 1166|  22.5k|	uint32_t namesz, descsz;
 1167|  22.5k|	char buf[256];
 1168|  22.5k|	unsigned char *nbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  426|  22.5k|#define CAST(T, b)	((T)(b))
  ------------------
 1169|       |
 1170|  22.5k|	if (*notecount == 0)
  ------------------
  |  Branch (1170:6): [True: 230, False: 22.3k]
  ------------------
 1171|    230|		return 0;
 1172|  22.3k|	--*notecount;
 1173|       |
 1174|  22.3k|	if (xnh_sizeof + offset > size) {
  ------------------
  |  |  197|  22.3k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  22.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:21): [True: 20.6k, False: 1.69k]
  |  |  ------------------
  |  |  198|  22.3k|			 ? sizeof(nh32)				\
  |  |  199|  22.3k|			 : sizeof(nh64))
  ------------------
  |  Branch (1174:6): [True: 1.03k, False: 21.3k]
  ------------------
 1175|       |		/*
 1176|       |		 * We're out of note headers.
 1177|       |		 */
 1178|  1.03k|		return xnh_sizeof + offset;
  ------------------
  |  |  197|  1.03k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.03k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:21): [True: 943, False: 93]
  |  |  ------------------
  |  |  198|  1.03k|			 ? sizeof(nh32)				\
  |  |  199|  1.03k|			 : sizeof(nh64))
  ------------------
 1179|  1.03k|	}
 1180|       |	/*XXX: GCC */
 1181|  21.3k|	memset(&nh32, 0, sizeof(nh32));
 1182|  21.3k|	memset(&nh64, 0, sizeof(nh64));
 1183|       |
 1184|  21.3k|	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  194|  21.3k|#define xnh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  21.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (194:19): [True: 19.7k, False: 1.60k]
  |  |  ------------------
  |  |  195|  21.3k|			 ? CAST(void *, &nh32)			\
  |  |  ------------------
  |  |  |  |  426|  19.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  196|  21.3k|			 : CAST(void *, &nh64))
  |  |  ------------------
  |  |  |  |  426|  1.60k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  197|  21.3k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  21.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:21): [True: 19.7k, False: 1.60k]
  |  |  ------------------
  |  |  198|  21.3k|			 ? sizeof(nh32)				\
  |  |  199|  21.3k|			 : sizeof(nh64))
  ------------------
 1185|  21.3k|	offset += xnh_sizeof;
  ------------------
  |  |  197|  21.3k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  21.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:21): [True: 19.7k, False: 1.60k]
  |  |  ------------------
  |  |  198|  21.3k|			 ? sizeof(nh32)				\
  |  |  199|  21.3k|			 : sizeof(nh64))
  ------------------
 1186|       |
 1187|  21.3k|	namesz = xnh_namesz;
  ------------------
  |  |  203|  21.3k|#define xnh_namesz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  21.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (203:21): [True: 19.7k, False: 1.60k]
  |  |  ------------------
  |  |  204|  21.3k|			 ? elf_getu32(swap, nh32.n_namesz)	\
  |  |  ------------------
  |  |  |  |  144|  19.7k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  205|  21.3k|			 : elf_getu32(swap, nh64.n_namesz))
  |  |  ------------------
  |  |  |  |  144|  1.60k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1188|  21.3k|	descsz = xnh_descsz;
  ------------------
  |  |  206|  21.3k|#define xnh_descsz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  21.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (206:21): [True: 19.7k, False: 1.60k]
  |  |  ------------------
  |  |  207|  21.3k|			 ? elf_getu32(swap, nh32.n_descsz)	\
  |  |  ------------------
  |  |  |  |  144|  19.7k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  208|  21.3k|			 : elf_getu32(swap, nh64.n_descsz))
  |  |  ------------------
  |  |  |  |  144|  1.60k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1189|       |
 1190|  21.3k|	if ((namesz == 0) && (descsz == 0)) {
  ------------------
  |  Branch (1190:6): [True: 5.79k, False: 15.5k]
  |  Branch (1190:23): [True: 671, False: 5.12k]
  ------------------
 1191|       |		/*
 1192|       |		 * We're out of note headers.
 1193|       |		 */
 1194|    671|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1194:10): [True: 44, False: 627]
  ------------------
 1195|    671|	}
 1196|       |
 1197|  20.6k|	if (namesz & 0x80000000) {
  ------------------
  |  Branch (1197:6): [True: 739, False: 19.9k]
  ------------------
 1198|    739|	    (void)file_printf(ms, ", bad note name size %#lx",
 1199|    739|		CAST(unsigned long, namesz));
  ------------------
  |  |  426|    739|#define CAST(T, b)	((T)(b))
  ------------------
 1200|    739|	    return 0;
 1201|    739|	}
 1202|       |
 1203|  19.9k|	if (descsz & 0x80000000) {
  ------------------
  |  Branch (1203:6): [True: 1.07k, False: 18.8k]
  ------------------
 1204|  1.07k|		(void)file_printf(ms, ", bad note description size %#lx",
 1205|  1.07k|		    CAST(unsigned long, descsz));
  ------------------
  |  |  426|  1.07k|#define CAST(T, b)	((T)(b))
  ------------------
 1206|  1.07k|		return 0;
 1207|  1.07k|	}
 1208|       |
 1209|  18.8k|	noff = offset;
 1210|  18.8k|	doff = ELF_ALIGN(offset + namesz);
  ------------------
  |  |   55|  18.8k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1211|       |
 1212|  18.8k|	if (offset + namesz > size) {
  ------------------
  |  Branch (1212:6): [True: 2.78k, False: 16.0k]
  ------------------
 1213|       |		/*
 1214|       |		 * We're past the end of the buffer.
 1215|       |		 */
 1216|  2.78k|		return doff;
 1217|  2.78k|	}
 1218|       |
 1219|  16.0k|	offset = ELF_ALIGN(doff + descsz);
  ------------------
  |  |   55|  16.0k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1220|  16.0k|	if (doff + descsz > size) {
  ------------------
  |  Branch (1220:6): [True: 1.69k, False: 14.3k]
  ------------------
 1221|       |		/*
 1222|       |		 * We're past the end of the buffer.
 1223|       |		 */
 1224|  1.69k|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1224:10): [True: 1.63k, False: 61]
  ------------------
 1225|  1.69k|	}
 1226|       |
 1227|       |
 1228|  14.3k|	if ((*flags & FLAGS_DID_OS_NOTE) == 0) {
  ------------------
  |  |  338|  14.3k|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  |  Branch (1228:6): [True: 14.0k, False: 268]
  ------------------
 1229|  14.0k|		if (do_os_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  200|  14.0k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  14.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (200:19): [True: 13.4k, False: 692]
  |  |  ------------------
  |  |  201|  14.0k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  144|  13.4k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  202|  14.0k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  144|    692|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1229:7): [True: 99, False: 13.9k]
  ------------------
 1230|  14.0k|		    namesz, descsz, noff, doff, flags))
 1231|     99|			return offset;
 1232|  14.0k|	}
 1233|       |
 1234|  14.2k|	if ((*flags & FLAGS_DID_BUILD_ID) == 0) {
  ------------------
  |  |  339|  14.2k|#define FLAGS_DID_BUILD_ID		0x0010
  ------------------
  |  Branch (1234:6): [True: 14.0k, False: 202]
  ------------------
 1235|  14.0k|		if (do_bid_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  200|  14.0k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  14.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (200:19): [True: 13.3k, False: 692]
  |  |  ------------------
  |  |  201|  14.0k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  144|  13.3k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  202|  14.0k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  144|    692|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1235:7): [True: 86, False: 13.9k]
  ------------------
 1236|  14.0k|		    namesz, descsz, noff, doff, flags))
 1237|     86|			return offset;
 1238|  14.0k|	}
 1239|       |
 1240|  14.1k|	if ((*flags & FLAGS_DID_NETBSD_PAX) == 0) {
  ------------------
  |  |  341|  14.1k|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  |  Branch (1240:6): [True: 13.9k, False: 213]
  ------------------
 1241|  13.9k|		if (do_pax_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  200|  13.9k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  13.9k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (200:19): [True: 13.2k, False: 692]
  |  |  ------------------
  |  |  201|  13.9k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  144|  13.2k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  202|  13.9k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  144|    692|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1241:7): [True: 14, False: 13.9k]
  ------------------
 1242|  13.9k|		    namesz, descsz, noff, doff, flags))
 1243|     14|			return offset;
 1244|  13.9k|	}
 1245|       |
 1246|  14.1k|	if ((*flags & FLAGS_DID_CORE) == 0) {
  ------------------
  |  |  337|  14.1k|#define FLAGS_DID_CORE			0x0004
  ------------------
  |  Branch (1246:6): [True: 13.6k, False: 513]
  ------------------
 1247|  13.6k|		if (do_core_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  200|  13.6k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  13.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (200:19): [True: 12.9k, False: 691]
  |  |  ------------------
  |  |  201|  13.6k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  144|  12.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  202|  13.6k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  144|    691|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1247:7): [True: 89, False: 13.5k]
  ------------------
 1248|  13.6k|		    namesz, descsz, noff, doff, flags, size, clazz))
 1249|     89|			return offset;
 1250|  13.6k|	}
 1251|       |
 1252|  14.0k|	if ((*flags & FLAGS_DID_AUXV) == 0) {
  ------------------
  |  |  347|  14.0k|#define FLAGS_DID_AUXV			0x1000
  ------------------
  |  Branch (1252:6): [True: 13.7k, False: 293]
  ------------------
 1253|  13.7k|		if (do_auxv_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  200|  13.7k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  13.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (200:19): [True: 13.1k, False: 683]
  |  |  ------------------
  |  |  201|  13.7k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  144|  13.1k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  202|  13.7k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  144|    683|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1253:7): [True: 405, False: 13.3k]
  ------------------
 1254|  13.7k|			namesz, descsz, noff, doff, flags, size, clazz,
 1255|  13.7k|			fd, ph_off, ph_num, fsize))
 1256|    405|			return offset;
 1257|  13.7k|	}
 1258|       |
 1259|  13.6k|	if (namesz == 7 && strcmp(RCAST(char *, &nbuf[noff]), "NetBSD") == 0) {
  ------------------
  |  |  427|    868|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (1259:6): [True: 868, False: 12.8k]
  |  Branch (1259:21): [True: 587, False: 281]
  ------------------
 1260|    587|		int descw, flag;
 1261|    587|		const char *str, *tag;
 1262|    587|		if (descsz > 100)
  ------------------
  |  Branch (1262:7): [True: 220, False: 367]
  ------------------
 1263|    220|			descsz = 100;
 1264|    587|		switch (xnh_type) {
  ------------------
  |  |  200|    587|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    587|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (200:19): [True: 587, False: 0]
  |  |  ------------------
  |  |  201|    587|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  144|    587|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  202|    587|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  144|      0|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1265|     89|	    	case NT_NETBSD_VERSION:
  ------------------
  |  |  285|     89|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (1265:7): [True: 89, False: 498]
  ------------------
 1266|     89|			return offset;
 1267|     74|		case NT_NETBSD_MARCH:
  ------------------
  |  |  346|     74|#define NT_NETBSD_MARCH		5
  ------------------
  |  Branch (1267:3): [True: 74, False: 513]
  ------------------
 1268|     74|			flag = FLAGS_DID_NETBSD_MARCH;
  ------------------
  |  |  342|     74|#define FLAGS_DID_NETBSD_MARCH		0x0080
  ------------------
 1269|     74|			tag = "compiled for";
 1270|     74|			break;
 1271|     84|		case NT_NETBSD_CMODEL:
  ------------------
  |  |  356|     84|#define NT_NETBSD_CMODEL	6
  ------------------
  |  Branch (1271:3): [True: 84, False: 503]
  ------------------
 1272|     84|			flag = FLAGS_DID_NETBSD_CMODEL;
  ------------------
  |  |  343|     84|#define FLAGS_DID_NETBSD_CMODEL		0x0100
  ------------------
 1273|     84|			tag = "compiler model";
 1274|     84|			break;
 1275|     34|		case NT_NETBSD_EMULATION:
  ------------------
  |  |  286|     34|#define	NT_NETBSD_EMULATION	2
  ------------------
  |  Branch (1275:3): [True: 34, False: 553]
  ------------------
 1276|     34|			flag = FLAGS_DID_NETBSD_EMULATION;
  ------------------
  |  |  344|     34|#define FLAGS_DID_NETBSD_EMULATION	0x0200
  ------------------
 1277|     34|			tag = "emulation:";
 1278|     34|			break;
 1279|    306|		default:
  ------------------
  |  Branch (1279:3): [True: 306, False: 281]
  ------------------
 1280|    306|			if (*flags & FLAGS_DID_NETBSD_UNKNOWN)
  ------------------
  |  |  345|    306|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
  |  Branch (1280:8): [True: 250, False: 56]
  ------------------
 1281|    250|				return offset;
 1282|     56|			*flags |= FLAGS_DID_NETBSD_UNKNOWN;
  ------------------
  |  |  345|     56|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
 1283|     56|			if (file_printf(ms, ", note=%u", xnh_type) == -1)
  ------------------
  |  |  200|     56|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|     56|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (200:19): [True: 56, False: 0]
  |  |  ------------------
  |  |  201|     56|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  144|     56|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  202|     56|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  144|      0|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1283:8): [True: 0, False: 56]
  ------------------
 1284|      0|				return offset;
 1285|     56|			return offset;
 1286|    587|		}
 1287|       |
 1288|    192|		if (*flags & flag)
  ------------------
  |  Branch (1288:7): [True: 169, False: 23]
  ------------------
 1289|    169|			return offset;
 1290|     23|		str = RCAST(const char *, &nbuf[doff]);
  ------------------
  |  |  427|     23|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1291|     23|		descw = CAST(int, descsz);
  ------------------
  |  |  426|     23|#define CAST(T, b)	((T)(b))
  ------------------
 1292|     23|		*flags |= flag;
 1293|     23|		file_printf(ms, ", %s: %s", tag,
 1294|     23|		    file_copystr(buf, sizeof(buf), descw, str));
 1295|     23|		return offset;
 1296|    192|	}
 1297|       |
 1298|  13.0k|	return offset;
 1299|  13.6k|}
readelf.c:do_os_note:
  600|  14.0k|{
  601|  14.0k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  427|  14.0k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  602|       |
  603|  14.0k|	if (namesz == 5 && strcmp(name, "SuSE") == 0 &&
  ------------------
  |  Branch (603:6): [True: 447, False: 13.6k]
  |  Branch (603:21): [True: 96, False: 351]
  ------------------
  604|  14.0k|		type == NT_GNU_VERSION && descsz == 2) {
  ------------------
  |  |  297|  14.1k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (604:3): [True: 0, False: 96]
  |  Branch (604:29): [True: 0, False: 0]
  ------------------
  605|      0|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  338|      0|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  606|      0|		if (file_printf(ms, ", for SuSE %d.%d", nbuf[doff],
  ------------------
  |  Branch (606:7): [True: 0, False: 0]
  ------------------
  607|      0|		    nbuf[doff + 1]) == -1)
  608|      0|		    return -1;
  609|      0|	    return 1;
  610|      0|	}
  611|       |
  612|  14.0k|	if (namesz == 4 && strcmp(name, "GNU") == 0 &&
  ------------------
  |  Branch (612:6): [True: 5.59k, False: 8.49k]
  |  Branch (612:21): [True: 497, False: 5.10k]
  ------------------
  613|  14.0k|	    type == NT_GNU_VERSION && descsz == 16) {
  ------------------
  |  |  297|  14.5k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (613:6): [True: 76, False: 421]
  |  Branch (613:32): [True: 10, False: 66]
  ------------------
  614|     10|		uint32_t desc[4];
  615|     10|		memcpy(desc, &nbuf[doff], sizeof(desc));
  616|       |
  617|     10|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  338|     10|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  618|     10|		if (file_printf(ms, ", for GNU/") == -1)
  ------------------
  |  Branch (618:7): [True: 0, False: 10]
  ------------------
  619|      0|			return -1;
  620|     10|		switch (elf_getu32(swap, desc[0])) {
  ------------------
  |  |  144|     10|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  621|      4|		case GNU_OS_LINUX:
  ------------------
  |  |  300|      4|#define	GNU_OS_LINUX	0
  ------------------
  |  Branch (621:3): [True: 4, False: 6]
  ------------------
  622|      4|			if (file_printf(ms, "Linux") == -1)
  ------------------
  |  Branch (622:8): [True: 0, False: 4]
  ------------------
  623|      0|				return -1;
  624|      4|			break;
  625|      4|		case GNU_OS_HURD:
  ------------------
  |  |  301|      1|#define	GNU_OS_HURD	1
  ------------------
  |  Branch (625:3): [True: 1, False: 9]
  ------------------
  626|      1|			if (file_printf(ms, "Hurd") == -1)
  ------------------
  |  Branch (626:8): [True: 0, False: 1]
  ------------------
  627|      0|				return -1;
  628|      1|			break;
  629|      1|		case GNU_OS_SOLARIS:
  ------------------
  |  |  302|      1|#define	GNU_OS_SOLARIS	2
  ------------------
  |  Branch (629:3): [True: 1, False: 9]
  ------------------
  630|      1|			if (file_printf(ms, "Solaris") == -1)
  ------------------
  |  Branch (630:8): [True: 0, False: 1]
  ------------------
  631|      0|				return -1;
  632|      1|			break;
  633|      1|		case GNU_OS_KFREEBSD:
  ------------------
  |  |  303|      1|#define	GNU_OS_KFREEBSD	3
  ------------------
  |  Branch (633:3): [True: 1, False: 9]
  ------------------
  634|      1|			if (file_printf(ms, "kFreeBSD") == -1)
  ------------------
  |  Branch (634:8): [True: 0, False: 1]
  ------------------
  635|      0|				return -1;
  636|      1|			break;
  637|      1|		case GNU_OS_KNETBSD:
  ------------------
  |  |  304|      1|#define	GNU_OS_KNETBSD	4
  ------------------
  |  Branch (637:3): [True: 1, False: 9]
  ------------------
  638|      1|			if (file_printf(ms, "kNetBSD") == -1)
  ------------------
  |  Branch (638:8): [True: 0, False: 1]
  ------------------
  639|      0|				return -1;
  640|      1|			break;
  641|      2|		default:
  ------------------
  |  Branch (641:3): [True: 2, False: 8]
  ------------------
  642|      2|			if (file_printf(ms, "<unknown>") == -1)
  ------------------
  |  Branch (642:8): [True: 0, False: 2]
  ------------------
  643|      0|				return -1;
  644|     10|		}
  645|     10|		if (file_printf(ms, " %d.%d.%d", elf_getu32(swap, desc[1]),
  ------------------
  |  |  144|     10|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  |  Branch (645:7): [True: 0, False: 10]
  ------------------
  646|     10|		    elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1)
  ------------------
  |  |  144|     10|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
              		    elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1)
  ------------------
  |  |  144|     10|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  647|      0|			return -1;
  648|     10|		return 1;
  649|     10|	}
  650|       |
  651|  14.0k|	if (namesz == 7 && strcmp(name, "NetBSD") == 0) {
  ------------------
  |  Branch (651:6): [True: 883, False: 13.2k]
  |  Branch (651:21): [True: 602, False: 281]
  ------------------
  652|    602|	    	if (type == NT_NETBSD_VERSION && descsz == 4) {
  ------------------
  |  |  285|  1.20k|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (652:11): [True: 104, False: 498]
  |  Branch (652:40): [True: 33, False: 71]
  ------------------
  653|     33|			*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  338|     33|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  654|     33|			if (do_note_netbsd_version(ms, swap, &nbuf[doff]) == -1)
  ------------------
  |  Branch (654:8): [True: 0, False: 33]
  ------------------
  655|      0|				return -1;
  656|     33|			return 1;
  657|     33|		}
  658|    602|	}
  659|       |
  660|  14.0k|	if (namesz == 8 && strcmp(name, "FreeBSD") == 0) {
  ------------------
  |  Branch (660:6): [True: 688, False: 13.3k]
  |  Branch (660:21): [True: 195, False: 493]
  ------------------
  661|    195|	    	if (type == NT_FREEBSD_VERSION && descsz == 4) {
  ------------------
  |  |  287|    390|#define	NT_FREEBSD_VERSION	1
  ------------------
  |  Branch (661:11): [True: 67, False: 128]
  |  Branch (661:41): [True: 55, False: 12]
  ------------------
  662|     55|			*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  338|     55|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  663|     55|			if (do_note_freebsd_version(ms, swap, &nbuf[doff])
  ------------------
  |  Branch (663:8): [True: 0, False: 55]
  ------------------
  664|     55|			    == -1)
  665|      0|				return -1;
  666|     55|			return 1;
  667|     55|		}
  668|    195|	}
  669|       |
  670|  13.9k|	if (namesz == 8 && strcmp(name, "OpenBSD") == 0 &&
  ------------------
  |  Branch (670:6): [True: 633, False: 13.3k]
  |  Branch (670:21): [True: 111, False: 522]
  ------------------
  671|  13.9k|	    type == NT_OPENBSD_VERSION && descsz == 4) {
  ------------------
  |  |  288|  14.1k|#define	NT_OPENBSD_VERSION	1
  ------------------
  |  Branch (671:6): [True: 3, False: 108]
  |  Branch (671:36): [True: 1, False: 2]
  ------------------
  672|      1|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  338|      1|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  673|      1|		if (file_printf(ms, ", for OpenBSD") == -1)
  ------------------
  |  Branch (673:7): [True: 0, False: 1]
  ------------------
  674|      0|			return -1;
  675|       |		/* Content of note is always 0 */
  676|      1|		return 1;
  677|      1|	}
  678|       |
  679|  13.9k|	if (namesz == 10 && strcmp(name, "DragonFly") == 0 &&
  ------------------
  |  Branch (679:6): [True: 269, False: 13.7k]
  |  Branch (679:22): [True: 147, False: 122]
  ------------------
  680|  13.9k|	    type == NT_DRAGONFLY_VERSION && descsz == 4) {
  ------------------
  |  |  289|  14.1k|#define	NT_DRAGONFLY_VERSION	1
  ------------------
  |  Branch (680:6): [True: 66, False: 81]
  |  Branch (680:38): [True: 0, False: 66]
  ------------------
  681|      0|		uint32_t desc;
  682|      0|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  338|      0|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  683|      0|		if (file_printf(ms, ", for DragonFly") == -1)
  ------------------
  |  Branch (683:7): [True: 0, False: 0]
  ------------------
  684|      0|			return -1;
  685|      0|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  686|      0|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  144|      0|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  687|      0|		if (file_printf(ms, " %d.%d.%d", desc / 100000,
  ------------------
  |  Branch (687:7): [True: 0, False: 0]
  ------------------
  688|      0|		    desc / 10000 % 10, desc % 10000) == -1)
  689|      0|			return -1;
  690|      0|		return 1;
  691|      0|	}
  692|  13.9k|	return 0;
  693|  13.9k|}
readelf.c:do_note_netbsd_version:
  427|     33|{
  428|     33|	uint32_t desc;
  429|     33|	memcpy(&desc, v, sizeof(desc));
  430|     33|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  144|     33|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  431|       |
  432|     33|	if (file_printf(ms, ", for NetBSD") == -1)
  ------------------
  |  Branch (432:6): [True: 0, False: 33]
  ------------------
  433|      0|		return -1;
  434|       |	/*
  435|       |	 * The version number used to be stuck as 199905, and was thus
  436|       |	 * basically content-free.  Newer versions of NetBSD have fixed
  437|       |	 * this and now use the encoding of __NetBSD_Version__:
  438|       |	 *
  439|       |	 *	MMmmrrpp00
  440|       |	 *
  441|       |	 * M = major version
  442|       |	 * m = minor version
  443|       |	 * r = release ["",A-Z,Z[A-Z] but numeric]
  444|       |	 * p = patchlevel
  445|       |	 */
  446|     33|	if (desc > 100000000U) {
  ------------------
  |  Branch (446:6): [True: 25, False: 8]
  ------------------
  447|     25|		uint32_t ver_patch = (desc / 100) % 100;
  448|     25|		uint32_t ver_rel = (desc / 10000) % 100;
  449|     25|		uint32_t ver_min = (desc / 1000000) % 100;
  450|     25|		uint32_t ver_maj = desc / 100000000;
  451|       |
  452|     25|		if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
  ------------------
  |  Branch (452:7): [True: 0, False: 25]
  ------------------
  453|      0|			return -1;
  454|     25|		if (ver_maj >= 9) {
  ------------------
  |  Branch (454:7): [True: 13, False: 12]
  ------------------
  455|     13|			ver_patch += 100 * ver_rel;
  456|     13|			ver_rel = 0;
  457|     13|		}
  458|     25|		if (ver_rel == 0 && ver_patch != 0) {
  ------------------
  |  Branch (458:7): [True: 14, False: 11]
  |  Branch (458:23): [True: 13, False: 1]
  ------------------
  459|     13|			if (file_printf(ms, ".%u", ver_patch) == -1)
  ------------------
  |  Branch (459:8): [True: 0, False: 13]
  ------------------
  460|      0|				return -1;
  461|     13|		} else if (ver_rel != 0) {
  ------------------
  |  Branch (461:14): [True: 11, False: 1]
  ------------------
  462|     21|			while (ver_rel > 26) {
  ------------------
  |  Branch (462:11): [True: 10, False: 11]
  ------------------
  463|     10|				if (file_printf(ms, "Z") == -1)
  ------------------
  |  Branch (463:9): [True: 0, False: 10]
  ------------------
  464|      0|					return -1;
  465|     10|				ver_rel -= 26;
  466|     10|			}
  467|     11|			if (file_printf(ms, "%c", 'A' + ver_rel - 1) == -1)
  ------------------
  |  Branch (467:8): [True: 0, False: 11]
  ------------------
  468|      0|				return -1;
  469|     11|		}
  470|     25|	}
  471|     33|	return 0;
  472|     33|}
readelf.c:do_note_freebsd_version:
  476|     55|{
  477|     55|	uint32_t desc;
  478|       |
  479|     55|	memcpy(&desc, v, sizeof(desc));
  480|     55|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  144|     55|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  481|     55|	if (file_printf(ms, ", for FreeBSD") == -1)
  ------------------
  |  Branch (481:6): [True: 0, False: 55]
  ------------------
  482|      0|		return -1;
  483|       |
  484|       |	/*
  485|       |	 * Contents is __FreeBSD_version, whose relation to OS
  486|       |	 * versions is defined by a huge table in the Porter's
  487|       |	 * Handbook.  This is the general scheme:
  488|       |	 *
  489|       |	 * Releases:
  490|       |	 * 	Mmp000 (before 4.10)
  491|       |	 * 	Mmi0p0 (before 5.0)
  492|       |	 * 	Mmm0p0
  493|       |	 *
  494|       |	 * Development branches:
  495|       |	 * 	Mmpxxx (before 4.6)
  496|       |	 * 	Mmp1xx (before 4.10)
  497|       |	 * 	Mmi1xx (before 5.0)
  498|       |	 * 	M000xx (pre-M.0)
  499|       |	 * 	Mmm1xx
  500|       |	 *
  501|       |	 * M = major version
  502|       |	 * m = minor version
  503|       |	 * i = minor version increment (491000 -> 4.10)
  504|       |	 * p = patchlevel
  505|       |	 * x = revision
  506|       |	 *
  507|       |	 * The first release of FreeBSD to use ELF by default
  508|       |	 * was version 3.0.
  509|       |	 */
  510|     55|	if (desc == 460002) {
  ------------------
  |  Branch (510:6): [True: 0, False: 55]
  ------------------
  511|      0|		if (file_printf(ms, " 4.6.2") == -1)
  ------------------
  |  Branch (511:7): [True: 0, False: 0]
  ------------------
  512|      0|			return -1;
  513|     55|	} else if (desc < 460100) {
  ------------------
  |  Branch (513:13): [True: 16, False: 39]
  ------------------
  514|     16|		if (file_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (514:7): [True: 0, False: 16]
  ------------------
  515|     16|		    desc / 10000 % 10) == -1)
  516|      0|			return -1;
  517|     16|		if (desc / 1000 % 10 > 0)
  ------------------
  |  Branch (517:7): [True: 13, False: 3]
  ------------------
  518|     13|			if (file_printf(ms, ".%d", desc / 1000 % 10) == -1)
  ------------------
  |  Branch (518:8): [True: 0, False: 13]
  ------------------
  519|      0|				return -1;
  520|     16|		if ((desc % 1000 > 0) || (desc % 100000 == 0))
  ------------------
  |  Branch (520:7): [True: 11, False: 5]
  |  Branch (520:28): [True: 2, False: 3]
  ------------------
  521|     13|			if (file_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (521:8): [True: 0, False: 13]
  ------------------
  522|      0|				return -1;
  523|     39|	} else if (desc < 500000) {
  ------------------
  |  Branch (523:13): [True: 5, False: 34]
  ------------------
  524|      5|		if (file_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (524:7): [True: 0, False: 5]
  ------------------
  525|      5|		    desc / 10000 % 10 + desc / 1000 % 10) == -1)
  526|      0|			return -1;
  527|      5|		if (desc / 100 % 10 > 0) {
  ------------------
  |  Branch (527:7): [True: 3, False: 2]
  ------------------
  528|      3|			if (file_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (528:8): [True: 0, False: 3]
  ------------------
  529|      0|				return -1;
  530|      3|		} else if (desc / 10 % 10 > 0) {
  ------------------
  |  Branch (530:14): [True: 2, False: 0]
  ------------------
  531|      2|			if (file_printf(ms, ".%d", desc / 10 % 10) == -1)
  ------------------
  |  Branch (531:8): [True: 0, False: 2]
  ------------------
  532|      0|				return -1;
  533|      2|		}
  534|     34|	} else {
  535|     34|		if (file_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (535:7): [True: 0, False: 34]
  ------------------
  536|     34|		    desc / 1000 % 100) == -1)
  537|      0|			return -1;
  538|     34|		if ((desc / 100 % 10 > 0) ||
  ------------------
  |  Branch (538:7): [True: 23, False: 11]
  ------------------
  539|     34|		    (desc % 100000 / 100 == 0)) {
  ------------------
  |  Branch (539:7): [True: 1, False: 10]
  ------------------
  540|     24|			if (file_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (540:8): [True: 0, False: 24]
  ------------------
  541|      0|				return -1;
  542|     24|		} else if (desc / 10 % 10 > 0) {
  ------------------
  |  Branch (542:14): [True: 6, False: 4]
  ------------------
  543|      6|			if (file_printf(ms, ".%d", desc / 10 % 10) == -1)
  ------------------
  |  Branch (543:8): [True: 0, False: 6]
  ------------------
  544|      0|				return -1;
  545|      6|		}
  546|     34|	}
  547|     55|	return 0;
  548|     55|}
readelf.c:do_bid_note:
  555|  14.0k|{
  556|  14.0k|	if (namesz == 4 && strcmp(RCAST(char *, &nbuf[noff]), "GNU") == 0 &&
  ------------------
  |  |  427|  5.60k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (556:6): [True: 5.60k, False: 8.45k]
  |  Branch (556:21): [True: 529, False: 5.07k]
  ------------------
  557|  14.0k|	    type == NT_GNU_BUILD_ID && (descsz >= 4 && descsz <= 20)) {
  ------------------
  |  |  319|  14.5k|#define	NT_GNU_BUILD_ID		3
  ------------------
  |  Branch (557:6): [True: 147, False: 382]
  |  Branch (557:34): [True: 81, False: 66]
  |  Branch (557:49): [True: 13, False: 68]
  ------------------
  558|     13|		uint8_t desc[20];
  559|     13|		const char *btype;
  560|     13|		uint32_t i;
  561|     13|		*flags |= FLAGS_DID_BUILD_ID;
  ------------------
  |  |  339|     13|#define FLAGS_DID_BUILD_ID		0x0010
  ------------------
  562|     13|		switch (descsz) {
  563|      1|		case 8:
  ------------------
  |  Branch (563:3): [True: 1, False: 12]
  ------------------
  564|      1|		    btype = "xxHash";
  565|      1|		    break;
  566|      1|		case 16:
  ------------------
  |  Branch (566:3): [True: 1, False: 12]
  ------------------
  567|      1|		    btype = "md5/uuid";
  568|      1|		    break;
  569|      1|		case 20:
  ------------------
  |  Branch (569:3): [True: 1, False: 12]
  ------------------
  570|      1|		    btype = "sha1";
  571|      1|		    break;
  572|     10|		default:
  ------------------
  |  Branch (572:3): [True: 10, False: 3]
  ------------------
  573|     10|		    btype = "unknown";
  574|     10|		    break;
  575|     13|		}
  576|     13|		if (file_printf(ms, ", BuildID[%s]=", btype) == -1)
  ------------------
  |  Branch (576:7): [True: 0, False: 13]
  ------------------
  577|      0|			return -1;
  578|     13|		memcpy(desc, &nbuf[doff], descsz);
  579|    217|		for (i = 0; i < descsz; i++)
  ------------------
  |  Branch (579:15): [True: 204, False: 13]
  ------------------
  580|    204|		    if (file_printf(ms, "%02x", desc[i]) == -1)
  ------------------
  |  Branch (580:11): [True: 0, False: 204]
  ------------------
  581|      0|			return -1;
  582|     13|		return 1;
  583|     13|	}
  584|  14.0k|	if (namesz == 4 && strcmp(RCAST(char *, &nbuf[noff]), "Go") == 0 &&
  ------------------
  |  |  427|  5.59k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (584:6): [True: 5.59k, False: 8.45k]
  |  Branch (584:21): [True: 399, False: 5.19k]
  ------------------
  585|  14.0k|	    type == NT_GO_BUILD_ID && descsz < 128) {
  ------------------
  |  |  365|  14.4k|#define NT_GO_BUILD_ID	4
  ------------------
  |  Branch (585:6): [True: 141, False: 258]
  |  Branch (585:32): [True: 73, False: 68]
  ------------------
  586|     73|		char buf[256];
  587|     73|		if (file_printf(ms, ", Go BuildID=%s",
  ------------------
  |  Branch (587:7): [True: 0, False: 73]
  ------------------
  588|     73|		    file_copystr(buf, sizeof(buf), descsz,
  589|     73|		    RCAST(const char *, &nbuf[doff]))) == -1)
  ------------------
  |  |  427|     73|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  590|      0|			return -1;
  591|     73|		return 1;
  592|     73|	}
  593|  13.9k|	return 0;
  594|  14.0k|}
readelf.c:do_pax_note:
  699|  13.9k|{
  700|  13.9k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  427|  13.9k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  701|       |
  702|  13.9k|	if (namesz == 4 && strcmp(name, "PaX") == 0 &&
  ------------------
  |  Branch (702:6): [True: 5.54k, False: 8.42k]
  |  Branch (702:21): [True: 461, False: 5.08k]
  ------------------
  703|  13.9k|	    type == NT_NETBSD_PAX && descsz == 4) {
  ------------------
  |  |  330|  14.4k|#define NT_NETBSD_PAX		3
  ------------------
  |  Branch (703:6): [True: 84, False: 377]
  |  Branch (703:31): [True: 14, False: 70]
  ------------------
  704|     14|		static const char *pax[] = {
  705|     14|		    "+mprotect",
  706|     14|		    "-mprotect",
  707|     14|		    "+segvguard",
  708|     14|		    "-segvguard",
  709|     14|		    "+ASLR",
  710|     14|		    "-ASLR",
  711|     14|		};
  712|     14|		uint32_t desc;
  713|     14|		size_t i;
  714|     14|		int did = 0;
  715|       |
  716|     14|		*flags |= FLAGS_DID_NETBSD_PAX;
  ------------------
  |  |  341|     14|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  717|     14|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  718|     14|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  144|     14|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  719|       |
  720|     14|		if (desc && file_printf(ms, ", PaX: ") == -1)
  ------------------
  |  Branch (720:7): [True: 13, False: 1]
  |  Branch (720:15): [True: 0, False: 13]
  ------------------
  721|      0|			return -1;
  722|       |
  723|     98|		for (i = 0; i < __arraycount(pax); i++) {
  ------------------
  |  |  123|     98|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (723:15): [True: 84, False: 14]
  ------------------
  724|     84|			if (((1 << CAST(int, i)) & desc) == 0)
  ------------------
  |  |  426|     84|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (724:8): [True: 57, False: 27]
  ------------------
  725|     57|				continue;
  726|     27|			if (file_printf(ms, "%s%s", did++ ? "," : "",
  ------------------
  |  Branch (726:8): [True: 0, False: 27]
  |  Branch (726:32): [True: 14, False: 13]
  ------------------
  727|     27|			    pax[i]) == -1)
  728|      0|				return -1;
  729|     27|		}
  730|     14|		return 1;
  731|     14|	}
  732|  13.9k|	return 0;
  733|  13.9k|}
readelf.c:do_core_note:
  739|  13.6k|{
  740|  13.6k|#ifdef ELFCORE
  741|  13.6k|	char buf[256];
  742|  13.6k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  427|  13.6k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  743|       |
  744|  13.6k|	int os_style = -1;
  745|       |	/*
  746|       |	 * Sigh.  The 2.0.36 kernel in Debian 2.1, at
  747|       |	 * least, doesn't correctly implement name
  748|       |	 * sections, in core dumps, as specified by
  749|       |	 * the "Program Linking" section of "UNIX(R) System
  750|       |	 * V Release 4 Programmer's Guide: ANSI C and
  751|       |	 * Programming Support Tools", because my copy
  752|       |	 * clearly says "The first 'namesz' bytes in 'name'
  753|       |	 * contain a *null-terminated* [emphasis mine]
  754|       |	 * character representation of the entry's owner
  755|       |	 * or originator", but the 2.0.36 kernel code
  756|       |	 * doesn't include the terminating null in the
  757|       |	 * name....
  758|       |	 */
  759|  13.6k|	if ((namesz == 4 && strncmp(name, "CORE", 4) == 0) ||
  ------------------
  |  Branch (759:7): [True: 5.19k, False: 8.45k]
  |  Branch (759:22): [True: 943, False: 4.25k]
  ------------------
  760|  13.6k|	    (namesz == 5 && strcmp(name, "CORE") == 0)) {
  ------------------
  |  Branch (760:7): [True: 434, False: 12.2k]
  |  Branch (760:22): [True: 66, False: 368]
  ------------------
  761|  1.00k|		os_style = OS_STYLE_SVR4;
  ------------------
  |  |  325|  1.00k|#define	OS_STYLE_SVR4		0
  ------------------
  762|  1.00k|	}
  763|       |
  764|  13.6k|	if ((namesz == 8 && strcmp(name, "FreeBSD") == 0)) {
  ------------------
  |  Branch (764:7): [True: 721, False: 12.9k]
  |  Branch (764:22): [True: 141, False: 580]
  ------------------
  765|    141|		os_style = OS_STYLE_FREEBSD;
  ------------------
  |  |  326|    141|#define	OS_STYLE_FREEBSD	1
  ------------------
  766|    141|	}
  767|       |
  768|  13.6k|	if ((namesz >= 11 && strncmp(name, "NetBSD-CORE", 11)
  ------------------
  |  Branch (768:7): [True: 1.26k, False: 12.3k]
  |  Branch (768:23): [True: 137, False: 1.13k]
  ------------------
  769|  1.26k|	    == 0)) {
  770|    137|		os_style = OS_STYLE_NETBSD;
  ------------------
  |  |  327|    137|#define	OS_STYLE_NETBSD		2
  ------------------
  771|    137|	}
  772|       |
  773|  13.6k|	if (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {
  ------------------
  |  |  340|  1.28k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (773:6): [True: 1.28k, False: 12.3k]
  |  Branch (773:24): [True: 638, False: 649]
  ------------------
  774|    638|		if (file_printf(ms, ", %s-style", os_style_names[os_style])
  ------------------
  |  Branch (774:7): [True: 0, False: 638]
  ------------------
  775|    638|		    == -1)
  776|      0|			return -1;
  777|    638|		*flags |= FLAGS_DID_CORE_STYLE;
  ------------------
  |  |  340|    638|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  778|    638|		*flags |= os_style;
  779|    638|	}
  780|       |
  781|  13.6k|	switch (os_style) {
  782|    137|	case OS_STYLE_NETBSD:
  ------------------
  |  |  327|    137|#define	OS_STYLE_NETBSD		2
  ------------------
  |  Branch (782:2): [True: 137, False: 13.5k]
  ------------------
  783|    137|		if (type == NT_NETBSD_CORE_PROCINFO) {
  ------------------
  |  |  232|    137|#define	NT_NETBSD_CORE_PROCINFO		1
  ------------------
  |  Branch (783:7): [True: 4, False: 133]
  ------------------
  784|      4|			char sbuf[512];
  785|      4|			struct NetBSD_elfcore_procinfo pi;
  786|      4|			memset(&pi, 0, sizeof(pi));
  787|      4|			memcpy(&pi, nbuf + doff, MIN(descsz, sizeof(pi)));
  788|       |
  789|      4|			if (file_printf(ms, ", from '%.31s', pid=%u, uid=%u, "
  ------------------
  |  Branch (789:8): [True: 0, False: 4]
  ------------------
  790|      4|			    "gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)",
  791|      4|			    file_printable(ms, sbuf, sizeof(sbuf),
  792|      4|			    RCAST(char *, pi.cpi_name), sizeof(pi.cpi_name)),
  ------------------
  |  |  427|      4|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  793|      4|			    elf_getu32(swap, CAST(uint32_t, pi.cpi_pid)),
  ------------------
  |  |  144|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  794|      4|			    elf_getu32(swap, pi.cpi_euid),
  ------------------
  |  |  144|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  795|      4|			    elf_getu32(swap, pi.cpi_egid),
  ------------------
  |  |  144|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  796|      4|			    elf_getu32(swap, pi.cpi_nlwps),
  ------------------
  |  |  144|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  797|      4|			    elf_getu32(swap, CAST(uint32_t, pi.cpi_siglwp)),
  ------------------
  |  |  144|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  798|      4|			    elf_getu32(swap, pi.cpi_signo),
  ------------------
  |  |  144|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  799|      4|			    elf_getu32(swap, pi.cpi_sigcode)) == -1)
  ------------------
  |  |  144|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  800|      0|				return -1;
  801|       |
  802|      4|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  337|      4|#define FLAGS_DID_CORE			0x0004
  ------------------
  803|      4|			return 1;
  804|      4|		}
  805|    133|		break;
  806|       |
  807|    141|	case OS_STYLE_FREEBSD:
  ------------------
  |  |  326|    141|#define	OS_STYLE_FREEBSD	1
  ------------------
  |  Branch (807:2): [True: 141, False: 13.5k]
  ------------------
  808|    141|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|    282|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  346|     12|#define FLAGS_IS_CORE			0x0800
  ------------------
  |  Branch (808:7): [True: 12, False: 129]
  |  Branch (808:30): [True: 2, False: 10]
  ------------------
  809|      2|			size_t argoff, pidoff;
  810|       |
  811|      2|			if (clazz == ELFCLASS32)
  ------------------
  |  |  153|      2|#define	ELFCLASS32	1
  ------------------
  |  Branch (811:8): [True: 2, False: 0]
  ------------------
  812|      2|				argoff = 4 + 4 + 17;
  813|      0|			else
  814|      0|				argoff = 4 + 4 + 8 + 17;
  815|      2|			if (file_printf(ms, ", from '%.80s'", nbuf + doff +
  ------------------
  |  Branch (815:8): [True: 0, False: 2]
  ------------------
  816|      2|			    argoff) == -1)
  817|      0|				return -1;
  818|      2|			pidoff = argoff + 81 + 2;
  819|      2|			if (doff + pidoff + 4 <= size) {
  ------------------
  |  Branch (819:8): [True: 1, False: 1]
  ------------------
  820|      1|				if (file_printf(ms, ", pid=%u",
  ------------------
  |  Branch (820:9): [True: 0, False: 1]
  ------------------
  821|      1|				    elf_getu32(swap, *RCAST(uint32_t *, (nbuf +
  ------------------
  |  |  144|      1|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  822|      1|				    doff + pidoff)))) == -1)
  823|      0|					return -1;
  824|      1|			}
  825|      2|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  337|      2|#define FLAGS_DID_CORE			0x0004
  ------------------
  826|      2|		}			    
  827|    141|		break;
  828|       |
  829|  13.3k|	default:
  ------------------
  |  Branch (829:2): [True: 13.3k, False: 278]
  ------------------
  830|  13.3k|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|  26.7k|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  346|  1.40k|#define FLAGS_IS_CORE			0x0800
  ------------------
  |  Branch (830:7): [True: 1.40k, False: 11.9k]
  |  Branch (830:30): [True: 1.13k, False: 265]
  ------------------
  831|  1.13k|			size_t i, j;
  832|  1.13k|			unsigned char c;
  833|       |			/*
  834|       |			 * Extract the program name.  We assume
  835|       |			 * it to be 16 characters (that's what it
  836|       |			 * is in SunOS 5.x and Linux).
  837|       |			 *
  838|       |			 * Unfortunately, it's at a different offset
  839|       |			 * in various OSes, so try multiple offsets.
  840|       |			 * If the characters aren't all printable,
  841|       |			 * reject it.
  842|       |			 */
  843|  8.58k|			for (i = 0; i < NOFFSETS; i++) {
  ------------------
  |  |  294|  8.58k|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|  8.58k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  291|  7.99k|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|  7.99k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  292|    585|#define NOFFSETS64	__arraycount(prpsoffsets64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|    585|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (294:19): [True: 7.99k, False: 585]
  |  |  ------------------
  ------------------
  |  Branch (843:16): [True: 7.52k, False: 1.05k]
  ------------------
  844|  7.52k|				unsigned char *cname, *cp;
  845|  7.52k|				size_t reloffset = prpsoffsets(i);
  ------------------
  |  |  249|  7.52k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  7.52k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (249:25): [True: 7.03k, False: 492]
  |  |  ------------------
  |  |  250|  7.52k|			 ? prpsoffsets32[i]			\
  |  |  251|  7.52k|			 : prpsoffsets64[i])
  ------------------
  846|  7.52k|				size_t noffset = doff + reloffset;
  847|  7.52k|				size_t k;
  848|  9.59k|				for (j = 0; j < 16; j++, noffset++,
  ------------------
  |  Branch (848:17): [True: 9.57k, False: 17]
  ------------------
  849|  9.57k|				    reloffset++) {
  850|       |					/*
  851|       |					 * Make sure we're not past
  852|       |					 * the end of the buffer; if
  853|       |					 * we are, just give up.
  854|       |					 */
  855|  9.57k|					if (noffset >= size)
  ------------------
  |  Branch (855:10): [True: 391, False: 9.18k]
  ------------------
  856|    391|						goto tryanother;
  857|       |
  858|       |					/*
  859|       |					 * Make sure we're not past
  860|       |					 * the end of the contents;
  861|       |					 * if we are, this obviously
  862|       |					 * isn't the right offset.
  863|       |					 */
  864|  9.18k|					if (reloffset >= descsz)
  ------------------
  |  Branch (864:10): [True: 2.52k, False: 6.66k]
  ------------------
  865|  2.52k|						goto tryanother;
  866|       |
  867|  6.66k|					c = nbuf[noffset];
  868|  6.66k|					if (c == '\0') {
  ------------------
  |  Branch (868:10): [True: 2.35k, False: 4.30k]
  ------------------
  869|       |						/*
  870|       |						 * A '\0' at the
  871|       |						 * beginning is
  872|       |						 * obviously wrong.
  873|       |						 * Any other '\0'
  874|       |						 * means we're done.
  875|       |						 */
  876|  2.35k|						if (j == 0)
  ------------------
  |  Branch (876:11): [True: 2.28k, False: 68]
  ------------------
  877|  2.28k|							goto tryanother;
  878|     68|						else
  879|     68|							break;
  880|  4.30k|					} else {
  881|       |						/*
  882|       |						 * A nonprintable
  883|       |						 * character is also
  884|       |						 * wrong.
  885|       |						 */
  886|  4.30k|						if (!isprint(c) || isquote(c))
  ------------------
  |  |   57|  2.31k|#define isquote(c) (strchr("'\"`", (c)) != NULL)
  |  |  ------------------
  |  |  |  Branch (57:20): [True: 249, False: 2.06k]
  |  |  ------------------
  ------------------
  |  Branch (886:11): [True: 1.99k, False: 2.31k]
  ------------------
  887|  2.24k|							goto tryanother;
  888|  4.30k|					}
  889|  6.66k|				}
  890|       |				/*
  891|       |				 * Well, that worked.
  892|       |				 */
  893|       |
  894|       |				/*
  895|       |				 * Try next offsets, in case this match is
  896|       |				 * in the middle of a string.
  897|       |				 */
  898|    319|				for (k = i + 1 ; k < NOFFSETS; k++) {
  ------------------
  |  |  294|    319|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|    319|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  291|    292|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|    292|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  292|     27|#define NOFFSETS64	__arraycount(prpsoffsets64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|     27|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (294:19): [True: 292, False: 27]
  |  |  ------------------
  ------------------
  |  Branch (898:22): [True: 234, False: 85]
  ------------------
  899|    234|					size_t no;
  900|    234|					int adjust = 1;
  901|    234|					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  249|    234|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    234|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (249:25): [True: 216, False: 18]
  |  |  ------------------
  |  |  250|    234|			 ? prpsoffsets32[i]			\
  |  |  251|    234|			 : prpsoffsets64[i])
  ------------------
              					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  249|    234|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    234|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (249:25): [True: 216, False: 18]
  |  |  ------------------
  |  |  250|    234|			 ? prpsoffsets32[i]			\
  |  |  251|    234|			 : prpsoffsets64[i])
  ------------------
  |  Branch (901:10): [True: 52, False: 182]
  ------------------
  902|     52|						continue;
  903|       |					/*
  904|       |					 * pr_fname == pr_psargs - 16 &&
  905|       |					 * non-nul-terminated fname (qemu)
  906|       |					 */
  907|    182|					if (prpsoffsets(k) ==
  ------------------
  |  |  249|    182|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    182|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (249:25): [True: 164, False: 18]
  |  |  ------------------
  |  |  250|    182|			 ? prpsoffsets32[i]			\
  |  |  251|    182|			 : prpsoffsets64[i])
  ------------------
  |  Branch (907:10): [True: 46, False: 136]
  ------------------
  908|    182|					    prpsoffsets(i) - 16 && j == 16)
  ------------------
  |  |  249|    182|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    182|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (249:25): [True: 164, False: 18]
  |  |  ------------------
  |  |  250|    182|			 ? prpsoffsets32[i]			\
  |  |  251|    182|			 : prpsoffsets64[i])
  ------------------
  |  Branch (908:33): [True: 11, False: 35]
  ------------------
  909|     11|						continue;
  910|    171|					for (no = doff + prpsoffsets(k);
  ------------------
  |  |  249|    171|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    171|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (249:25): [True: 153, False: 18]
  |  |  ------------------
  |  |  250|    171|			 ? prpsoffsets32[i]			\
  |  |  251|    171|			 : prpsoffsets64[i])
  ------------------
  911|  6.00k|					     no < doff + prpsoffsets(i); no++)
  ------------------
  |  |  249|  6.00k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.00k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (249:25): [True: 4.99k, False: 1.01k]
  |  |  ------------------
  |  |  250|  6.00k|			 ? prpsoffsets32[i]			\
  |  |  251|  6.00k|			 : prpsoffsets64[i])
  ------------------
  |  Branch (911:11): [True: 5.83k, False: 171]
  ------------------
  912|  5.83k|						adjust = adjust
  ------------------
  |  Branch (912:16): [True: 1.55k, False: 4.27k]
  ------------------
  913|  5.83k|						         && isprint(nbuf[no]);
  914|    171|					if (adjust)
  ------------------
  |  Branch (914:10): [True: 36, False: 135]
  ------------------
  915|     36|						i = k;
  916|    171|				}
  917|       |
  918|     85|				cname = CAST(unsigned char *,
  ------------------
  |  |  426|    170|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 76, False: 9]
  |  |  ------------------
  ------------------
  919|     85|				    &nbuf[doff + prpsoffsets(i)]);
  920|  1.83k|				for (cp = cname; cp < nbuf + size && *cp
  ------------------
  |  Branch (920:22): [True: 1.82k, False: 6]
  |  Branch (920:42): [True: 1.75k, False: 69]
  ------------------
  921|  1.83k|				    && isprint(*cp); cp++)
  922|  1.74k|					continue;
  923|       |				/*
  924|       |				 * Linux apparently appends a space at the end
  925|       |				 * of the command line: remove it.
  926|       |				 */
  927|    310|				while (cp > cname && isspace(cp[-1]))
  ------------------
  |  Branch (927:12): [True: 302, False: 8]
  ------------------
  928|    225|					cp--;
  929|     85|				if (file_printf(ms, ", from '%s'",
  ------------------
  |  Branch (929:9): [True: 0, False: 85]
  ------------------
  930|     85|				    file_copystr(buf, sizeof(buf),
  931|     85|				    CAST(size_t, cp - cname),
  ------------------
  |  |  426|     85|#define CAST(T, b)	((T)(b))
  ------------------
  932|     85|				    RCAST(char *, cname))) == -1)
  ------------------
  |  |  427|     85|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  933|      0|					return -1;
  934|     85|				*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  337|     85|#define FLAGS_DID_CORE			0x0004
  ------------------
  935|     85|				return 1;
  936|       |
  937|  7.44k|			tryanother:
  938|  7.44k|				;
  939|  7.44k|			}
  940|  1.13k|		}
  941|  13.2k|		break;
  942|  13.6k|	}
  943|  13.5k|#endif
  944|  13.5k|	return 0;
  945|  13.6k|}
readelf.c:do_auxv_note:
 1022|  13.7k|{
 1023|  13.7k|#ifdef ELFCORE
 1024|  13.7k|	Aux32Info auxv32;
 1025|  13.7k|	Aux64Info auxv64;
 1026|  13.7k|	size_t elsize = xauxv_sizeof;
  ------------------
  |  |  239|  13.7k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  13.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (239:23): [True: 13.1k, False: 683]
  |  |  ------------------
  |  |  240|  13.7k|			 ? sizeof(auxv32)			\
  |  |  241|  13.7k|			 : sizeof(auxv64))
  ------------------
 1027|  13.7k|	const char *tag;
 1028|  13.7k|	int is_string;
 1029|  13.7k|	size_t nval, off;
 1030|       |
 1031|  13.7k|	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  346|  13.7k|#define FLAGS_IS_CORE			0x0800
  ------------------
              	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  340|  13.7k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (1031:6): [True: 11.3k, False: 2.47k]
  ------------------
 1032|  13.7k|	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  346|  13.7k|#define FLAGS_IS_CORE			0x0800
  ------------------
              	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  340|  13.7k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
 1033|  11.3k|		return 0;
 1034|       |
 1035|  2.47k|	switch (*flags & FLAGS_CORE_STYLE) {
  ------------------
  |  |  335|  2.47k|#define FLAGS_CORE_STYLE		0x0003
  ------------------
 1036|  1.87k|	case OS_STYLE_SVR4:
  ------------------
  |  |  325|  1.87k|#define	OS_STYLE_SVR4		0
  ------------------
  |  Branch (1036:2): [True: 1.87k, False: 592]
  ------------------
 1037|  1.87k|		if (type != NT_AUXV)
  ------------------
  |  |  281|  1.87k|#define	NT_AUXV		6
  ------------------
  |  Branch (1037:7): [True: 1.47k, False: 405]
  ------------------
 1038|  1.47k|			return 0;
 1039|    405|		break;
 1040|       |#ifdef notyet
 1041|       |	case OS_STYLE_NETBSD:
 1042|       |		if (type != NT_NETBSD_CORE_AUXV)
 1043|       |			return 0;
 1044|       |		break;
 1045|       |	case OS_STYLE_FREEBSD:
 1046|       |		if (type != NT_FREEBSD_PROCSTAT_AUXV)
 1047|       |			return 0;
 1048|       |		break;
 1049|       |#endif
 1050|    592|	default:
  ------------------
  |  Branch (1050:2): [True: 592, False: 1.87k]
  ------------------
 1051|    592|		return 0;
 1052|  2.47k|	}
 1053|       |
 1054|    405|	*flags |= FLAGS_DID_AUXV;
  ------------------
  |  |  347|    405|#define FLAGS_DID_AUXV			0x1000
  ------------------
 1055|       |
 1056|    405|	nval = 0;
 1057|  6.03k|	for (off = 0; off + elsize <= descsz; off += elsize) {
  ------------------
  |  Branch (1057:16): [True: 5.66k, False: 367]
  ------------------
 1058|  5.66k|		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  236|  5.66k|#define xauxv_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.66k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (236:21): [True: 5.66k, False: 0]
  |  |  ------------------
  |  |  237|  5.66k|			 ? CAST(void *, &auxv32)		\
  |  |  ------------------
  |  |  |  |  426|  5.66k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  238|  5.66k|			 : CAST(void *, &auxv64))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  239|  5.66k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.66k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (239:23): [True: 5.66k, False: 0]
  |  |  ------------------
  |  |  240|  5.66k|			 ? sizeof(auxv32)			\
  |  |  241|  5.66k|			 : sizeof(auxv64))
  ------------------
 1059|       |		/* Limit processing to 50 vector entries to prevent DoS */
 1060|  5.66k|		if (nval++ >= 50) {
  ------------------
  |  Branch (1060:7): [True: 38, False: 5.62k]
  ------------------
 1061|     38|			file_error(ms, 0, "Too many ELF Auxv elements");
 1062|     38|			return 1;
 1063|     38|		}
 1064|       |
 1065|  5.62k|		switch(xauxv_type) {
  ------------------
  |  |  242|  5.62k|#define xauxv_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.62k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (242:21): [True: 5.62k, False: 0]
  |  |  ------------------
  |  |  243|  5.62k|			 ? elf_getu32(swap, auxv32.a_type)	\
  |  |  ------------------
  |  |  |  |  144|  5.62k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  244|  5.62k|			 : elf_getu64(swap, auxv64.a_type))
  |  |  ------------------
  |  |  |  |  145|      0|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1066|    704|		case AT_LINUX_EXECFN:
  ------------------
  |  |   90|    704|#define AT_LINUX_EXECFN 31   /* filename of program */
  ------------------
  |  Branch (1066:3): [True: 704, False: 4.92k]
  ------------------
 1067|    704|			is_string = 1;
 1068|    704|			tag = "execfn";
 1069|    704|			break;
 1070|     95|		case AT_LINUX_PLATFORM:
  ------------------
  |  |   81|     95|#define AT_LINUX_PLATFORM 15  /* string identifying CPU for optimizations */
  ------------------
  |  Branch (1070:3): [True: 95, False: 5.53k]
  ------------------
 1071|     95|			is_string = 1;
 1072|     95|			tag = "platform";
 1073|     95|			break;
 1074|     13|		case AT_LINUX_UID:
  ------------------
  |  |   77|     13|#define AT_LINUX_UID    11    /* real uid */
  ------------------
  |  Branch (1074:3): [True: 13, False: 5.61k]
  ------------------
 1075|     13|			is_string = 0;
 1076|     13|			tag = "real uid";
 1077|     13|			break;
 1078|     14|		case AT_LINUX_GID:
  ------------------
  |  |   79|     14|#define AT_LINUX_GID    13    /* real gid */
  ------------------
  |  Branch (1078:3): [True: 14, False: 5.61k]
  ------------------
 1079|     14|			is_string = 0;
 1080|     14|			tag = "real gid";
 1081|     14|			break;
 1082|     32|		case AT_LINUX_EUID:
  ------------------
  |  |   78|     32|#define AT_LINUX_EUID   12    /* effective uid */
  ------------------
  |  Branch (1082:3): [True: 32, False: 5.59k]
  ------------------
 1083|     32|			is_string = 0;
 1084|     32|			tag = "effective uid";
 1085|     32|			break;
 1086|     16|		case AT_LINUX_EGID:
  ------------------
  |  |   80|     16|#define AT_LINUX_EGID   14    /* effective gid */
  ------------------
  |  Branch (1086:3): [True: 16, False: 5.61k]
  ------------------
 1087|     16|			is_string = 0;
 1088|     16|			tag = "effective gid";
 1089|     16|			break;
 1090|  4.75k|		default:
  ------------------
  |  Branch (1090:3): [True: 4.75k, False: 874]
  ------------------
 1091|  4.75k|			is_string = 0;
 1092|  4.75k|			tag = NULL;
 1093|  4.75k|			break;
 1094|  5.62k|		}
 1095|       |
 1096|  5.62k|		if (tag == NULL)
  ------------------
  |  Branch (1096:7): [True: 4.75k, False: 874]
  ------------------
 1097|  4.75k|			continue;
 1098|       |
 1099|    874|		if (is_string) {
  ------------------
  |  Branch (1099:7): [True: 799, False: 75]
  ------------------
 1100|    799|			char buf[256];
 1101|    799|			ssize_t buflen;
 1102|    799|			buflen = get_string_on_virtaddr(ms, swap, clazz, fd,
 1103|    799|			    ph_off, ph_num, fsize, xauxv_val, buf, sizeof(buf));
  ------------------
  |  |  245|    799|#define xauxv_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    799|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (245:20): [True: 799, False: 0]
  |  |  ------------------
  |  |  246|    799|			 ? elf_getu32(swap, auxv32.a_v)		\
  |  |  ------------------
  |  |  |  |  144|    799|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  247|    799|			 : elf_getu64(swap, auxv64.a_v))
  |  |  ------------------
  |  |  |  |  145|      0|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1104|       |
 1105|    799|			if (buflen == 0)
  ------------------
  |  Branch (1105:8): [True: 750, False: 49]
  ------------------
 1106|    750|				continue;
 1107|       |
 1108|     49|			if (file_printf(ms, ", %s: '%s'", tag, buf) == -1)
  ------------------
  |  Branch (1108:8): [True: 0, False: 49]
  ------------------
 1109|      0|				return -1;
 1110|     75|		} else {
 1111|     75|			if (file_printf(ms, ", %s: %d", tag,
  ------------------
  |  Branch (1111:8): [True: 0, False: 75]
  ------------------
 1112|     75|			    CAST(int, xauxv_val)) == -1)
  ------------------
  |  |  426|    150|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 75, False: 0]
  |  |  ------------------
  ------------------
 1113|      0|				return -1;
 1114|     75|		}
 1115|    874|	}
 1116|    367|	return 1;
 1117|       |#else
 1118|       |	return 0;
 1119|       |#endif
 1120|    405|}
readelf.c:get_string_on_virtaddr:
  985|    799|{
  986|    799|	char *bptr;
  987|    799|	off_t offset;
  988|       |
  989|    799|	if (buflen == 0)
  ------------------
  |  Branch (989:6): [True: 0, False: 799]
  ------------------
  990|      0|		return 0;
  991|       |
  992|    799|	offset = get_offset_from_virtaddr(ms, swap, clazz, fd, ph_off, ph_num,
  993|    799|	    fsize, virtaddr);
  994|    799|	if (offset < 0 ||
  ------------------
  |  Branch (994:6): [True: 0, False: 799]
  ------------------
  995|    799|	    (buflen = pread(fd, buf, CAST(size_t, buflen), offset)) <= 0) {
  ------------------
  |  |  426|    799|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (995:6): [True: 269, False: 530]
  ------------------
  996|    269|		(void)file_printf(ms, ", can't read elf string at %jd",
  997|    269|		    (intmax_t)offset);
  998|    269|		return 0;
  999|    269|	}
 1000|       |
 1001|    530|	buf[buflen - 1] = '\0';
 1002|       |
 1003|       |	/* We expect only printable characters, so return if buffer contains
 1004|       |	 * non-printable character before the '\0' or just '\0'. */
 1005|  1.42k|	for (bptr = buf; *bptr && isprint(CAST(unsigned char, *bptr)); bptr++)
  ------------------
  |  Branch (1005:19): [True: 1.26k, False: 162]
  ------------------
 1006|    897|		continue;
 1007|    530|	if (*bptr != '\0')
  ------------------
  |  Branch (1007:6): [True: 368, False: 162]
  ------------------
 1008|    368|		return 0;
 1009|       |
 1010|    162|	return bptr - buf;
 1011|    530|}
readelf.c:get_offset_from_virtaddr:
  950|    799|{
  951|    799|	Elf32_Phdr ph32;
  952|    799|	Elf64_Phdr ph64;
  953|       |
  954|       |	/*
  955|       |	 * Loop through all the program headers and find the header with
  956|       |	 * virtual address in which the "virtaddr" belongs to.
  957|       |	 */
  958|  7.97k|	for ( ; num; num--) {
  ------------------
  |  Branch (958:10): [True: 7.92k, False: 57]
  ------------------
  959|  7.92k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  166|  7.92k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  7.92k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (166:19): [True: 7.92k, False: 0]
  |  |  ------------------
  |  |  167|  7.92k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  426|  7.92k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  168|  7.92k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  169|  7.92k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  7.92k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (169:21): [True: 7.92k, False: 0]
  |  |  ------------------
  |  |  170|  7.92k|			 ? sizeof(ph32)				\
  |  |  171|  7.92k|			 : sizeof(ph64))
  ------------------
  |  Branch (959:7): [True: 277, False: 7.64k]
  ------------------
  960|  7.92k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  426|  15.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 7.92k, False: 0]
  |  |  ------------------
  ------------------
  961|    277|			if (file_printf(ms,
  ------------------
  |  Branch (961:8): [True: 0, False: 277]
  ------------------
  962|    277|			    ", can't read elf program header at %jd",
  963|    277|			    (intmax_t)off) == -1)
  964|      0|				return -1;
  965|    277|			return 0;
  966|       |
  967|    277|		}
  968|  7.64k|		off += xph_sizeof;
  ------------------
  |  |  169|  7.64k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  7.64k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (169:21): [True: 7.64k, False: 0]
  |  |  ------------------
  |  |  170|  7.64k|			 ? sizeof(ph32)				\
  |  |  171|  7.64k|			 : sizeof(ph64))
  ------------------
  969|       |
  970|  7.64k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   66|  7.64k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  426|  15.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  175|  7.64k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  15.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 7.64k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  176|  7.64k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  177|  7.64k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (970:7): [True: 7.64k, False: 0]
  |  Branch (970:32): [True: 4.13k, False: 3.50k]
  ------------------
  971|       |			/* Perhaps warn here */
  972|  4.13k|			continue;
  973|  4.13k|		}
  974|       |
  975|  3.50k|		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  183|  3.50k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  14.0k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 2.55k, False: 956]
  |  |  |  |  |  Branch (426:25): [True: 0, False: 0]
  |  |  |  |  |  Branch (426:25): [True: 3.50k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  184|  3.50k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  185|  3.50k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  186|  3.50k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  187|  3.50k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  183|  2.28k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  9.12k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 1.63k, False: 646]
  |  |  |  |  |  Branch (426:25): [True: 0, False: 0]
  |  |  |  |  |  Branch (426:25): [True: 2.28k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  184|  2.28k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  185|  2.28k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  186|  2.28k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  187|  2.28k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  188|  2.28k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  4.56k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 2.28k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (975:7): [True: 2.28k, False: 1.22k]
  |  Branch (975:32): [True: 465, False: 1.81k]
  ------------------
  976|    465|			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  175|    465|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|    930|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 465, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  176|    465|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  177|    465|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
              			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  183|    465|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  1.86k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 388, False: 77]
  |  |  |  |  |  Branch (426:25): [True: 0, False: 0]
  |  |  |  |  |  Branch (426:25): [True: 465, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  184|    465|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  185|    465|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  186|    465|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  187|    465|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
  977|  3.50k|	}
  978|     57|	return 0;
  979|    799|}
readelf.c:getu32:
   99|   843k|{
  100|   843k|	union {
  101|   843k|		uint32_t ui;
  102|   843k|		char c[4];
  103|   843k|	} retval, tmpval;
  104|       |
  105|   843k|	if (swap) {
  ------------------
  |  Branch (105:6): [True: 699k, False: 143k]
  ------------------
  106|   699k|		tmpval.ui = value;
  107|       |
  108|   699k|		retval.c[0] = tmpval.c[3];
  109|   699k|		retval.c[1] = tmpval.c[2];
  110|   699k|		retval.c[2] = tmpval.c[1];
  111|   699k|		retval.c[3] = tmpval.c[0];
  112|       |
  113|   699k|		return retval.ui;
  114|   699k|	} else
  115|   143k|		return value;
  116|   843k|}
readelf.c:dophn_exec:
 1661|  2.66k|{
 1662|  2.66k|	Elf32_Phdr ph32;
 1663|  2.66k|	Elf64_Phdr ph64;
 1664|  2.66k|	const char *linking_style;
 1665|  2.66k|	unsigned char nbuf[BUFSIZ];
 1666|  2.66k|	char ibuf[BUFSIZ];
 1667|  2.66k|	char interp[BUFSIZ];
 1668|  2.66k|	ssize_t bufsize;
 1669|  2.66k|	size_t offset, align, need = 0;
 1670|  2.66k|	int pie = 0, dynamic = 0;
 1671|       |
 1672|  2.66k|	if (num == 0) {
  ------------------
  |  Branch (1672:6): [True: 1.04k, False: 1.61k]
  ------------------
 1673|  1.04k|		if (file_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (1673:7): [True: 0, False: 1.04k]
  ------------------
 1674|      0|			return -1;
 1675|  1.04k|		return 0;
 1676|  1.04k|	}
 1677|  1.61k|	if (size != xph_sizeof) {
  ------------------
  |  |  169|  1.61k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.61k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (169:21): [True: 1.03k, False: 582]
  |  |  ------------------
  |  |  170|  1.61k|			 ? sizeof(ph32)				\
  |  |  171|  1.61k|			 : sizeof(ph64))
  ------------------
  |  Branch (1677:6): [True: 86, False: 1.52k]
  ------------------
 1678|     86|		if (file_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (1678:7): [True: 0, False: 86]
  ------------------
 1679|      0|			return -1;
 1680|     86|		return 0;
 1681|     86|	}
 1682|       |
 1683|  1.52k|	interp[0] = '\0';
 1684|  48.6k|  	for ( ; num; num--) {
  ------------------
  |  Branch (1684:12): [True: 48.5k, False: 105]
  ------------------
 1685|  48.5k|		int doread;
 1686|  48.5k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  166|  48.5k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  48.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (166:19): [True: 33.9k, False: 14.6k]
  |  |  ------------------
  |  |  167|  48.5k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  426|  33.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  168|  48.5k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  426|  14.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  169|  48.5k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  48.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (169:21): [True: 33.9k, False: 14.6k]
  |  |  ------------------
  |  |  170|  48.5k|			 ? sizeof(ph32)				\
  |  |  171|  48.5k|			 : sizeof(ph64))
  ------------------
  |  Branch (1686:7): [True: 1.37k, False: 47.1k]
  ------------------
 1687|  48.5k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  426|  97.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 33.9k, False: 14.6k]
  |  |  ------------------
  ------------------
 1688|  1.37k|			if (file_printf(ms,
  ------------------
  |  Branch (1688:8): [True: 0, False: 1.37k]
  ------------------
 1689|  1.37k|			    ", can't read elf program headers at %jd",
 1690|  1.37k|			    (intmax_t)off) == -1)
 1691|      0|				return -1;
 1692|  1.37k|			return 0;
 1693|  1.37k|		}
 1694|       |
 1695|  47.1k|		off += size;
 1696|  47.1k|		bufsize = 0;
 1697|  47.1k|		align = 4;
 1698|       |
 1699|       |		/* Things we can determine before we seek */
 1700|  47.1k|		switch (xph_type) {
  ------------------
  |  |  172|  47.1k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  47.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (172:19): [True: 32.9k, False: 14.2k]
  |  |  ------------------
  |  |  173|  47.1k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  144|  32.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  174|  47.1k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  144|  14.2k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1701|  1.54k|		case PT_DYNAMIC:
  ------------------
  |  |  199|  1.54k|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1701:3): [True: 1.54k, False: 45.6k]
  ------------------
 1702|  1.54k|			doread = 1;
 1703|  1.54k|			break;
 1704|  4.77k|		case PT_NOTE:
  ------------------
  |  |  201|  4.77k|#define	PT_NOTE		4
  ------------------
  |  Branch (1704:3): [True: 4.77k, False: 42.4k]
  ------------------
 1705|  4.77k|			if (sh_num)	/* Did this through section headers */
  ------------------
  |  Branch (1705:8): [True: 420, False: 4.35k]
  ------------------
 1706|    420|				continue;
 1707|  4.35k|			if (((align = xph_align) & 0x80000000UL) != 0 ||
  ------------------
  |  |  178|  4.35k|#define xph_align	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  17.4k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 2.10k, False: 1.13k]
  |  |  |  |  |  Branch (426:25): [True: 1.01k, False: 99]
  |  |  |  |  |  Branch (426:25): [True: 3.24k, False: 1.11k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  179|  4.35k|			 ? CAST(off_t, (ph32.p_align ? 		\
  |  |  180|  4.35k|			    elf_getu32(swap, ph32.p_align) : 4))\
  |  |  181|  4.35k|			 : CAST(off_t, (ph64.p_align ?		\
  |  |  182|  4.35k|			    elf_getu64(swap, ph64.p_align) : 4))))
  ------------------
  |  Branch (1707:8): [True: 738, False: 3.62k]
  ------------------
 1708|  4.35k|			    align < 4) {
  ------------------
  |  Branch (1708:8): [True: 761, False: 2.86k]
  ------------------
 1709|  1.49k|				if (file_printf(ms,
  ------------------
  |  Branch (1709:9): [True: 0, False: 1.49k]
  ------------------
 1710|  1.49k|				    ", invalid note alignment %#lx",
 1711|  1.49k|				    CAST(unsigned long, align)) == -1)
  ------------------
  |  |  426|  1.49k|#define CAST(T, b)	((T)(b))
  ------------------
 1712|      0|					return -1;
 1713|  1.49k|				align = 4;
 1714|  1.49k|			}
 1715|       |			/*FALLTHROUGH*/
 1716|  4.81k|		case PT_INTERP:
  ------------------
  |  |  200|  4.81k|#define	PT_INTERP	3
  ------------------
  |  Branch (1716:3): [True: 456, False: 46.7k]
  ------------------
 1717|  4.81k|			doread = 1;
 1718|  4.81k|			break;
 1719|  40.4k|		default:
  ------------------
  |  Branch (1719:3): [True: 40.4k, False: 6.77k]
  ------------------
 1720|  40.4k|			doread = 0;
 1721|  40.4k|			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   66|  40.4k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  426|  80.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  175|  40.4k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  80.8k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 27.8k, False: 12.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  176|  40.4k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  177|  40.4k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (1721:8): [True: 40.4k, False: 0]
  |  Branch (1721:33): [True: 23.7k, False: 16.7k]
  ------------------
 1722|       |				/* Maybe warn here? */
 1723|  23.7k|				continue;
 1724|  23.7k|			}
 1725|  16.7k|			break;
 1726|  47.1k|		}
 1727|       |
 1728|  23.0k|		if (doread) {
  ------------------
  |  Branch (1728:7): [True: 6.35k, False: 16.7k]
  ------------------
 1729|  6.35k|			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  188|  6.35k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  12.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 4.72k, False: 1.63k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  6.35k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  190|  6.35k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  188|  1.54k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  3.09k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 1.33k, False: 215]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  6.35k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  190|  6.35k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (1729:17): [True: 1.54k, False: 4.81k]
  ------------------
 1730|  6.35k|			    : sizeof(nbuf);
 1731|  6.35k|			off_t offs = xph_offset;
  ------------------
  |  |  175|  6.35k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  12.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 4.72k, False: 1.63k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  176|  6.35k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  177|  6.35k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
 1732|  6.35k|			bufsize = pread(fd, nbuf, len, offs);
 1733|  6.35k|			if (bufsize == -1) {
  ------------------
  |  Branch (1733:8): [True: 54, False: 6.30k]
  ------------------
 1734|     54|				if (file_printf(ms,
  ------------------
  |  Branch (1734:9): [True: 0, False: 54]
  ------------------
 1735|     54|				    ", can't read section at %jd",
 1736|     54|				    (intmax_t)offs) == -1)
 1737|      0|					return -1;
 1738|     54|				return 0;
 1739|     54|			}
 1740|  6.35k|		}
 1741|       |
 1742|       |		/* Things we can determine when we seek */
 1743|  23.0k|		switch (xph_type) {
  ------------------
  |  |  172|  23.0k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (172:19): [True: 17.1k, False: 5.87k]
  |  |  ------------------
  |  |  173|  23.0k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  144|  17.1k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  174|  23.0k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  144|  5.87k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1744|  1.54k|		case PT_DYNAMIC:
  ------------------
  |  |  199|  1.54k|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1744:3): [True: 1.54k, False: 21.4k]
  ------------------
 1745|  1.54k|			dynamic = 1;
 1746|  1.54k|			offset = 0;
 1747|       |			// Let DF_1 determine if we are PIE or not.
 1748|  1.54k|			ms->mode &= ~0111;
 1749|   408k|			for (;;) {
 1750|   408k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  426|   408k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1750:9): [True: 1.54k, False: 406k]
  ------------------
 1751|  1.54k|					break;
 1752|   406k|				offset = dodynamic(ms, nbuf, offset,
 1753|   406k|				    CAST(size_t, bufsize), clazz, swap,
  ------------------
  |  |  426|   406k|#define CAST(T, b)	((T)(b))
  ------------------
 1754|   406k|				    &pie, &need);
 1755|   406k|				if (offset == 0)
  ------------------
  |  Branch (1755:9): [True: 0, False: 406k]
  ------------------
 1756|      0|					break;
 1757|   406k|			}
 1758|  1.54k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  1.54k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.54k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.54k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1758:8): [True: 0, False: 1.54k]
  ------------------
 1759|      0|				continue;
 1760|  1.54k|			break;
 1761|       |
 1762|  1.54k|		case PT_INTERP:
  ------------------
  |  |  200|    456|#define	PT_INTERP	3
  ------------------
  |  Branch (1762:3): [True: 456, False: 22.5k]
  ------------------
 1763|    456|			need++;
 1764|    456|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|    456|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    456|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    456|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1764:8): [True: 0, False: 456]
  ------------------
 1765|      0|				continue;
 1766|    456|			if (bufsize && nbuf[0]) {
  ------------------
  |  Branch (1766:8): [True: 163, False: 293]
  |  Branch (1766:19): [True: 95, False: 68]
  ------------------
 1767|     95|				nbuf[bufsize - 1] = '\0';
 1768|     95|				memcpy(interp, nbuf, CAST(size_t, bufsize));
  ------------------
  |  |  426|     95|#define CAST(T, b)	((T)(b))
  ------------------
 1769|     95|			} else
 1770|    361|				strlcpy(interp, "*empty*", sizeof(interp));
 1771|    456|			break;
 1772|  4.30k|		case PT_NOTE:
  ------------------
  |  |  201|  4.30k|#define	PT_NOTE		4
  ------------------
  |  Branch (1772:3): [True: 4.30k, False: 18.7k]
  ------------------
 1773|  4.30k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  4.30k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  4.30k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  4.30k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1773:8): [True: 0, False: 4.30k]
  ------------------
 1774|      0|				return 0;
 1775|       |			/*
 1776|       |			 * This is a PT_NOTE section; loop through all the notes
 1777|       |			 * in the section.
 1778|       |			 */
 1779|  4.30k|			offset = 0;
 1780|  13.0k|			for (;;) {
 1781|  13.0k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  426|  13.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1781:9): [True: 3.78k, False: 9.22k]
  ------------------
 1782|  3.78k|					break;
 1783|  9.22k|				offset = donote(ms, nbuf, offset,
 1784|  9.22k|				    CAST(size_t, bufsize), clazz, swap, align,
  ------------------
  |  |  426|  9.22k|#define CAST(T, b)	((T)(b))
  ------------------
 1785|  9.22k|				    flags, notecount, fd, 0, 0, 0);
 1786|  9.22k|				if (offset == 0)
  ------------------
  |  Branch (1786:9): [True: 522, False: 8.70k]
  ------------------
 1787|    522|					break;
 1788|  9.22k|			}
 1789|  4.30k|			break;
 1790|  16.7k|		default:
  ------------------
  |  Branch (1790:3): [True: 16.7k, False: 6.30k]
  ------------------
 1791|  16.7k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  16.7k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  16.7k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  16.7k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1791:8): [True: 0, False: 16.7k]
  ------------------
 1792|      0|				continue;
 1793|  16.7k|			break;
 1794|  23.0k|		}
 1795|  23.0k|	}
 1796|    105|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|    105|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    105|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    105|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1796:6): [True: 0, False: 105]
  ------------------
 1797|      0|		return 0;
 1798|    105|	if (dynamic) {
  ------------------
  |  Branch (1798:6): [True: 77, False: 28]
  ------------------
 1799|     77|		if (pie && need == 0)
  ------------------
  |  Branch (1799:7): [True: 12, False: 65]
  |  Branch (1799:14): [True: 1, False: 11]
  ------------------
 1800|      1|			linking_style = "static-pie";
 1801|     76|		else
 1802|     76|			linking_style = "dynamically";
 1803|     77|	} else {
 1804|     28|		linking_style = "statically";
 1805|     28|	}
 1806|    105|	if (file_printf(ms, ", %s linked", linking_style) == -1)
  ------------------
  |  Branch (1806:6): [True: 0, False: 105]
  ------------------
 1807|      0|		return -1;
 1808|    105|	if (interp[0])
  ------------------
  |  Branch (1808:6): [True: 14, False: 91]
  ------------------
 1809|     14|		if (file_printf(ms, ", interpreter %s", file_printable(ms,
  ------------------
  |  Branch (1809:7): [True: 2, False: 12]
  ------------------
 1810|     14|		    ibuf, sizeof(ibuf), interp, sizeof(interp))) == -1)
 1811|      2|			return -1;
 1812|    103|	return 0;
 1813|    105|}
readelf.c:dodynamic:
 1125|   406k|{
 1126|   406k|	Elf32_Dyn dh32;
 1127|   406k|	Elf64_Dyn dh64;
 1128|   406k|	unsigned char *dbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  426|   406k|#define CAST(T, b)	((T)(b))
  ------------------
 1129|       |
 1130|   406k|	if (xdh_sizeof + offset > size) {
  ------------------
  |  |  213|   406k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|   406k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (213:21): [True: 401k, False: 5.00k]
  |  |  ------------------
  |  |  214|   406k|			 ? sizeof(dh32)				\
  |  |  215|   406k|			 : sizeof(dh64))
  ------------------
  |  Branch (1130:6): [True: 596, False: 405k]
  ------------------
 1131|       |		/*
 1132|       |		 * We're out of note headers.
 1133|       |		 */
 1134|    596|		return xdh_sizeof + offset;
  ------------------
  |  |  213|    596|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    596|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (213:21): [True: 537, False: 59]
  |  |  ------------------
  |  |  214|    596|			 ? sizeof(dh32)				\
  |  |  215|    596|			 : sizeof(dh64))
  ------------------
 1135|    596|	}
 1136|       |
 1137|   405k|	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  210|   405k|#define xdh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|   405k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (210:19): [True: 401k, False: 4.94k]
  |  |  ------------------
  |  |  211|   405k|			 ? CAST(void *, &dh32)			\
  |  |  ------------------
  |  |  |  |  426|   401k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  212|   405k|			 : CAST(void *, &dh64))
  |  |  ------------------
  |  |  |  |  426|  4.94k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  213|   405k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|   405k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (213:21): [True: 401k, False: 4.94k]
  |  |  ------------------
  |  |  214|   405k|			 ? sizeof(dh32)				\
  |  |  215|   405k|			 : sizeof(dh64))
  ------------------
 1138|   405k|	offset += xdh_sizeof;
  ------------------
  |  |  213|   405k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|   405k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (213:21): [True: 401k, False: 4.94k]
  |  |  ------------------
  |  |  214|   405k|			 ? sizeof(dh32)				\
  |  |  215|   405k|			 : sizeof(dh64))
  ------------------
 1139|       |
 1140|   405k|	switch (xdh_tag) {
  ------------------
  |  |  216|   405k|#define xdh_tag		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|   405k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (216:19): [True: 401k, False: 4.94k]
  |  |  ------------------
  |  |  217|   405k|			 ? elf_getu32(swap, dh32.d_tag)		\
  |  |  ------------------
  |  |  |  |  144|   401k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  218|   405k|			 : elf_getu64(swap, dh64.d_tag))
  |  |  ------------------
  |  |  |  |  145|  4.94k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1141|    848|	case DT_FLAGS_1:
  ------------------
  |  |  500|    848|#define DT_FLAGS_1	0x6ffffffb	/* ELF dynamic flags */
  ------------------
  |  Branch (1141:2): [True: 848, False: 405k]
  ------------------
 1142|    848|		*pie = 1;
 1143|    848|		if (xdh_val & DF_1_PIE)
  ------------------
  |  |  219|    848|#define xdh_val		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    848|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (219:19): [True: 780, False: 68]
  |  |  ------------------
  |  |  220|    848|			 ? elf_getu32(swap, dh32.d_un.d_val)	\
  |  |  ------------------
  |  |  |  |  144|    780|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  221|    848|			 : elf_getu64(swap, dh64.d_un.d_val))
  |  |  ------------------
  |  |  |  |  145|     68|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
              		if (xdh_val & DF_1_PIE)
  ------------------
  |  |  543|    848|#define	DF_1_PIE	0x08000000	/* Position Independent Executable */
  ------------------
  |  Branch (1143:7): [True: 535, False: 313]
  ------------------
 1144|    535|			ms->mode |= 0111;
 1145|    313|		else
 1146|    313|			ms->mode &= ~0111;
 1147|    848|		break;
 1148|  3.47k|	case DT_NEEDED:
  ------------------
  |  |  463|  3.47k|#define DT_NEEDED	1	/* Name of needed library (DT_STRTAB offset) */
  ------------------
  |  Branch (1148:2): [True: 3.47k, False: 402k]
  ------------------
 1149|  3.47k|		(*need)++;
 1150|  3.47k|		break;
 1151|   401k|	default:
  ------------------
  |  Branch (1151:2): [True: 401k, False: 4.32k]
  ------------------
 1152|   401k|		break;
 1153|   405k|	}
 1154|   405k|	return offset;
 1155|   405k|}
readelf.c:doshn:
 1355|  2.67k|{
 1356|  2.67k|	Elf32_Shdr sh32;
 1357|  2.67k|	Elf64_Shdr sh64;
 1358|  2.67k|	int stripped = 1, has_debug_info = 0;
 1359|  2.67k|	size_t nbadcap = 0;
 1360|  2.67k|	void *nbuf;
 1361|  2.67k|	off_t noff, coff, name_off, offs;
 1362|  2.67k|	uint64_t cap_hw1 = 0;	/* SunOS 5.x hardware capabilities */
 1363|  2.67k|	uint64_t cap_sf1 = 0;	/* SunOS 5.x software capabilities */
 1364|  2.67k|	char name[50];
 1365|  2.67k|	ssize_t namesize;
 1366|       |
 1367|  2.67k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  2.67k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.67k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.67k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1367:6): [True: 0, False: 2.67k]
  ------------------
 1368|      0|		return 0;
 1369|       |
 1370|  2.67k|	if (num == 0) {
  ------------------
  |  Branch (1370:6): [True: 1.24k, False: 1.42k]
  ------------------
 1371|  1.24k|		if (file_printf(ms, ", no section header") == -1)
  ------------------
  |  Branch (1371:7): [True: 0, False: 1.24k]
  ------------------
 1372|      0|			return -1;
 1373|  1.24k|		return 0;
 1374|  1.24k|	}
 1375|  1.42k|	if (size != xsh_sizeof) {
  ------------------
  |  |  150|  1.42k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.42k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (150:21): [True: 766, False: 661]
  |  |  ------------------
  |  |  151|  1.42k|			 ? sizeof(sh32)				\
  |  |  152|  1.42k|			 : sizeof(sh64))
  ------------------
  |  Branch (1375:6): [True: 309, False: 1.11k]
  ------------------
 1376|    309|		if (file_printf(ms, ", corrupted section header size") == -1)
  ------------------
  |  Branch (1376:7): [True: 0, False: 309]
  ------------------
 1377|      0|			return -1;
 1378|    309|		return 0;
 1379|    309|	}
 1380|       |
 1381|       |	/* Read offset of name section to be able to read section names later */
 1382|  1.11k|	offs = CAST(off_t, (off + size * strtab));
  ------------------
  |  |  426|  1.11k|#define CAST(T, b)	((T)(b))
  ------------------
 1383|  1.11k|	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  147|  1.11k|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.11k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (147:19): [True: 550, False: 568]
  |  |  ------------------
  |  |  148|  1.11k|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  426|    550|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  149|  1.11k|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  426|    568|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  150|  1.11k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.11k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (150:21): [True: 550, False: 568]
  |  |  ------------------
  |  |  151|  1.11k|			 ? sizeof(sh32)				\
  |  |  152|  1.11k|			 : sizeof(sh64))
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  426|  2.23k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 550, False: 568]
  |  |  ------------------
  ------------------
  |  Branch (1383:6): [True: 7, False: 1.11k]
  ------------------
 1384|      7|		if (file_printf(ms, ", missing section headers at %jd",
  ------------------
  |  Branch (1384:7): [True: 0, False: 7]
  ------------------
 1385|      7|		    (intmax_t)offs) == -1)
 1386|      0|			return -1;
 1387|      7|		return 0;
 1388|      7|	}
 1389|  1.11k|	name_off = xsh_offset;
  ------------------
  |  |  156|  1.11k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  2.22k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 546, False: 565]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  157|  1.11k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  158|  1.11k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1390|       |
 1391|  1.11k|	if (fsize != SIZE_UNKNOWN && fsize < name_off) {
  ------------------
  |  |   66|  1.11k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  426|  2.22k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1391:6): [True: 1.11k, False: 0]
  |  Branch (1391:31): [True: 84, False: 1.02k]
  ------------------
 1392|     84|		if (file_printf(ms, ", too large section header offset %jd",
  ------------------
  |  Branch (1392:7): [True: 0, False: 84]
  ------------------
 1393|     84|		    (intmax_t)name_off) == -1)
 1394|      0|			return -1;
 1395|     84|		return 0;
 1396|     84|	}
 1397|       |
 1398|  39.0k|	for ( ; num; num--) {
  ------------------
  |  Branch (1398:10): [True: 38.8k, False: 235]
  ------------------
 1399|       |		/* Read the name of this section. */
 1400|  38.8k|		offs = name_off + xsh_name;
  ------------------
  |  |  162|  38.8k|#define xsh_name    	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  38.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (162:23): [True: 21.7k, False: 17.0k]
  |  |  ------------------
  |  |  163|  38.8k|			 ? elf_getu32(swap, sh32.sh_name)	\
  |  |  ------------------
  |  |  |  |  144|  21.7k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  164|  38.8k|			 : elf_getu32(swap, sh64.sh_name))
  |  |  ------------------
  |  |  |  |  144|  17.0k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1401|  38.8k|		if ((namesize = pread(fd, name, sizeof(name) - 1, offs))
  ------------------
  |  Branch (1401:7): [True: 16, False: 38.8k]
  ------------------
 1402|  38.8k|		    == -1) {
 1403|     16|			if (file_printf(ms, 
  ------------------
  |  Branch (1403:8): [True: 0, False: 16]
  ------------------
 1404|     16|			    ", can't read name of elf section at %jd",
 1405|     16|			    (intmax_t)offs) == -1)
 1406|      0|				return -1;
 1407|     16|			return 0;
 1408|     16|		}
 1409|  38.8k|		name[namesize] = '\0';
 1410|  38.8k|		if (strcmp(name, ".debug_info") == 0) {
  ------------------
  |  Branch (1410:7): [True: 203, False: 38.6k]
  ------------------
 1411|    203|			has_debug_info = 1;
 1412|    203|			stripped = 0;
 1413|    203|		}
 1414|       |
 1415|  38.8k|		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  147|  38.8k|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  38.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (147:19): [True: 21.7k, False: 17.0k]
  |  |  ------------------
  |  |  148|  38.8k|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  426|  21.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  149|  38.8k|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  426|  17.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  150|  38.8k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  38.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (150:21): [True: 21.7k, False: 17.0k]
  |  |  ------------------
  |  |  151|  38.8k|			 ? sizeof(sh32)				\
  |  |  152|  38.8k|			 : sizeof(sh64))
  ------------------
  |  Branch (1415:7): [True: 547, False: 38.2k]
  ------------------
 1416|  38.8k|		    CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  426|  77.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 21.7k, False: 17.0k]
  |  |  ------------------
  ------------------
 1417|    547|			if (file_printf(ms, ", can't read elf section at %jd",
  ------------------
  |  Branch (1417:8): [True: 0, False: 547]
  ------------------
 1418|    547|			    (intmax_t)off) == -1)
 1419|      0|				return -1;
 1420|    547|			return 0;
 1421|    547|		}
 1422|  38.2k|		off += size;
 1423|       |
 1424|       |		/* Things we can determine before we seek */
 1425|  38.2k|		switch (xsh_type) {
  ------------------
  |  |  159|  38.2k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  38.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (159:19): [True: 21.4k, False: 16.8k]
  |  |  ------------------
  |  |  160|  38.2k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  144|  21.4k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  161|  38.2k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  144|  16.8k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1426|    255|		case SHT_SYMTAB:
  ------------------
  |  |  141|    255|#define	SHT_SYMTAB	2
  ------------------
  |  Branch (1426:3): [True: 255, False: 38.0k]
  ------------------
 1427|       |#if 0
 1428|       |		case SHT_DYNSYM:
 1429|       |#endif
 1430|    255|			stripped = 0;
 1431|    255|			break;
 1432|  38.0k|		default:
  ------------------
  |  Branch (1432:3): [True: 38.0k, False: 255]
  ------------------
 1433|  38.0k|			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |   66|  38.0k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  426|  76.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |  156|  38.0k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  76.0k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 21.1k, False: 16.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  157|  38.0k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  158|  38.0k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1433:8): [True: 38.0k, False: 0]
  |  Branch (1433:33): [True: 21.2k, False: 16.7k]
  ------------------
 1434|       |				/* Perhaps warn here */
 1435|  21.2k|				continue;
 1436|  21.2k|			}
 1437|  16.7k|			break;
 1438|  38.2k|		}
 1439|       |
 1440|       |
 1441|       |		/* Things we can determine when we seek */
 1442|  17.0k|		switch (xsh_type) {
  ------------------
  |  |  159|  17.0k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  17.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (159:19): [True: 10.7k, False: 6.27k]
  |  |  ------------------
  |  |  160|  17.0k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  144|  10.7k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  161|  17.0k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  144|  6.27k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1443|  1.42k|		case SHT_NOTE:
  ------------------
  |  |  142|  1.42k|#define	SHT_NOTE	7
  ------------------
  |  Branch (1443:3): [True: 1.42k, False: 15.5k]
  ------------------
 1444|  1.42k|			if (CAST(uintmax_t, (xsh_size + xsh_offset)) >
  ------------------
  |  |  426|  5.68k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 1.17k, False: 250]
  |  |  |  Branch (426:25): [True: 1.17k, False: 250]
  |  |  ------------------
  ------------------
  |  Branch (1444:8): [True: 119, False: 1.30k]
  ------------------
 1445|  1.42k|			    CAST(uintmax_t, fsize)) {
  ------------------
  |  |  426|  1.42k|#define CAST(T, b)	((T)(b))
  ------------------
 1446|    119|				if (file_printf(ms,
  ------------------
  |  Branch (1446:9): [True: 0, False: 119]
  ------------------
 1447|    119|				    ", note offset/size %#" INTMAX_T_FORMAT
 1448|    119|				    "x+%#" INTMAX_T_FORMAT "x exceeds"
 1449|    119|				    " file size %#" INTMAX_T_FORMAT "x",
 1450|    119|				    CAST(uintmax_t, xsh_offset),
  ------------------
  |  |  426|    238|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 50, False: 69]
  |  |  ------------------
  ------------------
 1451|    119|				    CAST(uintmax_t, xsh_size),
  ------------------
  |  |  426|    238|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 50, False: 69]
  |  |  ------------------
  ------------------
 1452|    119|				    CAST(uintmax_t, fsize)) == -1)
  ------------------
  |  |  426|    119|#define CAST(T, b)	((T)(b))
  ------------------
 1453|      0|					return -1;
 1454|    119|				return 0;
 1455|    119|			}
 1456|  1.30k|			if (xsh_size > MAX_SHSIZE) {
  ------------------
  |  |  153|  1.30k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  2.60k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 1.12k, False: 181]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.30k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  155|  1.30k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
              			if (xsh_size > MAX_SHSIZE) {
  ------------------
  |  |   65|  1.30k|#define MAX_SHSIZE	(64 * 1024 * 1024)
  ------------------
  |  Branch (1456:8): [True: 13, False: 1.29k]
  ------------------
 1457|     13|				file_error(ms, errno, "Note section size too "
 1458|     13|				    "big (%ju > %u)", (uintmax_t)xsh_size,
  ------------------
  |  |  153|     13|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|     26|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     13|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  155|     13|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1459|     13|				    MAX_SHSIZE);
  ------------------
  |  |   65|     13|#define MAX_SHSIZE	(64 * 1024 * 1024)
  ------------------
 1460|     13|				return -1;
 1461|     13|			}
 1462|  1.29k|			if ((nbuf = malloc(xsh_size)) == NULL) {
  ------------------
  |  |  153|  1.29k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  2.58k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 1.12k, False: 168]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.29k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  155|  1.29k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1462:8): [True: 0, False: 1.29k]
  ------------------
 1463|      0|				file_error(ms, errno, "Cannot allocate memory"
 1464|      0|				    " for note");
 1465|      0|				return -1;
 1466|      0|			}
 1467|  1.29k|			offs = xsh_offset;
  ------------------
  |  |  156|  1.29k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  2.58k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 1.12k, False: 168]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  157|  1.29k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  158|  1.29k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1468|  1.29k|			if (pread(fd, nbuf, xsh_size, offs) <
  ------------------
  |  |  153|  1.29k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  2.58k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 1.12k, False: 168]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.29k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  155|  1.29k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1468:8): [True: 12, False: 1.27k]
  ------------------
 1469|  1.29k|			    CAST(ssize_t, xsh_size)) {
  ------------------
  |  |  426|  2.58k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 1.12k, False: 168]
  |  |  ------------------
  ------------------
 1470|     12|				free(nbuf);
 1471|     12|				if (file_printf(ms,
  ------------------
  |  Branch (1471:9): [True: 0, False: 12]
  ------------------
 1472|     12|				    ", can't read elf note at %jd",
 1473|     12|				    (intmax_t)offs) == -1)
 1474|      0|					return -1;
 1475|     12|				return 0;
 1476|     12|			}
 1477|       |
 1478|  1.27k|			noff = 0;
 1479|  2.02k|			for (;;) {
 1480|  2.02k|				if (noff >= CAST(off_t, xsh_size))
  ------------------
  |  |  426|  4.04k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 1.72k, False: 302]
  |  |  ------------------
  ------------------
  |  Branch (1480:9): [True: 907, False: 1.11k]
  ------------------
 1481|    907|					break;
 1482|  1.11k|				noff = donote(ms, nbuf, CAST(size_t, noff),
  ------------------
  |  |  426|  1.11k|#define CAST(T, b)	((T)(b))
  ------------------
 1483|  1.11k|				    xsh_size, clazz, swap, 4, flags, notecount,
  ------------------
  |  |  153|  1.11k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  2.23k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 958, False: 158]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.11k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  155|  1.11k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1484|  1.11k|				    fd, 0, 0, 0);
 1485|  1.11k|				if (noff == 0)
  ------------------
  |  Branch (1485:9): [True: 371, False: 745]
  ------------------
 1486|    371|					break;
 1487|  1.11k|			}
 1488|  1.27k|			free(nbuf);
 1489|  1.27k|			break;
 1490|  1.29k|		case SHT_SUNW_cap:
  ------------------
  |  |  144|  1.29k|#define	SHT_SUNW_cap	0x6ffffff5	/* SunOS 5.x hw/sw capabilities */
  ------------------
  |  Branch (1490:3): [True: 1.29k, False: 15.7k]
  ------------------
 1491|  1.29k|			switch (mach) {
 1492|     95|			case EM_SPARC:
  ------------------
  |  |  133|     95|#define	EM_SPARC	2
  ------------------
  |  Branch (1492:4): [True: 95, False: 1.20k]
  ------------------
 1493|    457|			case EM_SPARCV9:
  ------------------
  |  |  136|    457|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1493:4): [True: 362, False: 934]
  ------------------
 1494|    530|			case EM_IA_64:
  ------------------
  |  |  137|    530|#define	EM_IA_64	50
  ------------------
  |  Branch (1494:4): [True: 73, False: 1.22k]
  ------------------
 1495|    997|			case EM_386:
  ------------------
  |  |  134|    997|#define	EM_386		3
  ------------------
  |  Branch (1495:4): [True: 467, False: 829]
  ------------------
 1496|  1.07k|			case EM_AMD64:
  ------------------
  |  |  138|  1.07k|#define	EM_AMD64	62
  ------------------
  |  Branch (1496:4): [True: 78, False: 1.21k]
  ------------------
 1497|  1.07k|				break;
 1498|    221|			default:
  ------------------
  |  Branch (1498:4): [True: 221, False: 1.07k]
  ------------------
 1499|    221|				goto skip;
 1500|  1.29k|			}
 1501|       |
 1502|  1.07k|			if (nbadcap > 5)
  ------------------
  |  Branch (1502:8): [True: 371, False: 704]
  ------------------
 1503|    371|				break;
 1504|    704|			if (lseek(fd, xsh_offset, SEEK_SET)
  ------------------
  |  |  156|    704|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  1.40k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 398, False: 306]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  157|    704|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  158|    704|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1504:8): [True: 1, False: 703]
  ------------------
 1505|    704|			    == CAST(off_t, -1)) {
  ------------------
  |  |  426|    704|#define CAST(T, b)	((T)(b))
  ------------------
 1506|      1|				file_badseek(ms);
 1507|      1|				return -1;
 1508|      1|			}
 1509|    703|			coff = 0;
 1510|  34.0k|			for (;;) {
 1511|  34.0k|				Elf32_Cap cap32;
 1512|  34.0k|				Elf64_Cap cap64;
 1513|  34.0k|				char cbuf[/*CONSTCOND*/
 1514|  34.0k|				    MAX(sizeof(cap32), sizeof(cap64))];
 1515|  34.0k|				if ((coff += xcap_sizeof) >
  ------------------
  |  |  226|  34.0k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  34.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (226:22): [True: 1.67k, False: 32.3k]
  |  |  ------------------
  |  |  227|  34.0k|			 ? sizeof(cap32)			\
  |  |  228|  34.0k|			 : sizeof(cap64))
  ------------------
  |  Branch (1515:9): [True: 601, False: 33.4k]
  ------------------
 1516|  34.0k|				    CAST(off_t, xsh_size))
  ------------------
  |  |  426|  68.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 1.67k, False: 32.3k]
  |  |  ------------------
  ------------------
 1517|    601|					break;
 1518|  33.4k|				if (read(fd, cbuf, CAST(size_t, xcap_sizeof)) !=
  ------------------
  |  |  426|  66.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 1.32k, False: 32.1k]
  |  |  ------------------
  ------------------
  |  Branch (1518:9): [True: 84, False: 33.3k]
  ------------------
 1519|  33.4k|				    CAST(ssize_t, xcap_sizeof)) {
  ------------------
  |  |  426|  66.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 1.32k, False: 32.1k]
  |  |  ------------------
  ------------------
 1520|     84|					file_badread(ms);
 1521|     84|					return -1;
 1522|     84|				}
 1523|  33.3k|				if (cbuf[0] == 'A') {
  ------------------
  |  Branch (1523:9): [True: 18, False: 33.3k]
  ------------------
 1524|       |#ifdef notyet
 1525|       |					char *p = cbuf + 1;
 1526|       |					uint32_t len, tag;
 1527|       |					memcpy(&len, p, sizeof(len));
 1528|       |					p += 4;
 1529|       |					len = getu32(swap, len);
 1530|       |					if (memcmp("gnu", p, 3) != 0) {
 1531|       |					    if (file_printf(ms,
 1532|       |						", unknown capability %.3s", p)
 1533|       |						== -1)
 1534|       |						return -1;
 1535|       |					    break;
 1536|       |					}
 1537|       |					p += strlen(p) + 1;
 1538|       |					tag = *p++;
 1539|       |					memcpy(&len, p, sizeof(len));
 1540|       |					p += 4;
 1541|       |					len = getu32(swap, len);
 1542|       |					if (tag != 1) {
 1543|       |					    if (file_printf(ms, ", unknown gnu"
 1544|       |						" capability tag %d", tag)
 1545|       |						== -1)
 1546|       |						return -1;
 1547|       |					    break;
 1548|       |					}
 1549|       |					// gnu attributes
 1550|       |#endif
 1551|     18|					break;
 1552|     18|				}
 1553|  33.3k|				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  223|  33.3k|#define xcap_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  33.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (223:20): [True: 1.27k, False: 32.0k]
  |  |  ------------------
  |  |  224|  33.3k|			 ? CAST(void *, &cap32)			\
  |  |  ------------------
  |  |  |  |  426|  1.27k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  225|  33.3k|			 : CAST(void *, &cap64))
  |  |  ------------------
  |  |  |  |  426|  32.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  226|  33.3k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  33.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (226:22): [True: 1.27k, False: 32.0k]
  |  |  ------------------
  |  |  227|  33.3k|			 ? sizeof(cap32)			\
  |  |  228|  33.3k|			 : sizeof(cap64))
  ------------------
 1554|  33.3k|				switch (xcap_tag) {
  ------------------
  |  |  229|  33.3k|#define xcap_tag	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  33.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (229:19): [True: 1.27k, False: 32.0k]
  |  |  ------------------
  |  |  230|  33.3k|			 ? elf_getu32(swap, cap32.c_tag)	\
  |  |  ------------------
  |  |  |  |  144|  1.27k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  231|  33.3k|			 : elf_getu64(swap, cap64.c_tag))
  |  |  ------------------
  |  |  |  |  145|  32.0k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1555|  2.50k|				case CA_SUNW_NULL:
  ------------------
  |  |  393|  2.50k|#define	CA_SUNW_NULL	0
  ------------------
  |  Branch (1555:5): [True: 2.50k, False: 30.8k]
  ------------------
 1556|  2.50k|					break;
 1557|    566|				case CA_SUNW_HW_1:
  ------------------
  |  |  394|    566|#define	CA_SUNW_HW_1	1
  ------------------
  |  Branch (1557:5): [True: 566, False: 32.7k]
  ------------------
 1558|    566|					cap_hw1 |= xcap_val;
  ------------------
  |  |  232|    566|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    566|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (232:19): [True: 59, False: 507]
  |  |  ------------------
  |  |  233|    566|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  144|     59|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  234|    566|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  145|    507|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1559|    566|					break;
 1560|    306|				case CA_SUNW_SF_1:
  ------------------
  |  |  395|    306|#define	CA_SUNW_SF_1	2
  ------------------
  |  Branch (1560:5): [True: 306, False: 33.0k]
  ------------------
 1561|    306|					cap_sf1 |= xcap_val;
  ------------------
  |  |  232|    306|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    306|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (232:19): [True: 63, False: 243]
  |  |  ------------------
  |  |  233|    306|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  144|     63|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  234|    306|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  145|    243|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1562|    306|					break;
 1563|  29.9k|				default:
  ------------------
  |  Branch (1563:5): [True: 29.9k, False: 3.38k]
  ------------------
 1564|  29.9k|					if (file_printf(ms,
  ------------------
  |  Branch (1564:10): [True: 0, False: 29.9k]
  ------------------
 1565|  29.9k|					    ", with unknown capability "
 1566|  29.9k|					    "%#" INT64_T_FORMAT "x = %#"
 1567|  29.9k|					    INT64_T_FORMAT "x",
 1568|  29.9k|					    CAST(unsigned long long, xcap_tag),
  ------------------
  |  |  426|  59.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 683, False: 29.2k]
  |  |  ------------------
  ------------------
 1569|  29.9k|					    CAST(unsigned long long, xcap_val))
  ------------------
  |  |  426|  59.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (426:25): [True: 683, False: 29.2k]
  |  |  ------------------
  ------------------
 1570|  29.9k|					    == -1)
 1571|      0|						return -1;
 1572|  29.9k|					if (nbadcap++ > 2)
  ------------------
  |  Branch (1572:10): [True: 28.8k, False: 1.13k]
  ------------------
 1573|  28.8k|						coff = xsh_size;
  ------------------
  |  |  153|  28.8k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  426|  57.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 202, False: 28.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1574|  29.9k|					break;
 1575|  33.3k|				}
 1576|  33.3k|			}
 1577|       |			/*FALLTHROUGH*/
 1578|    840|		skip:
 1579|  15.1k|		default:
  ------------------
  |  Branch (1579:3): [True: 14.2k, False: 2.71k]
  ------------------
 1580|  15.1k|			break;
 1581|  17.0k|		}
 1582|  17.0k|	}
 1583|       |
 1584|    235|	if (has_debug_info) {
  ------------------
  |  Branch (1584:6): [True: 1, False: 234]
  ------------------
 1585|      1|		if (file_printf(ms, ", with debug_info") == -1)
  ------------------
  |  Branch (1585:7): [True: 0, False: 1]
  ------------------
 1586|      0|			return -1;
 1587|      1|	}
 1588|    235|	if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
  ------------------
  |  Branch (1588:6): [True: 0, False: 235]
  |  Branch (1588:38): [True: 228, False: 7]
  ------------------
 1589|      0|		return -1;
 1590|    235|	if (cap_hw1) {
  ------------------
  |  Branch (1590:6): [True: 147, False: 88]
  ------------------
 1591|    147|		const cap_desc_t *cdp;
 1592|    147|		switch (mach) {
 1593|      8|		case EM_SPARC:
  ------------------
  |  |  133|      8|#define	EM_SPARC	2
  ------------------
  |  Branch (1593:3): [True: 8, False: 139]
  ------------------
 1594|      8|		case EM_SPARC32PLUS:
  ------------------
  |  |  135|      8|#define	EM_SPARC32PLUS	18
  ------------------
  |  Branch (1594:3): [True: 0, False: 147]
  ------------------
 1595|    114|		case EM_SPARCV9:
  ------------------
  |  |  136|    114|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1595:3): [True: 106, False: 41]
  ------------------
 1596|    114|			cdp = cap_desc_sparc;
 1597|    114|			break;
 1598|     30|		case EM_386:
  ------------------
  |  |  134|     30|#define	EM_386		3
  ------------------
  |  Branch (1598:3): [True: 30, False: 117]
  ------------------
 1599|     32|		case EM_IA_64:
  ------------------
  |  |  137|     32|#define	EM_IA_64	50
  ------------------
  |  Branch (1599:3): [True: 2, False: 145]
  ------------------
 1600|     33|		case EM_AMD64:
  ------------------
  |  |  138|     33|#define	EM_AMD64	62
  ------------------
  |  Branch (1600:3): [True: 1, False: 146]
  ------------------
 1601|     33|			cdp = cap_desc_386;
 1602|     33|			break;
 1603|      0|		default:
  ------------------
  |  Branch (1603:3): [True: 0, False: 147]
  ------------------
 1604|      0|			cdp = NULL;
 1605|      0|			break;
 1606|    147|		}
 1607|    147|		if (file_printf(ms, ", uses") == -1)
  ------------------
  |  Branch (1607:7): [True: 0, False: 147]
  ------------------
 1608|      0|			return -1;
 1609|    147|		if (cdp) {
  ------------------
  |  Branch (1609:7): [True: 147, False: 0]
  ------------------
 1610|  2.22k|			while (cdp->cd_name) {
  ------------------
  |  Branch (1610:11): [True: 2.07k, False: 147]
  ------------------
 1611|  2.07k|				if (cap_hw1 & cdp->cd_mask) {
  ------------------
  |  Branch (1611:9): [True: 818, False: 1.26k]
  ------------------
 1612|    818|					if (file_printf(ms,
  ------------------
  |  Branch (1612:10): [True: 0, False: 818]
  ------------------
 1613|    818|					    " %s", cdp->cd_name) == -1)
 1614|      0|						return -1;
 1615|    818|					cap_hw1 &= ~cdp->cd_mask;
 1616|    818|				}
 1617|  2.07k|				++cdp;
 1618|  2.07k|			}
 1619|    147|			if (cap_hw1)
  ------------------
  |  Branch (1619:8): [True: 139, False: 8]
  ------------------
 1620|    139|				if (file_printf(ms,
  ------------------
  |  Branch (1620:9): [True: 0, False: 139]
  ------------------
 1621|    139|				    " unknown hardware capability %#"
 1622|    139|				    INT64_T_FORMAT "x",
 1623|    139|				    CAST(unsigned long long, cap_hw1)) == -1)
  ------------------
  |  |  426|    139|#define CAST(T, b)	((T)(b))
  ------------------
 1624|      0|					return -1;
 1625|    147|		} else {
 1626|      0|			if (file_printf(ms,
  ------------------
  |  Branch (1626:8): [True: 0, False: 0]
  ------------------
 1627|      0|			    " hardware capability %#" INT64_T_FORMAT "x",
 1628|      0|			    CAST(unsigned long long, cap_hw1)) == -1)
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1629|      0|				return -1;
 1630|      0|		}
 1631|    147|	}
 1632|    235|	if (cap_sf1) {
  ------------------
  |  Branch (1632:6): [True: 119, False: 116]
  ------------------
 1633|    119|		if (cap_sf1 & SF1_SUNW_FPUSED) {
  ------------------
  |  |  399|    119|#define	SF1_SUNW_FPUSED	0x02
  ------------------
  |  Branch (1633:7): [True: 49, False: 70]
  ------------------
 1634|     49|			if (file_printf(ms,
  ------------------
  |  Branch (1634:8): [True: 0, False: 49]
  ------------------
 1635|     49|			    (cap_sf1 & SF1_SUNW_FPKNWN)
  ------------------
  |  |  398|     49|#define	SF1_SUNW_FPKNWN	0x01
  ------------------
  |  Branch (1635:8): [True: 43, False: 6]
  ------------------
 1636|     49|			    ? ", uses frame pointer"
 1637|     49|			    : ", not known to use frame pointer") == -1)
 1638|      0|				return -1;
 1639|     49|		}
 1640|    119|		cap_sf1 &= ~SF1_SUNW_MASK;
  ------------------
  |  |  400|    119|#define	SF1_SUNW_MASK	0x03
  ------------------
 1641|    119|		if (cap_sf1)
  ------------------
  |  Branch (1641:7): [True: 118, False: 1]
  ------------------
 1642|    118|			if (file_printf(ms,
  ------------------
  |  Branch (1642:8): [True: 0, False: 118]
  ------------------
 1643|    118|			    ", with unknown software capability %#"
 1644|    118|			    INT64_T_FORMAT "x",
 1645|    118|			    CAST(unsigned long long, cap_sf1)) == -1)
  ------------------
  |  |  426|    118|#define CAST(T, b)	((T)(b))
  ------------------
 1646|      0|				return -1;
 1647|    119|	}
 1648|    235|	return 0;
 1649|    235|}
readelf.c:getu64:
  120|   209k|{
  121|   209k|	union {
  122|   209k|		uint64_t ui;
  123|   209k|		char c[8];
  124|   209k|	} retval, tmpval;
  125|       |
  126|   209k|	if (swap) {
  ------------------
  |  Branch (126:6): [True: 11.6k, False: 198k]
  ------------------
  127|  11.6k|		tmpval.ui = value;
  128|       |
  129|  11.6k|		retval.c[0] = tmpval.c[7];
  130|  11.6k|		retval.c[1] = tmpval.c[6];
  131|  11.6k|		retval.c[2] = tmpval.c[5];
  132|  11.6k|		retval.c[3] = tmpval.c[4];
  133|  11.6k|		retval.c[4] = tmpval.c[3];
  134|  11.6k|		retval.c[5] = tmpval.c[2];
  135|  11.6k|		retval.c[6] = tmpval.c[1];
  136|  11.6k|		retval.c[7] = tmpval.c[0];
  137|       |
  138|  11.6k|		return retval.ui;
  139|  11.6k|	} else
  140|   198k|		return value;
  141|   209k|}

file_softmagic:
  119|  13.7k|{
  120|  13.7k|	struct mlist *ml;
  121|  13.7k|	int rv = 0, printed_something = 0, need_separator = 0;
  122|  13.7k|	uint16_t nc, ic;
  123|       |
  124|  13.7k|	if (name_count == NULL) {
  ------------------
  |  Branch (124:6): [True: 13.7k, False: 0]
  ------------------
  125|  13.7k|		nc = 0;
  126|  13.7k|		name_count = &nc;
  127|  13.7k|	}
  128|  13.7k|	if (indir_count == NULL) {
  ------------------
  |  Branch (128:6): [True: 13.7k, False: 0]
  ------------------
  129|  13.7k|		ic = 0;
  130|  13.7k|		indir_count = &ic;
  131|  13.7k|	}
  132|       |
  133|  27.3k|	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next) {
  ------------------
  |  Branch (133:32): [True: 13.7k, False: 13.6k]
  ------------------
  134|  13.7k|		int ret = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
  135|  13.7k|		    0, mode, text, 0, indir_count, name_count,
  136|  13.7k|		    &printed_something, &need_separator, NULL, NULL);
  137|  13.7k|		switch (ret) {
  138|    111|		case -1:
  ------------------
  |  Branch (138:3): [True: 111, False: 13.6k]
  ------------------
  139|    111|			return ret;
  140|  5.13k|		case 0:
  ------------------
  |  Branch (140:3): [True: 5.13k, False: 8.58k]
  ------------------
  141|  5.13k|			continue;
  142|  8.47k|		default:
  ------------------
  |  Branch (142:3): [True: 8.47k, False: 5.24k]
  ------------------
  143|  8.47k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  8.47k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (143:8): [True: 0, False: 8.47k]
  ------------------
  144|      0|				return ret;
  145|  8.47k|			rv = ret;
  146|  8.47k|			break;
  147|  13.7k|		}
  148|  13.7k|	}
  149|       |
  150|  13.6k|	return rv;
  151|  13.7k|}
softmagic.c:match:
  210|  34.3k|{
  211|  34.3k|	uint32_t magindex = 0;
  212|  34.3k|	unsigned int cont_level = 0;
  213|  34.3k|	int found_matchv = 0; /* if a match is found it is set to 1*/
  214|  34.3k|	int returnvalv = 0, e;
  215|       |	/* a flag to print X\n  X\n- X */
  216|  34.3k|	int firstline = !(*printed_something || *need_separator);
  ------------------
  |  Branch (216:20): [True: 17.5k, False: 16.8k]
  |  Branch (216:42): [True: 1.31k, False: 15.5k]
  ------------------
  217|  34.3k|	struct buffer bb;
  218|  34.3k|	int print = (ms->flags & MAGIC_NODESC) == 0;
  ------------------
  |  |   52|  34.3k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  34.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  34.3k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  34.3k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  34.3k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  34.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  219|       |
  220|       |	/*
  221|       |	 * returnval can be 0 if a match is found, but there was no
  222|       |	 * annotation to be printed.
  223|       |	 */
  224|  34.3k|	if (returnval == NULL)
  ------------------
  |  Branch (224:6): [True: 21.3k, False: 12.9k]
  ------------------
  225|  21.3k|		returnval = &returnvalv;
  226|  34.3k|	if (found_match == NULL)
  ------------------
  |  Branch (226:6): [True: 21.3k, False: 12.9k]
  ------------------
  227|  21.3k|		found_match = &found_matchv;
  228|       |
  229|  34.3k|	if (file_check_mem(ms, cont_level) == -1)
  ------------------
  |  Branch (229:6): [True: 0, False: 34.3k]
  ------------------
  230|      0|		return -1;
  231|       |
  232|  72.5M|	for (magindex = 0; magindex < nmagic; magindex++) {
  ------------------
  |  Branch (232:21): [True: 72.5M, False: 32.5k]
  ------------------
  233|  72.5M|		int flush = 0;
  234|  72.5M|		struct magic *m = &magic[magindex];
  235|  72.5M|		file_regex_t **m_rxcomp = &magic_rxcomp[magindex];
  236|       |
  237|  72.5M|		if (m->type != FILE_NAME)
  ------------------
  |  |  267|  72.5M|#define				FILE_NAME		45
  ------------------
  |  Branch (237:7): [True: 72.5M, False: 12.9k]
  ------------------
  238|  72.5M|		if ((IS_STRING(m->type) &&
  ------------------
  |  |  285|   145M|	((t) == FILE_STRING || \
  |  |  ------------------
  |  |  |  |  227|   145M|#define				FILE_STRING		5
  |  |  ------------------
  |  |  |  Branch (285:3): [True: 44.6M, False: 27.8M]
  |  |  ------------------
  |  |  286|  72.5M|	 (t) == FILE_PSTRING || \
  |  |  ------------------
  |  |  |  |  235|   100M|#define				FILE_PSTRING		13
  |  |  ------------------
  |  |  |  Branch (286:3): [True: 21.3k, False: 27.8M]
  |  |  ------------------
  |  |  287|  72.5M|	 (t) == FILE_BESTRING16 || \
  |  |  ------------------
  |  |  |  |  240|   100M|#define				FILE_BESTRING16		18
  |  |  ------------------
  |  |  |  Branch (287:3): [True: 0, False: 27.8M]
  |  |  ------------------
  |  |  288|  72.5M|	 (t) == FILE_LESTRING16 || \
  |  |  ------------------
  |  |  |  |  241|   100M|#define				FILE_LESTRING16		19
  |  |  ------------------
  |  |  |  Branch (288:3): [True: 42.7k, False: 27.8M]
  |  |  ------------------
  |  |  289|  72.5M|	 (t) == FILE_REGEX || \
  |  |  ------------------
  |  |  |  |  239|   100M|#define				FILE_REGEX		17
  |  |  ------------------
  |  |  |  Branch (289:3): [True: 1.25M, False: 26.5M]
  |  |  ------------------
  |  |  290|  72.5M|	 (t) == FILE_SEARCH || \
  |  |  ------------------
  |  |  |  |  242|  99.0M|#define				FILE_SEARCH		20
  |  |  ------------------
  |  |  |  Branch (290:3): [True: 5.03M, False: 21.5M]
  |  |  ------------------
  |  |  291|  72.5M|	 (t) == FILE_INDIRECT || \
  |  |  ------------------
  |  |  |  |  263|  94.0M|#define				FILE_INDIRECT		41
  |  |  ------------------
  |  |  |  Branch (291:3): [True: 0, False: 21.5M]
  |  |  ------------------
  |  |  292|  72.5M|	 (t) == FILE_NAME || \
  |  |  ------------------
  |  |  |  |  267|  94.0M|#define				FILE_NAME		45
  |  |  ------------------
  |  |  |  Branch (292:3): [True: 0, False: 21.5M]
  |  |  ------------------
  |  |  293|  72.5M|	 (t) == FILE_USE || \
  |  |  ------------------
  |  |  |  |  268|  94.0M|#define				FILE_USE		46
  |  |  ------------------
  |  |  |  Branch (293:3): [True: 0, False: 21.5M]
  |  |  ------------------
  |  |  294|   145M|	 (t) == FILE_OCTAL)
  |  |  ------------------
  |  |  |  |  281|  21.5M|#define				FILE_OCTAL		59
  |  |  ------------------
  |  |  |  Branch (294:3): [True: 0, False: 21.5M]
  |  |  ------------------
  ------------------
  239|  72.5M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  240|  72.5M|		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  357|  10.7M|#define str_flags _u._s._flags
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  239|  10.7M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  377|  10.7M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  10.7M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  376|  10.7M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  10.7M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  377|  10.7M|#define STRING_BINTEST				BIT(6)
  |  |  ------------------
  |  |  |  |  370|  10.7M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (240:10): [True: 10.7M, False: 40.2M]
  |  Branch (240:18): [True: 444k, False: 10.3M]
  ------------------
  241|  51.0M|		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  357|  40.2M|#define str_flags _u._s._flags
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  239|  40.2M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  377|  40.2M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  40.2M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  376|  40.2M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  40.2M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  376|  40.2M|#define STRING_TEXTTEST				BIT(5)
  |  |  ------------------
  |  |  |  |  370|  40.2M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (241:10): [True: 40.2M, False: 10.3M]
  |  Branch (241:19): [True: 1.80M, False: 38.4M]
  ------------------
  242|  72.5M|		    (m->flag & mode) != mode) {
  ------------------
  |  Branch (242:7): [True: 11.9M, False: 58.3M]
  ------------------
  243|  72.3M|flush:
  244|       |			/* Skip sub-tests */
  245|   323M|			while (magindex < nmagic - 1 &&
  ------------------
  |  Branch (245:11): [True: 323M, False: 17.8k]
  ------------------
  246|   323M|			    magic[magindex + 1].cont_level != 0)
  ------------------
  |  Branch (246:8): [True: 251M, False: 72.3M]
  ------------------
  247|   251M|				magindex++;
  248|  72.3M|			cont_level = 0;
  249|  72.3M|			continue; /* Skip to next top-level test*/
  250|  14.2M|		}
  251|       |
  252|  58.3M|		if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
  ------------------
  |  Branch (252:7): [True: 21.4k, False: 58.3M]
  ------------------
  253|  21.4k|			goto flush;
  254|  58.3M|		ms->line = m->lineno;
  255|       |
  256|       |		/* if main entry matches, print it... */
  257|  58.3M|		switch (mget(ms, m, b, CAST(const unsigned char *, bb.fbuf),
  ------------------
  |  |  426|  58.3M|#define CAST(T, b)	((T)(b))
  ------------------
  258|  58.3M|		    bb.flen, offset, cont_level,
  259|  58.3M|		    mode, text, flip, indir_count, name_count,
  260|  58.3M|		    printed_something, need_separator, returnval, found_match))
  261|  58.3M|		{
  262|      6|		case -1:
  ------------------
  |  Branch (262:3): [True: 6, False: 58.3M]
  ------------------
  263|      6|			return -1;
  264|  7.76M|		case 0:
  ------------------
  |  Branch (264:3): [True: 7.76M, False: 50.5M]
  ------------------
  265|  7.76M|			flush = m->reln != '!';
  266|  7.76M|			break;
  267|  50.5M|		default:
  ------------------
  |  Branch (267:3): [True: 50.5M, False: 7.76M]
  ------------------
  268|  50.5M|			if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  263|  50.5M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (268:8): [True: 0, False: 50.5M]
  ------------------
  269|      0|				*found_match = 1;
  270|      0|				*returnval = 1;
  271|      0|			}
  272|       |
  273|  50.5M|			switch (magiccheck(ms, m, m_rxcomp)) {
  274|      0|			case -1:
  ------------------
  |  Branch (274:4): [True: 0, False: 50.5M]
  ------------------
  275|      0|				return -1;
  276|  50.3M|			case 0:
  ------------------
  |  Branch (276:4): [True: 50.3M, False: 209k]
  ------------------
  277|  50.3M|				flush++;
  278|  50.3M|				break;
  279|   209k|			default:
  ------------------
  |  Branch (279:4): [True: 209k, False: 50.3M]
  ------------------
  280|   209k|				flush = 0;
  281|   209k|				break;
  282|  50.5M|			}
  283|  50.5M|			break;
  284|  58.3M|		}
  285|  58.3M|		if (flush) {
  ------------------
  |  Branch (285:7): [True: 58.1M, False: 209k]
  ------------------
  286|       |			/*
  287|       |			 * main entry didn't match,
  288|       |			 * flush its continuations
  289|       |			 */
  290|  58.1M|			goto flush;
  291|  58.1M|		}
  292|       |
  293|   209k|		if ((e = handle_annotation(ms, m, firstline)) != 0)
  ------------------
  |  Branch (293:7): [True: 0, False: 209k]
  ------------------
  294|      0|		{
  295|      0|			*found_match = 1;
  296|      0|			*need_separator = 1;
  297|      0|			*printed_something = 1;
  298|      0|			*returnval = 1;
  299|      0|			return e;
  300|      0|		}
  301|       |
  302|       |		/*
  303|       |		 * If we are going to print something, we'll need to print
  304|       |		 * a blank before we print something else.
  305|       |		 */
  306|   209k|		if (*m->desc) {
  ------------------
  |  Branch (306:7): [True: 7.99k, False: 201k]
  ------------------
  307|  7.99k|			*found_match = 1;
  308|  7.99k|			if (print) {
  ------------------
  |  Branch (308:8): [True: 7.99k, False: 0]
  ------------------
  309|  7.99k|				*returnval = 1;
  310|  7.99k|				*need_separator = 1;
  311|  7.99k|				*printed_something = 1;
  312|  7.99k|				if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (312:9): [True: 0, False: 7.99k]
  ------------------
  313|      0|					return -1;
  314|  7.99k|				if (mprint(ms, m) == -1)
  ------------------
  |  Branch (314:9): [True: 0, False: 7.99k]
  ------------------
  315|      0|					return -1;
  316|  7.99k|			}
  317|  7.99k|		}
  318|       |
  319|   209k|		switch (moffset(ms, m, &bb, &ms->c.li[cont_level].off)) {
  320|  15.8k|		case -1:
  ------------------
  |  Branch (320:3): [True: 15.8k, False: 193k]
  ------------------
  321|  15.8k|		case 0:
  ------------------
  |  Branch (321:3): [True: 0, False: 209k]
  ------------------
  322|  15.8k|			goto flush;
  323|   193k|		default:
  ------------------
  |  Branch (323:3): [True: 193k, False: 15.8k]
  ------------------
  324|   193k|			break;
  325|   209k|		}
  326|       |
  327|       |		/* and any continuations that match */
  328|   193k|		if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (328:7): [True: 0, False: 193k]
  ------------------
  329|      0|			return -1;
  330|       |
  331|  2.97M|		while (magindex + 1 < nmagic &&
  ------------------
  |  Branch (331:10): [True: 2.96M, False: 14.7k]
  ------------------
  332|  2.97M|		    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (332:7): [True: 2.78M, False: 177k]
  ------------------
  333|  2.78M|			m = &magic[++magindex];
  334|  2.78M|			m_rxcomp = &magic_rxcomp[magindex];
  335|  2.78M|			ms->line = m->lineno; /* for messages */
  336|       |
  337|  2.78M|			if (cont_level < m->cont_level)
  ------------------
  |  Branch (337:8): [True: 1.71M, False: 1.06M]
  ------------------
  338|  1.71M|				continue;
  339|  1.06M|			if (cont_level > m->cont_level) {
  ------------------
  |  Branch (339:8): [True: 81.9k, False: 987k]
  ------------------
  340|       |				/*
  341|       |				 * We're at the end of the level
  342|       |				 * "cont_level" continuations.
  343|       |				 */
  344|  81.9k|				cont_level = m->cont_level;
  345|  81.9k|			}
  346|  1.06M|			if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
  ------------------
  |  Branch (346:8): [True: 211, False: 1.06M]
  ------------------
  347|    211|				goto flush;
  348|  1.06M|			if (m->flag & OFFADD) {
  ------------------
  |  |  206|  1.06M|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
  |  Branch (348:8): [True: 54.9k, False: 1.01M]
  ------------------
  349|  54.9k|				if (cont_level == 0) {
  ------------------
  |  Branch (349:9): [True: 0, False: 54.9k]
  ------------------
  350|      0|					if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (350:10): [True: 0, False: 0]
  ------------------
  351|      0|						fprintf(stderr,
  352|      0|						    "direct *zero*"
  353|      0|						    " cont_level\n");
  354|      0|					return 0;
  355|      0|				}
  356|  54.9k|				ms->offset +=
  357|  54.9k|				    ms->c.li[cont_level - 1].off;
  358|  54.9k|			}
  359|       |
  360|  1.06M|#ifdef ENABLE_CONDITIONALS
  361|  1.06M|			if (m->cond == COND_ELSE ||
  ------------------
  |  |  338|  2.13M|#define				COND_ELSE	3
  ------------------
  |  Branch (361:8): [True: 0, False: 1.06M]
  ------------------
  362|  1.06M|			    m->cond == COND_ELIF) {
  ------------------
  |  |  337|  1.06M|#define				COND_ELIF	2
  ------------------
  |  Branch (362:8): [True: 0, False: 1.06M]
  ------------------
  363|      0|				if (ms->c.li[cont_level].last_match == 1)
  ------------------
  |  Branch (363:9): [True: 0, False: 0]
  ------------------
  364|      0|					continue;
  365|      0|			}
  366|  1.06M|#endif
  367|  1.06M|			switch (mget(ms, m, b, CAST(const unsigned char *,
  ------------------
  |  |  426|  1.06M|#define CAST(T, b)	((T)(b))
  ------------------
  368|  1.06M|			    bb.fbuf), bb.flen, offset,
  369|  1.06M|			    cont_level, mode, text, flip, indir_count,
  370|  1.06M|			    name_count, printed_something, need_separator,
  371|  1.06M|			    returnval, found_match)) {
  372|  1.78k|			case -1:
  ------------------
  |  Branch (372:4): [True: 1.78k, False: 1.06M]
  ------------------
  373|  1.78k|				return -1;
  374|  32.9k|			case 0:
  ------------------
  |  Branch (374:4): [True: 32.9k, False: 1.03M]
  ------------------
  375|  32.9k|				if (m->reln != '!')
  ------------------
  |  Branch (375:9): [True: 31.7k, False: 1.24k]
  ------------------
  376|  31.7k|					continue;
  377|  1.24k|				flush = 1;
  378|  1.24k|				break;
  379|  1.03M|			default:
  ------------------
  |  Branch (379:4): [True: 1.03M, False: 34.7k]
  ------------------
  380|  1.03M|				if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  263|  1.03M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (380:9): [True: 5.31k, False: 1.02M]
  ------------------
  381|  5.31k|					*found_match = 1;
  382|  5.31k|					*returnval = 1;
  383|  5.31k|				}
  384|  1.03M|				flush = 0;
  385|  1.03M|				break;
  386|  1.06M|			}
  387|       |
  388|  1.03M|			switch (flush ? 1 : magiccheck(ms, m, m_rxcomp)) {
  ------------------
  |  Branch (388:12): [True: 1.24k, False: 1.03M]
  ------------------
  389|      0|			case -1:
  ------------------
  |  Branch (389:4): [True: 0, False: 1.03M]
  ------------------
  390|      0|				return -1;
  391|   829k|			case 0:
  ------------------
  |  Branch (391:4): [True: 829k, False: 206k]
  ------------------
  392|   829k|#ifdef ENABLE_CONDITIONALS
  393|   829k|				ms->c.li[cont_level].last_match = 0;
  394|   829k|#endif
  395|   829k|				break;
  396|   206k|			default:
  ------------------
  |  Branch (396:4): [True: 206k, False: 829k]
  ------------------
  397|   206k|#ifdef ENABLE_CONDITIONALS
  398|   206k|				ms->c.li[cont_level].last_match = 1;
  399|   206k|#endif
  400|   206k|				if (m->type == FILE_CLEAR)
  ------------------
  |  |  269|   206k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (400:9): [True: 1.37k, False: 204k]
  ------------------
  401|  1.37k|					ms->c.li[cont_level].got_match = 0;
  402|   204k|				else if (ms->c.li[cont_level].got_match) {
  ------------------
  |  Branch (402:14): [True: 62.1k, False: 142k]
  ------------------
  403|  62.1k|					if (m->type == FILE_DEFAULT)
  ------------------
  |  |  225|  62.1k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (403:10): [True: 981, False: 61.1k]
  ------------------
  404|    981|						break;
  405|  62.1k|				} else
  406|   142k|					ms->c.li[cont_level].got_match = 1;
  407|       |
  408|   205k|				if ((e = handle_annotation(ms, m, firstline))
  ------------------
  |  Branch (408:9): [True: 0, False: 205k]
  ------------------
  409|   205k|				    != 0) {
  410|      0|					*found_match = 1;
  411|      0|					*need_separator = 1;
  412|      0|					*printed_something = 1;
  413|      0|					*returnval = 1;
  414|      0|					return e;
  415|      0|				}
  416|   205k|				if (*m->desc) {
  ------------------
  |  Branch (416:9): [True: 87.3k, False: 117k]
  ------------------
  417|  87.3k|					*found_match = 1;
  418|  87.3k|				}
  419|   205k|				if (print && *m->desc) {
  ------------------
  |  Branch (419:9): [True: 205k, False: 0]
  |  Branch (419:18): [True: 87.3k, False: 117k]
  ------------------
  420|  87.3k|					*returnval = 1;
  421|       |					/*
  422|       |					 * This continuation matched.  Print
  423|       |					 * its message, with a blank before it
  424|       |					 * if the previous item printed and
  425|       |					 * this item isn't empty.
  426|       |					 */
  427|       |					/*
  428|       |					 * If we are going to print something,
  429|       |					 * make sure that we have a separator
  430|       |					 * first.
  431|       |					 */
  432|  87.3k|					if (!*printed_something) {
  ------------------
  |  Branch (432:10): [True: 8.74k, False: 78.5k]
  ------------------
  433|  8.74k|						*printed_something = 1;
  434|  8.74k|						if (print_sep(ms, firstline)
  ------------------
  |  Branch (434:11): [True: 0, False: 8.74k]
  ------------------
  435|  8.74k|						    == -1)
  436|      0|							return -1;
  437|  8.74k|					}
  438|       |					/* space if previous printed */
  439|  87.3k|					if (*need_separator
  ------------------
  |  Branch (439:10): [True: 84.9k, False: 2.39k]
  ------------------
  440|  87.3k|					    && (m->flag & NOSPACE) == 0) {
  ------------------
  |  |  209|  84.9k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (440:13): [True: 41.5k, False: 43.4k]
  ------------------
  441|  41.5k|						if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (441:11): [True: 0, False: 41.5k]
  ------------------
  442|      0|							return -1;
  443|  41.5k|					}
  444|  87.3k|					if (mprint(ms, m) == -1)
  ------------------
  |  Branch (444:10): [True: 0, False: 87.3k]
  ------------------
  445|      0|						return -1;
  446|  87.3k|					*need_separator = 1;
  447|  87.3k|				}
  448|       |
  449|   205k|				switch (moffset(ms, m, &bb,
  450|   205k|				    &ms->c.li[cont_level].off)) {
  451|  2.24k|				case -1:
  ------------------
  |  Branch (451:5): [True: 2.24k, False: 203k]
  ------------------
  452|  2.24k|				case 0:
  ------------------
  |  Branch (452:5): [True: 0, False: 205k]
  ------------------
  453|  2.24k|					cont_level--;
  454|  2.24k|					break;
  455|   203k|				default:
  ------------------
  |  Branch (455:5): [True: 203k, False: 2.24k]
  ------------------
  456|   203k|					break;
  457|   205k|				}
  458|       |
  459|       |				/*
  460|       |				 * If we see any continuations
  461|       |				 * at a higher level,
  462|       |				 * process them.
  463|       |				 */
  464|   205k|				if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (464:9): [True: 0, False: 205k]
  ------------------
  465|      0|					return -1;
  466|   205k|				break;
  467|  1.03M|			}
  468|  1.03M|		}
  469|   191k|		if (*printed_something) {
  ------------------
  |  Branch (469:7): [True: 56.7k, False: 135k]
  ------------------
  470|  56.7k|			firstline = 0;
  471|  56.7k|		}
  472|   191k|		if (*found_match) {
  ------------------
  |  Branch (472:7): [True: 113k, False: 78.4k]
  ------------------
  473|   113k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|   113k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (473:8): [True: 0, False: 113k]
  ------------------
  474|      0|				return *returnval;
  475|       |			// So that we print a separator
  476|   113k|			*printed_something = 0;
  477|   113k|			firstline = 0;
  478|   113k|		}
  479|   191k|		cont_level = 0;
  480|   191k|	}
  481|  32.5k|	return *returnval;
  482|  34.3k|}
softmagic.c:msetoffset:
 1505|  59.4M|{
 1506|  59.4M|	int32_t offset;
 1507|  59.4M|	if (m->flag & OFFNEGATIVE) {
  ------------------
  |  |  213|  59.4M|#define OFFNEGATIVE	0x80	/* relative to the end of file */
  ------------------
  |  Branch (1507:6): [True: 99.7k, False: 59.3M]
  ------------------
 1508|  99.7k|		offset = -m->offset;
 1509|  99.7k|		if (cont_level > 0) {
  ------------------
  |  Branch (1509:7): [True: 4.58k, False: 95.1k]
  ------------------
 1510|  4.58k|			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  206|  4.58k|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
              			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  207|  4.58k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1510:8): [True: 3.23k, False: 1.35k]
  ------------------
 1511|  3.23k|				goto normal;
 1512|       |#if 0
 1513|       |			file_error(ms, 0, "negative offset %d at continuation"
 1514|       |			    "level %u", m->offset, cont_level);
 1515|       |			return -1;
 1516|       |#endif
 1517|  4.58k|		}
 1518|  96.5k|		if (buffer_fill(b) == -1)
  ------------------
  |  Branch (1518:7): [True: 10.9k, False: 85.5k]
  ------------------
 1519|  10.9k|			return -1;
 1520|  85.5k|		if (o != 0) {
  ------------------
  |  Branch (1520:7): [True: 0, False: 85.5k]
  ------------------
 1521|       |			// Not yet!
 1522|      0|			file_magerror(ms, "non zero offset %" SIZE_T_FORMAT
 1523|      0|			    "u at level %u", o, cont_level);
 1524|      0|			return -1;
 1525|      0|		}
 1526|  85.5k|		if (CAST(size_t, m->offset) > b->elen)
  ------------------
  |  |  426|  85.5k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1526:7): [True: 10.6k, False: 74.9k]
  ------------------
 1527|  10.6k|			return -1;
 1528|  74.9k|		buffer_init(bb, -1, NULL, b->ebuf, b->elen);
 1529|  74.9k|		ms->eoffset = ms->offset = CAST(int32_t, b->elen - m->offset);
  ------------------
  |  |  426|  74.9k|#define CAST(T, b)	((T)(b))
  ------------------
 1530|  59.3M|	} else {
 1531|  59.3M|		offset = m->offset;
 1532|  59.3M|		if (cont_level == 0) {
  ------------------
  |  Branch (1532:7): [True: 58.2M, False: 1.06M]
  ------------------
 1533|  58.2M|normal:
 1534|       |			// XXX: Pass real fd, then who frees bb?
 1535|  58.2M|			buffer_init(bb, -1, NULL, b->fbuf, b->flen);
 1536|  58.2M|			ms->offset = offset;
 1537|  58.2M|			ms->eoffset = 0;
 1538|  58.2M|		} else {
 1539|  1.06M|			ms->offset = ms->eoffset + offset;
 1540|  1.06M|		}
 1541|  59.3M|	}
 1542|  59.3M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  59.3M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1542:6): [True: 0, False: 59.3M]
  ------------------
 1543|      0|		fprintf(stderr, "bb=[%p,%" SIZE_T_FORMAT "u,%"
 1544|      0|		    SIZE_T_FORMAT "u], %d [b=%p,%"
 1545|      0|		    SIZE_T_FORMAT "u,%" SIZE_T_FORMAT "u], [o=%#x, c=%d]\n",
 1546|      0|		    bb->fbuf, bb->flen, bb->elen, ms->offset, b->fbuf,
 1547|      0|		    b->flen, b->elen, offset, cont_level);
 1548|      0|	}
 1549|  59.3M|	return 0;
 1550|  59.4M|}
softmagic.c:mget:
 1580|  59.3M|{
 1581|  59.3M|	uint32_t eoffset, offset = ms->offset;
 1582|  59.3M|	struct buffer bb;
 1583|  59.3M|	intmax_t lhs;
 1584|  59.3M|	file_pushbuf_t *pb;
 1585|  59.3M|	int rv, oneed_separator, in_type, nfound_match;
 1586|  59.3M|	char *rbuf;
 1587|  59.3M|	union VALUETYPE *p = &ms->ms_value;
 1588|  59.3M|	struct mlist ml, *mlp;
 1589|  59.3M|	struct cont c;
 1590|       |
 1591|  59.3M|	if (*indir_count >= ms->indir_max) {
  ------------------
  |  Branch (1591:6): [True: 5, False: 59.3M]
  ------------------
 1592|      5|		file_error(ms, 0, "indirect count (%hu) exceeded",
 1593|      5|		    *indir_count);
 1594|      5|		return -1;
 1595|      5|	}
 1596|       |
 1597|  59.3M|	if (*name_count >= ms->name_max) {
  ------------------
  |  Branch (1597:6): [True: 1, False: 59.3M]
  ------------------
 1598|      1|		file_error(ms, 0, "name use count (%hu) exceeded",
 1599|      1|		    *name_count);
 1600|      1|		return -1;
 1601|      1|	}
 1602|       |
 1603|       |
 1604|       |
 1605|  59.3M|	if (mcopy(ms, p, m->type, m->flag & INDIR, s,
  ------------------
  |  |  205|  59.3M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1605:6): [True: 0, False: 59.3M]
  ------------------
 1606|  59.3M|	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  426|  59.3M|#define CAST(T, b)	((T)(b))
  ------------------
              	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  426|  59.3M|#define CAST(T, b)	((T)(b))
  ------------------
 1607|      0|		return -1;
 1608|       |
 1609|  59.3M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  59.3M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1609:6): [True: 0, False: 59.3M]
  ------------------
 1610|      0|		fprintf(stderr, "mget(type=%d, flag=%#x, offset=%u, o=%"
 1611|      0|		    SIZE_T_FORMAT "u, " "nbytes=%" SIZE_T_FORMAT
 1612|      0|		    "u, il=%hu, nc=%hu)\n",
 1613|      0|		    m->type, m->flag, offset, o, nbytes,
 1614|      0|		    *indir_count, *name_count);
 1615|      0|		mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  427|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1616|      0|		    sizeof(union VALUETYPE));
 1617|      0|#ifndef COMPILE_ONLY
 1618|      0|		file_mdump(m);
 1619|      0|#endif
 1620|      0|	}
 1621|       |
 1622|  59.3M|	if (m->flag & INDIR) {
  ------------------
  |  |  205|  59.3M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1622:6): [True: 35.3k, False: 59.3M]
  ------------------
 1623|  35.3k|		intmax_t off = m->in_offset;
 1624|  35.3k|		const int sgn = m->in_op & FILE_OPSIGNED;
  ------------------
  |  |  330|  35.3k|#define				FILE_OPSIGNED	0x20
  ------------------
 1625|  35.3k|		if (m->in_op & FILE_OPINDIRECT) {
  ------------------
  |  |  332|  35.3k|#define				FILE_OPINDIRECT	0x80
  ------------------
  |  Branch (1625:7): [True: 0, False: 35.3k]
  ------------------
 1626|      0|			const union VALUETYPE *q = CAST(const union VALUETYPE *,
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1627|      0|			    RCAST(const void *, s + offset + off));
 1628|      0|			int op;
 1629|      0|			switch (op = cvt_flip(m->in_type, flip)) {
 1630|      0|			case FILE_BYTE:
  ------------------
  |  |  223|      0|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1630:4): [True: 0, False: 0]
  ------------------
 1631|      0|				if (OFFSET_OOB(nbytes, offset + off, 1))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1632|      0|					return 0;
 1633|      0|				off = SEXT(sgn,8,q->b);
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1634|      0|				break;
 1635|      0|			case FILE_SHORT:
  ------------------
  |  |  224|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1635:4): [True: 0, False: 0]
  ------------------
 1636|      0|				if (OFFSET_OOB(nbytes, offset + off, 2))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1637|      0|					return 0;
 1638|      0|				off = SEXT(sgn,16,q->h);
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1639|      0|				break;
 1640|      0|			case FILE_BESHORT:
  ------------------
  |  |  229|      0|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1640:4): [True: 0, False: 0]
  ------------------
 1641|      0|				if (OFFSET_OOB(nbytes, offset + off, 2))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1642|      0|					return 0;
 1643|      0|				off = SEXT(sgn,16,BE16(q));
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1644|      0|				break;
 1645|      0|			case FILE_LESHORT:
  ------------------
  |  |  232|      0|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1645:4): [True: 0, False: 0]
  ------------------
 1646|      0|				if (OFFSET_OOB(nbytes, offset + off, 2))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1647|      0|					return 0;
 1648|      0|				off = SEXT(sgn,16,LE16(q));
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1649|      0|				break;
 1650|      0|			case FILE_LONG:
  ------------------
  |  |  226|      0|#define				FILE_LONG		4
  ------------------
  |  Branch (1650:4): [True: 0, False: 0]
  ------------------
 1651|      0|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1652|      0|					return 0;
 1653|      0|				off = SEXT(sgn,32,q->l);
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1654|      0|				break;
 1655|      0|			case FILE_BELONG:
  ------------------
  |  |  230|      0|#define				FILE_BELONG		8
  ------------------
  |  Branch (1655:4): [True: 0, False: 0]
  ------------------
 1656|      0|			case FILE_BEID3:
  ------------------
  |  |  261|      0|#define				FILE_BEID3		39
  ------------------
  |  Branch (1656:4): [True: 0, False: 0]
  ------------------
 1657|      0|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1658|      0|					return 0;
 1659|      0|				off = SEXT(sgn,32,BE32(q));
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1660|      0|				break;
 1661|      0|			case FILE_LEID3:
  ------------------
  |  |  262|      0|#define				FILE_LEID3		40
  ------------------
  |  Branch (1661:4): [True: 0, False: 0]
  ------------------
 1662|      0|			case FILE_LELONG:
  ------------------
  |  |  233|      0|#define				FILE_LELONG		11
  ------------------
  |  Branch (1662:4): [True: 0, False: 0]
  ------------------
 1663|      0|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1664|      0|					return 0;
 1665|      0|				off = SEXT(sgn,32,LE32(q));
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1666|      0|				break;
 1667|      0|			case FILE_MELONG:
  ------------------
  |  |  245|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1667:4): [True: 0, False: 0]
  ------------------
 1668|      0|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1669|      0|					return 0;
 1670|      0|				off = SEXT(sgn,32,ME32(q));
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1671|      0|				break;
 1672|      0|			case FILE_BEQUAD:
  ------------------
  |  |  248|      0|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1672:4): [True: 0, False: 0]
  ------------------
 1673|      0|				if (OFFSET_OOB(nbytes, offset + off, 8))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1674|      0|					return 0;
 1675|      0|				off = SEXT(sgn,64,BE64(q));
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1676|      0|				break;
 1677|      0|			case FILE_LEQUAD:
  ------------------
  |  |  247|      0|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1677:4): [True: 0, False: 0]
  ------------------
 1678|      0|				if (OFFSET_OOB(nbytes, offset + off, 8))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1679|      0|					return 0;
 1680|      0|				off = SEXT(sgn,64,LE64(q));
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1681|      0|				break;
 1682|      0|			case FILE_OCTAL:
  ------------------
  |  |  281|      0|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1682:4): [True: 0, False: 0]
  ------------------
 1683|      0|				if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1684|      0|					return 0;
 1685|      0|				off = SEXT(sgn,64,strtoull(p->s, NULL, 8));
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1686|      0|				break;
 1687|      0|			default:
  ------------------
  |  Branch (1687:4): [True: 0, False: 0]
  ------------------
 1688|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1688:9): [True: 0, False: 0]
  ------------------
 1689|      0|					fprintf(stderr, "bad op=%d\n", op);
 1690|      0|				return 0;
 1691|      0|			}
 1692|      0|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1692:8): [True: 0, False: 0]
  ------------------
 1693|      0|				fprintf(stderr, "indirect offs=%jd\n", off);
 1694|      0|		}
 1695|  35.3k|		switch (in_type = cvt_flip(m->in_type, flip)) {
 1696|  8.75k|		case FILE_BYTE:
  ------------------
  |  |  223|  8.75k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1696:3): [True: 8.75k, False: 26.6k]
  ------------------
 1697|  8.75k|			if (OFFSET_OOB(nbytes, offset, 1))
  ------------------
  |  |   70|  8.75k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  17.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 8.75k]
  |  |  |  Branch (70:59): [True: 0, False: 8.75k]
  |  |  ------------------
  ------------------
 1698|      0|				return 0;
 1699|  8.75k|			if (do_ops(m, &offset, SEXT(sgn,8,p->b), off))
  ------------------
  |  |  107|  8.75k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 8.75k]
  |  |  ------------------
  |  |  108|  8.75k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|  8.75k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|  8.75k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1699:8): [True: 0, False: 8.75k]
  ------------------
 1700|      0|				return 0;
 1701|  8.75k|			break;
 1702|  8.75k|		case FILE_BESHORT:
  ------------------
  |  |  229|  2.55k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1702:3): [True: 2.55k, False: 32.8k]
  ------------------
 1703|  2.55k|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   70|  2.55k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  5.11k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 22, False: 2.53k]
  |  |  |  Branch (70:59): [True: 19, False: 2.51k]
  |  |  ------------------
  ------------------
 1704|     41|				return 0;
 1705|  2.51k|			if (do_ops(m, &offset, SEXT(sgn,16,BE16(p)), off))
  ------------------
  |  |  107|  2.51k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 2.51k]
  |  |  ------------------
  |  |  108|  2.51k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|  2.51k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|  2.51k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1705:8): [True: 0, False: 2.51k]
  ------------------
 1706|      0|				return 0;
 1707|  2.51k|			break;
 1708|  2.51k|		case FILE_LESHORT:
  ------------------
  |  |  232|  1.64k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1708:3): [True: 1.64k, False: 33.7k]
  ------------------
 1709|  1.64k|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   70|  1.64k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  3.29k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 220, False: 1.42k]
  |  |  |  Branch (70:59): [True: 46, False: 1.38k]
  |  |  ------------------
  ------------------
 1710|    266|				return 0;
 1711|  1.38k|			if (do_ops(m, &offset, SEXT(sgn,16,LE16(p)), off))
  ------------------
  |  |  107|  1.38k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 65, False: 1.31k]
  |  |  ------------------
  |  |  108|  1.38k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|     65|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|  1.38k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|  1.31k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1711:8): [True: 0, False: 1.38k]
  ------------------
 1712|      0|				return 0;
 1713|  1.38k|			break;
 1714|  1.38k|		case FILE_SHORT:
  ------------------
  |  |  224|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1714:3): [True: 0, False: 35.3k]
  ------------------
 1715|      0|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1716|      0|				return 0;
 1717|      0|			if (do_ops(m, &offset, SEXT(sgn,16,p->h), off))
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1717:8): [True: 0, False: 0]
  ------------------
 1718|      0|				return 0;
 1719|      0|			break;
 1720|    780|		case FILE_BELONG:
  ------------------
  |  |  230|    780|#define				FILE_BELONG		8
  ------------------
  |  Branch (1720:3): [True: 780, False: 34.5k]
  ------------------
 1721|  1.22k|		case FILE_BEID3:
  ------------------
  |  |  261|  1.22k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1721:3): [True: 444, False: 34.9k]
  ------------------
 1722|  1.22k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   70|  1.22k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  2.44k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 39, False: 1.18k]
  |  |  |  Branch (70:59): [True: 50, False: 1.13k]
  |  |  ------------------
  ------------------
 1723|     89|				return 0;
 1724|  1.13k|			lhs = BE32(p);
  ------------------
  |  |   94|  1.13k|#define BE32(p) ( \
  |  |   95|  1.13k|    (CAST(uint32_t, (p)->hl[0])<<24)| \
  |  |  ------------------
  |  |  |  |  426|  1.13k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   96|  1.13k|    (CAST(uint32_t, (p)->hl[1])<<16)| \
  |  |  ------------------
  |  |  |  |  426|  1.13k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   97|  1.13k|    (CAST(uint32_t, (p)->hl[2])<<8)| \
  |  |  ------------------
  |  |  |  |  426|  1.13k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|  1.13k|    (CAST(uint32_t, (p)->hl[3])))
  |  |  ------------------
  |  |  |  |  426|  1.13k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1725|  1.13k|			if (in_type == FILE_BEID3)
  ------------------
  |  |  261|  1.13k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1725:8): [True: 431, False: 704]
  ------------------
 1726|    431|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  426|    431|#define CAST(T, b)	((T)(b))
  ------------------
 1727|  1.13k|			if (do_ops(m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  107|  1.13k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 1.13k]
  |  |  ------------------
  |  |  108|  1.13k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|  1.13k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|  1.13k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1727:8): [True: 45, False: 1.09k]
  ------------------
 1728|     45|				return 0;
 1729|  1.09k|			break;
 1730|  20.6k|		case FILE_LELONG:
  ------------------
  |  |  233|  20.6k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1730:3): [True: 20.6k, False: 14.6k]
  ------------------
 1731|  20.6k|		case FILE_LEID3:
  ------------------
  |  |  262|  20.6k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1731:3): [True: 0, False: 35.3k]
  ------------------
 1732|  20.6k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   70|  20.6k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  41.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 330, False: 20.3k]
  |  |  |  Branch (70:59): [True: 1.62k, False: 18.7k]
  |  |  ------------------
  ------------------
 1733|  1.95k|				return 0;
 1734|  18.7k|			lhs = LE32(p);
  ------------------
  |  |   89|  18.7k|#define LE32(p) ( \
  |  |   90|  18.7k|    (CAST(uint32_t, (p)->hl[3])<<24)| \
  |  |  ------------------
  |  |  |  |  426|  18.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   91|  18.7k|    (CAST(uint32_t, (p)->hl[2])<<16)| \
  |  |  ------------------
  |  |  |  |  426|  18.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|  18.7k|    (CAST(uint32_t, (p)->hl[1])<<8)| \
  |  |  ------------------
  |  |  |  |  426|  18.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  18.7k|    (CAST(uint32_t, (p)->hl[0])))
  |  |  ------------------
  |  |  |  |  426|  18.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1735|  18.7k|			if (in_type == FILE_LEID3)
  ------------------
  |  |  262|  18.7k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1735:8): [True: 0, False: 18.7k]
  ------------------
 1736|      0|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1737|  18.7k|			if (do_ops(m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  107|  18.7k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 18.7k]
  |  |  ------------------
  |  |  108|  18.7k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|  18.7k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|  18.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1737:8): [True: 2.94k, False: 15.8k]
  ------------------
 1738|  2.94k|				return 0;
 1739|  15.8k|			break;
 1740|  15.8k|		case FILE_MELONG:
  ------------------
  |  |  245|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1740:3): [True: 0, False: 35.3k]
  ------------------
 1741|      0|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1742|      0|				return 0;
 1743|      0|			if (do_ops(m, &offset, SEXT(sgn,32,ME32(p)), off))
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1743:8): [True: 0, False: 0]
  ------------------
 1744|      0|				return 0;
 1745|      0|			break;
 1746|    336|		case FILE_LONG:
  ------------------
  |  |  226|    336|#define				FILE_LONG		4
  ------------------
  |  Branch (1746:3): [True: 336, False: 35.0k]
  ------------------
 1747|    336|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   70|    336|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|    672|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 60, False: 276]
  |  |  |  Branch (70:59): [True: 33, False: 243]
  |  |  ------------------
  ------------------
 1748|     93|				return 0;
 1749|    243|			if (do_ops(m, &offset, SEXT(sgn,32,p->l), off))
  ------------------
  |  |  107|    243|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 243]
  |  |  ------------------
  |  |  108|    243|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|    243|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|    243|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1749:8): [True: 41, False: 202]
  ------------------
 1750|     41|				return 0;
 1751|    202|			break;
 1752|    202|		case FILE_LEQUAD:
  ------------------
  |  |  247|    156|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1752:3): [True: 156, False: 35.2k]
  ------------------
 1753|    156|			if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   70|    156|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|    312|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 156]
  |  |  |  Branch (70:59): [True: 0, False: 156]
  |  |  ------------------
  ------------------
 1754|      0|				return 0;
 1755|    156|			if (do_ops(m, &offset, SEXT(sgn,64,LE64(p)), off))	
  ------------------
  |  |  107|    156|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 156]
  |  |  ------------------
  |  |  108|    156|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|    156|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|    156|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1755:8): [True: 99, False: 57]
  ------------------
 1756|     99|				return 0;
 1757|     57|			break;
 1758|     57|		case FILE_BEQUAD:
  ------------------
  |  |  248|      0|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1758:3): [True: 0, False: 35.3k]
  ------------------
 1759|      0|			if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1760|      0|				return 0;
 1761|      0|			if (do_ops(m, &offset, SEXT(sgn,64,BE64(p)), off))
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1761:8): [True: 0, False: 0]
  ------------------
 1762|      0|				return 0;
 1763|      0|			break;
 1764|      0|		case FILE_OCTAL:
  ------------------
  |  |  281|      0|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1764:3): [True: 0, False: 35.3k]
  ------------------
 1765|      0|			if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   70|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 0]
  |  |  |  Branch (70:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1766|      0|				return 0;
 1767|      0|			if(do_ops(m, &offset,
  ------------------
  |  Branch (1767:7): [True: 0, False: 0]
  ------------------
 1768|      0|			    SEXT(sgn,64,strtoull(p->s, NULL, 8)), off))
  ------------------
  |  |  107|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1769|      0|				return 0;
 1770|      0|			break;
 1771|      0|		default:
  ------------------
  |  Branch (1771:3): [True: 0, False: 35.3k]
  ------------------
 1772|      0|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1772:8): [True: 0, False: 0]
  ------------------
 1773|      0|				fprintf(stderr, "bad in_type=%d\n", in_type);
 1774|      0|			return 0;
 1775|  35.3k|		}
 1776|       |
 1777|  29.8k|		if (m->flag & INDIROFFADD) {
  ------------------
  |  |  207|  29.8k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1777:7): [True: 460, False: 29.3k]
  ------------------
 1778|    460|			if (cont_level == 0) {
  ------------------
  |  Branch (1778:8): [True: 0, False: 460]
  ------------------
 1779|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1779:9): [True: 0, False: 0]
  ------------------
 1780|      0|					fprintf(stderr,
 1781|      0|					    "indirect *zero* cont_level\n");
 1782|      0|				return 0;
 1783|      0|			}
 1784|    460|			offset += ms->c.li[cont_level - 1].off;
 1785|    460|			if (offset == 0) {
  ------------------
  |  Branch (1785:8): [True: 38, False: 422]
  ------------------
 1786|     38|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|     38|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1786:9): [True: 0, False: 38]
  ------------------
 1787|      0|					fprintf(stderr,
 1788|      0|					    "indirect *zero* offset\n");
 1789|     38|				return 0;
 1790|     38|			}
 1791|    422|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    422|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1791:8): [True: 0, False: 422]
  ------------------
 1792|      0|				fprintf(stderr, "indirect +offs=%u\n", offset);
 1793|    422|		}
 1794|  29.7k|		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
  ------------------
  |  Branch (1794:7): [True: 0, False: 29.7k]
  ------------------
 1795|      0|			return -1;
 1796|  29.7k|		ms->offset = offset;
 1797|       |
 1798|  29.7k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  29.7k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1798:7): [True: 0, False: 29.7k]
  ------------------
 1799|      0|			mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  427|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1800|      0|			    sizeof(union VALUETYPE));
 1801|      0|#ifndef COMPILE_ONLY
 1802|      0|			file_mdump(m);
 1803|      0|#endif
 1804|      0|		}
 1805|  29.7k|	}
 1806|       |
 1807|       |	/* Verify we have enough data to match magic type */
 1808|  59.3M|	switch (m->type) {
 1809|   842k|	case FILE_BYTE:
  ------------------
  |  |  223|   842k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1809:2): [True: 842k, False: 58.5M]
  ------------------
 1810|   842k|		if (OFFSET_OOB(nbytes, offset, 1))
  ------------------
  |  |   70|   842k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  1.68M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 51.0k, False: 791k]
  |  |  |  Branch (70:59): [True: 2.92k, False: 788k]
  |  |  ------------------
  ------------------
 1811|  53.9k|			return 0;
 1812|   788k|		break;
 1813|       |
 1814|   788k|	case FILE_SHORT:
  ------------------
  |  |  224|   588k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1814:2): [True: 588k, False: 58.8M]
  ------------------
 1815|  3.14M|	case FILE_BESHORT:
  ------------------
  |  |  229|  3.14M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1815:2): [True: 2.55M, False: 56.8M]
  ------------------
 1816|  5.09M|	case FILE_LESHORT:
  ------------------
  |  |  232|  5.09M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1816:2): [True: 1.95M, False: 57.4M]
  ------------------
 1817|  5.09M|		if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   70|  5.09M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  10.1M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 249k, False: 4.84M]
  |  |  |  Branch (70:59): [True: 27.5k, False: 4.82M]
  |  |  ------------------
  ------------------
 1818|   276k|			return 0;
 1819|  4.82M|		break;
 1820|       |
 1821|  4.82M|	case FILE_LONG:
  ------------------
  |  |  226|   959k|#define				FILE_LONG		4
  ------------------
  |  Branch (1821:2): [True: 959k, False: 58.4M]
  ------------------
 1822|  8.95M|	case FILE_BELONG:
  ------------------
  |  |  230|  8.95M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1822:2): [True: 7.99M, False: 51.3M]
  ------------------
 1823|  12.7M|	case FILE_LELONG:
  ------------------
  |  |  233|  12.7M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1823:2): [True: 3.79M, False: 55.5M]
  ------------------
 1824|  12.7M|	case FILE_MELONG:
  ------------------
  |  |  245|  12.7M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1824:2): [True: 0, False: 59.3M]
  ------------------
 1825|  12.7M|	case FILE_DATE:
  ------------------
  |  |  228|  12.7M|#define				FILE_DATE		6
  ------------------
  |  Branch (1825:2): [True: 0, False: 59.3M]
  ------------------
 1826|  12.7M|	case FILE_BEDATE:
  ------------------
  |  |  231|  12.7M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1826:2): [True: 205, False: 59.3M]
  ------------------
 1827|  12.7M|	case FILE_LEDATE:
  ------------------
  |  |  234|  12.7M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1827:2): [True: 303, False: 59.3M]
  ------------------
 1828|  12.7M|	case FILE_MEDATE:
  ------------------
  |  |  243|  12.7M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1828:2): [True: 16, False: 59.3M]
  ------------------
 1829|  12.7M|	case FILE_LDATE:
  ------------------
  |  |  236|  12.7M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1829:2): [True: 0, False: 59.3M]
  ------------------
 1830|  12.7M|	case FILE_BELDATE:
  ------------------
  |  |  237|  12.7M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1830:2): [True: 5.17k, False: 59.3M]
  ------------------
 1831|  12.7M|	case FILE_LELDATE:
  ------------------
  |  |  238|  12.7M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1831:2): [True: 0, False: 59.3M]
  ------------------
 1832|  12.7M|	case FILE_MELDATE:
  ------------------
  |  |  244|  12.7M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1832:2): [True: 0, False: 59.3M]
  ------------------
 1833|  12.7M|	case FILE_FLOAT:
  ------------------
  |  |  255|  12.7M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1833:2): [True: 0, False: 59.3M]
  ------------------
 1834|  12.7M|	case FILE_BEFLOAT:
  ------------------
  |  |  256|  12.7M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1834:2): [True: 0, False: 59.3M]
  ------------------
 1835|  12.7M|	case FILE_LEFLOAT:
  ------------------
  |  |  257|  12.7M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1835:2): [True: 525, False: 59.3M]
  ------------------
 1836|  12.7M|		if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   70|  12.7M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  25.5M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 495k, False: 12.2M]
  |  |  |  Branch (70:59): [True: 540k, False: 11.7M]
  |  |  ------------------
  ------------------
 1837|  1.03M|			return 0;
 1838|  11.7M|		break;
 1839|       |
 1840|  11.7M|	case FILE_DOUBLE:
  ------------------
  |  |  258|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1840:2): [True: 0, False: 59.3M]
  ------------------
 1841|     38|	case FILE_BEDOUBLE:
  ------------------
  |  |  259|     38|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1841:2): [True: 38, False: 59.3M]
  ------------------
 1842|    437|	case FILE_LEDOUBLE:
  ------------------
  |  |  260|    437|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1842:2): [True: 399, False: 59.3M]
  ------------------
 1843|    437|		if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   70|    437|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|    874|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 165, False: 272]
  |  |  |  Branch (70:59): [True: 58, False: 214]
  |  |  ------------------
  ------------------
 1844|    223|			return 0;
 1845|    214|		break;
 1846|       |
 1847|  23.5k|	case FILE_GUID:
  ------------------
  |  |  271|  23.5k|#define				FILE_GUID		49
  ------------------
  |  Branch (1847:2): [True: 23.5k, False: 59.3M]
  ------------------
 1848|  23.5k|		if (OFFSET_OOB(nbytes, offset, 16))
  ------------------
  |  |   70|  23.5k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  47.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 23.5k]
  |  |  |  Branch (70:59): [True: 4.26k, False: 19.3k]
  |  |  ------------------
  ------------------
 1849|  4.26k|			return 0;
 1850|  19.3k|		break;
 1851|       |
 1852|  38.3M|	case FILE_STRING:
  ------------------
  |  |  227|  38.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (1852:2): [True: 38.3M, False: 20.9M]
  ------------------
 1853|  38.4M|	case FILE_PSTRING:
  ------------------
  |  |  235|  38.4M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1853:2): [True: 21.9k, False: 59.3M]
  ------------------
 1854|  39.1M|	case FILE_SEARCH:
  ------------------
  |  |  242|  39.1M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1854:2): [True: 746k, False: 58.6M]
  ------------------
 1855|  39.1M|	case FILE_OCTAL:
  ------------------
  |  |  281|  39.1M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1855:2): [True: 0, False: 59.3M]
  ------------------
 1856|  39.1M|		if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   70|  39.1M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  78.3M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 2.21M, False: 36.9M]
  |  |  |  Branch (70:59): [True: 4.20M, False: 32.7M]
  |  |  ------------------
  ------------------
 1857|  6.41M|			return 0;
 1858|  32.7M|		break;
 1859|       |
 1860|  32.7M|	case FILE_REGEX:
  ------------------
  |  |  239|   190k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1860:2): [True: 190k, False: 59.1M]
  ------------------
 1861|   190k|		if (nbytes < offset)
  ------------------
  |  Branch (1861:7): [True: 387, False: 189k]
  ------------------
 1862|    387|			return 0;
 1863|   189k|		break;
 1864|       |
 1865|   189k|	case FILE_INDIRECT:
  ------------------
  |  |  263|  7.83k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1865:2): [True: 7.83k, False: 59.3M]
  ------------------
 1866|  7.83k|		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  357|  7.83k|#define str_flags _u._s._flags
  ------------------
              		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  409|  7.83k|#define	INDIRECT_RELATIVE			BIT(0)
  |  |  ------------------
  |  |  |  |  370|  7.83k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1866:7): [True: 0, False: 7.83k]
  ------------------
 1867|      0|			offset += CAST(uint32_t, o);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1868|  7.83k|		if (offset == 0)
  ------------------
  |  Branch (1868:7): [True: 35, False: 7.79k]
  ------------------
 1869|     35|			return 0;
 1870|       |
 1871|  7.79k|		if (nbytes < offset)
  ------------------
  |  Branch (1871:7): [True: 147, False: 7.65k]
  ------------------
 1872|    147|			return 0;
 1873|       |
 1874|  7.65k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (1874:7): [True: 0, False: 7.65k]
  ------------------
 1875|      0|			return -1;
 1876|       |
 1877|  7.65k|		(*indir_count)++;
 1878|  7.65k|		bb = *b;
 1879|  7.65k|		bb.fbuf = s + offset;
 1880|  7.65k|		bb.flen = nbytes - offset;
 1881|  7.65k|		rv = -1;
 1882|  8.75k|		for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
  ------------------
  |  Branch (1882:34): [True: 7.65k, False: 1.10k]
  ------------------
 1883|  7.65k|		    mlp = mlp->next)
 1884|  7.65k|		{
 1885|  7.65k|			if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
  ------------------
  |  Branch (1885:8): [True: 6.54k, False: 1.10k]
  ------------------
 1886|  7.65k|			    mlp->nmagic, &bb, 0, BINTEST, text, 0, indir_count,
  ------------------
  |  |  210|  7.65k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
 1887|  7.65k|			    name_count, printed_something, need_separator,
 1888|  7.65k|			    NULL, NULL)) != 0)
 1889|  6.54k|				break;
 1890|  7.65k|		}
 1891|       |
 1892|  7.65k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  7.65k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1892:7): [True: 0, False: 7.65k]
  ------------------
 1893|      0|			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 1894|       |
 1895|  7.65k|		rbuf = file_pop_buffer(ms, pb);
 1896|  7.65k|		if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  461|  1.99k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (1896:7): [True: 1.99k, False: 5.65k]
  |  Branch (1896:23): [True: 1.12k, False: 871]
  ------------------
 1897|  1.12k|			return -1;
 1898|       |
 1899|  6.52k|		if (rv == 1) {
  ------------------
  |  Branch (1899:7): [True: 5.42k, False: 1.10k]
  ------------------
 1900|  5.42k|			if ((ms->flags & MAGIC_NODESC) == 0 &&
  ------------------
  |  |   52|  5.42k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  5.42k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  5.42k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  5.42k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  5.42k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  5.42k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1900:8): [True: 5.42k, False: 0]
  ------------------
 1901|  5.42k|			    file_printf(ms, F(ms, m->desc, "%u"), offset) == -1)
  ------------------
  |  |  155|  5.42k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (1901:8): [True: 0, False: 5.42k]
  ------------------
 1902|      0|			{
 1903|      0|				free(rbuf);
 1904|      0|				return -1;
 1905|      0|			}
 1906|  5.42k|			if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (1906:8): [True: 105, False: 5.31k]
  ------------------
 1907|    105|				free(rbuf);
 1908|    105|				return -1;
 1909|    105|			}
 1910|  5.42k|		}
 1911|  6.42k|		free(rbuf);
 1912|  6.42k|		return rv;
 1913|       |
 1914|  13.2k|	case FILE_USE:
  ------------------
  |  |  268|  13.2k|#define				FILE_USE		46
  ------------------
  |  Branch (1914:2): [True: 13.2k, False: 59.3M]
  ------------------
 1915|  13.2k|		if (nbytes < offset)
  ------------------
  |  Branch (1915:7): [True: 256, False: 12.9k]
  ------------------
 1916|    256|			return 0;
 1917|  12.9k|		rbuf = m->value.s;
 1918|  12.9k|		if (*rbuf == '^') {
  ------------------
  |  Branch (1918:7): [True: 109, False: 12.8k]
  ------------------
 1919|    109|			rbuf++;
 1920|    109|			flip = !flip;
 1921|    109|		}
 1922|  12.9k|		if (file_magicfind(ms, rbuf, &ml) == -1) {
  ------------------
  |  Branch (1922:7): [True: 0, False: 12.9k]
  ------------------
 1923|      0|			file_error(ms, 0, "cannot find entry `%s'", rbuf);
 1924|      0|			return -1;
 1925|      0|		}
 1926|  12.9k|		if (save_cont(ms, &c) == -1) {
  ------------------
  |  Branch (1926:7): [True: 0, False: 12.9k]
  ------------------
 1927|      0|			file_error(ms, errno, "can't allocate continuation");
 1928|      0|			return -1;
 1929|      0|		}
 1930|       |
 1931|  12.9k|		oneed_separator = *need_separator;
 1932|  12.9k|		if (m->flag & NOSPACE)
  ------------------
  |  |  209|  12.9k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (1932:7): [True: 0, False: 12.9k]
  ------------------
 1933|      0|			*need_separator = 0;
 1934|       |
 1935|  12.9k|		nfound_match = 0;
 1936|  12.9k|		(*name_count)++;
 1937|  12.9k|		eoffset = ms->eoffset;
 1938|  12.9k|		rv = match(ms, ml.magic, ml.magic_rxcomp, ml.nmagic, b,
 1939|  12.9k|		    offset + o, mode, text, flip, indir_count, name_count,
 1940|  12.9k|		    printed_something, need_separator, returnval,
 1941|  12.9k|		    &nfound_match);
 1942|  12.9k|		ms->ms_value.q = nfound_match;
 1943|  12.9k|		(*name_count)--;
 1944|  12.9k|		*found_match |= nfound_match;
 1945|       |
 1946|  12.9k|		restore_cont(ms, &c);
 1947|       |
 1948|  12.9k|		if (rv != 1)
  ------------------
  |  Branch (1948:7): [True: 2.12k, False: 10.8k]
  ------------------
 1949|  2.12k|		    *need_separator = oneed_separator;
 1950|  12.9k|		ms->offset = offset;
 1951|  12.9k|		ms->eoffset = eoffset;
 1952|  12.9k|		return rv;
 1953|       |
 1954|  12.9k|	case FILE_NAME:
  ------------------
  |  |  267|  12.9k|#define				FILE_NAME		45
  ------------------
  |  Branch (1954:2): [True: 12.9k, False: 59.3M]
  ------------------
 1955|  12.9k|		if (ms->flags & MAGIC_NODESC)
  ------------------
  |  |   52|  12.9k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  12.9k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  12.9k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  12.9k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  12.9k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  12.9k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1955:7): [True: 0, False: 12.9k]
  ------------------
 1956|      0|			return 1;
 1957|  12.9k|		if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (1957:7): [True: 0, False: 12.9k]
  ------------------
 1958|      0|			return -1;
 1959|  12.9k|		return 1;
 1960|   216k|	case FILE_DER:
  ------------------
  |  |  270|   216k|#define				FILE_DER		48
  ------------------
  |  Branch (1960:2): [True: 216k, False: 59.1M]
  ------------------
 1961|   223k|	case FILE_DEFAULT:	/* nothing to check */
  ------------------
  |  |  225|   223k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1961:2): [True: 6.48k, False: 59.3M]
  ------------------
 1962|   224k|	case FILE_CLEAR:
  ------------------
  |  |  269|   224k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1962:2): [True: 1.37k, False: 59.3M]
  ------------------
 1963|  1.27M|	default:
  ------------------
  |  Branch (1963:2): [True: 1.05M, False: 58.3M]
  ------------------
 1964|  1.27M|		break;
 1965|  59.3M|	}
 1966|  51.5M|	if (!mconvert(ms, m, flip))
  ------------------
  |  Branch (1966:6): [True: 0, False: 51.5M]
  ------------------
 1967|      0|		return 0;
 1968|  51.5M|	return 1;
 1969|  51.5M|}
softmagic.c:mcopy:
 1322|  59.4M|{
 1323|       |	/*
 1324|       |	 * Note: FILE_SEARCH and FILE_REGEX do not actually copy
 1325|       |	 * anything, but setup pointers into the source
 1326|       |	 */
 1327|  59.4M|	if (indir == 0) {
  ------------------
  |  Branch (1327:6): [True: 59.3M, False: 35.3k]
  ------------------
 1328|  59.3M|		switch (type) {
 1329|   216k|		case FILE_DER:
  ------------------
  |  |  270|   216k|#define				FILE_DER		48
  ------------------
  |  Branch (1329:3): [True: 216k, False: 59.1M]
  ------------------
 1330|   963k|		case FILE_SEARCH:
  ------------------
  |  |  242|   963k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1330:3): [True: 746k, False: 58.6M]
  ------------------
 1331|   963k|			if (offset > nbytes)
  ------------------
  |  Branch (1331:8): [True: 40.5k, False: 922k]
  ------------------
 1332|  40.5k|				offset = CAST(uint32_t, nbytes);
  ------------------
  |  |  426|  40.5k|#define CAST(T, b)	((T)(b))
  ------------------
 1333|   963k|			ms->search.s = RCAST(const char *, s) + offset;
  ------------------
  |  |  427|   963k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1334|   963k|			ms->search.s_len = nbytes - offset;
 1335|   963k|			ms->search.offset = offset;
 1336|   963k|			return 0;
 1337|       |
 1338|   190k|		case FILE_REGEX: {
  ------------------
  |  |  239|   190k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1338:3): [True: 190k, False: 59.1M]
  ------------------
 1339|   190k|			const char *b;
 1340|   190k|			const char *c;
 1341|   190k|			const char *last;	/* end of search region */
 1342|   190k|			const char *buf;	/* start of search region */
 1343|   190k|			const char *end;
 1344|   190k|			size_t lines, linecnt, bytecnt;
 1345|       |
 1346|   190k|			if (s == NULL || nbytes < offset) {
  ------------------
  |  Branch (1346:8): [True: 0, False: 190k]
  |  Branch (1346:21): [True: 387, False: 189k]
  ------------------
 1347|    387|				ms->search.s_len = 0;
 1348|    387|				ms->search.s = NULL;
 1349|    387|				return 0;
 1350|    387|			}
 1351|       |
 1352|   189k|			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  357|   189k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  384|   189k|#define REGEX_LINE_COUNT			BIT(11)
  |  |  ------------------
  |  |  |  |  370|   189k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1352:8): [True: 60.7k, False: 129k]
  ------------------
 1353|  60.7k|				linecnt = m->str_range;
  ------------------
  |  |  356|  60.7k|#define str_range _u._s._count
  ------------------
 1354|  60.7k|				bytecnt = linecnt * 80;
 1355|   129k|			} else {
 1356|   129k|				linecnt = 0;
 1357|   129k|				bytecnt = m->str_range;
  ------------------
  |  |  356|   129k|#define str_range _u._s._count
  ------------------
 1358|   129k|			}
 1359|       |
 1360|   189k|			if (bytecnt == 0 || bytecnt > nbytes - offset)
  ------------------
  |  Branch (1360:8): [True: 101k, False: 88.3k]
  |  Branch (1360:24): [True: 81.1k, False: 7.19k]
  ------------------
 1361|   182k|				bytecnt = nbytes - offset;
 1362|   189k|			if (bytecnt > ms->regex_max)
  ------------------
  |  Branch (1362:8): [True: 8.41k, False: 181k]
  ------------------
 1363|  8.41k|				bytecnt = ms->regex_max;
 1364|       |
 1365|   189k|			buf = RCAST(const char *, s) + offset;
  ------------------
  |  |  427|   189k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1366|   189k|			end = last = RCAST(const char *, s) + bytecnt + offset;
  ------------------
  |  |  427|   189k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1367|       |			/* mget() guarantees buf <= last */
 1368|   460k|			for (lines = linecnt, b = buf; lines && b < end &&
  ------------------
  |  Branch (1368:35): [True: 329k, False: 131k]
  |  Branch (1368:44): [True: 325k, False: 3.50k]
  ------------------
 1369|   460k|			     ((b = CAST(const char *,
  ------------------
  |  |  426|   325k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1369:10): [True: 165k, False: 159k]
  ------------------
 1370|   325k|				 memchr(c = b, '\n', CAST(size_t, (end - b)))))
 1371|   325k|			     || (b = CAST(const char *,
  ------------------
  |  |  426|   159k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1371:12): [True: 104k, False: 54.9k]
  ------------------
 1372|   159k|				 memchr(c, '\r', CAST(size_t, (end - c))))));
 1373|   270k|			     lines--, b++) {
 1374|   270k|				if (b < end - 1 && b[0] == '\r' && b[1] == '\n')
  ------------------
  |  Branch (1374:9): [True: 268k, False: 2.45k]
  |  Branch (1374:24): [True: 104k, False: 164k]
  |  Branch (1374:40): [True: 0, False: 104k]
  ------------------
 1375|      0|					b++;
 1376|   270k|				if (b < end - 1 && b[0] == '\n')
  ------------------
  |  Branch (1376:9): [True: 268k, False: 2.45k]
  |  Branch (1376:24): [True: 164k, False: 104k]
  ------------------
 1377|   164k|					b++;
 1378|   270k|				last = b;
 1379|   270k|			}
 1380|   189k|			if (lines)
  ------------------
  |  Branch (1380:8): [True: 58.4k, False: 131k]
  ------------------
 1381|  58.4k|				last = end;
 1382|       |
 1383|   189k|			ms->search.s = buf;
 1384|   189k|			ms->search.s_len = last - buf;
 1385|   189k|			ms->search.offset = offset;
 1386|   189k|			ms->search.rm_len = 0;
 1387|   189k|			return 0;
 1388|   190k|		}
 1389|    119|		case FILE_BESTRING16:
  ------------------
  |  |  240|    119|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1389:3): [True: 119, False: 59.3M]
  ------------------
 1390|  38.4k|		case FILE_LESTRING16: {
  ------------------
  |  |  241|  38.4k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1390:3): [True: 38.3k, False: 59.3M]
  ------------------
 1391|  38.4k|			const unsigned char *src = s + offset;
 1392|  38.4k|			const unsigned char *esrc = s + nbytes;
 1393|  38.4k|			char *dst = p->s;
 1394|  38.4k|			char *edst = &p->s[sizeof(p->s) - 1];
 1395|       |
 1396|  38.4k|			if (type == FILE_BESTRING16)
  ------------------
  |  |  240|  38.4k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1396:8): [True: 119, False: 38.3k]
  ------------------
 1397|    119|				src++;
 1398|       |
 1399|       |			/* check that offset is within range */
 1400|  38.4k|			if (offset >= nbytes)
  ------------------
  |  Branch (1400:8): [True: 631, False: 37.8k]
  ------------------
 1401|    631|				break;
 1402|  2.34M|			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
  ------------------
  |  Branch (1402:20): [True: 2.31M, False: 27.4k]
  ------------------
 1403|  2.31M|				if (dst < edst)
  ------------------
  |  Branch (1403:9): [True: 2.30M, False: 10.3k]
  ------------------
 1404|  2.30M|					*dst = *src;
 1405|  10.3k|				else
 1406|  10.3k|					break;
 1407|  2.30M|				if (*dst == '\0') {
  ------------------
  |  Branch (1407:9): [True: 1.10M, False: 1.19M]
  ------------------
 1408|  1.10M|					if (type == FILE_BESTRING16 ?
  ------------------
  |  |  240|  1.10M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1408:10): [True: 572, False: 1.10M]
  |  Branch (1408:10): [True: 247k, False: 858k]
  ------------------
 1409|    572|					    *(src - 1) != '\0' :
 1410|  1.10M|					    ((src + 1 < esrc) &&
  ------------------
  |  Branch (1410:11): [True: 1.10M, False: 4.30k]
  ------------------
 1411|  1.10M|					    *(src + 1) != '\0'))
  ------------------
  |  Branch (1411:10): [True: 247k, False: 854k]
  ------------------
 1412|   247k|						*dst = ' ';
 1413|  1.10M|				}
 1414|  2.30M|			}
 1415|  37.8k|			*edst = '\0';
 1416|  37.8k|			return 0;
 1417|  38.4k|		}
 1418|  38.3M|		case FILE_STRING:	/* XXX - these two should not need */
  ------------------
  |  |  227|  38.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (1418:3): [True: 38.3M, False: 20.9M]
  ------------------
 1419|  38.4M|		case FILE_PSTRING:	/* to copy anything, but do anyway. */
  ------------------
  |  |  235|  38.4M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1419:3): [True: 21.9k, False: 59.3M]
  ------------------
 1420|  58.1M|		default:
  ------------------
  |  Branch (1420:3): [True: 19.7M, False: 39.6M]
  ------------------
 1421|  58.1M|			break;
 1422|  59.3M|		}
 1423|  59.3M|	}
 1424|       |
 1425|  58.2M|	if (type == FILE_OFFSET) {
  ------------------
  |  |  272|  58.2M|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1425:6): [True: 1.11k, False: 58.2M]
  ------------------
 1426|  1.11k|		(void)memset(p, '\0', sizeof(*p));
 1427|  1.11k|		p->q = offset;
 1428|  1.11k|		return 0;
 1429|  1.11k|	}
 1430|       |
 1431|  58.2M|	if (offset >= nbytes) {
  ------------------
  |  Branch (1431:6): [True: 3.30M, False: 54.9M]
  ------------------
 1432|  3.30M|		(void)memset(p, '\0', sizeof(*p));
 1433|  3.30M|		return 0;
 1434|  3.30M|	}
 1435|  54.9M|	if (nbytes - offset < sizeof(*p))
  ------------------
  |  Branch (1435:6): [True: 29.6M, False: 25.2M]
  ------------------
 1436|  29.6M|		nbytes = nbytes - offset;
 1437|  25.2M|	else
 1438|  25.2M|		nbytes = sizeof(*p);
 1439|       |
 1440|  54.9M|	(void)memcpy(p, s + offset, nbytes);
 1441|       |
 1442|       |	/*
 1443|       |	 * the usefulness of padding with zeroes eludes me, it
 1444|       |	 * might even cause problems
 1445|       |	 */
 1446|  54.9M|	if (nbytes < sizeof(*p))
  ------------------
  |  Branch (1446:6): [True: 29.6M, False: 25.2M]
  ------------------
 1447|  29.6M|		(void)memset(RCAST(char *, RCAST(void *, p)) + nbytes, '\0',
  ------------------
  |  |  427|  29.6M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1448|  29.6M|		    sizeof(*p) - nbytes);
 1449|  54.9M|	return 0;
 1450|  58.2M|}
softmagic.c:cvt_flip:
  998|  51.6M|{
  999|  51.6M|	if (flip == 0)
  ------------------
  |  Branch (999:6): [True: 51.5M, False: 3.76k]
  ------------------
 1000|  51.5M|		return type;
 1001|  3.76k|	switch (type) {
 1002|     99|	case FILE_BESHORT:
  ------------------
  |  |  229|     99|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1002:2): [True: 99, False: 3.66k]
  ------------------
 1003|     99|		return FILE_LESHORT;
  ------------------
  |  |  232|     99|#define				FILE_LESHORT		10
  ------------------
 1004|    522|	case FILE_BELONG:
  ------------------
  |  |  230|    522|#define				FILE_BELONG		8
  ------------------
  |  Branch (1004:2): [True: 522, False: 3.24k]
  ------------------
 1005|    522|		return FILE_LELONG;
  ------------------
  |  |  233|    522|#define				FILE_LELONG		11
  ------------------
 1006|      9|	case FILE_BEDATE:
  ------------------
  |  |  231|      9|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1006:2): [True: 9, False: 3.75k]
  ------------------
 1007|      9|		return FILE_LEDATE;
  ------------------
  |  |  234|      9|#define				FILE_LEDATE		12
  ------------------
 1008|      0|	case FILE_BELDATE:
  ------------------
  |  |  237|      0|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1008:2): [True: 0, False: 3.76k]
  ------------------
 1009|      0|		return FILE_LELDATE;
  ------------------
  |  |  238|      0|#define				FILE_LELDATE		16
  ------------------
 1010|      5|	case FILE_BEQUAD:
  ------------------
  |  |  248|      5|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1010:2): [True: 5, False: 3.75k]
  ------------------
 1011|      5|		return FILE_LEQUAD;
  ------------------
  |  |  247|      5|#define				FILE_LEQUAD		25
  ------------------
 1012|      0|	case FILE_BEQDATE:
  ------------------
  |  |  251|      0|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1012:2): [True: 0, False: 3.76k]
  ------------------
 1013|      0|		return FILE_LEQDATE;
  ------------------
  |  |  250|      0|#define				FILE_LEQDATE		28
  ------------------
 1014|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  254|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1014:2): [True: 0, False: 3.76k]
  ------------------
 1015|      0|		return FILE_LEQLDATE;
  ------------------
  |  |  253|      0|#define				FILE_LEQLDATE		31
  ------------------
 1016|      0|	case FILE_BEQWDATE:
  ------------------
  |  |  266|      0|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1016:2): [True: 0, False: 3.76k]
  ------------------
 1017|      0|		return FILE_LEQWDATE;
  ------------------
  |  |  265|      0|#define				FILE_LEQWDATE		43
  ------------------
 1018|  2.83k|	case FILE_LESHORT:
  ------------------
  |  |  232|  2.83k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1018:2): [True: 2.83k, False: 930]
  ------------------
 1019|  2.83k|		return FILE_BESHORT;
  ------------------
  |  |  229|  2.83k|#define				FILE_BESHORT		7
  ------------------
 1020|    109|	case FILE_LELONG:
  ------------------
  |  |  233|    109|#define				FILE_LELONG		11
  ------------------
  |  Branch (1020:2): [True: 109, False: 3.65k]
  ------------------
 1021|    109|		return FILE_BELONG;
  ------------------
  |  |  230|    109|#define				FILE_BELONG		8
  ------------------
 1022|     14|	case FILE_LEDATE:
  ------------------
  |  |  234|     14|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1022:2): [True: 14, False: 3.74k]
  ------------------
 1023|     14|		return FILE_BEDATE;
  ------------------
  |  |  231|     14|#define				FILE_BEDATE		9
  ------------------
 1024|      0|	case FILE_LELDATE:
  ------------------
  |  |  238|      0|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1024:2): [True: 0, False: 3.76k]
  ------------------
 1025|      0|		return FILE_BELDATE;
  ------------------
  |  |  237|      0|#define				FILE_BELDATE		15
  ------------------
 1026|      0|	case FILE_LEQUAD:
  ------------------
  |  |  247|      0|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1026:2): [True: 0, False: 3.76k]
  ------------------
 1027|      0|		return FILE_BEQUAD;
  ------------------
  |  |  248|      0|#define				FILE_BEQUAD		26
  ------------------
 1028|      0|	case FILE_LEQDATE:
  ------------------
  |  |  250|      0|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1028:2): [True: 0, False: 3.76k]
  ------------------
 1029|      0|		return FILE_BEQDATE;
  ------------------
  |  |  251|      0|#define				FILE_BEQDATE		29
  ------------------
 1030|      0|	case FILE_LEQLDATE:
  ------------------
  |  |  253|      0|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1030:2): [True: 0, False: 3.76k]
  ------------------
 1031|      0|		return FILE_BEQLDATE;
  ------------------
  |  |  254|      0|#define				FILE_BEQLDATE		32
  ------------------
 1032|      0|	case FILE_LEQWDATE:
  ------------------
  |  |  265|      0|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1032:2): [True: 0, False: 3.76k]
  ------------------
 1033|      0|		return FILE_BEQWDATE;
  ------------------
  |  |  266|      0|#define				FILE_BEQWDATE		44
  ------------------
 1034|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  256|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1034:2): [True: 0, False: 3.76k]
  ------------------
 1035|      0|		return FILE_LEFLOAT;
  ------------------
  |  |  257|      0|#define				FILE_LEFLOAT		35
  ------------------
 1036|      0|	case FILE_LEFLOAT:
  ------------------
  |  |  257|      0|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1036:2): [True: 0, False: 3.76k]
  ------------------
 1037|      0|		return FILE_BEFLOAT;
  ------------------
  |  |  256|      0|#define				FILE_BEFLOAT		34
  ------------------
 1038|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  259|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1038:2): [True: 0, False: 3.76k]
  ------------------
 1039|      0|		return FILE_LEDOUBLE;
  ------------------
  |  |  260|      0|#define				FILE_LEDOUBLE		38
  ------------------
 1040|      0|	case FILE_LEDOUBLE:
  ------------------
  |  |  260|      0|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1040:2): [True: 0, False: 3.76k]
  ------------------
 1041|      0|		return FILE_BEDOUBLE;
  ------------------
  |  |  259|      0|#define				FILE_BEDOUBLE		37
  ------------------
 1042|    172|	default:
  ------------------
  |  Branch (1042:2): [True: 172, False: 3.59k]
  ------------------
 1043|    172|		return type;
 1044|  3.76k|	}
 1045|  3.76k|}
softmagic.c:do_ops:
 1454|  32.9k|{
 1455|  32.9k|	intmax_t offset;
 1456|       |	// On purpose not INTMAX_MAX
 1457|  32.9k|	if (lhs >= INT_MAX || lhs <= INT_MIN ||
  ------------------
  |  Branch (1457:6): [True: 3.02k, False: 29.9k]
  |  Branch (1457:24): [True: 0, False: 29.9k]
  ------------------
 1458|  32.9k|	    off >= INT_MAX || off <= INT_MIN) {
  ------------------
  |  Branch (1458:6): [True: 0, False: 29.9k]
  |  Branch (1458:24): [True: 0, False: 29.9k]
  ------------------
 1459|  3.02k|		fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off);
 1460|  3.02k|		return 1;
 1461|  3.02k|	}
 1462|       |	   
 1463|  29.9k|	if (off) {
  ------------------
  |  Branch (1463:6): [True: 13.9k, False: 15.9k]
  ------------------
 1464|  13.9k|		switch (m->in_op & FILE_OPS_MASK) {
  ------------------
  |  |  327|  13.9k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  ------------------
  |  Branch (1464:11): [True: 0, False: 13.9k]
  ------------------
 1465|     18|		case FILE_OPAND:
  ------------------
  |  |  319|     18|#define				FILE_OPAND	0
  ------------------
  |  Branch (1465:3): [True: 18, False: 13.9k]
  ------------------
 1466|     18|			offset = lhs & off;
 1467|     18|			break;
 1468|      0|		case FILE_OPOR:
  ------------------
  |  |  320|      0|#define				FILE_OPOR	1
  ------------------
  |  Branch (1468:3): [True: 0, False: 13.9k]
  ------------------
 1469|      0|			offset = lhs | off;
 1470|      0|			break;
 1471|      0|		case FILE_OPXOR:
  ------------------
  |  |  321|      0|#define				FILE_OPXOR	2
  ------------------
  |  Branch (1471:3): [True: 0, False: 13.9k]
  ------------------
 1472|      0|			offset = lhs ^ off;
 1473|      0|			break;
 1474|  12.0k|		case FILE_OPADD:
  ------------------
  |  |  322|  12.0k|#define				FILE_OPADD	3
  ------------------
  |  Branch (1474:3): [True: 12.0k, False: 1.91k]
  ------------------
 1475|  12.0k|			offset = lhs + off;
 1476|  12.0k|			break;
 1477|    385|		case FILE_OPMINUS:
  ------------------
  |  |  323|    385|#define				FILE_OPMINUS	4
  ------------------
  |  Branch (1477:3): [True: 385, False: 13.5k]
  ------------------
 1478|    385|			offset = lhs - off;
 1479|    385|			break;
 1480|  1.48k|		case FILE_OPMULTIPLY:
  ------------------
  |  |  324|  1.48k|#define				FILE_OPMULTIPLY	5
  ------------------
  |  Branch (1480:3): [True: 1.48k, False: 12.4k]
  ------------------
 1481|  1.48k|			offset = lhs * off;
 1482|  1.48k|			break;
 1483|     22|		case FILE_OPDIVIDE:
  ------------------
  |  |  325|     22|#define				FILE_OPDIVIDE	6
  ------------------
  |  Branch (1483:3): [True: 22, False: 13.9k]
  ------------------
 1484|     22|			offset = lhs / off;
 1485|     22|			break;
 1486|      0|		case FILE_OPMODULO:
  ------------------
  |  |  326|      0|#define				FILE_OPMODULO	7
  ------------------
  |  Branch (1486:3): [True: 0, False: 13.9k]
  ------------------
 1487|      0|			offset = lhs % off;
 1488|      0|			break;
 1489|  13.9k|		}
 1490|  13.9k|	} else
 1491|  15.9k|		offset = lhs;
 1492|  29.9k|	if (m->in_op & FILE_OPINVERSE)
  ------------------
  |  |  331|  29.9k|#define				FILE_OPINVERSE	0x40
  ------------------
  |  Branch (1492:6): [True: 0, False: 29.9k]
  ------------------
 1493|      0|		offset = ~offset;
 1494|  29.9k|	if (offset >= UINT_MAX) {
  ------------------
  |  Branch (1494:6): [True: 110, False: 29.8k]
  ------------------
 1495|    110|		fprintf(stderr, "offset overflow %jd\n", offset);
 1496|    110|		return 1;
 1497|    110|	}
 1498|  29.8k|	*rv = CAST(uint32_t, offset);
  ------------------
  |  |  426|  29.8k|#define CAST(T, b)	((T)(b))
  ------------------
 1499|  29.8k|	return 0;
 1500|  29.9k|}
softmagic.c:cvt_id3:
  986|    431|{
  987|    431|	v = ((((v >>  0) & 0x7f) <<  0) |
  988|    431|	     (((v >>  8) & 0x7f) <<  7) |
  989|    431|	     (((v >> 16) & 0x7f) << 14) |
  990|    431|	     (((v >> 24) & 0x7f) << 21));
  991|    431|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    431|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (991:6): [True: 0, False: 431]
  ------------------
  992|      0|		fprintf(stderr, "id3 offs=%u\n", v);
  993|    431|	return v;
  994|    431|}
softmagic.c:file_fmtcheck:
  160|   100k|{
  161|   100k|	const char *ptr;
  162|       |
  163|   100k|	if (strchr(desc, '%') == NULL)
  ------------------
  |  Branch (163:6): [True: 53.8k, False: 46.2k]
  ------------------
  164|  53.8k|		return desc;
  165|       |
  166|  46.2k|	ptr = fmtcheck(desc, def);
  167|  46.2k|	if (ptr == def)
  ------------------
  |  Branch (167:6): [True: 0, False: 46.2k]
  ------------------
  168|      0|		file_magerror(ms,
  169|      0|		    "%s, %" SIZE_T_FORMAT "u: format `%s' does not match"
  170|      0|		    " with `%s'", file, line, desc, def);
  171|  46.2k|	return ptr;
  172|   100k|}
softmagic.c:save_cont:
 1554|  12.9k|{
 1555|  12.9k|	size_t len;
 1556|  12.9k|	*c = ms->c;
 1557|  12.9k|	len = c->len * sizeof(*c->li);
 1558|  12.9k|	ms->c.li = CAST(struct level_info *, malloc(len));
  ------------------
  |  |  426|  12.9k|#define CAST(T, b)	((T)(b))
  ------------------
 1559|  12.9k|	if (ms->c.li == NULL) {
  ------------------
  |  Branch (1559:6): [True: 0, False: 12.9k]
  ------------------
 1560|      0|		ms->c = *c;
 1561|      0|		return -1;
 1562|      0|	}
 1563|  12.9k|	memcpy(ms->c.li, c->li, len);
 1564|  12.9k|	return 0;
 1565|  12.9k|}
softmagic.c:restore_cont:
 1569|  12.9k|{
 1570|  12.9k|	free(ms->c.li);
 1571|  12.9k|	ms->c = *c;
 1572|  12.9k|}
softmagic.c:mconvert:
 1149|  51.5M|{
 1150|  51.5M|	union VALUETYPE *p = &ms->ms_value;
 1151|       |
 1152|  51.5M|	switch (cvt_flip(m->type, flip)) {
 1153|   788k|	case FILE_BYTE:
  ------------------
  |  |  223|   788k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1153:2): [True: 788k, False: 50.7M]
  ------------------
 1154|   788k|		if (cvt_8(p, m) == -1)
  ------------------
  |  Branch (1154:7): [True: 0, False: 788k]
  ------------------
 1155|      0|			goto out;
 1156|   788k|		return 1;
 1157|   580k|	case FILE_SHORT:
  ------------------
  |  |  224|   580k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1157:2): [True: 580k, False: 50.9M]
  ------------------
 1158|   580k|	case FILE_MSDOSDATE:
  ------------------
  |  |  275|   580k|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (1158:2): [True: 0, False: 51.5M]
  ------------------
 1159|   580k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  276|   580k|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (1159:2): [True: 0, False: 51.5M]
  ------------------
 1160|   580k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  277|   580k|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (1160:2): [True: 0, False: 51.5M]
  ------------------
 1161|   580k|	case FILE_MSDOSTIME:
  ------------------
  |  |  278|   580k|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (1161:2): [True: 0, False: 51.5M]
  ------------------
 1162|   580k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  279|   580k|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (1162:2): [True: 0, False: 51.5M]
  ------------------
 1163|   580k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  280|   580k|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (1163:2): [True: 0, False: 51.5M]
  ------------------
 1164|   580k|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1164:7): [True: 0, False: 580k]
  ------------------
 1165|      0|			goto out;
 1166|   580k|		return 1;
 1167|   902k|	case FILE_LONG:
  ------------------
  |  |  226|   902k|#define				FILE_LONG		4
  ------------------
  |  Branch (1167:2): [True: 902k, False: 50.6M]
  ------------------
 1168|   902k|	case FILE_DATE:
  ------------------
  |  |  228|   902k|#define				FILE_DATE		6
  ------------------
  |  Branch (1168:2): [True: 0, False: 51.5M]
  ------------------
 1169|   902k|	case FILE_LDATE:
  ------------------
  |  |  236|   902k|#define				FILE_LDATE		14
  ------------------
  |  Branch (1169:2): [True: 0, False: 51.5M]
  ------------------
 1170|   902k|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1170:7): [True: 0, False: 902k]
  ------------------
 1171|      0|			goto out;
 1172|   902k|		return 1;
 1173|  39.6k|	case FILE_QUAD:
  ------------------
  |  |  246|  39.6k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1173:2): [True: 39.6k, False: 51.5M]
  ------------------
 1174|  39.6k|	case FILE_QDATE:
  ------------------
  |  |  249|  39.6k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1174:2): [True: 0, False: 51.5M]
  ------------------
 1175|  39.6k|	case FILE_QLDATE:
  ------------------
  |  |  252|  39.6k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1175:2): [True: 0, False: 51.5M]
  ------------------
 1176|  39.9k|	case FILE_QWDATE:
  ------------------
  |  |  264|  39.9k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1176:2): [True: 297, False: 51.5M]
  ------------------
 1177|  41.0k|	case FILE_OFFSET:
  ------------------
  |  |  272|  41.0k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1177:2): [True: 1.11k, False: 51.5M]
  ------------------
 1178|  41.0k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1178:7): [True: 0, False: 41.0k]
  ------------------
 1179|      0|			goto out;
 1180|  41.0k|		return 1;
 1181|  32.3M|	case FILE_STRING:
  ------------------
  |  |  227|  32.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (1181:2): [True: 32.3M, False: 19.2M]
  ------------------
 1182|  32.3M|	case FILE_BESTRING16:
  ------------------
  |  |  240|  32.3M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1182:2): [True: 119, False: 51.5M]
  ------------------
 1183|  32.3M|	case FILE_LESTRING16:
  ------------------
  |  |  241|  32.3M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1183:2): [True: 38.3k, False: 51.5M]
  ------------------
 1184|  32.3M|	case FILE_OCTAL: {
  ------------------
  |  |  281|  32.3M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1184:2): [True: 0, False: 51.5M]
  ------------------
 1185|       |		/* Null terminate and eat *trailing* return */
 1186|  32.3M|		p->s[sizeof(p->s) - 1] = '\0';
 1187|  32.3M|		return 1;
 1188|  32.3M|	}
 1189|  17.2k|	case FILE_PSTRING: {
  ------------------
  |  |  235|  17.2k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1189:2): [True: 17.2k, False: 51.5M]
  ------------------
 1190|  17.2k|		char *ptr1, *ptr2;
 1191|  17.2k|		size_t len, sz = file_pstring_length_size(ms, m);
 1192|  17.2k|		if (sz == FILE_BADSIZE)
  ------------------
  |  |  158|  17.2k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|  17.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1192:7): [True: 0, False: 17.2k]
  ------------------
 1193|      0|			return 0;
 1194|  17.2k|		ptr1 = p->s;
 1195|  17.2k|		ptr2 = ptr1 + sz;
 1196|  17.2k|		len = file_pstring_get_length(ms, m, ptr1);
 1197|  17.2k|		if (len == FILE_BADSIZE)
  ------------------
  |  |  158|  17.2k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|  17.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1197:7): [True: 0, False: 17.2k]
  ------------------
 1198|      0|			return 0;
 1199|  17.2k|		sz = sizeof(p->s) - sz; /* maximum length of string */
 1200|  17.2k|		if (len >= sz) {
  ------------------
  |  Branch (1200:7): [True: 6.01k, False: 11.2k]
  ------------------
 1201|       |			/*
 1202|       |			 * The size of the pascal string length (sz)
 1203|       |			 * is 1, 2, or 4. We need at least 1 byte for NUL
 1204|       |			 * termination, but we've already truncated the
 1205|       |			 * string by p->s, so we need to deduct sz.
 1206|       |			 * Because we can use one of the bytes of the length
 1207|       |			 * after we shifted as NUL termination.
 1208|       |			 */
 1209|  6.01k|			len = sz;
 1210|  6.01k|		}
 1211|  1.16M|		while (len--)
  ------------------
  |  Branch (1211:10): [True: 1.15M, False: 17.2k]
  ------------------
 1212|  1.15M|			*ptr1++ = *ptr2++;
 1213|  17.2k|		*ptr1 = '\0';
 1214|  17.2k|		return 1;
 1215|  17.2k|	}
 1216|  2.42M|	case FILE_BESHORT:
  ------------------
  |  |  229|  2.42M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1216:2): [True: 2.42M, False: 49.1M]
  ------------------
 1217|  2.42M|		p->h = CAST(short, BE16(p));
  ------------------
  |  |  426|  2.42M|#define CAST(T, b)	((T)(b))
  ------------------
 1218|  2.42M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1218:7): [True: 0, False: 2.42M]
  ------------------
 1219|      0|			goto out;
 1220|  2.42M|		return 1;
 1221|  7.41M|	case FILE_BELONG:
  ------------------
  |  |  230|  7.41M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1221:2): [True: 7.41M, False: 44.1M]
  ------------------
 1222|  7.41M|	case FILE_BEDATE:
  ------------------
  |  |  231|  7.41M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1222:2): [True: 161, False: 51.5M]
  ------------------
 1223|  7.42M|	case FILE_BELDATE:
  ------------------
  |  |  237|  7.42M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1223:2): [True: 5.17k, False: 51.5M]
  ------------------
 1224|  7.42M|		p->l = CAST(int32_t, BE32(p));
  ------------------
  |  |  426|  7.42M|#define CAST(T, b)	((T)(b))
  ------------------
 1225|  7.42M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1225:7): [True: 0, False: 7.42M]
  ------------------
 1226|      0|			goto out;
 1227|  7.42M|		return 1;
 1228|   516k|	case FILE_BEQUAD:
  ------------------
  |  |  248|   516k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1228:2): [True: 516k, False: 51.0M]
  ------------------
 1229|   516k|	case FILE_BEQDATE:
  ------------------
  |  |  251|   516k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1229:2): [True: 0, False: 51.5M]
  ------------------
 1230|   516k|	case FILE_BEQLDATE:
  ------------------
  |  |  254|   516k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1230:2): [True: 0, False: 51.5M]
  ------------------
 1231|   516k|	case FILE_BEQWDATE:
  ------------------
  |  |  266|   516k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1231:2): [True: 0, False: 51.5M]
  ------------------
 1232|   516k|		p->q = CAST(uint64_t, BE64(p));
  ------------------
  |  |  426|   516k|#define CAST(T, b)	((T)(b))
  ------------------
 1233|   516k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1233:7): [True: 0, False: 516k]
  ------------------
 1234|      0|			goto out;
 1235|   516k|		return 1;
 1236|  1.81M|	case FILE_LESHORT:
  ------------------
  |  |  232|  1.81M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1236:2): [True: 1.81M, False: 49.7M]
  ------------------
 1237|  1.81M|		p->h = CAST(short, LE16(p));
  ------------------
  |  |  426|  1.81M|#define CAST(T, b)	((T)(b))
  ------------------
 1238|  1.81M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1238:7): [True: 0, False: 1.81M]
  ------------------
 1239|      0|			goto out;
 1240|  1.81M|		return 1;
 1241|  3.39M|	case FILE_LELONG:
  ------------------
  |  |  233|  3.39M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1241:2): [True: 3.39M, False: 48.1M]
  ------------------
 1242|  3.39M|	case FILE_LEDATE:
  ------------------
  |  |  234|  3.39M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1242:2): [True: 284, False: 51.5M]
  ------------------
 1243|  3.39M|	case FILE_LELDATE:
  ------------------
  |  |  238|  3.39M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1243:2): [True: 0, False: 51.5M]
  ------------------
 1244|  3.39M|		p->l = CAST(int32_t, LE32(p));
  ------------------
  |  |  426|  3.39M|#define CAST(T, b)	((T)(b))
  ------------------
 1245|  3.39M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1245:7): [True: 0, False: 3.39M]
  ------------------
 1246|      0|			goto out;
 1247|  3.39M|		return 1;
 1248|   457k|	case FILE_LEQUAD:
  ------------------
  |  |  247|   457k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1248:2): [True: 457k, False: 51.1M]
  ------------------
 1249|   457k|	case FILE_LEQDATE:
  ------------------
  |  |  250|   457k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1249:2): [True: 0, False: 51.5M]
  ------------------
 1250|   457k|	case FILE_LEQLDATE:
  ------------------
  |  |  253|   457k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1250:2): [True: 0, False: 51.5M]
  ------------------
 1251|   457k|	case FILE_LEQWDATE:
  ------------------
  |  |  265|   457k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1251:2): [True: 0, False: 51.5M]
  ------------------
 1252|   457k|		p->q = CAST(uint64_t, LE64(p));
  ------------------
  |  |  426|   457k|#define CAST(T, b)	((T)(b))
  ------------------
 1253|   457k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1253:7): [True: 0, False: 457k]
  ------------------
 1254|      0|			goto out;
 1255|   457k|		return 1;
 1256|      0|	case FILE_MELONG:
  ------------------
  |  |  245|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1256:2): [True: 0, False: 51.5M]
  ------------------
 1257|     16|	case FILE_MEDATE:
  ------------------
  |  |  243|     16|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1257:2): [True: 16, False: 51.5M]
  ------------------
 1258|     16|	case FILE_MELDATE:
  ------------------
  |  |  244|     16|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1258:2): [True: 0, False: 51.5M]
  ------------------
 1259|     16|		p->l = CAST(int32_t, ME32(p));
  ------------------
  |  |  426|     16|#define CAST(T, b)	((T)(b))
  ------------------
 1260|     16|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1260:7): [True: 0, False: 16]
  ------------------
 1261|      0|			goto out;
 1262|     16|		return 1;
 1263|      0|	case FILE_FLOAT:
  ------------------
  |  |  255|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1263:2): [True: 0, False: 51.5M]
  ------------------
 1264|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1264:7): [True: 0, False: 0]
  ------------------
 1265|      0|			goto out;
 1266|      0|		return 1;
 1267|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  256|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1267:2): [True: 0, False: 51.5M]
  ------------------
 1268|      0|		p->l = BE32(p);
  ------------------
  |  |   94|      0|#define BE32(p) ( \
  |  |   95|      0|    (CAST(uint32_t, (p)->hl[0])<<24)| \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   96|      0|    (CAST(uint32_t, (p)->hl[1])<<16)| \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   97|      0|    (CAST(uint32_t, (p)->hl[2])<<8)| \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|      0|    (CAST(uint32_t, (p)->hl[3])))
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1269|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1269:7): [True: 0, False: 0]
  ------------------
 1270|      0|			goto out;
 1271|      0|		return 1;
 1272|    525|	case FILE_LEFLOAT:
  ------------------
  |  |  257|    525|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1272:2): [True: 525, False: 51.5M]
  ------------------
 1273|    525|		p->l = LE32(p);
  ------------------
  |  |   89|    525|#define LE32(p) ( \
  |  |   90|    525|    (CAST(uint32_t, (p)->hl[3])<<24)| \
  |  |  ------------------
  |  |  |  |  426|    525|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   91|    525|    (CAST(uint32_t, (p)->hl[2])<<16)| \
  |  |  ------------------
  |  |  |  |  426|    525|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|    525|    (CAST(uint32_t, (p)->hl[1])<<8)| \
  |  |  ------------------
  |  |  |  |  426|    525|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|    525|    (CAST(uint32_t, (p)->hl[0])))
  |  |  ------------------
  |  |  |  |  426|    525|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1274|    525|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1274:7): [True: 0, False: 525]
  ------------------
 1275|      0|			goto out;
 1276|    525|		return 1;
 1277|      0|	case FILE_DOUBLE:
  ------------------
  |  |  258|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1277:2): [True: 0, False: 51.5M]
  ------------------
 1278|      0|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1278:7): [True: 0, False: 0]
  ------------------
 1279|      0|			goto out;
 1280|      0|		return 1;
 1281|     30|	case FILE_BEDOUBLE:
  ------------------
  |  |  259|     30|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1281:2): [True: 30, False: 51.5M]
  ------------------
 1282|     30|		p->q = BE64(p);
  ------------------
  |  |   71|     30|#define BE64(p) ( \
  |  |   72|     30|    (CAST(uint64_t, (p)->hq[0])<<56)| \
  |  |  ------------------
  |  |  |  |  426|     30|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|     30|    (CAST(uint64_t, (p)->hq[1])<<48)| \
  |  |  ------------------
  |  |  |  |  426|     30|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   74|     30|    (CAST(uint64_t, (p)->hq[2])<<40)| \
  |  |  ------------------
  |  |  |  |  426|     30|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   75|     30|    (CAST(uint64_t, (p)->hq[3])<<32)| \
  |  |  ------------------
  |  |  |  |  426|     30|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   76|     30|    (CAST(uint64_t, (p)->hq[4])<<24)| \
  |  |  ------------------
  |  |  |  |  426|     30|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   77|     30|    (CAST(uint64_t, (p)->hq[5])<<16)| \
  |  |  ------------------
  |  |  |  |  426|     30|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   78|     30|    (CAST(uint64_t, (p)->hq[6])<<8)| \
  |  |  ------------------
  |  |  |  |  426|     30|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   79|     30|    (CAST(uint64_t, (p)->hq[7])))
  |  |  ------------------
  |  |  |  |  426|     30|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1283|     30|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1283:7): [True: 0, False: 30]
  ------------------
 1284|      0|			goto out;
 1285|     30|		return 1;
 1286|    184|	case FILE_LEDOUBLE:
  ------------------
  |  |  260|    184|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1286:2): [True: 184, False: 51.5M]
  ------------------
 1287|    184|		p->q = LE64(p);
  ------------------
  |  |   80|    184|#define LE64(p) ( \
  |  |   81|    184|    (CAST(uint64_t, (p)->hq[7])<<56)| \
  |  |  ------------------
  |  |  |  |  426|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   82|    184|    (CAST(uint64_t, (p)->hq[6])<<48)| \
  |  |  ------------------
  |  |  |  |  426|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   83|    184|    (CAST(uint64_t, (p)->hq[5])<<40)| \
  |  |  ------------------
  |  |  |  |  426|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   84|    184|    (CAST(uint64_t, (p)->hq[4])<<32)| \
  |  |  ------------------
  |  |  |  |  426|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   85|    184|    (CAST(uint64_t, (p)->hq[3])<<24)| \
  |  |  ------------------
  |  |  |  |  426|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   86|    184|    (CAST(uint64_t, (p)->hq[2])<<16)| \
  |  |  ------------------
  |  |  |  |  426|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   87|    184|    (CAST(uint64_t, (p)->hq[1])<<8)| \
  |  |  ------------------
  |  |  |  |  426|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   88|    184|    (CAST(uint64_t, (p)->hq[0])))
  |  |  ------------------
  |  |  |  |  426|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1288|    184|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1288:7): [True: 0, False: 184]
  ------------------
 1289|      0|			goto out;
 1290|    184|		return 1;
 1291|   189k|	case FILE_REGEX:
  ------------------
  |  |  239|   189k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1291:2): [True: 189k, False: 51.3M]
  ------------------
 1292|   619k|	case FILE_SEARCH:
  ------------------
  |  |  242|   619k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1292:2): [True: 429k, False: 51.1M]
  ------------------
 1293|   625k|	case FILE_DEFAULT:
  ------------------
  |  |  225|   625k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1293:2): [True: 6.48k, False: 51.5M]
  ------------------
 1294|   627k|	case FILE_CLEAR:
  ------------------
  |  |  269|   627k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1294:2): [True: 1.37k, False: 51.5M]
  ------------------
 1295|   627k|	case FILE_NAME:
  ------------------
  |  |  267|   627k|#define				FILE_NAME		45
  ------------------
  |  Branch (1295:2): [True: 0, False: 51.5M]
  ------------------
 1296|   627k|	case FILE_USE:
  ------------------
  |  |  268|   627k|#define				FILE_USE		46
  ------------------
  |  Branch (1296:2): [True: 0, False: 51.5M]
  ------------------
 1297|   843k|	case FILE_DER:
  ------------------
  |  |  270|   843k|#define				FILE_DER		48
  ------------------
  |  Branch (1297:2): [True: 216k, False: 51.3M]
  ------------------
 1298|   863k|	case FILE_GUID:
  ------------------
  |  |  271|   863k|#define				FILE_GUID		49
  ------------------
  |  Branch (1298:2): [True: 19.3k, False: 51.5M]
  ------------------
 1299|   863k|		return 1;
 1300|      0|	default:
  ------------------
  |  Branch (1300:2): [True: 0, False: 51.5M]
  ------------------
 1301|      0|		file_magerror(ms, "invalid type %d in mconvert()", m->type);
 1302|      0|		return 0;
 1303|  51.5M|	}
 1304|      0|out:
 1305|      0|	file_magerror(ms, "zerodivide in mconvert()");
 1306|      0|	return 0;
 1307|  51.5M|}
softmagic.c:cvt_8:
 1083|   788k|{
 1084|   788k|	DO_CVT(b, uint8_t);
  ------------------
  |  | 1047|   788k|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|   788k|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1047:6): [True: 60.0k, False: 728k]
  |  |  ------------------
  |  | 1048|   788k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  327|  60.0k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1048:11): [True: 0, False: 60.0k]
  |  |  ------------------
  |  | 1049|  45.1k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  319|  45.1k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1049:3): [True: 45.1k, False: 14.9k]
  |  |  ------------------
  |  | 1050|  45.1k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  45.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1051|  45.1k|			break; \
  |  | 1052|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  320|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 0, False: 60.0k]
  |  |  ------------------
  |  | 1053|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|      0|			break; \
  |  | 1055|      0|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  321|      0|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 60.0k]
  |  |  ------------------
  |  | 1056|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  322|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 0, False: 60.0k]
  |  |  ------------------
  |  | 1059|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      0|			break; \
  |  | 1061|  14.8k|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  323|  14.8k|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 14.8k, False: 45.1k]
  |  |  ------------------
  |  | 1062|  14.8k|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  14.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|  14.8k|			break; \
  |  | 1064|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  324|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 0, False: 60.0k]
  |  |  ------------------
  |  | 1065|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|      0|			break; \
  |  | 1067|     19|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  325|     19|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 19, False: 60.0k]
  |  |  ------------------
  |  | 1068|     19|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|     19|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1068:8): [True: 0, False: 19]
  |  |  ------------------
  |  | 1069|     19|				return -1; \
  |  | 1070|     19|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     19|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1071|     19|			break; \
  |  | 1072|     19|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  326|     18|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1072:3): [True: 18, False: 60.0k]
  |  |  ------------------
  |  | 1073|     18|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|     18|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1073:8): [True: 0, False: 18]
  |  |  ------------------
  |  | 1074|     18|				return -1; \
  |  | 1075|     18|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     18|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1076|     18|			break; \
  |  | 1077|  60.0k|		} \
  |  | 1078|   788k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  331|   788k|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1078:6): [True: 0, False: 788k]
  |  |  ------------------
  |  | 1079|   788k|		p->fld = ~p->fld \
  ------------------
 1085|   788k|	return 0;
 1086|   788k|}
softmagic.c:cvt_16:
 1090|  4.82M|{
 1091|  4.82M|	DO_CVT(h, uint16_t);
  ------------------
  |  | 1047|  4.82M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|  4.82M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1047:6): [True: 295k, False: 4.52M]
  |  |  ------------------
  |  | 1048|  4.82M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  327|   295k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1048:11): [True: 0, False: 295k]
  |  |  ------------------
  |  | 1049|   280k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  319|   280k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1049:3): [True: 280k, False: 15.6k]
  |  |  ------------------
  |  | 1050|   280k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|   280k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1051|   280k|			break; \
  |  | 1052|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  320|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 0, False: 295k]
  |  |  ------------------
  |  | 1053|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|      0|			break; \
  |  | 1055|      0|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  321|      0|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 295k]
  |  |  ------------------
  |  | 1056|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|     16|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  322|     16|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 16, False: 295k]
  |  |  ------------------
  |  | 1059|     16|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     16|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|     16|			break; \
  |  | 1061|    119|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  323|    119|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 119, False: 295k]
  |  |  ------------------
  |  | 1062|    119|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|    119|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|    119|			break; \
  |  | 1064|     18|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  324|     18|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 18, False: 295k]
  |  |  ------------------
  |  | 1065|     18|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     18|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|     18|			break; \
  |  | 1067|     64|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  325|     64|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 64, False: 295k]
  |  |  ------------------
  |  | 1068|     64|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|     64|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1068:8): [True: 0, False: 64]
  |  |  ------------------
  |  | 1069|     64|				return -1; \
  |  | 1070|     64|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     64|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1071|     64|			break; \
  |  | 1072|  15.4k|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  326|  15.4k|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1072:3): [True: 15.4k, False: 280k]
  |  |  ------------------
  |  | 1073|  15.4k|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|  15.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1073:8): [True: 0, False: 15.4k]
  |  |  ------------------
  |  | 1074|  15.4k|				return -1; \
  |  | 1075|  15.4k|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  15.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1076|  15.4k|			break; \
  |  | 1077|   295k|		} \
  |  | 1078|  4.82M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  331|  4.82M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1078:6): [True: 0, False: 4.82M]
  |  |  ------------------
  |  | 1079|  4.82M|		p->fld = ~p->fld \
  ------------------
 1092|  4.82M|	return 0;
 1093|  4.82M|}
softmagic.c:cvt_32:
 1097|  11.7M|{
 1098|  11.7M|	DO_CVT(l, uint32_t);
  ------------------
  |  | 1047|  11.7M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|  11.7M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1047:6): [True: 2.08M, False: 9.63M]
  |  |  ------------------
  |  | 1048|  11.7M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  327|  2.08M|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1048:11): [True: 0, False: 2.08M]
  |  |  ------------------
  |  | 1049|  2.08M|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  319|  2.08M|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1049:3): [True: 2.08M, False: 7.73k]
  |  |  ------------------
  |  | 1050|  2.08M|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  2.08M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1051|  2.08M|			break; \
  |  | 1052|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  320|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 0, False: 2.08M]
  |  |  ------------------
  |  | 1053|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|      0|			break; \
  |  | 1055|     20|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  321|     20|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 20, False: 2.08M]
  |  |  ------------------
  |  | 1056|     20|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     20|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|     20|			break; \
  |  | 1058|  1.94k|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  322|  1.94k|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 1.94k, False: 2.08M]
  |  |  ------------------
  |  | 1059|  1.94k|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  1.94k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|  1.94k|			break; \
  |  | 1061|  5.11k|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  323|  5.11k|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 5.11k, False: 2.08M]
  |  |  ------------------
  |  | 1062|  5.11k|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  5.11k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|  5.11k|			break; \
  |  | 1064|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  324|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 0, False: 2.08M]
  |  |  ------------------
  |  | 1065|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|      0|			break; \
  |  | 1067|    410|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  325|    410|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 410, False: 2.08M]
  |  |  ------------------
  |  | 1068|    410|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|    410|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1068:8): [True: 0, False: 410]
  |  |  ------------------
  |  | 1069|    410|				return -1; \
  |  | 1070|    410|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|    410|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1071|    410|			break; \
  |  | 1072|    410|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  326|    246|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1072:3): [True: 246, False: 2.08M]
  |  |  ------------------
  |  | 1073|    246|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|    246|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1073:8): [True: 0, False: 246]
  |  |  ------------------
  |  | 1074|    246|				return -1; \
  |  | 1075|    246|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|    246|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1076|    246|			break; \
  |  | 1077|  2.08M|		} \
  |  | 1078|  11.7M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  331|  11.7M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1078:6): [True: 0, False: 11.7M]
  |  |  ------------------
  |  | 1079|  11.7M|		p->fld = ~p->fld \
  ------------------
 1099|  11.7M|	return 0;
 1100|  11.7M|}
softmagic.c:cvt_64:
 1104|  1.01M|{
 1105|  1.01M|	DO_CVT(q, uint64_t);
  ------------------
  |  | 1047|  1.01M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|  1.01M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1047:6): [True: 95.1k, False: 919k]
  |  |  ------------------
  |  | 1048|  1.01M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  327|  95.1k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1048:11): [True: 0, False: 95.1k]
  |  |  ------------------
  |  | 1049|  95.1k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  319|  95.1k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1049:3): [True: 95.1k, False: 14]
  |  |  ------------------
  |  | 1050|  95.1k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  95.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1051|  95.1k|			break; \
  |  | 1052|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  320|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 0, False: 95.1k]
  |  |  ------------------
  |  | 1053|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|      0|			break; \
  |  | 1055|      0|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  321|      0|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 95.1k]
  |  |  ------------------
  |  | 1056|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|      7|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  322|      7|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 7, False: 95.1k]
  |  |  ------------------
  |  | 1059|      7|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      7|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      7|			break; \
  |  | 1061|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  323|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 0, False: 95.1k]
  |  |  ------------------
  |  | 1062|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|      0|			break; \
  |  | 1064|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  324|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 0, False: 95.1k]
  |  |  ------------------
  |  | 1065|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|      0|			break; \
  |  | 1067|      7|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  325|      7|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 7, False: 95.1k]
  |  |  ------------------
  |  | 1068|      7|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|      7|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1068:8): [True: 0, False: 7]
  |  |  ------------------
  |  | 1069|      7|				return -1; \
  |  | 1070|      7|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      7|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1071|      7|			break; \
  |  | 1072|      7|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  326|      0|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1072:3): [True: 0, False: 95.1k]
  |  |  ------------------
  |  | 1073|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1073:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1074|      0|				return -1; \
  |  | 1075|      0|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1076|      0|			break; \
  |  | 1077|  95.1k|		} \
  |  | 1078|  1.01M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  331|  1.01M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1078:6): [True: 0, False: 1.01M]
  |  |  ------------------
  |  | 1079|  1.01M|		p->fld = ~p->fld \
  ------------------
 1106|  1.01M|	return 0;
 1107|  1.01M|}
softmagic.c:cvt_float:
 1130|    525|{
 1131|    525|	DO_CVT2(f, float);
  ------------------
  |  | 1110|    525|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|    525|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1110:6): [True: 0, False: 525]
  |  |  ------------------
  |  | 1111|    525|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  327|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1111:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1112|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  322|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1112:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1113|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1114|      0|			break; \
  |  | 1115|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  323|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1115:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1116|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1117|      0|			break; \
  |  | 1118|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  324|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1118:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1119|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1120|      0|			break; \
  |  | 1121|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  325|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1121:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1122|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1122:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|				return -1; \
  |  | 1124|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1125|      0|			break; \
  |  | 1126|      0|		} \
  ------------------
 1132|    525|	return 0;
 1133|    525|}
softmagic.c:cvt_double:
 1137|    214|{
 1138|    214|	DO_CVT2(d, double);
  ------------------
  |  | 1110|    214|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|    214|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1110:6): [True: 0, False: 214]
  |  |  ------------------
  |  | 1111|    214|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  327|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1111:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1112|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  322|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1112:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1113|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1114|      0|			break; \
  |  | 1115|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  323|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1115:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1116|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1117|      0|			break; \
  |  | 1118|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  324|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1118:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1119|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1120|      0|			break; \
  |  | 1121|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  325|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1121:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1122|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1122:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|				return -1; \
  |  | 1124|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1125|      0|			break; \
  |  | 1126|      0|		} \
  ------------------
 1139|    214|	return 0;
 1140|    214|}
softmagic.c:magiccheck:
 2084|  51.5M|{
 2085|  51.5M|	uint64_t l = m->value.q;
 2086|  51.5M|	uint64_t v;
 2087|  51.5M|	float fl, fv;
 2088|  51.5M|	double dl, dv;
 2089|  51.5M|	int matched;
 2090|  51.5M|	union VALUETYPE *p = &ms->ms_value;
 2091|       |
 2092|  51.5M|	switch (m->type) {
 2093|   788k|	case FILE_BYTE:
  ------------------
  |  |  223|   788k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (2093:2): [True: 788k, False: 50.8M]
  ------------------
 2094|   788k|		v = p->b;
 2095|   788k|		break;
 2096|       |
 2097|   580k|	case FILE_SHORT:
  ------------------
  |  |  224|   580k|#define				FILE_SHORT		2
  ------------------
  |  Branch (2097:2): [True: 580k, False: 51.0M]
  ------------------
 2098|  3.00M|	case FILE_BESHORT:
  ------------------
  |  |  229|  3.00M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (2098:2): [True: 2.42M, False: 49.1M]
  ------------------
 2099|  4.82M|	case FILE_LESHORT:
  ------------------
  |  |  232|  4.82M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (2099:2): [True: 1.81M, False: 49.7M]
  ------------------
 2100|  4.82M|	case FILE_MSDOSDATE:
  ------------------
  |  |  275|  4.82M|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (2100:2): [True: 0, False: 51.5M]
  ------------------
 2101|  4.82M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  276|  4.82M|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (2101:2): [True: 0, False: 51.5M]
  ------------------
 2102|  4.82M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  277|  4.82M|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (2102:2): [True: 0, False: 51.5M]
  ------------------
 2103|  4.82M|	case FILE_MSDOSTIME:
  ------------------
  |  |  278|  4.82M|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (2103:2): [True: 0, False: 51.5M]
  ------------------
 2104|  4.82M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  279|  4.82M|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (2104:2): [True: 0, False: 51.5M]
  ------------------
 2105|  4.82M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  280|  4.82M|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (2105:2): [True: 0, False: 51.5M]
  ------------------
 2106|  4.82M|		v = p->h;
 2107|  4.82M|		break;
 2108|       |
 2109|   902k|	case FILE_LONG:
  ------------------
  |  |  226|   902k|#define				FILE_LONG		4
  ------------------
  |  Branch (2109:2): [True: 902k, False: 50.6M]
  ------------------
 2110|  8.31M|	case FILE_BELONG:
  ------------------
  |  |  230|  8.31M|#define				FILE_BELONG		8
  ------------------
  |  Branch (2110:2): [True: 7.41M, False: 44.1M]
  ------------------
 2111|  11.7M|	case FILE_LELONG:
  ------------------
  |  |  233|  11.7M|#define				FILE_LELONG		11
  ------------------
  |  Branch (2111:2): [True: 3.39M, False: 48.1M]
  ------------------
 2112|  11.7M|	case FILE_MELONG:
  ------------------
  |  |  245|  11.7M|#define				FILE_MELONG		23
  ------------------
  |  Branch (2112:2): [True: 0, False: 51.5M]
  ------------------
 2113|  11.7M|	case FILE_DATE:
  ------------------
  |  |  228|  11.7M|#define				FILE_DATE		6
  ------------------
  |  Branch (2113:2): [True: 0, False: 51.5M]
  ------------------
 2114|  11.7M|	case FILE_BEDATE:
  ------------------
  |  |  231|  11.7M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (2114:2): [True: 156, False: 51.5M]
  ------------------
 2115|  11.7M|	case FILE_LEDATE:
  ------------------
  |  |  234|  11.7M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (2115:2): [True: 289, False: 51.5M]
  ------------------
 2116|  11.7M|	case FILE_MEDATE:
  ------------------
  |  |  243|  11.7M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (2116:2): [True: 16, False: 51.5M]
  ------------------
 2117|  11.7M|	case FILE_LDATE:
  ------------------
  |  |  236|  11.7M|#define				FILE_LDATE		14
  ------------------
  |  Branch (2117:2): [True: 0, False: 51.5M]
  ------------------
 2118|  11.7M|	case FILE_BELDATE:
  ------------------
  |  |  237|  11.7M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (2118:2): [True: 5.17k, False: 51.5M]
  ------------------
 2119|  11.7M|	case FILE_LELDATE:
  ------------------
  |  |  238|  11.7M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (2119:2): [True: 0, False: 51.5M]
  ------------------
 2120|  11.7M|	case FILE_MELDATE:
  ------------------
  |  |  244|  11.7M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (2120:2): [True: 0, False: 51.5M]
  ------------------
 2121|  11.7M|		v = p->l;
 2122|  11.7M|		break;
 2123|       |
 2124|  39.6k|	case FILE_QUAD:
  ------------------
  |  |  246|  39.6k|#define				FILE_QUAD		24
  ------------------
  |  Branch (2124:2): [True: 39.6k, False: 51.5M]
  ------------------
 2125|   496k|	case FILE_LEQUAD:
  ------------------
  |  |  247|   496k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (2125:2): [True: 457k, False: 51.1M]
  ------------------
 2126|  1.01M|	case FILE_BEQUAD:
  ------------------
  |  |  248|  1.01M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (2126:2): [True: 516k, False: 51.0M]
  ------------------
 2127|  1.01M|	case FILE_QDATE:
  ------------------
  |  |  249|  1.01M|#define				FILE_QDATE		27
  ------------------
  |  Branch (2127:2): [True: 0, False: 51.5M]
  ------------------
 2128|  1.01M|	case FILE_BEQDATE:
  ------------------
  |  |  251|  1.01M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (2128:2): [True: 0, False: 51.5M]
  ------------------
 2129|  1.01M|	case FILE_LEQDATE:
  ------------------
  |  |  250|  1.01M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (2129:2): [True: 0, False: 51.5M]
  ------------------
 2130|  1.01M|	case FILE_QLDATE:
  ------------------
  |  |  252|  1.01M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (2130:2): [True: 0, False: 51.5M]
  ------------------
 2131|  1.01M|	case FILE_BEQLDATE:
  ------------------
  |  |  254|  1.01M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (2131:2): [True: 0, False: 51.5M]
  ------------------
 2132|  1.01M|	case FILE_LEQLDATE:
  ------------------
  |  |  253|  1.01M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (2132:2): [True: 0, False: 51.5M]
  ------------------
 2133|  1.01M|	case FILE_QWDATE:
  ------------------
  |  |  264|  1.01M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (2133:2): [True: 297, False: 51.5M]
  ------------------
 2134|  1.01M|	case FILE_BEQWDATE:
  ------------------
  |  |  266|  1.01M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (2134:2): [True: 0, False: 51.5M]
  ------------------
 2135|  1.01M|	case FILE_LEQWDATE:
  ------------------
  |  |  265|  1.01M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (2135:2): [True: 0, False: 51.5M]
  ------------------
 2136|  1.01M|	case FILE_OFFSET:
  ------------------
  |  |  272|  1.01M|#define				FILE_OFFSET		50
  ------------------
  |  Branch (2136:2): [True: 1.11k, False: 51.5M]
  ------------------
 2137|  1.01M|		v = p->q;
 2138|  1.01M|		break;
 2139|       |
 2140|      0|	case FILE_FLOAT:
  ------------------
  |  |  255|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (2140:2): [True: 0, False: 51.5M]
  ------------------
 2141|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  256|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (2141:2): [True: 0, False: 51.5M]
  ------------------
 2142|    525|	case FILE_LEFLOAT:
  ------------------
  |  |  257|    525|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (2142:2): [True: 525, False: 51.5M]
  ------------------
 2143|    525|		fl = m->value.f;
 2144|    525|		fv = p->f;
 2145|    525|		switch (m->reln) {
 2146|    132|		case 'x':
  ------------------
  |  Branch (2146:3): [True: 132, False: 393]
  ------------------
 2147|    132|			matched = 1;
 2148|    132|			break;
 2149|       |
 2150|      0|		case '!':
  ------------------
  |  Branch (2150:3): [True: 0, False: 525]
  ------------------
 2151|      0|			matched = fv != fl;
 2152|      0|			break;
 2153|       |
 2154|      0|		case '=':
  ------------------
  |  Branch (2154:3): [True: 0, False: 525]
  ------------------
 2155|      0|			matched = fv == fl;
 2156|      0|			break;
 2157|       |
 2158|    393|		case '>':
  ------------------
  |  Branch (2158:3): [True: 393, False: 132]
  ------------------
 2159|    393|			matched = fv > fl;
 2160|    393|			break;
 2161|       |
 2162|      0|		case '<':
  ------------------
  |  Branch (2162:3): [True: 0, False: 525]
  ------------------
 2163|      0|			matched = fv < fl;
 2164|      0|			break;
 2165|       |
 2166|      0|		default:
  ------------------
  |  Branch (2166:3): [True: 0, False: 525]
  ------------------
 2167|      0|			file_magerror(ms, "cannot happen with float: "
 2168|      0|			    "invalid relation `%c'", m->reln);
 2169|      0|			return -1;
 2170|    525|		}
 2171|    525|		return matched;
 2172|       |
 2173|      0|	case FILE_DOUBLE:
  ------------------
  |  |  258|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (2173:2): [True: 0, False: 51.5M]
  ------------------
 2174|     30|	case FILE_BEDOUBLE:
  ------------------
  |  |  259|     30|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (2174:2): [True: 30, False: 51.5M]
  ------------------
 2175|    214|	case FILE_LEDOUBLE:
  ------------------
  |  |  260|    214|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (2175:2): [True: 184, False: 51.5M]
  ------------------
 2176|    214|		dl = m->value.d;
 2177|    214|		dv = p->d;
 2178|    214|		switch (m->reln) {
 2179|    166|		case 'x':
  ------------------
  |  Branch (2179:3): [True: 166, False: 48]
  ------------------
 2180|    166|			matched = 1;
 2181|    166|			break;
 2182|       |
 2183|      0|		case '!':
  ------------------
  |  Branch (2183:3): [True: 0, False: 214]
  ------------------
 2184|      0|			matched = dv != dl;
 2185|      0|			break;
 2186|       |
 2187|     48|		case '=':
  ------------------
  |  Branch (2187:3): [True: 48, False: 166]
  ------------------
 2188|     48|			matched = dv == dl;
 2189|     48|			break;
 2190|       |
 2191|      0|		case '>':
  ------------------
  |  Branch (2191:3): [True: 0, False: 214]
  ------------------
 2192|      0|			matched = dv > dl;
 2193|      0|			break;
 2194|       |
 2195|      0|		case '<':
  ------------------
  |  Branch (2195:3): [True: 0, False: 214]
  ------------------
 2196|      0|			matched = dv < dl;
 2197|      0|			break;
 2198|       |
 2199|      0|		default:
  ------------------
  |  Branch (2199:3): [True: 0, False: 214]
  ------------------
 2200|      0|			file_magerror(ms, "cannot happen with double: "
 2201|      0|			    "invalid relation `%c'", m->reln);
 2202|      0|			return -1;
 2203|    214|		}
 2204|    214|		return matched;
 2205|       |
 2206|  6.48k|	case FILE_DEFAULT:
  ------------------
  |  |  225|  6.48k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2206:2): [True: 6.48k, False: 51.5M]
  ------------------
 2207|  7.86k|	case FILE_CLEAR:
  ------------------
  |  |  269|  7.86k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2207:2): [True: 1.37k, False: 51.5M]
  ------------------
 2208|  7.86k|		l = 0;
 2209|  7.86k|		v = 0;
 2210|  7.86k|		break;
 2211|       |
 2212|  32.3M|	case FILE_STRING:
  ------------------
  |  |  227|  32.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (2212:2): [True: 32.3M, False: 19.2M]
  ------------------
 2213|  32.3M|	case FILE_PSTRING:
  ------------------
  |  |  235|  32.3M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (2213:2): [True: 17.2k, False: 51.5M]
  ------------------
 2214|  32.3M|	case FILE_OCTAL:
  ------------------
  |  |  281|  32.3M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (2214:2): [True: 0, False: 51.5M]
  ------------------
 2215|  32.3M|		l = 0;
 2216|  32.3M|		v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  426|  32.3M|#define CAST(T, b)	((T)(b))
  ------------------
 2217|  32.3M|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  357|  32.3M|#define str_flags _u._s._flags
  ------------------
 2218|  32.3M|		break;
 2219|       |
 2220|    119|	case FILE_BESTRING16:
  ------------------
  |  |  240|    119|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (2220:2): [True: 119, False: 51.5M]
  ------------------
 2221|  38.4k|	case FILE_LESTRING16:
  ------------------
  |  |  241|  38.4k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (2221:2): [True: 38.3k, False: 51.5M]
  ------------------
 2222|  38.4k|		l = 0;
 2223|  38.4k|		v = file_strncmp16(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  426|  38.4k|#define CAST(T, b)	((T)(b))
  ------------------
 2224|  38.4k|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  357|  38.4k|#define str_flags _u._s._flags
  ------------------
 2225|  38.4k|		break;
 2226|       |
 2227|   429k|	case FILE_SEARCH: { /* search ms->search.s for the string m->value.s */
  ------------------
  |  |  242|   429k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (2227:2): [True: 429k, False: 51.1M]
  ------------------
 2228|   429k|		size_t slen;
 2229|   429k|		size_t idx;
 2230|       |
 2231|   429k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2231:7): [True: 0, False: 429k]
  ------------------
 2232|      0|			return 0;
 2233|       |
 2234|   429k|		slen = MIN(m->vallen, sizeof(m->value.s));
 2235|   429k|		l = 0;
 2236|   429k|		v = 0;
 2237|   429k|#ifdef HAVE_MEMMEM
 2238|   429k|		if (slen > 0 && m->str_flags == 0) {
  ------------------
  |  |  357|   429k|#define str_flags _u._s._flags
  ------------------
  |  Branch (2238:7): [True: 429k, False: 0]
  |  Branch (2238:19): [True: 274k, False: 154k]
  ------------------
 2239|   274k|			const char *found;
 2240|   274k|			idx = m->str_range + slen;
  ------------------
  |  |  356|   274k|#define str_range _u._s._count
  ------------------
 2241|   274k|			if (m->str_range == 0 || ms->search.s_len < idx)
  ------------------
  |  |  356|   274k|#define str_range _u._s._count
  ------------------
  |  Branch (2241:8): [True: 3.20k, False: 271k]
  |  Branch (2241:29): [True: 123k, False: 148k]
  ------------------
 2242|   126k|				idx = ms->search.s_len;
 2243|   274k|			found = CAST(const char *, memmem(ms->search.s, idx,
  ------------------
  |  |  426|   274k|#define CAST(T, b)	((T)(b))
  ------------------
 2244|   274k|			    m->value.s, slen));
 2245|   274k|			if (!found) {
  ------------------
  |  Branch (2245:8): [True: 273k, False: 1.42k]
  ------------------
 2246|   273k|				v = 1;
 2247|   273k|				break;
 2248|   273k|			}
 2249|  1.42k|			idx = found - ms->search.s;
 2250|  1.42k|			ms->search.offset += idx;
 2251|  1.42k|			ms->search.rm_len = ms->search.s_len - idx;
 2252|  1.42k|			break;
 2253|   274k|		}
 2254|   154k|#endif
 2255|       |
 2256|  37.2M|		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  356|  37.2M|#define str_range _u._s._count
  ------------------
              		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  356|  37.2M|#define str_range _u._s._count
  ------------------
  |  Branch (2256:17): [True: 0, False: 37.2M]
  |  Branch (2256:38): [True: 37.1M, False: 82.5k]
  ------------------
 2257|  37.1M|			if (slen + idx > ms->search.s_len) {
  ------------------
  |  Branch (2257:8): [True: 71.4k, False: 37.0M]
  ------------------
 2258|  71.4k|				v = 1;
 2259|  71.4k|				break;
 2260|  71.4k|			}
 2261|       |
 2262|  37.0M|			v = file_strncmp(m->value.s, ms->search.s + idx, slen,
 2263|  37.0M|			    ms->search.s_len - idx, m->str_flags);
  ------------------
  |  |  357|  37.0M|#define str_flags _u._s._flags
  ------------------
 2264|  37.0M|			if (v == 0) {	/* found match */
  ------------------
  |  Branch (2264:8): [True: 470, False: 37.0M]
  ------------------
 2265|    470|				ms->search.offset += idx;
 2266|    470|				ms->search.rm_len = ms->search.s_len - idx;
 2267|    470|				break;
 2268|    470|			}
 2269|  37.0M|		}
 2270|   154k|		break;
 2271|   429k|	}
 2272|   189k|	case FILE_REGEX: {
  ------------------
  |  |  239|   189k|#define				FILE_REGEX		17
  ------------------
  |  Branch (2272:2): [True: 189k, False: 51.4M]
  ------------------
 2273|   189k|		int rc;
 2274|   189k|		file_regex_t *rx = *m_cache;
 2275|   189k|		const char *search;
 2276|   189k|		regmatch_t pmatch;
 2277|   189k|		size_t slen = ms->search.s_len;
 2278|   189k|		char *copy;
 2279|       |
 2280|   189k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2280:7): [True: 0, False: 189k]
  ------------------
 2281|      0|			return 0;
 2282|       |
 2283|   189k|		if (rx == NULL) {
  ------------------
  |  Branch (2283:7): [True: 148, False: 189k]
  ------------------
 2284|    148|			rx = *m_cache = alloc_regex(ms, m);
 2285|    148|			if (rx == NULL)
  ------------------
  |  Branch (2285:8): [True: 0, False: 148]
  ------------------
 2286|      0|				return -1;
 2287|    148|		}
 2288|   189k|		l = 0;
 2289|   189k|		if (slen != 0) {
  ------------------
  |  Branch (2289:7): [True: 188k, False: 1.10k]
  ------------------
 2290|   188k|		    copy = CAST(char *, malloc(slen));
  ------------------
  |  |  426|   188k|#define CAST(T, b)	((T)(b))
  ------------------
 2291|   188k|		    if (copy == NULL)  {
  ------------------
  |  Branch (2291:11): [True: 0, False: 188k]
  ------------------
 2292|      0|			file_error(ms, errno,
 2293|      0|			    "can't allocate %" SIZE_T_FORMAT "u bytes",
 2294|      0|			    slen);
 2295|      0|			return -1;
 2296|      0|		    }
 2297|   188k|		    memcpy(copy, ms->search.s, slen);
 2298|   188k|		    copy[--slen] = '\0';
 2299|   188k|		    search = copy;
 2300|   188k|		} else {
 2301|  1.10k|		    search = CCAST(char *, "");
  ------------------
  |  |  428|  1.10k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2302|  1.10k|		    copy = NULL;
 2303|  1.10k|		}
 2304|   189k|		rc = file_regexec(ms, rx, RCAST(const char *, search),
  ------------------
  |  |  427|   189k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2305|   189k|		    1, &pmatch, 0);
 2306|   189k|		free(copy);
 2307|   189k|		switch (rc) {
 2308|  2.79k|		case 0:
  ------------------
  |  Branch (2308:3): [True: 2.79k, False: 187k]
  ------------------
 2309|  2.79k|			ms->search.s += CAST(int, pmatch.rm_so);
  ------------------
  |  |  426|  2.79k|#define CAST(T, b)	((T)(b))
  ------------------
 2310|  2.79k|			ms->search.offset += CAST(size_t, pmatch.rm_so);
  ------------------
  |  |  426|  2.79k|#define CAST(T, b)	((T)(b))
  ------------------
 2311|  2.79k|			ms->search.rm_len = CAST(size_t,
  ------------------
  |  |  426|  2.79k|#define CAST(T, b)	((T)(b))
  ------------------
 2312|  2.79k|			    pmatch.rm_eo - pmatch.rm_so);
 2313|  2.79k|			v = 0;
 2314|  2.79k|			break;
 2315|       |
 2316|   187k|		case REG_NOMATCH:
  ------------------
  |  Branch (2316:3): [True: 187k, False: 2.79k]
  ------------------
 2317|   187k|			v = 1;
 2318|   187k|			break;
 2319|       |
 2320|      0|		default:
  ------------------
  |  Branch (2320:3): [True: 0, False: 189k]
  ------------------
 2321|      0|			return -1;
 2322|   189k|		}
 2323|   189k|		break;
 2324|   189k|	}
 2325|   189k|	case FILE_USE:
  ------------------
  |  |  268|  10.8k|#define				FILE_USE		46
  ------------------
  |  Branch (2325:2): [True: 10.8k, False: 51.5M]
  ------------------
 2326|  10.8k|		return ms->ms_value.q != 0;
 2327|  12.9k|	case FILE_NAME:
  ------------------
  |  |  267|  12.9k|#define				FILE_NAME		45
  ------------------
  |  Branch (2327:2): [True: 12.9k, False: 51.5M]
  ------------------
 2328|  18.2k|	case FILE_INDIRECT:
  ------------------
  |  |  263|  18.2k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (2328:2): [True: 5.31k, False: 51.5M]
  ------------------
 2329|  18.2k|		return 1;
 2330|   216k|	case FILE_DER:
  ------------------
  |  |  270|   216k|#define				FILE_DER		48
  ------------------
  |  Branch (2330:2): [True: 216k, False: 51.3M]
  ------------------
 2331|   216k|		matched = der_cmp(ms, m);
 2332|   216k|		if (matched == -1) {
  ------------------
  |  Branch (2332:7): [True: 67.0k, False: 149k]
  ------------------
 2333|  67.0k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  67.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2333:8): [True: 0, False: 67.0k]
  ------------------
 2334|      0|				(void) fprintf(stderr,
 2335|      0|				    "EOF comparing DER entries\n");
 2336|      0|			}
 2337|  67.0k|			return 0;
 2338|  67.0k|		}
 2339|   149k|		return matched;
 2340|  19.3k|	case FILE_GUID:
  ------------------
  |  |  271|  19.3k|#define				FILE_GUID		49
  ------------------
  |  Branch (2340:2): [True: 19.3k, False: 51.5M]
  ------------------
 2341|  19.3k|		l = 0;
 2342|  19.3k|		v = memcmp(m->value.guid, p->guid, sizeof(p->guid));
 2343|  19.3k|		break;
 2344|      0|	default:
  ------------------
  |  Branch (2344:2): [True: 0, False: 51.5M]
  ------------------
 2345|      0|		file_magerror(ms, "invalid type %d in magiccheck()", m->type);
 2346|      0|		return -1;
 2347|  51.5M|	}
 2348|       |
 2349|  51.3M|	v = file_signextend(ms, m, v);
 2350|       |
 2351|  51.3M|	switch (m->reln) {
 2352|  55.2k|	case 'x':
  ------------------
  |  Branch (2352:2): [True: 55.2k, False: 51.2M]
  ------------------
 2353|  55.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  55.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2353:7): [True: 0, False: 55.2k]
  ------------------
 2354|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT
 2355|      0|			    "u == *any* = 1\n", CAST(unsigned long long, v));
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2356|  55.2k|		matched = 1;
 2357|  55.2k|		break;
 2358|       |
 2359|  68.8k|	case '!':
  ------------------
  |  Branch (2359:2): [True: 68.8k, False: 51.2M]
  ------------------
 2360|  68.8k|		matched = v != l;
 2361|  68.8k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  68.8k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2361:7): [True: 0, False: 68.8k]
  ------------------
 2362|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u != %"
 2363|      0|			    INT64_T_FORMAT "u = %d\n",
 2364|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2365|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2366|  68.8k|		break;
 2367|       |
 2368|  50.8M|	case '=':
  ------------------
  |  Branch (2368:2): [True: 50.8M, False: 500k]
  ------------------
 2369|  50.8M|		matched = v == l;
 2370|  50.8M|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  50.8M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2370:7): [True: 0, False: 50.8M]
  ------------------
 2371|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u == %"
 2372|      0|			    INT64_T_FORMAT "u = %d\n",
 2373|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2374|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2375|  50.8M|		break;
 2376|       |
 2377|   138k|	case '>':
  ------------------
  |  Branch (2377:2): [True: 138k, False: 51.2M]
  ------------------
 2378|   138k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  208|   138k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2378:7): [True: 115k, False: 22.7k]
  ------------------
 2379|   115k|			matched = v > l;
 2380|   115k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   115k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2380:8): [True: 0, False: 115k]
  ------------------
 2381|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2382|      0|				    "u > %" INT64_T_FORMAT "u = %d\n",
 2383|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2384|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2385|   115k|		}
 2386|  22.7k|		else {
 2387|  22.7k|			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  426|  22.7k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  426|  22.7k|#define CAST(T, b)	((T)(b))
  ------------------
 2388|  22.7k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  22.7k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2388:8): [True: 0, False: 22.7k]
  ------------------
 2389|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2390|      0|				    "d > %" INT64_T_FORMAT "d = %d\n",
 2391|      0|				    CAST(long long, v),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2392|      0|				    CAST(long long, l), matched);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2393|  22.7k|		}
 2394|   138k|		break;
 2395|       |
 2396|   194k|	case '<':
  ------------------
  |  Branch (2396:2): [True: 194k, False: 51.1M]
  ------------------
 2397|   194k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  208|   194k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2397:7): [True: 160k, False: 33.8k]
  ------------------
 2398|   160k|			matched = v < l;
 2399|   160k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   160k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2399:8): [True: 0, False: 160k]
  ------------------
 2400|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2401|      0|				    "u < %" INT64_T_FORMAT "u = %d\n",
 2402|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2403|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2404|   160k|		}
 2405|  33.8k|		else {
 2406|  33.8k|			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  426|  33.8k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  426|  33.8k|#define CAST(T, b)	((T)(b))
  ------------------
 2407|  33.8k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  33.8k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2407:8): [True: 0, False: 33.8k]
  ------------------
 2408|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2409|      0|				    "d < %" INT64_T_FORMAT "d = %d\n",
 2410|      0|				     CAST(long long, v),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2411|      0|				     CAST(long long, l), matched);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2412|  33.8k|		}
 2413|   194k|		break;
 2414|       |
 2415|  43.3k|	case '&':
  ------------------
  |  Branch (2415:2): [True: 43.3k, False: 51.3M]
  ------------------
 2416|  43.3k|		matched = (v & l) == l;
 2417|  43.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  43.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2417:7): [True: 0, False: 43.3k]
  ------------------
 2418|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2419|      0|			    INT64_T_FORMAT "x) == %" INT64_T_FORMAT
 2420|      0|			    "x) = %d\n", CAST(unsigned long long, v),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2421|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2422|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2423|      0|			    matched);
 2424|  43.3k|		break;
 2425|       |
 2426|    688|	case '^':
  ------------------
  |  Branch (2426:2): [True: 688, False: 51.3M]
  ------------------
 2427|    688|		matched = (v & l) != l;
 2428|    688|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    688|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2428:7): [True: 0, False: 688]
  ------------------
 2429|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2430|      0|			    INT64_T_FORMAT "x) != %" INT64_T_FORMAT
 2431|      0|			    "x) = %d\n", CAST(unsigned long long, v),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2432|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2433|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2434|    688|		break;
 2435|       |
 2436|      0|	default:
  ------------------
  |  Branch (2436:2): [True: 0, False: 51.3M]
  ------------------
 2437|      0|		file_magerror(ms, "cannot happen: invalid relation `%c'",
 2438|      0|		    m->reln);
 2439|      0|		return -1;
 2440|  51.3M|	}
 2441|       |
 2442|  51.3M|	return matched;
 2443|  51.3M|}
softmagic.c:file_strncmp:
 1974|  69.4M|{
 1975|       |	/*
 1976|       |	 * Convert the source args to unsigned here so that (1) the
 1977|       |	 * compare will be unsigned as it is in strncmp() and (2) so
 1978|       |	 * the ctype functions will work correctly without extra
 1979|       |	 * casting.
 1980|       |	 */
 1981|  69.4M|	const unsigned char *a = RCAST(const unsigned char *, s1);
  ------------------
  |  |  427|  69.4M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1982|  69.4M|	const unsigned char *b = RCAST(const unsigned char *, s2);
  ------------------
  |  |  427|  69.4M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1983|  69.4M|	uint32_t ws = flags & (STRING_COMPACT_WHITESPACE |
  ------------------
  |  |  371|  69.4M|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  370|  69.4M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 1984|  69.4M|	    STRING_COMPACT_OPTIONAL_WHITESPACE);
  ------------------
  |  |  372|  69.4M|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  370|  69.4M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 1985|  69.4M|	const unsigned char *eb = b + (ws ? maxlen : len);
  ------------------
  |  Branch (1985:33): [True: 26.0M, False: 43.3M]
  ------------------
 1986|  69.4M|	uint64_t v;
 1987|       |
 1988|       |	/*
 1989|       |	 * What we want here is v = strncmp(s1, s2, len),
 1990|       |	 * but ignoring any nulls.
 1991|       |	 */
 1992|  69.4M|	v = 0;
 1993|  69.4M|	len++;
 1994|  69.4M|	if (0L == flags) { /* normal string: do it fast */
  ------------------
  |  Branch (1994:6): [True: 30.5M, False: 38.8M]
  ------------------
 1995|  31.0M|		while (--len > 0)
  ------------------
  |  Branch (1995:10): [True: 31.0M, False: 17.5k]
  ------------------
 1996|  31.0M|			if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (1996:8): [True: 30.5M, False: 556k]
  ------------------
 1997|  30.5M|				break;
 1998|  30.5M|	}
 1999|  38.8M|	else { /* combine the others */
 2000|  39.2M|		while (--len > 0) {
  ------------------
  |  Branch (2000:10): [True: 39.2M, False: 19.6k]
  ------------------
 2001|  39.2M|			if (b >= eb) {
  ------------------
  |  Branch (2001:8): [True: 220k, False: 39.0M]
  ------------------
 2002|   220k|				v = 1;
 2003|   220k|				break;
 2004|   220k|			}
 2005|  39.0M|			if ((flags & STRING_IGNORE_LOWERCASE) &&
  ------------------
  |  |  373|  39.0M|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  ------------------
  |  |  |  |  370|  39.0M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2005:8): [True: 25.4M, False: 13.6M]
  ------------------
 2006|  39.0M|			    islower(*a)) {
 2007|  2.02M|				if ((v = tolower(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2007:9): [True: 2.00M, False: 18.0k]
  ------------------
 2008|  2.00M|					break;
 2009|  2.02M|			}
 2010|  37.0M|			else if ((flags & STRING_IGNORE_UPPERCASE) &&
  ------------------
  |  |  374|  37.0M|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  ------------------
  |  |  |  |  370|  37.0M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2010:13): [True: 17.4k, False: 36.9M]
  ------------------
 2011|  37.0M|			    isupper(*a)) {
 2012|  17.2k|				if ((v = toupper(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2012:9): [True: 17.0k, False: 195]
  ------------------
 2013|  17.0k|					break;
 2014|  17.2k|			}
 2015|  36.9M|			else if ((flags & STRING_COMPACT_WHITESPACE) &&
  ------------------
  |  |  371|  36.9M|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  370|  36.9M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2015:13): [True: 17.5M, False: 19.4M]
  ------------------
 2016|  36.9M|			    isspace(*a)) {
 2017|  1.17M|				a++;
 2018|  1.17M|				if (isspace(*b)) {
 2019|   274k|					b++;
 2020|   274k|					if (!isspace(*a))
  ------------------
  |  Branch (2020:10): [True: 274k, False: 0]
  ------------------
 2021|  9.45G|						while (b < eb && isspace(*b))
  ------------------
  |  Branch (2021:14): [True: 9.45G, False: 220k]
  ------------------
 2022|  9.45G|							b++;
 2023|   274k|				}
 2024|   896k|				else {
 2025|   896k|					v = 1;
 2026|   896k|					break;
 2027|   896k|				}
 2028|  1.17M|			}
 2029|  35.8M|			else if ((flags & STRING_COMPACT_OPTIONAL_WHITESPACE) &&
  ------------------
  |  |  372|  35.8M|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  370|  35.8M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2029:13): [True: 8.60M, False: 27.2M]
  ------------------
 2030|  35.8M|			    isspace(*a)) {
 2031|  3.42k|				a++;
 2032|  9.30k|				while (b < eb && isspace(*b))
  ------------------
  |  Branch (2032:12): [True: 9.24k, False: 54]
  ------------------
 2033|  5.88k|					b++;
 2034|  3.42k|			}
 2035|  35.8M|			else {
 2036|  35.8M|				if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2036:9): [True: 35.7M, False: 105k]
  ------------------
 2037|  35.7M|					break;
 2038|  35.8M|			}
 2039|  39.0M|		}
 2040|  38.8M|		if (len == 0 && v == 0 && (flags & STRING_FULL_WORD)) {
  ------------------
  |  |  389|  19.6k|#define	STRING_FULL_WORD			BIT(14)
  |  |  ------------------
  |  |  |  |  370|  19.6k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2040:7): [True: 19.6k, False: 38.8M]
  |  Branch (2040:19): [True: 19.6k, False: 0]
  |  Branch (2040:29): [True: 51, False: 19.6k]
  ------------------
 2041|     51|			if (*b && !isspace(*b))
  ------------------
  |  Branch (2041:8): [True: 33, False: 18]
  |  Branch (2041:14): [True: 23, False: 10]
  ------------------
 2042|     23|				v = 1;
 2043|     51|		}
 2044|  38.8M|	}
 2045|  69.4M|	return v;
 2046|  69.4M|}
softmagic.c:file_strncmp16:
 2051|  38.4k|{
 2052|       |	/*
 2053|       |	 * XXX - The 16-bit string compare probably needs to be done
 2054|       |	 * differently, especially if the flags are to be supported.
 2055|       |	 * At the moment, I am unsure.
 2056|       |	 */
 2057|  38.4k|	flags = 0;
 2058|  38.4k|	return file_strncmp(a, b, len, maxlen, flags);
 2059|  38.4k|}
softmagic.c:alloc_regex:
 2063|    148|{
 2064|    148|	int rc;
 2065|    148|	file_regex_t *rx = CAST(file_regex_t *, malloc(sizeof(*rx)));
  ------------------
  |  |  426|    148|#define CAST(T, b)	((T)(b))
  ------------------
 2066|       |
 2067|    148|	if (rx == NULL) {
  ------------------
  |  Branch (2067:6): [True: 0, False: 148]
  ------------------
 2068|      0|		file_error(ms, errno, "can't allocate %" SIZE_T_FORMAT
 2069|      0|		    "u bytes", sizeof(*rx));
 2070|      0|		return NULL;
 2071|      0|	}
 2072|       |
 2073|    148|	rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE |
 2074|    148|	    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
  ------------------
  |  |  357|    148|#define str_flags _u._s._flags
  ------------------
              	    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
  ------------------
  |  |  406|    148|#define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  ------------------
  |  |  |  |  373|    148|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|    148|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  ------------------
  |  |  |  |  374|    148|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|    148|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2074:7): [True: 17, False: 131]
  ------------------
 2075|    148|	if (rc == 0)
  ------------------
  |  Branch (2075:6): [True: 148, False: 0]
  ------------------
 2076|    148|		return rx;
 2077|       |
 2078|      0|	free(rx);
 2079|      0|	return NULL;
 2080|    148|}
softmagic.c:handle_annotation:
 2447|   415k|{
 2448|   415k|	if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
  ------------------
  |  |   45|   415k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (2448:6): [True: 0, False: 415k]
  |  Branch (2448:35): [True: 0, False: 0]
  ------------------
 2449|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2449:7): [True: 0, False: 0]
  ------------------
 2450|      0|			return -1;
 2451|      0|		if (file_printf(ms, "%.8s", m->apple) == -1)
  ------------------
  |  Branch (2451:7): [True: 0, False: 0]
  ------------------
 2452|      0|			return -1;
 2453|      0|		return 1;
 2454|      0|	}
 2455|   415k|	if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
  ------------------
  |  |   46|   415k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (2455:6): [True: 0, False: 415k]
  |  Branch (2455:39): [True: 0, False: 0]
  ------------------
 2456|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2456:7): [True: 0, False: 0]
  ------------------
 2457|      0|			return -1;
 2458|      0|		if (file_printf(ms, "%s", m->ext) == -1)
  ------------------
  |  Branch (2458:7): [True: 0, False: 0]
  ------------------
 2459|      0|			return -1;
 2460|      0|		return 1;
 2461|      0|	}
 2462|   415k|	if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
  ------------------
  |  |   37|   415k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (2462:6): [True: 0, False: 415k]
  |  Branch (2462:39): [True: 0, False: 0]
  ------------------
 2463|      0|		char buf[1024];
 2464|      0|		const char *p;
 2465|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2465:7): [True: 0, False: 0]
  ------------------
 2466|      0|			return -1;
 2467|      0|		if (varexpand(ms, buf, sizeof(buf), m->mimetype) == -1)
  ------------------
  |  Branch (2467:7): [True: 0, False: 0]
  ------------------
 2468|      0|			p = m->mimetype;
 2469|      0|		else
 2470|      0|			p = buf;
 2471|      0|		if (file_printf(ms, "%s", p) == -1)
  ------------------
  |  Branch (2471:7): [True: 0, False: 0]
  ------------------
 2472|      0|			return -1;
 2473|      0|		return 1;
 2474|      0|	}
 2475|   415k|	return 0;
 2476|   415k|}
softmagic.c:varexpand:
  527|  95.3k|{
  528|  95.3k|	const char *ptr, *sptr, *e, *t, *ee, *et;
  529|  95.3k|	size_t l;
  530|       |
  531|  96.2k|	for (sptr = str; (ptr = strstr(sptr, "${")) != NULL;) {
  ------------------
  |  Branch (531:19): [True: 934, False: 95.3k]
  ------------------
  532|    934|		l = CAST(size_t, ptr - sptr);
  ------------------
  |  |  426|    934|#define CAST(T, b)	((T)(b))
  ------------------
  533|    934|		if (l >= len)
  ------------------
  |  Branch (533:7): [True: 0, False: 934]
  ------------------
  534|      0|			return -1;
  535|    934|		memcpy(buf, sptr, l);
  536|    934|		buf += l;
  537|    934|		len -= l;
  538|    934|		ptr += 2;
  539|    934|		if (!*ptr || ptr[1] != '?')
  ------------------
  |  Branch (539:7): [True: 0, False: 934]
  |  Branch (539:16): [True: 0, False: 934]
  ------------------
  540|      0|			return -1;
  541|  14.0k|		for (et = t = ptr + 2; *et && *et != ':'; et++)
  ------------------
  |  Branch (541:26): [True: 14.0k, False: 0]
  |  Branch (541:33): [True: 13.0k, False: 934]
  ------------------
  542|  13.0k|			continue;
  543|    934|		if (*et != ':')
  ------------------
  |  Branch (543:7): [True: 0, False: 934]
  ------------------
  544|      0|			return -1;
  545|  13.0k|		for (ee = e = et + 1; *ee && *ee != '}'; ee++)
  ------------------
  |  Branch (545:25): [True: 13.0k, False: 0]
  |  Branch (545:32): [True: 12.1k, False: 934]
  ------------------
  546|  12.1k|			continue;
  547|    934|		if (*ee != '}')
  ------------------
  |  Branch (547:7): [True: 0, False: 934]
  ------------------
  548|      0|			return -1;
  549|    934|		switch (*ptr) {
  550|    934|		case 'x':
  ------------------
  |  Branch (550:3): [True: 934, False: 0]
  ------------------
  551|    934|			if (ms->mode & 0111) {
  ------------------
  |  Branch (551:8): [True: 2, False: 932]
  ------------------
  552|      2|				ptr = t;
  553|      2|				l = et - t;
  554|    932|			} else {
  555|    932|				ptr = e;
  556|    932|				l = ee - e;
  557|    932|			}
  558|    934|			break;
  559|      0|		default:
  ------------------
  |  Branch (559:3): [True: 0, False: 934]
  ------------------
  560|      0|			return -1;
  561|    934|		}
  562|    934|		if (l >= len)
  ------------------
  |  Branch (562:7): [True: 0, False: 934]
  ------------------
  563|      0|			return -1;
  564|    934|		memcpy(buf, ptr, l);
  565|    934|		buf += l;
  566|    934|		len -= l;
  567|    934|		sptr = ee + 1;
  568|    934|	}
  569|       |
  570|  95.3k|	l = strlen(sptr);
  571|  95.3k|	if (l >= len)
  ------------------
  |  Branch (571:6): [True: 0, False: 95.3k]
  ------------------
  572|      0|		return -1;
  573|       |
  574|  95.3k|	memcpy(buf, sptr, l);
  575|  95.3k|	buf[l] = '\0';
  576|  95.3k|	return 0;
  577|  95.3k|}
softmagic.c:print_sep:
 2480|  16.7k|{
 2481|  16.7k|	if (firstline)
  ------------------
  |  Branch (2481:6): [True: 9.85k, False: 6.88k]
  ------------------
 2482|  9.85k|		return 0;
 2483|       |	/*
 2484|       |	 * we found another match
 2485|       |	 * put a newline and '-' to do some simple formatting
 2486|       |	 */
 2487|  6.88k|	return file_separator(ms);
 2488|  16.7k|}
softmagic.c:mprint:
  582|  95.3k|{
  583|  95.3k|	uint64_t v;
  584|  95.3k|	float vf;
  585|  95.3k|	double vd;
  586|  95.3k| 	char buf[128], tbuf[26], sbuf[512], ebuf[512];
  587|  95.3k|	const char *desc;
  588|  95.3k|	union VALUETYPE *p = &ms->ms_value;
  589|       |
  590|  95.3k|	if (varexpand(ms, ebuf, sizeof(ebuf), m->desc) == -1)
  ------------------
  |  Branch (590:6): [True: 0, False: 95.3k]
  ------------------
  591|      0|		desc = m->desc;
  592|  95.3k|	else
  593|  95.3k|		desc = ebuf;
  594|       |
  595|  95.3k|#define	PRINTER(value, format, stype, utype)	\
  596|  95.3k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  597|  95.3k|	switch (check_fmt(ms, desc)) { \
  598|  95.3k|	case -1: \
  599|  95.3k|		return -1; \
  600|  95.3k|	case 1: \
  601|  95.3k|		if (m->flag & UNSIGNED) { \
  602|  95.3k|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  603|  95.3k|			    CAST(utype, v)); \
  604|  95.3k|		} else { \
  605|  95.3k|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  606|  95.3k|			    CAST(stype, v)); \
  607|  95.3k|		} \
  608|  95.3k|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  609|  95.3k|			return -1; \
  610|  95.3k|		break; \
  611|  95.3k|	default: \
  612|  95.3k|		if (m->flag & UNSIGNED) { \
  613|  95.3k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  614|  95.3k|			   CAST(utype, v)) == -1) \
  615|  95.3k|			   return -1; \
  616|  95.3k|		} else { \
  617|  95.3k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  618|  95.3k|			   CAST(stype, v)) == -1) \
  619|  95.3k|			   return -1; \
  620|  95.3k|		} \
  621|  95.3k|		break; \
  622|  95.3k|	} \
  623|  95.3k|	break
  624|       |
  625|  95.3k|  	switch (m->type) {
  626|  25.4k|  	case FILE_BYTE:
  ------------------
  |  |  223|  25.4k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (626:4): [True: 25.4k, False: 69.8k]
  ------------------
  627|  25.4k|		PRINTER(p->b, "", int8_t, uint8_t);
  ------------------
  |  |  596|  25.4k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  426|  25.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  597|  25.4k|	switch (check_fmt(ms, desc)) { \
  |  |  598|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (598:2): [True: 0, False: 25.4k]
  |  |  ------------------
  |  |  599|      0|		return -1; \
  |  |  600|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (600:2): [True: 0, False: 25.4k]
  |  |  ------------------
  |  |  601|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (601:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  602|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  603|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  604|      0|		} else { \
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  606|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} \
  |  |  608|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (608:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  609|      0|			return -1; \
  |  |  610|      0|		break; \
  |  |  611|  25.4k|	default: \
  |  |  ------------------
  |  |  |  Branch (611:2): [True: 25.4k, False: 0]
  |  |  ------------------
  |  |  612|  25.4k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|  25.4k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (612:7): [True: 7.32k, False: 18.1k]
  |  |  ------------------
  |  |  613|  7.32k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  155|  7.32k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (613:14): [True: 0, False: 7.32k]
  |  |  ------------------
  |  |  614|  7.32k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  7.32k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  615|  7.32k|			   return -1; \
  |  |  616|  18.1k|		} else { \
  |  |  617|  18.1k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  155|  18.1k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 18.1k]
  |  |  ------------------
  |  |  618|  18.1k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  18.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  18.1k|			   return -1; \
  |  |  620|  18.1k|		} \
  |  |  621|  25.4k|		break; \
  |  |  622|  25.4k|	} \
  |  |  623|  25.4k|	break
  ------------------
  628|       |
  629|  25.4k|  	case FILE_SHORT:
  ------------------
  |  |  224|    807|#define				FILE_SHORT		2
  ------------------
  |  Branch (629:4): [True: 807, False: 94.5k]
  ------------------
  630|  5.66k|  	case FILE_BESHORT:
  ------------------
  |  |  229|  5.66k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (630:4): [True: 4.85k, False: 90.4k]
  ------------------
  631|  16.3k|  	case FILE_LESHORT:
  ------------------
  |  |  232|  16.3k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (631:4): [True: 10.6k, False: 84.6k]
  ------------------
  632|  16.3k|		PRINTER(p->h, "", int16_t, uint16_t);
  ------------------
  |  |  596|  16.3k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  426|  16.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  597|  16.3k|	switch (check_fmt(ms, desc)) { \
  |  |  598|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (598:2): [True: 0, False: 16.3k]
  |  |  ------------------
  |  |  599|      0|		return -1; \
  |  |  600|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (600:2): [True: 0, False: 16.3k]
  |  |  ------------------
  |  |  601|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (601:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  602|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  603|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  604|      0|		} else { \
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  606|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} \
  |  |  608|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (608:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  609|      0|			return -1; \
  |  |  610|      0|		break; \
  |  |  611|  16.3k|	default: \
  |  |  ------------------
  |  |  |  Branch (611:2): [True: 16.3k, False: 0]
  |  |  ------------------
  |  |  612|  16.3k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|  16.3k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (612:7): [True: 11.8k, False: 4.47k]
  |  |  ------------------
  |  |  613|  11.8k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  155|  11.8k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (613:14): [True: 0, False: 11.8k]
  |  |  ------------------
  |  |  614|  11.8k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  11.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  615|  11.8k|			   return -1; \
  |  |  616|  11.8k|		} else { \
  |  |  617|  4.47k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  155|  4.47k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 4.47k]
  |  |  ------------------
  |  |  618|  4.47k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  4.47k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  4.47k|			   return -1; \
  |  |  620|  4.47k|		} \
  |  |  621|  16.3k|		break; \
  |  |  622|  16.3k|	} \
  |  |  623|  16.3k|	break
  ------------------
  633|       |
  634|  16.3k|  	case FILE_LONG:
  ------------------
  |  |  226|  3.18k|#define				FILE_LONG		4
  ------------------
  |  Branch (634:4): [True: 3.18k, False: 92.1k]
  ------------------
  635|  16.6k|  	case FILE_BELONG:
  ------------------
  |  |  230|  16.6k|#define				FILE_BELONG		8
  ------------------
  |  Branch (635:4): [True: 13.4k, False: 81.8k]
  ------------------
  636|  28.5k|  	case FILE_LELONG:
  ------------------
  |  |  233|  28.5k|#define				FILE_LELONG		11
  ------------------
  |  Branch (636:4): [True: 11.8k, False: 83.5k]
  ------------------
  637|  28.5k|  	case FILE_MELONG:
  ------------------
  |  |  245|  28.5k|#define				FILE_MELONG		23
  ------------------
  |  Branch (637:4): [True: 0, False: 95.3k]
  ------------------
  638|  28.5k|		PRINTER(p->l, "", int32_t, uint32_t);
  ------------------
  |  |  596|  28.5k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  426|  28.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  597|  28.5k|	switch (check_fmt(ms, desc)) { \
  |  |  598|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (598:2): [True: 0, False: 28.5k]
  |  |  ------------------
  |  |  599|      0|		return -1; \
  |  |  600|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (600:2): [True: 0, False: 28.5k]
  |  |  ------------------
  |  |  601|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (601:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  602|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  603|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  604|      0|		} else { \
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  606|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} \
  |  |  608|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (608:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  609|      0|			return -1; \
  |  |  610|      0|		break; \
  |  |  611|  28.5k|	default: \
  |  |  ------------------
  |  |  |  Branch (611:2): [True: 28.5k, False: 0]
  |  |  ------------------
  |  |  612|  28.5k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|  28.5k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (612:7): [True: 26.9k, False: 1.55k]
  |  |  ------------------
  |  |  613|  26.9k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  155|  26.9k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (613:14): [True: 0, False: 26.9k]
  |  |  ------------------
  |  |  614|  26.9k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  26.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  615|  26.9k|			   return -1; \
  |  |  616|  26.9k|		} else { \
  |  |  617|  1.55k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  155|  1.55k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 1.55k]
  |  |  ------------------
  |  |  618|  1.55k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  1.55k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  1.55k|			   return -1; \
  |  |  620|  1.55k|		} \
  |  |  621|  28.5k|		break; \
  |  |  622|  28.5k|	} \
  |  |  623|  28.5k|	break
  ------------------
  639|       |
  640|  28.5k|  	case FILE_QUAD:
  ------------------
  |  |  246|     55|#define				FILE_QUAD		24
  ------------------
  |  Branch (640:4): [True: 55, False: 95.2k]
  ------------------
  641|  2.28k|  	case FILE_BEQUAD:
  ------------------
  |  |  248|  2.28k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (641:4): [True: 2.22k, False: 93.1k]
  ------------------
  642|  2.37k|  	case FILE_LEQUAD:
  ------------------
  |  |  247|  2.37k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (642:4): [True: 88, False: 95.2k]
  ------------------
  643|  2.37k|	case FILE_OFFSET:
  ------------------
  |  |  272|  2.37k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (643:2): [True: 4, False: 95.3k]
  ------------------
  644|  2.37k|		PRINTER(p->q, INT64_T_FORMAT, long long, unsigned long long);
  ------------------
  |  |  596|  2.37k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  426|  2.37k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  597|  2.37k|	switch (check_fmt(ms, desc)) { \
  |  |  598|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (598:2): [True: 0, False: 2.37k]
  |  |  ------------------
  |  |  599|      0|		return -1; \
  |  |  600|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (600:2): [True: 0, False: 2.37k]
  |  |  ------------------
  |  |  601|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (601:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  602|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  603|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  604|      0|		} else { \
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  606|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} \
  |  |  608|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (608:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  609|      0|			return -1; \
  |  |  610|      0|		break; \
  |  |  611|  2.37k|	default: \
  |  |  ------------------
  |  |  |  Branch (611:2): [True: 2.37k, False: 0]
  |  |  ------------------
  |  |  612|  2.37k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|  2.37k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (612:7): [True: 2.27k, False: 105]
  |  |  ------------------
  |  |  613|  2.27k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  155|  2.27k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (613:14): [True: 0, False: 2.27k]
  |  |  ------------------
  |  |  614|  2.27k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  2.27k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  615|  2.27k|			   return -1; \
  |  |  616|  2.27k|		} else { \
  |  |  617|    105|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  155|    105|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 105]
  |  |  ------------------
  |  |  618|    105|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|    105|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|    105|			   return -1; \
  |  |  620|    105|		} \
  |  |  621|  2.37k|		break; \
  |  |  622|  2.37k|	} \
  |  |  623|  2.37k|	break
  ------------------
  645|       |
  646|  11.8k|  	case FILE_STRING:
  ------------------
  |  |  227|  11.8k|#define				FILE_STRING		5
  ------------------
  |  Branch (646:4): [True: 11.8k, False: 83.4k]
  ------------------
  647|  14.7k|  	case FILE_PSTRING:
  ------------------
  |  |  235|  14.7k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (647:4): [True: 2.90k, False: 92.4k]
  ------------------
  648|  14.8k|  	case FILE_BESTRING16:
  ------------------
  |  |  240|  14.8k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (648:4): [True: 119, False: 95.2k]
  ------------------
  649|  15.1k|  	case FILE_LESTRING16:
  ------------------
  |  |  241|  15.1k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (649:4): [True: 280, False: 95.0k]
  ------------------
  650|  15.1k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (650:7): [True: 6.49k, False: 8.67k]
  |  Branch (650:25): [True: 134, False: 8.54k]
  ------------------
  651|  6.63k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|  6.63k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (651:8): [True: 0, False: 6.63k]
  ------------------
  652|  6.63k|			    file_printable(ms, sbuf, sizeof(sbuf), m->value.s,
  653|  6.63k|			    sizeof(m->value.s))) == -1)
  654|      0|				return -1;
  655|  6.63k|		}
  656|  8.54k|		else {
  657|  8.54k|			char *str = p->s;
  658|       |
  659|       |			/* compute t before we mangle the string? */
  660|       |
  661|  8.54k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (661:8): [True: 8.49k, False: 47]
  ------------------
  662|  8.49k|				str[strcspn(str, "\r\n")] = '\0';
  663|       |
  664|  8.54k|			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  357|  8.54k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  388|  8.54k|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  370|  8.54k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (664:8): [True: 88, False: 8.45k]
  ------------------
  665|     88|				str = file_strtrim(str);
  666|       |
  667|  8.54k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|  8.54k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (667:8): [True: 0, False: 8.54k]
  ------------------
  668|  8.54k|			    file_printable(ms, sbuf, sizeof(sbuf), str,
  669|  8.54k|				sizeof(p->s) - (str - p->s))) == -1)
  670|      0|				return -1;
  671|       |
  672|  8.54k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  235|  8.54k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (672:8): [True: 2.90k, False: 5.64k]
  ------------------
  673|  2.90k|				size_t l = file_pstring_length_size(ms, m);
  674|  2.90k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  158|  2.90k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|  2.90k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (674:9): [True: 0, False: 2.90k]
  ------------------
  675|      0|					return -1;
  676|  2.90k|			}
  677|  8.54k|		}
  678|  15.1k|		break;
  679|       |
  680|  15.1k|	case FILE_DATE:
  ------------------
  |  |  228|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (680:2): [True: 0, False: 95.3k]
  ------------------
  681|     76|	case FILE_BEDATE:
  ------------------
  |  |  231|     76|#define				FILE_BEDATE		9
  ------------------
  |  Branch (681:2): [True: 76, False: 95.2k]
  ------------------
  682|    262|	case FILE_LEDATE:
  ------------------
  |  |  234|    262|#define				FILE_LEDATE		12
  ------------------
  |  Branch (682:2): [True: 186, False: 95.1k]
  ------------------
  683|    278|	case FILE_MEDATE:
  ------------------
  |  |  243|    278|#define				FILE_MEDATE		21
  ------------------
  |  Branch (683:2): [True: 16, False: 95.3k]
  ------------------
  684|    278|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|    278|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (684:7): [True: 0, False: 278]
  ------------------
  685|    278|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, 0)) == -1)
  686|      0|			return -1;
  687|    278|		break;
  688|       |
  689|    278|	case FILE_LDATE:
  ------------------
  |  |  236|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (689:2): [True: 0, False: 95.3k]
  ------------------
  690|  5.17k|	case FILE_BELDATE:
  ------------------
  |  |  237|  5.17k|#define				FILE_BELDATE		15
  ------------------
  |  Branch (690:2): [True: 5.17k, False: 90.1k]
  ------------------
  691|  5.17k|	case FILE_LELDATE:
  ------------------
  |  |  238|  5.17k|#define				FILE_LELDATE		16
  ------------------
  |  Branch (691:2): [True: 0, False: 95.3k]
  ------------------
  692|  5.17k|	case FILE_MELDATE:
  ------------------
  |  |  244|  5.17k|#define				FILE_MELDATE		22
  ------------------
  |  Branch (692:2): [True: 0, False: 95.3k]
  ------------------
  693|  5.17k|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|  5.17k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (693:7): [True: 0, False: 5.17k]
  ------------------
  694|  5.17k|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, FILE_T_LOCAL))
  ------------------
  |  |  508|  5.17k|#define FILE_T_LOCAL	1
  ------------------
  695|  5.17k|			== -1)
  696|      0|			return -1;
  697|  5.17k|		break;
  698|       |
  699|  5.17k|	case FILE_QDATE:
  ------------------
  |  |  249|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (699:2): [True: 0, False: 95.3k]
  ------------------
  700|      0|	case FILE_BEQDATE:
  ------------------
  |  |  251|      0|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (700:2): [True: 0, False: 95.3k]
  ------------------
  701|      0|	case FILE_LEQDATE:
  ------------------
  |  |  250|      0|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (701:2): [True: 0, False: 95.3k]
  ------------------
  702|      0|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (702:7): [True: 0, False: 0]
  ------------------
  703|      0|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, 0)) == -1)
  704|      0|			return -1;
  705|      0|		break;
  706|       |
  707|      0|	case FILE_QLDATE:
  ------------------
  |  |  252|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (707:2): [True: 0, False: 95.3k]
  ------------------
  708|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  254|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (708:2): [True: 0, False: 95.3k]
  ------------------
  709|      0|	case FILE_LEQLDATE:
  ------------------
  |  |  253|      0|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (709:2): [True: 0, False: 95.3k]
  ------------------
  710|      0|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (710:7): [True: 0, False: 0]
  ------------------
  711|      0|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_LOCAL)) == -1)
  ------------------
  |  |  508|      0|#define FILE_T_LOCAL	1
  ------------------
  712|      0|			return -1;
  713|      0|		break;
  714|       |
  715|    297|	case FILE_QWDATE:
  ------------------
  |  |  264|    297|#define				FILE_QWDATE		42
  ------------------
  |  Branch (715:2): [True: 297, False: 95.0k]
  ------------------
  716|    297|	case FILE_BEQWDATE:
  ------------------
  |  |  266|    297|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (716:2): [True: 0, False: 95.3k]
  ------------------
  717|    297|	case FILE_LEQWDATE:
  ------------------
  |  |  265|    297|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (717:2): [True: 0, False: 95.3k]
  ------------------
  718|    297|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|    297|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (718:7): [True: 0, False: 297]
  ------------------
  719|    297|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_WINDOWS))
  ------------------
  |  |  509|    297|#define FILE_T_WINDOWS	2
  ------------------
  720|    297|		    == -1)
  721|      0|			return -1;
  722|    297|		break;
  723|       |
  724|    297|	case FILE_FLOAT:
  ------------------
  |  |  255|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (724:2): [True: 0, False: 95.3k]
  ------------------
  725|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  256|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (725:2): [True: 0, False: 95.3k]
  ------------------
  726|    176|	case FILE_LEFLOAT:
  ------------------
  |  |  257|    176|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (726:2): [True: 176, False: 95.1k]
  ------------------
  727|    176|		vf = p->f;
  728|    176|		switch (check_fmt(ms, desc)) {
  729|      0|		case -1:
  ------------------
  |  Branch (729:3): [True: 0, False: 176]
  ------------------
  730|      0|			return -1;
  731|      0|		case 1:
  ------------------
  |  Branch (731:3): [True: 0, False: 176]
  ------------------
  732|      0|			(void)snprintf(buf, sizeof(buf), "%g", vf);
  733|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (733:8): [True: 0, False: 0]
  ------------------
  734|      0|				return -1;
  735|      0|			break;
  736|    176|		default:
  ------------------
  |  Branch (736:3): [True: 176, False: 0]
  ------------------
  737|    176|			if (file_printf(ms, F(ms, desc, "%g"), vf) == -1)
  ------------------
  |  |  155|    176|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (737:8): [True: 0, False: 176]
  ------------------
  738|      0|				return -1;
  739|    176|			break;
  740|    176|		}
  741|    176|  		break;
  742|       |
  743|    176|	case FILE_DOUBLE:
  ------------------
  |  |  258|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (743:2): [True: 0, False: 95.3k]
  ------------------
  744|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  259|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (744:2): [True: 0, False: 95.3k]
  ------------------
  745|    166|	case FILE_LEDOUBLE:
  ------------------
  |  |  260|    166|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (745:2): [True: 166, False: 95.1k]
  ------------------
  746|    166|		vd = p->d;
  747|    166|		switch (check_fmt(ms, desc)) {
  748|      0|		case -1:
  ------------------
  |  Branch (748:3): [True: 0, False: 166]
  ------------------
  749|      0|			return -1;
  750|      0|		case 1:
  ------------------
  |  Branch (750:3): [True: 0, False: 166]
  ------------------
  751|      0|			(void)snprintf(buf, sizeof(buf), "%g", vd);
  752|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (752:8): [True: 0, False: 0]
  ------------------
  753|      0|				return -1;
  754|      0|			break;
  755|    166|		default:
  ------------------
  |  Branch (755:3): [True: 166, False: 0]
  ------------------
  756|    166|			if (file_printf(ms, F(ms, desc, "%g"), vd) == -1)
  ------------------
  |  |  155|    166|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (756:8): [True: 0, False: 166]
  ------------------
  757|      0|				return -1;
  758|    166|			break;
  759|    166|		}
  760|    166|  		break;
  761|       |
  762|    259|	case FILE_SEARCH:
  ------------------
  |  |  242|    259|#define				FILE_SEARCH		20
  ------------------
  |  Branch (762:2): [True: 259, False: 95.0k]
  ------------------
  763|    350|	case FILE_REGEX: {
  ------------------
  |  |  239|    350|#define				FILE_REGEX		17
  ------------------
  |  Branch (763:2): [True: 91, False: 95.2k]
  ------------------
  764|    350|		char *cp, *scp;
  765|    350|		int rval;
  766|       |
  767|    350|		cp = strndup(RCAST(const char *, ms->search.s),
  ------------------
  |  |  427|    350|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  768|    350|		    ms->search.rm_len);
  769|    350|		if (cp == NULL) {
  ------------------
  |  Branch (769:7): [True: 0, False: 350]
  ------------------
  770|      0|			file_oomem(ms, ms->search.rm_len);
  771|      0|			return -1;
  772|      0|		}
  773|    350|		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  357|    350|#define str_flags _u._s._flags
  ------------------
              		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  388|    350|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  370|    350|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (773:9): [True: 19, False: 331]
  ------------------
  774|       |
  775|    350|		rval = file_printf(ms, F(ms, desc, "%s"), file_printable(ms,
  ------------------
  |  |  155|    350|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  776|    350|		    sbuf, sizeof(sbuf), scp, ms->search.rm_len));
  777|    350|		free(cp);
  778|       |
  779|    350|		if (rval == -1)
  ------------------
  |  Branch (779:7): [True: 0, False: 350]
  ------------------
  780|      0|			return -1;
  781|    350|		break;
  782|    350|	}
  783|       |
  784|    350|	case FILE_DEFAULT:
  ------------------
  |  |  225|    166|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (784:2): [True: 166, False: 95.1k]
  ------------------
  785|    169|	case FILE_CLEAR:
  ------------------
  |  |  269|    169|#define				FILE_CLEAR		47
  ------------------
  |  Branch (785:2): [True: 3, False: 95.3k]
  ------------------
  786|    169|	  	if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (786:9): [True: 0, False: 169]
  ------------------
  787|      0|			return -1;
  788|    169|		break;
  789|       |
  790|    348|	case FILE_INDIRECT:
  ------------------
  |  |  263|    348|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (790:2): [True: 348, False: 94.9k]
  ------------------
  791|    348|	case FILE_USE:
  ------------------
  |  |  268|    348|#define				FILE_USE		46
  ------------------
  |  Branch (791:2): [True: 0, False: 95.3k]
  ------------------
  792|    499|	case FILE_NAME:
  ------------------
  |  |  267|    499|#define				FILE_NAME		45
  ------------------
  |  Branch (792:2): [True: 151, False: 95.1k]
  ------------------
  793|    499|		break;
  794|    177|	case FILE_DER:
  ------------------
  |  |  270|    177|#define				FILE_DER		48
  ------------------
  |  Branch (794:2): [True: 177, False: 95.1k]
  ------------------
  795|    177|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|    177|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (795:7): [True: 0, False: 177]
  ------------------
  796|    177|		    file_printable(ms, sbuf, sizeof(sbuf), ms->ms_value.s,
  797|    177|			sizeof(ms->ms_value.s))) == -1)
  798|      0|			return -1;
  799|    177|		break;
  800|    186|	case FILE_GUID:
  ------------------
  |  |  271|    186|#define				FILE_GUID		49
  ------------------
  |  Branch (800:2): [True: 186, False: 95.1k]
  ------------------
  801|    186|		(void) file_print_guid(buf, sizeof(buf), ms->ms_value.guid);
  802|    186|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  155|    186|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (802:7): [True: 0, False: 186]
  ------------------
  803|      0|			return -1;
  804|    186|		break;
  805|    186|	case FILE_MSDOSDATE:
  ------------------
  |  |  275|      0|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (805:2): [True: 0, False: 95.3k]
  ------------------
  806|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  277|      0|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (806:2): [True: 0, False: 95.3k]
  ------------------
  807|      0|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  276|      0|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (807:2): [True: 0, False: 95.3k]
  ------------------
  808|      0|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (808:7): [True: 0, False: 0]
  ------------------
  809|      0|		    file_fmtdate(tbuf, sizeof(tbuf), p->h)) == -1)
  810|      0|			return -1;
  811|      0|		break;
  812|      0|	case FILE_MSDOSTIME:
  ------------------
  |  |  278|      0|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (812:2): [True: 0, False: 95.3k]
  ------------------
  813|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  280|      0|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (813:2): [True: 0, False: 95.3k]
  ------------------
  814|      0|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  279|      0|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (814:2): [True: 0, False: 95.3k]
  ------------------
  815|      0|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (815:7): [True: 0, False: 0]
  ------------------
  816|      0|		    file_fmttime(tbuf, sizeof(tbuf), p->h)) == -1)
  817|      0|			return -1;
  818|      0|		break;
  819|      0|	case FILE_OCTAL:
  ------------------
  |  |  281|      0|#define				FILE_OCTAL		59
  ------------------
  |  Branch (819:2): [True: 0, False: 95.3k]
  ------------------
  820|      0|		file_fmtnum(buf, sizeof(buf), m->value.s, 8);
  821|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  155|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (821:7): [True: 0, False: 0]
  ------------------
  822|      0|			return -1;
  823|      0|		break;
  824|      0|	default:
  ------------------
  |  Branch (824:2): [True: 0, False: 95.3k]
  ------------------
  825|      0|		file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
  826|      0|		return -1;
  827|  95.3k|	}
  828|  95.3k|	return 0;
  829|  95.3k|}
softmagic.c:check_fmt:
  486|  73.0k|{
  487|  73.0k|	file_regex_t rx;
  488|  73.0k|	int rc, rv = -1;
  489|  73.0k|        const char* pat = "%[-0-9\\.]*s";
  490|       |
  491|  73.0k|	if (strchr(fmt, '%') == NULL)
  ------------------
  |  Branch (491:6): [True: 41.1k, False: 31.8k]
  ------------------
  492|  41.1k|		return 0;
  493|       |
  494|  31.8k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED|REG_NOSUB);
  495|  31.8k|	if (rc == 0) {
  ------------------
  |  Branch (495:6): [True: 31.8k, False: 0]
  ------------------
  496|  31.8k|		rc = file_regexec(ms, &rx, fmt, 0, 0, 0);
  497|  31.8k|		rv = !rc;
  498|  31.8k|	}
  499|  31.8k|	file_regfree(&rx);
  500|  31.8k|	return rv;
  501|  73.0k|}
softmagic.c:moffset:
  834|   415k|{
  835|   415k|	size_t nbytes = b->flen;
  836|   415k|	int32_t o;
  837|       |
  838|   415k|  	switch (m->type) {
  839|   134k|  	case FILE_BYTE:
  ------------------
  |  |  223|   134k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (839:4): [True: 134k, False: 280k]
  ------------------
  840|   134k|		o = CAST(int32_t, (ms->offset + sizeof(char)));
  ------------------
  |  |  426|   134k|#define CAST(T, b)	((T)(b))
  ------------------
  841|   134k|		break;
  842|       |
  843|  13.3k|  	case FILE_SHORT:
  ------------------
  |  |  224|  13.3k|#define				FILE_SHORT		2
  ------------------
  |  Branch (843:4): [True: 13.3k, False: 401k]
  ------------------
  844|  32.8k|  	case FILE_BESHORT:
  ------------------
  |  |  229|  32.8k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (844:4): [True: 19.5k, False: 395k]
  ------------------
  845|  57.3k|  	case FILE_LESHORT:
  ------------------
  |  |  232|  57.3k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (845:4): [True: 24.4k, False: 390k]
  ------------------
  846|  57.3k|	case FILE_MSDOSDATE:
  ------------------
  |  |  275|  57.3k|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (846:2): [True: 0, False: 415k]
  ------------------
  847|  57.3k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  276|  57.3k|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (847:2): [True: 0, False: 415k]
  ------------------
  848|  57.3k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  277|  57.3k|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (848:2): [True: 0, False: 415k]
  ------------------
  849|  57.3k|	case FILE_MSDOSTIME:
  ------------------
  |  |  278|  57.3k|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (849:2): [True: 0, False: 415k]
  ------------------
  850|  57.3k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  279|  57.3k|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (850:2): [True: 0, False: 415k]
  ------------------
  851|  57.3k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  280|  57.3k|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (851:2): [True: 0, False: 415k]
  ------------------
  852|  57.3k|		o = CAST(int32_t, (ms->offset + sizeof(short)));
  ------------------
  |  |  426|  57.3k|#define CAST(T, b)	((T)(b))
  ------------------
  853|  57.3k|		break;
  854|       |
  855|  6.32k|  	case FILE_LONG:
  ------------------
  |  |  226|  6.32k|#define				FILE_LONG		4
  ------------------
  |  Branch (855:4): [True: 6.32k, False: 408k]
  ------------------
  856|  60.4k|  	case FILE_BELONG:
  ------------------
  |  |  230|  60.4k|#define				FILE_BELONG		8
  ------------------
  |  Branch (856:4): [True: 54.0k, False: 361k]
  ------------------
  857|  93.8k|  	case FILE_LELONG:
  ------------------
  |  |  233|  93.8k|#define				FILE_LELONG		11
  ------------------
  |  Branch (857:4): [True: 33.4k, False: 381k]
  ------------------
  858|  93.8k|  	case FILE_MELONG:
  ------------------
  |  |  245|  93.8k|#define				FILE_MELONG		23
  ------------------
  |  Branch (858:4): [True: 0, False: 415k]
  ------------------
  859|  93.8k|		o = CAST(int32_t, (ms->offset + sizeof(int32_t)));
  ------------------
  |  |  426|  93.8k|#define CAST(T, b)	((T)(b))
  ------------------
  860|  93.8k|		break;
  861|       |
  862|  17.3k|  	case FILE_QUAD:
  ------------------
  |  |  246|  17.3k|#define				FILE_QUAD		24
  ------------------
  |  Branch (862:4): [True: 17.3k, False: 397k]
  ------------------
  863|  21.3k|  	case FILE_BEQUAD:
  ------------------
  |  |  248|  21.3k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (863:4): [True: 3.91k, False: 411k]
  ------------------
  864|  21.6k|  	case FILE_LEQUAD:
  ------------------
  |  |  247|  21.6k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (864:4): [True: 309, False: 414k]
  ------------------
  865|  21.6k|		o = CAST(int32_t, (ms->offset + sizeof(int64_t)));
  ------------------
  |  |  426|  21.6k|#define CAST(T, b)	((T)(b))
  ------------------
  866|  21.6k|		break;
  867|       |
  868|  43.6k|  	case FILE_STRING:
  ------------------
  |  |  227|  43.6k|#define				FILE_STRING		5
  ------------------
  |  Branch (868:4): [True: 43.6k, False: 371k]
  ------------------
  869|  46.5k|  	case FILE_PSTRING:
  ------------------
  |  |  235|  46.5k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (869:4): [True: 2.90k, False: 412k]
  ------------------
  870|  46.6k|  	case FILE_BESTRING16:
  ------------------
  |  |  240|  46.6k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (870:4): [True: 119, False: 414k]
  ------------------
  871|  46.9k|  	case FILE_LESTRING16:
  ------------------
  |  |  241|  46.9k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (871:4): [True: 280, False: 414k]
  ------------------
  872|  46.9k|	case FILE_OCTAL:
  ------------------
  |  |  281|  46.9k|#define				FILE_OCTAL		59
  ------------------
  |  Branch (872:2): [True: 0, False: 415k]
  ------------------
  873|  46.9k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (873:7): [True: 12.9k, False: 34.0k]
  |  Branch (873:25): [True: 1.17k, False: 32.8k]
  ------------------
  874|  14.1k|			o = ms->offset + m->vallen;
  875|  32.8k|		} else {
  876|  32.8k|			union VALUETYPE *p = &ms->ms_value;
  877|       |
  878|  32.8k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (878:8): [True: 24.0k, False: 8.83k]
  ------------------
  879|  24.0k|				p->s[strcspn(p->s, "\r\n")] = '\0';
  880|  32.8k|			o = CAST(uint32_t, (ms->offset + strlen(p->s)));
  ------------------
  |  |  426|  32.8k|#define CAST(T, b)	((T)(b))
  ------------------
  881|  32.8k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  235|  32.8k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (881:8): [True: 2.90k, False: 29.9k]
  ------------------
  882|  2.90k|				size_t l = file_pstring_length_size(ms, m);
  883|  2.90k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  158|  2.90k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|  2.90k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (883:9): [True: 0, False: 2.90k]
  ------------------
  884|      0|					return -1;
  885|  2.90k|				o += CAST(uint32_t, l);
  ------------------
  |  |  426|  2.90k|#define CAST(T, b)	((T)(b))
  ------------------
  886|  2.90k|			}
  887|  32.8k|		}
  888|  46.9k|		break;
  889|       |
  890|  46.9k|	case FILE_DATE:
  ------------------
  |  |  228|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (890:2): [True: 0, False: 415k]
  ------------------
  891|     76|	case FILE_BEDATE:
  ------------------
  |  |  231|     76|#define				FILE_BEDATE		9
  ------------------
  |  Branch (891:2): [True: 76, False: 415k]
  ------------------
  892|    262|	case FILE_LEDATE:
  ------------------
  |  |  234|    262|#define				FILE_LEDATE		12
  ------------------
  |  Branch (892:2): [True: 186, False: 414k]
  ------------------
  893|    278|	case FILE_MEDATE:
  ------------------
  |  |  243|    278|#define				FILE_MEDATE		21
  ------------------
  |  Branch (893:2): [True: 16, False: 415k]
  ------------------
  894|    278|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  426|    278|#define CAST(T, b)	((T)(b))
  ------------------
  895|    278|		break;
  896|       |
  897|      0|	case FILE_LDATE:
  ------------------
  |  |  236|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (897:2): [True: 0, False: 415k]
  ------------------
  898|  5.17k|	case FILE_BELDATE:
  ------------------
  |  |  237|  5.17k|#define				FILE_BELDATE		15
  ------------------
  |  Branch (898:2): [True: 5.17k, False: 409k]
  ------------------
  899|  5.17k|	case FILE_LELDATE:
  ------------------
  |  |  238|  5.17k|#define				FILE_LELDATE		16
  ------------------
  |  Branch (899:2): [True: 0, False: 415k]
  ------------------
  900|  5.17k|	case FILE_MELDATE:
  ------------------
  |  |  244|  5.17k|#define				FILE_MELDATE		22
  ------------------
  |  Branch (900:2): [True: 0, False: 415k]
  ------------------
  901|  5.17k|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  426|  5.17k|#define CAST(T, b)	((T)(b))
  ------------------
  902|  5.17k|		break;
  903|       |
  904|      0|	case FILE_QDATE:
  ------------------
  |  |  249|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (904:2): [True: 0, False: 415k]
  ------------------
  905|      0|	case FILE_BEQDATE:
  ------------------
  |  |  251|      0|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (905:2): [True: 0, False: 415k]
  ------------------
  906|      0|	case FILE_LEQDATE:
  ------------------
  |  |  250|      0|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (906:2): [True: 0, False: 415k]
  ------------------
  907|      0|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  908|      0|		break;
  909|       |
  910|      0|	case FILE_QLDATE:
  ------------------
  |  |  252|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (910:2): [True: 0, False: 415k]
  ------------------
  911|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  254|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (911:2): [True: 0, False: 415k]
  ------------------
  912|      0|	case FILE_LEQLDATE:
  ------------------
  |  |  253|      0|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (912:2): [True: 0, False: 415k]
  ------------------
  913|      0|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  914|      0|		break;
  915|       |
  916|      0|  	case FILE_FLOAT:
  ------------------
  |  |  255|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (916:4): [True: 0, False: 415k]
  ------------------
  917|      0|  	case FILE_BEFLOAT:
  ------------------
  |  |  256|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (917:4): [True: 0, False: 415k]
  ------------------
  918|    176|  	case FILE_LEFLOAT:
  ------------------
  |  |  257|    176|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (918:4): [True: 176, False: 414k]
  ------------------
  919|    176|		o = CAST(int32_t, (ms->offset + sizeof(float)));
  ------------------
  |  |  426|    176|#define CAST(T, b)	((T)(b))
  ------------------
  920|    176|		break;
  921|       |
  922|      0|  	case FILE_DOUBLE:
  ------------------
  |  |  258|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (922:4): [True: 0, False: 415k]
  ------------------
  923|      0|  	case FILE_BEDOUBLE:
  ------------------
  |  |  259|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (923:4): [True: 0, False: 415k]
  ------------------
  924|    166|  	case FILE_LEDOUBLE:
  ------------------
  |  |  260|    166|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (924:4): [True: 166, False: 414k]
  ------------------
  925|    166|		o = CAST(int32_t, (ms->offset + sizeof(double)));
  ------------------
  |  |  426|    166|#define CAST(T, b)	((T)(b))
  ------------------
  926|    166|		break;
  927|       |
  928|    654|	case FILE_REGEX:
  ------------------
  |  |  239|    654|#define				FILE_REGEX		17
  ------------------
  |  Branch (928:2): [True: 654, False: 414k]
  ------------------
  929|    654|		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  357|    654|#define str_flags _u._s._flags
  ------------------
              		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  375|    654|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  370|    654|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (929:7): [True: 24, False: 630]
  ------------------
  930|     24|			o = CAST(int32_t, ms->search.offset);
  ------------------
  |  |  426|     24|#define CAST(T, b)	((T)(b))
  ------------------
  931|    630|		else
  932|    630|			o = CAST(int32_t,
  ------------------
  |  |  426|    630|#define CAST(T, b)	((T)(b))
  ------------------
  933|    654|			    (ms->search.offset + ms->search.rm_len));
  934|    654|		break;
  935|       |
  936|  6.33k|	case FILE_SEARCH:
  ------------------
  |  |  242|  6.33k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (936:2): [True: 6.33k, False: 408k]
  ------------------
  937|  6.33k|		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  357|  6.33k|#define str_flags _u._s._flags
  ------------------
              		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  375|  6.33k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  370|  6.33k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (937:7): [True: 82, False: 6.25k]
  ------------------
  938|     82|			o = CAST(int32_t, ms->search.offset);
  ------------------
  |  |  426|     82|#define CAST(T, b)	((T)(b))
  ------------------
  939|  6.25k|		else
  940|  6.25k|			o = CAST(int32_t, (ms->search.offset + m->vallen));
  ------------------
  |  |  426|  6.25k|#define CAST(T, b)	((T)(b))
  ------------------
  941|  6.33k|		break;
  942|       |
  943|  1.37k|	case FILE_CLEAR:
  ------------------
  |  |  269|  1.37k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (943:2): [True: 1.37k, False: 413k]
  ------------------
  944|  6.88k|	case FILE_DEFAULT:
  ------------------
  |  |  225|  6.88k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (944:2): [True: 5.50k, False: 409k]
  ------------------
  945|  12.2k|	case FILE_INDIRECT:
  ------------------
  |  |  263|  12.2k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (945:2): [True: 5.31k, False: 409k]
  ------------------
  946|  12.2k|	case FILE_OFFSET:
  ------------------
  |  |  272|  12.2k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (946:2): [True: 32, False: 415k]
  ------------------
  947|  21.8k|	case FILE_USE:
  ------------------
  |  |  268|  21.8k|#define				FILE_USE		46
  ------------------
  |  Branch (947:2): [True: 9.66k, False: 405k]
  ------------------
  948|  21.8k|		o = ms->offset;
  949|  21.8k|		break;
  950|       |
  951|  12.8k|	case FILE_DER:
  ------------------
  |  |  270|  12.8k|#define				FILE_DER		48
  ------------------
  |  Branch (951:2): [True: 12.8k, False: 402k]
  ------------------
  952|  12.8k|		o = der_offs(ms, m, nbytes);
  953|  12.8k|		if (o == -1 || CAST(size_t, o) > nbytes) {
  ------------------
  |  |  426|  12.8k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (953:7): [True: 0, False: 12.8k]
  |  Branch (953:18): [True: 0, False: 12.8k]
  ------------------
  954|      0|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (954:8): [True: 0, False: 0]
  ------------------
  955|      0|				(void)fprintf(stderr,
  956|      0|				    "Bad DER offset %d nbytes=%"
  957|      0|				    SIZE_T_FORMAT "u", o, nbytes);
  958|      0|			}
  959|      0|			*op = 0;
  960|      0|			return 0;
  961|      0|		}
  962|  12.8k|		break;
  963|       |
  964|  12.8k|	case FILE_GUID:
  ------------------
  |  |  271|    186|#define				FILE_GUID		49
  ------------------
  |  Branch (964:2): [True: 186, False: 414k]
  ------------------
  965|    186|		o = CAST(int32_t, (ms->offset + 2 * sizeof(uint64_t)));
  ------------------
  |  |  426|    186|#define CAST(T, b)	((T)(b))
  ------------------
  966|    186|		break;
  967|       |
  968|  13.2k|	default:
  ------------------
  |  Branch (968:2): [True: 13.2k, False: 401k]
  ------------------
  969|  13.2k|		o = 0;
  970|  13.2k|		break;
  971|   415k|	}
  972|       |
  973|   415k|	if (CAST(size_t, o) > nbytes) {
  ------------------
  |  |  426|   415k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (973:6): [True: 18.1k, False: 396k]
  ------------------
  974|       |#if 0
  975|       |		file_error(ms, 0, "Offset out of range %" SIZE_T_FORMAT
  976|       |		    "u > %" SIZE_T_FORMAT "u", (size_t)o, nbytes);
  977|       |#endif
  978|  18.1k|		return -1;
  979|  18.1k|	}
  980|   396k|	*op = o;
  981|   396k|	return 1;
  982|   415k|}

strlcpy:
   35|   145k|{
   36|   145k|	char *d = dst;
   37|   145k|	const char *s = src;
   38|   145k|	size_t n = siz;
   39|       |
   40|       |	/* Copy as many bytes as will fit */
   41|   145k|	if (n != 0 && --n != 0) {
  ------------------
  |  Branch (41:6): [True: 145k, False: 0]
  |  Branch (41:16): [True: 145k, False: 0]
  ------------------
   42|   661k|		do {
   43|   661k|			if ((*d++ = *s++) == 0)
  ------------------
  |  Branch (43:8): [True: 145k, False: 516k]
  ------------------
   44|   145k|				break;
   45|   661k|		} while (--n != 0);
  ------------------
  |  Branch (45:12): [True: 516k, False: 10]
  ------------------
   46|   145k|	}
   47|       |
   48|       |	/* Not enough room in dst, add NUL and traverse rest of src */
   49|   145k|	if (n == 0) {
  ------------------
  |  Branch (49:6): [True: 10, False: 145k]
  ------------------
   50|     10|		if (siz != 0)
  ------------------
  |  Branch (50:7): [True: 10, False: 0]
  ------------------
   51|     10|			*d = '\0';		/* NUL-terminate dst */
   52|     10|		while (*s++)
  ------------------
  |  Branch (52:10): [True: 0, False: 10]
  ------------------
   53|      0|			;
   54|     10|	}
   55|       |
   56|   145k|	return(s - src - 1);	/* count does not include NUL */
   57|   145k|}

_ZN19FuzzerTemporaryFileC2EPKhm:
   70|  10.5k|            : filename_(fuzzer_get_tmpfile(data, size)) {}
magic_fuzzer_fd.cc:_ZL18fuzzer_get_tmpfilePKhm:
   29|  10.5k|static char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {
   30|  10.5k|    char* filename_buffer = strdup("/tmp/generate_temporary_file.XXXXXX");
   31|  10.5k|    if (!filename_buffer) {
  ------------------
  |  Branch (31:9): [True: 0, False: 10.5k]
  ------------------
   32|      0|        perror("Failed to allocate file name buffer.");
   33|      0|        abort();
   34|      0|    }
   35|  10.5k|    const int file_descriptor = mkstemp(filename_buffer);
   36|  10.5k|    if (file_descriptor < 0) {
  ------------------
  |  Branch (36:9): [True: 0, False: 10.5k]
  ------------------
   37|      0|        perror("Failed to make temporary file.");
   38|      0|        abort();
   39|      0|    }
   40|  10.5k|    FILE* file = fdopen(file_descriptor, "wb");
   41|  10.5k|    if (!file) {
  ------------------
  |  Branch (41:9): [True: 0, False: 10.5k]
  ------------------
   42|      0|        perror("Failed to open file descriptor.");
   43|      0|        close(file_descriptor);
   44|      0|        abort();
   45|      0|    }
   46|  10.5k|    const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);
   47|  10.5k|    if (bytes_written < size) {
  ------------------
  |  Branch (47:9): [True: 0, False: 10.5k]
  ------------------
   48|      0|        close(file_descriptor);
   49|      0|        fprintf(stderr, "Failed to write all bytes to file (%zu out of %zu)",
   50|      0|                bytes_written, size);
   51|      0|        abort();
   52|      0|    }
   53|  10.5k|    fclose(file);
   54|  10.5k|    return filename_buffer;
   55|  10.5k|}
_ZNK19FuzzerTemporaryFile8filenameEv:
   74|  10.5k|        const char* filename() const { return filename_; }
_ZN19FuzzerTemporaryFileD2Ev:
   72|  10.5k|        ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }
magic_fuzzer_fd.cc:_ZL22fuzzer_release_tmpfilePc:
   57|  10.5k|static void fuzzer_release_tmpfile(char* filename) {
   58|  10.5k|    if (unlink(filename) != 0) {
  ------------------
  |  Branch (58:9): [True: 0, False: 10.5k]
  ------------------
   59|      0|        perror("WARNING: Failed to delete temporary file.");
   60|      0|    }
   61|  10.5k|    free(filename);
   62|  10.5k|}

LLVMFuzzerInitialize:
   42|      2|extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) {
   43|      2|  char* exe_path = (*argv)[0];
   44|       |  // dirname() can modify its argument.
   45|      2|  char* exe_path_copy = strdup(exe_path);
   46|      2|  char* dir = dirname(exe_path_copy);
   47|      2|  env = new Environment(dir);
   48|      2|  free(exe_path_copy);
   49|      2|  return 0;
   50|      2|}
LLVMFuzzerTestOneInput:
   52|  10.5k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   53|  10.5k|  FuzzerTemporaryFile ftf (data, size);
   54|  10.5k|  int fd = open(ftf.filename(), O_RDONLY);
   55|  10.5k|  magic_descriptor(env->magic, fd);
   56|  10.5k|  close(fd);
   57|  10.5k|  return 0;
   58|  10.5k|}
_ZN11EnvironmentC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   28|      2|  Environment(std::string data_dir) {
   29|      2|    magic = magic_open(MAGIC_COMPRESS|MAGIC_CONTINUE);
  ------------------
  |  |   35|      2|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
                  magic = magic_open(MAGIC_COMPRESS|MAGIC_CONTINUE);
  ------------------
  |  |   38|      2|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
   30|      2|    std::string magic_path = data_dir + "/magic";
   31|      2|    if (magic_load(magic, magic_path.c_str())) {
  ------------------
  |  Branch (31:9): [True: 0, False: 2]
  ------------------
   32|      0|      fprintf(stderr, "error loading magic file: %s\n", magic_error(magic));
   33|      0|      exit(1);
   34|      0|    }
   35|      2|  }

